From 71ea4da3184759d078054d1df9302bebb27fd3a7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 17 May 2026 05:52:35 +0000 Subject: [PATCH] s --- .../live-product/LiveControlApp.tsx | 1 + .../live-product/LiveYoutubeUnmannedView.tsx | 19 ++++++++++++++----- d2ypp2/web-console/out/404.html | 2 +- ...3d2c60f238.js => page-a22341e1f7071ab6.js} | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 d2ypp2/web-console/out/android.html | 2 +- d2ypp2/web-console/out/android.txt | 2 +- d2ypp2/web-console/out/console.html | 2 +- d2ypp2/web-console/out/console.txt | 2 +- d2ypp2/web-console/out/index.html | 2 +- d2ypp2/web-console/out/index.txt | 4 ++-- d2ypp2/web-console/out/shellcrash.html | 2 +- d2ypp2/web-console/out/shellcrash.txt | 2 +- 14 files changed, 26 insertions(+), 16 deletions(-) rename d2ypp2/web-console/out/_next/static/chunks/app/{page-9b99cd3d2c60f238.js => page-a22341e1f7071ab6.js} (58%) rename d2ypp2/web-console/out/_next/static/{lVyIIaGIEEEd2dYJHSxM8 => nIVEbaa7YzQOC_jRgGVnk}/_buildManifest.js (100%) rename d2ypp2/web-console/out/_next/static/{lVyIIaGIEEEd2dYJHSxM8 => nIVEbaa7YzQOC_jRgGVnk}/_ssgManifest.js (100%) diff --git a/d2ypp2/web-console/components/live-product/LiveControlApp.tsx b/d2ypp2/web-console/components/live-product/LiveControlApp.tsx index 6d84977..4000194 100644 --- a/d2ypp2/web-console/components/live-product/LiveControlApp.tsx +++ b/d2ypp2/web-console/components/live-product/LiveControlApp.tsx @@ -1290,6 +1290,7 @@ export default function LiveControlApp() { fetchJson={fetchJson} liveProcesses={processRows.length ? processRows : (dash?.live?.processes ?? [])} notify={notify} + quickLinks={ql} onNavigate={(target: PortalNavTarget) => setView(target)} /> ) : null} diff --git a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx index c2fdab6..5054725 100644 --- a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx +++ b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx @@ -553,6 +553,10 @@ export function LiveYoutubeUnmannedView({ const active = channels.find((c) => c.id === activeCh) || channels[0]; const activeSavedUrlDraft = useMemo(() => (active?.urlLines ?? "").trim(), [active?.urlLines]); + const activeUrlDirty = useMemo( + () => (active ? proUrlDraft !== (active.urlLines ?? "").trim() : false), + [active, proUrlDraft], + ); const activeLaneDraft = useMemo( () => (active ? laneDrafts[active.id] ?? laneDraftFromChannel(active) : null), [active, laneDrafts], @@ -659,7 +663,9 @@ export function LiveYoutubeUnmannedView({ const setModePersist = useCallback( (m: "single" | "pro") => { if (m === "single" && mode === "pro" && active) { - persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x))); + if (activeUrlDirty) { + persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x))); + } } if (m === "pro" && channels.length) { const first = channels[0]; @@ -691,6 +697,7 @@ export function LiveYoutubeUnmannedView({ [ mode, active, + activeUrlDirty, channels, proUrlDraft, ytFields.key, @@ -704,7 +711,7 @@ export function LiveYoutubeUnmannedView({ const selectProChannel = useCallback( (c: YoutubeProChannel) => { - if (active && mode === "pro") { + if (active && mode === "pro" && activeUrlDirty) { persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x))); } const u = (c.urlLines ?? "").trim(); @@ -712,7 +719,7 @@ export function LiveYoutubeUnmannedView({ setActiveCh(c.id); setCurrentProc(resolveChannelPm2(c)); }, - [active, mode, channels, proUrlDraft, setCurrentProc, persistChannels], + [active, activeUrlDirty, mode, channels, proUrlDraft, setCurrentProc, persistChannels], ); useEffect(() => { @@ -931,8 +938,10 @@ export function LiveYoutubeUnmannedView({ await Promise.resolve(onSaveUrlConfig(proUrlDraft, saved.pm2)); urlListDirtyRef.current = false; setLaneStatus(t("线路与地址已保存", "Lane settings and URLs saved")); - } catch { - /* parent 已 toast */ + } catch (e) { + const message = e instanceof Error ? e.message : String(e); + setLaneStatus(message); + notify(message); } finally { setLaneSaving(false); } diff --git a/d2ypp2/web-console/out/404.html b/d2ypp2/web-console/out/404.html index 67f3ffc..d5bb8d9 100644 --- a/d2ypp2/web-console/out/404.html +++ b/d2ypp2/web-console/out/404.html @@ -1 +1 @@ -404: This page could not be found.无人直播系统 · live.local

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.无人直播系统 · live.local

404

This page could not be found.

\ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/page-9b99cd3d2c60f238.js b/d2ypp2/web-console/out/_next/static/chunks/app/page-a22341e1f7071ab6.js similarity index 58% rename from d2ypp2/web-console/out/_next/static/chunks/app/page-9b99cd3d2c60f238.js rename to d2ypp2/web-console/out/_next/static/chunks/app/page-a22341e1f7071ab6.js index caa9bd9..f5616b9 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/page-9b99cd3d2c60f238.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/page-a22341e1f7071ab6.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{4578:function(e,t,s){Promise.resolve().then(s.bind(s,1499))},1499:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return e4}});var n=s(7437),l=s(6247),i=s(7586),a=s(4401),r=s(6137),o=s(4372),c=s(5901),d=s(3388),x=s(3420),m=s(8728),u=s(2023),h=s(407),p=s(6840),b=s(7226),g=s(5929),f=s(7945),v=s(1817),y=s(7168),w=s(4822),j=s(4428),N=s(1723),k=s(2926),z=s(7580),S=s(2489),_=s(2265);function C(e){let{tr:t}=e,l=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e;if(!l.current)return;let t=!1,n=0;return s.e(689).then(s.bind(s,1448)).then(s=>{if(t||!l.current)return;let i=l.current,a=Math.max(i.clientWidth,280),r=Math.max(i.clientHeight,200),o=new s.Scene,c=new s.PerspectiveCamera(48,a/r,.1,80);c.position.set(0,1.1,7.2);let d=new s.WebGLRenderer({antialias:!0,alpha:!0});d.setPixelRatio(Math.min(window.devicePixelRatio,2)),d.setSize(a,r),d.setClearColor(0,0),i.appendChild(d.domElement);let x=new s.HemisphereLight(16762092,4482815,.85);o.add(x);let m=new s.DirectionalLight(16777215,.9);m.position.set(4,8,6),o.add(m);let u=new s.PointLight(8189439,.6,20);u.position.set(-3,2,-2),o.add(u);let h=new s.Group,p=new s.Mesh(new s.BoxGeometry(3.2,.35,2.2),new s.MeshStandardMaterial({color:2762048,metalness:.15,roughness:.55}));p.position.y=-.85,h.add(p);let b=new s.Mesh(new s.TorusGeometry(.72,.09,12,48),new s.MeshStandardMaterial({color:16724821,emissive:4456465,metalness:.35,roughness:.25}));b.rotation.x=Math.PI/2,b.position.set(-.85,.15,.2),h.add(b);let g=new s.Mesh(new s.ConeGeometry(.35,.5,3),new s.MeshStandardMaterial({color:16777215,emissive:2236962,metalness:.2,roughness:.3}));g.rotation.z=-Math.PI/2,g.rotation.y=Math.PI,g.position.set(-.55,.18,.2),h.add(g);let f=new s.Mesh(new s.CylinderGeometry(.22,.28,.95,20),new s.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}));f.position.set(1.05,.35,-.15),f.rotation.z=.12,h.add(f);let v=new s.Mesh(new s.SphereGeometry(.26,16,16),new s.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}));v.position.set(1.05,.92,-.15),h.add(v);let y=new s.BufferGeometry,w=new Float32Array(360);for(let e=0;e<120;e++)w[3*e]=(Math.random()-.5)*14,w[3*e+1]=(Math.random()-.3)*8,w[3*e+2]=(Math.random()-.5)*8-2;y.setAttribute("position",new s.BufferAttribute(w,3));let j=new s.Points(y,new s.PointsMaterial({color:16777215,size:.06,transparent:!0,opacity:.7}));o.add(j),o.add(h);let N=performance.now(),k=()=>{if(t)return;n=requestAnimationFrame(k);let e=(performance.now()-N)/1e3;h.rotation.y=.25*Math.sin(.35*e)+.12*e,h.position.y=.06*Math.sin(.9*e),b.rotation.z=.4*e,j.rotation.y=.02*e,d.render(o,c)};k();let z=new ResizeObserver(()=>{if(!l.current||t)return;let e=Math.max(l.current.clientWidth,280),s=Math.max(l.current.clientHeight,200);c.aspect=e/s,c.updateProjectionMatrix(),d.setSize(e,s)});z.observe(i),e=()=>{cancelAnimationFrame(n),z.disconnect(),d.dispose(),y.dispose(),d.domElement.parentNode===i&&i.removeChild(d.domElement)}}),()=>{t=!0,cancelAnimationFrame(n),null==e||e()}},[]),(0,n.jsxs)("div",{className:"flex h-full min-h-[14rem] flex-col",children:[(0,n.jsx)("p",{className:"mb-2 px-1 text-[10px] font-medium uppercase tracking-wider text-fuchsia-200/80",children:t("直播工作室 \xb7 3D","Live studio \xb7 3D")}),(0,n.jsx)("div",{ref:l,className:"relative min-h-[12rem] flex-1 overflow-hidden rounded-xl bg-gradient-to-b from-fuchsia-950/40 to-cyan-950/20 ring-1 ring-white/10"})]})}var R=s(9170),P=s(2246),L=s(4286),M=s(4794),U=s(221),T=s(8867),I=s(8124),E=s(2101),A=s(3651),D=s(9985),Z=s(6362),O=s(3468),H=s(6443),B=s(5287),K=s(3276),W=s(9227),F=s(257),Y=s(1387);class J{reset(){if(this.buf=new Uint8Array(0),this.sps=null,this.pps=null,this.configured=!1,this.configuring=!1,this.ts=0,this.decoder){try{this.decoder.close()}catch(e){}this.decoder=null}}push(e){let t=new Uint8Array(e.byteLength);t.set(new Uint8Array(e)),this.buf=function(e,t){let s=new Uint8Array(e.length+t.length);return s.set(e,0),s.set(t,e.length),s}(this.buf,t),this.drainAvcc()}drainAvcc(){let e=this.buf,t=0;for(;t+4<=e.length;){var s;let n=e[s=t]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3];if(n<=0||n>6291456){this.buf=new Uint8Array(e.subarray(t+1)),t=0;continue}if(t+4+n>e.length)break;let l=e.subarray(t+4,t+4+n);t+=4+n,this.handleNal(l)}t>0&&(this.buf=new Uint8Array(e.subarray(t)))}handleNal(e){if(e.length<2)return;let t=31&e[0];if(7===t?this.sps=new Uint8Array(e):8===t&&(this.pps=new Uint8Array(e)),this.sps&&this.pps&&!this.configured&&!this.configuring&&this.configure(),!this.configured||!this.decoder||1!==t&&5!==t&&7!==t&&8!==t||7===t||8===t)return;let s=new Uint8Array(4+e.length);new DataView(s.buffer).setUint32(0,e.length,!1),s.set(e,4);try{let e=new EncodedVideoChunk({type:5===t?"key":"delta",timestamp:this.ts,data:s});this.ts+=33333,this.decoder.decode(e)}catch(e){this.onDecodeError(e.message||String(e))}}async configure(){if(this.sps&&this.pps&&!this.configured&&!this.configuring){this.configuring=!0;try{let e=function(e,t){let s=e.subarray(1),n=t.subarray(1),l=new Uint8Array(11+s.length+3+n.length),i=0;return l[i++]=1,l[i++]=e[1],l[i++]=e[2],l[i++]=e[3],l[i++]=255,l[i++]=225,l[i++]=s.length>>8&255,l[i++]=255&s.length,l.set(s,i),i+=s.length,l[i++]=1,l[i++]=n.length>>8&255,l[i++]=255&n.length,l.set(n,i),l}(this.sps,this.pps),t=function(e){let t=e=>e.toString(16).padStart(2,"0").toUpperCase();return"avc1.".concat(t(e[1])).concat(t(e[2])).concat(t(e[3]))}(this.sps),s=new VideoDecoder({output:e=>{let t=this.canvas.getContext("2d");if(!t){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),t.drawImage(e,0,0),e.close()},error:e=>this.onDecodeError(String(e.message||e))});await s.configure({codec:t,description:e,optimizeForLatency:!0}),this.decoder=s,this.configured=!0}catch(e){this.onDecodeError(e.message||String(e))}finally{this.configuring=!1}}}constructor(e,t){this.canvas=e,this.onDecodeError=t,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function G(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let V="live-hub-adb-bookmarks-v1";function q(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.width,c=e.height;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let m=t-r.left-i,u=s-r.top-a;return m<0||u<0||m>n||u>l?null:{x:Math.max(0,Math.min(o-1,Math.round(m/n*o))),y:Math.max(0,Math.min(c-1,Math.round(u/l*c)))}}function X(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let m=t-r.left-i,u=s-r.top-a;return m<0||u<0||m>n||u>l?null:{x:Math.max(0,Math.min(o-1,Math.round(m/n*o))),y:Math.max(0,Math.min(c-1,Math.round(u/l*c)))}}let $=[0,280,450,700,1100];function Q(e){switch(e){case"usb":return{Icon:E.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:k.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:A.Z,zh:"模拟器",en:"Emu",cls:"bg-fuchsia-500/20 text-fuchsia-100 ring-fuchsia-500/35"};default:return{Icon:d.Z,zh:"?",en:"?",cls:"bg-zinc-600/30 text-zinc-400"}}}let ee="https://github.com/Genymobile/scrcpy",et="https://github.com/viarotel-org/escrcpy";function es(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function en(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:a,devices:r,setSerial:o,adbAvailable:c,lock:x,overview:m,onAndroidAction:h,notify:p,onRefreshDevices:b}=e,[g,f]=(0,_.useState)(0),[v,w]=(0,_.useState)(450),[j,N]=(0,_.useState)(!1),[k,z]=(0,_.useState)(null),[S,C]=(0,_.useState)(null),[R,P]=(0,_.useState)(!0),[L,M]=(0,_.useState)(""),[U,T]=(0,_.useState)(""),[I,E]=(0,_.useState)("37777"),[A,en]=(0,_.useState)(""),[el,ei]=(0,_.useState)(!1),[ea,er]=(0,_.useState)([]),[eo,ec]=(0,_.useState)(!1),[ed,ex]=(0,_.useState)(null),[em,eu]=(0,_.useState)(!1),[eh,ep]=(0,_.useState)(null),[eb,eg]=(0,_.useState)(null),ef=(0,_.useRef)(null),ev=(0,_.useRef)(null),ey=(0,_.useRef)(null),ew=(0,_.useRef)(null),ej=(0,_.useRef)(null),eN=(0,_.useRef)(null),ek=(0,_.useRef)(0),ez=null===(t=r.find(e=>e.serial===a))||void 0===t?void 0:t.transport,eS=v>0,e_=a?"".concat(es(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(a),"&ts=").concat(g).concat(eS?"&fast=1":""):"",eC=(0,_.useCallback)(()=>{f(e=>e+1)},[]);(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(V);if(e){let t=JSON.parse(e);Array.isArray(t)&&er(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eR=e=>{let t=e.trim();if(!t)return;let n=[t,...ea.filter(e=>e!==t)].slice(0,16);er(n);try{window.localStorage.setItem(V,JSON.stringify(n))}catch(e){}p(s("已保存快捷地址","Saved quick address"))};(0,_.useEffect)(()=>{if(!a||!c){C(null);return}let e=!1;return(async()=>{try{let t=await (0,Y.N)("".concat(es(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(a)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&C({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,a]),(0,_.useEffect)(()=>{if(!c||!a||v<=0||eo)return;let e=window.setInterval(()=>f(e=>e+1),v);return()=>clearInterval(e)},[c,v,a,eo]),(0,_.useEffect)(()=>{if(!c){eg(null);return}let e=!1;return(async()=>{try{let t=await (0,Y.N)(es(l,"/android/scrcpy/info"));e||eg(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,_.useEffect)(()=>{eo||ep(null)},[eo]),(0,_.useEffect)(()=>{ex(null)},[a]),(0,_.useEffect)(()=>{let e=r.find(e=>e.serial===a),t=!!(a&&ed===a);if(c&&a&&(null==e?void 0:e.state)==="device"&&(null==eb?void 0:eb.server_jar)&&G()&&!t){ec(!0),w(0);return}if(t||!a||!c||eb&&!eb.server_jar||!G()||e&&"device"!==e.state){ec(!1);return}},[a,r,c,eb,ed]),(0,_.useEffect)(()=>{if(!eo||!a||!c){var e,t;null===(e=ew.current)||void 0===e||e.close(),ew.current=null,null===(t=ej.current)||void 0===t||t.reset(),ej.current=null,eu(!1);return}if(!G()){ep(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),ec(!1);return}let n=ey.current;if(!n)return;let i=new J(n,e=>ep(e));ej.current=i;let r=new WebSocket(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920,n=(function(e){let t=(e||"").trim();if(t)try{let e=new URL(t,window.location.href),s="https:"===e.protocol?"wss:":"ws:";return"".concat(s,"//").concat(e.host)}catch(e){}let s=void 0!==F&&F.env.NEXT_PUBLIC_API_URL?String(F.env.NEXT_PUBLIC_API_URL).trim():"";if(s)try{let e=new URL(s,window.location.href),t="https:"===e.protocol?"wss:":"ws:";return"".concat(t,"//").concat(e.host)}catch(e){}let n=window.location.port;if("3000"===n||"3001"===n){let e=window.location.hostname||"127.0.0.1";return"ws://".concat(e,":").concat("8001")}let{protocol:l,host:i}=window.location;return"".concat("https:"===l?"wss:":"ws:","//").concat(i)})(e).replace(/\/$/,""),l=new URLSearchParams({serial:t,max_size:String(s)});return"".concat(n,"/android/scrcpy/ws?").concat(l.toString())}(l,a));return ew.current=r,r.binaryType="arraybuffer",r.onopen=()=>{eu(!0),ep(null)},r.onmessage=e=>{var t;if("string"==typeof e.data){try{let t=JSON.parse(e.data);t.error&&ep(t.error)}catch(e){}return}null===(t=ej.current)||void 0===t||t.push(e.data)},r.onerror=()=>{ep(s("WebSocket 异常","WebSocket error"))},r.onclose=()=>{var e;eu(!1),null===(e=ej.current)||void 0===e||e.reset(),ej.current=null},()=>{r.close(),ew.current=null,i.reset(),ej.current===i&&(ej.current=null)}},[eo,a,c,l,s]),(0,_.useEffect)(()=>{a&&c&&(ek.current=0,f(e=>e+1))},[a,c]);let eP=async()=>{let e=L.trim();if(!e){p(s("填写 host:port","Enter host:port"));return}ei(!0);try{let t=await i("/android/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||(t.ok?"OK":s("连接结果见日志","See message"))),b(),eC()}catch(e){p(e.message)}finally{ei(!1)}},eL=async e=>{ei(!0);try{let t=await i("/android/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||"OK"),b()}catch(e){p(e.message)}finally{ei(!1)}},eM=async()=>{let e=U.trim(),t=parseInt(I,10)||37777,n=A.trim();if(!e||!n){p(s("填写配对 IP 与码","Host + code required"));return}ei(!0);try{let l=await i("/android/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:e,port:t,code:n})});p(l.message||(l.ok?s("配对成功后再点连接","Paired — now Connect"):"pair"))}catch(e){p(e.message)}finally{ei(!1)}},eU=async e=>{if(!R||x||!c||!a)return;let t=ev.current;if(!t)return;let n=X(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ef.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ef.current=null,await h("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ef.current={t:l,x:n.x,y:n.y},await h("tap",{x:n.x,y:n.y})),eC()},eT=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ev.current;if(!t)return;let n=X(t,e.clientX,e.clientY);n&&(await h("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eC())},eI=async e=>{if(!R||x||!c||!a)return;let t=ey.current;if(!t)return;let n=q(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ef.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ef.current=null,await h("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ef.current={t:l,x:n.x,y:n.y},await h("tap",{x:n.x,y:n.y})),eo||eC()},eE=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ey.current;if(!t)return;let n=q(t,e.clientX,e.clientY);n&&(await h("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eo||eC())};if(!c)return(0,n.jsx)("div",{className:"rounded-2xl border border-amber-500/25 bg-amber-500/[0.06] p-6 text-center text-sm text-amber-200/90",children:s("宿主机未安装 adb,无法使用 Live 控制台。","adb is required for the Live console.")});let eA=Q(ez),eD=eA.Icon;return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-sky-500/20 bg-gradient-to-br from-sky-500/[0.08] via-zinc-950/80 to-zinc-900/90 p-4 ring-1 ring-white/[0.05]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)(D.Z,{className:"h-4 w-4 text-sky-400"}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:s("链路管理","Link manager")}),(0,n.jsx)("span",{className:"text-[10px] text-zinc-500",children:s("USB / Redroid :5555 / 无线调试(先配对再连接)","USB \xb7 Redroid :5555 \xb7 wireless (pair then connect)")})]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb connect"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("input",{className:"min-w-[12rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-3 py-2 font-mono text-xs text-zinc-200",placeholder:"192.168.1.10:5555",value:L,onChange:e=>M(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eP()}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eP(),className:"rounded-lg bg-sky-500/25 px-3 py-2 text-xs font-semibold text-sky-100 ring-1 ring-sky-400/40",children:el?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:el||x||!L.trim(),onClick:()=>eR(L),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),ea.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ea.map(e=>(0,n.jsx)("button",{type:"button",className:"rounded-md bg-white/[0.06] px-2 py-0.5 font-mono text-[10px] text-zinc-400 hover:bg-white/10",onClick:()=>M(e),children:e},e))}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,n.jsx)("button",{type:"button",disabled:el||x||!a,onClick:()=>void eL(a),className:"rounded-lg border border-rose-500/30 bg-rose-500/10 px-2.5 py-1.5 text-[10px] text-rose-200",children:s("断开当前 TCP","Disconnect current")}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eL(""),className:"rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-500 hover:text-zinc-300",children:s("断开全部 TCP","Disconnect all TCP")}),(0,n.jsxs)("button",{type:"button",disabled:el||x,onClick:()=>{b(),eC(),p(s("已刷新设备列表","Devices refreshed"))},className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)(y.Z,{className:"h-3 w-3"}),"ADB list"]})]})]}),(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb pair(无线调试)"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("input",{className:"w-32 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"IP",value:U,onChange:e=>T(e.target.value)}),(0,n.jsx)("input",{className:"w-20 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"port",value:I,onChange:e=>E(e.target.value)}),(0,n.jsx)("input",{className:"min-w-[6rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs tracking-widest",placeholder:"123456",value:A,onChange:e=>en(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eM(),className:"rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-400/35",children:"Pair"})]}),(0,n.jsx)("p",{className:"text-[10px] leading-relaxed text-zinc-600",children:s("手机上「无线调试」会显示配对端口与 6 位码;配对成功后用上方 connect 连接 adb 显示的 IP:5555。","Use the pairing port + 6-digit code from Wireless debugging; then connect to the listed adb IP:5555.")})]})]})]}),(0,n.jsxs)("div",{className:"relative overflow-hidden rounded-3xl border border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.12] via-zinc-950/90 to-violet-500/[0.08] p-1 shadow-2xl shadow-emerald-900/20 ring-1 ring-white/[0.06]",children:[(0,n.jsx)("div",{className:"pointer-events-none absolute -right-20 -top-20 h-56 w-56 rounded-full bg-emerald-500/10 blur-3xl","aria-hidden":!0}),(0,n.jsxs)("div",{className:"relative rounded-[1.35rem] border border-white/[0.06] bg-zinc-950/80 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-emerald-400/30 to-violet-500/25 ring-1 ring-white/10",children:(0,n.jsx)(u.Z,{className:"h-6 w-6 text-emerald-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-semibold tracking-tight text-white",children:s("无人直播系统 \xb7 ADB 云控台","Unmanned Live System \xb7 ADB farm console")}),(0,n.jsxs)("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-zinc-500",children:[s("统一适配 USB / Redroid / 无线 adb:已授权设备默认走官方 scrcpy-server 的 WebSocket H.264 真流(与桌面 ","USB / Redroid / wireless adb: authorized devices default to official scrcpy-server WebSocket H.264 (same stack as "),(0,n.jsx)("a",{href:et,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:ee,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"scrcpy"}),s(");无 jar 或关闭真流时用截图。","); PNG screenshot when jar missing or stream off.")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 self-start sm:flex-row",children:[(0,n.jsxs)("a",{href:et,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["escrcpy",(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:ee,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["scrcpy",(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 opacity-70"})]})]})]}),r.length>0?(0,n.jsxs)("div",{className:"mt-5",children:[(0,n.jsxs)("p",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:[(0,n.jsx)(O.Z,{className:"h-3.5 w-3.5"}),s("设备矩阵","Device matrix")]}),(0,n.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:r.map(e=>{let t="device"===e.state,l=a===e.serial,i=Q(e.transport),r=i.Icon;return(0,n.jsxs)("button",{type:"button",onClick:()=>o(e.serial),className:"flex min-w-[9rem] flex-col rounded-xl border px-3 py-2 text-left transition ".concat(l?"border-emerald-500/50 bg-emerald-500/15 ring-1 ring-emerald-400/30":"border-white/10 bg-black/30 hover:border-white/20"),children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-zinc-200",children:[(0,n.jsx)(d.Z,{className:"h-3.5 w-3.5 text-emerald-400/80"}),(0,n.jsx)("span",{className:"truncate",children:e.model||e.serial.slice(0,10)})]}),(0,n.jsx)("span",{className:"mt-0.5 truncate font-mono text-[9px] text-zinc-600",children:e.serial}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 text-[9px] font-semibold ring-1 ".concat(i.cls),children:[(0,n.jsx)(r,{className:"h-2.5 w-2.5"}),s(i.zh,i.en)]}),(0,n.jsx)("span",{className:"rounded-md px-1.5 py-0.5 text-[9px] font-semibold ".concat(t?"bg-emerald-500/20 text-emerald-200":"bg-zinc-600/30 text-zinc-500"),children:e.state})]})]},e.serial)})})]}):null,(0,n.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-12",children:[(0,n.jsxs)("div",{className:"xl:col-span-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("刷新间隔","Interval")}),$.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>w(e),className:"rounded-lg px-2.5 py-1 text-[10px] font-semibold transition ".concat(v===e?"bg-violet-500/25 text-violet-100 ring-1 ring-violet-400/35":"bg-black/30 text-zinc-500 hover:text-zinc-300"),children:0===e?s("手动","Manual"):"".concat(e,"ms")},e)),(0,n.jsxs)("span",{className:"ml-1 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[9px] font-medium ring-1 ".concat(eA.cls),children:[(0,n.jsx)(eD,{className:"h-3 w-3"}),"tcp"===ez?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.jsxs)("button",{type:"button",disabled:x,onClick:()=>void eC(),className:"ml-auto inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-2.5 py-1 text-[10px] text-zinc-300 hover:bg-white/[0.08]",children:[(0,n.jsx)(y.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>void h("wake"),className:"rounded-lg bg-amber-500/20 px-2.5 py-1 text-[10px] font-semibold text-amber-100 ring-1 ring-amber-500/30",children:"Wake"}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/50",checked:R,onChange:e=>P(e.target.checked)}),(0,n.jsx)(H.Z,{className:"h-3 w-3"}),s("点按穿透","Tap-through")]}),(0,n.jsxs)("button",{type:"button",disabled:x||!a||!(null==eb?void 0:eb.server_jar),title:eb&&!eb.server_jar&&eb.hint_zh?eb.hint_zh:s("官方 scrcpy-server + WebSocket H.264","Official scrcpy-server + WebSocket H.264"),onClick:()=>{ec(e=>{let t=!e;return t?(ex(null),p(s("已开启实时画面(H.264 WebSocket)","Live H.264 WebSocket stream on"))):(a&&ex(a),p(s("已关闭实时画面(将使用截图)","Live stream off — screenshot mode"))),t})},className:"inline-flex items-center gap-1 rounded-lg border px-2.5 py-1 text-[10px] font-semibold transition ".concat(eo?"border-cyan-400/50 bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/35":"border-white/10 bg-black/30 text-zinc-400 hover:text-zinc-200"),children:[(0,n.jsx)(B.Z,{className:"h-3 w-3"}),eo?s("关闭真流","Stop WS"):s("实时画面","Live H.264")]})]}),eb&&!eb.server_jar?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-amber-200/80",children:[s("未检测到 scrcpy-server:启动时会自动拉取;内网可在 runtime.env 配置 SCRCPY_SERVER_DOWNLOAD_URL(支持 {tag})。","scrcpy-server missing: auto-fetched on startup; set SCRCPY_SERVER_DOWNLOAD_URL ({tag}) for mirrors."),eb.server_version?" (".concat(s("期望版本","version")," ").concat(eb.server_version,")"):null]}):null,(0,n.jsx)("p",{className:"mt-2 text-[10px] text-zinc-600",children:s("快捷键(镜像区聚焦时):H Home \xb7 B Back \xb7 R 多任务 \xb7 W 唤醒 \xb7 M 菜单","Hotkeys (mirror focused): H Home \xb7 B Back \xb7 R Recents \xb7 W Wake \xb7 M Menu")}),(0,n.jsxs)("div",{className:"relative mx-auto mt-4 max-h-[min(78vh,720px)] min-h-[280px]",children:[a?(0,n.jsxs)("div",{ref:eN,tabIndex:0,onKeyDown:e=>{if(!a||x)return;let t=e.target.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;let s={h:["key",{keycode:"3"}],b:["key",{keycode:"4"}],r:["key",{keycode:"187"}],w:["wake",void 0],m:["key",{keycode:"82"}]}[e.key.toLowerCase()];s&&(e.preventDefault(),(async()=>{await h(s[0],s[1]),eo||eC()})())},className:"relative flex justify-center outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50",children:[(0,n.jsxs)("div",{className:"relative rounded-[2rem] border-[10px] border-zinc-800 bg-black shadow-inner shadow-black/80 ring-1 ring-white/10",style:{maxHeight:"min(72vh, 680px)"},children:[(0,n.jsx)("div",{className:"absolute left-1/2 top-0 z-10 h-5 w-24 -translate-x-1/2 rounded-b-xl bg-black/80"}),eo?(0,n.jsx)("canvas",{ref:ey,className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(R?"cursor-crosshair":"cursor-default"),draggable:!1,onClick:eI,onContextMenu:eE}):(0,n.jsx)("img",{ref:ev,src:e_||void 0,alt:"device",className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(R?"cursor-crosshair":"cursor-default"),draggable:!1,onLoadStart:()=>{N(!0)},onLoad:()=>{N(!1),ek.current=0,z(null)},onError:()=>{N(!1),ek.current+=1,ek.current<=3?(z(null),window.setTimeout(()=>eC(),380+200*ek.current)):z(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eU,onContextMenu:eT})]}),em?(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-cyan-500/90 px-2 py-0.5 text-[9px] font-bold text-cyan-950 shadow-lg",children:[(0,n.jsx)(B.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):v>0&&!eo?(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-emerald-500/90 px-2 py-0.5 text-[9px] font-bold text-emerald-950 shadow-lg",children:[(0,n.jsx)(K.Z,{className:"h-3 w-3"}),"LIVE"]}):eo?null:(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-zinc-700/90 px-2 py-0.5 text-[9px] font-bold text-zinc-200",children:[(0,n.jsx)(W.Z,{className:"h-3 w-3"}),s("单帧","Still")]})]}):(0,n.jsx)("p",{className:"py-16 text-center text-sm text-zinc-600",children:s("请选择或连接设备","Pick or connect a device")}),eh?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:eh}):null,k&&!eo?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:k}):null,(0,n.jsx)("p",{className:"mt-3 text-center text-[10px] text-zinc-600",children:s("左键单击 / 双击 \xb7 右键长按 \xb7 坐标对齐 PNG 像素","Left tap/double \xb7 right long-press \xb7 PNG pixel coords")})]})]}),(0,n.jsxs)("div",{className:"space-y-4 xl:col-span-4",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("遥测","Telemetry")}),m?(0,n.jsxs)("dl",{className:"mt-3 space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"device"}),(0,n.jsxs)("dd",{className:"text-right text-zinc-200",children:[m.brand," ",m.model]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Android"}),(0,n.jsxs)("dd",{className:"text-zinc-300",children:[m.android_version," (API ",m.sdk,")"]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"wm size"}),(0,n.jsx)("dd",{className:"text-cyan-300/90",children:S?"".concat(S.width,"\xd7").concat(S.height):m.resolution||"—"})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:m.battery})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-600",children:s("在上方点「刷新设备信息」","Use Refresh device info above")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-b from-violet-500/[0.08] to-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:s("导航坞","Nav dock")}),(0,n.jsx)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[["3","Home"],["4","Back"],["187","Recents"]].map(e=>{let[t,s]=e;return(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:t}),eC()},className:"rounded-xl border border-white/10 bg-white/[0.06] py-3 text-xs font-semibold text-zinc-200 hover:bg-white/[0.1]",children:s},t)})}),(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:"24"}),eC()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:"25"}),eC()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol−"})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-cyan-500/[0.05] p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-cyan-300/80",children:s("手势","Gestures")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("swipe",{direction:e}),eC()},className:"rounded-lg border border-white/10 bg-black/30 py-2 font-mono text-[10px] uppercase text-zinc-300",children:e},e))})]})]})]})]})]})]})}let el=[{label:"getprop",cmd:"getprop ro.build.version.release"},{label:"top pkg",cmd:"dumpsys activity activities | grep -E 'mResumedActivity' | tail -n 1"},{label:"usb",cmd:"dumpsys usb | head -n 60"},{label:"surface",cmd:"dumpsys SurfaceFlinger | head -n 40"}];function ei(e,t,s){return e?(0,n.jsx)("span",{className:"rounded bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-200",children:t}):(0,n.jsx)("span",{className:"rounded bg-zinc-500/15 px-2 py-0.5 text-[10px] text-zinc-400",children:s})}function ea(e){var t,s,l,i,a,r,o,c,d,x,m,u,h,p,b;let{t:g,notify:f,fetchJson:y,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:z,adbAvailable:S,apkPath:C,setApkPath:R,onAndroidAction:P,onCopy:E,onRefreshDevices:A}=e,[D,Z]=(0,_.useState)(null),[O,H]=(0,_.useState)(null),[B,K]=(0,_.useState)(null),[W,F]=(0,_.useState)(null),[Y,J]=(0,_.useState)(""),[G,V]=(0,_.useState)([]),[q,X]=(0,_.useState)("getprop ro.product.model"),[$,Q]=(0,_.useState)(""),[ee,et]=(0,_.useState)("300"),[es,ea]=(0,_.useState)(""),[er,eo]=(0,_.useState)(null),[ec,ed]=(0,_.useState)([]),[ex,em]=(0,_.useState)(null),[eu,eh]=(0,_.useState)("https://"),[ep,eb]=(0,_.useState)(""),[eg,ef]=(0,_.useState)(!1),[ev,ey]=(0,_.useState)(null),ew=!!(j||ev),ej=z.find(e=>e.serial===N)||null,eN=(0,_.useCallback)(async()=>{if(!N||!S){Z(null),H(null);return}ey("overview"),H(null);try{let e=await y("/android/overview?serial=".concat(encodeURIComponent(N)));Z(e)}catch(e){Z(null),H(e.message)}finally{ey(null)}},[S,N,y]),ek=(0,_.useCallback)(async()=>{F(null);try{let e=await y("/redroid/summary");K(e)}catch(e){K(null),F(e.message)}},[y]);(0,_.useEffect)(()=>{eN()},[eN]),(0,_.useEffect)(()=>{ek()},[ek]);let ez=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await y("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));V(t.packages||[])}catch(e){f(e.message),V([])}finally{ey(null)}},eS=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}let e=q.trim();if(e){ey("shell");try{var t,s;let n=await y("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"shell",serial:N,payload:{command:e}})});Q(null!==(s=null!==(t=n.output)&&void 0!==t?t:n.message)&&void 0!==s?s:"")}catch(e){Q(e.message)}finally{ey(null)}}},e_=(0,_.useCallback)(async e=>{if(!N)return;let t=Math.min(3e3,Math.max(1,parseInt(ee,10)||200)),s=!!(null==e?void 0:e.silent);s||ey("logcat"),eo(null);try{var n;let e=await y("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));ea(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){ea(""),eo(e.message)}finally{s||ey(null)}},[N,y,ee]);(0,_.useEffect)(()=>{if(!eg||!N||!S)return;let e=window.setInterval(()=>void e_({silent:!0}),3e3);return e_({silent:!0}),()=>clearInterval(e)},[S,N,eg,e_]);let eC=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("ui"),em(null);try{let e=await y("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));ed(e.nodes||[])}catch(e){ed([]),em(e.message)}finally{ey(null)}},eR=async(e,t)=>{ey("redroid:".concat(e));try{let s=await y("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&K(s.summary),f(s.message||"OK"),await ek(),A()}catch(e){f(e.message)}finally{ey(null)}},eP=async e=>{await P("key",{keycode:e})},eL=async()=>{let e=ep.trim();if(!e){f(g("请输入文字","Enter text"));return}await P("text",{text:e})},eM=async()=>{let e=eu.trim();if(!e||"https://"===e){f(g("请输入 URL","Enter URL"));return}await P("open_url",{url:e})};return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安卓设备工作台","Android workstation")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("USB 真机与 Redroid 共用一套控制面,优先保证 USB 真机稳定。","USB phone and Redroid share one control surface.")})]}),S?(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew||!N,onClick:()=>void eN(),className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新设备","Refresh device")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>{ek(),A()},className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新 Redroid","Refresh Redroid")})]}):(0,n.jsx)("span",{className:"text-xs text-amber-200/90",children:g("宿主机未检测到 adb","adb not found on host")})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:z.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>k(e.serial),className:"rounded-xl border px-4 py-2 text-left text-xs ".concat(N===e.serial?"border-violet-500/50 bg-violet-500/10 text-white":"border-white/10 bg-black/30 text-zinc-400"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:e.model||e.serial}),e.transport?(0,n.jsx)("span",{className:"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-zinc-500",children:e.transport}):null,e.kind?(0,n.jsx)("span",{className:"rounded bg-cyan-500/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-cyan-200",children:e.kind}):null]}),(0,n.jsx)("div",{className:"text-[10px] text-zinc-600",children:e.serial}),"device"!==(e.state||"").toLowerCase()?(0,n.jsx)("div",{className:"mt-1 text-[10px] font-medium text-amber-200/90",children:"unauthorized"===e.state?g("未授权,请在手机上允许 USB 调试。","Unauthorized, allow USB debugging on device."):"".concat(g("状态","State"),": ").concat(e.state)}):null]},e.serial))}),S&&0===z.length?(0,n.jsx)("p",{className:"mt-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs leading-relaxed text-amber-200/90",children:g("当前没有已授权设备。USB 真机请检查调试授权;Redroid 请先启动实例,再 adb connect 127.0.0.1:5555。","No authorized devices. For USB phones, confirm USB debugging. For Redroid, start an instance then adb connect 127.0.0.1:5555.")}):null]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-violet-300/90",children:g("真机诊断","Phone diagnostics")}),O?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:O}):null,D?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("dl",{className:"space-y-1.5 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"model"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.brand," ",D.model]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"android"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.android_version," (sdk ",D.sdk,")"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"kind"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",D.transport||(null==ej?void 0:ej.transport)||"unknown"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"display"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:D.resolution})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"rotation"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:D.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:D.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:D.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ei(null===(t=D.diagnostics)||void 0===t?void 0:t.ready,g("已启动","Boot ready"),g("未完成启动","Boot pending")),ei(null===(s=D.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),ei(null===(l=D.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),ei(null===(i=D.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),ei(null===(a=D.diagnostics)||void 0===a?void 0:a.root,"Root","No root")]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:["boot_completed: ",(null===(r=D.diagnostics)||void 0===r?void 0:r.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=D.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=D.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=D.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=D.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):O?null:(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("加载中","Loading")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:g("Redroid 板块","Redroid panel")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("启动默认实例","Start default")})]}),W?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:W}):null,B?(0,n.jsxs)("div",{className:"mt-3 space-y-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsxs)("div",{children:["arch: ",B.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",B.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",B.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",B.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",B.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ei(null===(m=B.requirements)||void 0===m?void 0:m.docker_available,"Docker","No Docker"),ei(null===(u=B.requirements)||void 0===u?void 0:u.adb_available,"ADB","No ADB"),ei(null===(h=B.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),ei(null===(p=B.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(B.instances||[]).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-500",children:[e.port?"127.0.0.1:".concat(e.port):"-"," / ",e.status_text||"-"]})]}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start",e.name),className:"rounded bg-emerald-500/15 px-2 py-1 text-[10px] text-emerald-200",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("restart",e.name),className:"rounded bg-amber-500/15 px-2 py-1 text-[10px] text-amber-200",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("adb_connect",e.name),className:"rounded bg-cyan-500/15 px-2 py-1 text-[10px] text-cyan-200",children:"ADB"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("stop",e.name),className:"rounded bg-rose-500/15 px-2 py-1 text-[10px] text-rose-200",children:"Stop"})]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[ei(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,g("系统就绪","System ready"),g("启动中","Booting")),ei(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),ei(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),ei(null===(i=e.diagnostics)||void 0===i?void 0:i.root,"Root","No root")]}),e.data_dir?(0,n.jsx)("div",{className:"mt-2 truncate font-mono text-[10px] text-zinc-500",children:e.data_dir}):null]},e.name)}),(null===(b=B.instances)||void 0===b?void 0:b.length)?null:(0,n.jsx)("p",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-xs text-zinc-500",children:g("当前没有 Redroid 实例。默认动作会创建 redroid13-1。","No Redroid instances yet. Default actions create redroid13-1.")})]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("读取 Redroid 状态中","Loading Redroid status")})]})]}),(0,n.jsx)(en,{t:g,apiBase:w,fetchJson:y,serial:N,devices:z,setSerial:k,adbAvailable:S,lock:ew,overview:D,onAndroidAction:P,notify:f,onRefreshDevices:A}),S&&N?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-300/90",children:g("快捷控制","Quick controls")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("3"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Home"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("4"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Back"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("187"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Recents"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("wake"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Wake"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("launch_package",{package:"com.zhiliaoapp.musically"}),className:"rounded-lg bg-gradient-to-r from-pink-500/25 to-violet-500/25 px-3 py-1.5 text-xs ring-1 ring-white/10",children:"TikTok"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("24"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("25"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol-"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("66"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Enter"})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:g("滑动手势","Swipe gestures")}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("swipe",{direction:e}),className:"rounded-lg border border-white/10 bg-black/30 px-2.5 py-1 font-mono text-[10px] uppercase text-zinc-300",children:e},e))}),(0,n.jsxs)("div",{className:"mt-4 rounded-lg border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:g("ADB 文本输入","ADB text input")}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:ep,onChange:e=>eb(e.target.value),placeholder:"hello / 123",onKeyDown:e=>{"Enter"===e.key&&eL()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL(),className:"rounded-lg bg-emerald-500/20 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("发送","Send")})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:eu,onChange:e=>eh(e.target.value),placeholder:"https://"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eM(),className:"rounded-lg bg-violet-500/20 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/30",children:g("打开链接","Open URL")})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("h4",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:[(0,n.jsx)(L.Z,{className:"h-4 w-4"}),g("USB 真机优化建议","USB optimization")]}),(0,n.jsxs)("ul",{className:"mt-3 space-y-2 text-xs leading-relaxed text-zinc-400",children:[(0,n.jsx)("li",{children:g("优先使用主板直连 USB,不要经过不稳的 HUB。","Prefer direct motherboard USB, not unstable hubs.")}),(0,n.jsx)("li",{children:g("开发板端固定 adb server,避免频繁 kill-server。","Keep adb server stable and avoid frequent kill-server.")}),(0,n.jsx)("li",{children:g("镜像页默认支持 scrcpy H.264 真流,截图模式作为回退。","Use scrcpy H.264 live stream first, screenshot mode as fallback.")}),(0,n.jsx)("li",{children:g("如果 TikTok / YouTube App 直播,要先确认屏幕常亮、分辨率稳定、USB 供电足够。","For TikTok / YouTube app live, keep screen on, resolution stable, and USB power sufficient.")})]})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 text-emerald-400"}),g("包名搜索与启动","Packages")]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-xl border border-white/10 bg-black/40 px-4 py-2 text-sm",value:Y,onChange:e=>J(e.target.value),placeholder:"tiktok / musically / youtube",onKeyDown:e=>{"Enter"===e.key&&ez()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void ez(),className:"rounded-xl bg-emerald-500/20 px-4 py-2 text-sm text-emerald-100 ring-1 ring-emerald-500/30",children:g("搜索","Search")})]}),(0,n.jsxs)("ul",{className:"mt-4 max-h-48 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 font-mono text-[11px]",children:[G.map(e=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 py-1 text-zinc-400",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-zinc-300",children:e.package}),(0,n.jsxs)("span",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("launch_package",{package:e.package}),className:"rounded bg-white/10 px-2 py-0.5 text-[10px] text-zinc-200",children:g("启动","Launch")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("force_stop",{package:e.package}),className:"rounded bg-rose-500/15 px-2 py-0.5 text-[10px] text-rose-200",children:g("停止","Stop")})]})]},e.package)),G.length?null:(0,n.jsx)("li",{className:"py-2 text-center text-zinc-600",children:g("暂无结果","No results")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(U.Z,{className:"h-4 w-4 text-amber-400"}),"ADB shell"]}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:el.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>X(e.cmd),className:"rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[10px] text-zinc-400 hover:text-zinc-200",children:e.label},e.label))}),(0,n.jsx)("textarea",{className:"mt-3 min-h-[100px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-3 font-mono text-xs text-zinc-200",value:q,onChange:e=>X(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),eS())}}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),className:"rounded-xl bg-amber-500/20 px-4 py-2 text-sm text-amber-100 ring-1 ring-amber-500/30",children:"shell"===ev?(0,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),$?(0,n.jsxs)("button",{type:"button",disabled:!$,onClick:()=>E($),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),g("复制输出","Copy")]}):null]}),$?(0,n.jsx)("pre",{className:"mt-3 max-h-64 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/40 p-3 font-mono text-[11px] text-zinc-400 xl:max-h-[min(24rem,50vh)]",children:$}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("Logcat","Logcat")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("input",{className:"w-24 rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:ee,onChange:e=>et(e.target.value)}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-[11px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eg,onChange:e=>ef(e.target.checked)}),g("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:g("拉取日志","Pull logs")}),es?(0,n.jsxs)("button",{type:"button",onClick:()=>E(es),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),g("复制","Copy")]}):null]}),er?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:er}):null,es?(0,n.jsx)("pre",{className:"mt-3 max-h-72 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/50 p-3 font-mono text-[10px] leading-tight text-zinc-500 xl:max-h-[min(24rem,50vh)]",children:es}):null]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(I.Z,{className:"h-4 w-4 text-fuchsia-400"}),g("界面节点","UI nodes")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eC(),className:"mt-3 rounded-xl border border-fuchsia-500/30 bg-fuchsia-500/10 px-4 py-2 text-sm text-fuchsia-100",children:g("刷新节点","Refresh nodes")}),ex?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:ex}):null,(0,n.jsxs)("ul",{className:"mt-3 max-h-64 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 text-[11px]",children:[ec.map((e,t)=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.04] py-1.5 text-zinc-400 last:border-0",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-zinc-200",children:e.label}),e.resource_id?(0,n.jsx)("span",{className:"ml-2 font-mono text-[10px] text-zinc-600",children:e.resource_id}):null,(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-600",children:["(",e.center_x,", ",e.center_y,")",e.clickable?" click":""]})]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("tap",{x:e.center_x,y:e.center_y}),className:"shrink-0 rounded bg-white/10 px-2 py-1 text-[10px] text-zinc-200",children:"Tap"})]},"".concat(e.center_x,"-").concat(e.center_y,"-").concat(t))),ec.length||ex?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:g("尚未加载","Not loaded")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安装 APK","Install APK")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("先 adb push 到 /sdcard/ 再执行安装。","Push the APK to /sdcard/ first.")}),(0,n.jsx)("input",{className:"mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm",value:C,onChange:e=>R(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!S||!N,onClick:()=>void P("install_apk",{path:C}),className:"mt-3 rounded-xl bg-emerald-500/20 px-4 py-2 text-sm font-medium text-emerald-100 ring-1 ring-emerald-500/30",children:"pm install"})]}):null]})}var er=s(9897),eo=s(4554),ec=s(7689),ed=s(8930),ex=s(8401);function em(e){let{t,title:s,subtitle:l,steps:i,onNavigate:a}=e;return(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5 p-6 shadow-lg shadow-violet-900/10",children:[(0,n.jsx)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:s}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:l}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:flex-wrap sm:justify-center",children:i.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[e.openUrl||e.target&&a?(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e.openUrl){window.open((0,ex.p)(e.openUrl),"_blank","noopener,noreferrer");return}e.target&&a&&a(e.target)},className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ring-2 ring-white/10 transition hover:ring-violet-400/50 hover:brightness-110 ".concat(e.gradient),children:[(0,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}):(0,n.jsxs)("div",{className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ".concat(e.gradient),children:[(0,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}),t8?e.slice(-8):e;if(e.includes("live2/")){let t=e.split("/"),s=t[t.length-1]||"";return s.length>8?s.slice(-8):s}}}let t=e.trim();return!t||t.includes("\n")||t.toLowerCase().startsWith("rtmp")?"":t.length>8?t.slice(-8):t}function eh(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/(https?:\/\/live\.douyin\.com\/[a-zA-Z0-9_-]+)/i);if(n){t.push(n[1].replace(/^http:\/\//i,"https://"));continue}let l=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(l){t.push("https://live.douyin.com/".concat(l[1]));continue}let i=e.match(/(\d{8,})/);i&&t.push("https://live.douyin.com/".concat(i[1]))}return Array.from(new Set(t)).slice(0,16)}function ep(e){let t="",s=!0,n="",l=!1,i=e.split(/\r?\n/),a=!1;for(let e of i){let i=e.trim();if(/^\[youtube\]/i.test(i)){a=!0;continue}if(/^\[/.test(i)){a=!1;continue}if(!a||!i||i.startsWith("#")||i.startsWith(";"))continue;let r=i.indexOf("=");if(r<0)continue;let o=i.slice(0,r).trim().toLowerCase(),c=i.slice(r+1).trim().split(/[#;]/)[0].trim();"key"===o||"stream_key"===o?t=c:"rtmps"===o?s=!/^(0|false|否)/i.test(c):"bitrate"===o?n=c:"fast_audio"===o&&(l=/^(1|true|yes|是|开|on)/i.test(c))}return{key:t,rtmps:s,bitrate:n,fastAudio:l}}function eb(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eg(e){let t=e.bitrate.trim()?"bitrate = ".concat(e.bitrate.trim()):"# bitrate = 4000";return"[youtube]\n# YouTube 推流 key(工作室 → 直播 → 串流密钥)\nkey = ".concat(e.key.trim(),"\n\n# 使用 RTMPS;填 否 则 RTMP\nrtmps = ").concat(e.rtmps?"是":"否","\n\n# 视频比特率 kbps(可选)\n").concat(t,"\n\n# 轻量音频链,减轻 CPU:1 / 是\nfast_audio = ").concat(e.fastAudio?"1":"0","\n")}function ef(e){if(e<60)return"".concat(e,"s");let t=Math.floor(e/60);return t<60?"".concat(t,"m ").concat(e%60,"s"):"".concat(Math.floor(t/60),"h ").concat(t%60,"m")}function ev(e){var t,s,l;let{t:i,currentProc:a,fetchJson:r,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3}=e,[m,u]=(0,_.useState)(""),[h,p]=(0,_.useState)(""),[b,g]=(0,_.useState)(""),[f,v]=(0,_.useState)(""),[w,j]=(0,_.useState)(""),[N,k]=(0,_.useState)([]),[z,S]=(0,_.useState)(null),[C,R]=(0,_.useState)(!1),[P,L]=(0,_.useState)(null),[M,U]=(0,_.useState)(0),T=(0,_.useRef)(null),I=(0,_.useRef)(null),E=(0,_.useRef)(!1),A=(0,_.useRef)(!1),D=(0,_.useRef)(!1),O=function(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(n){t.push(n[1]);continue}let l=e.match(/(\d{8,})/);t.push(l?l[1]:e.slice(0,96))}return Array.from(new Set(t)).slice(0,12)}(o),H=/^(online|running)$/i.test(m),B=function(e){if(!e)return null;let t=null;for(let s of e.split(/\r?\n/)){let e=s.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);e&&(t=e[1]);let n=s.match(/https?:\/\/[^/\s]*douyin\.com\/(\d{8,})/i);n&&(t=n[1])}return t}(h),F=null!==(s=eh(o)[0])&&void 0!==s?s:"",Y=B||(null!==(l=null===(t=F.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),J=Y?"https://live.douyin.com/".concat(Y):F||null,G=(0,_.useCallback)(async()=>{if(a){if(A.current){D.current=!0;return}A.current=!0;try{let e=await r("/status?process=".concat(encodeURIComponent(a))),t=e.process_status||"unknown";u(t),p(e.recent_log||""),g(e.recent_error||""),v(e.business_status||""),j(e.business_note||""),k(Array.isArray(e.ffmpeg_pids)?e.ffmpeg_pids:[]),S("number"==typeof e.log_age_seconds?e.log_age_seconds:null);let s=/^(online|running)$/i.test(t);s&&!E.current&&L(Date.now()),s||L(null),E.current=s}catch(e){u("error"),v("error"),j(""),k([]),S(null)}finally{A.current=!1,D.current&&(D.current=!1,window.setTimeout(()=>void G(),0))}}},[a,r]);(0,_.useEffect)(()=>{G()},[G]),(0,_.useEffect)(()=>{if(C||!a)return;let e=window.setInterval(()=>void G(),x);return()=>clearInterval(e)},[C,a,G,x]),(0,_.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&G()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[G]),(0,_.useEffect)(()=>{if(!P)return;let e=window.setInterval(()=>U(e=>e+1),1e3);return()=>clearInterval(e)},[P]),(0,_.useEffect)(()=>{if(C)return;let e=T.current;e&&(e.scrollTop=e.scrollHeight)},[h,C]),(0,_.useEffect)(()=>{if(C)return;let e=I.current;e&&(e.scrollTop=e.scrollHeight)},[b,C]);let V=null==P?i("—(未检测到在线)","— (not online)"):ef(Math.max(0,Math.floor((Date.now()-P)/1e3)));return(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-b from-emerald-500/[0.07] to-zinc-950/80 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("span",{className:"sr-only","aria-hidden":!0,children:M}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:i("当前直播日志","Live process log")}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-200/90 ring-1 ring-emerald-500/25",children:C?i("已暂停刷新","Paused"):i("每秒刷新","~1s refresh")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void G(),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300 hover:bg-white/[0.08]",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>R(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(C?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[C?(0,n.jsx)(K.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(W.Z,{className:"h-3.5 w-3.5"}),C?i("继续自动刷新","Resume"):i("暂停自动刷新","Pause")]})]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-3 rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("进程状态","Status")}),(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:function(e,t){let s=(t||"unknown").toLowerCase();return"online"===s||"running"===s?e("运行中(PM2/进程在线)","Running (process online)"):"stopped"===s||"stopping"===s?e("已停止","Stopped"):"not_found"===s||"errored"===s?e("未运行或未找到","Not running / not found"):"invalid"===s?e("无效进程名","Invalid process"):t||"—"}(i,m)})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("Business state","Business state")}),(0,n.jsx)("span",{className:"font-medium text-cyan-200/90",children:function(e,t,s){let n=(t||"").toLowerCase();return"streaming"===n?e("Pushing to YouTube","Pushing to YouTube"):"waiting_source"===n?e("Waiting for the upstream live source","Waiting for the upstream live source"):"source_live"===n?e("Source live detected, but no active FFmpeg relay worker","Source live detected, but no active FFmpeg relay worker"):"monitoring"===n?e("Process online and monitoring the source","Process online and monitoring the source"):"misconfigured"===n?e("YouTube key missing or invalid","YouTube key missing or invalid"):"stale"===n?e("Process online but the log heartbeat is stale","Process online but the log heartbeat is stale"):"error"===n?e("Recent process error detected","Recent process error detected"):(null==s?void 0:s.trim())?s.trim():e("No business-state hint yet","No business-state hint yet")}(i,f,w)})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("本次在线时长(估算)","Online duration (est.)")}),(0,n.jsx)("span",{className:"font-mono text-cyan-200/90",children:V})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("FFmpeg workers","FFmpeg workers")}),(0,n.jsxs)("span",{className:"font-mono text-zinc-300",children:[N.length?N.join(", "):"none",null!=z?" \xb7 log ".concat(ef(Math.max(0,Math.floor(z)))):""]})]})]}),d?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("YouTube key 尾码(参考)","YT key suffix")}),(0,n.jsx)("span",{className:"font-mono text-zinc-300",children:c||"—"})]}):null,J?(0,n.jsxs)("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/[0.06] px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium text-zinc-400",children:B?i("当前直播源站(日志)","Current source (from log)"):H?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:J,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs font-medium text-violet-100 ring-1 ring-violet-500/35 transition hover:bg-violet-500/30",children:[(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),Y||i("打开抖音直播页","Open Douyin live")]})]}),O.length>1&&B?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",O.filter(e=>e!==Y).slice(0,3).map(e=>(0,n.jsx)("a",{href:"https://live.douyin.com/".concat(e),target:"_blank",rel:"noreferrer",className:"ml-1 text-violet-400/90 underline-offset-2 hover:underline",children:e},e)),O.length>4?"…":null]}):null]}):(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:i("(日志与地址列表中暂无抖音房间)","(No Douyin room in log or URL list)")})]}),"not_found"!==m&&"invalid"!==m?(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-emerald-400/90",children:i("进程输出(stdout / 合并日志)","Process output")}),(0,n.jsx)("pre",{ref:T,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-emerald-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-emerald-100/95",children:h.trim()||i("(暂无)","(empty)")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-rose-400/90",children:i("异常信息(stderr)","Stderr")}),(0,n.jsx)("pre",{ref:I,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-rose-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-rose-100/95",children:b.trim()||i("(暂无)","(empty)")})]})]}):(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:i("进程未在 PM2 / 本地注册表中运行,日志区域已隐藏。","Process not running — log panes hidden.")})]})}function ey(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let ew=[{id:"720p60",labelZh:"720p @ 60Hz",labelEn:"720p @ 60Hz",spec:"1280x720, 59.94/60Hz, RGB/YUV 有限",hintZh:"板端 HDMI 输出时序与显示端一致;下游画布建议 1280\xd7720。",hintEn:"Match SoC HDMI timing to the display; downstream canvas e.g. 1280\xd7720."},{id:"1080p30",labelZh:"1080p @ 30Hz",labelEn:"1080p @ 30Hz",spec:"1920x1080, 30Hz",hintZh:"带宽紧张时可优先 1080p30;检查线材与接口规格。",hintEn:"Prefer 1080p30 when bandwidth is tight; check cable and port specs."},{id:"1080p60",labelZh:"1080p @ 60Hz",labelEn:"1080p @ 60Hz",spec:"1920x1080, 60Hz, 高刷转播",hintZh:"两端均需稳定支持 1080p60;长时间运行注意散热。",hintEn:"Both ends need stable 1080p60; mind thermals for long runs."}],ej="live-hub-tiktok-hdmi-check-v1",eN="live-hub-tiktok-hdmi-notes-v1",ek="live-hub-tiktok-source-mode-v1";function ez(e){var t;let{t:s,busy:l,entries:i,currentProc:a,setCurrentProc:r,urlConfig:o,setUrlConfig:c,onRunProcess:d,onSaveUrlConfig:x,onReplayGoLive:m,onCopy:u,fetchJson:h,apiPrefix:p,quickLinks:b,hdmiStatus:g,notify:f,onNavigate:v}=e,y=(0,_.useMemo)(()=>i.filter(ey),[i]),w=y.length?y:i,[j,N]=(0,_.useState)("srs"),[k,z]=(0,_.useState)([]),[S,C]=(0,_.useState)(!1),[R,P]=(0,_.useState)(!1),[L,M]=(0,_.useState)("1080p30"),[U,I]=(0,_.useState)("1080p30"),[E,D]=(0,_.useState)(!1),[Z,O]=(0,_.useState)(!0),[H,K]=(0,_.useState)(null),W=(0,_.useRef)(!1),[F,J]=(0,_.useState)(""),[G,V]=(0,_.useState)({}),q=(0,_.useCallback)(e=>{N(e);try{window.localStorage.setItem(ek,e)}catch(e){}},[]);(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(ek);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,_.useEffect)(()=>{W.current=!1},[a]);let X=(0,_.useCallback)(async()=>{if(a)try{var e;let t=await h("/get_url_config?process=".concat(encodeURIComponent(a)));c(null!==(e=t.content)&&void 0!==e?e:"")}catch(e){}},[a,h,c]);(0,_.useEffect)(()=>{if(!a||!Z||"ffmpeg"!==j)return;let e=window.setInterval(()=>{W.current||X()},8e3);return()=>clearInterval(e)},[a,Z,X,j]),(0,_.useEffect)(()=>{"ffmpeg"===j&&a&&X()},[j,a,X]);let $=(0,_.useCallback)(async()=>{if(a){C(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(a)));z(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){f(e.message),z([])}finally{C(!1)}}},[a,h,f]);(0,_.useEffect)(()=>{"replay"===j&&a&&$()},[j,a,$]),(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(ej);e&&V(JSON.parse(e))}catch(e){}try{J(window.localStorage.getItem(eN)||"")}catch(e){}},[]);let Q=(0,_.useCallback)(e=>{V(e);try{window.localStorage.setItem(ej,JSON.stringify(e))}catch(e){}},[]),ee=e=>{J(e);try{window.localStorage.setItem(eN,e)}catch(e){}},et=async()=>{if(a){D(!0),K(null),W.current=!1;try{var e;let t=await h("/get_url_config?process=".concat(encodeURIComponent(a)));c(null!==(e=t.content)&&void 0!==e?e:""),K(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){K(e.message)}finally{D(!1)}}},es=async()=>{try{await Promise.resolve(x()),W.current=!1}catch(e){}},en=async e=>{if(a){P(!0);try{await h("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:a,filename:e})}),f(s("已删除文件","File removed")),await $()}catch(e){f(e.message)}finally{P(!1)}}},el=async e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",n&&a){P(!0);try{let e=new FormData;e.append("file",n);let t=await (0,Y.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(a)),{method:"POST",body:e});f(t.message||s("上传成功","Uploaded")),await $()}catch(e){f(e.message)}finally{P(!1)}}},ei=l||E||R,ea=ew.find(e=>e.id===U),ex=!!(null==g?void 0:g.can_stream_hdmi),eu=(null==g?void 0:g.preferred_device)||(null==g?void 0:null===(t=g.video_devices)||void 0===t?void 0:t[0])||"";return(0,n.jsxs)("div",{className:"mx-auto max-w-4xl space-y-6",children:[v?(0,n.jsx)(em,{t:s,title:s("TikTok HDMI 硬件链路","TikTok HDMI hardware chain"),subtitle:s("板端编码经 HDMI 到显示/下游设备;与「网络」页顶卡相同的箭头风格。","Encode on SoC → HDMI → display/downstream; same arrow style as Network header."),onNavigate:v,steps:[{label:"FFmpeg",sub:s("采集 / 推流","Capture"),gradient:"from-cyan-400 to-blue-500",target:"live_tiktok"},{label:"HDMI",sub:s("板载输出","SoC out"),gradient:"from-violet-500 to-fuchsia-500"},{label:"Android",sub:s("AOSP / 手机","AOSP"),gradient:"from-amber-400 to-orange-500",target:"android"}]}):null,(0,n.jsx)("div",{className:"rounded-2xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.14] via-zinc-950/80 to-fuchsia-500/10 p-6 shadow-xl shadow-cyan-900/10",children:(0,n.jsx)("div",{className:"flex flex-wrap items-start gap-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500/35 to-fuchsia-600/25 ring-1 ring-white/10",children:(0,n.jsx)(A.Z,{className:"h-5 w-5 text-cyan-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:s("TikTok 无人直播(单路)","TikTok unmanned (single lane)")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:s("布局对齐 YouTube 单频道:直播开关 + 源站 + URL_config;无 stream key,输出走 HDMI 硬件链路。","Same layout as YouTube single: controls + URLs; no stream key — HDMI hardware path.")})]})]})})}),(0,n.jsx)("div",{className:"rounded-2xl border border-cyan-500/20 bg-cyan-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:(0,n.jsx)("p",{className:"text-xs leading-relaxed text-cyan-100/90",children:s("HDMI 互斥:后端在「开始 / 重新开始」TikTok 或 obs*.sh(SRS 拉流上屏)时,会自动停止其它正在占用 HDMI 链路的同类进程;与 YouTube 推流互不干扰。","HDMI mutex: starting TikTok or obs*.sh stops other TikTok/OBS HDMI sinks; YouTube RTMP is unaffected.")})}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-300"}),s("X86 HDMI 采集状态","X86 HDMI capture status")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("这里直接显示主机是否识别到采集卡和 /dev/video 设备,可用于验证 ARM HDMI 进 X86 的链路。","Shows whether the host sees the capture card and /dev/video nodes for ARM-to-X86 HDMI ingest.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ring-1 ".concat(ex?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ex?s("可推流","Ready"):s("未就绪","Not ready")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"device: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:eu||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"video nodes: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:((null==g?void 0:g.video_devices)||[]).join(", ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"usb matches: "}),(0,n.jsx)("span",{className:"text-zinc-300",children:((null==g?void 0:g.usb_capture_matches)||[]).length||0})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsx)("p",{className:"text-zinc-600",children:s("建议 FFmpeg","Suggested FFmpeg")}),(0,n.jsx)("p",{className:"mt-2 break-all font-mono text-zinc-200",children:(null==g?void 0:g.suggested_ffmpeg_cmd)||"—"}),(null==g?void 0:g.suggested_ffmpeg_cmd)?(0,n.jsxs)("button",{type:"button",onClick:()=>u(g.suggested_ffmpeg_cmd||""),className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-medium text-cyan-100 ring-1 ring-cyan-500/25",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),s("复制命令","Copy command")]}):null]})]}),((null==g?void 0:g.issues)||[]).length?(0,n.jsx)("ul",{className:"mt-4 list-inside list-disc space-y-1 text-[11px] text-amber-200/85",children:((null==g?void 0:g.issues)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(B.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播开关","Live control")})]}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("TikTok 进程(PM2)","TikTok PM2 process")}),(0,n.jsx)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:a,onChange:e=>r(e.target.value),children:w.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[e.label," (",e.pm2,")"]},e.pm2))}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("直播源","Video source")}),(0,n.jsxs)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:j,onChange:e=>q(e.target.value),children:[(0,n.jsx)("option",{value:"ffmpeg",hidden:!0,children:"FFmpeg(抖音 / TikTok 等直播间 URL)"}),(0,n.jsx)("option",{value:"replay",hidden:!0,children:s("录播素材(本地上传)","VOD upload")}),(0,n.jsx)("option",{value:"srs",children:s("SRS(OBS 推流)","SRS (OBS)")})]}),"srs"===j?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-amber-200/85",children:s("此模式不显示 URL_config:请在 OBS 中填写下方 RTMP 推流地址;板端 SRS 拉流上屏仍可能占用 HDMI,与 TikTok 进程互斥规则不变。","URL_config is hidden: set the RTMP URL in OBS. SRS pull-to-HDMI may still mutex with TikTok per server rules.")}):null,(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["start",s("开始直播","Start"),"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30"],["stop",s("停止直播","Stop"),"bg-rose-500/15 text-rose-200 ring-rose-500/25"],["restart",s("重新开始","Restart"),"bg-amber-500/15 text-amber-200 ring-amber-500/25"]].map(e=>{let[t,s,l]=e;return(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>d(t),className:"rounded-xl px-4 py-3 text-sm font-medium ring-1 ".concat(l),children:s},t)})}),(0,n.jsxs)("p",{className:"mt-3 text-center text-[11px] text-zinc-500",children:[s("当前 HDMI 预设(备忘)","HDMI preset (memo)"),":"," ",(0,n.jsx)("span",{className:"font-mono text-cyan-300/90",children:ea?s(ea.labelZh,ea.labelEn):U})]})]}),"replay"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eo.Z,{className:"h-4 w-4 text-violet-300"}),s("录播素材","VOD library")]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-xl bg-violet-500/15 px-3 py-2 text-xs font-medium text-violet-100 ring-1 ring-violet-500/30",children:[(0,n.jsx)(ec.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:s("上传视频","Upload")}),(0,n.jsx)("input",{type:"file",accept:".mp4,.mkv,.ts,.flv,.mov,.m4v,.webm",className:"hidden",onChange:el})]}),(0,n.jsx)("button",{type:"button",disabled:ei||!a,onClick:()=>void $(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-300",children:s("刷新列表","Refresh")})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s("文件保存在服务器 config/tiktok_replay/对应进程目录;点「开始直播」会写入 replayfile 行并启动 PM2 进程。停播请用上方「停止直播」。","Files under config/tiktok_replay/. Go live writes replayfile + starts PM2. Use Stop above to stop.")}),S?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("加载中…","Loading…")}):0===k.length?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("暂无文件,请先上传。","No files yet.")}):(0,n.jsx)("ul",{className:"mt-4 space-y-2",children:k.map(e=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-white/10 bg-black/30 px-3 py-2 text-xs text-zinc-300",children:[(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.name}),(0,n.jsxs)("span",{className:"shrink-0 text-zinc-500",children:[(e.size/1048576).toFixed(1)," MB"]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void(async()=>{try{await Promise.resolve(m(e.replay_url,e.name))}catch(e){}})(),className:"rounded-lg bg-emerald-500/20 px-2 py-1 text-[11px] text-emerald-100 ring-1 ring-emerald-500/30",children:s("开始直播","Go live")}),(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>d("stop"),className:"rounded-lg bg-rose-500/15 px-2 py-1 text-[11px] text-rose-100 ring-1 ring-rose-500/25",children:s("停播","Stop")}),(0,n.jsxs)("button",{type:"button",disabled:ei,onClick:()=>void en(e.name),className:"inline-flex items-center gap-1 rounded-lg bg-zinc-700/40 px-2 py-1 text-[11px] text-zinc-200",children:[(0,n.jsx)(ed.Z,{className:"h-3 w-3"}),s("删除","Del")]})]})]},e.name))})]}):null,"srs"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-emerald-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("SRS / OBS 推流","SRS / OBS ingest")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("OBS:设置 → 推流 → 服务选「自定义」,服务器填 RTMP 地址;串流密钥可与 SRS 应用配置一致(默认 live/livestream)。","OBS → Stream → Custom: RTMP URL as server; stream key per SRS app (default live/livestream).")}),(0,n.jsxs)("dl",{className:"mt-4 space-y-3 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("RTMP 推流地址(OBS 服务器)","RTMP publish URL")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-emerald-200/90",children:[(0,n.jsx)("span",{className:"break-all",children:b.srs_rtmp_publish||"—"}),b.srs_rtmp_publish?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>u(b.srs_rtmp_publish),children:(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("HTTP-FLV 预览","HTTP-FLV preview")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-zinc-400",children:[(0,n.jsx)("span",{className:"break-all",children:b.srs_play_flv||b.srs_http||"—"}),b.srs_play_flv||b.srs_http?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>u(b.srs_play_flv||b.srs_http),children:(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("SRS 控制台","SRS web UI")}),(0,n.jsx)("dd",{className:"mt-1 font-mono text-zinc-400",children:(0,n.jsx)("a",{href:b.srs_http||"#",target:"_blank",rel:"noreferrer",className:"text-cyan-300 hover:underline",children:b.srs_http||"—"})})]})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-400"}),s("HDMI 硬件与时序","HDMI timing")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("点选一路作为现场备忘;与板端 ffmpeg/OBS 采集参数对齐。","Pick a preset as field memo; match capture settings.")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:ew.map(e=>{let t=L===e.id,l=U===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{M(t?null:e.id),I(e.id)},className:"rounded-2xl border p-4 text-left transition ".concat(l?"border-cyan-500/50 ring-1 ring-cyan-500/20":""," ").concat(t?"border-cyan-500/40 bg-cyan-500/10":"border-white/[0.08] bg-zinc-950/50 hover:border-white/15"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-400"}),s(e.labelZh,e.labelEn)]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:e.spec}),t?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s(e.hintZh,e.hintEn)}):null]},e.id)})}),(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/5 bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-zinc-400",children:s("上线前检查清单(本地保存)","Pre-flight checklist (local)")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:[{id:"cable",zh:"HDMI 线材插紧、方向正确(如需转接头确认规格)",en:"HDMI cable seated; adapter specs OK"},{id:"thermal",zh:"长时间推流注意散热,过热会掉帧黑屏",en:"Thermal headroom for long runs"}].map(e=>(0,n.jsxs)("li",{className:"flex items-start gap-2 text-xs text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"mt-0.5 rounded border-white/20 bg-black/40",checked:!!G[e.id],onChange:t=>Q({...G,[e.id]:t.target.checked})}),(0,n.jsx)("span",{children:s(e.zh,e.en)})]},e.id))}),(0,n.jsx)("label",{className:"mt-4 block text-[11px] text-zinc-500",children:s("HDMI / 走线备忘","HDMI / wiring notes")}),(0,n.jsx)("textarea",{className:"mt-1 min-h-[72px] w-full resize-y rounded-lg border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:F,onChange:e=>ee(e.target.value),spellCheck:!1,placeholder:s("接口、线长、显示器型号…","Ports, cable length, display model…")})]})]}),"ffmpeg"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-cyan-300 hover:text-cyan-200",onClick:()=>u(o),children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),s("复制全文","Copy all")]})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("一行一个地址;可勾选自动从服务器刷新,或点「重新读取」手动同步。","One URL per line; enable auto-refresh or reload from server.")}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:Z,onChange:e=>O(e.target.checked)}),s("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]})}),H?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:H}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:o,onChange:e=>{W.current=!0,c(e.target.value)},spellCheck:!1}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void et(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-300",children:s("重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void es(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm font-medium text-cyan-100 ring-1 ring-cyan-500/30",children:s("保存 URL 配置","Save URL config")})]})]}):null,(0,n.jsx)(ev,{t:s,currentProc:a,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eS=s(5468),e_=s(9397);let eC="live-hub-youtube-pro-v2",eR=/[^a-zA-Z0-9_.-]+/g;function eP(e){return(e||"").trim().replace(eR,"_")}function eL(e){return eP(String(e.pm2Name||""))||eZ(String(e.id||""))}function eM(e){if(!e||"object"!=typeof e)return null;let t=String(e.id||"").trim();if(!t)return null;let s=String(e.name||"").trim()||t;return{id:t,name:s,streamKeySuffix:"string"==typeof e.streamKeySuffix?e.streamKeySuffix:void 0,streamKey:"string"==typeof e.streamKey?e.streamKey:void 0,urlLines:"string"==typeof e.urlLines?e.urlLines:void 0,pm2Name:"string"==typeof e.pm2Name?e.pm2Name:void 0,notes:"string"==typeof e.notes?e.notes:void 0}}function eU(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.map(e=>eM(e)).filter(e=>null!==e)}catch(e){return[]}}function eT(e){window.localStorage.setItem(eC,JSON.stringify(e))}let eI=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function eE(e){for(let s of eI)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?t.map(e=>eM(e)).filter(e=>null!==e):[])}}catch(e){}return{fetched:!1,channels:[]}}async function eA(e,t){let s=null;for(let n of eI)try{await e(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:t})});return}catch(e){s=e instanceof Error?e:Error(String(e))}throw null!=s?s:Error("youtube_pro_channels sync failed")}function eD(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function eZ(e){return"youtube2__".concat(eP(e)||"channel")}function eO(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function eH(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function eB(e){return eO(e)&&e.pm2.trim()===eH(e.script).trim()}function eK(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function eW(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:eG(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===eH(e.script).trim().toLowerCase()?3:10}let eF="live-hub-youtube-mode-v1",eY=new Set(["tiktok","obs","web"]);function eJ(e){var t,s,n;return{name:e.name,streamKey:null!==(t=e.streamKey)&&void 0!==t?t:"",pm2Name:null!==(s=e.pm2Name)&&void 0!==s?s:eZ(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function eG(e){return/^(online|running)$/i.test((e||"").trim())}function eV(e,t){let s=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===s?t("已配置","Ready"):"streaming"===s?t("推流中","Pushing"):"waiting_source"===s?t("等待上游","Waiting source"):"source_live"===s?t("源已开播,转推未起","Source live, relay down"):"monitoring"===s?t("监控中","Monitoring"):"misconfigured"===s?t("密钥异常","Key invalid"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):eG(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function eq(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function eX(e,t){return eq(e).length>0&&0===eq(t).length}function e$(e){let{kind:t,busyKind:s,targetPm2:l,busy:i,online:a,label:r,className:o,baseLock:c,onRun:d,notify:x,t:m,compact:u}=e,h=function(e){if(!(null==e?void 0:e.startsWith("proc:")))return null;let t=e.slice(5),s=t.indexOf(":");if(s<=0)return null;let n=t.slice(0,s),l=t.slice(s+1);return l&&["start","stop","restart"].includes(n)?{action:n,pm2:l}:null}(i),p=h&&h.pm2===l,b=null!=s?s:t,g=!!(p&&h.action===b),f=!!(p&&h.action!==b),y="start"===t&&a,w="stop"===t&&!a,j="restart"===t&&!a,N=y||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!g){if(f){x(m("请等待当前操作完成","Wait for the current action to finish"));return}if(y){x(m("已在直播中,无需重复开始","Already live"));return}if(w){x(m("当前未在直播,无法停止","Not live — cannot stop"));return}if(j){x(m("进程未运行时请使用「开始直播」","Use Start when the process is not running"));return}c||d()}},className:"relative overflow-hidden rounded-xl ring-1 transition ".concat(u?"min-h-[2rem] px-3 py-1.5 text-xs font-medium":"min-h-[2.75rem] px-4 py-3 text-sm font-medium"," ").concat(o," ").concat(N||c||g||f?"cursor-not-allowed":""," ").concat(N&&!g?"opacity-45":""," ").concat(f?"opacity-35":""," ").concat(g?"ring-violet-400/40":""),children:[g?(0,n.jsx)("span",{className:"absolute inset-0 flex items-center justify-center bg-black/25 backdrop-blur-[2px]",children:(0,n.jsx)(v.Z,{className:"".concat(u?"h-4 w-4":"h-6 w-6"," animate-spin text-white")})}):null,(0,n.jsxs)("span",{className:"inline-flex items-center justify-center gap-1.5 ".concat(g?"invisible":""),children:[N?(0,n.jsx)(eS.Z,{className:"".concat(u?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,r]})]})}function eQ(e){var t,s,l,i;let{t:a,busy:r,entries:o,currentProc:d,setCurrentProc:x,urlConfig:m,setUrlConfig:u,onRunProcess:h,onSaveUrlConfig:p,fetchJson:b,liveProcesses:g,notify:f,onNavigate:w,quickLinks:j}=e,N=(0,_.useMemo)(()=>o.filter(eO),[o]),k=(0,_.useMemo)(()=>N.filter(e=>eB(e)),[N]),z=(0,_.useMemo)(()=>(function(e,t){let s=e.filter(eO),n=s.filter(e=>eB(e)),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(eK)){var a,r,o,c;let t=e.pm2.trim();if(!t||i.has(t))continue;let n=(e.business_status||"").trim().toLowerCase();if(!e.is_pushing&&"streaming"!==n&&!eG(e.process_status))continue;let d=s.find(e=>e.pm2.trim()===t);l.push(null!=d?d:{pm2:t,script:null!==(o=null!==(r=e.script)&&void 0!==r?r:null===(a=s[0])||void 0===a?void 0:a.script)&&void 0!==o?o:"youtube.py",label:null!==(c=e.label)&&void 0!==c?c:t}),i.add(t)}return l})(N.length?N:o,g),[o,g,N]),S=(0,_.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(eK).map(e=>[e.pm2.trim(),e])),n=e[0],l=eW(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=eW(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===eH(e.script).trim().toLowerCase());return l?l.pm2:null!==(s=null===(t=e[0])||void 0===t?void 0:t.pm2)&&void 0!==s?s:""}(z),[g,z]),[C,R]=(0,_.useState)("single"),[P,L]=(0,_.useState)([]),[M,U]=(0,_.useState)(""),[T,I]=(0,_.useState)(""),[E,A]=(0,_.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!1}),[D,Z]=(0,_.useState)(null),[O,H]=(0,_.useState)(!1),[K,W]=(0,_.useState)(""),[F,Y]=(0,_.useState)(!0),[J,G]=(0,_.useState)(!1),[V,q]=(0,_.useState)(!1),[X,$]=(0,_.useState)(null),[Q,ee]=(0,_.useState)({}),[et,es]=(0,_.useState)(!1),[en,el]=(0,_.useState)(null),ei=(0,_.useRef)(!1);(0,_.useEffect)(()=>{ei.current=!1},[d]);let ea=(0,_.useCallback)(async()=>{if(d)try{var e,t,s;let n=await b("/get_url_config?process=".concat(encodeURIComponent(d))),l=null!==(e=n.content)&&void 0!==e?e:"";if(ei.current)return;if("single"===C)u(l);else{let e=null!==(s=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==s?s:"";if(eX(e,l)){W(e);return}W(l),M&&L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:l}:e);return eT(t),t})}}catch(e){}},[M,P,d,b,C,u]);(0,_.useEffect)(()=>{if(!d||!F)return;let e=window.setInterval(()=>{ei.current||ea()},8e3);return()=>clearInterval(e)},[d,F,ea]);let er=async()=>{if(d){G(!0),$(null),ei.current=!1;try{var e,t,s;let n=await b("/get_url_config?process=".concat(encodeURIComponent(d))),l=null!==(e=n.content)&&void 0!==e?e:"";if(ei.current){$(a("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===C)u(l);else{let e=null!==(s=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==s?s:"";if(eX(e,l)){W(e),$(a("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}W(l),M&&L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:l}:e);return eT(t),t})}$(a("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){$(e.message)}finally{G(!1)}}};(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(eF);("pro"===e||"single"===e)&&R(e)}catch(e){}},[]),(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await eE(b);if(t.fetched&&!e){L(t.channels),eT(t.channels);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(eC);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=eU(e);if(t.length)return window.localStorage.setItem(eC,JSON.stringify(t)),t}return eU(e)}(),s=t.length>0?t:(()=>{let e=eD();return[{id:e,name:"线路 1",streamKey:"",urlLines:"",pm2Name:eZ(e),notes:""}]})();L(s),t.length||eT(s)})(),()=>{e=!0}},[b]),(0,_.useEffect)(()=>{P.length&&!M&&U(P[0].id)},[P,M]);let eo=(0,_.useCallback)(e=>g.find(t=>t.pm2===e),[g]),ec=(0,_.useCallback)(e=>{var t;return null===(t=eo(e))||void 0===t?void 0:t.process_status},[eo]);(0,_.useEffect)(()=>{if("single"!==C||!S)return;if(!z.some(e=>e.pm2===d)){x(S);return}let e=z.find(e=>e.pm2===d),t=eo(d),s=z.find(e=>e.pm2===S),n=eo(S);d!==S&&e&&s&&eW(s,n){L(e),eT(e)},[]),ey=(0,_.useCallback)(async e=>{await eA(b,e)},[b]),ew=(0,_.useCallback)(e=>{ef(e),ey(e).catch(e=>{f("".concat(a("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[ef,f,ey,a]),ej=P.find(e=>e.id===M)||P[0],eN=(0,_.useMemo)(()=>{var e;return(null!==(e=null==ej?void 0:ej.urlLines)&&void 0!==e?e:"").trim()},[null==ej?void 0:ej.urlLines]),ek=(0,_.useMemo)(()=>{var e;return ej?null!==(e=Q[ej.id])&&void 0!==e?e:eJ(ej):null},[ej,Q]);(0,_.useEffect)(()=>{ej&&ee(e=>e[ej.id]?e:{...e,[ej.id]:eJ(ej)})},[ej]),(0,_.useEffect)(()=>{el(null)},[M]);let ez=(0,_.useCallback)((e,t)=>{ej&&(ee(s=>{var n;return{...s,[ej.id]:{...null!==(n=s[ej.id])&&void 0!==n?n:eJ(ej),[e]:t}}}),el(null))},[ej]),eS=ej?eL(ej):"",eR=ej&&ek?eL({id:ej.id,pm2Name:ek.pm2Name}):"",eM=!!ej&&!!ek&&eR!==eS,eI=(0,_.useMemo)(()=>{if(!ej||!ek)return{ok:!1,message:a("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=ek.name.trim()||"".concat(a("线路","Ch")," ").concat(P.findIndex(e=>e.id===ej.id)+1),t=eL({id:ej.id,pm2Name:ek.pm2Name});return t?eY.has(t)?{ok:!1,message:a("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ek.streamKey.trim(),normalizedNotes:ek.notes.trim()}:P.find(e=>e.id!==ej.id&&eL(e)===t)?{ok:!1,message:a("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ek.streamKey.trim(),normalizedNotes:ek.notes.trim()}:{ok:!0,message:"",normalizedName:e,normalizedPm2:t,normalizedStreamKey:ek.streamKey.trim(),normalizedNotes:ek.notes.trim()}:{ok:!1,message:a("进程名不能为空","PM2 name is required"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ek.streamKey.trim(),normalizedNotes:ek.notes.trim()}},[ej,ek,P,a]),eQ=(0,_.useMemo)(()=>{if(!ej||!ek)return!1;let e=eJ(ej);return ek.name!==e.name||ek.streamKey!==e.streamKey||eP(ek.pm2Name)!==eP(e.pm2Name)||ek.notes!==e.notes},[ej,ek]),e0=(0,_.useCallback)(e=>{if("single"===e&&"pro"===C&&ej&&ew(P.map(e=>e.id===ej.id?{...e,urlLines:K}:e)),"pro"===e&&P.length){var t,s;let e=P[0],n=k.some(e=>e.pm2===d)&&d.trim()?d.trim():eL(e),l=[{...e,streamKey:E.key.trim()||e.streamKey||"",urlLines:m.trim()||e.urlLines||"",pm2Name:n},...P.slice(1)];ew(l);let i=null!==(t=l.find(e=>e.id===M))&&void 0!==t?t:l[0];W((null!==(s=null==i?void 0:i.urlLines)&&void 0!==s?s:"").trim()||m.trim())}R(e);try{window.localStorage.setItem(eF,e)}catch(e){}},[C,ej,P,K,E.key,m,d,k,M,ew]),e1=(0,_.useCallback)(e=>{var t;ej&&"pro"===C&&ew(P.map(e=>e.id===ej.id?{...e,urlLines:K}:e)),W((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),U(e.id),x(eL(e))},[ej,C,P,K,x,ew]);(0,_.useEffect)(()=>{if("pro"!==C||!M)return;let e=P.find(e=>e.id===M);e&&x(eL(e))},[C,M,P,x]),(0,_.useEffect)(()=>{if("pro"!==C||!d||!M)return;let e=!1;return(async()=>{try{var t,s,n;let l=await b("/get_url_config?process=".concat(encodeURIComponent(d)));if(e||ei.current)return;let i=null!==(s=l.content)&&void 0!==s?s:"",a=null!==(n=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==n?n:"";if(eX(a,i)){W(a);return}W(i),ei.current=!1,L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:i}:e);return eT(t),t})}catch(t){e||ei.current||W(eN)}})(),()=>{e=!0}},[M,eN,P,d,b,C]);let e5=(0,_.useCallback)(async()=>{if(d){H(!0),Z(null);try{var e;let t=await b("/get_config?process=".concat(encodeURIComponent(d))),s=null!==(e=t.content)&&void 0!==e?e:"";I(s),A(ep(s))}catch(e){Z(e.message)}finally{H(!1)}}},[d,b]);(0,_.useEffect)(()=>{d&&e5()},[d,e5]);let e2=(0,_.useCallback)(async()=>{var e;if(!ej||!ek)throw Error(a("请选择线路","Pick a lane"));if(!eI.ok)throw Error(eI.message);let t=P.map(e=>e.id===ej.id?{...e,name:eI.normalizedName,streamKey:eI.normalizedStreamKey,pm2Name:eI.normalizedPm2,notes:eI.normalizedNotes,urlLines:K}:e);return ef(t),await ey(t),ee(e=>({...e,[ej.id]:{name:eI.normalizedName,streamKey:eI.normalizedStreamKey,pm2Name:eI.normalizedPm2,notes:eI.normalizedNotes}})),{next:t,savedLane:null!==(e=t.find(e=>e.id===ej.id))&&void 0!==e?e:{...ej,name:eI.normalizedName,streamKey:eI.normalizedStreamKey,pm2Name:eI.normalizedPm2,notes:eI.normalizedNotes,urlLines:K},pm2:eI.normalizedPm2}},[ej,ek,eI,ef,P,K,ey,a]),e3=(0,_.useCallback)(async()=>{if(ej){es(!0),el(null);try{let e=await e2();x(e.pm2),el(a("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;el(e),f(e)}finally{es(!1)}}},[ej,f,e2,x,a]),e4=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d,s=t.trim();if(!s){Z(a("请选择进程","Pick a process"));return}H(!0),Z(null);try{let t=new URLSearchParams({process:s});await b("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),I(e),Z(a("youtube.ini 已保存","youtube.ini saved"))}catch(e){Z(e.message)}finally{H(!1)}},e6=async()=>{let e=eg(E);await e4(e)},e8=async()=>{H(!0),Z(null);try{var e;let t=T||eg(E),s=await b("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:"youtube.".concat(d.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini"),content:t,action:"youtube_balanced_preset"})}),n=null!==(e=s.content)&&void 0!==e?e:t;I(n),A(ep(n)),Z(s.message||a("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){Z(e.message)}finally{H(!1)}},e9=(0,_.useMemo)(()=>{var e,t;if("single"===C)return eu("key = ".concat(E.key));let s=null!==(t=null!==(e=null==ek?void 0:ek.streamKey)&&void 0!==e?e:null==ej?void 0:ej.streamKey)&&void 0!==t?t:"";return eu("key = ".concat(s))},[C,E.key,null==ej?void 0:ej.streamKey,null==ek?void 0:ek.streamKey]),e7=async()=>{if(ej)try{es(!0),el(null);let e=await e2();x(e.pm2),await Promise.resolve(p(K,e.pm2)),ei.current=!1,el(a("线路与地址已保存","Lane settings and URLs saved"))}catch(e){}finally{es(!1)}},te=async()=>{try{await Promise.resolve(p()),ei.current=!1}catch(e){}},tt=async()=>{let e="single"===C?m:K;q(!0),$(null);try{var t;let s=await b("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eb(d),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===C?u(n):W(n),ei.current=!0,$(s.message||a("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){$(e.message)}finally{q(!1)}},ts=async()=>{if(!ej||!ek)return;let e=ep(T||eg(E)),t=eg({key:ek.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});es(!0),el(null);try{let e=await e2();x(e.pm2),await e4(t,e.pm2),el(a("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;el(e),f(e)}finally{es(!1)}},tn="single"===C?m:K,tl=(0,_.useMemo)(()=>eq(tn).length,[tn]),ti=(0,_.useMemo)(()=>eh(tn).length,[tn]),ta=(0,_.useMemo)(()=>[null==j?void 0:j.neko_browser,null==j?void 0:j.chromium_remote_debug,null==j?void 0:j.srs_api].filter(e=>!!e),[j]),tr=(0,_.useCallback)(async e=>{let t=ej?eL(ej):"";return ej&&e===t?await e2():(ef(P),await ey(P),{next:P,savedLane:null!=ej?ej:null,pm2:e})},[ej,ef,P,e2,ey]),to=(0,_.useCallback)(async(e,t)=>{let s=!!ej&&eL(ej)===t;if("stop"!==e){var n,l;let e=P,s=t;try{let n=await tr(t);e=n.next,s=n.pm2}catch(e){f("".concat(a("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>eL(e)===s),r=null!==(n=null==i?void 0:i.urlLines)&&void 0!==n?n:"";if(!(null!==(l=null==i?void 0:i.streamKey)&&void 0!==l?l:"").trim()){f(a("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!eq(r).length){f(a("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&x(t),h(e,t)},[ej,P,tr,f,h,x,a]),tc=!!r||O||J||V||et,td=eo(d),tx=eG(ec(d)),tm=(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:F,onChange:e=>Y(e.target.checked)}),a("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void er(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:a("手动重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void tt(),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-1.5 text-cyan-100 hover:bg-cyan-500/15",children:V?a("去重中...","Deduplicating..."):a("智能去重","Deduplicate")})]});return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[w?(0,n.jsx)(em,{t:a,title:a("YouTube 转播链路","YouTube relay chain"),subtitle:a("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:w,steps:[{label:"ShellCrash",sub:a("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:a("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:a("Chromium 工作室","Chromium"),gradient:"from-emerald-400 to-teal-500",openUrl:(0,ex.p)((null==j?void 0:j.neko_browser)||"http://live.local:9200/")}]}):null,(0,n.jsx)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/80 to-cyan-500/5 p-6 shadow-xl shadow-violet-900/10",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-red-500/30 to-violet-600/30 ring-1 ring-white/10",children:(0,n.jsx)(c.Z,{className:"h-5 w-5 text-red-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:a("YouTube 无人直播","YouTube unmanned live")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:a("单路一条流;多路时每条线路独立保存自己的密钥、URL 列表和 PM2 任务。填好后保存,再点「开始」。Neko 浏览器仅作辅助工作室,不再阻塞推流。","Single lane or multi-lane: every lane keeps its own key, URL list, and PM2 task. Save, then Start. Neko is optional browser tooling and no longer blocks streaming.")})]})]}),(0,n.jsxs)("div",{className:"flex rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>e0("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===C?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>e0("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===C?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("多频道 Pro","Multi Pro")})]})]})}),ta.length?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null==j?void 0:j.neko_browser)?(0,n.jsx)("a",{href:(0,ex.p)(j.neko_browser),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/20",children:a("打开 Neko 工作室","Open Neko studio")}):null,(null==j?void 0:j.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,ex.p)(j.chromium_remote_debug),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:a("打开 Chromium 调试","Open Chromium debug")}):null,(null==j?void 0:j.srs_api)?(0,n.jsx)("a",{href:(0,ex.p)(j.srs_api),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-violet-500/20 bg-violet-500/10 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/20",children:a("打开 SRS API","Open SRS API")}):null]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(B.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播开关","Live control")})]}),"single"===C?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:a("转播任务","Relay task")}),(0,n.jsx)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:d,onChange:e=>x(e.target.value),children:z.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=eH(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,a)," (",e.pm2,")"]},e.pm2))}),(0,n.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,n.jsx)(e$,{kind:"start",targetPm2:d,busy:r,online:tx,label:a("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>h("start",d),notify:f,t:a}),(0,n.jsx)(e$,{kind:"stop",targetPm2:d,busy:r,online:tx,label:a("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>h("stop",d),notify:f,t:a}),(0,n.jsx)(e$,{kind:"restart",targetPm2:d,busy:r,online:tx,label:a("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>h("restart",d),notify:f,t:a})]}),(0,n.jsxs)("p",{className:"mt-3 text-center text-xs text-zinc-400",children:[a("当前状态","Current state"),": ",eV(td,a)]}),(0,n.jsxs)("p",{className:"mt-3 text-center font-mono text-[11px] text-zinc-600",children:["key ",a("尾码","suffix"),": ",e9||"—"]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"mt-4 rounded-xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.1] via-zinc-950/50 to-violet-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:a("Pro 转播实况","Pro relay status")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:a("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:P.map(e=>{var t,s,l;let i=eL(e),o=eo(i),c=ec(i),d=eq((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),x=eh((null!==(s=e.urlLines)&&void 0!==s?s:"").trim()),m=x[0],u=eu("key = ".concat(null!==(l=e.streamKey)&&void 0!==l?l:"")),h=M===e.id,p=eG(c);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border px-3 py-2.5 text-left text-xs transition sm:flex-nowrap ".concat(h?"border-violet-500/45 bg-violet-500/[0.1]":"border-white/10 bg-black/30 hover:border-white/18"),children:[(0,n.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>e1(e),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(function(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"streaming"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"waiting_source"===t||"monitoring"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"source_live"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"misconfigured"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":eG(null==e?void 0:e.process_status)?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"bg-zinc-600/20 text-zinc-400 ring-zinc-500/25"}(o)),children:eV(o,a)})]}),(0,n.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-zinc-500",children:[(0,n.jsxs)("span",{children:["key …",u||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:i,children:i}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",d.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",x.length]})]}),m?(0,n.jsx)("a",{href:m,target:"_blank",rel:"noreferrer",className:"mt-1 block max-w-full truncate text-cyan-300/90 underline-offset-2 hover:underline",onClick:e=>e.stopPropagation(),title:m,children:m.replace(/^https?:\/\//,"")}):(0,n.jsx)("span",{className:"mt-1 block text-zinc-600",children:"—"})]}),(0,n.jsxs)("div",{className:"flex w-full shrink-0 flex-wrap items-center justify-end gap-1.5 sm:w-auto",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,n.jsx)(e$,{kind:"start",targetPm2:i,busy:r,online:p,label:a("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void to("start",i),notify:f,t:a,compact:!0}),(0,n.jsx)(e$,{kind:"stop",targetPm2:i,busy:r,online:p,label:a("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void to("stop",i),notify:f,t:a,compact:!0}),(0,n.jsx)(e$,{kind:"restart",targetPm2:i,busy:r,online:p,label:a("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void to("restart",i),notify:f,t:a,compact:!0})]})]},e.id)})})]})})]}),"single"===C?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("YouTube 相关设置","YouTube settings")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("串流参数写进 youtube.ini,无需 Google 登录。","Stream settings go to youtube.ini — no Google login.")}),(0,n.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,n.jsx)("label",{className:"block text-xs text-zinc-400",children:a("串流密钥","Stream key")}),(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm font-mono text-zinc-200",spellCheck:!1,autoComplete:"off",value:E.key,onChange:e=>A(t=>({...t,key:e.target.value})),placeholder:"xxxx-xxxx-xxxx-xxxx-xxxx"}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:["RTMPS",(0,n.jsxs)("select",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-sm text-white",value:E.rtmps?"1":"0",onChange:e=>A(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:a("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:a("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[a("比特率 kbps","Bitrate kbps"),(0,n.jsx)("input",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",value:E.bitrate,onChange:e=>A(t=>({...t,bitrate:e.target.value})),placeholder:"4000"})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 pt-6 text-xs text-zinc-300",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:E.fastAudio,onChange:e=>A(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",a("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:tc,onClick:()=>void e5(),className:"inline-flex items-center gap-2 rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-200",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 ".concat(O?"animate-spin":"")}),a("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:tc,onClick:()=>void e6(),className:"inline-flex items-center gap-2 rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:[O?(0,n.jsx)(v.Z,{className:"h-4 w-4 animate-spin"}):null,a("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void e8(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:a("平衡预设","Balanced preset")}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>{A(ep(T)),Z(a("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:a("从原文同步表单","Parse raw")})]}),(0,n.jsxs)("details",{className:"mt-4 rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:youtube.ini 原文","Raw youtube.ini")}),(0,n.jsx)("textarea",{className:"mt-2 h-36 w-full resize-y rounded-lg border border-white/10 bg-black/50 p-3 font-mono text-[11px] text-zinc-400",value:T,onChange:e=>I(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:tc,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void e4(T),children:a("保存原文","Save raw")})]}),D?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:D}):null]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[a("当前线路","Current lane"),ej?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",ej.name]}):null,eQ?(0,n.jsx)("span",{className:"ml-2 rounded-md bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-100 ring-1 ring-amber-500/25",children:a("有未保存修改","Unsaved")}):null]}),ej?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:["PM2: ",eS,eM?" → ".concat(eR):""," \xb7 ","key ",e9||"—"]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:tc,className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/30",onClick:()=>{let e=eD(),t={id:e,name:"".concat(a("线路","Ch")," ").concat(P.length+1),streamKey:"",urlLines:"",pm2Name:eZ(e),notes:""};ew([...P,t]),U(e),x(eL(t)),W("")},children:[(0,n.jsx)(e_.Z,{className:"h-3.5 w-3.5"}),a("新增线路","Add lane")]})]}),ej?(0,n.jsxs)("div",{className:"mt-4 space-y-3 border-t border-white/5 pt-4",children:[(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm",value:null!==(t=null==ek?void 0:ek.name)&&void 0!==t?t:"",onChange:e=>ez("name",e.target.value),placeholder:a("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:a("串流密钥","Stream key")}),(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",spellCheck:!1,value:null!==(s=null==ek?void 0:ek.streamKey)&&void 0!==s?s:"",onChange:e=>ez("streamKey",e.target.value),placeholder:"xxxx-xxxx… / rtmp(s)://…"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void e3(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:et?a("保存中...","Saving..."):a("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void ts(),className:"rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:a("写入 youtube.ini","Write youtube.ini")})]}),eI.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:eI.message}),(0,n.jsxs)("details",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:进程名","Advanced: process name")}),(0,n.jsx)("input",{className:"mt-2 w-full rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:null!==(l=null==ek?void 0:ek.pm2Name)&&void 0!==l?l:eZ(ej.id),onChange:e=>ez("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[a("实际生效","Effective"),": ",eR||"—"]}),eI.message&&!eI.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:eI.message}):null]}),(0,n.jsx)("textarea",{className:"h-16 w-full resize-y rounded-xl border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:null!==(i=null==ek?void 0:ek.notes)&&void 0!==i?i:"",onChange:e=>ez("notes",e.target.value),placeholder:a("备注(可选)","Notes (optional)")}),en?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:en}):null,(0,n.jsxs)("button",{type:"button",disabled:tc||P.length<2,className:"inline-flex items-center gap-1 text-xs text-rose-300 hover:text-rose-200 disabled:opacity-30",onClick:()=>{var e;let t=P.filter(e=>e.id!==ej.id);ee(e=>{let t={...e};return delete t[ej.id],t}),ew(t),U((null===(e=t[0])||void 0===e?void 0:e.id)||"")},children:[(0,n.jsx)(ed.Z,{className:"h-3.5 w-3.5"}),a("删除此线路","Delete lane")]})]}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("每条线路独立写入自己的 URL_config..ini,不再复用或回填所谓“全局地址”。","Each lane writes to its own URL_config..ini with no shared global URL draft.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:d?eb(d):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",tl]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",ti]})]}),tm,X?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:X}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[160px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:K,onChange:e=>{ei.current=!0,W(e.target.value)},spellCheck:!1,placeholder:"https://live.douyin.com/..."}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void e7(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存地址","Save URLs")})})]})]}),"single"===C?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",tl]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",ti]})]}),tm,X?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:X}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:m,onChange:e=>{ei.current=!0,u(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:tc,onClick:()=>void te(),className:"mt-3 rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存 URL 配置","Save URL config")})]}):null,(0,n.jsx)(ev,{t:a,currentProc:d,fetchJson:b,urlListText:"single"===C?m:K,keySuffixUi:e9,showKeyRow:!0,pollMs:800})]})}var e0=s(257);let e1=()=>void 0!==e0&&e0.env.NEXT_PUBLIC_API_URL||"";function e5(e){if(!e)return"—";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function e2(e){return"online"===e||"running"===e?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":"configured"===e?"bg-sky-500/15 text-sky-200 ring-1 ring-sky-500/25":"skipped"===e?"bg-slate-500/15 text-slate-300 ring-1 ring-slate-500/30":"stopped"===e||"not_found"===e?"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25":"error"===e?"bg-rose-500/15 text-rose-300 ring-1 ring-rose-500/35":"bg-violet-500/15 text-violet-200 ring-1 ring-violet-500/30"}function e3(e,t){let s=(e||"").trim().toLowerCase();return"online"===s||"running"===s?t("运行中","Running"):"configured"===s?t("已配置","Configured"):"not_found"===s?t("未注册","Unregistered"):"stopped"===s?t("已停止","Stopped"):"error"===s?t("异常","Error"):e||"—"}function e4(){var e,t,s,L,M,U,T,I,E,A,D,Z,O,H,B,K,W,F,J,G,V,q,X,$,Q,ee,et,es,en,el,ei,er,eo,ec,ed,em,eu,eh,ep,eb,eg,ef,ev,ey,ew,ej,eN,ek,eS,e_,eC,eR,eP,eL;let eM=e1(),[eU,eT]=(0,_.useState)("zh"),[eI,eE]=(0,_.useState)("dark"),[eA,eD]=(0,_.useState)("dashboard"),[eZ,eO]=(0,_.useState)(!1),[eH,eB]=(0,_.useState)(null),[eK,eW]=(0,_.useState)(null),[eF,eY]=(0,_.useState)(!0),[eJ,eG]=(0,_.useState)(null),[eV,eq]=(0,_.useState)(null),[eX,e$]=(0,_.useState)([]),[e0,e4]=(0,_.useState)([]),[e6,e8]=(0,_.useState)(""),[e9,e7]=(0,_.useState)(""),[te,tt]=(0,_.useState)("/sdcard/app.apk"),[ts,tn]=(0,_.useState)(""),[tl,ti]=(0,_.useState)(null),[ta,tr]=(0,_.useState)(!0),[to,tc]=(0,_.useState)(!0),td=(0,_.useRef)(null),tx=(0,_.useRef)(null),tm=(0,_.useCallback)((e,t)=>"zh"===eU?e:t,[eU]),tu=(0,_.useCallback)(e=>{eq(e),window.setTimeout(()=>eq(null),2800)},[]),th=(0,_.useCallback)(async(e,t)=>(0,Y.N)("".concat(eM).concat(e),t),[eM]),tp=(0,_.useCallback)(async()=>{if(td.current)return td.current;let e=(async()=>{try{var e;let t=await th("/hub/dashboard");eB(t),eW(null);let s=(null===(e=t.android)||void 0===e?void 0:e.devices)||[];if(s.length&&!ts){let e=s.find(e=>"device"===(e.state||"").toLowerCase());tn((null!=e?e:s[0]).serial)}}catch(e){eW(e.message)}finally{eY(!1),td.current=null}})();return td.current=e,e},[ts,th]),tb=(0,_.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===eA?e.set("family","youtube"):"live_tiktok"===eA&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[eA]),tg=(0,_.useCallback)(async()=>{if(tx.current)return tx.current;let e=(async()=>{try{let e=(await th(tb)).entries||[];e4(e),e$(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),e8(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{tx.current=null}})();return tx.current=e,e},[th,tb]);(0,_.useEffect)(()=>{let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&eT(e);let t=window.localStorage.getItem("live-hub-theme");("light"===t||"dark"===t)&&eE(t)},[]),(0,_.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",eU)},[eU]),(0,_.useEffect)(()=>{document.documentElement.setAttribute("data-theme",eI);try{window.localStorage.setItem("live-hub-theme",eI)}catch(e){}},[eI]),(0,_.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&tr(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&tc(!1)}catch(e){}},[]),(0,_.useEffect)(()=>{tp()},[tp]),(0,_.useEffect)(()=>{tg()},[tg]),(0,_.useEffect)(()=>{if(!ta||"live_youtube"===eA||"live_tiktok"===eA)return;let e=window.setInterval(()=>{tp()},1e4);return()=>clearInterval(e)},[ta,tp,eA]),(0,_.useEffect)(()=>{if(!ta)return;let e=window.setInterval(()=>{tg()},"live_youtube"===eA||"live_tiktok"===eA?700:4e3);return()=>clearInterval(e)},[ta,tg,eA]),(0,_.useEffect)(()=>{e6&&"live_youtube"===eA&&(async()=>{try{let e=await th("/get_url_config?process=".concat(encodeURIComponent(e6)));e7(e.content||"")}catch(e){}})()},[e6,th,eA]),(0,_.useEffect)(()=>{"settings"===eA&&(async()=>{try{let e=await th("/hub/config");ti(e)}catch(e){ti(null)}})()},[th,eA]);let tf=(0,_.useMemo)(()=>{var e;let t=(null==eH?void 0:null===(e=eH.stack)||void 0===e?void 0:e.quick_links)||{},s={};for(let[e,n]of Object.entries(t))/^https?:\/\//i.test(n)?s[e]=(0,ex.p)(n):s[e]=n;return s},[null==eH?void 0:null===(e=eH.stack)||void 0===e?void 0:e.quick_links]),tv=async(e,t)=>{eG("svc:".concat(e));try{let s=await th("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?tu(s.detail||s.message||tm("操作失败","Action failed")):tu(s.message||"OK"),await tp()}catch(e){tu(e.message)}finally{eG(null)}},ty=async(e,t)=>{let s=(null!=t?t:e6).trim();if(s){eG("proc:".concat(e,":").concat(s));try{let t=await th("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});tu(String(t.output||t.message||"OK")),await tg(),"live_youtube"===eA||"live_tiktok"===eA?tp():await tp()}catch(e){tu(e.message)}finally{eG(null)}}},tw=async(e,t)=>{let s=(null!=t?t:e6).trim();if(!s)return;let n=null!=e?e:e9;eG("save:url");try{let e=new URLSearchParams({process:s});await th("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),tu(tm("URL 配置已保存","URL config saved"))}catch(e){throw tu(e.message),e}finally{eG(null)}},tj=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ts){tu(tm("请选择设备","Pick a device"));return}eG("adb:".concat(e));try{let s=await th("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:ts,payload:t})});tu(s.message||"OK")}catch(e){tu(e.message)}finally{eG(null)}},tN=[{id:"dashboard",icon:a.Z,labelZh:"总览",labelEn:"Dashboard"},{id:"services",icon:r.Z,labelZh:"服务",labelEn:"Services"},{id:"live_youtube",icon:o.Z,labelZh:"YouTube 无人直播",labelEn:"YouTube unmanned"},{id:"live_tiktok",icon:c.Z,labelZh:"TikTok 无人直播",labelEn:"TikTok unmanned"},{id:"android",icon:d.Z,labelZh:"安卓",labelEn:"Android"},{id:"network",icon:x.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:m.Z,labelZh:"设置",labelEn:"Settings"}],tk=e=>{navigator.clipboard.writeText(e).then(()=>tu(tm("已复制","Copied")),()=>tu(tm("复制失败","Copy failed")))},tz=null!==(eg=null==eH?void 0:null===(t=eH.services)||void 0===t?void 0:t.filter(e=>e.running&&e.available).length)&&void 0!==eg?eg:0,tS=null!==(ef=null==eH?void 0:null===(s=eH.services)||void 0===s?void 0:s.length)&&void 0!==ef?ef:0;return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===eI?"bg-slate-100 text-slate-900 selection:bg-violet-400/25":"bg-[#050508] text-zinc-100 selection:bg-violet-500/30"),children:[(0,n.jsx)("div",{className:"lp-noise pointer-events-none fixed inset-0 z-0 ".concat("light"===eI?"opacity-[0.06]":"opacity-[0.22]"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora pointer-events-none fixed -left-1/4 top-0 h-[42rem] w-[42rem] rounded-full blur-[120px] ".concat("light"===eI?"bg-violet-400/15":"bg-violet-600/20"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora2 pointer-events-none fixed bottom-0 right-0 h-[36rem] w-[36rem] rounded-full blur-[100px] ".concat("light"===eI?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),eV?(0,n.jsx)(l.E.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},className:"fixed bottom-6 left-1/2 z-[100] max-w-md -translate-x-1/2 rounded-2xl border border-white/10 bg-zinc-950/95 px-5 py-3 text-center text-sm text-zinc-100 shadow-2xl shadow-black/50 backdrop-blur-xl",children:eV}):null,(0,n.jsxs)("div",{className:"relative z-10 flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"hidden w-64 shrink-0 flex-col border-r px-4 py-6 backdrop-blur-2xl lg:flex ".concat("light"===eI?"border-slate-200/90 bg-white/70":"border-white/[0.06] bg-zinc-950/40"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500 to-cyan-400 shadow-lg shadow-violet-500/25",children:(0,n.jsx)(u.Z,{className:"h-4 w-4 text-white"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] ".concat("light"===eI?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===eI?"text-slate-900":"text-white"),children:tm("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:tN.map(e=>{let t=e.icon,s=eA===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>eD(e.id),className:"flex items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm font-medium transition ".concat("light"===eI?s?"bg-violet-100/90 text-slate-900 shadow-inner shadow-violet-200/50":"text-slate-600 hover:bg-slate-200/60 hover:text-slate-900":s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-200"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat("light"===eI?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),tm(e.labelZh,e.labelEn),s?(0,n.jsx)(h.Z,{className:"ml-auto h-4 w-4 ".concat("light"===eI?"text-slate-400":"text-zinc-600")}):null]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxs)("header",{className:"sticky top-0 z-20 flex items-center justify-between gap-3 border-b px-4 py-3 backdrop-blur-xl lg:px-8 ".concat("light"===eI?"border-slate-200/80 bg-white/75 text-slate-900":"border-white/[0.06] bg-zinc-950/70 text-white"),children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,n.jsx)("button",{type:"button",className:"rounded-xl border p-2 lg:hidden ".concat("light"===eI?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>eO(!0),"aria-label":"Menu",children:(0,n.jsx)(p.Z,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight lg:text-xl ".concat("light"===eI?"text-slate-900":"text-white"),children:tm((null===(L=tN.find(e=>e.id===eA))||void 0===L?void 0:L.labelZh)||"",(null===(M=tN.find(e=>e.id===eA))||void 0===M?void 0:M.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===eI?"text-slate-500":"text-zinc-500"),children:[(null==eH?void 0:null===(U=eH.stack)||void 0===U?void 0:U.mdns_host)||"live.local"," \xb7"," ","dark"===eI?tm("夜间","Dark mode"):tm("日间","Light mode")," \xb7 ",tm("自动刷新","Auto refresh")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>eE(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===eI?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===eI?tm("切换到日间","Switch to light"):tm("切换到夜间","Switch to dark"),"aria-label":"dark"===eI?tm("日间模式","Light mode"):tm("夜间模式","Dark mode"),"aria-pressed":"light"===eI,children:"dark"===eI?(0,n.jsx)(b.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(g.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>eT(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===eI?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===eU?"English":"中文","aria-label":tm("切换语言","Toggle language"),"aria-pressed":"en"===eU,children:[(0,n.jsx)(f.Z,{className:"h-5 w-5",strokeWidth:2}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-4 min-w-[1rem] items-center justify-center rounded px-0.5 text-[9px] font-bold leading-none ".concat("light"===eI?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===eU?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!eJ,onClick:()=>void Promise.all([tp(),tg()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===eI?"border-slate-200 bg-white text-slate-700 hover:bg-slate-50":"border-white/10 bg-white/[0.04] text-zinc-300 hover:bg-white/[0.07]"),children:[eJ?(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:tm("刷新","Refresh")})]})]})]}),(0,n.jsx)("main",{className:"flex-1 px-4 py-6 lg:px-8 lg:py-8",children:(0,n.jsx)(i.M,{mode:"wait",children:(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.28,ease:[.22,1,.36,1]},children:["dashboard"===eA?(0,n.jsxs)("div",{className:"space-y-6",children:[eK?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[tm("无法加载仪表盘:","Dashboard error: "),eK]}):null,(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.02},className:"rounded-2xl border p-2 backdrop-blur-xl ".concat("light"===eI?"border-slate-200/90 bg-white/80 shadow-sm shadow-slate-200/30":"border-white/[0.07] bg-zinc-950/30"),children:(0,n.jsx)(R.Z,{snapshot:null!==(ev=null==eH?void 0:eH.snapshot)&&void 0!==ev?ev:null,theme:eI,tr:tm})}),(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05},className:"rounded-2xl border p-3 shadow-lg ".concat("light"===eI?"border-fuchsia-200/80 bg-gradient-to-br from-fuchsia-50/90 via-white to-cyan-50/70 shadow-fuchsia-100/40":"border-fuchsia-500/20 bg-gradient-to-br from-fuchsia-500/10 via-zinc-950/60 to-cyan-500/10 shadow-fuchsia-900/10"),children:(0,n.jsx)(C,{tr:tm})}),(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[{icon:w.Z,label:tm("CPU 1m","CPU 1m"),value:null!==(ey=null==eH?void 0:null===(E=eH.snapshot)||void 0===E?void 0:null===(I=E.cpu_load)||void 0===I?void 0:null===(T=I["1m"])||void 0===T?void 0:T.toFixed(2))&&void 0!==ey?ey:"—",sub:tm("负载均值","Load avg")},{icon:a.Z,label:tm("内存","Memory"),value:e5(null==eH?void 0:null===(D=eH.snapshot)||void 0===D?void 0:null===(A=D.memory)||void 0===A?void 0:A.available),sub:"/ ".concat(e5(null==eH?void 0:null===(O=eH.snapshot)||void 0===O?void 0:null===(Z=O.memory)||void 0===Z?void 0:Z.total))},{icon:j.Z,label:tm("磁盘可用","Disk free"),value:e5(null==eH?void 0:null===(B=eH.snapshot)||void 0===B?void 0:null===(H=B.disk)||void 0===H?void 0:H.free),sub:"/ ".concat(e5(null==eH?void 0:null===(W=eH.snapshot)||void 0===W?void 0:null===(K=W.disk)||void 0===K?void 0:K.total))},{icon:r.Z,label:tm("服务在线","Services up"),value:"".concat(tz,"/").concat(tS||"—"),sub:tm("基础服务层","Infra layer")},{icon:N.Z,label:tm("运行时间","Uptime"),value:function(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e)),s=Math.floor(t/86400),n=Math.floor(t%86400/3600),l=Math.floor(t%3600/60);return s>0?"".concat(s,"d ").concat(n,"h"):n>0?"".concat(n,"h ").concat(l,"m"):"".concat(l,"m")}(null==eH?void 0:null===(F=eH.snapshot)||void 0===F?void 0:F.uptime_seconds),sub:tm("自开机","Since boot")}].map((e,t)=>(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.05*t,duration:.35,ease:[.22,1,.36,1]},whileHover:{y:-2},className:"group relative overflow-hidden rounded-xl border border-white/[0.07] bg-gradient-to-br from-white/[0.05] to-transparent p-3 shadow-lg shadow-black/20",children:[(0,n.jsx)("div",{className:"absolute -right-4 -top-4 h-16 w-16 rounded-full bg-violet-500/10 blur-xl transition group-hover:bg-violet-500/18"}),(0,n.jsx)(e.icon,{className:"h-4 w-4 text-violet-300/90"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:e.label}),(0,n.jsx)("p",{className:"mt-0.5 font-mono text-lg font-semibold leading-tight text-white",children:eF?"…":e.value}),(0,n.jsx)("p",{className:"mt-0.5 text-[10px] text-zinc-500",children:e.sub})]},e.label))}),(null==eH?void 0:eH.hardware)&&"object"==typeof eH.hardware?(0,n.jsxs)("div",{className:"rounded-2xl border border-indigo-500/25 bg-gradient-to-br from-indigo-500/[0.1] via-zinc-950/70 to-violet-500/[0.08] p-6 shadow-2xl shadow-indigo-500/5",children:[(0,n.jsx)("h3",{className:"text-base font-semibold text-white",children:tm("系统硬件与软件能力","Hardware & software profile")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("来自 hardware_probe;用于直播/解码策略参考。","From hardware_probe; guides decode/streaming posture.")}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-indigo-300/90",children:tm("平台","Platform")}),(0,n.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"arch"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(ew=eH.hardware.arch)&&void 0!==ew?ew:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"kernel"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(eN=null!==(ej=eH.hardware.kernel)&&void 0!==ej?ej:null===(J=eH.stack)||void 0===J?void 0:J.kernel)&&void 0!==eN?eN:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Python"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(ek=null===(G=eH.stack)||void 0===G?void 0:G.python)&&void 0!==ek?ek:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"mDNS"}),(0,n.jsx)("dd",{className:"text-right text-cyan-200/90",children:null!==(eS=null===(V=eH.stack)||void 0===V?void 0:V.mdns_host)&&void 0!==eS?eS:"—"})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"IP"}),(0,n.jsx)("dd",{className:"text-right text-zinc-300",children:((null===(q=eH.stack)||void 0===q?void 0:q.ips)||[]).join(" \xb7 ")||"—"})]})]})]}),(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-fuchsia-300/90",children:"GPU / NPU"}),(()=>{let e=eH.hardware.gpu,t=eH.hardware.npu;return(0,n.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"GPU"}),(0,n.jsxs)("dd",{className:"mt-0.5 text-zinc-200",children:[(null==e?void 0:e.present)?tm("已检测","present"):tm("未检测","absent"),(null==e?void 0:e.driver)?" \xb7 ".concat(e.driver):""]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"render"}),(0,n.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:((null==e?void 0:e.render_nodes)||[]).join(", ")||"—"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"NPU"}),(0,n.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:(null==t?void 0:t.present)?(t.devices||[]).join(", "):tm("—","—")})]})]})})()]}),(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4 lg:col-span-2",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-emerald-300/90",children:"ffmpeg / 建议策略"}),(()=>{var e,t,s,l;let i=eH.hardware.ffmpeg_hwaccels||[],a=eH.hardware.recommendation;return(0,n.jsxs)("div",{className:"space-y-2 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"hwaccels: "}),(0,n.jsx)("span",{className:"font-mono text-emerald-200/90",children:i.length?i.join(", "):"—"})]}),(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsxs)("span",{className:"text-zinc-600",children:[tm("解码","Decoder"),": "]}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(e=null==a?void 0:a.video_decoder)&&void 0!==e?e:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"HDMI: "}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(t=null==a?void 0:a.hdmi_player)&&void 0!==t?t:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Browser: "}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(s=null==a?void 0:a.browser_hwaccel)&&void 0!==s?s:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsxs)("span",{className:"text-zinc-600",children:[tm("稳定模式","Stability"),": "]}),(0,n.jsx)("span",{className:"text-amber-200/90",children:null!==(l=null==a?void 0:a.stability_mode)&&void 0!==l?l:"—"})]})]}),((null==a?void 0:a.degradation_reasons)||[]).length?(0,n.jsx)("ul",{className:"mt-2 list-inside list-disc space-y-1 text-[10px] text-amber-200/80",children:((null==a?void 0:a.degradation_reasons)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]})})()]})]})]}):null,(null==eH?void 0:null===(X=eH.stack)||void 0===X?void 0:X.neko_login)?(0,n.jsxs)("div",{className:"rounded-2xl border border-fuchsia-500/25 bg-gradient-to-r from-fuchsia-500/[0.08] to-violet-500/[0.06] p-5",children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:["Neko ",tm("登录","sign-in")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:eH.stack.neko_login.note_zh||tm("Neko Chromium :9200 使用下列账号策略。","Neko Chromium :9200 uses the policy below.")}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-amber-200/85",children:tm("重要:两栏分开填——昵称随意,密码必须是环境变量里的口令(默认 12345678)。用错密码会像一直加载;勿把「用户名/密码」写在一行。","Use two fields: display name is free-form; password must match NEKO_* (default 12345678). Wrong password looks like infinite loading.")}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 font-mono text-sm",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,n.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:tm("昵称示例","Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-fuchsia-200",children:null!==(e_=eH.stack.neko_login.user_login)&&void 0!==e_?e_:"live"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:tm("连接口令","Access Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-fuchsia-100",children:null!==(eC=eH.stack.neko_login.user_password)&&void 0!==eC?eC:"—"})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,n.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:tm("管理昵称示例","Admin Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-violet-200",children:null!==(eR=eH.stack.neko_login.admin_login)&&void 0!==eR?eR:"admin"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:tm("管理口令","Admin Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-violet-100",children:null!==(eP=eH.stack.neko_login.admin_password)&&void 0!==eP?eP:"—"})]})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:tm("x86 默认使用 Neko 的 Chrome 镜像,ARM 默认使用 Chromium 镜像;默认保留管理员会话、开发者工具和 Tampermonkey 持久化。本栈未启用 Firefox 版 Neko。","x86 defaults to Neko’s Chrome image, ARM defaults to Chromium, and admin access, DevTools, plus persistent Tampermonkey stay enabled. This stack does not use Firefox Neko.")})]}):null,(null==eH?void 0:null===(Q=eH.network)||void 0===Q?void 0:null===($=Q.interfaces)||void 0===$?void 0:$.length)?(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-gradient-to-br from-cyan-500/[0.07] to-transparent p-5",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(k.Z,{className:"h-4 w-4 text-cyan-300"}),tm("网络流量(累计)","Network I/O (cumulative)")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("自开机以来各接口收发字节;非实时速率。","Per-interface RX/TX since boot (not a live bitrate).")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:(eH.network.interfaces||[]).slice(0,6).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 px-4 py-3 font-mono text-[11px]",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-cyan-200/90",children:e.name}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:[tm("链路","Link"),": ",e.operstate||"unknown"," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e.speed_mbps?"".concat(e.speed_mbps," Mbps"):tm("未知速率","unknown speed")]}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:["↓ ",e5(e.rx_bytes)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(l=null===(t=e.rx_packets)||void 0===t?void 0:t.toLocaleString())&&void 0!==l?l:"—"," pkt"]}),(0,n.jsxs)("p",{className:"mt-0.5 text-zinc-500",children:["↑ ",e5(e.tx_bytes)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(i=null===(s=e.tx_packets)||void 0===s?void 0:s.toLocaleString())&&void 0!==i?i:"—"," pkt"]})]},e.name)})})]}):null,(null==eH?void 0:null===(et=eH.live_events)||void 0===et?void 0:null===(ee=et.pm2_tail)||void 0===ee?void 0:ee.length)||(null==eH?void 0:null===(en=eH.live_events)||void 0===en?void 0:null===(es=en.process_digest)||void 0===es?void 0:es.length)?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/15 bg-zinc-950/40 p-5",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("直播 / PM2 事件","Live / PM2 feed")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("PM2 合并日志尾部","PM2 merged log tail")}),(0,n.jsx)("pre",{className:"mt-3 max-h-48 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.05] bg-black/40 p-3 font-mono text-[10px] leading-relaxed text-zinc-400",children:((null==eH?void 0:null===(el=eH.live_events)||void 0===el?void 0:el.pm2_tail)||[]).join("\n")||tm("暂无 PM2 输出","No PM2 output")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/40 p-5",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("进程快照","Process digest")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:((null==eH?void 0:null===(ei=eH.live_events)||void 0===ei?void 0:ei.process_digest)||[]).map(e=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.05] bg-black/30 px-3 py-2 text-xs",children:[(0,n.jsx)("span",{className:"truncate text-zinc-300",children:e.label||e.pm2}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ".concat(e2(e.status||"")),children:e3(e.status||"",tm)})]},e.pm2))})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/50 to-fuchsia-500/[0.06] p-5 shadow-lg shadow-violet-500/5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("直播进程","Live processes")}),(0,n.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 text-[10px] font-medium text-zinc-300",children:(null==eH?void 0:null===(er=eH.live)||void 0===er?void 0:er.backend_mode)||"—"})]}),(0,n.jsxs)("ul",{className:"mt-4 space-y-2.5",children:[((null==eH?void 0:null===(eo=eH.live)||void 0===eo?void 0:eo.processes)||[]).slice(0,10).map(e=>(0,n.jsxs)("li",{className:"group flex items-center gap-3 rounded-xl border border-white/[0.08] bg-black/35 px-3 py-2.5 transition hover:border-violet-400/25 hover:bg-black/45",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500/30 to-fuchsia-500/20 text-[10px] font-bold text-violet-100 ring-1 ring-white/10",children:"LIVE"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-sm font-medium text-zinc-100",children:e.label||e.pm2}),(0,n.jsx)("p",{className:"truncate font-mono text-[10px] text-zinc-600",children:e.script||e.pm2})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-lg px-2.5 py-1 text-[10px] font-semibold ".concat(e2(e.process_status||"")),children:e3(e.process_status||"",tm)})]},e.pm2)),(null==eH?void 0:null===(ed=eH.live)||void 0===ed?void 0:null===(ec=ed.processes)||void 0===ec?void 0:ec.length)?null:(0,n.jsx)("li",{className:"rounded-xl border border-dashed border-white/10 py-8 text-center text-xs text-zinc-600",children:tm("暂无直播进程","No live processes")})]}),(0,n.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>eD("live_youtube"),className:"rounded-xl border border-violet-400/35 bg-violet-500/15 py-2.5 text-[11px] font-semibold text-violet-100 shadow-inner shadow-black/20 transition hover:bg-violet-500/25",children:"YouTube"}),(0,n.jsx)("button",{type:"button",onClick:()=>eD("live_tiktok"),className:"rounded-xl border border-cyan-400/35 bg-cyan-500/15 py-2.5 text-[11px] font-semibold text-cyan-100 shadow-inner shadow-black/20 transition hover:bg-cyan-500/25",children:"TikTok"})]})]}),(null==eH?void 0:eH.probes)&&to?(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[eH.probes.srs?(()=>{var e,t,s,l,i,a,r;let o=null===(e=eH.probes)||void 0===e?void 0:e.srs,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:null===(s=o.tcp_api)||void 0===s?void 0:s.reachable,x=null==o?void 0:o.http_ui,m=null==o?void 0:o.http,u=null==o?void 0:o.api_port,h=null!==(i=null==o?void 0:o.api_ok)&&void 0!==i?i:(null==m?void 0:m.http_code)===200,p=null==x?void 0:x.http_code;return(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white",children:"SRS"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(h?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:h?tm("API 正常","API OK"):tm("API 异常","API down")})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:[":",null!==(a=null==o?void 0:o.port)&&void 0!==a?a:"—"," / API :",null!=u?u:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 API TCP"," ",d?"OK":"—"]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:["API HTTP ",null!==(r=null==m?void 0:m.http_code)&&void 0!==r?r:"—"," \xb7 ",tm("根路径","root")," ",null!=p?p:"—",404===p?tm("(无首页不影响推流)"," (no index is OK for streaming)"):null]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[tm("延迟","RTT")," ",(null==m?void 0:m.latency_ms)!=null?"".concat(m.latency_ms," ms"):(null==o?void 0:null===(l=o.tcp)||void 0===l?void 0:l.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),!h&&(null==m?void 0:m.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:m.error}):null]})})():null,eH.probes.neko?(()=>{var e,t,s,l,i;let a=null===(e=eH.probes)||void 0===e?void 0:e.neko,r=null==a?void 0:null===(t=a.tcp)||void 0===t?void 0:t.reachable,o=null==a?void 0:a.http;return(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white",children:"Neko Chromium"}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("Docker 内 Chromium(非 Chrome 品牌);arm64/x86 同一镜像。","Chromium in Docker (not Chrome branding); multi-arch.")}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[":",null!==(l=null==a?void 0:a.port)&&void 0!==l?l:"—"," \xb7 TCP ",r?"OK":"—"," \xb7 HTTP ",null!==(i=null==o?void 0:o.http_code)&&void 0!==i?i:"—"]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[tm("延迟","RTT")," ",(null==o?void 0:o.latency_ms)!=null?"".concat(o.latency_ms," ms"):(null==a?void 0:null===(s=a.tcp)||void 0===s?void 0:s.latency_ms)!=null?"".concat(a.tcp.latency_ms," ms"):"—"]}),!(null==o?void 0:o.reachable)&&(null==o?void 0:o.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:o.error}):null]})})():null]}):null]}):null,"services"===eA?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==eH?void 0:eH.services)||[]).map((e,t)=>(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.04*t},whileHover:{y:-2},className:"rounded-2xl border border-white/[0.07] bg-gradient-to-b from-white/[0.05] to-transparent p-5",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-semibold text-white",children:e.label}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(e2(e.running?"online":e.status)),children:e.running?tm("运行中","Running"):e.status})]}),e.detail?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-snug line-clamp-6 ".concat("skipped"===e.status?"text-slate-300/90":"text-amber-200/85"),children:e.detail}):null,"shellcrash"===e.service_id&&e.available&&!e.running?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-500",children:tm("stopped 为常态:仅当需要透明代理 / 规则分流时再点 Start(或 systemctl enable --now shellcrash)。","Stopped is normal; Start only when you need the proxy (or enable shellcrash.service).")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,ex.p)(e.url),target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-3 py-1.5 text-xs font-medium text-violet-200 ring-1 ring-violet-500/25",children:tm("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs font-medium text-emerald-200 ring-1 ring-emerald-500/30 disabled:opacity-30",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"install"),className:"rounded-lg bg-sky-500/15 px-3 py-1.5 text-xs font-medium text-sky-200 ring-1 ring-sky-500/25 disabled:opacity-30",children:"Install"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-1.5 text-xs font-medium text-amber-200 ring-1 ring-amber-500/25 disabled:opacity-30",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"upgrade"),className:"rounded-lg bg-indigo-500/15 px-3 py-1.5 text-xs font-medium text-indigo-200 ring-1 ring-indigo-500/25 disabled:opacity-30",children:"Upgrade"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-1.5 text-xs font-medium text-rose-200 ring-1 ring-rose-500/25 disabled:opacity-30",children:"Stop"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"uninstall"),className:"rounded-lg bg-zinc-500/15 px-3 py-1.5 text-xs font-medium text-zinc-200 ring-1 ring-zinc-500/25 disabled:opacity-30",children:"Uninstall"})]})]},e.service_id)),(null==eH?void 0:null===(em=eH.services)||void 0===em?void 0:em.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:tm("暂无服务数据","No services")})]}):null,"live_youtube"===eA?(0,n.jsx)(eQ,{t:tm,busy:eJ,entries:eX,currentProc:e6,setCurrentProc:e8,urlConfig:e9,setUrlConfig:e7,onRunProcess:(e,t)=>void ty(e,t),onSaveUrlConfig:(e,t)=>tw(e,t),fetchJson:th,liveProcesses:e0.length?e0:null!==(eL=null==eH?void 0:null===(eu=eH.live)||void 0===eu?void 0:eu.processes)&&void 0!==eL?eL:[],notify:tu,onNavigate:e=>eD(e)}):null,"live_tiktok"===eA?(0,n.jsx)(ez,{t:tm,busy:!!eJ,entries:eX,currentProc:e6,setCurrentProc:e8,urlConfig:e9,setUrlConfig:e7,onRunProcess:e=>void ty(e),onSaveUrlConfig:e=>tw(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await tw("原画,".concat(e,",主播: ").concat(s)),await ty("start")},onCopy:tk,fetchJson:th,apiPrefix:eM,quickLinks:tf,hdmiStatus:null==eH?void 0:eH.hdmi,notify:tu,onNavigate:e=>eD(e)}):null,"android"===eA?(0,n.jsx)(ea,{t:tm,notify:tu,fetchJson:th,apiBase:eM,busy:eJ,androidSerial:ts,setAndroidSerial:tn,devices:(null==eH?void 0:null===(eh=eH.android)||void 0===eh?void 0:eh.devices)||[],adbAvailable:!!(null==eH?void 0:null===(ep=eH.android)||void 0===ep?void 0:ep.adb_available),apkPath:te,setApkPath:tt,onAndroidAction:(e,t)=>tj(e,null!=t?t:{}),onCopy:tk,onRefreshDevices:()=>void tp()}):null,"network"===eA?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===eI?"border-violet-200/90 bg-gradient-to-br from-violet-50 via-white to-fuchsia-50/80":"border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===eI?"text-slate-900":"text-white"),children:[(0,n.jsx)(k.Z,{className:"h-4 w-4 ".concat("light"===eI?"text-violet-600":"text-violet-300")}),tm("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===eI?"text-slate-600":"text-zinc-400"),children:tm("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","Proxy rules and YAML editing are embedded here. Use Services for SRS/Neko/Chromium, etc.")}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:justify-center",children:[{tx:tm("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:tm("本机 / 安卓","Host / Android"),c:"from-emerald-400 to-teal-500"}].map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex h-16 w-28 items-center justify-center rounded-2xl bg-gradient-to-br ".concat(e.c," text-xs font-bold text-white shadow-lg"),children:e.tx}),t<2?(0,n.jsx)(h.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===eI?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===eI?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:(0,n.jsx)("div",{className:"max-h-[min(78vh,56rem)] min-h-[22rem] overflow-y-auto overflow-x-hidden",children:(0,n.jsx)(P.d,{embeddedShellCrash:!0,portalLang:eU})})})]}):null,"settings"===eA?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===eI?"text-slate-600":"text-zinc-400"),children:tm("常用选项(本机偏好);完整文件与 JSON 编辑见下方链接。","Local preferences; full file/JSON editor via the link below.")}),(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:tm("总览自动刷新","Auto-refresh dashboard")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:"10s"})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:ta,onChange:e=>{let t=e.target.checked;tr(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}tu(t?tm("已开启刷新","Auto refresh on"):tm("已暂停刷新","Paused"))}})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 border-t border-white/[0.06] pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:tm("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:tm("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:to,onChange:e=>{let t=e.target.checked;tc(t);try{localStorage.setItem("livehub.showStreamProbes",t?"1":"0")}catch(e){}}})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/40 p-5",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500",children:tm("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==tl?void 0:tl.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[tm("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==tl?void 0:tl.system;return(null==n?void 0:null===(t=n.identity)||void 0===t?void 0:null===(e=t.hostname_alias)||void 0===e?void 0:e.trim())||((null==eH?void 0:null===(s=eH.stack)||void 0===s?void 0:s.mdns_host)||"").replace(/\.local$/i,"")||"—"})()})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:null==tl?void 0:null===(eb=tl.services)||void 0===eb?void 0:eb.slice(0,8).map(e=>(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-medium ".concat(e.enabled?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400"),children:[e.id," ",e.enabled?"ON":"off"]},e.id))})]}),(0,n.jsxs)("a",{href:"/console?tab=config",className:"inline-flex w-full items-center justify-center gap-2 rounded-xl border py-3 text-sm transition ".concat("light"===eI?"border-slate-200 bg-slate-50 text-violet-700 hover:bg-slate-100":"border-white/10 bg-white/[0.05] text-violet-200 hover:bg-white/[0.08]"),children:[tm("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(z.Z,{className:"h-4 w-4"})]})]}):null]},eA)})})]})]}),(0,n.jsx)(i.M,{children:eZ?(0,n.jsx)(l.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm lg:hidden",onClick:()=>eO(!1),children:(0,n.jsxs)(l.E.aside,{initial:{x:-280},animate:{x:0},exit:{x:-280},transition:{type:"spring",damping:28,stiffness:320},className:"absolute left-0 top-0 h-full w-[min(88vw,280px)] border-r border-white/10 bg-zinc-950 p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>eO(!1),className:"rounded-lg p-2",children:(0,n.jsx)(S.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:tN.map(e=>{let t=e.icon;return(0,n.jsxs)("button",{type:"button",onClick:()=>{eD(e.id),eO(!1)},className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm text-zinc-300",children:[(0,n.jsx)(t,{className:"h-4 w-4 text-violet-400"}),tm(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}},function(e){e.O(0,[500,719,246,971,117,744],function(){return e(e.s=4578)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{4578:function(e,t,s){Promise.resolve().then(s.bind(s,1499))},1499:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return e4}});var n=s(7437),l=s(6247),i=s(7586),a=s(4401),r=s(6137),o=s(4372),c=s(5901),d=s(3388),x=s(3420),m=s(8728),u=s(2023),h=s(407),p=s(6840),b=s(7226),g=s(5929),f=s(7945),v=s(1817),y=s(7168),w=s(4822),j=s(4428),N=s(1723),k=s(2926),z=s(7580),S=s(2489),_=s(2265);function C(e){let{tr:t}=e,l=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e;if(!l.current)return;let t=!1,n=0;return s.e(689).then(s.bind(s,1448)).then(s=>{if(t||!l.current)return;let i=l.current,a=Math.max(i.clientWidth,280),r=Math.max(i.clientHeight,200),o=new s.Scene,c=new s.PerspectiveCamera(48,a/r,.1,80);c.position.set(0,1.1,7.2);let d=new s.WebGLRenderer({antialias:!0,alpha:!0});d.setPixelRatio(Math.min(window.devicePixelRatio,2)),d.setSize(a,r),d.setClearColor(0,0),i.appendChild(d.domElement);let x=new s.HemisphereLight(16762092,4482815,.85);o.add(x);let m=new s.DirectionalLight(16777215,.9);m.position.set(4,8,6),o.add(m);let u=new s.PointLight(8189439,.6,20);u.position.set(-3,2,-2),o.add(u);let h=new s.Group,p=new s.Mesh(new s.BoxGeometry(3.2,.35,2.2),new s.MeshStandardMaterial({color:2762048,metalness:.15,roughness:.55}));p.position.y=-.85,h.add(p);let b=new s.Mesh(new s.TorusGeometry(.72,.09,12,48),new s.MeshStandardMaterial({color:16724821,emissive:4456465,metalness:.35,roughness:.25}));b.rotation.x=Math.PI/2,b.position.set(-.85,.15,.2),h.add(b);let g=new s.Mesh(new s.ConeGeometry(.35,.5,3),new s.MeshStandardMaterial({color:16777215,emissive:2236962,metalness:.2,roughness:.3}));g.rotation.z=-Math.PI/2,g.rotation.y=Math.PI,g.position.set(-.55,.18,.2),h.add(g);let f=new s.Mesh(new s.CylinderGeometry(.22,.28,.95,20),new s.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}));f.position.set(1.05,.35,-.15),f.rotation.z=.12,h.add(f);let v=new s.Mesh(new s.SphereGeometry(.26,16,16),new s.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}));v.position.set(1.05,.92,-.15),h.add(v);let y=new s.BufferGeometry,w=new Float32Array(360);for(let e=0;e<120;e++)w[3*e]=(Math.random()-.5)*14,w[3*e+1]=(Math.random()-.3)*8,w[3*e+2]=(Math.random()-.5)*8-2;y.setAttribute("position",new s.BufferAttribute(w,3));let j=new s.Points(y,new s.PointsMaterial({color:16777215,size:.06,transparent:!0,opacity:.7}));o.add(j),o.add(h);let N=performance.now(),k=()=>{if(t)return;n=requestAnimationFrame(k);let e=(performance.now()-N)/1e3;h.rotation.y=.25*Math.sin(.35*e)+.12*e,h.position.y=.06*Math.sin(.9*e),b.rotation.z=.4*e,j.rotation.y=.02*e,d.render(o,c)};k();let z=new ResizeObserver(()=>{if(!l.current||t)return;let e=Math.max(l.current.clientWidth,280),s=Math.max(l.current.clientHeight,200);c.aspect=e/s,c.updateProjectionMatrix(),d.setSize(e,s)});z.observe(i),e=()=>{cancelAnimationFrame(n),z.disconnect(),d.dispose(),y.dispose(),d.domElement.parentNode===i&&i.removeChild(d.domElement)}}),()=>{t=!0,cancelAnimationFrame(n),null==e||e()}},[]),(0,n.jsxs)("div",{className:"flex h-full min-h-[14rem] flex-col",children:[(0,n.jsx)("p",{className:"mb-2 px-1 text-[10px] font-medium uppercase tracking-wider text-fuchsia-200/80",children:t("直播工作室 \xb7 3D","Live studio \xb7 3D")}),(0,n.jsx)("div",{ref:l,className:"relative min-h-[12rem] flex-1 overflow-hidden rounded-xl bg-gradient-to-b from-fuchsia-950/40 to-cyan-950/20 ring-1 ring-white/10"})]})}var R=s(9170),P=s(2246),L=s(4286),M=s(4794),U=s(221),T=s(8867),I=s(8124),E=s(2101),A=s(3651),D=s(9985),Z=s(6362),O=s(3468),H=s(6443),B=s(5287),K=s(3276),W=s(9227),F=s(257),Y=s(1387);class J{reset(){if(this.buf=new Uint8Array(0),this.sps=null,this.pps=null,this.configured=!1,this.configuring=!1,this.ts=0,this.decoder){try{this.decoder.close()}catch(e){}this.decoder=null}}push(e){let t=new Uint8Array(e.byteLength);t.set(new Uint8Array(e)),this.buf=function(e,t){let s=new Uint8Array(e.length+t.length);return s.set(e,0),s.set(t,e.length),s}(this.buf,t),this.drainAvcc()}drainAvcc(){let e=this.buf,t=0;for(;t+4<=e.length;){var s;let n=e[s=t]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3];if(n<=0||n>6291456){this.buf=new Uint8Array(e.subarray(t+1)),t=0;continue}if(t+4+n>e.length)break;let l=e.subarray(t+4,t+4+n);t+=4+n,this.handleNal(l)}t>0&&(this.buf=new Uint8Array(e.subarray(t)))}handleNal(e){if(e.length<2)return;let t=31&e[0];if(7===t?this.sps=new Uint8Array(e):8===t&&(this.pps=new Uint8Array(e)),this.sps&&this.pps&&!this.configured&&!this.configuring&&this.configure(),!this.configured||!this.decoder||1!==t&&5!==t&&7!==t&&8!==t||7===t||8===t)return;let s=new Uint8Array(4+e.length);new DataView(s.buffer).setUint32(0,e.length,!1),s.set(e,4);try{let e=new EncodedVideoChunk({type:5===t?"key":"delta",timestamp:this.ts,data:s});this.ts+=33333,this.decoder.decode(e)}catch(e){this.onDecodeError(e.message||String(e))}}async configure(){if(this.sps&&this.pps&&!this.configured&&!this.configuring){this.configuring=!0;try{let e=function(e,t){let s=e.subarray(1),n=t.subarray(1),l=new Uint8Array(11+s.length+3+n.length),i=0;return l[i++]=1,l[i++]=e[1],l[i++]=e[2],l[i++]=e[3],l[i++]=255,l[i++]=225,l[i++]=s.length>>8&255,l[i++]=255&s.length,l.set(s,i),i+=s.length,l[i++]=1,l[i++]=n.length>>8&255,l[i++]=255&n.length,l.set(n,i),l}(this.sps,this.pps),t=function(e){let t=e=>e.toString(16).padStart(2,"0").toUpperCase();return"avc1.".concat(t(e[1])).concat(t(e[2])).concat(t(e[3]))}(this.sps),s=new VideoDecoder({output:e=>{let t=this.canvas.getContext("2d");if(!t){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),t.drawImage(e,0,0),e.close()},error:e=>this.onDecodeError(String(e.message||e))});await s.configure({codec:t,description:e,optimizeForLatency:!0}),this.decoder=s,this.configured=!0}catch(e){this.onDecodeError(e.message||String(e))}finally{this.configuring=!1}}}constructor(e,t){this.canvas=e,this.onDecodeError=t,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function G(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let V="live-hub-adb-bookmarks-v1";function q(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.width,c=e.height;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let m=t-r.left-i,u=s-r.top-a;return m<0||u<0||m>n||u>l?null:{x:Math.max(0,Math.min(o-1,Math.round(m/n*o))),y:Math.max(0,Math.min(c-1,Math.round(u/l*c)))}}function X(e,t,s){let n,l,i,a;let r=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c)return null;let d=r.width/r.height,x=o/c;x>d?(n=r.width,l=r.width/x,i=0,a=(r.height-l)/2):(l=r.height,n=r.height*x,i=(r.width-n)/2,a=0);let m=t-r.left-i,u=s-r.top-a;return m<0||u<0||m>n||u>l?null:{x:Math.max(0,Math.min(o-1,Math.round(m/n*o))),y:Math.max(0,Math.min(c-1,Math.round(u/l*c)))}}let $=[0,280,450,700,1100];function Q(e){switch(e){case"usb":return{Icon:E.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:k.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:A.Z,zh:"模拟器",en:"Emu",cls:"bg-fuchsia-500/20 text-fuchsia-100 ring-fuchsia-500/35"};default:return{Icon:d.Z,zh:"?",en:"?",cls:"bg-zinc-600/30 text-zinc-400"}}}let ee="https://github.com/Genymobile/scrcpy",et="https://github.com/viarotel-org/escrcpy";function es(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function en(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:a,devices:r,setSerial:o,adbAvailable:c,lock:x,overview:m,onAndroidAction:h,notify:p,onRefreshDevices:b}=e,[g,f]=(0,_.useState)(0),[v,w]=(0,_.useState)(450),[j,N]=(0,_.useState)(!1),[k,z]=(0,_.useState)(null),[S,C]=(0,_.useState)(null),[R,P]=(0,_.useState)(!0),[L,M]=(0,_.useState)(""),[U,T]=(0,_.useState)(""),[I,E]=(0,_.useState)("37777"),[A,en]=(0,_.useState)(""),[el,ei]=(0,_.useState)(!1),[ea,er]=(0,_.useState)([]),[eo,ec]=(0,_.useState)(!1),[ed,ex]=(0,_.useState)(null),[em,eu]=(0,_.useState)(!1),[eh,ep]=(0,_.useState)(null),[eb,eg]=(0,_.useState)(null),ef=(0,_.useRef)(null),ev=(0,_.useRef)(null),ey=(0,_.useRef)(null),ew=(0,_.useRef)(null),ej=(0,_.useRef)(null),eN=(0,_.useRef)(null),ek=(0,_.useRef)(0),ez=null===(t=r.find(e=>e.serial===a))||void 0===t?void 0:t.transport,eS=v>0,e_=a?"".concat(es(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(a),"&ts=").concat(g).concat(eS?"&fast=1":""):"",eC=(0,_.useCallback)(()=>{f(e=>e+1)},[]);(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(V);if(e){let t=JSON.parse(e);Array.isArray(t)&&er(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eR=e=>{let t=e.trim();if(!t)return;let n=[t,...ea.filter(e=>e!==t)].slice(0,16);er(n);try{window.localStorage.setItem(V,JSON.stringify(n))}catch(e){}p(s("已保存快捷地址","Saved quick address"))};(0,_.useEffect)(()=>{if(!a||!c){C(null);return}let e=!1;return(async()=>{try{let t=await (0,Y.N)("".concat(es(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(a)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&C({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,a]),(0,_.useEffect)(()=>{if(!c||!a||v<=0||eo)return;let e=window.setInterval(()=>f(e=>e+1),v);return()=>clearInterval(e)},[c,v,a,eo]),(0,_.useEffect)(()=>{if(!c){eg(null);return}let e=!1;return(async()=>{try{let t=await (0,Y.N)(es(l,"/android/scrcpy/info"));e||eg(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,_.useEffect)(()=>{eo||ep(null)},[eo]),(0,_.useEffect)(()=>{ex(null)},[a]),(0,_.useEffect)(()=>{let e=r.find(e=>e.serial===a),t=!!(a&&ed===a);if(c&&a&&(null==e?void 0:e.state)==="device"&&(null==eb?void 0:eb.server_jar)&&G()&&!t){ec(!0),w(0);return}if(t||!a||!c||eb&&!eb.server_jar||!G()||e&&"device"!==e.state){ec(!1);return}},[a,r,c,eb,ed]),(0,_.useEffect)(()=>{if(!eo||!a||!c){var e,t;null===(e=ew.current)||void 0===e||e.close(),ew.current=null,null===(t=ej.current)||void 0===t||t.reset(),ej.current=null,eu(!1);return}if(!G()){ep(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),ec(!1);return}let n=ey.current;if(!n)return;let i=new J(n,e=>ep(e));ej.current=i;let r=new WebSocket(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920,n=(function(e){let t=(e||"").trim();if(t)try{let e=new URL(t,window.location.href),s="https:"===e.protocol?"wss:":"ws:";return"".concat(s,"//").concat(e.host)}catch(e){}let s=void 0!==F&&F.env.NEXT_PUBLIC_API_URL?String(F.env.NEXT_PUBLIC_API_URL).trim():"";if(s)try{let e=new URL(s,window.location.href),t="https:"===e.protocol?"wss:":"ws:";return"".concat(t,"//").concat(e.host)}catch(e){}let n=window.location.port;if("3000"===n||"3001"===n){let e=window.location.hostname||"127.0.0.1";return"ws://".concat(e,":").concat("8001")}let{protocol:l,host:i}=window.location;return"".concat("https:"===l?"wss:":"ws:","//").concat(i)})(e).replace(/\/$/,""),l=new URLSearchParams({serial:t,max_size:String(s)});return"".concat(n,"/android/scrcpy/ws?").concat(l.toString())}(l,a));return ew.current=r,r.binaryType="arraybuffer",r.onopen=()=>{eu(!0),ep(null)},r.onmessage=e=>{var t;if("string"==typeof e.data){try{let t=JSON.parse(e.data);t.error&&ep(t.error)}catch(e){}return}null===(t=ej.current)||void 0===t||t.push(e.data)},r.onerror=()=>{ep(s("WebSocket 异常","WebSocket error"))},r.onclose=()=>{var e;eu(!1),null===(e=ej.current)||void 0===e||e.reset(),ej.current=null},()=>{r.close(),ew.current=null,i.reset(),ej.current===i&&(ej.current=null)}},[eo,a,c,l,s]),(0,_.useEffect)(()=>{a&&c&&(ek.current=0,f(e=>e+1))},[a,c]);let eP=async()=>{let e=L.trim();if(!e){p(s("填写 host:port","Enter host:port"));return}ei(!0);try{let t=await i("/android/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||(t.ok?"OK":s("连接结果见日志","See message"))),b(),eC()}catch(e){p(e.message)}finally{ei(!1)}},eL=async e=>{ei(!0);try{let t=await i("/android/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:e})});p(t.message||"OK"),b()}catch(e){p(e.message)}finally{ei(!1)}},eM=async()=>{let e=U.trim(),t=parseInt(I,10)||37777,n=A.trim();if(!e||!n){p(s("填写配对 IP 与码","Host + code required"));return}ei(!0);try{let l=await i("/android/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({host:e,port:t,code:n})});p(l.message||(l.ok?s("配对成功后再点连接","Paired — now Connect"):"pair"))}catch(e){p(e.message)}finally{ei(!1)}},eU=async e=>{if(!R||x||!c||!a)return;let t=ev.current;if(!t)return;let n=X(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ef.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ef.current=null,await h("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ef.current={t:l,x:n.x,y:n.y},await h("tap",{x:n.x,y:n.y})),eC()},eT=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ev.current;if(!t)return;let n=X(t,e.clientX,e.clientY);n&&(await h("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eC())},eI=async e=>{if(!R||x||!c||!a)return;let t=ey.current;if(!t)return;let n=q(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ef.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ef.current=null,await h("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ef.current={t:l,x:n.x,y:n.y},await h("tap",{x:n.x,y:n.y})),eo||eC()},eE=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ey.current;if(!t)return;let n=q(t,e.clientX,e.clientY);n&&(await h("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eo||eC())};if(!c)return(0,n.jsx)("div",{className:"rounded-2xl border border-amber-500/25 bg-amber-500/[0.06] p-6 text-center text-sm text-amber-200/90",children:s("宿主机未安装 adb,无法使用 Live 控制台。","adb is required for the Live console.")});let eA=Q(ez),eD=eA.Icon;return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-sky-500/20 bg-gradient-to-br from-sky-500/[0.08] via-zinc-950/80 to-zinc-900/90 p-4 ring-1 ring-white/[0.05]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)(D.Z,{className:"h-4 w-4 text-sky-400"}),(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:s("链路管理","Link manager")}),(0,n.jsx)("span",{className:"text-[10px] text-zinc-500",children:s("USB / Redroid :5555 / 无线调试(先配对再连接)","USB \xb7 Redroid :5555 \xb7 wireless (pair then connect)")})]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb connect"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("input",{className:"min-w-[12rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-3 py-2 font-mono text-xs text-zinc-200",placeholder:"192.168.1.10:5555",value:L,onChange:e=>M(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eP()}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eP(),className:"rounded-lg bg-sky-500/25 px-3 py-2 text-xs font-semibold text-sky-100 ring-1 ring-sky-400/40",children:el?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:el||x||!L.trim(),onClick:()=>eR(L),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),ea.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ea.map(e=>(0,n.jsx)("button",{type:"button",className:"rounded-md bg-white/[0.06] px-2 py-0.5 font-mono text-[10px] text-zinc-400 hover:bg-white/10",onClick:()=>M(e),children:e},e))}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,n.jsx)("button",{type:"button",disabled:el||x||!a,onClick:()=>void eL(a),className:"rounded-lg border border-rose-500/30 bg-rose-500/10 px-2.5 py-1.5 text-[10px] text-rose-200",children:s("断开当前 TCP","Disconnect current")}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eL(""),className:"rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-500 hover:text-zinc-300",children:s("断开全部 TCP","Disconnect all TCP")}),(0,n.jsxs)("button",{type:"button",disabled:el||x,onClick:()=>{b(),eC(),p(s("已刷新设备列表","Devices refreshed"))},className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-2.5 py-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)(y.Z,{className:"h-3 w-3"}),"ADB list"]})]})]}),(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-white/[0.06] bg-black/35 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:"adb pair(无线调试)"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("input",{className:"w-32 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"IP",value:U,onChange:e=>T(e.target.value)}),(0,n.jsx)("input",{className:"w-20 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs",placeholder:"port",value:I,onChange:e=>E(e.target.value)}),(0,n.jsx)("input",{className:"min-w-[6rem] flex-1 rounded-lg border border-white/10 bg-black/50 px-2 py-1.5 font-mono text-xs tracking-widest",placeholder:"123456",value:A,onChange:e=>en(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:el||x,onClick:()=>void eM(),className:"rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-400/35",children:"Pair"})]}),(0,n.jsx)("p",{className:"text-[10px] leading-relaxed text-zinc-600",children:s("手机上「无线调试」会显示配对端口与 6 位码;配对成功后用上方 connect 连接 adb 显示的 IP:5555。","Use the pairing port + 6-digit code from Wireless debugging; then connect to the listed adb IP:5555.")})]})]})]}),(0,n.jsxs)("div",{className:"relative overflow-hidden rounded-3xl border border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.12] via-zinc-950/90 to-violet-500/[0.08] p-1 shadow-2xl shadow-emerald-900/20 ring-1 ring-white/[0.06]",children:[(0,n.jsx)("div",{className:"pointer-events-none absolute -right-20 -top-20 h-56 w-56 rounded-full bg-emerald-500/10 blur-3xl","aria-hidden":!0}),(0,n.jsxs)("div",{className:"relative rounded-[1.35rem] border border-white/[0.06] bg-zinc-950/80 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-emerald-400/30 to-violet-500/25 ring-1 ring-white/10",children:(0,n.jsx)(u.Z,{className:"h-6 w-6 text-emerald-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-base font-semibold tracking-tight text-white",children:s("无人直播系统 \xb7 ADB 云控台","Unmanned Live System \xb7 ADB farm console")}),(0,n.jsxs)("p",{className:"mt-1 max-w-xl text-[11px] leading-relaxed text-zinc-500",children:[s("统一适配 USB / Redroid / 无线 adb:已授权设备默认走官方 scrcpy-server 的 WebSocket H.264 真流(与桌面 ","USB / Redroid / wireless adb: authorized devices default to official scrcpy-server WebSocket H.264 (same stack as "),(0,n.jsx)("a",{href:et,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:ee,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"scrcpy"}),s(");无 jar 或关闭真流时用截图。","); PNG screenshot when jar missing or stream off.")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 self-start sm:flex-row",children:[(0,n.jsxs)("a",{href:et,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["escrcpy",(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:ee,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-[11px] font-medium text-zinc-300 hover:bg-white/[0.07]",children:["scrcpy",(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 opacity-70"})]})]})]}),r.length>0?(0,n.jsxs)("div",{className:"mt-5",children:[(0,n.jsxs)("p",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:[(0,n.jsx)(O.Z,{className:"h-3.5 w-3.5"}),s("设备矩阵","Device matrix")]}),(0,n.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:r.map(e=>{let t="device"===e.state,l=a===e.serial,i=Q(e.transport),r=i.Icon;return(0,n.jsxs)("button",{type:"button",onClick:()=>o(e.serial),className:"flex min-w-[9rem] flex-col rounded-xl border px-3 py-2 text-left transition ".concat(l?"border-emerald-500/50 bg-emerald-500/15 ring-1 ring-emerald-400/30":"border-white/10 bg-black/30 hover:border-white/20"),children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-zinc-200",children:[(0,n.jsx)(d.Z,{className:"h-3.5 w-3.5 text-emerald-400/80"}),(0,n.jsx)("span",{className:"truncate",children:e.model||e.serial.slice(0,10)})]}),(0,n.jsx)("span",{className:"mt-0.5 truncate font-mono text-[9px] text-zinc-600",children:e.serial}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 text-[9px] font-semibold ring-1 ".concat(i.cls),children:[(0,n.jsx)(r,{className:"h-2.5 w-2.5"}),s(i.zh,i.en)]}),(0,n.jsx)("span",{className:"rounded-md px-1.5 py-0.5 text-[9px] font-semibold ".concat(t?"bg-emerald-500/20 text-emerald-200":"bg-zinc-600/30 text-zinc-500"),children:e.state})]})]},e.serial)})})]}):null,(0,n.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-12",children:[(0,n.jsxs)("div",{className:"xl:col-span-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/[0.06] pb-3",children:[(0,n.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("刷新间隔","Interval")}),$.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>w(e),className:"rounded-lg px-2.5 py-1 text-[10px] font-semibold transition ".concat(v===e?"bg-violet-500/25 text-violet-100 ring-1 ring-violet-400/35":"bg-black/30 text-zinc-500 hover:text-zinc-300"),children:0===e?s("手动","Manual"):"".concat(e,"ms")},e)),(0,n.jsxs)("span",{className:"ml-1 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[9px] font-medium ring-1 ".concat(eA.cls),children:[(0,n.jsx)(eD,{className:"h-3 w-3"}),"tcp"===ez?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.jsxs)("button",{type:"button",disabled:x,onClick:()=>void eC(),className:"ml-auto inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-2.5 py-1 text-[10px] text-zinc-300 hover:bg-white/[0.08]",children:[(0,n.jsx)(y.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>void h("wake"),className:"rounded-lg bg-amber-500/20 px-2.5 py-1 text-[10px] font-semibold text-amber-100 ring-1 ring-amber-500/30",children:"Wake"}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-[10px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/50",checked:R,onChange:e=>P(e.target.checked)}),(0,n.jsx)(H.Z,{className:"h-3 w-3"}),s("点按穿透","Tap-through")]}),(0,n.jsxs)("button",{type:"button",disabled:x||!a||!(null==eb?void 0:eb.server_jar),title:eb&&!eb.server_jar&&eb.hint_zh?eb.hint_zh:s("官方 scrcpy-server + WebSocket H.264","Official scrcpy-server + WebSocket H.264"),onClick:()=>{ec(e=>{let t=!e;return t?(ex(null),p(s("已开启实时画面(H.264 WebSocket)","Live H.264 WebSocket stream on"))):(a&&ex(a),p(s("已关闭实时画面(将使用截图)","Live stream off — screenshot mode"))),t})},className:"inline-flex items-center gap-1 rounded-lg border px-2.5 py-1 text-[10px] font-semibold transition ".concat(eo?"border-cyan-400/50 bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/35":"border-white/10 bg-black/30 text-zinc-400 hover:text-zinc-200"),children:[(0,n.jsx)(B.Z,{className:"h-3 w-3"}),eo?s("关闭真流","Stop WS"):s("实时画面","Live H.264")]})]}),eb&&!eb.server_jar?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-amber-200/80",children:[s("未检测到 scrcpy-server:启动时会自动拉取;内网可在 runtime.env 配置 SCRCPY_SERVER_DOWNLOAD_URL(支持 {tag})。","scrcpy-server missing: auto-fetched on startup; set SCRCPY_SERVER_DOWNLOAD_URL ({tag}) for mirrors."),eb.server_version?" (".concat(s("期望版本","version")," ").concat(eb.server_version,")"):null]}):null,(0,n.jsx)("p",{className:"mt-2 text-[10px] text-zinc-600",children:s("快捷键(镜像区聚焦时):H Home \xb7 B Back \xb7 R 多任务 \xb7 W 唤醒 \xb7 M 菜单","Hotkeys (mirror focused): H Home \xb7 B Back \xb7 R Recents \xb7 W Wake \xb7 M Menu")}),(0,n.jsxs)("div",{className:"relative mx-auto mt-4 max-h-[min(78vh,720px)] min-h-[280px]",children:[a?(0,n.jsxs)("div",{ref:eN,tabIndex:0,onKeyDown:e=>{if(!a||x)return;let t=e.target.tagName;if("INPUT"===t||"TEXTAREA"===t||"SELECT"===t)return;let s={h:["key",{keycode:"3"}],b:["key",{keycode:"4"}],r:["key",{keycode:"187"}],w:["wake",void 0],m:["key",{keycode:"82"}]}[e.key.toLowerCase()];s&&(e.preventDefault(),(async()=>{await h(s[0],s[1]),eo||eC()})())},className:"relative flex justify-center outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50",children:[(0,n.jsxs)("div",{className:"relative rounded-[2rem] border-[10px] border-zinc-800 bg-black shadow-inner shadow-black/80 ring-1 ring-white/10",style:{maxHeight:"min(72vh, 680px)"},children:[(0,n.jsx)("div",{className:"absolute left-1/2 top-0 z-10 h-5 w-24 -translate-x-1/2 rounded-b-xl bg-black/80"}),eo?(0,n.jsx)("canvas",{ref:ey,className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(R?"cursor-crosshair":"cursor-default"),draggable:!1,onClick:eI,onContextMenu:eE}):(0,n.jsx)("img",{ref:ev,src:e_||void 0,alt:"device",className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(R?"cursor-crosshair":"cursor-default"),draggable:!1,onLoadStart:()=>{N(!0)},onLoad:()=>{N(!1),ek.current=0,z(null)},onError:()=>{N(!1),ek.current+=1,ek.current<=3?(z(null),window.setTimeout(()=>eC(),380+200*ek.current)):z(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eU,onContextMenu:eT})]}),em?(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-cyan-500/90 px-2 py-0.5 text-[9px] font-bold text-cyan-950 shadow-lg",children:[(0,n.jsx)(B.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):v>0&&!eo?(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-emerald-500/90 px-2 py-0.5 text-[9px] font-bold text-emerald-950 shadow-lg",children:[(0,n.jsx)(K.Z,{className:"h-3 w-3"}),"LIVE"]}):eo?null:(0,n.jsxs)("div",{className:"pointer-events-none absolute bottom-3 right-3 flex items-center gap-1 rounded-full bg-zinc-700/90 px-2 py-0.5 text-[9px] font-bold text-zinc-200",children:[(0,n.jsx)(W.Z,{className:"h-3 w-3"}),s("单帧","Still")]})]}):(0,n.jsx)("p",{className:"py-16 text-center text-sm text-zinc-600",children:s("请选择或连接设备","Pick or connect a device")}),eh?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:eh}):null,k&&!eo?(0,n.jsx)("p",{className:"mt-3 text-center text-xs text-rose-300",children:k}):null,(0,n.jsx)("p",{className:"mt-3 text-center text-[10px] text-zinc-600",children:s("左键单击 / 双击 \xb7 右键长按 \xb7 坐标对齐 PNG 像素","Left tap/double \xb7 right long-press \xb7 PNG pixel coords")})]})]}),(0,n.jsxs)("div",{className:"space-y-4 xl:col-span-4",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:s("遥测","Telemetry")}),m?(0,n.jsxs)("dl",{className:"mt-3 space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"device"}),(0,n.jsxs)("dd",{className:"text-right text-zinc-200",children:[m.brand," ",m.model]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Android"}),(0,n.jsxs)("dd",{className:"text-zinc-300",children:[m.android_version," (API ",m.sdk,")"]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"wm size"}),(0,n.jsx)("dd",{className:"text-cyan-300/90",children:S?"".concat(S.width,"\xd7").concat(S.height):m.resolution||"—"})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:m.battery})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-600",children:s("在上方点「刷新设备信息」","Use Refresh device info above")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-b from-violet-500/[0.08] to-black/40 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-violet-300/80",children:s("导航坞","Nav dock")}),(0,n.jsx)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[["3","Home"],["4","Back"],["187","Recents"]].map(e=>{let[t,s]=e;return(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:t}),eC()},className:"rounded-xl border border-white/10 bg-white/[0.06] py-3 text-xs font-semibold text-zinc-200 hover:bg-white/[0.1]",children:s},t)})}),(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:"24"}),eC()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("key",{keycode:"25"}),eC()},className:"rounded-xl border border-white/10 bg-black/30 py-2 text-[11px] text-zinc-300",children:"Vol−"})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-cyan-500/[0.05] p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-cyan-300/80",children:s("手势","Gestures")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>{h("swipe",{direction:e}),eC()},className:"rounded-lg border border-white/10 bg-black/30 py-2 font-mono text-[10px] uppercase text-zinc-300",children:e},e))})]})]})]})]})]})]})}let el=[{label:"getprop",cmd:"getprop ro.build.version.release"},{label:"top pkg",cmd:"dumpsys activity activities | grep -E 'mResumedActivity' | tail -n 1"},{label:"usb",cmd:"dumpsys usb | head -n 60"},{label:"surface",cmd:"dumpsys SurfaceFlinger | head -n 40"}];function ei(e,t,s){return e?(0,n.jsx)("span",{className:"rounded bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-200",children:t}):(0,n.jsx)("span",{className:"rounded bg-zinc-500/15 px-2 py-0.5 text-[10px] text-zinc-400",children:s})}function ea(e){var t,s,l,i,a,r,o,c,d,x,m,u,h,p,b;let{t:g,notify:f,fetchJson:y,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:z,adbAvailable:S,apkPath:C,setApkPath:R,onAndroidAction:P,onCopy:E,onRefreshDevices:A}=e,[D,Z]=(0,_.useState)(null),[O,H]=(0,_.useState)(null),[B,K]=(0,_.useState)(null),[W,F]=(0,_.useState)(null),[Y,J]=(0,_.useState)(""),[G,V]=(0,_.useState)([]),[q,X]=(0,_.useState)("getprop ro.product.model"),[$,Q]=(0,_.useState)(""),[ee,et]=(0,_.useState)("300"),[es,ea]=(0,_.useState)(""),[er,eo]=(0,_.useState)(null),[ec,ed]=(0,_.useState)([]),[ex,em]=(0,_.useState)(null),[eu,eh]=(0,_.useState)("https://"),[ep,eb]=(0,_.useState)(""),[eg,ef]=(0,_.useState)(!1),[ev,ey]=(0,_.useState)(null),ew=!!(j||ev),ej=z.find(e=>e.serial===N)||null,eN=(0,_.useCallback)(async()=>{if(!N||!S){Z(null),H(null);return}ey("overview"),H(null);try{let e=await y("/android/overview?serial=".concat(encodeURIComponent(N)));Z(e)}catch(e){Z(null),H(e.message)}finally{ey(null)}},[S,N,y]),ek=(0,_.useCallback)(async()=>{F(null);try{let e=await y("/redroid/summary");K(e)}catch(e){K(null),F(e.message)}},[y]);(0,_.useEffect)(()=>{eN()},[eN]),(0,_.useEffect)(()=>{ek()},[ek]);let ez=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await y("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));V(t.packages||[])}catch(e){f(e.message),V([])}finally{ey(null)}},eS=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}let e=q.trim();if(e){ey("shell");try{var t,s;let n=await y("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"shell",serial:N,payload:{command:e}})});Q(null!==(s=null!==(t=n.output)&&void 0!==t?t:n.message)&&void 0!==s?s:"")}catch(e){Q(e.message)}finally{ey(null)}}},e_=(0,_.useCallback)(async e=>{if(!N)return;let t=Math.min(3e3,Math.max(1,parseInt(ee,10)||200)),s=!!(null==e?void 0:e.silent);s||ey("logcat"),eo(null);try{var n;let e=await y("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));ea(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){ea(""),eo(e.message)}finally{s||ey(null)}},[N,y,ee]);(0,_.useEffect)(()=>{if(!eg||!N||!S)return;let e=window.setInterval(()=>void e_({silent:!0}),3e3);return e_({silent:!0}),()=>clearInterval(e)},[S,N,eg,e_]);let eC=async()=>{if(!N){f(g("请选择设备","Pick a device"));return}ey("ui"),em(null);try{let e=await y("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));ed(e.nodes||[])}catch(e){ed([]),em(e.message)}finally{ey(null)}},eR=async(e,t)=>{ey("redroid:".concat(e));try{let s=await y("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&K(s.summary),f(s.message||"OK"),await ek(),A()}catch(e){f(e.message)}finally{ey(null)}},eP=async e=>{await P("key",{keycode:e})},eL=async()=>{let e=ep.trim();if(!e){f(g("请输入文字","Enter text"));return}await P("text",{text:e})},eM=async()=>{let e=eu.trim();if(!e||"https://"===e){f(g("请输入 URL","Enter URL"));return}await P("open_url",{url:e})};return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安卓设备工作台","Android workstation")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("USB 真机与 Redroid 共用一套控制面,优先保证 USB 真机稳定。","USB phone and Redroid share one control surface.")})]}),S?(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew||!N,onClick:()=>void eN(),className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新设备","Refresh device")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>{ek(),A()},className:"rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300",children:g("刷新 Redroid","Refresh Redroid")})]}):(0,n.jsx)("span",{className:"text-xs text-amber-200/90",children:g("宿主机未检测到 adb","adb not found on host")})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:z.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>k(e.serial),className:"rounded-xl border px-4 py-2 text-left text-xs ".concat(N===e.serial?"border-violet-500/50 bg-violet-500/10 text-white":"border-white/10 bg-black/30 text-zinc-400"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:e.model||e.serial}),e.transport?(0,n.jsx)("span",{className:"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-zinc-500",children:e.transport}):null,e.kind?(0,n.jsx)("span",{className:"rounded bg-cyan-500/10 px-1.5 py-0.5 font-mono text-[9px] uppercase text-cyan-200",children:e.kind}):null]}),(0,n.jsx)("div",{className:"text-[10px] text-zinc-600",children:e.serial}),"device"!==(e.state||"").toLowerCase()?(0,n.jsx)("div",{className:"mt-1 text-[10px] font-medium text-amber-200/90",children:"unauthorized"===e.state?g("未授权,请在手机上允许 USB 调试。","Unauthorized, allow USB debugging on device."):"".concat(g("状态","State"),": ").concat(e.state)}):null]},e.serial))}),S&&0===z.length?(0,n.jsx)("p",{className:"mt-4 rounded-lg border border-amber-500/20 bg-amber-500/5 p-3 text-xs leading-relaxed text-amber-200/90",children:g("当前没有已授权设备。USB 真机请检查调试授权;Redroid 请先启动实例,再 adb connect 127.0.0.1:5555。","No authorized devices. For USB phones, confirm USB debugging. For Redroid, start an instance then adb connect 127.0.0.1:5555.")}):null]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-violet-300/90",children:g("真机诊断","Phone diagnostics")}),O?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:O}):null,D?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("dl",{className:"space-y-1.5 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"model"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.brand," ",D.model]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"android"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.android_version," (sdk ",D.sdk,")"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"kind"})," ",(0,n.jsxs)("dd",{className:"inline text-zinc-300",children:[D.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",D.transport||(null==ej?void 0:ej.transport)||"unknown"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"display"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:D.resolution})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"inline text-zinc-600",children:"rotation"})," ",(0,n.jsx)("dd",{className:"inline text-zinc-300",children:D.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:D.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:D.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ei(null===(t=D.diagnostics)||void 0===t?void 0:t.ready,g("已启动","Boot ready"),g("未完成启动","Boot pending")),ei(null===(s=D.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),ei(null===(l=D.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),ei(null===(i=D.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),ei(null===(a=D.diagnostics)||void 0===a?void 0:a.root,"Root","No root")]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:["boot_completed: ",(null===(r=D.diagnostics)||void 0===r?void 0:r.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=D.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=D.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=D.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=D.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):O?null:(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("加载中","Loading")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-zinc-950/50 p-5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:g("Redroid 板块","Redroid panel")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("启动默认实例","Start default")})]}),W?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:W}):null,B?(0,n.jsxs)("div",{className:"mt-3 space-y-3 text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsxs)("div",{children:["arch: ",B.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",B.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",B.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",B.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",B.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[ei(null===(m=B.requirements)||void 0===m?void 0:m.docker_available,"Docker","No Docker"),ei(null===(u=B.requirements)||void 0===u?void 0:u.adb_available,"ADB","No ADB"),ei(null===(h=B.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),ei(null===(p=B.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(B.instances||[]).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-500",children:[e.port?"127.0.0.1:".concat(e.port):"-"," / ",e.status_text||"-"]})]}),(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("start",e.name),className:"rounded bg-emerald-500/15 px-2 py-1 text-[10px] text-emerald-200",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("restart",e.name),className:"rounded bg-amber-500/15 px-2 py-1 text-[10px] text-amber-200",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("adb_connect",e.name),className:"rounded bg-cyan-500/15 px-2 py-1 text-[10px] text-cyan-200",children:"ADB"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eR("stop",e.name),className:"rounded bg-rose-500/15 px-2 py-1 text-[10px] text-rose-200",children:"Stop"})]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[ei(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,g("系统就绪","System ready"),g("启动中","Booting")),ei(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),ei(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),ei(null===(i=e.diagnostics)||void 0===i?void 0:i.root,"Root","No root")]}),e.data_dir?(0,n.jsx)("div",{className:"mt-2 truncate font-mono text-[10px] text-zinc-500",children:e.data_dir}):null]},e.name)}),(null===(b=B.instances)||void 0===b?void 0:b.length)?null:(0,n.jsx)("p",{className:"rounded-xl border border-white/5 bg-black/20 p-3 text-xs text-zinc-500",children:g("当前没有 Redroid 实例。默认动作会创建 redroid13-1。","No Redroid instances yet. Default actions create redroid13-1.")})]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:g("读取 Redroid 状态中","Loading Redroid status")})]})]}),(0,n.jsx)(en,{t:g,apiBase:w,fetchJson:y,serial:N,devices:z,setSerial:k,adbAvailable:S,lock:ew,overview:D,onAndroidAction:P,notify:f,onRefreshDevices:A}),S&&N?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-300/90",children:g("快捷控制","Quick controls")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("3"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Home"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("4"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Back"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("187"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Recents"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("wake"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Wake"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("launch_package",{package:"com.zhiliaoapp.musically"}),className:"rounded-lg bg-gradient-to-r from-pink-500/25 to-violet-500/25 px-3 py-1.5 text-xs ring-1 ring-white/10",children:"TikTok"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("24"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol+"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("25"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Vol-"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eP("66"),className:"rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs",children:"Enter"})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:g("滑动手势","Swipe gestures")}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-2",children:["up","down","left","right"].map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("swipe",{direction:e}),className:"rounded-lg border border-white/10 bg-black/30 px-2.5 py-1 font-mono text-[10px] uppercase text-zinc-300",children:e},e))}),(0,n.jsxs)("div",{className:"mt-4 rounded-lg border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:g("ADB 文本输入","ADB text input")}),(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:ep,onChange:e=>eb(e.target.value),placeholder:"hello / 123",onKeyDown:e=>{"Enter"===e.key&&eL()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL(),className:"rounded-lg bg-emerald-500/20 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/30",children:g("发送","Send")})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-xs",value:eu,onChange:e=>eh(e.target.value),placeholder:"https://"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eM(),className:"rounded-lg bg-violet-500/20 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/30",children:g("打开链接","Open URL")})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("h4",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-cyan-300/90",children:[(0,n.jsx)(L.Z,{className:"h-4 w-4"}),g("USB 真机优化建议","USB optimization")]}),(0,n.jsxs)("ul",{className:"mt-3 space-y-2 text-xs leading-relaxed text-zinc-400",children:[(0,n.jsx)("li",{children:g("优先使用主板直连 USB,不要经过不稳的 HUB。","Prefer direct motherboard USB, not unstable hubs.")}),(0,n.jsx)("li",{children:g("开发板端固定 adb server,避免频繁 kill-server。","Keep adb server stable and avoid frequent kill-server.")}),(0,n.jsx)("li",{children:g("镜像页默认支持 scrcpy H.264 真流,截图模式作为回退。","Use scrcpy H.264 live stream first, screenshot mode as fallback.")}),(0,n.jsx)("li",{children:g("如果 TikTok / YouTube App 直播,要先确认屏幕常亮、分辨率稳定、USB 供电足够。","For TikTok / YouTube app live, keep screen on, resolution stable, and USB power sufficient.")})]})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 text-emerald-400"}),g("包名搜索与启动","Packages")]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,n.jsx)("input",{className:"min-w-0 flex-1 rounded-xl border border-white/10 bg-black/40 px-4 py-2 text-sm",value:Y,onChange:e=>J(e.target.value),placeholder:"tiktok / musically / youtube",onKeyDown:e=>{"Enter"===e.key&&ez()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void ez(),className:"rounded-xl bg-emerald-500/20 px-4 py-2 text-sm text-emerald-100 ring-1 ring-emerald-500/30",children:g("搜索","Search")})]}),(0,n.jsxs)("ul",{className:"mt-4 max-h-48 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 font-mono text-[11px]",children:[G.map(e=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 py-1 text-zinc-400",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-zinc-300",children:e.package}),(0,n.jsxs)("span",{className:"flex shrink-0 gap-1",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("launch_package",{package:e.package}),className:"rounded bg-white/10 px-2 py-0.5 text-[10px] text-zinc-200",children:g("启动","Launch")}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("force_stop",{package:e.package}),className:"rounded bg-rose-500/15 px-2 py-0.5 text-[10px] text-rose-200",children:g("停止","Stop")})]})]},e.package)),G.length?null:(0,n.jsx)("li",{className:"py-2 text-center text-zinc-600",children:g("暂无结果","No results")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(U.Z,{className:"h-4 w-4 text-amber-400"}),"ADB shell"]}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:el.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>X(e.cmd),className:"rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[10px] text-zinc-400 hover:text-zinc-200",children:e.label},e.label))}),(0,n.jsx)("textarea",{className:"mt-3 min-h-[100px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-3 font-mono text-xs text-zinc-200",value:q,onChange:e=>X(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),eS())}}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),className:"rounded-xl bg-amber-500/20 px-4 py-2 text-sm text-amber-100 ring-1 ring-amber-500/30",children:"shell"===ev?(0,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),$?(0,n.jsxs)("button",{type:"button",disabled:!$,onClick:()=>E($),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),g("复制输出","Copy")]}):null]}),$?(0,n.jsx)("pre",{className:"mt-3 max-h-64 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/40 p-3 font-mono text-[11px] text-zinc-400 xl:max-h-[min(24rem,50vh)]",children:$}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("Logcat","Logcat")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("input",{className:"w-24 rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:ee,onChange:e=>et(e.target.value)}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 text-[11px] text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:eg,onChange:e=>ef(e.target.checked)}),g("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:g("拉取日志","Pull logs")}),es?(0,n.jsxs)("button",{type:"button",onClick:()=>E(es),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 px-3 py-1.5 text-xs text-zinc-400 hover:text-zinc-200",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),g("复制","Copy")]}):null]}),er?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:er}):null,es?(0,n.jsx)("pre",{className:"mt-3 max-h-72 overflow-auto whitespace-pre-wrap rounded-lg border border-white/5 bg-black/50 p-3 font-mono text-[10px] leading-tight text-zinc-500 xl:max-h-[min(24rem,50vh)]",children:es}):null]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(I.Z,{className:"h-4 w-4 text-fuchsia-400"}),g("界面节点","UI nodes")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eC(),className:"mt-3 rounded-xl border border-fuchsia-500/30 bg-fuchsia-500/10 px-4 py-2 text-sm text-fuchsia-100",children:g("刷新节点","Refresh nodes")}),ex?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:ex}):null,(0,n.jsxs)("ul",{className:"mt-3 max-h-64 space-y-1 overflow-y-auto rounded-lg border border-white/5 bg-black/30 p-2 text-[11px]",children:[ec.map((e,t)=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.04] py-1.5 text-zinc-400 last:border-0",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-zinc-200",children:e.label}),e.resource_id?(0,n.jsx)("span",{className:"ml-2 font-mono text-[10px] text-zinc-600",children:e.resource_id}):null,(0,n.jsxs)("div",{className:"font-mono text-[10px] text-zinc-600",children:["(",e.center_x,", ",e.center_y,")",e.clickable?" click":""]})]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void P("tap",{x:e.center_x,y:e.center_y}),className:"shrink-0 rounded bg-white/10 px-2 py-1 text-[10px] text-zinc-200",children:"Tap"})]},"".concat(e.center_x,"-").concat(e.center_y,"-").concat(t))),ec.length||ex?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:g("尚未加载","Not loaded")})]})]}):null,S&&N?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:g("安装 APK","Install APK")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:g("先 adb push 到 /sdcard/ 再执行安装。","Push the APK to /sdcard/ first.")}),(0,n.jsx)("input",{className:"mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm",value:C,onChange:e=>R(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!S||!N,onClick:()=>void P("install_apk",{path:C}),className:"mt-3 rounded-xl bg-emerald-500/20 px-4 py-2 text-sm font-medium text-emerald-100 ring-1 ring-emerald-500/30",children:"pm install"})]}):null]})}var er=s(9897),eo=s(4554),ec=s(7689),ed=s(8930),ex=s(8401);function em(e){let{t,title:s,subtitle:l,steps:i,onNavigate:a}=e;return(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5 p-6 shadow-lg shadow-violet-900/10",children:[(0,n.jsx)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:s}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:l}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:flex-wrap sm:justify-center",children:i.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[e.openUrl||e.target&&a?(0,n.jsxs)("button",{type:"button",onClick:()=>{if(e.openUrl){window.open((0,ex.p)(e.openUrl),"_blank","noopener,noreferrer");return}e.target&&a&&a(e.target)},className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ring-2 ring-white/10 transition hover:ring-violet-400/50 hover:brightness-110 ".concat(e.gradient),children:[(0,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}):(0,n.jsxs)("div",{className:"flex min-h-[4rem] min-w-[7rem] flex-col items-center justify-center rounded-2xl bg-gradient-to-br px-4 py-2 text-center text-xs font-bold text-white shadow-lg ".concat(e.gradient),children:[(0,n.jsx)("span",{children:e.label}),e.sub?(0,n.jsx)("span",{className:"mt-1 text-[10px] font-normal text-white/80",children:e.sub}):null]}),t8?e.slice(-8):e;if(e.includes("live2/")){let t=e.split("/"),s=t[t.length-1]||"";return s.length>8?s.slice(-8):s}}}let t=e.trim();return!t||t.includes("\n")||t.toLowerCase().startsWith("rtmp")?"":t.length>8?t.slice(-8):t}function eh(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/(https?:\/\/live\.douyin\.com\/[a-zA-Z0-9_-]+)/i);if(n){t.push(n[1].replace(/^http:\/\//i,"https://"));continue}let l=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(l){t.push("https://live.douyin.com/".concat(l[1]));continue}let i=e.match(/(\d{8,})/);i&&t.push("https://live.douyin.com/".concat(i[1]))}return Array.from(new Set(t)).slice(0,16)}function ep(e){let t="",s=!0,n="",l=!1,i=e.split(/\r?\n/),a=!1;for(let e of i){let i=e.trim();if(/^\[youtube\]/i.test(i)){a=!0;continue}if(/^\[/.test(i)){a=!1;continue}if(!a||!i||i.startsWith("#")||i.startsWith(";"))continue;let r=i.indexOf("=");if(r<0)continue;let o=i.slice(0,r).trim().toLowerCase(),c=i.slice(r+1).trim().split(/[#;]/)[0].trim();"key"===o||"stream_key"===o?t=c:"rtmps"===o?s=!/^(0|false|否)/i.test(c):"bitrate"===o?n=c:"fast_audio"===o&&(l=/^(1|true|yes|是|开|on)/i.test(c))}return{key:t,rtmps:s,bitrate:n,fastAudio:l}}function eb(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eg(e){let t=e.bitrate.trim()?"bitrate = ".concat(e.bitrate.trim()):"# bitrate = 4000";return"[youtube]\n# YouTube 推流 key(工作室 → 直播 → 串流密钥)\nkey = ".concat(e.key.trim(),"\n\n# 使用 RTMPS;填 否 则 RTMP\nrtmps = ").concat(e.rtmps?"是":"否","\n\n# 视频比特率 kbps(可选)\n").concat(t,"\n\n# 轻量音频链,减轻 CPU:1 / 是\nfast_audio = ").concat(e.fastAudio?"1":"0","\n")}function ef(e){if(e<60)return"".concat(e,"s");let t=Math.floor(e/60);return t<60?"".concat(t,"m ").concat(e%60,"s"):"".concat(Math.floor(t/60),"h ").concat(t%60,"m")}function ev(e){var t,s,l;let{t:i,currentProc:a,fetchJson:r,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3}=e,[m,u]=(0,_.useState)(""),[h,p]=(0,_.useState)(""),[b,g]=(0,_.useState)(""),[f,v]=(0,_.useState)(""),[w,j]=(0,_.useState)(""),[N,k]=(0,_.useState)([]),[z,S]=(0,_.useState)(null),[C,R]=(0,_.useState)(!1),[P,L]=(0,_.useState)(null),[M,U]=(0,_.useState)(0),T=(0,_.useRef)(null),I=(0,_.useRef)(null),E=(0,_.useRef)(!1),A=(0,_.useRef)(!1),D=(0,_.useRef)(!1),O=function(e){let t=[];for(let s of e.split(/\r?\n/)){let e=s.trim();if(!e||e.startsWith("#")||!/douyin\.com|v\.douyin\.com/i.test(e))continue;let n=e.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);if(n){t.push(n[1]);continue}let l=e.match(/(\d{8,})/);t.push(l?l[1]:e.slice(0,96))}return Array.from(new Set(t)).slice(0,12)}(o),H=/^(online|running)$/i.test(m),B=function(e){if(!e)return null;let t=null;for(let s of e.split(/\r?\n/)){let e=s.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i);e&&(t=e[1]);let n=s.match(/https?:\/\/[^/\s]*douyin\.com\/(\d{8,})/i);n&&(t=n[1])}return t}(h),F=null!==(s=eh(o)[0])&&void 0!==s?s:"",Y=B||(null!==(l=null===(t=F.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),J=Y?"https://live.douyin.com/".concat(Y):F||null,G=(0,_.useCallback)(async()=>{if(a){if(A.current){D.current=!0;return}A.current=!0;try{let e=await r("/status?process=".concat(encodeURIComponent(a))),t=e.process_status||"unknown";u(t),p(e.recent_log||""),g(e.recent_error||""),v(e.business_status||""),j(e.business_note||""),k(Array.isArray(e.ffmpeg_pids)?e.ffmpeg_pids:[]),S("number"==typeof e.log_age_seconds?e.log_age_seconds:null);let s=/^(online|running)$/i.test(t);s&&!E.current&&L(Date.now()),s||L(null),E.current=s}catch(e){u("error"),v("error"),j(""),k([]),S(null)}finally{A.current=!1,D.current&&(D.current=!1,window.setTimeout(()=>void G(),0))}}},[a,r]);(0,_.useEffect)(()=>{G()},[G]),(0,_.useEffect)(()=>{if(C||!a)return;let e=window.setInterval(()=>void G(),x);return()=>clearInterval(e)},[C,a,G,x]),(0,_.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&G()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[G]),(0,_.useEffect)(()=>{if(!P)return;let e=window.setInterval(()=>U(e=>e+1),1e3);return()=>clearInterval(e)},[P]),(0,_.useEffect)(()=>{if(C)return;let e=T.current;e&&(e.scrollTop=e.scrollHeight)},[h,C]),(0,_.useEffect)(()=>{if(C)return;let e=I.current;e&&(e.scrollTop=e.scrollHeight)},[b,C]);let V=null==P?i("—(未检测到在线)","— (not online)"):ef(Math.max(0,Math.floor((Date.now()-P)/1e3)));return(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-b from-emerald-500/[0.07] to-zinc-950/80 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("span",{className:"sr-only","aria-hidden":!0,children:M}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:i("当前直播日志","Live process log")}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-200/90 ring-1 ring-emerald-500/25",children:C?i("已暂停刷新","Paused"):i("每秒刷新","~1s refresh")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void G(),className:"inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-1.5 text-xs text-zinc-300 hover:bg-white/[0.08]",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>R(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(C?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[C?(0,n.jsx)(K.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(W.Z,{className:"h-3.5 w-3.5"}),C?i("继续自动刷新","Resume"):i("暂停自动刷新","Pause")]})]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-3 rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("进程状态","Status")}),(0,n.jsx)("span",{className:"font-medium text-zinc-200",children:function(e,t){let s=(t||"unknown").toLowerCase();return"online"===s||"running"===s?e("运行中(PM2/进程在线)","Running (process online)"):"stopped"===s||"stopping"===s?e("已停止","Stopped"):"not_found"===s||"errored"===s?e("未运行或未找到","Not running / not found"):"invalid"===s?e("无效进程名","Invalid process"):t||"—"}(i,m)})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("Business state","Business state")}),(0,n.jsx)("span",{className:"font-medium text-cyan-200/90",children:function(e,t,s){let n=(t||"").toLowerCase();return"streaming"===n?e("Pushing to YouTube","Pushing to YouTube"):"waiting_source"===n?e("Waiting for the upstream live source","Waiting for the upstream live source"):"source_live"===n?e("Source live detected, but no active FFmpeg relay worker","Source live detected, but no active FFmpeg relay worker"):"monitoring"===n?e("Process online and monitoring the source","Process online and monitoring the source"):"misconfigured"===n?e("YouTube key missing or invalid","YouTube key missing or invalid"):"stale"===n?e("Process online but the log heartbeat is stale","Process online but the log heartbeat is stale"):"error"===n?e("Recent process error detected","Recent process error detected"):(null==s?void 0:s.trim())?s.trim():e("No business-state hint yet","No business-state hint yet")}(i,f,w)})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("本次在线时长(估算)","Online duration (est.)")}),(0,n.jsx)("span",{className:"font-mono text-cyan-200/90",children:V})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("FFmpeg workers","FFmpeg workers")}),(0,n.jsxs)("span",{className:"font-mono text-zinc-300",children:[N.length?N.join(", "):"none",null!=z?" \xb7 log ".concat(ef(Math.max(0,Math.floor(z)))):""]})]})]}),d?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-500",children:i("YouTube key 尾码(参考)","YT key suffix")}),(0,n.jsx)("span",{className:"font-mono text-zinc-300",children:c||"—"})]}):null,J?(0,n.jsxs)("div",{className:"rounded-lg border border-violet-500/20 bg-violet-500/[0.06] px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium text-zinc-400",children:B?i("当前直播源站(日志)","Current source (from log)"):H?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:J,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs font-medium text-violet-100 ring-1 ring-violet-500/35 transition hover:bg-violet-500/30",children:[(0,n.jsx)(Z.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),Y||i("打开抖音直播页","Open Douyin live")]})]}),O.length>1&&B?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",O.filter(e=>e!==Y).slice(0,3).map(e=>(0,n.jsx)("a",{href:"https://live.douyin.com/".concat(e),target:"_blank",rel:"noreferrer",className:"ml-1 text-violet-400/90 underline-offset-2 hover:underline",children:e},e)),O.length>4?"…":null]}):null]}):(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:i("(日志与地址列表中暂无抖音房间)","(No Douyin room in log or URL list)")})]}),"not_found"!==m&&"invalid"!==m?(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-emerald-400/90",children:i("进程输出(stdout / 合并日志)","Process output")}),(0,n.jsx)("pre",{ref:T,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-emerald-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-emerald-100/95",children:h.trim()||i("(暂无)","(empty)")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-rose-400/90",children:i("异常信息(stderr)","Stderr")}),(0,n.jsx)("pre",{ref:I,className:"log-live-scroll mt-2 max-h-[min(22rem,42vh)] min-h-[12rem] overflow-auto whitespace-pre-wrap rounded-xl border border-rose-500/20 bg-black/55 p-3 font-mono text-[10px] leading-relaxed text-rose-100/95",children:b.trim()||i("(暂无)","(empty)")})]})]}):(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:i("进程未在 PM2 / 本地注册表中运行,日志区域已隐藏。","Process not running — log panes hidden.")})]})}function ey(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let ew=[{id:"720p60",labelZh:"720p @ 60Hz",labelEn:"720p @ 60Hz",spec:"1280x720, 59.94/60Hz, RGB/YUV 有限",hintZh:"板端 HDMI 输出时序与显示端一致;下游画布建议 1280\xd7720。",hintEn:"Match SoC HDMI timing to the display; downstream canvas e.g. 1280\xd7720."},{id:"1080p30",labelZh:"1080p @ 30Hz",labelEn:"1080p @ 30Hz",spec:"1920x1080, 30Hz",hintZh:"带宽紧张时可优先 1080p30;检查线材与接口规格。",hintEn:"Prefer 1080p30 when bandwidth is tight; check cable and port specs."},{id:"1080p60",labelZh:"1080p @ 60Hz",labelEn:"1080p @ 60Hz",spec:"1920x1080, 60Hz, 高刷转播",hintZh:"两端均需稳定支持 1080p60;长时间运行注意散热。",hintEn:"Both ends need stable 1080p60; mind thermals for long runs."}],ej="live-hub-tiktok-hdmi-check-v1",eN="live-hub-tiktok-hdmi-notes-v1",ek="live-hub-tiktok-source-mode-v1";function ez(e){var t;let{t:s,busy:l,entries:i,currentProc:a,setCurrentProc:r,urlConfig:o,setUrlConfig:c,onRunProcess:d,onSaveUrlConfig:x,onReplayGoLive:m,onCopy:u,fetchJson:h,apiPrefix:p,quickLinks:b,hdmiStatus:g,notify:f,onNavigate:v}=e,y=(0,_.useMemo)(()=>i.filter(ey),[i]),w=y.length?y:i,[j,N]=(0,_.useState)("srs"),[k,z]=(0,_.useState)([]),[S,C]=(0,_.useState)(!1),[R,P]=(0,_.useState)(!1),[L,M]=(0,_.useState)("1080p30"),[U,I]=(0,_.useState)("1080p30"),[E,D]=(0,_.useState)(!1),[Z,O]=(0,_.useState)(!0),[H,K]=(0,_.useState)(null),W=(0,_.useRef)(!1),[F,J]=(0,_.useState)(""),[G,V]=(0,_.useState)({}),q=(0,_.useCallback)(e=>{N(e);try{window.localStorage.setItem(ek,e)}catch(e){}},[]);(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(ek);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,_.useEffect)(()=>{W.current=!1},[a]);let X=(0,_.useCallback)(async()=>{if(a)try{var e;let t=await h("/get_url_config?process=".concat(encodeURIComponent(a)));c(null!==(e=t.content)&&void 0!==e?e:"")}catch(e){}},[a,h,c]);(0,_.useEffect)(()=>{if(!a||!Z||"ffmpeg"!==j)return;let e=window.setInterval(()=>{W.current||X()},8e3);return()=>clearInterval(e)},[a,Z,X,j]),(0,_.useEffect)(()=>{"ffmpeg"===j&&a&&X()},[j,a,X]);let $=(0,_.useCallback)(async()=>{if(a){C(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(a)));z(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){f(e.message),z([])}finally{C(!1)}}},[a,h,f]);(0,_.useEffect)(()=>{"replay"===j&&a&&$()},[j,a,$]),(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(ej);e&&V(JSON.parse(e))}catch(e){}try{J(window.localStorage.getItem(eN)||"")}catch(e){}},[]);let Q=(0,_.useCallback)(e=>{V(e);try{window.localStorage.setItem(ej,JSON.stringify(e))}catch(e){}},[]),ee=e=>{J(e);try{window.localStorage.setItem(eN,e)}catch(e){}},et=async()=>{if(a){D(!0),K(null),W.current=!1;try{var e;let t=await h("/get_url_config?process=".concat(encodeURIComponent(a)));c(null!==(e=t.content)&&void 0!==e?e:""),K(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){K(e.message)}finally{D(!1)}}},es=async()=>{try{await Promise.resolve(x()),W.current=!1}catch(e){}},en=async e=>{if(a){P(!0);try{await h("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:a,filename:e})}),f(s("已删除文件","File removed")),await $()}catch(e){f(e.message)}finally{P(!1)}}},el=async e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",n&&a){P(!0);try{let e=new FormData;e.append("file",n);let t=await (0,Y.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(a)),{method:"POST",body:e});f(t.message||s("上传成功","Uploaded")),await $()}catch(e){f(e.message)}finally{P(!1)}}},ei=l||E||R,ea=ew.find(e=>e.id===U),ex=!!(null==g?void 0:g.can_stream_hdmi),eu=(null==g?void 0:g.preferred_device)||(null==g?void 0:null===(t=g.video_devices)||void 0===t?void 0:t[0])||"";return(0,n.jsxs)("div",{className:"mx-auto max-w-4xl space-y-6",children:[v?(0,n.jsx)(em,{t:s,title:s("TikTok HDMI 硬件链路","TikTok HDMI hardware chain"),subtitle:s("板端编码经 HDMI 到显示/下游设备;与「网络」页顶卡相同的箭头风格。","Encode on SoC → HDMI → display/downstream; same arrow style as Network header."),onNavigate:v,steps:[{label:"FFmpeg",sub:s("采集 / 推流","Capture"),gradient:"from-cyan-400 to-blue-500",target:"live_tiktok"},{label:"HDMI",sub:s("板载输出","SoC out"),gradient:"from-violet-500 to-fuchsia-500"},{label:"Android",sub:s("AOSP / 手机","AOSP"),gradient:"from-amber-400 to-orange-500",target:"android"}]}):null,(0,n.jsx)("div",{className:"rounded-2xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.14] via-zinc-950/80 to-fuchsia-500/10 p-6 shadow-xl shadow-cyan-900/10",children:(0,n.jsx)("div",{className:"flex flex-wrap items-start gap-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-cyan-500/35 to-fuchsia-600/25 ring-1 ring-white/10",children:(0,n.jsx)(A.Z,{className:"h-5 w-5 text-cyan-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:s("TikTok 无人直播(单路)","TikTok unmanned (single lane)")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:s("布局对齐 YouTube 单频道:直播开关 + 源站 + URL_config;无 stream key,输出走 HDMI 硬件链路。","Same layout as YouTube single: controls + URLs; no stream key — HDMI hardware path.")})]})]})})}),(0,n.jsx)("div",{className:"rounded-2xl border border-cyan-500/20 bg-cyan-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:(0,n.jsx)("p",{className:"text-xs leading-relaxed text-cyan-100/90",children:s("HDMI 互斥:后端在「开始 / 重新开始」TikTok 或 obs*.sh(SRS 拉流上屏)时,会自动停止其它正在占用 HDMI 链路的同类进程;与 YouTube 推流互不干扰。","HDMI mutex: starting TikTok or obs*.sh stops other TikTok/OBS HDMI sinks; YouTube RTMP is unaffected.")})}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-300"}),s("X86 HDMI 采集状态","X86 HDMI capture status")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("这里直接显示主机是否识别到采集卡和 /dev/video 设备,可用于验证 ARM HDMI 进 X86 的链路。","Shows whether the host sees the capture card and /dev/video nodes for ARM-to-X86 HDMI ingest.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ring-1 ".concat(ex?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ex?s("可推流","Ready"):s("未就绪","Not ready")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"device: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:eu||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"video nodes: "}),(0,n.jsx)("span",{className:"font-mono text-zinc-200",children:((null==g?void 0:g.video_devices)||[]).join(", ")||"—"})]}),(0,n.jsxs)("p",{className:"mt-2",children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"usb matches: "}),(0,n.jsx)("span",{className:"text-zinc-300",children:((null==g?void 0:g.usb_capture_matches)||[]).length||0})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4 text-[11px] text-zinc-400",children:[(0,n.jsx)("p",{className:"text-zinc-600",children:s("建议 FFmpeg","Suggested FFmpeg")}),(0,n.jsx)("p",{className:"mt-2 break-all font-mono text-zinc-200",children:(null==g?void 0:g.suggested_ffmpeg_cmd)||"—"}),(null==g?void 0:g.suggested_ffmpeg_cmd)?(0,n.jsxs)("button",{type:"button",onClick:()=>u(g.suggested_ffmpeg_cmd||""),className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-medium text-cyan-100 ring-1 ring-cyan-500/25",children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),s("复制命令","Copy command")]}):null]})]}),((null==g?void 0:g.issues)||[]).length?(0,n.jsx)("ul",{className:"mt-4 list-inside list-disc space-y-1 text-[11px] text-amber-200/85",children:((null==g?void 0:g.issues)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(B.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播开关","Live control")})]}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("TikTok 进程(PM2)","TikTok PM2 process")}),(0,n.jsx)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:a,onChange:e=>r(e.target.value),children:w.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[e.label," (",e.pm2,")"]},e.pm2))}),(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:s("直播源","Video source")}),(0,n.jsxs)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:j,onChange:e=>q(e.target.value),children:[(0,n.jsx)("option",{value:"ffmpeg",hidden:!0,children:"FFmpeg(抖音 / TikTok 等直播间 URL)"}),(0,n.jsx)("option",{value:"replay",hidden:!0,children:s("录播素材(本地上传)","VOD upload")}),(0,n.jsx)("option",{value:"srs",children:s("SRS(OBS 推流)","SRS (OBS)")})]}),"srs"===j?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-amber-200/85",children:s("此模式不显示 URL_config:请在 OBS 中填写下方 RTMP 推流地址;板端 SRS 拉流上屏仍可能占用 HDMI,与 TikTok 进程互斥规则不变。","URL_config is hidden: set the RTMP URL in OBS. SRS pull-to-HDMI may still mutex with TikTok per server rules.")}):null,(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[["start",s("开始直播","Start"),"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30"],["stop",s("停止直播","Stop"),"bg-rose-500/15 text-rose-200 ring-rose-500/25"],["restart",s("重新开始","Restart"),"bg-amber-500/15 text-amber-200 ring-amber-500/25"]].map(e=>{let[t,s,l]=e;return(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>d(t),className:"rounded-xl px-4 py-3 text-sm font-medium ring-1 ".concat(l),children:s},t)})}),(0,n.jsxs)("p",{className:"mt-3 text-center text-[11px] text-zinc-500",children:[s("当前 HDMI 预设(备忘)","HDMI preset (memo)"),":"," ",(0,n.jsx)("span",{className:"font-mono text-cyan-300/90",children:ea?s(ea.labelZh,ea.labelEn):U})]})]}),"replay"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(eo.Z,{className:"h-4 w-4 text-violet-300"}),s("录播素材","VOD library")]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-xl bg-violet-500/15 px-3 py-2 text-xs font-medium text-violet-100 ring-1 ring-violet-500/30",children:[(0,n.jsx)(ec.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{children:s("上传视频","Upload")}),(0,n.jsx)("input",{type:"file",accept:".mp4,.mkv,.ts,.flv,.mov,.m4v,.webm",className:"hidden",onChange:el})]}),(0,n.jsx)("button",{type:"button",disabled:ei||!a,onClick:()=>void $(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-300",children:s("刷新列表","Refresh")})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s("文件保存在服务器 config/tiktok_replay/对应进程目录;点「开始直播」会写入 replayfile 行并启动 PM2 进程。停播请用上方「停止直播」。","Files under config/tiktok_replay/. Go live writes replayfile + starts PM2. Use Stop above to stop.")}),S?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("加载中…","Loading…")}):0===k.length?(0,n.jsx)("p",{className:"mt-4 text-xs text-zinc-500",children:s("暂无文件,请先上传。","No files yet.")}):(0,n.jsx)("ul",{className:"mt-4 space-y-2",children:k.map(e=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-white/10 bg-black/30 px-3 py-2 text-xs text-zinc-300",children:[(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.name}),(0,n.jsxs)("span",{className:"shrink-0 text-zinc-500",children:[(e.size/1048576).toFixed(1)," MB"]}),(0,n.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void(async()=>{try{await Promise.resolve(m(e.replay_url,e.name))}catch(e){}})(),className:"rounded-lg bg-emerald-500/20 px-2 py-1 text-[11px] text-emerald-100 ring-1 ring-emerald-500/30",children:s("开始直播","Go live")}),(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>d("stop"),className:"rounded-lg bg-rose-500/15 px-2 py-1 text-[11px] text-rose-100 ring-1 ring-rose-500/25",children:s("停播","Stop")}),(0,n.jsxs)("button",{type:"button",disabled:ei,onClick:()=>void en(e.name),className:"inline-flex items-center gap-1 rounded-lg bg-zinc-700/40 px-2 py-1 text-[11px] text-zinc-200",children:[(0,n.jsx)(ed.Z,{className:"h-3 w-3"}),s("删除","Del")]})]})]},e.name))})]}):null,"srs"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-emerald-500/25 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("SRS / OBS 推流","SRS / OBS ingest")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("OBS:设置 → 推流 → 服务选「自定义」,服务器填 RTMP 地址;串流密钥可与 SRS 应用配置一致(默认 live/livestream)。","OBS → Stream → Custom: RTMP URL as server; stream key per SRS app (default live/livestream).")}),(0,n.jsxs)("dl",{className:"mt-4 space-y-3 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("RTMP 推流地址(OBS 服务器)","RTMP publish URL")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-emerald-200/90",children:[(0,n.jsx)("span",{className:"break-all",children:b.srs_rtmp_publish||"—"}),b.srs_rtmp_publish?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>u(b.srs_rtmp_publish),children:(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("HTTP-FLV 预览","HTTP-FLV preview")}),(0,n.jsxs)("dd",{className:"mt-1 flex flex-wrap items-center gap-2 font-mono text-zinc-400",children:[(0,n.jsx)("span",{className:"break-all",children:b.srs_play_flv||b.srs_http||"—"}),b.srs_play_flv||b.srs_http?(0,n.jsx)("button",{type:"button",className:"shrink-0 text-cyan-300 hover:text-cyan-200",onClick:()=>u(b.srs_play_flv||b.srs_http),children:(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-500",children:s("SRS 控制台","SRS web UI")}),(0,n.jsx)("dd",{className:"mt-1 font-mono text-zinc-400",children:(0,n.jsx)("a",{href:b.srs_http||"#",target:"_blank",rel:"noreferrer",className:"text-cyan-300 hover:underline",children:b.srs_http||"—"})})]})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-400"}),s("HDMI 硬件与时序","HDMI timing")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("点选一路作为现场备忘;与板端 ffmpeg/OBS 采集参数对齐。","Pick a preset as field memo; match capture settings.")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:ew.map(e=>{let t=L===e.id,l=U===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{M(t?null:e.id),I(e.id)},className:"rounded-2xl border p-4 text-left transition ".concat(l?"border-cyan-500/50 ring-1 ring-cyan-500/20":""," ").concat(t?"border-cyan-500/40 bg-cyan-500/10":"border-white/[0.08] bg-zinc-950/50 hover:border-white/15"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(er.Z,{className:"h-4 w-4 text-cyan-400"}),s(e.labelZh,e.labelEn)]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:e.spec}),t?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:s(e.hintZh,e.hintEn)}):null]},e.id)})}),(0,n.jsxs)("div",{className:"mt-6 rounded-xl border border-white/5 bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-zinc-400",children:s("上线前检查清单(本地保存)","Pre-flight checklist (local)")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:[{id:"cable",zh:"HDMI 线材插紧、方向正确(如需转接头确认规格)",en:"HDMI cable seated; adapter specs OK"},{id:"thermal",zh:"长时间推流注意散热,过热会掉帧黑屏",en:"Thermal headroom for long runs"}].map(e=>(0,n.jsxs)("li",{className:"flex items-start gap-2 text-xs text-zinc-400",children:[(0,n.jsx)("input",{type:"checkbox",className:"mt-0.5 rounded border-white/20 bg-black/40",checked:!!G[e.id],onChange:t=>Q({...G,[e.id]:t.target.checked})}),(0,n.jsx)("span",{children:s(e.zh,e.en)})]},e.id))}),(0,n.jsx)("label",{className:"mt-4 block text-[11px] text-zinc-500",children:s("HDMI / 走线备忘","HDMI / wiring notes")}),(0,n.jsx)("textarea",{className:"mt-1 min-h-[72px] w-full resize-y rounded-lg border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:F,onChange:e=>ee(e.target.value),spellCheck:!1,placeholder:s("接口、线长、显示器型号…","Ports, cable length, display model…")})]})]}),"ffmpeg"===j?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:s("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-cyan-300 hover:text-cyan-200",onClick:()=>u(o),children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),s("复制全文","Copy all")]})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:s("一行一个地址;可勾选自动从服务器刷新,或点「重新读取」手动同步。","One URL per line; enable auto-refresh or reload from server.")}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:Z,onChange:e=>O(e.target.checked)}),s("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]})}),H?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:H}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:o,onChange:e=>{W.current=!0,c(e.target.value)},spellCheck:!1}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void et(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-300",children:s("重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:ei,onClick:()=>void es(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm font-medium text-cyan-100 ring-1 ring-cyan-500/30",children:s("保存 URL 配置","Save URL config")})]})]}):null,(0,n.jsx)(ev,{t:s,currentProc:a,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eS=s(5468),e_=s(9397);let eC="live-hub-youtube-pro-v2",eR=/[^a-zA-Z0-9_.-]+/g;function eP(e){return(e||"").trim().replace(eR,"_")}function eL(e){return eP(String(e.pm2Name||""))||eZ(String(e.id||""))}function eM(e){if(!e||"object"!=typeof e)return null;let t=String(e.id||"").trim();if(!t)return null;let s=String(e.name||"").trim()||t;return{id:t,name:s,streamKeySuffix:"string"==typeof e.streamKeySuffix?e.streamKeySuffix:void 0,streamKey:"string"==typeof e.streamKey?e.streamKey:void 0,urlLines:"string"==typeof e.urlLines?e.urlLines:void 0,pm2Name:"string"==typeof e.pm2Name?e.pm2Name:void 0,notes:"string"==typeof e.notes?e.notes:void 0}}function eU(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.map(e=>eM(e)).filter(e=>null!==e)}catch(e){return[]}}function eT(e){window.localStorage.setItem(eC,JSON.stringify(e))}let eI=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function eE(e){for(let s of eI)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?t.map(e=>eM(e)).filter(e=>null!==e):[])}}catch(e){}return{fetched:!1,channels:[]}}async function eA(e,t){let s=null;for(let n of eI)try{await e(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:t})});return}catch(e){s=e instanceof Error?e:Error(String(e))}throw null!=s?s:Error("youtube_pro_channels sync failed")}function eD(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function eZ(e){return"youtube2__".concat(eP(e)||"channel")}function eO(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function eH(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function eB(e){return eO(e)&&e.pm2.trim()===eH(e.script).trim()}function eK(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function eW(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:eG(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===eH(e.script).trim().toLowerCase()?3:10}let eF="live-hub-youtube-mode-v1",eY=new Set(["tiktok","obs","web"]);function eJ(e){var t,s,n;return{name:e.name,streamKey:null!==(t=e.streamKey)&&void 0!==t?t:"",pm2Name:null!==(s=e.pm2Name)&&void 0!==s?s:eZ(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function eG(e){return/^(online|running)$/i.test((e||"").trim())}function eV(e,t){let s=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===s?t("已配置","Ready"):"streaming"===s?t("推流中","Pushing"):"waiting_source"===s?t("等待上游","Waiting source"):"source_live"===s?t("源已开播,转推未起","Source live, relay down"):"monitoring"===s?t("监控中","Monitoring"):"misconfigured"===s?t("密钥异常","Key invalid"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):eG(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function eq(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function eX(e,t){return eq(e).length>0&&0===eq(t).length}function e$(e){let{kind:t,busyKind:s,targetPm2:l,busy:i,online:a,label:r,className:o,baseLock:c,onRun:d,notify:x,t:m,compact:u}=e,h=function(e){if(!(null==e?void 0:e.startsWith("proc:")))return null;let t=e.slice(5),s=t.indexOf(":");if(s<=0)return null;let n=t.slice(0,s),l=t.slice(s+1);return l&&["start","stop","restart"].includes(n)?{action:n,pm2:l}:null}(i),p=h&&h.pm2===l,b=null!=s?s:t,g=!!(p&&h.action===b),f=!!(p&&h.action!==b),y="start"===t&&a,w="stop"===t&&!a,j="restart"===t&&!a,N=y||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!g){if(f){x(m("请等待当前操作完成","Wait for the current action to finish"));return}if(y){x(m("已在直播中,无需重复开始","Already live"));return}if(w){x(m("当前未在直播,无法停止","Not live — cannot stop"));return}if(j){x(m("进程未运行时请使用「开始直播」","Use Start when the process is not running"));return}c||d()}},className:"relative overflow-hidden rounded-xl ring-1 transition ".concat(u?"min-h-[2rem] px-3 py-1.5 text-xs font-medium":"min-h-[2.75rem] px-4 py-3 text-sm font-medium"," ").concat(o," ").concat(N||c||g||f?"cursor-not-allowed":""," ").concat(N&&!g?"opacity-45":""," ").concat(f?"opacity-35":""," ").concat(g?"ring-violet-400/40":""),children:[g?(0,n.jsx)("span",{className:"absolute inset-0 flex items-center justify-center bg-black/25 backdrop-blur-[2px]",children:(0,n.jsx)(v.Z,{className:"".concat(u?"h-4 w-4":"h-6 w-6"," animate-spin text-white")})}):null,(0,n.jsxs)("span",{className:"inline-flex items-center justify-center gap-1.5 ".concat(g?"invisible":""),children:[N?(0,n.jsx)(eS.Z,{className:"".concat(u?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,r]})]})}function eQ(e){var t,s,l,i;let{t:a,busy:r,entries:o,currentProc:d,setCurrentProc:x,urlConfig:m,setUrlConfig:u,onRunProcess:h,onSaveUrlConfig:p,fetchJson:b,liveProcesses:g,notify:f,onNavigate:w,quickLinks:j}=e,N=(0,_.useMemo)(()=>o.filter(eO),[o]),k=(0,_.useMemo)(()=>N.filter(e=>eB(e)),[N]),z=(0,_.useMemo)(()=>(function(e,t){let s=e.filter(eO),n=s.filter(e=>eB(e)),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(eK)){var a,r,o,c;let t=e.pm2.trim();if(!t||i.has(t))continue;let n=(e.business_status||"").trim().toLowerCase();if(!e.is_pushing&&"streaming"!==n&&!eG(e.process_status))continue;let d=s.find(e=>e.pm2.trim()===t);l.push(null!=d?d:{pm2:t,script:null!==(o=null!==(r=e.script)&&void 0!==r?r:null===(a=s[0])||void 0===a?void 0:a.script)&&void 0!==o?o:"youtube.py",label:null!==(c=e.label)&&void 0!==c?c:t}),i.add(t)}return l})(N.length?N:o,g),[o,g,N]),S=(0,_.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(eK).map(e=>[e.pm2.trim(),e])),n=e[0],l=eW(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=eW(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===eH(e.script).trim().toLowerCase());return l?l.pm2:null!==(s=null===(t=e[0])||void 0===t?void 0:t.pm2)&&void 0!==s?s:""}(z),[g,z]),[C,R]=(0,_.useState)("single"),[P,L]=(0,_.useState)([]),[M,U]=(0,_.useState)(""),[T,I]=(0,_.useState)(""),[E,A]=(0,_.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!1}),[D,Z]=(0,_.useState)(null),[O,H]=(0,_.useState)(!1),[K,W]=(0,_.useState)(""),[F,Y]=(0,_.useState)(!0),[J,G]=(0,_.useState)(!1),[V,q]=(0,_.useState)(!1),[X,$]=(0,_.useState)(null),[Q,ee]=(0,_.useState)({}),[et,es]=(0,_.useState)(!1),[en,el]=(0,_.useState)(null),ei=(0,_.useRef)(!1);(0,_.useEffect)(()=>{ei.current=!1},[d]);let ea=(0,_.useCallback)(async()=>{if(d)try{var e,t,s;let n=await b("/get_url_config?process=".concat(encodeURIComponent(d))),l=null!==(e=n.content)&&void 0!==e?e:"";if(ei.current)return;if("single"===C)u(l);else{let e=null!==(s=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==s?s:"";if(eX(e,l)){W(e);return}W(l),M&&L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:l}:e);return eT(t),t})}}catch(e){}},[M,P,d,b,C,u]);(0,_.useEffect)(()=>{if(!d||!F)return;let e=window.setInterval(()=>{ei.current||ea()},8e3);return()=>clearInterval(e)},[d,F,ea]);let er=async()=>{if(d){G(!0),$(null),ei.current=!1;try{var e,t,s;let n=await b("/get_url_config?process=".concat(encodeURIComponent(d))),l=null!==(e=n.content)&&void 0!==e?e:"";if(ei.current){$(a("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===C)u(l);else{let e=null!==(s=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==s?s:"";if(eX(e,l)){W(e),$(a("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}W(l),M&&L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:l}:e);return eT(t),t})}$(a("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){$(e.message)}finally{G(!1)}}};(0,_.useEffect)(()=>{try{let e=window.localStorage.getItem(eF);("pro"===e||"single"===e)&&R(e)}catch(e){}},[]),(0,_.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await eE(b);if(t.fetched&&!e){L(t.channels),eT(t.channels);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(eC);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=eU(e);if(t.length)return window.localStorage.setItem(eC,JSON.stringify(t)),t}return eU(e)}(),s=t.length>0?t:(()=>{let e=eD();return[{id:e,name:"线路 1",streamKey:"",urlLines:"",pm2Name:eZ(e),notes:""}]})();L(s),t.length||eT(s)})(),()=>{e=!0}},[b]),(0,_.useEffect)(()=>{P.length&&!M&&U(P[0].id)},[P,M]);let eo=(0,_.useCallback)(e=>g.find(t=>t.pm2===e),[g]),ec=(0,_.useCallback)(e=>{var t;return null===(t=eo(e))||void 0===t?void 0:t.process_status},[eo]);(0,_.useEffect)(()=>{if("single"!==C||!S)return;if(!z.some(e=>e.pm2===d)){x(S);return}let e=z.find(e=>e.pm2===d),t=eo(d),s=z.find(e=>e.pm2===S),n=eo(S);d!==S&&e&&s&&eW(s,n){L(e),eT(e)},[]),ey=(0,_.useCallback)(async e=>{await eA(b,e)},[b]),ew=(0,_.useCallback)(e=>{ef(e),ey(e).catch(e=>{f("".concat(a("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[ef,f,ey,a]),ej=P.find(e=>e.id===M)||P[0],eN=(0,_.useMemo)(()=>{var e;return(null!==(e=null==ej?void 0:ej.urlLines)&&void 0!==e?e:"").trim()},[null==ej?void 0:ej.urlLines]),ek=(0,_.useMemo)(()=>{var e;return!!ej&&K!==(null!==(e=ej.urlLines)&&void 0!==e?e:"").trim()},[ej,K]),ez=(0,_.useMemo)(()=>{var e;return ej?null!==(e=Q[ej.id])&&void 0!==e?e:eJ(ej):null},[ej,Q]);(0,_.useEffect)(()=>{ej&&ee(e=>e[ej.id]?e:{...e,[ej.id]:eJ(ej)})},[ej]),(0,_.useEffect)(()=>{el(null)},[M]);let eS=(0,_.useCallback)((e,t)=>{ej&&(ee(s=>{var n;return{...s,[ej.id]:{...null!==(n=s[ej.id])&&void 0!==n?n:eJ(ej),[e]:t}}}),el(null))},[ej]),eR=ej?eL(ej):"",eM=ej&&ez?eL({id:ej.id,pm2Name:ez.pm2Name}):"",eI=!!ej&&!!ez&&eM!==eR,eQ=(0,_.useMemo)(()=>{if(!ej||!ez)return{ok:!1,message:a("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=ez.name.trim()||"".concat(a("线路","Ch")," ").concat(P.findIndex(e=>e.id===ej.id)+1),t=eL({id:ej.id,pm2Name:ez.pm2Name});return t?eY.has(t)?{ok:!1,message:a("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ez.streamKey.trim(),normalizedNotes:ez.notes.trim()}:P.find(e=>e.id!==ej.id&&eL(e)===t)?{ok:!1,message:a("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ez.streamKey.trim(),normalizedNotes:ez.notes.trim()}:{ok:!0,message:"",normalizedName:e,normalizedPm2:t,normalizedStreamKey:ez.streamKey.trim(),normalizedNotes:ez.notes.trim()}:{ok:!1,message:a("进程名不能为空","PM2 name is required"),normalizedName:e,normalizedPm2:t,normalizedStreamKey:ez.streamKey.trim(),normalizedNotes:ez.notes.trim()}},[ej,ez,P,a]),e0=(0,_.useMemo)(()=>{if(!ej||!ez)return!1;let e=eJ(ej);return ez.name!==e.name||ez.streamKey!==e.streamKey||eP(ez.pm2Name)!==eP(e.pm2Name)||ez.notes!==e.notes},[ej,ez]),e1=(0,_.useCallback)(e=>{if("single"===e&&"pro"===C&&ej&&ek&&ew(P.map(e=>e.id===ej.id?{...e,urlLines:K}:e)),"pro"===e&&P.length){var t,s;let e=P[0],n=k.some(e=>e.pm2===d)&&d.trim()?d.trim():eL(e),l=[{...e,streamKey:E.key.trim()||e.streamKey||"",urlLines:m.trim()||e.urlLines||"",pm2Name:n},...P.slice(1)];ew(l);let i=null!==(t=l.find(e=>e.id===M))&&void 0!==t?t:l[0];W((null!==(s=null==i?void 0:i.urlLines)&&void 0!==s?s:"").trim()||m.trim())}R(e);try{window.localStorage.setItem(eF,e)}catch(e){}},[C,ej,ek,P,K,E.key,m,d,k,M,ew]),e5=(0,_.useCallback)(e=>{var t;ej&&"pro"===C&&ek&&ew(P.map(e=>e.id===ej.id?{...e,urlLines:K}:e)),W((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),U(e.id),x(eL(e))},[ej,ek,C,P,K,x,ew]);(0,_.useEffect)(()=>{if("pro"!==C||!M)return;let e=P.find(e=>e.id===M);e&&x(eL(e))},[C,M,P,x]),(0,_.useEffect)(()=>{if("pro"!==C||!d||!M)return;let e=!1;return(async()=>{try{var t,s,n;let l=await b("/get_url_config?process=".concat(encodeURIComponent(d)));if(e||ei.current)return;let i=null!==(s=l.content)&&void 0!==s?s:"",a=null!==(n=null===(t=P.find(e=>e.id===M))||void 0===t?void 0:t.urlLines)&&void 0!==n?n:"";if(eX(a,i)){W(a);return}W(i),ei.current=!1,L(e=>{let t=e.map(e=>e.id===M?{...e,urlLines:i}:e);return eT(t),t})}catch(t){e||ei.current||W(eN)}})(),()=>{e=!0}},[M,eN,P,d,b,C]);let e2=(0,_.useCallback)(async()=>{if(d){H(!0),Z(null);try{var e;let t=await b("/get_config?process=".concat(encodeURIComponent(d))),s=null!==(e=t.content)&&void 0!==e?e:"";I(s),A(ep(s))}catch(e){Z(e.message)}finally{H(!1)}}},[d,b]);(0,_.useEffect)(()=>{d&&e2()},[d,e2]);let e3=(0,_.useCallback)(async()=>{var e;if(!ej||!ez)throw Error(a("请选择线路","Pick a lane"));if(!eQ.ok)throw Error(eQ.message);let t=P.map(e=>e.id===ej.id?{...e,name:eQ.normalizedName,streamKey:eQ.normalizedStreamKey,pm2Name:eQ.normalizedPm2,notes:eQ.normalizedNotes,urlLines:K}:e);return ef(t),await ey(t),ee(e=>({...e,[ej.id]:{name:eQ.normalizedName,streamKey:eQ.normalizedStreamKey,pm2Name:eQ.normalizedPm2,notes:eQ.normalizedNotes}})),{next:t,savedLane:null!==(e=t.find(e=>e.id===ej.id))&&void 0!==e?e:{...ej,name:eQ.normalizedName,streamKey:eQ.normalizedStreamKey,pm2Name:eQ.normalizedPm2,notes:eQ.normalizedNotes,urlLines:K},pm2:eQ.normalizedPm2}},[ej,ez,eQ,ef,P,K,ey,a]),e4=(0,_.useCallback)(async()=>{if(ej){es(!0),el(null);try{let e=await e3();x(e.pm2),el(a("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;el(e),f(e)}finally{es(!1)}}},[ej,f,e3,x,a]),e6=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d,s=t.trim();if(!s){Z(a("请选择进程","Pick a process"));return}H(!0),Z(null);try{let t=new URLSearchParams({process:s});await b("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),I(e),Z(a("youtube.ini 已保存","youtube.ini saved"))}catch(e){Z(e.message)}finally{H(!1)}},e8=async()=>{let e=eg(E);await e6(e)},e9=async()=>{H(!0),Z(null);try{var e;let t=T||eg(E),s=await b("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:"youtube.".concat(d.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini"),content:t,action:"youtube_balanced_preset"})}),n=null!==(e=s.content)&&void 0!==e?e:t;I(n),A(ep(n)),Z(s.message||a("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){Z(e.message)}finally{H(!1)}},e7=(0,_.useMemo)(()=>{var e,t;if("single"===C)return eu("key = ".concat(E.key));let s=null!==(t=null!==(e=null==ez?void 0:ez.streamKey)&&void 0!==e?e:null==ej?void 0:ej.streamKey)&&void 0!==t?t:"";return eu("key = ".concat(s))},[C,E.key,null==ej?void 0:ej.streamKey,null==ez?void 0:ez.streamKey]),te=async()=>{if(ej)try{es(!0),el(null);let e=await e3();x(e.pm2),await Promise.resolve(p(K,e.pm2)),ei.current=!1,el(a("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);el(e),f(e)}finally{es(!1)}},tt=async()=>{try{await Promise.resolve(p()),ei.current=!1}catch(e){}},ts=async()=>{let e="single"===C?m:K;q(!0),$(null);try{var t;let s=await b("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eb(d),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===C?u(n):W(n),ei.current=!0,$(s.message||a("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){$(e.message)}finally{q(!1)}},tn=async()=>{if(!ej||!ez)return;let e=ep(T||eg(E)),t=eg({key:ez.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});es(!0),el(null);try{let e=await e3();x(e.pm2),await e6(t,e.pm2),el(a("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;el(e),f(e)}finally{es(!1)}},tl="single"===C?m:K,ti=(0,_.useMemo)(()=>eq(tl).length,[tl]),ta=(0,_.useMemo)(()=>eh(tl).length,[tl]),tr=(0,_.useMemo)(()=>[null==j?void 0:j.neko_browser,null==j?void 0:j.chromium_remote_debug,null==j?void 0:j.srs_api].filter(e=>!!e),[j]),to=(0,_.useCallback)(async e=>{let t=ej?eL(ej):"";return ej&&e===t?await e3():(ef(P),await ey(P),{next:P,savedLane:null!=ej?ej:null,pm2:e})},[ej,ef,P,e3,ey]),tc=(0,_.useCallback)(async(e,t)=>{let s=!!ej&&eL(ej)===t;if("stop"!==e){var n,l;let e=P,s=t;try{let n=await to(t);e=n.next,s=n.pm2}catch(e){f("".concat(a("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>eL(e)===s),r=null!==(n=null==i?void 0:i.urlLines)&&void 0!==n?n:"";if(!(null!==(l=null==i?void 0:i.streamKey)&&void 0!==l?l:"").trim()){f(a("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!eq(r).length){f(a("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&x(t),h(e,t)},[ej,P,to,f,h,x,a]),td=!!r||O||J||V||et,tx=eo(d),tm=eG(ec(d)),tu=(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-4 text-xs text-zinc-400",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:F,onChange:e=>Y(e.target.checked)}),a("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void er(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:a("手动重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void ts(),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-1.5 text-cyan-100 hover:bg-cyan-500/15",children:V?a("去重中...","Deduplicating..."):a("智能去重","Deduplicate")})]});return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[w?(0,n.jsx)(em,{t:a,title:a("YouTube 转播链路","YouTube relay chain"),subtitle:a("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:w,steps:[{label:"ShellCrash",sub:a("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:a("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:a("Chromium 工作室","Chromium"),gradient:"from-emerald-400 to-teal-500",openUrl:(0,ex.p)((null==j?void 0:j.neko_browser)||"http://live.local:9200/")}]}):null,(0,n.jsx)("div",{className:"rounded-2xl border border-violet-500/25 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/80 to-cyan-500/5 p-6 shadow-xl shadow-violet-900/10",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gradient-to-br from-red-500/30 to-violet-600/30 ring-1 ring-white/10",children:(0,n.jsx)(c.Z,{className:"h-5 w-5 text-red-200"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-white",children:a("YouTube 无人直播","YouTube unmanned live")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:a("单路一条流;多路时每条线路独立保存自己的密钥、URL 列表和 PM2 任务。填好后保存,再点「开始」。Neko 浏览器仅作辅助工作室,不再阻塞推流。","Single lane or multi-lane: every lane keeps its own key, URL list, and PM2 task. Save, then Start. Neko is optional browser tooling and no longer blocks streaming.")})]})]}),(0,n.jsxs)("div",{className:"flex rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>e1("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===C?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>e1("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===C?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:a("多频道 Pro","Multi Pro")})]})]})}),tr.length?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null==j?void 0:j.neko_browser)?(0,n.jsx)("a",{href:(0,ex.p)(j.neko_browser),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/20",children:a("打开 Neko 工作室","Open Neko studio")}):null,(null==j?void 0:j.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,ex.p)(j.chromium_remote_debug),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:a("打开 Chromium 调试","Open Chromium debug")}):null,(null==j?void 0:j.srs_api)?(0,n.jsx)("a",{href:(0,ex.p)(j.srs_api),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-violet-500/20 bg-violet-500/10 px-3 py-2 text-xs text-violet-100 ring-1 ring-violet-500/20",children:a("打开 SRS API","Open SRS API")}):null]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-zinc-950/60 p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-200/90",children:[(0,n.jsx)(B.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播开关","Live control")})]}),"single"===C?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{className:"mt-4 block text-xs font-semibold uppercase tracking-wider text-zinc-500",children:a("转播任务","Relay task")}),(0,n.jsx)("select",{className:"mt-2 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-white",value:d,onChange:e=>x(e.target.value),children:z.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=eH(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,a)," (",e.pm2,")"]},e.pm2))}),(0,n.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3",children:[(0,n.jsx)(e$,{kind:"start",targetPm2:d,busy:r,online:tm,label:a("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>h("start",d),notify:f,t:a}),(0,n.jsx)(e$,{kind:"stop",targetPm2:d,busy:r,online:tm,label:a("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>h("stop",d),notify:f,t:a}),(0,n.jsx)(e$,{kind:"restart",targetPm2:d,busy:r,online:tm,label:a("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>h("restart",d),notify:f,t:a})]}),(0,n.jsxs)("p",{className:"mt-3 text-center text-xs text-zinc-400",children:[a("当前状态","Current state"),": ",eV(tx,a)]}),(0,n.jsxs)("p",{className:"mt-3 text-center font-mono text-[11px] text-zinc-600",children:["key ",a("尾码","suffix"),": ",e7||"—"]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"mt-4 rounded-xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.1] via-zinc-950/50 to-violet-500/[0.06] p-4 ring-1 ring-white/[0.04]",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:a("Pro 转播实况","Pro relay status")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:a("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:P.map(e=>{var t,s,l;let i=eL(e),o=eo(i),c=ec(i),d=eq((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),x=eh((null!==(s=e.urlLines)&&void 0!==s?s:"").trim()),m=x[0],u=eu("key = ".concat(null!==(l=e.streamKey)&&void 0!==l?l:"")),h=M===e.id,p=eG(c);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border px-3 py-2.5 text-left text-xs transition sm:flex-nowrap ".concat(h?"border-violet-500/45 bg-violet-500/[0.1]":"border-white/10 bg-black/30 hover:border-white/18"),children:[(0,n.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>e5(e),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"font-medium text-zinc-100",children:e.name}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(function(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return"ready"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"streaming"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"waiting_source"===t||"monitoring"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/25":"source_live"===t?"bg-sky-500/15 text-sky-100 ring-sky-500/25":"misconfigured"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":eG(null==e?void 0:e.process_status)?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"bg-zinc-600/20 text-zinc-400 ring-zinc-500/25"}(o)),children:eV(o,a)})]}),(0,n.jsxs)("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-zinc-500",children:[(0,n.jsxs)("span",{children:["key …",u||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:i,children:i}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",d.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",x.length]})]}),m?(0,n.jsx)("a",{href:m,target:"_blank",rel:"noreferrer",className:"mt-1 block max-w-full truncate text-cyan-300/90 underline-offset-2 hover:underline",onClick:e=>e.stopPropagation(),title:m,children:m.replace(/^https?:\/\//,"")}):(0,n.jsx)("span",{className:"mt-1 block text-zinc-600",children:"—"})]}),(0,n.jsxs)("div",{className:"flex w-full shrink-0 flex-wrap items-center justify-end gap-1.5 sm:w-auto",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,n.jsx)(e$,{kind:"start",targetPm2:i,busy:r,online:p,label:a("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void tc("start",i),notify:f,t:a,compact:!0}),(0,n.jsx)(e$,{kind:"stop",targetPm2:i,busy:r,online:p,label:a("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void tc("stop",i),notify:f,t:a,compact:!0}),(0,n.jsx)(e$,{kind:"restart",targetPm2:i,busy:r,online:p,label:a("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void tc("restart",i),notify:f,t:a,compact:!0})]})]},e.id)})})]})})]}),"single"===C?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("YouTube 相关设置","YouTube settings")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("串流参数写进 youtube.ini,无需 Google 登录。","Stream settings go to youtube.ini — no Google login.")}),(0,n.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,n.jsx)("label",{className:"block text-xs text-zinc-400",children:a("串流密钥","Stream key")}),(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm font-mono text-zinc-200",spellCheck:!1,autoComplete:"off",value:E.key,onChange:e=>A(t=>({...t,key:e.target.value})),placeholder:"xxxx-xxxx-xxxx-xxxx-xxxx"}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:["RTMPS",(0,n.jsxs)("select",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 text-sm text-white",value:E.rtmps?"1":"0",onChange:e=>A(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:a("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:a("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[a("比特率 kbps","Bitrate kbps"),(0,n.jsx)("input",{className:"rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",value:E.bitrate,onChange:e=>A(t=>({...t,bitrate:e.target.value})),placeholder:"4000"})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 pt-6 text-xs text-zinc-300",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded border-white/20 bg-black/40",checked:E.fastAudio,onChange:e=>A(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",a("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:td,onClick:()=>void e2(),className:"inline-flex items-center gap-2 rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-200",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 ".concat(O?"animate-spin":"")}),a("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:td,onClick:()=>void e8(),className:"inline-flex items-center gap-2 rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:[O?(0,n.jsx)(v.Z,{className:"h-4 w-4 animate-spin"}):null,a("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void e9(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:a("平衡预设","Balanced preset")}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>{A(ep(T)),Z(a("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:a("从原文同步表单","Parse raw")})]}),(0,n.jsxs)("details",{className:"mt-4 rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:youtube.ini 原文","Raw youtube.ini")}),(0,n.jsx)("textarea",{className:"mt-2 h-36 w-full resize-y rounded-lg border border-white/10 bg-black/50 p-3 font-mono text-[11px] text-zinc-400",value:T,onChange:e=>I(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:td,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void e6(T),children:a("保存原文","Save raw")})]}),D?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:D}):null]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:[a("当前线路","Current lane"),ej?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",ej.name]}):null,e0?(0,n.jsx)("span",{className:"ml-2 rounded-md bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-100 ring-1 ring-amber-500/25",children:a("有未保存修改","Unsaved")}):null]}),ej?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:["PM2: ",eR,eI?" → ".concat(eM):""," \xb7 ","key ",e7||"—"]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:td,className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/20 px-3 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/30",onClick:()=>{let e=eD(),t={id:e,name:"".concat(a("线路","Ch")," ").concat(P.length+1),streamKey:"",urlLines:"",pm2Name:eZ(e),notes:""};ew([...P,t]),U(e),x(eL(t)),W("")},children:[(0,n.jsx)(e_.Z,{className:"h-3.5 w-3.5"}),a("新增线路","Add lane")]})]}),ej?(0,n.jsxs)("div",{className:"mt-4 space-y-3 border-t border-white/5 pt-4",children:[(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 text-sm",value:null!==(t=null==ez?void 0:ez.name)&&void 0!==t?t:"",onChange:e=>eS("name",e.target.value),placeholder:a("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:a("串流密钥","Stream key")}),(0,n.jsx)("input",{className:"w-full rounded-xl border border-white/10 bg-black/40 px-3 py-2 font-mono text-sm",spellCheck:!1,value:null!==(s=null==ez?void 0:ez.streamKey)&&void 0!==s?s:"",onChange:e=>eS("streamKey",e.target.value),placeholder:"xxxx-xxxx… / rtmp(s)://…"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void e4(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:et?a("保存中...","Saving..."):a("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void tn(),className:"rounded-xl bg-violet-500/25 px-4 py-2 text-sm font-medium text-violet-100 ring-1 ring-violet-500/35",children:a("写入 youtube.ini","Write youtube.ini")})]}),eQ.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:eQ.message}),(0,n.jsxs)("details",{className:"rounded-xl border border-white/5 bg-black/20 p-3",children:[(0,n.jsx)("summary",{className:"cursor-pointer text-xs text-zinc-500",children:a("高级:进程名","Advanced: process name")}),(0,n.jsx)("input",{className:"mt-2 w-full rounded-lg border border-white/10 bg-black/40 px-3 py-2 font-mono text-xs",value:null!==(l=null==ez?void 0:ez.pm2Name)&&void 0!==l?l:eZ(ej.id),onChange:e=>eS("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[a("实际生效","Effective"),": ",eM||"—"]}),eQ.message&&!eQ.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:eQ.message}):null]}),(0,n.jsx)("textarea",{className:"h-16 w-full resize-y rounded-xl border border-white/10 bg-black/40 p-3 text-xs text-zinc-300",value:null!==(i=null==ez?void 0:ez.notes)&&void 0!==i?i:"",onChange:e=>eS("notes",e.target.value),placeholder:a("备注(可选)","Notes (optional)")}),en?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:en}):null,(0,n.jsxs)("button",{type:"button",disabled:td||P.length<2,className:"inline-flex items-center gap-1 text-xs text-rose-300 hover:text-rose-200 disabled:opacity-30",onClick:()=>{var e;let t=P.filter(e=>e.id!==ej.id);ee(e=>{let t={...e};return delete t[ej.id],t}),ew(t),U((null===(e=t[0])||void 0===e?void 0:e.id)||"")},children:[(0,n.jsx)(ed.Z,{className:"h-3.5 w-3.5"}),a("删除此线路","Delete lane")]})]}):null]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("每条线路独立写入自己的 URL_config..ini,不再复用或回填所谓“全局地址”。","Each lane writes to its own URL_config..ini with no shared global URL draft.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:d?eb(d):"URL_config.ini"}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",ti]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",ta]})]}),tu,X?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:X}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[160px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:K,onChange:e=>{ei.current=!0,W(e.target.value)},spellCheck:!1,placeholder:"https://live.douyin.com/..."}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void te(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存地址","Save URLs")})})]})]}),"single"===C?(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:a("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:a("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,n.jsxs)("span",{className:"rounded-full border border-cyan-500/20 bg-cyan-500/10 px-2.5 py-1 text-cyan-100",children:[a("有效地址","Valid URLs"),": ",ti]}),(0,n.jsxs)("span",{className:"rounded-full border border-violet-500/20 bg-violet-500/10 px-2.5 py-1 text-violet-100",children:["Douyin: ",ta]})]}),tu,X?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:X}):null,(0,n.jsx)("textarea",{className:"mt-4 min-h-[200px] w-full resize-y rounded-xl border border-white/10 bg-black/50 p-4 font-mono text-xs text-zinc-300",value:m,onChange:e=>{ei.current=!0,u(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:td,onClick:()=>void tt(),className:"mt-3 rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:a("保存 URL 配置","Save URL config")})]}):null,(0,n.jsx)(ev,{t:a,currentProc:d,fetchJson:b,urlListText:"single"===C?m:K,keySuffixUi:e7,showKeyRow:!0,pollMs:800})]})}var e0=s(257);let e1=()=>void 0!==e0&&e0.env.NEXT_PUBLIC_API_URL||"";function e5(e){if(!e)return"—";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function e2(e){return"online"===e||"running"===e?"bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/30":"configured"===e?"bg-sky-500/15 text-sky-200 ring-1 ring-sky-500/25":"skipped"===e?"bg-slate-500/15 text-slate-300 ring-1 ring-slate-500/30":"stopped"===e||"not_found"===e?"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25":"error"===e?"bg-rose-500/15 text-rose-300 ring-1 ring-rose-500/35":"bg-violet-500/15 text-violet-200 ring-1 ring-violet-500/30"}function e3(e,t){let s=(e||"").trim().toLowerCase();return"online"===s||"running"===s?t("运行中","Running"):"configured"===s?t("已配置","Configured"):"not_found"===s?t("未注册","Unregistered"):"stopped"===s?t("已停止","Stopped"):"error"===s?t("异常","Error"):e||"—"}function e4(){var e,t,s,L,M,U,T,I,E,A,D,Z,O,H,B,K,W,F,J,G,V,q,X,$,Q,ee,et,es,en,el,ei,er,eo,ec,ed,em,eu,eh,ep,eb,eg,ef,ev,ey,ew,ej,eN,ek,eS,e_,eC,eR,eP,eL;let eM=e1(),[eU,eT]=(0,_.useState)("zh"),[eI,eE]=(0,_.useState)("dark"),[eA,eD]=(0,_.useState)("dashboard"),[eZ,eO]=(0,_.useState)(!1),[eH,eB]=(0,_.useState)(null),[eK,eW]=(0,_.useState)(null),[eF,eY]=(0,_.useState)(!0),[eJ,eG]=(0,_.useState)(null),[eV,eq]=(0,_.useState)(null),[eX,e$]=(0,_.useState)([]),[e0,e4]=(0,_.useState)([]),[e6,e8]=(0,_.useState)(""),[e9,e7]=(0,_.useState)(""),[te,tt]=(0,_.useState)("/sdcard/app.apk"),[ts,tn]=(0,_.useState)(""),[tl,ti]=(0,_.useState)(null),[ta,tr]=(0,_.useState)(!0),[to,tc]=(0,_.useState)(!0),td=(0,_.useRef)(null),tx=(0,_.useRef)(null),tm=(0,_.useCallback)((e,t)=>"zh"===eU?e:t,[eU]),tu=(0,_.useCallback)(e=>{eq(e),window.setTimeout(()=>eq(null),2800)},[]),th=(0,_.useCallback)(async(e,t)=>(0,Y.N)("".concat(eM).concat(e),t),[eM]),tp=(0,_.useCallback)(async()=>{if(td.current)return td.current;let e=(async()=>{try{var e;let t=await th("/hub/dashboard");eB(t),eW(null);let s=(null===(e=t.android)||void 0===e?void 0:e.devices)||[];if(s.length&&!ts){let e=s.find(e=>"device"===(e.state||"").toLowerCase());tn((null!=e?e:s[0]).serial)}}catch(e){eW(e.message)}finally{eY(!1),td.current=null}})();return td.current=e,e},[ts,th]),tb=(0,_.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===eA?e.set("family","youtube"):"live_tiktok"===eA&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[eA]),tg=(0,_.useCallback)(async()=>{if(tx.current)return tx.current;let e=(async()=>{try{let e=(await th(tb)).entries||[];e4(e),e$(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),e8(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{tx.current=null}})();return tx.current=e,e},[th,tb]);(0,_.useEffect)(()=>{let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&eT(e);let t=window.localStorage.getItem("live-hub-theme");("light"===t||"dark"===t)&&eE(t)},[]),(0,_.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",eU)},[eU]),(0,_.useEffect)(()=>{document.documentElement.setAttribute("data-theme",eI);try{window.localStorage.setItem("live-hub-theme",eI)}catch(e){}},[eI]),(0,_.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&tr(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&tc(!1)}catch(e){}},[]),(0,_.useEffect)(()=>{tp()},[tp]),(0,_.useEffect)(()=>{tg()},[tg]),(0,_.useEffect)(()=>{if(!ta||"live_youtube"===eA||"live_tiktok"===eA)return;let e=window.setInterval(()=>{tp()},1e4);return()=>clearInterval(e)},[ta,tp,eA]),(0,_.useEffect)(()=>{if(!ta)return;let e=window.setInterval(()=>{tg()},"live_youtube"===eA||"live_tiktok"===eA?700:4e3);return()=>clearInterval(e)},[ta,tg,eA]),(0,_.useEffect)(()=>{e6&&"live_youtube"===eA&&(async()=>{try{let e=await th("/get_url_config?process=".concat(encodeURIComponent(e6)));e7(e.content||"")}catch(e){}})()},[e6,th,eA]),(0,_.useEffect)(()=>{"settings"===eA&&(async()=>{try{let e=await th("/hub/config");ti(e)}catch(e){ti(null)}})()},[th,eA]);let tf=(0,_.useMemo)(()=>{var e;let t=(null==eH?void 0:null===(e=eH.stack)||void 0===e?void 0:e.quick_links)||{},s={};for(let[e,n]of Object.entries(t))/^https?:\/\//i.test(n)?s[e]=(0,ex.p)(n):s[e]=n;return s},[null==eH?void 0:null===(e=eH.stack)||void 0===e?void 0:e.quick_links]),tv=async(e,t)=>{eG("svc:".concat(e));try{let s=await th("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?tu(s.detail||s.message||tm("操作失败","Action failed")):tu(s.message||"OK"),await tp()}catch(e){tu(e.message)}finally{eG(null)}},ty=async(e,t)=>{let s=(null!=t?t:e6).trim();if(s){eG("proc:".concat(e,":").concat(s));try{let t=await th("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});tu(String(t.output||t.message||"OK")),await tg(),"live_youtube"===eA||"live_tiktok"===eA?tp():await tp()}catch(e){tu(e.message)}finally{eG(null)}}},tw=async(e,t)=>{let s=(null!=t?t:e6).trim();if(!s)return;let n=null!=e?e:e9;eG("save:url");try{let e=new URLSearchParams({process:s});await th("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),tu(tm("URL 配置已保存","URL config saved"))}catch(e){throw tu(e.message),e}finally{eG(null)}},tj=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ts){tu(tm("请选择设备","Pick a device"));return}eG("adb:".concat(e));try{let s=await th("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:ts,payload:t})});tu(s.message||"OK")}catch(e){tu(e.message)}finally{eG(null)}},tN=[{id:"dashboard",icon:a.Z,labelZh:"总览",labelEn:"Dashboard"},{id:"services",icon:r.Z,labelZh:"服务",labelEn:"Services"},{id:"live_youtube",icon:o.Z,labelZh:"YouTube 无人直播",labelEn:"YouTube unmanned"},{id:"live_tiktok",icon:c.Z,labelZh:"TikTok 无人直播",labelEn:"TikTok unmanned"},{id:"android",icon:d.Z,labelZh:"安卓",labelEn:"Android"},{id:"network",icon:x.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:m.Z,labelZh:"设置",labelEn:"Settings"}],tk=e=>{navigator.clipboard.writeText(e).then(()=>tu(tm("已复制","Copied")),()=>tu(tm("复制失败","Copy failed")))},tz=null!==(eg=null==eH?void 0:null===(t=eH.services)||void 0===t?void 0:t.filter(e=>e.running&&e.available).length)&&void 0!==eg?eg:0,tS=null!==(ef=null==eH?void 0:null===(s=eH.services)||void 0===s?void 0:s.length)&&void 0!==ef?ef:0;return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===eI?"bg-slate-100 text-slate-900 selection:bg-violet-400/25":"bg-[#050508] text-zinc-100 selection:bg-violet-500/30"),children:[(0,n.jsx)("div",{className:"lp-noise pointer-events-none fixed inset-0 z-0 ".concat("light"===eI?"opacity-[0.06]":"opacity-[0.22]"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora pointer-events-none fixed -left-1/4 top-0 h-[42rem] w-[42rem] rounded-full blur-[120px] ".concat("light"===eI?"bg-violet-400/15":"bg-violet-600/20"),"aria-hidden":!0}),(0,n.jsx)("div",{className:"lp-aurora2 pointer-events-none fixed bottom-0 right-0 h-[36rem] w-[36rem] rounded-full blur-[100px] ".concat("light"===eI?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),eV?(0,n.jsx)(l.E.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},className:"fixed bottom-6 left-1/2 z-[100] max-w-md -translate-x-1/2 rounded-2xl border border-white/10 bg-zinc-950/95 px-5 py-3 text-center text-sm text-zinc-100 shadow-2xl shadow-black/50 backdrop-blur-xl",children:eV}):null,(0,n.jsxs)("div",{className:"relative z-10 flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"hidden w-64 shrink-0 flex-col border-r px-4 py-6 backdrop-blur-2xl lg:flex ".concat("light"===eI?"border-slate-200/90 bg-white/70":"border-white/[0.06] bg-zinc-950/40"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 px-2",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-violet-500 to-cyan-400 shadow-lg shadow-violet-500/25",children:(0,n.jsx)(u.Z,{className:"h-4 w-4 text-white"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] ".concat("light"===eI?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===eI?"text-slate-900":"text-white"),children:tm("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:tN.map(e=>{let t=e.icon,s=eA===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>eD(e.id),className:"flex items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm font-medium transition ".concat("light"===eI?s?"bg-violet-100/90 text-slate-900 shadow-inner shadow-violet-200/50":"text-slate-600 hover:bg-slate-200/60 hover:text-slate-900":s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-500 hover:bg-white/[0.04] hover:text-zinc-200"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat("light"===eI?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),tm(e.labelZh,e.labelEn),s?(0,n.jsx)(h.Z,{className:"ml-auto h-4 w-4 ".concat("light"===eI?"text-slate-400":"text-zinc-600")}):null]},e.id)})})]}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxs)("header",{className:"sticky top-0 z-20 flex items-center justify-between gap-3 border-b px-4 py-3 backdrop-blur-xl lg:px-8 ".concat("light"===eI?"border-slate-200/80 bg-white/75 text-slate-900":"border-white/[0.06] bg-zinc-950/70 text-white"),children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,n.jsx)("button",{type:"button",className:"rounded-xl border p-2 lg:hidden ".concat("light"===eI?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>eO(!0),"aria-label":"Menu",children:(0,n.jsx)(p.Z,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight lg:text-xl ".concat("light"===eI?"text-slate-900":"text-white"),children:tm((null===(L=tN.find(e=>e.id===eA))||void 0===L?void 0:L.labelZh)||"",(null===(M=tN.find(e=>e.id===eA))||void 0===M?void 0:M.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===eI?"text-slate-500":"text-zinc-500"),children:[(null==eH?void 0:null===(U=eH.stack)||void 0===U?void 0:U.mdns_host)||"live.local"," \xb7"," ","dark"===eI?tm("夜间","Dark mode"):tm("日间","Light mode")," \xb7 ",tm("自动刷新","Auto refresh")]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>eE(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===eI?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===eI?tm("切换到日间","Switch to light"):tm("切换到夜间","Switch to dark"),"aria-label":"dark"===eI?tm("日间模式","Light mode"):tm("夜间模式","Dark mode"),"aria-pressed":"light"===eI,children:"dark"===eI?(0,n.jsx)(b.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(g.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>eT(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===eI?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===eU?"English":"中文","aria-label":tm("切换语言","Toggle language"),"aria-pressed":"en"===eU,children:[(0,n.jsx)(f.Z,{className:"h-5 w-5",strokeWidth:2}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-4 min-w-[1rem] items-center justify-center rounded px-0.5 text-[9px] font-bold leading-none ".concat("light"===eI?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===eU?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!eJ,onClick:()=>void Promise.all([tp(),tg()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===eI?"border-slate-200 bg-white text-slate-700 hover:bg-slate-50":"border-white/10 bg-white/[0.04] text-zinc-300 hover:bg-white/[0.07]"),children:[eJ?(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:tm("刷新","Refresh")})]})]})]}),(0,n.jsx)("main",{className:"flex-1 px-4 py-6 lg:px-8 lg:py-8",children:(0,n.jsx)(i.M,{mode:"wait",children:(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.28,ease:[.22,1,.36,1]},children:["dashboard"===eA?(0,n.jsxs)("div",{className:"space-y-6",children:[eK?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[tm("无法加载仪表盘:","Dashboard error: "),eK]}):null,(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.02},className:"rounded-2xl border p-2 backdrop-blur-xl ".concat("light"===eI?"border-slate-200/90 bg-white/80 shadow-sm shadow-slate-200/30":"border-white/[0.07] bg-zinc-950/30"),children:(0,n.jsx)(R.Z,{snapshot:null!==(ev=null==eH?void 0:eH.snapshot)&&void 0!==ev?ev:null,theme:eI,tr:tm})}),(0,n.jsx)(l.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05},className:"rounded-2xl border p-3 shadow-lg ".concat("light"===eI?"border-fuchsia-200/80 bg-gradient-to-br from-fuchsia-50/90 via-white to-cyan-50/70 shadow-fuchsia-100/40":"border-fuchsia-500/20 bg-gradient-to-br from-fuchsia-500/10 via-zinc-950/60 to-cyan-500/10 shadow-fuchsia-900/10"),children:(0,n.jsx)(C,{tr:tm})}),(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[{icon:w.Z,label:tm("CPU 1m","CPU 1m"),value:null!==(ey=null==eH?void 0:null===(E=eH.snapshot)||void 0===E?void 0:null===(I=E.cpu_load)||void 0===I?void 0:null===(T=I["1m"])||void 0===T?void 0:T.toFixed(2))&&void 0!==ey?ey:"—",sub:tm("负载均值","Load avg")},{icon:a.Z,label:tm("内存","Memory"),value:e5(null==eH?void 0:null===(D=eH.snapshot)||void 0===D?void 0:null===(A=D.memory)||void 0===A?void 0:A.available),sub:"/ ".concat(e5(null==eH?void 0:null===(O=eH.snapshot)||void 0===O?void 0:null===(Z=O.memory)||void 0===Z?void 0:Z.total))},{icon:j.Z,label:tm("磁盘可用","Disk free"),value:e5(null==eH?void 0:null===(B=eH.snapshot)||void 0===B?void 0:null===(H=B.disk)||void 0===H?void 0:H.free),sub:"/ ".concat(e5(null==eH?void 0:null===(W=eH.snapshot)||void 0===W?void 0:null===(K=W.disk)||void 0===K?void 0:K.total))},{icon:r.Z,label:tm("服务在线","Services up"),value:"".concat(tz,"/").concat(tS||"—"),sub:tm("基础服务层","Infra layer")},{icon:N.Z,label:tm("运行时间","Uptime"),value:function(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e)),s=Math.floor(t/86400),n=Math.floor(t%86400/3600),l=Math.floor(t%3600/60);return s>0?"".concat(s,"d ").concat(n,"h"):n>0?"".concat(n,"h ").concat(l,"m"):"".concat(l,"m")}(null==eH?void 0:null===(F=eH.snapshot)||void 0===F?void 0:F.uptime_seconds),sub:tm("自开机","Since boot")}].map((e,t)=>(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.05*t,duration:.35,ease:[.22,1,.36,1]},whileHover:{y:-2},className:"group relative overflow-hidden rounded-xl border border-white/[0.07] bg-gradient-to-br from-white/[0.05] to-transparent p-3 shadow-lg shadow-black/20",children:[(0,n.jsx)("div",{className:"absolute -right-4 -top-4 h-16 w-16 rounded-full bg-violet-500/10 blur-xl transition group-hover:bg-violet-500/18"}),(0,n.jsx)(e.icon,{className:"h-4 w-4 text-violet-300/90"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-500",children:e.label}),(0,n.jsx)("p",{className:"mt-0.5 font-mono text-lg font-semibold leading-tight text-white",children:eF?"…":e.value}),(0,n.jsx)("p",{className:"mt-0.5 text-[10px] text-zinc-500",children:e.sub})]},e.label))}),(null==eH?void 0:eH.hardware)&&"object"==typeof eH.hardware?(0,n.jsxs)("div",{className:"rounded-2xl border border-indigo-500/25 bg-gradient-to-br from-indigo-500/[0.1] via-zinc-950/70 to-violet-500/[0.08] p-6 shadow-2xl shadow-indigo-500/5",children:[(0,n.jsx)("h3",{className:"text-base font-semibold text-white",children:tm("系统硬件与软件能力","Hardware & software profile")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("来自 hardware_probe;用于直播/解码策略参考。","From hardware_probe; guides decode/streaming posture.")}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-indigo-300/90",children:tm("平台","Platform")}),(0,n.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"arch"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(ew=eH.hardware.arch)&&void 0!==ew?ew:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"kernel"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(eN=null!==(ej=eH.hardware.kernel)&&void 0!==ej?ej:null===(J=eH.stack)||void 0===J?void 0:J.kernel)&&void 0!==eN?eN:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"Python"}),(0,n.jsx)("dd",{className:"text-right text-zinc-200",children:String(null!==(ek=null===(G=eH.stack)||void 0===G?void 0:G.python)&&void 0!==ek?ek:"—")})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"mDNS"}),(0,n.jsx)("dd",{className:"text-right text-cyan-200/90",children:null!==(eS=null===(V=eH.stack)||void 0===V?void 0:V.mdns_host)&&void 0!==eS?eS:"—"})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"IP"}),(0,n.jsx)("dd",{className:"text-right text-zinc-300",children:((null===(q=eH.stack)||void 0===q?void 0:q.ips)||[]).join(" \xb7 ")||"—"})]})]})]}),(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-fuchsia-300/90",children:"GPU / NPU"}),(()=>{let e=eH.hardware.gpu,t=eH.hardware.npu;return(0,n.jsxs)("dl",{className:"space-y-2 font-mono text-[11px] text-zinc-400",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"GPU"}),(0,n.jsxs)("dd",{className:"mt-0.5 text-zinc-200",children:[(null==e?void 0:e.present)?tm("已检测","present"):tm("未检测","absent"),(null==e?void 0:e.driver)?" \xb7 ".concat(e.driver):""]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"render"}),(0,n.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:((null==e?void 0:e.render_nodes)||[]).join(", ")||"—"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{className:"text-zinc-600",children:"NPU"}),(0,n.jsx)("dd",{className:"mt-0.5 break-all text-zinc-500",children:(null==t?void 0:t.present)?(t.devices||[]).join(", "):tm("—","—")})]})]})})()]}),(0,n.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/[0.06] bg-black/30 p-4 lg:col-span-2",children:[(0,n.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-emerald-300/90",children:"ffmpeg / 建议策略"}),(()=>{var e,t,s,l;let i=eH.hardware.ffmpeg_hwaccels||[],a=eH.hardware.recommendation;return(0,n.jsxs)("div",{className:"space-y-2 text-[11px] text-zinc-400",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"hwaccels: "}),(0,n.jsx)("span",{className:"font-mono text-emerald-200/90",children:i.length?i.join(", "):"—"})]}),(0,n.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsxs)("span",{className:"text-zinc-600",children:[tm("解码","Decoder"),": "]}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(e=null==a?void 0:a.video_decoder)&&void 0!==e?e:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"HDMI: "}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(t=null==a?void 0:a.hdmi_player)&&void 0!==t?t:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Browser: "}),(0,n.jsx)("span",{className:"text-zinc-200",children:null!==(s=null==a?void 0:a.browser_hwaccel)&&void 0!==s?s:"—"})]}),(0,n.jsxs)("p",{children:[(0,n.jsxs)("span",{className:"text-zinc-600",children:[tm("稳定模式","Stability"),": "]}),(0,n.jsx)("span",{className:"text-amber-200/90",children:null!==(l=null==a?void 0:a.stability_mode)&&void 0!==l?l:"—"})]})]}),((null==a?void 0:a.degradation_reasons)||[]).length?(0,n.jsx)("ul",{className:"mt-2 list-inside list-disc space-y-1 text-[10px] text-amber-200/80",children:((null==a?void 0:a.degradation_reasons)||[]).map(e=>(0,n.jsx)("li",{children:e},e))}):null]})})()]})]})]}):null,(null==eH?void 0:null===(X=eH.stack)||void 0===X?void 0:X.neko_login)?(0,n.jsxs)("div",{className:"rounded-2xl border border-fuchsia-500/25 bg-gradient-to-r from-fuchsia-500/[0.08] to-violet-500/[0.06] p-5",children:[(0,n.jsxs)("h3",{className:"text-sm font-semibold text-white",children:["Neko ",tm("登录","sign-in")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:eH.stack.neko_login.note_zh||tm("Neko Chromium :9200 使用下列账号策略。","Neko Chromium :9200 uses the policy below.")}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-amber-200/85",children:tm("重要:两栏分开填——昵称随意,密码必须是环境变量里的口令(默认 12345678)。用错密码会像一直加载;勿把「用户名/密码」写在一行。","Use two fields: display name is free-form; password must match NEKO_* (default 12345678). Wrong password looks like infinite loading.")}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 font-mono text-sm",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,n.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:tm("昵称示例","Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-fuchsia-200",children:null!==(e_=eH.stack.neko_login.user_login)&&void 0!==e_?e_:"live"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:tm("连接口令","Access Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-fuchsia-100",children:null!==(eC=eH.stack.neko_login.user_password)&&void 0!==eC?eC:"—"})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/40 px-4 py-3",children:[(0,n.jsx)("p",{className:"text-[10px] uppercase text-zinc-500",children:tm("管理昵称示例","Admin Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-violet-200",children:null!==(eR=eH.stack.neko_login.admin_login)&&void 0!==eR?eR:"admin"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:tm("管理口令","Admin Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-violet-100",children:null!==(eP=eH.stack.neko_login.admin_password)&&void 0!==eP?eP:"—"})]})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:tm("x86 默认使用 Neko 的 Chrome 镜像,ARM 默认使用 Chromium 镜像;默认保留管理员会话、开发者工具和 Tampermonkey 持久化。本栈未启用 Firefox 版 Neko。","x86 defaults to Neko’s Chrome image, ARM defaults to Chromium, and admin access, DevTools, plus persistent Tampermonkey stay enabled. This stack does not use Firefox Neko.")})]}):null,(null==eH?void 0:null===(Q=eH.network)||void 0===Q?void 0:null===($=Q.interfaces)||void 0===$?void 0:$.length)?(0,n.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-gradient-to-br from-cyan-500/[0.07] to-transparent p-5",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(k.Z,{className:"h-4 w-4 text-cyan-300"}),tm("网络流量(累计)","Network I/O (cumulative)")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("自开机以来各接口收发字节;非实时速率。","Per-interface RX/TX since boot (not a live bitrate).")}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:(eH.network.interfaces||[]).slice(0,6).map(e=>{var t,s,l,i;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 px-4 py-3 font-mono text-[11px]",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-cyan-200/90",children:e.name}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:[tm("链路","Link"),": ",e.operstate||"unknown"," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e.speed_mbps?"".concat(e.speed_mbps," Mbps"):tm("未知速率","unknown speed")]}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:["↓ ",e5(e.rx_bytes)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(l=null===(t=e.rx_packets)||void 0===t?void 0:t.toLocaleString())&&void 0!==l?l:"—"," pkt"]}),(0,n.jsxs)("p",{className:"mt-0.5 text-zinc-500",children:["↑ ",e5(e.tx_bytes)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",null!==(i=null===(s=e.tx_packets)||void 0===s?void 0:s.toLocaleString())&&void 0!==i?i:"—"," pkt"]})]},e.name)})})]}):null,(null==eH?void 0:null===(et=eH.live_events)||void 0===et?void 0:null===(ee=et.pm2_tail)||void 0===ee?void 0:ee.length)||(null==eH?void 0:null===(en=eH.live_events)||void 0===en?void 0:null===(es=en.process_digest)||void 0===es?void 0:es.length)?(0,n.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-2xl border border-amber-500/15 bg-zinc-950/40 p-5",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("直播 / PM2 事件","Live / PM2 feed")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("PM2 合并日志尾部","PM2 merged log tail")}),(0,n.jsx)("pre",{className:"mt-3 max-h-48 overflow-auto whitespace-pre-wrap rounded-lg border border-white/[0.05] bg-black/40 p-3 font-mono text-[10px] leading-relaxed text-zinc-400",children:((null==eH?void 0:null===(el=eH.live_events)||void 0===el?void 0:el.pm2_tail)||[]).join("\n")||tm("暂无 PM2 输出","No PM2 output")})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/15 bg-zinc-950/40 p-5",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("进程快照","Process digest")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:((null==eH?void 0:null===(ei=eH.live_events)||void 0===ei?void 0:ei.process_digest)||[]).map(e=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.05] bg-black/30 px-3 py-2 text-xs",children:[(0,n.jsx)("span",{className:"truncate text-zinc-300",children:e.label||e.pm2}),(0,n.jsx)("span",{className:"shrink-0 rounded-md px-2 py-0.5 text-[10px] font-medium ".concat(e2(e.status||"")),children:e3(e.status||"",tm)})]},e.pm2))})]})]}):null,(0,n.jsxs)("div",{className:"rounded-2xl border border-violet-500/20 bg-gradient-to-br from-violet-500/[0.12] via-zinc-950/50 to-fuchsia-500/[0.06] p-5 shadow-lg shadow-violet-500/5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:tm("直播进程","Live processes")}),(0,n.jsx)("span",{className:"rounded-full bg-white/10 px-2 py-0.5 text-[10px] font-medium text-zinc-300",children:(null==eH?void 0:null===(er=eH.live)||void 0===er?void 0:er.backend_mode)||"—"})]}),(0,n.jsxs)("ul",{className:"mt-4 space-y-2.5",children:[((null==eH?void 0:null===(eo=eH.live)||void 0===eo?void 0:eo.processes)||[]).slice(0,10).map(e=>(0,n.jsxs)("li",{className:"group flex items-center gap-3 rounded-xl border border-white/[0.08] bg-black/35 px-3 py-2.5 transition hover:border-violet-400/25 hover:bg-black/45",children:[(0,n.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-violet-500/30 to-fuchsia-500/20 text-[10px] font-bold text-violet-100 ring-1 ring-white/10",children:"LIVE"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-sm font-medium text-zinc-100",children:e.label||e.pm2}),(0,n.jsx)("p",{className:"truncate font-mono text-[10px] text-zinc-600",children:e.script||e.pm2})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-lg px-2.5 py-1 text-[10px] font-semibold ".concat(e2(e.process_status||"")),children:e3(e.process_status||"",tm)})]},e.pm2)),(null==eH?void 0:null===(ed=eH.live)||void 0===ed?void 0:null===(ec=ed.processes)||void 0===ec?void 0:ec.length)?null:(0,n.jsx)("li",{className:"rounded-xl border border-dashed border-white/10 py-8 text-center text-xs text-zinc-600",children:tm("暂无直播进程","No live processes")})]}),(0,n.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>eD("live_youtube"),className:"rounded-xl border border-violet-400/35 bg-violet-500/15 py-2.5 text-[11px] font-semibold text-violet-100 shadow-inner shadow-black/20 transition hover:bg-violet-500/25",children:"YouTube"}),(0,n.jsx)("button",{type:"button",onClick:()=>eD("live_tiktok"),className:"rounded-xl border border-cyan-400/35 bg-cyan-500/15 py-2.5 text-[11px] font-semibold text-cyan-100 shadow-inner shadow-black/20 transition hover:bg-cyan-500/25",children:"TikTok"})]})]}),(null==eH?void 0:eH.probes)&&to?(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[eH.probes.srs?(()=>{var e,t,s,l,i,a,r;let o=null===(e=eH.probes)||void 0===e?void 0:e.srs,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:null===(s=o.tcp_api)||void 0===s?void 0:s.reachable,x=null==o?void 0:o.http_ui,m=null==o?void 0:o.http,u=null==o?void 0:o.api_port,h=null!==(i=null==o?void 0:o.api_ok)&&void 0!==i?i:(null==m?void 0:m.http_code)===200,p=null==x?void 0:x.http_code;return(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white",children:"SRS"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(h?"bg-emerald-500/20 text-emerald-200 ring-1 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:h?tm("API 正常","API OK"):tm("API 异常","API down")})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:[":",null!==(a=null==o?void 0:o.port)&&void 0!==a?a:"—"," / API :",null!=u?u:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 API TCP"," ",d?"OK":"—"]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[11px] text-zinc-500",children:["API HTTP ",null!==(r=null==m?void 0:m.http_code)&&void 0!==r?r:"—"," \xb7 ",tm("根路径","root")," ",null!=p?p:"—",404===p?tm("(无首页不影响推流)"," (no index is OK for streaming)"):null]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[tm("延迟","RTT")," ",(null==m?void 0:m.latency_ms)!=null?"".concat(m.latency_ms," ms"):(null==o?void 0:null===(l=o.tcp)||void 0===l?void 0:l.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),!h&&(null==m?void 0:m.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:m.error}):null]})})():null,eH.probes.neko?(()=>{var e,t,s,l,i;let a=null===(e=eH.probes)||void 0===e?void 0:e.neko,r=null==a?void 0:null===(t=a.tcp)||void 0===t?void 0:t.reachable,o=null==a?void 0:a.http;return(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.07] bg-zinc-950/40 p-4 backdrop-blur-sm",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white",children:"Neko Chromium"}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tm("Docker 内 Chromium(非 Chrome 品牌);arm64/x86 同一镜像。","Chromium in Docker (not Chrome branding); multi-arch.")}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[":",null!==(l=null==a?void 0:a.port)&&void 0!==l?l:"—"," \xb7 TCP ",r?"OK":"—"," \xb7 HTTP ",null!==(i=null==o?void 0:o.http_code)&&void 0!==i?i:"—"]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[tm("延迟","RTT")," ",(null==o?void 0:o.latency_ms)!=null?"".concat(o.latency_ms," ms"):(null==a?void 0:null===(s=a.tcp)||void 0===s?void 0:s.latency_ms)!=null?"".concat(a.tcp.latency_ms," ms"):"—"]}),!(null==o?void 0:o.reachable)&&(null==o?void 0:o.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:o.error}):null]})})():null]}):null]}):null,"services"===eA?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==eH?void 0:eH.services)||[]).map((e,t)=>(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.04*t},whileHover:{y:-2},className:"rounded-2xl border border-white/[0.07] bg-gradient-to-b from-white/[0.05] to-transparent p-5",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"font-semibold text-white",children:e.label}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(e2(e.running?"online":e.status)),children:e.running?tm("运行中","Running"):e.status})]}),e.detail?(0,n.jsx)("p",{className:"mt-2 text-[11px] leading-snug line-clamp-6 ".concat("skipped"===e.status?"text-slate-300/90":"text-amber-200/85"),children:e.detail}):null,"shellcrash"===e.service_id&&e.available&&!e.running?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-500",children:tm("stopped 为常态:仅当需要透明代理 / 规则分流时再点 Start(或 systemctl enable --now shellcrash)。","Stopped is normal; Start only when you need the proxy (or enable shellcrash.service).")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,ex.p)(e.url),target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-3 py-1.5 text-xs font-medium text-violet-200 ring-1 ring-violet-500/25",children:tm("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"start"),className:"rounded-lg bg-emerald-500/20 px-3 py-1.5 text-xs font-medium text-emerald-200 ring-1 ring-emerald-500/30 disabled:opacity-30",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"install"),className:"rounded-lg bg-sky-500/15 px-3 py-1.5 text-xs font-medium text-sky-200 ring-1 ring-sky-500/25 disabled:opacity-30",children:"Install"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-1.5 text-xs font-medium text-amber-200 ring-1 ring-amber-500/25 disabled:opacity-30",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"upgrade"),className:"rounded-lg bg-indigo-500/15 px-3 py-1.5 text-xs font-medium text-indigo-200 ring-1 ring-indigo-500/25 disabled:opacity-30",children:"Upgrade"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-1.5 text-xs font-medium text-rose-200 ring-1 ring-rose-500/25 disabled:opacity-30",children:"Stop"}),(0,n.jsx)("button",{type:"button",disabled:!!eJ||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?tm("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||tm("当前不可操作","Unavailable"),onClick:()=>void tv(e.service_id,"uninstall"),className:"rounded-lg bg-zinc-500/15 px-3 py-1.5 text-xs font-medium text-zinc-200 ring-1 ring-zinc-500/25 disabled:opacity-30",children:"Uninstall"})]})]},e.service_id)),(null==eH?void 0:null===(em=eH.services)||void 0===em?void 0:em.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:tm("暂无服务数据","No services")})]}):null,"live_youtube"===eA?(0,n.jsx)(eQ,{t:tm,busy:eJ,entries:eX,currentProc:e6,setCurrentProc:e8,urlConfig:e9,setUrlConfig:e7,onRunProcess:(e,t)=>void ty(e,t),onSaveUrlConfig:(e,t)=>tw(e,t),fetchJson:th,liveProcesses:e0.length?e0:null!==(eL=null==eH?void 0:null===(eu=eH.live)||void 0===eu?void 0:eu.processes)&&void 0!==eL?eL:[],notify:tu,quickLinks:tf,onNavigate:e=>eD(e)}):null,"live_tiktok"===eA?(0,n.jsx)(ez,{t:tm,busy:!!eJ,entries:eX,currentProc:e6,setCurrentProc:e8,urlConfig:e9,setUrlConfig:e7,onRunProcess:e=>void ty(e),onSaveUrlConfig:e=>tw(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await tw("原画,".concat(e,",主播: ").concat(s)),await ty("start")},onCopy:tk,fetchJson:th,apiPrefix:eM,quickLinks:tf,hdmiStatus:null==eH?void 0:eH.hdmi,notify:tu,onNavigate:e=>eD(e)}):null,"android"===eA?(0,n.jsx)(ea,{t:tm,notify:tu,fetchJson:th,apiBase:eM,busy:eJ,androidSerial:ts,setAndroidSerial:tn,devices:(null==eH?void 0:null===(eh=eH.android)||void 0===eh?void 0:eh.devices)||[],adbAvailable:!!(null==eH?void 0:null===(ep=eH.android)||void 0===ep?void 0:ep.adb_available),apkPath:te,setApkPath:tt,onAndroidAction:(e,t)=>tj(e,null!=t?t:{}),onCopy:tk,onRefreshDevices:()=>void tp()}):null,"network"===eA?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===eI?"border-violet-200/90 bg-gradient-to-br from-violet-50 via-white to-fuchsia-50/80":"border-violet-500/25 bg-gradient-to-br from-violet-500/10 via-zinc-950/40 to-fuchsia-500/5"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===eI?"text-slate-900":"text-white"),children:[(0,n.jsx)(k.Z,{className:"h-4 w-4 ".concat("light"===eI?"text-violet-600":"text-violet-300")}),tm("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===eI?"text-slate-600":"text-zinc-400"),children:tm("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","Proxy rules and YAML editing are embedded here. Use Services for SRS/Neko/Chromium, etc.")}),(0,n.jsx)("div",{className:"mt-6 flex flex-col items-center gap-4 sm:flex-row sm:justify-center",children:[{tx:tm("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:tm("本机 / 安卓","Host / Android"),c:"from-emerald-400 to-teal-500"}].map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex h-16 w-28 items-center justify-center rounded-2xl bg-gradient-to-br ".concat(e.c," text-xs font-bold text-white shadow-lg"),children:e.tx}),t<2?(0,n.jsx)(h.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===eI?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===eI?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:(0,n.jsx)("div",{className:"max-h-[min(78vh,56rem)] min-h-[22rem] overflow-y-auto overflow-x-hidden",children:(0,n.jsx)(P.d,{embeddedShellCrash:!0,portalLang:eU})})})]}):null,"settings"===eA?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===eI?"text-slate-600":"text-zinc-400"),children:tm("常用选项(本机偏好);完整文件与 JSON 编辑见下方链接。","Local preferences; full file/JSON editor via the link below.")}),(0,n.jsxs)("div",{className:"space-y-4 rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-5",children:[(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:tm("总览自动刷新","Auto-refresh dashboard")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:"10s"})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:ta,onChange:e=>{let t=e.target.checked;tr(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}tu(t?tm("已开启刷新","Auto refresh on"):tm("已暂停刷新","Paused"))}})]}),(0,n.jsxs)("label",{className:"flex cursor-pointer items-center justify-between gap-4 border-t border-white/[0.06] pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white",children:tm("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:tm("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:to,onChange:e=>{let t=e.target.checked;tc(t);try{localStorage.setItem("livehub.showStreamProbes",t?"1":"0")}catch(e){}}})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/40 p-5",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500",children:tm("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==tl?void 0:tl.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[tm("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==tl?void 0:tl.system;return(null==n?void 0:null===(t=n.identity)||void 0===t?void 0:null===(e=t.hostname_alias)||void 0===e?void 0:e.trim())||((null==eH?void 0:null===(s=eH.stack)||void 0===s?void 0:s.mdns_host)||"").replace(/\.local$/i,"")||"—"})()})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:null==tl?void 0:null===(eb=tl.services)||void 0===eb?void 0:eb.slice(0,8).map(e=>(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-medium ".concat(e.enabled?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400"),children:[e.id," ",e.enabled?"ON":"off"]},e.id))})]}),(0,n.jsxs)("a",{href:"/console?tab=config",className:"inline-flex w-full items-center justify-center gap-2 rounded-xl border py-3 text-sm transition ".concat("light"===eI?"border-slate-200 bg-slate-50 text-violet-700 hover:bg-slate-100":"border-white/10 bg-white/[0.05] text-violet-200 hover:bg-white/[0.08]"),children:[tm("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(z.Z,{className:"h-4 w-4"})]})]}):null]},eA)})})]})]}),(0,n.jsx)(i.M,{children:eZ?(0,n.jsx)(l.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm lg:hidden",onClick:()=>eO(!1),children:(0,n.jsxs)(l.E.aside,{initial:{x:-280},animate:{x:0},exit:{x:-280},transition:{type:"spring",damping:28,stiffness:320},className:"absolute left-0 top-0 h-full w-[min(88vw,280px)] border-r border-white/10 bg-zinc-950 p-4 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>eO(!1),className:"rounded-lg p-2",children:(0,n.jsx)(S.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:tN.map(e=>{let t=e.icon;return(0,n.jsxs)("button",{type:"button",onClick:()=>{eD(e.id),eO(!1)},className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm text-zinc-300",children:[(0,n.jsx)(t,{className:"h-4 w-4 text-violet-400"}),tm(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}},function(e){e.O(0,[500,719,246,971,117,744],function(){return e(e.s=4578)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/lVyIIaGIEEEd2dYJHSxM8/_buildManifest.js b/d2ypp2/web-console/out/_next/static/nIVEbaa7YzQOC_jRgGVnk/_buildManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/lVyIIaGIEEEd2dYJHSxM8/_buildManifest.js rename to d2ypp2/web-console/out/_next/static/nIVEbaa7YzQOC_jRgGVnk/_buildManifest.js diff --git a/d2ypp2/web-console/out/_next/static/lVyIIaGIEEEd2dYJHSxM8/_ssgManifest.js b/d2ypp2/web-console/out/_next/static/nIVEbaa7YzQOC_jRgGVnk/_ssgManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/lVyIIaGIEEEd2dYJHSxM8/_ssgManifest.js rename to d2ypp2/web-console/out/_next/static/nIVEbaa7YzQOC_jRgGVnk/_ssgManifest.js diff --git a/d2ypp2/web-console/out/android.html b/d2ypp2/web-console/out/android.html index a1da9ea..d2a194f 100644 --- a/d2ypp2/web-console/out/android.html +++ b/d2ypp2/web-console/out/android.html @@ -1 +1 @@ -无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/android.txt b/d2ypp2/web-console/out/android.txt index 7fd4704..96e148e 100644 --- a/d2ypp2/web-console/out/android.txt +++ b/d2ypp2/web-console/out/android.txt @@ -2,6 +2,6 @@ 3:I[3946,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-fafe28420dae1d39.js","357","static/chunks/app/android/page-84550dabda18d658.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["lVyIIaGIEEEd2dYJHSxM8",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["nIVEbaa7YzQOC_jRgGVnk",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]] 1:null diff --git a/d2ypp2/web-console/out/console.html b/d2ypp2/web-console/out/console.html index 1e887da..5ff0146 100644 --- a/d2ypp2/web-console/out/console.html +++ b/d2ypp2/web-console/out/console.html @@ -1 +1 @@ -无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/console.txt b/d2ypp2/web-console/out/console.txt index 4d5363d..8f035bb 100644 --- a/d2ypp2/web-console/out/console.txt +++ b/d2ypp2/web-console/out/console.txt @@ -2,6 +2,6 @@ 3:I[6367,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-fafe28420dae1d39.js","443","static/chunks/app/console/page-75d851a154677dbc.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["lVyIIaGIEEEd2dYJHSxM8",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["nIVEbaa7YzQOC_jRgGVnk",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]] 1:null diff --git a/d2ypp2/web-console/out/index.html b/d2ypp2/web-console/out/index.html index 1164884..e15c271 100644 --- a/d2ypp2/web-console/out/index.html +++ b/d2ypp2/web-console/out/index.html @@ -1 +1 @@ -无人直播系统 · live.local

总览

live.local · 夜间 · 自动刷新

直播工作室 · 3D

CPU 1m

负载均值

内存

/ —

磁盘可用

/ —

服务在线

基础服务层

运行时间

自开机

直播进程

  • 暂无直播进程
\ No newline at end of file +无人直播系统 · live.local

总览

live.local · 夜间 · 自动刷新

直播工作室 · 3D

CPU 1m

负载均值

内存

/ —

磁盘可用

/ —

服务在线

基础服务层

运行时间

自开机

直播进程

  • 暂无直播进程
\ No newline at end of file diff --git a/d2ypp2/web-console/out/index.txt b/d2ypp2/web-console/out/index.txt index e92b158..74770a5 100644 --- a/d2ypp2/web-console/out/index.txt +++ b/d2ypp2/web-console/out/index.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[1499,["500","static/chunks/500-ea37cc8de90441f7.js","719","static/chunks/719-4dbe9dca4cff8afd.js","246","static/chunks/246-fafe28420dae1d39.js","931","static/chunks/app/page-9b99cd3d2c60f238.js"],"default",1] +3:I[1499,["500","static/chunks/500-ea37cc8de90441f7.js","719","static/chunks/719-4dbe9dca4cff8afd.js","246","static/chunks/246-fafe28420dae1d39.js","931","static/chunks/app/page-a22341e1f7071ab6.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["lVyIIaGIEEEd2dYJHSxM8",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["nIVEbaa7YzQOC_jRgGVnk",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]] 1:null diff --git a/d2ypp2/web-console/out/shellcrash.html b/d2ypp2/web-console/out/shellcrash.html index ee10aed..b5f788f 100644 --- a/d2ypp2/web-console/out/shellcrash.html +++ b/d2ypp2/web-console/out/shellcrash.html @@ -1 +1 @@ -无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file +无人直播系统 · live.local
返回门户首页无人直播 · 本页需与 API 同域(推荐 live.local:8001)

控制平面 · ARM Linux 开发板

无人直播控制中心

ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。

live.local · unknown · unknown
正在连接控制台...
\ No newline at end of file diff --git a/d2ypp2/web-console/out/shellcrash.txt b/d2ypp2/web-console/out/shellcrash.txt index 8efdc05..66405ff 100644 --- a/d2ypp2/web-console/out/shellcrash.txt +++ b/d2ypp2/web-console/out/shellcrash.txt @@ -2,6 +2,6 @@ 3:I[3398,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-fafe28420dae1d39.js","6","static/chunks/app/shellcrash/page-3d8615ae919b9119.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["lVyIIaGIEEEd2dYJHSxM8",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] +0:["nIVEbaa7YzQOC_jRgGVnk",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/91df3d4117d74443.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]] 1:null