diff --git a/d2ypp2/.gitignore b/d2ypp2/.gitignore index 751e8b5..f1f5553 100644 --- a/d2ypp2/.gitignore +++ b/d2ypp2/.gitignore @@ -83,6 +83,8 @@ config/hub_state.sqlite config/*.sqlite config/*.sqlite3 config/*.db +config/youtube.*.ini +config/URL_config.*.ini # Neko / browser runtime data services/neko/data/ diff --git a/d2ypp2/config/URL_config.youtube.ini b/d2ypp2/config/URL_config.youtube.ini deleted file mode 100644 index 1f0f900..0000000 --- a/d2ypp2/config/URL_config.youtube.ini +++ /dev/null @@ -1,2 +0,0 @@ -https://live.douyin.com/866853161480,主播: 小小咖啡老吴 -https://live.douyin.com/866853161482 diff --git a/d2ypp2/config/URL_config.youtube2__ch_mp9mm36r_2wn0r.ini b/d2ypp2/config/URL_config.youtube2__ch_mp9mm36r_2wn0r.ini deleted file mode 100644 index 6fab07e..0000000 --- a/d2ypp2/config/URL_config.youtube2__ch_mp9mm36r_2wn0r.ini +++ /dev/null @@ -1,3 +0,0 @@ -https://live.douyin.com/866853161480 -https://live.douyin.com/866853161482 -https://live.douyin.com/866853161483 \ No newline at end of file diff --git a/d2ypp2/config/URL_config.youtube2__ch_mp9n7yu2_83vci.ini b/d2ypp2/config/URL_config.youtube2__ch_mp9n7yu2_83vci.ini deleted file mode 100644 index cbacf08..0000000 --- a/d2ypp2/config/URL_config.youtube2__ch_mp9n7yu2_83vci.ini +++ /dev/null @@ -1 +0,0 @@ -https://live.douyin.com/866853111 diff --git a/d2ypp2/config/youtube.youtube.ini b/d2ypp2/config/youtube.youtube.ini deleted file mode 100644 index c0c9e1f..0000000 --- a/d2ypp2/config/youtube.youtube.ini +++ /dev/null @@ -1,133 +0,0 @@ -[youtube] -key = x04z-564w-aks7-embw-30y4 -rtmps = 是 -fast_audio = 1 - -[录制设置] -language(zh_cn/en) = zh_cn -是否跳过代理检测(是/否) = 否 -直播保存路径(不填则默认) = -保存文件夹是否以作者区分 = 是 -保存文件夹是否以时间区分 = 否 -保存文件夹是否以标题区分 = 否 -保存文件名是否包含标题 = 否 -是否去除名称中的表情符号 = 是 -视频保存格式ts|mkv|flv|mp4|mp3音频|m4a音频 = ts -原画|超清|高清|标清|流畅 = 原画 -是否使用代理ip(是/否) = 是 -代理地址 = -同一时间访问网络的线程数 = 3 -循环时间(秒) = 120 -排队读取网址时间(秒) = 0 -是否显示循环秒数 = 否 -是否显示直播源地址 = 否 -分段录制是否开启 = 否 -是否强制启用https录制 = 否 -录制空间剩余阈值(gb) = 1.0 -视频分段时间(秒) = 1800 -录制完成后自动转为mp4格式 = 否 -mp4格式重新编码为h264 = 否 -追加格式后删除原文件 = 否 -生成时间字幕文件 = 否 -是否录制完成后执行自定义脚本 = 否 -使用代理录制的平台(逗号分隔) = tiktok, soop, pandalive, winktv, flextv, popkontv, twitch, liveme, showroom, chzzk, shopee, shp, youtu, faceit -额外使用代理录制的平台(逗号分隔) = - -[推送配置] -直播状态推送渠道 = -钉钉推送接口链接 = -微信推送接口链接 = -bark推送接口链接 = -bark推送中断级别 = active -bark推送铃声 = bell -钉钉通知@对象(填手机号) = -钉钉通知@全体(是/否) = 否 -tgapi令牌 = -tg聊天id(个人或者群组id) = -smtp邮件服务器 = -是否使用smtp服务ssl加密(是/否) = 是 -smtp邮件服务器端口 = -邮箱登录账号 = -发件人密码(授权码) = -发件人邮箱 = -发件人显示昵称 = -收件人邮箱 = -ntfy推送地址 = -ntfy推送标签 = tada -ntfy推送邮箱 = -pushplus推送token = -自定义推送标题 = 直播间状态更新通知 -自定义开播推送内容 = -自定义关播推送内容 = -只推送通知不录制(是/否) = 否 -直播推送检测频率(秒) = 1800 -开播推送开启(是/否) = 是 -关播推送开启(是/否) = 否 - -[Cookie] -抖音cookie = -快手cookie = -tiktok_cookie = -虎牙cookie = -斗鱼cookie = -yy_cookie = -b站cookie = -小红书cookie = -bigo_cookie = -blued_cookie = -sooplive_cookie = -netease_cookie = -千度热播_cookie = -pandatv_cookie = -猫耳fm_cookie = -winktv_cookie = -flextv_cookie = -look_cookie = -twitcasting_cookie = -baidu_cookie = -weibo_cookie = -kugou_cookie = -twitch_cookie = -liveme_cookie = -huajiao_cookie = -liuxing_cookie = -showroom_cookie = -acfun_cookie = -changliao_cookie = -yinbo_cookie = -yingke_cookie = -zhihu_cookie = -chzzk_cookie = -haixiu_cookie = -vvxqiu_cookie = -17live_cookie = -langlive_cookie = -pplive_cookie = -6room_cookie = -lehaitv_cookie = -huamao_cookie = -shopee_cookie = -youtube_cookie = -taobao_cookie = -jd_cookie = -faceit_cookie = -migu_cookie = -lianjie_cookie = -laixiu_cookie = -picarto_cookie = - -[Authorization] -popkontv_token = - -[账号密码] -sooplive账号 = -sooplive密码 = -flextv账号 = -flextv密码 = -popkontv账号 = -partner_code = P-00001 -popkontv密码 = -twitcasting账号类型 = normal -twitcasting账号 = -twitcasting密码 = - diff --git a/d2ypp2/config/youtube.youtube2__ch_mp9mm36r_2wn0r.ini b/d2ypp2/config/youtube.youtube2__ch_mp9mm36r_2wn0r.ini deleted file mode 100644 index 50b44c8..0000000 --- a/d2ypp2/config/youtube.youtube2__ch_mp9mm36r_2wn0r.ini +++ /dev/null @@ -1,12 +0,0 @@ -[youtube] -# YouTube 推流 key(工作室 → 直播 → 串流密钥) -key = x04z-564w-aks7-embw-30y4 - -# 使用 RTMPS;填 否 则 RTMP -rtmps = 是 - -# 视频比特率 kbps(可选) -# bitrate = 4000 - -# 轻量音频链,减轻 CPU:1 / 是 -fast_audio = 1 diff --git a/d2ypp2/config/youtube.youtube2__ch_mp9mm9lz_a6jfx.ini b/d2ypp2/config/youtube.youtube2__ch_mp9mm9lz_a6jfx.ini deleted file mode 100644 index 22f96ac..0000000 --- a/d2ypp2/config/youtube.youtube2__ch_mp9mm9lz_a6jfx.ini +++ /dev/null @@ -1,12 +0,0 @@ -[youtube] -# YouTube 推流 key(工作室 → 直播 → 串流密钥) -key = 23122112 - -# 使用 RTMPS;填 否 则 RTMP -rtmps = 是 - -# 视频比特率 kbps(可选) -# bitrate = 4000 - -# 轻量音频链,减轻 CPU:1 / 是 -fast_audio = 0 diff --git a/d2ypp2/config/youtube.youtube2__ch_mp9n7yu2_83vci.ini b/d2ypp2/config/youtube.youtube2__ch_mp9n7yu2_83vci.ini deleted file mode 100644 index 76e725c..0000000 --- a/d2ypp2/config/youtube.youtube2__ch_mp9n7yu2_83vci.ini +++ /dev/null @@ -1,133 +0,0 @@ -[youtube] -key = ue78-1c3e-mr9g-14mz-9r4z -rtmps = 是 -fast_audio = 1 - -[录制设置] -language(zh_cn/en) = zh_cn -是否跳过代理检测(是/否) = 否 -直播保存路径(不填则默认) = -保存文件夹是否以作者区分 = 是 -保存文件夹是否以时间区分 = 否 -保存文件夹是否以标题区分 = 否 -保存文件名是否包含标题 = 否 -是否去除名称中的表情符号 = 是 -视频保存格式ts|mkv|flv|mp4|mp3音频|m4a音频 = ts -原画|超清|高清|标清|流畅 = 原画 -是否使用代理ip(是/否) = 是 -代理地址 = -同一时间访问网络的线程数 = 3 -循环时间(秒) = 120 -排队读取网址时间(秒) = 0 -是否显示循环秒数 = 否 -是否显示直播源地址 = 否 -分段录制是否开启 = 否 -是否强制启用https录制 = 否 -录制空间剩余阈值(gb) = 1.0 -视频分段时间(秒) = 1800 -录制完成后自动转为mp4格式 = 否 -mp4格式重新编码为h264 = 否 -追加格式后删除原文件 = 否 -生成时间字幕文件 = 否 -是否录制完成后执行自定义脚本 = 否 -使用代理录制的平台(逗号分隔) = tiktok, soop, pandalive, winktv, flextv, popkontv, twitch, liveme, showroom, chzzk, shopee, shp, youtu, faceit -额外使用代理录制的平台(逗号分隔) = - -[推送配置] -直播状态推送渠道 = -钉钉推送接口链接 = -微信推送接口链接 = -bark推送接口链接 = -bark推送中断级别 = active -bark推送铃声 = bell -钉钉通知@对象(填手机号) = -钉钉通知@全体(是/否) = 否 -tgapi令牌 = -tg聊天id(个人或者群组id) = -smtp邮件服务器 = -是否使用smtp服务ssl加密(是/否) = 是 -smtp邮件服务器端口 = -邮箱登录账号 = -发件人密码(授权码) = -发件人邮箱 = -发件人显示昵称 = -收件人邮箱 = -ntfy推送地址 = -ntfy推送标签 = tada -ntfy推送邮箱 = -pushplus推送token = -自定义推送标题 = 直播间状态更新通知 -自定义开播推送内容 = -自定义关播推送内容 = -只推送通知不录制(是/否) = 否 -直播推送检测频率(秒) = 1800 -开播推送开启(是/否) = 是 -关播推送开启(是/否) = 否 - -[Cookie] -抖音cookie = -快手cookie = -tiktok_cookie = -虎牙cookie = -斗鱼cookie = -yy_cookie = -b站cookie = -小红书cookie = -bigo_cookie = -blued_cookie = -sooplive_cookie = -netease_cookie = -千度热播_cookie = -pandatv_cookie = -猫耳fm_cookie = -winktv_cookie = -flextv_cookie = -look_cookie = -twitcasting_cookie = -baidu_cookie = -weibo_cookie = -kugou_cookie = -twitch_cookie = -liveme_cookie = -huajiao_cookie = -liuxing_cookie = -showroom_cookie = -acfun_cookie = -changliao_cookie = -yinbo_cookie = -yingke_cookie = -zhihu_cookie = -chzzk_cookie = -haixiu_cookie = -vvxqiu_cookie = -17live_cookie = -langlive_cookie = -pplive_cookie = -6room_cookie = -lehaitv_cookie = -huamao_cookie = -shopee_cookie = -youtube_cookie = -taobao_cookie = -jd_cookie = -faceit_cookie = -migu_cookie = -lianjie_cookie = -laixiu_cookie = -picarto_cookie = - -[Authorization] -popkontv_token = - -[账号密码] -sooplive账号 = -sooplive密码 = -flextv账号 = -flextv密码 = -popkontv账号 = -partner_code = P-00001 -popkontv密码 = -twitcasting账号类型 = normal -twitcasting账号 = -twitcasting密码 = - diff --git a/d2ypp2/docs/wg-easy-operations.md b/d2ypp2/docs/wg-easy-operations.md index 4c298e1..927b9b2 100644 --- a/d2ypp2/docs/wg-easy-operations.md +++ b/d2ypp2/docs/wg-easy-operations.md @@ -14,7 +14,7 @@ ## 2026-06-02 生产校验 -- wandaA:`wgeasy` 使用 `Endpoint = 129.204.21.129:51820`,`Address = 10.88.0.4/32`,`MTU = 1360`,`PersistentKeepalive = 25`;切回 `107.172.77.34:51820` 时未握手。 +- wandaA:`wgeasy` 使用 `Endpoint = 129.204.21.129:51820`,`Address = 10.88.0.4/32`,`MTU = 1360`,`PersistentKeepalive = 25`。 - wandaB:`wgeasy` 使用 `Endpoint = 129.204.21.129:51820`,`Address = 10.88.0.2/32`;到 `10.88.0.1` 的延迟约 25ms。 - Neko 访问优先级:WireGuard `10.88.0.0/24` 优先,frp 公网端口兜底,EasyTier `10.126.126.0/24` 作为备用运维链路。 @@ -80,13 +80,3 @@ NEKO_WEBRTC_UDPMUX=52301 - 页面会生成 Windows Endpoint 旁路路由模板。 导入功能只做解析和保存,不直接执行系统级 `wg-quick` 或 Windows 隧道安装命令,避免从 Web 表单执行未审计的网络配置。 - -## 旧 Endpoint 排障 - -旧 VPS Endpoint 只保留作排障记录。2026-06-02 校验时,wandaA 指向该端点无法握手,不应作为生产首选: - -```ini -Endpoint = 107.172.77.34:51820 -``` - -只有确认旧 VPS 的 wg-easy 容器、UDP `51820` 入站、防火墙和客户端出口都正常后,才临时切换到该端点。同时删除 Windows 上指向腾讯云的持久路由,或改成旧 Endpoint 对应的物理旁路路由。 diff --git a/d2ypp2/install.sh b/d2ypp2/install.sh index dd8ea86..478057f 100644 --- a/d2ypp2/install.sh +++ b/d2ypp2/install.sh @@ -293,6 +293,9 @@ sync_to_install_dir() { --exclude '.process_runner/' \ --exclude 'services/neko/data/' \ --exclude 'config/system-stack.env' \ + --exclude 'config/hub_state.sqlite' \ + --exclude 'config/youtube.*.ini' \ + --exclude 'config/URL_config.*.ini' \ "$source_dir/" "$target/" run_root chown -R live:live "$target" 2>/dev/null || true printf '%s\n' "$target" diff --git a/d2ypp2/scripts/linux/service_ctl.sh b/d2ypp2/scripts/linux/service_ctl.sh index bf9302a..5d2a78d 100644 --- a/d2ypp2/scripts/linux/service_ctl.sh +++ b/d2ypp2/scripts/linux/service_ctl.sh @@ -660,6 +660,35 @@ render_neko_compose_file() { printf '%s' "$out" } +sync_neko_host_assets() { + local dst="${NEKO_HOST_ASSET_DIR:-}" src item + [ -n "$dst" ] || return 0 + case "$dst" in + /|/home/eric/neko|/home/eric/neko-*|/home/eric/neko/*|"$ROOT_DIR"|"$ROOT_DIR"/*) + kv message "Refusing unsafe NEKO_HOST_ASSET_DIR=$dst" + exit 1 + ;; + esac + src="$ROOT_DIR/services/neko" + mkdir -p "$dst" + for item in external-extensions live-ops-extension no-managed-policies policies provisioning tampermonkey-seed; do + if [ -d "$src/$item" ]; then + mkdir -p "$dst/$item" + if have rsync; then + rsync -a --delete "$src/$item/" "$dst/$item/" + else + cp -a "$src/$item/." "$dst/$item/" + fi + fi + done + for item in browser-launch.sh chromium.conf google-chrome.conf; do + [ -f "$src/$item" ] || continue + install -m 0644 "$src/$item" "$dst/$item" + done + chmod +x "$dst/browser-launch.sh" 2>/dev/null || true + chmod -R a+rX "$dst" 2>/dev/null || true +} + remove_legacy_neko_container() { if have docker && docker ps -a --format '{{.Names}}' 2>/dev/null | grep -qx 'live-neko-chromium'; then docker stop live-neko-chromium >/dev/null 2>&1 || true @@ -945,10 +974,19 @@ system_direct_global_ready() { return 1 } +shellcrash_status_direct_probe() { + if flag_enabled "${SHELLCRASH_STATUS_PROBE_DIRECT:-0}"; then + system_direct_global_ready && printf '%s' ok || printf '%s' fail + else + printf '%s' skipped + fi +} + shellcrash_should_autostart_on_direct_fail() { flag_enabled "$SHELLCRASH_AUTOSTART_ON_DIRECT_FAIL" || return 1 + shellcrash_config_available || return 1 system_direct_global_ready && return 1 - shellcrash_config_available + return 0 } shellcrash_set_systemd_autostart_for_policy() { @@ -1248,7 +1286,7 @@ service_shellcrash_status() { kv host "${HOSTNAME_ALIAS}.local" kv port "$(shellcrash_web_port)" kv autostart "$([ "$enabled" = enabled ] && echo 1 || echo 0)" - kv detail "$detail; direct_google=$(system_direct_global_ready && echo ok || echo fail); config=$(shellcrash_config_available && echo 1 || echo 0); autostart=${enabled:-disabled}" + kv detail "$detail; direct_google=$(shellcrash_status_direct_probe); config=$(shellcrash_config_available && echo 1 || echo 0); autostart=${enabled:-disabled}" } service_shellcrash_start() { @@ -1820,6 +1858,7 @@ service_neko_start() { local instance_count instance_count="$(resolve_neko_instance_count)" export_neko_env + sync_neko_host_assets ensure_neko_browser_launcher_executable for idx in $(seq 1 "$instance_count"); do prof="$(resolve_neko_profile_dir_for_instance "$idx")" @@ -1854,6 +1893,7 @@ service_neko_reconfigure() { local idx instance_count compose_file service_names="" instance_count="$(resolve_neko_instance_count)" export_neko_env + sync_neko_host_assets for idx in $(seq 1 "$instance_count"); do service_names="${service_names} neko${idx}" done @@ -1879,6 +1919,7 @@ export_neko_env() { export NEKO_DISPLAY="${NEKO_DISPLAY:-:99.0}" export ENV_USER="${ENV_USER:-$NEKO_CONTAINER_USER}" export ENV_DISPLAY="${ENV_DISPLAY:-$NEKO_DISPLAY}" + export NEKO_HOST_ASSET_DIR="${NEKO_HOST_ASSET_DIR:-}" export NEKO_PROFILE_HOST_DIR="${NEKO_PROFILE_HOST_DIR:-$(resolve_neko_profile_dir)}" export NEKO_PROFILE_HOST_DIR_1="${NEKO_PROFILE_HOST_DIR_1:-$(resolve_neko_profile_dir_for_instance 1)}" export NEKO_PROFILE_HOST_DIR_2="${NEKO_PROFILE_HOST_DIR_2:-$(resolve_neko_profile_dir_for_instance 2)}" diff --git a/d2ypp2/src/web_process_backend.py b/d2ypp2/src/web_process_backend.py index 2ef7598..3ce59a0 100644 --- a/d2ypp2/src/web_process_backend.py +++ b/d2ypp2/src/web_process_backend.py @@ -922,7 +922,8 @@ class WebProcessBackend: if str(name).strip() } runtime = set(await self.online_process_names()) - return self._pm2_dump_registered_names() | desired | runtime + jlist = set((await self._pm2_jlist_index()).keys()) + return self._pm2_dump_registered_names() | desired | runtime | jlist async def clear_process_logs(self, process: str) -> None: await self.ensure_mode() @@ -956,24 +957,32 @@ class WebProcessBackend: if not self._use_pm2: return {name: self._local.describe_status(name) for name in names} + jlist = await self._pm2_jlist_index() runtime = await self._proc_runtime_items() known = self._pm2_dump_registered_names() | { str(name).strip() for name in self._read_pm2_desired_state().keys() if str(name).strip() - } + } | set(jlist) | set(runtime) out: dict[str, dict[str, Any]] = {} for name in names: process_info = runtime.get(name) - out_path, err_path = self._pm2_default_log_paths(name) + item_info = self._pm2_info_from_item(name, jlist.get(name)) if name in jlist else {} + default_out_path, default_err_path = self._pm2_default_log_paths(name) + out_path = item_info.get("out_path") or default_out_path + err_path = item_info.get("err_path") or default_err_path if process_info is not None: + item_status = str(item_info.get("process_status") or "").strip().lower() + status = item_status if item_status in {"online", "running", "launching"} else "online" out[name] = { - "process_status": "online", + "process_status": status, "out_path": out_path, "err_path": err_path, - "pid": int(process_info.get("pid") or 0), + "pid": int(process_info.get("pid") or item_info.get("pid") or 0), } + elif item_info: + out[name] = item_info elif name in known: out[name] = { "process_status": "stopped", diff --git a/d2ypp2/src/youtube_pro_runtime.py b/d2ypp2/src/youtube_pro_runtime.py index 86df871..f6f8daf 100644 --- a/d2ypp2/src/youtube_pro_runtime.py +++ b/d2ypp2/src/youtube_pro_runtime.py @@ -11,7 +11,7 @@ _YOUTUBE_HEADER = re.compile(r"^\s*\[youtube\]\s*$", re.IGNORECASE) _ANY_HEADER = re.compile(r"^\s*\[[^\]]+\]\s*$") _KEY_LINE = re.compile(r"^\s*(?:key|stream_key)\s*=", re.IGNORECASE) _YOUTUBE_PRO_PM2_PREFIX = "youtube2__" -_RESERVED_PM2_NAMES = frozenset({"youtube", "douyin_youtube", "tiktok", "obs", "web"}) +_RESERVED_PM2_NAMES = frozenset({"douyin_youtube", "tiktok", "obs", "web"}) _DEFAULT_YOUTUBE_TEMPLATE = "[youtube]\nkey = \nrtmps = 是\nfast_audio = 1\n" _BROKEN_LANE_NAME_RE = re.compile(r"(?:\?|\uff1f){2,}|\ufffd|锟|绾胯矾|çº|è·|Â", re.IGNORECASE) @@ -29,6 +29,8 @@ def normalize_youtube_pro_pm2_name(raw_value: str, channel_id: str) -> str: raw = sanitize_pm2_segment(raw_value) if not raw or raw in _RESERVED_PM2_NAMES or raw == _YOUTUBE_PRO_PM2_PREFIX: return default_youtube_pro_pm2_name(channel_id) + if raw == "youtube": + return raw if raw.startswith(_YOUTUBE_PRO_PM2_PREFIX): return raw return default_youtube_pro_pm2_name(raw) @@ -223,15 +225,15 @@ def ensure_youtube_pro_channel_runtime_files( pm2 = channel_pm2_name(channel) youtube_path = config_dir / managed_youtube_ini_relpath_for_pm2(pm2) url_path = config_dir / managed_url_config_relpath_for_pm2(pm2) - legacy_youtube = config_dir / "youtube.ini" - legacy_url = config_dir / "URL_config.ini" + legacy_youtube = config_dir / "youtube.ini" if pm2 == "youtube" else None + legacy_url = config_dir / "URL_config.ini" if pm2 == "youtube" else None seed_youtube = ( _read_text_if_file(youtube_path) - or _read_text_if_file(legacy_youtube) + or (legacy_youtube and _read_text_if_file(legacy_youtube)) or _DEFAULT_YOUTUBE_TEMPLATE ) - seed_url = _read_text_if_file(url_path) or _read_text_if_file(legacy_url) or "" + seed_url = _read_text_if_file(url_path) or (legacy_url and _read_text_if_file(legacy_url)) or "" effective_youtube = seed_youtube stream_key = str(channel.get("streamKey", "") or "").strip() diff --git a/d2ypp2/tests/test_web_dynamic_processes.py b/d2ypp2/tests/test_web_dynamic_processes.py index 4fb5545..62c0bc8 100644 --- a/d2ypp2/tests/test_web_dynamic_processes.py +++ b/d2ypp2/tests/test_web_dynamic_processes.py @@ -57,15 +57,14 @@ class WebDynamicProcessesTests(unittest.TestCase): self.assertEqual(resolved, "youtube.py") - def test_process_monitor_entries_migrates_legacy_youtube_pm2_without_hiding_single_lane(self) -> None: + def test_process_monitor_entries_allows_first_lane_to_bind_static_youtube(self) -> None: channels = [{"id": "lane1", "name": "Lane 1", "pm2Name": "youtube"}] with patch("web.get_youtube_pro_channels", return_value=channels): entries = web.process_monitor_entries() youtube_row = next(row for row in entries if row["pm2"] == "youtube") self.assertEqual(youtube_row["label"], "YouTube") - pro_row = next(row for row in entries if row["pm2"] == "youtube2__lane1") - self.assertEqual(pro_row["label"], "YouTube Pro · Lane 1") + self.assertFalse(any(row["pm2"] == "youtube2__lane1" for row in entries)) def test_process_monitor_entries_do_not_duplicate_static_pm2_rows(self) -> None: channels = [ @@ -76,7 +75,7 @@ class WebDynamicProcessesTests(unittest.TestCase): entries = web.process_monitor_entries() self.assertEqual(sum(1 for row in entries if row["pm2"] == "youtube"), 1) - self.assertEqual(sum(1 for row in entries if row["pm2"] == "youtube2__lane1"), 1) + self.assertEqual(sum(1 for row in entries if row["pm2"] == "youtube2__lane1"), 0) self.assertEqual(sum(1 for row in entries if row["pm2"] == "youtube2__lane2"), 1) def test_web_module_does_not_repeat_process_entry_function_defs(self) -> None: @@ -197,6 +196,55 @@ class WebDynamicProcessesTests(unittest.TestCase): self.assertEqual(_json_body(payload)["content"], "https://live.douyin.com/new\n") self.assertEqual(payload.headers.get("cache-control"), "no-store, max-age=0, must-revalidate") + def test_get_url_config_reads_saved_pro_channel_without_legacy_fallback_or_resync(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + config_dir = Path(tmp) + (config_dir / "URL_config.ini").write_text("https://live.douyin.com/legacy\n", encoding="utf-8") + channels = [ + { + "id": "lane1", + "name": "Lane 1", + "pm2Name": "youtube2__lane1", + "urlLines": "https://live.douyin.com/channel\n", + } + ] + + with patch("web.CONFIG_DIR", config_dir): + with patch("web.allows_url_config", return_value=True): + with patch("web.managed_url_config_relpath", return_value="URL_config.youtube2__lane1.ini"): + with patch("web.get_youtube_pro_channels", return_value=channels): + with patch("web._sync_youtube_pro_runtime_files", side_effect=AssertionError("unexpected resync")): + payload = asyncio.run(web.get_url_config(_ReadRequest(), process="youtube2__lane1")) + managed_exists = (config_dir / "URL_config.youtube2__lane1.ini").exists() + + self.assertEqual(_json_body(payload)["content"], "https://live.douyin.com/channel\n") + self.assertFalse(managed_exists) + + def test_get_config_reads_saved_pro_channel_key_without_legacy_fallback_or_resync(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + config_dir = Path(tmp) + (config_dir / "youtube.ini").write_text("[youtube]\nkey = legacy-key\n", encoding="utf-8") + channels = [ + { + "id": "lane1", + "name": "Lane 1", + "pm2Name": "youtube2__lane1", + "streamKey": "channel-key", + } + ] + + with patch("web.CONFIG_DIR", config_dir): + with patch("web.managed_youtube_ini_relpath", return_value="youtube.youtube2__lane1.ini"): + with patch("web.get_youtube_pro_channels", return_value=channels): + with patch("web._sync_youtube_pro_runtime_files", side_effect=AssertionError("unexpected resync")): + payload = asyncio.run(web.get_config(_ReadRequest(), process="youtube2__lane1")) + managed_exists = (config_dir / "youtube.youtube2__lane1.ini").exists() + + content = _json_body(payload)["content"] + self.assertIn("key = channel-key", content) + self.assertNotIn("legacy-key", content) + self.assertFalse(managed_exists) + def test_save_url_config_updates_matching_youtube_pro_channel_store(self) -> None: captured: list[list[dict[str, object]]] = [] channels = [{"id": "lane1", "name": "Lane 1", "pm2Name": "youtube2__lane1", "urlLines": "old\n"}] @@ -255,7 +303,7 @@ class WebDynamicProcessesTests(unittest.TestCase): self.assertEqual(_json_body(payload)["message"], "配置保存成功") self.assertEqual(captured[-1][0]["streamKey"], "new-key-123") - def test_single_youtube_save_does_not_mutate_legacy_pro_channel_named_youtube(self) -> None: + def test_single_youtube_save_updates_pro_lane_bound_to_youtube(self) -> None: captured: list[list[dict[str, object]]] = [] channels = [{"id": "lane1", "name": "Lane 1", "pm2Name": "youtube", "urlLines": "old\n"}] @@ -272,7 +320,7 @@ class WebDynamicProcessesTests(unittest.TestCase): ) self.assertEqual(_json_body(payload)["message"], "配置保存成功") - self.assertEqual(captured, []) + self.assertEqual(captured[-1][0]["urlLines"], "https://live.douyin.com/single\n") if __name__ == "__main__": diff --git a/d2ypp2/tests/test_web_process_backend.py b/d2ypp2/tests/test_web_process_backend.py index def3676..b18c2c8 100644 --- a/d2ypp2/tests/test_web_process_backend.py +++ b/d2ypp2/tests/test_web_process_backend.py @@ -141,6 +141,31 @@ class WebProcessBackendTests(unittest.TestCase): self.assertEqual(info["err_path"], "/home/live/.pm2/logs/youtube-error.log") self.assertEqual(info["pid"], 4567) + def test_process_infos_prefers_jlist_log_paths_when_runtime_pid_exists(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + base_dir = Path(tmp) + backend = WebProcessBackend(base_dir, base_dir / ".pm2" / "logs") + backend._use_pm2 = True + item = { + "name": "youtube2__lane1", + "pid": 123, + "pm2_env": { + "status": "online", + "pm_out_log_path": "/etc/.pm2/logs/youtube2--lane1-out.log", + "pm_err_log_path": "/etc/.pm2/logs/youtube2--lane1-error.log", + }, + } + + with patch.object(backend, "ensure_mode", AsyncMock()): + with patch.object(backend, "_pm2_jlist_index", AsyncMock(return_value={"youtube2__lane1": item})): + with patch.object(backend, "_proc_runtime_items", AsyncMock(return_value={"youtube2__lane1": {"pid": 123}})): + info = asyncio.run(backend.process_infos(["youtube2__lane1"]))["youtube2__lane1"] + + self.assertEqual(info["process_status"], "online") + self.assertEqual(info["pid"], 123) + self.assertEqual(info["out_path"], "/etc/.pm2/logs/youtube2--lane1-out.log") + self.assertEqual(info["err_path"], "/etc/.pm2/logs/youtube2--lane1-error.log") + def test_pm2_jlist_items_uses_short_ttl_cache(self) -> None: with tempfile.TemporaryDirectory() as tmp: base_dir = Path(tmp) diff --git a/d2ypp2/tests/test_wireguard_config.py b/d2ypp2/tests/test_wireguard_config.py index e0c1b93..14d58d5 100644 --- a/d2ypp2/tests/test_wireguard_config.py +++ b/d2ypp2/tests/test_wireguard_config.py @@ -187,7 +187,7 @@ class WireGuardConfigTests(unittest.TestCase): "stdout": "\n".join( [ "wg0\tpriv\tpub\t51820\toff", - f"wg0\tpeer\tpsk\t107.172.77.34:51820\t10.88.0.0/24\t{now - 30}\t4096\t8192\t25", + f"wg0\tpeer\tpsk\t129.204.21.129:51820\t10.88.0.0/24\t{now - 30}\t4096\t8192\t25", ] ), "stderr": "", diff --git a/d2ypp2/tests/test_youtube_pro_runtime.py b/d2ypp2/tests/test_youtube_pro_runtime.py index 2db38d2..61c3e5c 100644 --- a/d2ypp2/tests/test_youtube_pro_runtime.py +++ b/d2ypp2/tests/test_youtube_pro_runtime.py @@ -18,7 +18,7 @@ class YoutubeProRuntimeTests(unittest.TestCase): rows = normalize_youtube_pro_channels([{"id": "lane2", "name": "Lane 2"}]) self.assertEqual(rows[0]["pm2Name"], "youtube2__lane2") rows = normalize_youtube_pro_channels([{"id": "lane1", "pm2Name": "youtube"}]) - self.assertEqual(rows[0]["pm2Name"], "youtube2__lane1") + self.assertEqual(rows[0]["pm2Name"], "youtube") rows = normalize_youtube_pro_channels([{"id": "lane3", "pm2Name": "custom"}]) self.assertEqual(rows[0]["pm2Name"], "youtube2__custom") @@ -71,11 +71,17 @@ class YoutubeProRuntimeTests(unittest.TestCase): self.assertIn("key = abcd-efgh-ijkl-mnop", youtube_ini) self.assertIn("https://live.douyin.com/123456789", url_ini) - def test_materialize_runtime_files_uses_existing_seed_when_channel_fields_blank(self) -> None: + def test_materialize_runtime_files_uses_existing_managed_seed_when_channel_fields_blank(self) -> None: with tempfile.TemporaryDirectory() as tmp: config_dir = Path(tmp) - (config_dir / "youtube.ini").write_text("[youtube]\nkey = legacy-key\nrtmps = 是\n", encoding="utf-8") - (config_dir / "URL_config.ini").write_text("https://live.douyin.com/88888888\n", encoding="utf-8") + (config_dir / managed_youtube_ini_relpath_for_pm2("youtube2__lane3")).write_text( + "[youtube]\nkey = managed-key\nrtmps = 是\n", + encoding="utf-8", + ) + (config_dir / managed_url_config_relpath_for_pm2("youtube2__lane3")).write_text( + "https://live.douyin.com/88888888\n", + encoding="utf-8", + ) handled, errors = ensure_youtube_pro_channel_runtime_files( config_dir, @@ -91,6 +97,42 @@ class YoutubeProRuntimeTests(unittest.TestCase): url_ini = (config_dir / managed_url_config_relpath_for_pm2("youtube2__lane3")).read_text( encoding="utf-8" ) + self.assertIn("managed-key", youtube_ini) + self.assertIn("https://live.douyin.com/88888888", url_ini) + + def test_materialize_runtime_files_ignores_legacy_seed_for_non_single_pro_lane(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + config_dir = Path(tmp) + (config_dir / "youtube.ini").write_text("[youtube]\nkey = legacy-key\nrtmps = 是\n", encoding="utf-8") + (config_dir / "URL_config.ini").write_text("https://live.douyin.com/88888888\n", encoding="utf-8") + + handled, errors = ensure_youtube_pro_channel_runtime_files( + config_dir, + "youtube2__lane3", + [{"id": "lane3", "pm2Name": "youtube2__lane3"}], + ) + + self.assertTrue(handled) + self.assertEqual(errors, ["youtube2__lane3: stream key missing", "youtube2__lane3: source URL missing"]) + self.assertFalse((config_dir / managed_youtube_ini_relpath_for_pm2("youtube2__lane3")).exists()) + self.assertFalse((config_dir / managed_url_config_relpath_for_pm2("youtube2__lane3")).exists()) + + def test_materialize_runtime_files_allows_youtube_lane_to_use_single_legacy_seed(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + config_dir = Path(tmp) + (config_dir / "youtube.ini").write_text("[youtube]\nkey = legacy-key\nrtmps = 是\n", encoding="utf-8") + (config_dir / "URL_config.ini").write_text("https://live.douyin.com/88888888\n", encoding="utf-8") + + handled, errors = ensure_youtube_pro_channel_runtime_files( + config_dir, + "youtube", + [{"id": "lane1", "pm2Name": "youtube"}], + ) + + self.assertTrue(handled) + self.assertEqual(errors, []) + youtube_ini = (config_dir / managed_youtube_ini_relpath_for_pm2("youtube")).read_text(encoding="utf-8") + url_ini = (config_dir / managed_url_config_relpath_for_pm2("youtube")).read_text(encoding="utf-8") self.assertIn("legacy-key", youtube_ini) self.assertIn("https://live.douyin.com/88888888", url_ini) diff --git a/d2ypp2/tools/deploy_live_paramiko.py b/d2ypp2/tools/deploy_live_paramiko.py index efc0789..e3f176f 100644 --- a/d2ypp2/tools/deploy_live_paramiko.py +++ b/d2ypp2/tools/deploy_live_paramiko.py @@ -164,6 +164,16 @@ FILES = sorted(set(FILES + _discover_repo_files())) LOG_DIR = REPO_ROOT / ".deploy_logs" TAIL_LINES = 90 +OBSOLETE_SOURCE_RUNTIME_FILES = [ + "config/URL_config.youtube.ini", + "config/URL_config.youtube2__ch_mp9mm36r_2wn0r.ini", + "config/URL_config.youtube2__ch_mp9n7yu2_83vci.ini", + "config/youtube.youtube.ini", + "config/youtube.youtube2__ch_mp9mm36r_2wn0r.ini", + "config/youtube.youtube2__ch_mp9mm9lz_a6jfx.ini", + "config/youtube.youtube2__ch_mp9n7yu2_83vci.ini", +] + def _safe_print(text: str) -> None: try: @@ -462,6 +472,16 @@ def main() -> int: f"rm -rf {REMOTE_BASE}/src/__pycache__ {REMOTE_BASE}/backup/__pycache__ 2>/dev/null; echo cache_cleared", timeout=20, ) + obsolete_files = " ".join( + f"{REMOTE_BASE}/{rel}" for rel in OBSOLETE_SOURCE_RUNTIME_FILES + ) + run_logged( + client, + log_path, + "remove_obsolete_source_runtime_configs", + f"rm -f {obsolete_files}; echo obsolete_runtime_configs_removed", + timeout=20, + ) run_logged( client, log_path, diff --git a/d2ypp2/tools/render_neko_compose.py b/d2ypp2/tools/render_neko_compose.py index eb06eba..d1afe71 100644 --- a/d2ypp2/tools/render_neko_compose.py +++ b/d2ypp2/tools/render_neko_compose.py @@ -28,6 +28,13 @@ def instance_value(prefix: str, idx: int, default: str) -> str: return env(f"{prefix}_{idx}", default) +def host_path(base: str, name: str) -> str: + base = base.strip() + if base in {"", ".", "./"}: + return f"./{name}" + return f"{base.rstrip('/')}/{name}" + + def default_udp_range(idx: int) -> str: if idx == 1: return "52000-52099" @@ -65,12 +72,22 @@ def render(count: int) -> str: supervisor_conf = env("NEKO_BROWSER_SUPERVISOR_CONF", "chromium.conf") tampermonkey_repair = env("NEKO_TAMPERMONKEY_REPAIR", "1") live_ops_extension = env("NEKO_LIVE_OPS_EXTENSION", "1") + host_asset_dir = env("NEKO_HOST_ASSET_DIR", ".") base_profile = env("NEKO_PROFILE_HOST_DIR", str(Path.cwd() / "data" / "chromium-profile-v2")) http_base = int(env("NEKO_HTTP_PORT", "9200")) mux_base = int(env("NEKO_WEBRTC_TCPMUX", "52300")) managed_policies = env_enabled("NEKO_MANAGED_POLICIES", True) external_extensions = env_enabled("NEKO_EXTERNAL_EXTENSIONS", False) - policy_dir = "./policies" if managed_policies else "./no-managed-policies" + policy_dir = env( + "NEKO_POLICY_DIR", + host_path(host_asset_dir, "policies" if managed_policies else "no-managed-policies"), + ) + tampermonkey_seed_dir = host_path(host_asset_dir, "tampermonkey-seed") + live_ops_extension_dir = host_path(host_asset_dir, "live-ops-extension") + provisioning_dir = host_path(host_asset_dir, "provisioning") + browser_launch = host_path(host_asset_dir, "browser-launch.sh") + supervisor_conf_host = host_path(host_asset_dir, supervisor_conf) + external_extensions_dir = host_path(host_asset_dir, "external-extensions") lines = [ "# Generated by tools/render_neko_compose.py - do not hand-edit", @@ -135,18 +152,18 @@ def render(count: int) -> str: f" - {q(f'{policy_dir}:/etc/chromium/policies/managed:ro')}", f" - {q(f'{policy_dir}:/etc/chromium-browser/policies/managed:ro')}", f" - {q(f'{policy_dir}:/etc/opt/chrome/policies/managed:ro')}", - ' - "./tampermonkey-seed:/etc/neko/tampermonkey-seed:ro"', - ' - "./live-ops-extension:/etc/neko/live-ops-extension:ro"', - ' - "./provisioning:/var/www/provisioning:ro"', - ' - "./browser-launch.sh:/etc/neko/browser-launch.sh:ro"', - f" - {q(f'./{supervisor_conf}:/etc/neko/supervisord/{supervisor_conf}:ro')}", + f" - {q(f'{tampermonkey_seed_dir}:/etc/neko/tampermonkey-seed:ro')}", + f" - {q(f'{live_ops_extension_dir}:/etc/neko/live-ops-extension:ro')}", + f" - {q(f'{provisioning_dir}:/var/www/provisioning:ro')}", + f" - {q(f'{browser_launch}:/etc/neko/browser-launch.sh:ro')}", + f" - {q(f'{supervisor_conf_host}:/etc/neko/supervisord/{supervisor_conf}:ro')}", ] ) if external_extensions: lines[-3:-3] = [ - ' - "./external-extensions:/opt/google/chrome/extensions:ro"', - ' - "./external-extensions:/usr/share/chromium/extensions:ro"', - ' - "./external-extensions:/usr/share/chromium-browser/extensions:ro"', + f" - {q(f'{external_extensions_dir}:/opt/google/chrome/extensions:ro')}", + f" - {q(f'{external_extensions_dir}:/usr/share/chromium/extensions:ro')}", + f" - {q(f'{external_extensions_dir}:/usr/share/chromium-browser/extensions:ro')}", ] return "\n".join(lines) + "\n" diff --git a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx index 05e20e3..bc90f71 100644 --- a/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx +++ b/d2ypp2/web-console/components/live-product/LiveYoutubeUnmannedView.tsx @@ -157,7 +157,7 @@ function resolveChannelPm2(channel: YoutubeProChannel): string { } const MODE_KEY = "live-hub-youtube-mode-v1"; -const PRO_PM2_RESERVED = new Set(["youtube", "douyin_youtube", "tiktok", "obs", "web"]); +const PRO_PM2_RESERVED = new Set(["douyin_youtube", "tiktok", "obs", "web"]); /** UI 暂时隐藏「多频道 Pro」切换(DOM 与逻辑保留,改 false 即可恢复) */ const HIDE_YOUTUBE_MULTI_PRO_TOGGLE = false; @@ -358,15 +358,6 @@ function businessStatusBadgeClass(row: LiveProcRow | undefined): string { return "bg-zinc-600/20 text-zinc-400 ring-zinc-500/25"; } -function hasVisibleRuntime(row: LiveProcRow | undefined): boolean { - const business = (row?.business_status || "").trim().toLowerCase(); - return !!( - row?.is_pushing || - pm2StatusOnline(row?.process_status) || - ["streaming", "source_live", "waiting_source", "youtube_key_rejected", "error"].includes(business) - ); -} - function fmtEventDuration(seconds?: number | null): string { const sec = Math.max(0, Math.floor(seconds || 0)); if (sec < 60) return `${sec}s`; @@ -670,7 +661,6 @@ export function LiveYoutubeUnmannedView({ const proUrlDraftRef = useRef(proUrlDraft); const channelsRef = useRef([]); const currentProcRef = useRef(currentProc); - const singleProcessPm2SetRef = useRef>(new Set()); const urlRequestSeqRef = useRef(0); const ytIniRequestSeqRef = useRef(0); @@ -710,10 +700,6 @@ export function LiveYoutubeUnmannedView({ channelsRef.current = channels; }, [channels]); - useEffect(() => { - singleProcessPm2SetRef.current = new Set(singleProcessOptions.map((entry) => entry.pm2)); - }, [singleProcessOptions]); - useEffect(() => { urlRequestSeqRef.current += 1; ytIniRequestSeqRef.current += 1; @@ -721,31 +707,12 @@ export function LiveYoutubeUnmannedView({ setUrlFetchNote(null); }, [mode, activeCh]); - const updateActiveChannelUrlLines = useCallback((channelId: string, nextUrlLines: string) => { - if (!channelId) return; - setChannels((prev) => { - let changed = false; - const next = prev.map((row) => { - if (row.id !== channelId) return row; - if ((row.urlLines ?? "") === nextUrlLines) return row; - changed = true; - return { ...row, urlLines: nextUrlLines }; - }); - if (!changed) return prev; - channelsRef.current = next; - saveYoutubeProChannels(next); - return next; - }); - }, []); - const pullUrlConfigFromServer = useCallback(async () => { const targetProc = currentProcRef.current.trim(); if (!targetProc) return; if (mode === "pro") { const activePm2 = channelsRef.current.find((row) => row.id === activeCh); if (!activePm2 || resolveChannelPm2(activePm2) !== targetProc) return; - } else if (singleProcessPm2SetRef.current.size && !singleProcessPm2SetRef.current.has(targetProc)) { - return; } const requestId = ++urlRequestSeqRef.current; try { @@ -765,12 +732,11 @@ export function LiveYoutubeUnmannedView({ return; } applyProUrlDraft(c); - updateActiveChannelUrlLines(activeCh, c); } } catch { /* ignore */ } - }, [activeCh, applyProUrlDraft, applySingleUrlDraft, fetchJson, mode, updateActiveChannelUrlLines]); + }, [activeCh, applyProUrlDraft, applySingleUrlDraft, fetchJson, mode]); useEffect(() => { if (!currentProc || !urlAutoRefresh) return; @@ -787,8 +753,6 @@ export function LiveYoutubeUnmannedView({ if (mode === "pro") { const activePm2 = channelsRef.current.find((row) => row.id === activeCh); if (!activePm2 || resolveChannelPm2(activePm2) !== targetProc) return; - } else if (singleProcessPm2SetRef.current.size && !singleProcessPm2SetRef.current.has(targetProc)) { - return; } setUrlReloading(true); setUrlFetchNote(null); @@ -815,7 +779,6 @@ export function LiveYoutubeUnmannedView({ return; } applyProUrlDraft(c); - updateActiveChannelUrlLines(activeCh, c); } setUrlFetchNote(t("已从服务器读取 URL_config", "Reloaded URL_config from server")); } catch (e) { @@ -870,7 +833,7 @@ export function LiveYoutubeUnmannedView({ name: "线路 1", streamKey: "", urlLines: "", - pm2Name: defaultPm2NameForChannel(id), + pm2Name: "youtube", notes: "", }, ]; @@ -903,29 +866,16 @@ export function LiveYoutubeUnmannedView({ [rowForPm2], ); const currentProcRow = rowForPm2(currentProc); - const activeProRuntimeProc = active ? resolveChannelPm2(active) : ""; - const activeProRuntimeRow = activeProRuntimeProc ? rowForPm2(activeProRuntimeProc) : undefined; - const singleRuntimeProc = - mode === "single" && - activeProRuntimeProc && - activeProRuntimeProc !== currentProc && - hasVisibleRuntime(activeProRuntimeRow) - ? activeProRuntimeProc - : currentProc; - const runtimeLogProc = mode === "single" ? singleRuntimeProc : currentProc; + const singleRuntimeProc = currentProc; + const runtimeLogProc = currentProc; const runtimeLogRow = rowForPm2(runtimeLogProc); - const currentProcInSingleOptions = useMemo( - () => !!currentProc && singleProcessOptions.some((entry) => entry.pm2 === currentProc), - [currentProc, singleProcessOptions], - ); - useEffect(() => { if (mode !== "single" || !preferredSingleProc) return; - if (!currentProc || !currentProcInSingleOptions) { + if (!currentProc) { currentProcRef.current = preferredSingleProc; setCurrentProc(preferredSingleProc); } - }, [currentProc, currentProcInSingleOptions, mode, preferredSingleProc, setCurrentProc]); + }, [currentProc, mode, preferredSingleProc, setCurrentProc]); const applyChannelsLocal = useCallback((next: YoutubeProChannel[]) => { const cleaned = cleanYoutubeProChannelNames(next); @@ -934,6 +884,21 @@ export function LiveYoutubeUnmannedView({ saveYoutubeProChannels(cleaned); }, []); + const patchChannelLocalForPm2 = useCallback( + (pm2: string, patch: Partial) => { + const target = pm2.trim(); + if (!target) return; + let changed = false; + const next = channelsRef.current.map((row) => { + if (resolveChannelPm2(row) !== target) return row; + changed = true; + return { ...row, ...patch }; + }); + if (changed) applyChannelsLocal(next); + }, + [applyChannelsLocal], + ); + const syncChannelsRemote = useCallback( async (next: YoutubeProChannel[], options: YoutubeProChannelsSyncOptions = {}) => { await pushYoutubeProChannelsRemote(fetchJson, next, options); @@ -966,6 +931,25 @@ export function LiveYoutubeUnmannedView({ }); }, [active]); + useEffect(() => { + if (!active || resolveChannelPm2(active) !== "youtube") return; + const key = ytFields.key.trim(); + if (!key) return; + setLaneDrafts((prev) => { + const draft = prev[active.id] ?? laneDraftFromChannel(active); + if (draft.streamKey.trim() === key && draft.pm2Name === "youtube") return prev; + if (draft.streamKey.trim()) return prev; + return { + ...prev, + [active.id]: { + ...draft, + streamKey: key, + pm2Name: "youtube", + }, + }; + }); + }, [active, ytFields.key]); + useEffect(() => { setLaneStatus(null); }, [activeCh]); @@ -1126,166 +1110,33 @@ export function LiveYoutubeUnmannedView({ } }, [activeCh, applyProUrlDraft, fetchJson, setCurrentProc]); - const syncActiveProToSingleProcess = useCallback( - async (targetPm2: string) => { - const target = targetPm2.trim(); - if (!target || !active) return; - const streamKey = (activeLaneDraft?.streamKey ?? active.streamKey ?? "").trim(); - const urlText = proUrlDraftRef.current || active.urlLines || ""; - const base = parseYoutubeIniFields(youtubeIniText || buildYoutubeIniFromFields(ytFields)); - const nextFields: YoutubeIniFields = { - key: streamKey, - rtmps: base.rtmps, - bitrate: base.bitrate, - fastAudio: base.fastAudio, - }; - const nextIni = buildYoutubeIniFromFields(nextFields); - urlRequestSeqRef.current += 1; - ytIniRequestSeqRef.current += 1; - urlListDirtyRef.current = false; - applySingleUrlDraft(urlText); - setYoutubeIniText(nextIni); - setYtFields(nextFields); - setUrlFetchNote(t("已同步当前 Pro 线路到单频道", "Synced current Pro lane to single-channel")); - setYtIniStatus(t("已同步当前 Pro 线路到 single youtube.ini", "Synced current Pro lane to single youtube.ini")); - setUrlReloading(true); - setYtIniLoading(true); - try { - const params = new URLSearchParams({ process: target }); - await fetchJson(`/save_config?${params}`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ content: nextIni }), - }); - await fetchJson(`/save_url_config?${params}`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ content: urlText }), - }); - if (target === currentProcRef.current.trim()) { - setActiveViewRefreshToken((prev) => prev + 1); - } - } catch (e) { - const message = e instanceof Error ? e.message : String(e); - setUrlFetchNote(message); - setYtIniStatus(message); - notify(message); - } finally { - setUrlReloading(false); - setYtIniLoading(false); - } - }, - [active, activeLaneDraft, applySingleUrlDraft, fetchJson, notify, t, youtubeIniText, ytFields], - ); - const syncSingleToActiveProProcess = useCallback( - async () => { - const targetChannel = (activeCh ? channels.find((row) => row.id === activeCh) : null) ?? channels[0]; - if (!targetChannel) return; - const pm2 = resolveChannelPm2(targetChannel); - const urlText = singleUrlDraftRef.current; - const nextFields: YoutubeIniFields = { - key: ytFields.key.trim(), - rtmps: ytFields.rtmps, - bitrate: ytFields.bitrate, - fastAudio: ytFields.fastAudio, - }; - const nextIni = buildYoutubeIniFromFields(nextFields); - const nextChannels = cleanYoutubeProChannelNames(channels.map((row) => - row.id === targetChannel.id - ? { - ...row, - streamKey: nextFields.key, - urlLines: urlText, - pm2Name: pm2, - } - : row, - )); - channelsRef.current = nextChannels; - setChannels(nextChannels); - saveYoutubeProChannels(nextChannels); - setLaneDrafts((prev) => ({ - ...prev, - [targetChannel.id]: { - ...(prev[targetChannel.id] ?? laneDraftFromChannel(targetChannel)), - streamKey: nextFields.key, - pm2Name: pm2, - }, - })); - setActiveCh(targetChannel.id); - applyProUrlDraft(urlText); - currentProcRef.current = pm2; - setCurrentProc(pm2); - setUrlFetchNote(t("已同步单频道到当前 Pro 线路", "Synced single-channel to current Pro lane")); - setYtIniStatus(t("已同步单频道到 Pro youtube.ini", "Synced single-channel to Pro youtube.ini")); - setUrlReloading(true); - setYtIniLoading(true); - try { - await syncChannelsRemote(nextChannels, { force: true }); - const params = new URLSearchParams({ process: pm2 }); - await fetchJson(`/save_config?${params}`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ content: nextIni }), - }); - await fetchJson(`/save_url_config?${params}`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ content: urlText }), - }); - if (pm2 === currentProcRef.current.trim()) { - setActiveViewRefreshToken((prev) => prev + 1); - } - } catch (e) { - const message = e instanceof Error ? e.message : String(e); - setUrlFetchNote(message); - setYtIniStatus(message); - notify(message); - } finally { - setUrlReloading(false); - setYtIniLoading(false); - } - }, - [ - activeCh, - applyProUrlDraft, - channels, - fetchJson, - notify, - setCurrentProc, - syncChannelsRemote, - t, - ytFields, - ], - ); + void refreshSingleProcessFromServer; + void refreshProChannelsFromServer; const setModePersist = useCallback( (m: "single" | "pro") => { + if (m === "pro" && mode === "single" && !ytFields.key.trim()) { + notify(t("请先填写并保存 YouTube 推流 key,再切换到多频道 Pro", "Fill and save the YouTube stream key before switching to Multi Pro")); + return; + } if (m === "single") { - const target = preferredSingleProc || singleProcessOptions[0]?.pm2 || ""; + const target = currentProcRef.current.trim() || preferredSingleProc || singleProcessOptions[0]?.pm2 || ""; if (target) { currentProcRef.current = target; setCurrentProc(target); - if (mode === "pro" && active) { - void syncActiveProToSingleProcess(target); - } else { - void refreshSingleProcessFromServer(target); - } } } if (m === "pro" && channels.length) { - const ch = channels.find((c) => c.id === activeCh) ?? channels[0]; + const current = currentProcRef.current.trim(); + const ch = channels.find((c) => resolveChannelPm2(c) === current) ?? channels.find((c) => c.id === activeCh) ?? channels[0]; applyProUrlDraft((ch?.urlLines ?? "").trim()); if (ch) { + setActiveCh(ch.id); const pm2 = resolveChannelPm2(ch); currentProcRef.current = pm2; setCurrentProc(pm2); } - if (mode === "single") { - void syncSingleToActiveProProcess(); - } else { - void refreshProChannelsFromServer(); - } } setMode(m); try { @@ -1298,24 +1149,18 @@ export function LiveYoutubeUnmannedView({ channels, applyProUrlDraft, activeCh, - active, mode, + notify, preferredSingleProc, - refreshProChannelsFromServer, - refreshSingleProcessFromServer, setCurrentProc, singleProcessOptions, - syncActiveProToSingleProcess, - syncSingleToActiveProProcess, + t, + ytFields.key, ], ); const selectProChannel = useCallback( (c: YoutubeProChannel) => { - const latestProUrlDraft = proUrlDraftRef.current; - if (active && mode === "pro" && latestProUrlDraft !== (active.urlLines ?? "").trim()) { - persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: latestProUrlDraft } : x))); - } const u = (c.urlLines ?? "").trim(); applyProUrlDraft(u); setActiveCh(c.id); @@ -1323,7 +1168,7 @@ export function LiveYoutubeUnmannedView({ currentProcRef.current = pm2; setCurrentProc(pm2); }, - [active, applyProUrlDraft, mode, channels, setCurrentProc, persistChannels], + [applyProUrlDraft, setCurrentProc], ); useEffect(() => { @@ -1365,8 +1210,6 @@ export function LiveYoutubeUnmannedView({ if (!currentProc) return; if (mode === "pro") { if (!active || currentProc !== resolveChannelPm2(active)) return; - } else if (singleProcessPm2SetRef.current.size && !singleProcessPm2SetRef.current.has(currentProc)) { - return; } void pullUrlConfigFromServer(); void loadYoutubeIni(); @@ -1464,6 +1307,7 @@ export function LiveYoutubeUnmannedView({ body: JSON.stringify({ content }), }); setYoutubeIniText(content); + patchChannelLocalForPm2(targetPm2, { streamKey: parseYoutubeIniFields(content).key }); setYtIniStatus(t("youtube.ini 已保存", "youtube.ini saved")); } catch (e) { setYtIniStatus((e as Error).message); @@ -1510,16 +1354,12 @@ export function LiveYoutubeUnmannedView({ const keySuffixUi = useMemo(() => { if (mode === "single") { - if (runtimeLogProc && runtimeLogProc !== currentProc && runtimeLogProc === activeProRuntimeProc) { - return parseYoutubeStreamKeySuffix(`key = ${active?.streamKey ?? ""}`); - } return parseYoutubeStreamKeySuffix(`key = ${ytFields.key}`); } const k = activeLaneDraft?.streamKey ?? active?.streamKey ?? ""; return parseYoutubeStreamKeySuffix(`key = ${k}`); - }, [mode, runtimeLogProc, currentProc, activeProRuntimeProc, active?.streamKey, ytFields.key, activeLaneDraft?.streamKey]); + }, [mode, active?.streamKey, ytFields.key, activeLaneDraft?.streamKey]); const keySuffixDisplay = keySuffixUi ? `…${keySuffixUi}` : "—"; - const singleObservedDifferentProc = mode === "single" && !!runtimeLogProc && !!currentProc && runtimeLogProc !== currentProc; const saveProUrlAndServer = async () => { if (!active) return; @@ -1551,6 +1391,7 @@ export function LiveYoutubeUnmannedView({ try { urlRequestSeqRef.current += 1; await Promise.resolve(onSaveUrlConfig(singleUrlDraftRef.current, targetPm2)); + patchChannelLocalForPm2(targetPm2, { urlLines: singleUrlDraftRef.current }); urlListDirtyRef.current = false; } catch { /* parent 已 toast */ @@ -1783,11 +1624,7 @@ export function LiveYoutubeUnmannedView({ const singleRow = mode === "single" ? runtimeLogRow : currentProcRow; const singleOnline = pm2StatusOnline(statusForPm2(singleRuntimeProc)); - const singleSourceUrlText = - mode === "single" && runtimeLogProc === activeProRuntimeProc && runtimeLogProc !== currentProc - ? active?.urlLines ?? proUrlDraft - : singleUrlDraft; - const singleSourceDisplay = douyinSourceDisplayFor(singleRow, singleSourceUrlText); + const singleSourceDisplay = douyinSourceDisplayFor(singleRow, singleUrlDraft); const activeSourceDisplay = active ? douyinSourceDisplayFor(rowForPm2(resolveChannelPm2(active)), proUrlDraft || active.urlLines || "") : ""; @@ -2698,11 +2535,6 @@ export function LiveYoutubeUnmannedView({

{singleSourceDisplay || t("未配置抖音直播源", "No Douyin source configured")}

- {singleObservedDifferentProc ? ( -

- {t("当前推流", "Streaming")}: {runtimeLogProc} · {t("当前编辑", "Editing")}: {currentProc} -

- ) : null}

key {t("尾码", "suffix")}: {keySuffixDisplay}

@@ -2726,16 +2558,18 @@ export function LiveYoutubeUnmannedView({ const pm = resolveChannelPm2(c); const row = rowForPm2(pm); const st = statusForPm2(pm); - const laneUrls = nonCommentUrlLinesOf((c.urlLines ?? "").trim()); - const douyinUrls = extractDouyinLiveUrls((c.urlLines ?? "").trim()); - const dUrl = douyinUrls[0]; - const suf = parseYoutubeStreamKeySuffix(`key = ${c.streamKey ?? ""}`); const sel = activeCh === c.id; + const laneUrlText = sel ? proUrlDraft : (c.urlLines ?? "").trim(); + const laneKeyText = sel ? activeLaneDraft?.streamKey ?? c.streamKey ?? "" : c.streamKey ?? ""; + const laneUrls = nonCommentUrlLinesOf(laneUrlText); + const douyinUrls = extractDouyinLiveUrls(laneUrlText); + const dUrl = douyinUrls[0]; + const suf = parseYoutubeStreamKeySuffix(`key = ${laneKeyText}`); const rowOnline = pm2StatusOnline(st); const laneIndex = channels.findIndex((row) => row.id === c.id); const laneNeko = resolveNekoBrowserLink(nekoLinks, laneIndex).link; const laneName = cleanLaneName(c.name, laneIndex >= 0 ? laneIndex : 0); - const laneDisplay = douyinSourceDisplayFor(row, c.urlLines ?? ""); + const laneDisplay = douyinSourceDisplayFor(row, laneUrlText); return (
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/644-b670e35fa0cddabc.js b/d2ypp2/web-console/out/_next/static/chunks/644-b670e35fa0cddabc.js new file mode 100644 index 0000000..1cb2108 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/chunks/644-b670e35fa0cddabc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[644],{7644:function(e,t,s){s.d(t,{Z:function(){return tI}});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(4938),m=s(3420),u=s(8728),h=s(2023),p=s(407),b=s(6840),g=s(7226),v=s(5929),f=s(7945),y=s(1817),w=s(7168),j=s(4822),N=s(4428),k=s(1723),_=s(2926),z=s(3581),S=s(4766),C=s(7580),R=s(9688),P=s(4743),T=s(8930),L=s(3651),M=s(4286),E=s(7265),U=s(8867),I=s(8406),Z=s(2489),A=s(2265);function D(e){let{tr:t}=e,l=(0,A.useRef)(null);return(0,A.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 v=new s.Mesh(new s.CylinderGeometry(.22,.28,.95,20),new s.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}));v.position.set(1.05,.35,-.15),v.rotation.z=.12,h.add(v);let f=new s.Mesh(new s.SphereGeometry(.26,16,16),new s.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}));f.position.set(1.05,.92,-.15),h.add(f);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 _=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)});_.observe(i),e=()=>{cancelAnimationFrame(n),_.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 O=s(9170),B=s(2246),H=s(4794),W=s(221),K=s(8124),F=s(2101),Y=s(9985),G=s(6362),q=s(3468),J=s(6443),V=s(5287),$=s(3276),X=s(9227),Q=s(257),ee=s(1387);class et{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=>{var t;let s=this.canvas.getContext("2d");if(!s){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),s.drawImage(e,0,0),e.close(),null===(t=this.onFrame)||void 0===t||t.call(this)},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,s){this.canvas=e,this.onDecodeError=t,this.onFrame=s,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function es(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let en="live-hub-adb-bookmarks-v1";function el(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 ei(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 ea=[0,280,450,700,1100];function er(e){switch(e){case"usb":return{Icon:F.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:_.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:L.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 eo="https://github.com/Genymobile/scrcpy",ec="https://github.com/viarotel-org/escrcpy";function ed(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function ex(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:a,devices:r,setSerial:o,adbAvailable:c,lock:x,overview:m,onAndroidAction:u,notify:p,onRefreshDevices:b}=e,[g,v]=(0,A.useState)(0),[f,y]=(0,A.useState)(450),[j,N]=(0,A.useState)(!1),[k,_]=(0,A.useState)(null),[z,S]=(0,A.useState)(null),[C,R]=(0,A.useState)(!0),[P,T]=(0,A.useState)(""),[L,M]=(0,A.useState)(""),[E,U]=(0,A.useState)("37777"),[I,Z]=(0,A.useState)(""),[D,O]=(0,A.useState)(!1),[B,H]=(0,A.useState)([]),[W,K]=(0,A.useState)(!1),[F,ex]=(0,A.useState)(null),[em,eu]=(0,A.useState)(!1),[eh,ep]=(0,A.useState)(null),[eb,eg]=(0,A.useState)(null),[ev,ef]=(0,A.useState)(!0),ey=(0,A.useRef)(null),ew=(0,A.useRef)(null),ej=(0,A.useRef)(null),eN=(0,A.useRef)(null),ek=(0,A.useRef)(null),e_=(0,A.useRef)(null),ez=(0,A.useRef)(0),eS=(0,A.useRef)(!1),eC=(0,A.useRef)(null),eR=(0,A.useRef)(!1),eP=null===(t=r.find(e=>e.serial===a))||void 0===t?void 0:t.transport,eT=f>0,eL=a?"".concat(ed(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(a),"&ts=").concat(g).concat(eT?"&fast=1":""):"",eM=(0,A.useCallback)(()=>{v(e=>e+1)},[]),eE=(0,A.useCallback)(()=>{null!=eC.current&&(window.clearTimeout(eC.current),eC.current=null)},[]);(0,A.useEffect)(()=>{let e=()=>ef("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(en);if(e){let t=JSON.parse(e);Array.isArray(t)&&H(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eU=e=>{let t=e.trim();if(!t)return;let n=[t,...B.filter(e=>e!==t)].slice(0,16);H(n);try{window.localStorage.setItem(en,JSON.stringify(n))}catch(e){}p(s("已保存快捷地址","Saved quick address"))};(0,A.useEffect)(()=>{if(!a||!c){S(null);return}let e=!1;return(async()=>{try{let t=await (0,ee.N)("".concat(ed(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(a)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&S({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,a]),(0,A.useEffect)(()=>{if(!c||!a||f<=0||W||!ev)return;let e=window.setInterval(()=>v(e=>e+1),f);return()=>clearInterval(e)},[c,f,ev,a,W]),(0,A.useEffect)(()=>{ev&&c&&a&&!W&&eM()},[c,eM,ev,a,W]),(0,A.useEffect)(()=>{if(!c){eg(null);return}let e=!1;return(async()=>{try{let t=await (0,ee.N)(ed(l,"/android/scrcpy/info"));e||eg(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,A.useEffect)(()=>{W||ep(null)},[W]),(0,A.useEffect)(()=>{ex(null),eS.current=!1},[a]),(0,A.useEffect)(()=>{let e=r.find(e=>e.serial===a),t=!!(a&&F===a);if(c&&a&&(null==e?void 0:e.state)==="device"&&(null==eb?void 0:eb.server_jar)&&es()&&!t){K(!0),y(0);return}if(t||!a||!c||eb&&!eb.server_jar||!es()||e&&"device"!==e.state){K(!1);return}},[a,r,c,eb,F]),(0,A.useEffect)(()=>{if(!W||!a||!c){var e,t;eE(),eS.current=!0,eR.current=!1,null===(e=eN.current)||void 0===e||e.close(),eN.current=null,null===(t=ek.current)||void 0===t||t.reset(),ek.current=null,eu(!1);return}if(!es()){ep(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),K(!1);return}let n=ej.current;if(!n)return;let i=e=>{var t;eE(),eS.current=!0,null===(t=eN.current)||void 0===t||t.close(),ep(e),K(!1),y(450),ex(a),window.setTimeout(()=>eM(),120)},r=new et(n,e=>i("".concat(s("实时画面解码失败,已切回截图模式","Live stream decode failed, using screenshot mode"),": ").concat(e)),()=>{eR.current=!0,eE()});ek.current=r,eS.current=!1,eR.current=!1;let o=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!==Q&&Q.env.NEXT_PUBLIC_API_URL?String(Q.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 eN.current=o,o.binaryType="arraybuffer",o.onopen=()=>{eu(!0),ep(null),eE(),eC.current=window.setTimeout(()=>{eR.current||i(s("实时画面无首帧,已切回截图模式","No first live frame, using screenshot mode"))},5200)},o.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=ek.current)||void 0===t||t.push(e.data)},o.onerror=()=>{ep(s("WebSocket 异常","WebSocket error"))},o.onclose=()=>{var e;eu(!1),null===(e=ek.current)||void 0===e||e.reset(),ek.current=null,eE(),W&&!eS.current&&i(s("实时画面连接失败,已切回截图模式","Live stream failed, using screenshot mode"))},()=>{eE(),eS.current=!0,eR.current=!1,o.close(),eN.current=null,r.reset(),ek.current===r&&(ek.current=null)}},[W,a,c,l,eM,eE,s]),(0,A.useEffect)(()=>{a&&c&&(ez.current=0,v(e=>e+1))},[a,c]);let eI=async()=>{let e=P.trim();if(!e){p(s("填写 host:port","Enter host:port"));return}O(!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(),eM()}catch(e){p(e.message)}finally{O(!1)}},eZ=async e=>{O(!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{O(!1)}},eA=async()=>{let e=L.trim(),t=parseInt(E,10)||37777,n=I.trim();if(!e||!n){p(s("填写配对 IP 与码","Host + code required"));return}O(!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{O(!1)}},eD=async e=>{if(!C||x||!c||!a)return;let t=ew.current;if(!t)return;let n=ei(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await u("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await u("tap",{x:n.x,y:n.y})),eM()},eO=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ew.current;if(!t)return;let n=ei(t,e.clientX,e.clientY);n&&(await u("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eM())},eB=async e=>{if(!C||x||!c||!a)return;let t=ej.current;if(!t)return;let n=el(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await u("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await u("tap",{x:n.x,y:n.y})),W||eM()},eH=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ej.current;if(!t)return;let n=el(t,e.clientX,e.clientY);n&&(await u("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),W||eM())};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 eW=er(eP),eK=eW.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)(Y.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:P,onChange:e=>T(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eI()}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eI(),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:D?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:D||x||!P.trim(),onClick:()=>eU(P),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),B.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:B.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:()=>T(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:D||x||!a,onClick:()=>void eZ(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:D||x,onClick:()=>void eZ(""),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:D||x,onClick:()=>{b(),eM(),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)(w.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:L,onChange:e=>M(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:E,onChange:e=>U(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:I,onChange:e=>Z(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eA(),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)(h.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:ec,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:eo,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:ec,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)(G.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:eo,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)(G.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)(q.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=er(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")}),ea.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>y(e),className:"rounded-lg px-2.5 py-1 text-[10px] font-semibold transition ".concat(f===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(eW.cls),children:[(0,n.jsx)(eK,{className:"h-3 w-3"}),"tcp"===eP?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.jsxs)("button",{type:"button",disabled:x,onClick:()=>void eM(),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)(w.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>void u("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:C,onChange:e=>R(e.target.checked)}),(0,n.jsx)(J.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:()=>{K(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(W?"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)(V.Z,{className:"h-3 w-3"}),W?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:e_,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 u(s[0],s[1]),W||eM()})())},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"}),W?(0,n.jsx)("canvas",{ref:ej,className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onClick:eB,onContextMenu:eH}):(0,n.jsx)("img",{ref:ew,src:eL||void 0,alt:"device",className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onLoadStart:()=>{N(!0)},onLoad:()=>{N(!1),ez.current=0,_(null)},onError:()=>{N(!1),ez.current+=1,ez.current<=3?(_(null),window.setTimeout(()=>eM(),380+200*ez.current)):_(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eD,onContextMenu:eO})]}),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)(V.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):f>0&&!W?(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)($.Z,{className:"h-3 w-3"}),"LIVE"]}):W?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)(X.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&&!W?(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:z?"".concat(z.width,"\xd7").concat(z.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:()=>{u("key",{keycode:t}),eM()},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:()=>{u("key",{keycode:"24"}),eM()},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:()=>{u("key",{keycode:"25"}),eM()},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:()=>{u("swipe",{direction:e}),eM()},className:"rounded-lg border border-white/10 bg-black/30 py-2 font-mono text-[10px] uppercase text-zinc-300",children:e},e))})]})]})]})]})]})]})}let em=[{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 eu(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 eh(e){var t,s,l,i,a,r,o,c,d,x,m,u,h,p,b;let{t:g,notify:v,fetchJson:f,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:_,adbAvailable:z,apkPath:S,setApkPath:C,onAndroidAction:R,onCopy:P,onRefreshDevices:T}=e,[L,E]=(0,A.useState)(null),[I,Z]=(0,A.useState)(null),[D,O]=(0,A.useState)(null),[B,F]=(0,A.useState)(null),[Y,G]=(0,A.useState)(""),[q,J]=(0,A.useState)([]),[V,$]=(0,A.useState)("getprop ro.product.model"),[X,Q]=(0,A.useState)(""),[ee,et]=(0,A.useState)("300"),[es,en]=(0,A.useState)(""),[el,ei]=(0,A.useState)(null),[ea,er]=(0,A.useState)([]),[eo,ec]=(0,A.useState)(null),[ed,eh]=(0,A.useState)("https://"),[ep,eb]=(0,A.useState)(""),[eg,ev]=(0,A.useState)(!1),[ef,ey]=(0,A.useState)(null),ew=!!(j||ef),ej=_.find(e=>e.serial===N)||null,eN=(0,A.useCallback)(async()=>{if(!N||!z){E(null),Z(null);return}ey("overview"),Z(null);try{let e=await f("/android/overview?serial=".concat(encodeURIComponent(N)));E(e)}catch(e){E(null),Z(e.message)}finally{ey(null)}},[z,N,f]),ek=(0,A.useCallback)(async()=>{F(null);try{let e=await f("/redroid/summary");O(e)}catch(e){O(null),F(e.message)}},[f]);(0,A.useEffect)(()=>{eN()},[eN]),(0,A.useEffect)(()=>{ek()},[ek]);let e_=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await f("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));J(t.packages||[])}catch(e){v(e.message),J([])}finally{ey(null)}},ez=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}let e=V.trim();if(e){ey("shell");try{var t,s;let n=await f("/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)}}},eS=(0,A.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"),ei(null);try{var n;let e=await f("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));en(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){en(""),ei(e.message)}finally{s||ey(null)}},[N,f,ee]);(0,A.useEffect)(()=>{if(!eg||!N||!z)return;let e=window.setInterval(()=>void eS({silent:!0}),3e3);return eS({silent:!0}),()=>clearInterval(e)},[z,N,eg,eS]);let eC=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}ey("ui"),ec(null);try{let e=await f("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));er(e.nodes||[])}catch(e){er([]),ec(e.message)}finally{ey(null)}},eR=async(e,t)=>{ey("redroid:".concat(e));try{let s=await f("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&O(s.summary),v(s.message||"OK"),await ek(),T()}catch(e){v(e.message)}finally{ey(null)}},eP=async e=>{await R("key",{keycode:e})},eT=async()=>{let e=ep.trim();if(!e){v(g("请输入文字","Enter text"));return}await R("text",{text:e})},eL=async()=>{let e=ed.trim();if(!e||"https://"===e){v(g("请输入 URL","Enter URL"));return}await R("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.")})]}),z?(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(),T()},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:_.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))}),z&&0===_.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")}),I?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:I}):null,L?(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:[L.brand," ",L.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:[L.android_version," (sdk ",L.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:[L.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",L.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:L.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:L.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:L.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:L.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eu(null===(t=L.diagnostics)||void 0===t?void 0:t.ready,g("已启动","Boot ready"),g("未完成启动","Boot pending")),eu(null===(s=L.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),eu(null===(l=L.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),eu(null===(i=L.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),eu(null===(a=L.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=L.diagnostics)||void 0===r?void 0:r.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=L.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=L.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=L.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=L.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):I?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")})]}),B?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:B}):null,D?(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: ",D.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",D.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",D.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",D.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",D.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[eu(null===(m=D.requirements)||void 0===m?void 0:m.docker_available,"Docker","No Docker"),eu(null===(u=D.requirements)||void 0===u?void 0:u.adb_available,"ADB","No ADB"),eu(null===(h=D.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),eu(null===(p=D.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(D.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:[eu(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,g("系统就绪","System ready"),g("启动中","Booting")),eu(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),eu(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),eu(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=D.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)(ex,{t:g,apiBase:w,fetchJson:f,serial:N,devices:_,setSerial:k,adbAvailable:z,lock:ew,overview:L,onAndroidAction:R,notify:v,onRefreshDevices:T}),z&&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 R("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 R("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 R("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&&eT()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eT(),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:ed,onChange:e=>eh(e.target.value),placeholder:"https://"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eL(),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)(M.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,z&&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)(H.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=>G(e.target.value),placeholder:"tiktok / musically / youtube",onKeyDown:e=>{"Enter"===e.key&&e_()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),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:[q.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 R("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 R("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)),q.length?null:(0,n.jsx)("li",{className:"py-2 text-center text-zinc-600",children:g("暂无结果","No results")})]})]}):null,z&&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)(W.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:em.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>$(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:V,onChange:e=>$(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ez())}}),(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 ez(),className:"rounded-xl bg-amber-500/20 px-4 py-2 text-sm text-amber-100 ring-1 ring-amber-500/30",children:"shell"===ef?(0,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),X?(0,n.jsxs)("button",{type:"button",disabled:!X,onClick:()=>P(X),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)(U.Z,{className:"h-3.5 w-3.5"}),g("复制输出","Copy")]}):null]}),X?(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:X}):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=>ev(e.target.checked)}),g("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),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:()=>P(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)(U.Z,{className:"h-3.5 w-3.5"}),g("复制","Copy")]}):null]}),el?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:el}):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,z&&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)(K.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")}),eo?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:eo}):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:[ea.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 R("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))),ea.length||eo?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:g("尚未加载","Not loaded")})]})]}):null,z&&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:S,onChange:e=>C(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!z||!N,onClick:()=>void R("install_apk",{path:S}),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 ep=s(9897),eb=s(4554),eg=s(7689),ev=s(8401);function ef(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,ev.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 ej(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 eN(e){let t=(e||"").trim().replace(/^[\s"'`[\]()()【】]+|[\s"'`[\]()()【】]+$/g,"");return!(t=(t=(t=(t=t.replace(/^(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*/i,"")).replace(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/gi,"")).replace(/(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中).*$/i,"")).trim().replace(/^[\s,,;;||\-—::]+|[\s,,;;||\-—::]+$/g,""))||/^[-—_无未知]+$/i.test(t)||/^(unknown|null|undefined|none|nan)$/i.test(t)||/live\.douyin\.com/i.test(t)||/^\d{5,}$/.test(t)||/^(监测|格式|错误|无录制任务)/.test(t)?"":t.slice(0,48)}function ek(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=function(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!e||e.startsWith("#"))continue;let s=e.match(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/i);if(!s||null==s.index)continue;let n=eN(e.slice(s.index+s[0].length));if(n)return n;let l=e.split(/[,,||]/,2);if(l.length>1){let e=eN(l[1]);if(e)return e}}return""}(e)||function(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-160);for(let e=t.length-1;e>=0;e-=1){let s=t[e],n=s.match(/(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*(.{1,80})/i),l=s.match(/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中)/i),i=eN((null==n?void 0:n[1])||(null==l?void 0:l[1])||"");if(i)return i}return""}(t);if(s)return s;let n=e_(t)||ez(e)[0]||"";return n?"抖音直播间 ".concat(n):""}function e_(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}function ez(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)}function eS(e){let t="",s=!0,n="",l=!0,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 eC(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eR(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 eP(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 eT(e){var t,s,l;let{t:i,currentProc:a,fetchJson:r,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3,refreshToken:m=0}=e,[u,h]=(0,A.useState)(""),[p,b]=(0,A.useState)(""),[g,v]=(0,A.useState)(""),[f,y]=(0,A.useState)(""),[j,N]=(0,A.useState)(""),[k,_]=(0,A.useState)([]),[z,S]=(0,A.useState)(null),[C,R]=(0,A.useState)(""),[P,T]=(0,A.useState)(""),[L,M]=(0,A.useState)(""),[E,U]=(0,A.useState)(""),[I,Z]=(0,A.useState)(!1),[D,O]=(0,A.useState)(null),[B,H]=(0,A.useState)(0),[W,K]=(0,A.useState)(!0),F=(0,A.useRef)(null),Y=(0,A.useRef)(null),q=(0,A.useRef)(!1),J=(0,A.useRef)(!1),V=(0,A.useRef)(!1),Q=(0,A.useRef)(a),ee=(0,A.useRef)(0),et=ez(o),es=/^(online|running)$/i.test(u),en=e_(p),el=null!==(s=ej(o)[0])&&void 0!==s?s:"",ei=P||en||(null!==(l=null===(t=el.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),ea=L||(ei?"https://live.douyin.com/".concat(ei):el||null),er=E||C||ek(o,p)||(ei?"抖音直播间 ".concat(ei):""),eo="youtube_key_rejected"===f.trim().toLowerCase(),ec=(0,A.useCallback)(async()=>{let e=Q.current.trim();if(!e)return;if(J.current){V.current=!0;return}J.current=!0;let t=++ee.current;try{let s=await r("/status?process=".concat(encodeURIComponent(e)));if(t!==ee.current||e!==Q.current.trim())return;let n=s.process_status||"unknown";h(n),b(s.recent_log||""),v(s.recent_error||""),y(s.business_status||""),N(s.business_note||""),_(Array.isArray(s.ffmpeg_pids)?s.ffmpeg_pids:[]),S("number"==typeof s.log_age_seconds?s.log_age_seconds:null),R(s.source_title||""),T(s.source_room_id||""),M(s.source_url||""),U(s.source_display||"");let l=/^(online|running)$/i.test(n);l&&!q.current&&O(Date.now()),l||O(null),q.current=l}catch(s){if(t!==ee.current||e!==Q.current.trim())return;h("error"),y("error"),N(""),_([]),S(null),R(""),T(""),M(""),U("")}finally{J.current=!1,V.current&&(V.current=!1,window.setTimeout(()=>void ec(),0))}},[r]);(0,A.useEffect)(()=>{if(Q.current=a,ee.current+=1,V.current=!1,!a){h(""),b(""),v(""),y(""),N(""),_([]),S(null),R(""),T(""),M(""),U(""),O(null),q.current=!1;return}h(""),b(""),v(""),y(""),N(""),_([]),S(null),R(""),T(""),M(""),U(""),O(null),q.current=!1,ec()},[a,ec]),(0,A.useEffect)(()=>{let e=()=>K("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{a&&ec()},[a,ec,m]),(0,A.useEffect)(()=>{if(I||!W||!a)return;let e=window.setInterval(()=>void ec(),x);return()=>clearInterval(e)},[I,W,a,ec,x]),(0,A.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&ec()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[ec]),(0,A.useEffect)(()=>{if(!D)return;let e=window.setInterval(()=>H(e=>e+1),1e3);return()=>clearInterval(e)},[D]),(0,A.useEffect)(()=>{if(I||!W)return;let e=F.current;e&&(e.scrollTop=e.scrollHeight)},[p,I,W]),(0,A.useEffect)(()=>{if(I||!W)return;let e=Y.current;e&&(e.scrollTop=e.scrollHeight)},[g,I,W]);let ed=null==D?i("—(未检测到在线)","— (not online)"):eP(Math.max(0,Math.floor((Date.now()-D)/1e3))),ex=I?i("已暂停刷新","Paused"):W?i("每秒刷新","~1s refresh"):i("后台暂停","Hidden"),em=I?"bg-amber-500/20 text-amber-100 ring-amber-500/35":W?"bg-emerald-500/15 text-emerald-200/90 ring-emerald-500/25":"bg-sky-500/15 text-sky-100 ring-sky-500/25";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:B}),(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-white/10 px-2 py-0.5 font-mono text-[10px] text-zinc-300 ring-1 ring-white/10",children:a||"—"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(em),children:ex})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void ec(),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)(w.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>Z(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(I?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[I?(0,n.jsx)($.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(X.Z,{className:"h-3.5 w-3.5"}),I?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,u)})]}),(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"):"youtube_key_rejected"===n?e("YouTube 推流失败:串流密钥无效、过期或不属于当前直播间","YouTube rejected the stream key"):"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,j)})]}),(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:ed})]}),(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:[k.length?k.join(", "):"none",null!=z?" \xb7 log ".concat(eP(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,eo?(0,n.jsx)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/[0.10] px-3 py-2.5 text-xs text-rose-100 ring-1 ring-rose-500/15",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(ey.Z,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-300","aria-hidden":!0}),(0,n.jsx)("p",{children:i("YouTube 已拒绝本次 RTMPS 推流。请从 YouTube Studio 当前直播间复制完整串流密钥,保存到当前线路后重新开始;如果密钥确认无误,再检查到 YouTube RTMPS 的网络/代理。","YouTube rejected this RTMPS publish. Copy the full stream key for the current live event from YouTube Studio, save it to this lane, then start again; if the key is correct, check network/proxy access to YouTube RTMPS.")})]})}):null,ea?(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:en?i("当前直播源站(日志)","Current source (from log)"):es?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:ea,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)(G.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),er||i("打开抖音直播页","Open Douyin live")]})]}),ei&&er&&!er.includes(ei)?(0,n.jsxs)("p",{className:"mt-2 font-mono text-[10px] text-zinc-600",children:["room:",ei]}):null,et.length>1&&en?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",et.filter(e=>e!==ei).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)),et.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"!==u&&"invalid"!==u?(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:F,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:p.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:Y,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:g.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 eL(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let eM=[{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."}],eE="live-hub-tiktok-hdmi-check-v1",eU="live-hub-tiktok-hdmi-notes-v1",eI="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:v,onNavigate:f}=e,y=(0,A.useMemo)(()=>i.filter(eL),[i]),w=y.length?y:i,[j,N]=(0,A.useState)("srs"),[k,_]=(0,A.useState)([]),[z,S]=(0,A.useState)(!1),[C,R]=(0,A.useState)(!1),[P,M]=(0,A.useState)("1080p30"),[E,I]=(0,A.useState)("1080p30"),[Z,D]=(0,A.useState)(!1),[O,B]=(0,A.useState)(!0),[H,W]=(0,A.useState)(null),K=(0,A.useRef)(!1),F=(0,A.useRef)(o),[Y,G]=(0,A.useState)(""),[q,J]=(0,A.useState)({}),$=(0,A.useCallback)(e=>{F.current=e,c(e)},[c]),X=(0,A.useCallback)(e=>{N(e);try{window.localStorage.setItem(eI,e)}catch(e){}},[]);(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(eI);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,A.useEffect)(()=>{K.current=!1},[a]),(0,A.useEffect)(()=>{F.current=o},[o]);let Q=(0,A.useCallback)(async()=>{if(a)try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),s=await h("/get_url_config?".concat(t));$(null!==(e=s.content)&&void 0!==e?e:"")}catch(e){}},[$,a,h]);(0,A.useEffect)(()=>{if(!a||!O||"ffmpeg"!==j)return;let e=window.setInterval(()=>{K.current||Q()},8e3);return()=>clearInterval(e)},[a,O,Q,j]),(0,A.useEffect)(()=>{"ffmpeg"===j&&a&&Q()},[j,a,Q]);let et=(0,A.useCallback)(async()=>{if(a){S(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(a)));_(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){v(e.message),_([])}finally{S(!1)}}},[a,h,v]);(0,A.useEffect)(()=>{"replay"===j&&a&&et()},[j,a,et]),(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(eE);e&&J(JSON.parse(e))}catch(e){}try{G(window.localStorage.getItem(eU)||"")}catch(e){}},[]);let es=(0,A.useCallback)(e=>{J(e);try{window.localStorage.setItem(eE,JSON.stringify(e))}catch(e){}},[]),en=e=>{G(e);try{window.localStorage.setItem(eU,e)}catch(e){}},el=async()=>{if(a){D(!0),W(null),K.current=!1;try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),n=await h("/get_url_config?".concat(t));$(null!==(e=n.content)&&void 0!==e?e:""),W(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){W(e.message)}finally{D(!1)}}},ei=async()=>{try{await Promise.resolve(x(F.current)),K.current=!1}catch(e){}},ea=async e=>{if(a){R(!0);try{await h("/tiktok_replay/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:a,filename:e})}),v(s("已删除文件","File removed")),await et()}catch(e){v(e.message)}finally{R(!1)}}},er=async e=>{var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",n&&a){R(!0);try{let e=new FormData;e.append("file",n);let t=await (0,ee.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(a)),{method:"POST",body:e});v(t.message||s("上传成功","Uploaded")),await et()}catch(e){v(e.message)}finally{R(!1)}}},eo=l||Z||C,ec=eM.find(e=>e.id===E),ed=!!(null==g?void 0:g.can_stream_hdmi),ex=(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:[f?(0,n.jsx)(ef,{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:f,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)(L.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)(ep.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(ed?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ed?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:ex||"—"})]}),(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)(U.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)(V.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=>X(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:eo,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:ec?s(ec.labelZh,ec.labelEn):E})]})]}),"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)(eb.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)(eg.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:er})]}),(0,n.jsx)("button",{type:"button",disabled:eo||!a,onClick:()=>void et(),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.")}),z?(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:eo,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:eo,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:eo,onClick:()=>void ea(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)(T.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)(U.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)(U.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)(ep.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:eM.map(e=>{let t=P===e.id,l=E===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)(ep.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:!!q[e.id],onChange:t=>es({...q,[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:Y,onChange:e=>en(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)(U.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:O,onChange:e=>B(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=>{K.current=!0,$(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:eo,onClick:()=>void el(),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:eo,onClick:()=>void ei(),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)(eT,{t:s,currentProc:a,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eA=s(5468),eD=s(1094),eO=s(5621),eB=s(91),eH=s(2208),eW=s(9397),eK=s(90);let eF="live-hub-youtube-pro-v2",eY="youtube2__",eG=/[^a-zA-Z0-9_.-]+/g,eq=new Set(["douyin_youtube","tiktok","obs","web"]);function eJ(e,t){var s;let n=(e||"").trim();if(!function(e){let t=(e||"").trim();return!t||/\?{2,}/.test(t)||/?{2,}/.test(t)||/�/.test(t)||/锟|绾胯矾|çº|è·|Â/.test(t)||/^(undefined|null|nan)$/i.test(t)}(n))return n;let l=(null===(s=n.match(/\d+/))||void 0===s?void 0:s[0])||String(Math.max(0,t)+1);return"线路 ".concat(l)}function eV(e){return e.map((e,t)=>({...e,name:eJ(e.name,t)}))}function e$(e){return(e||"").trim().replace(eG,"_")}function eX(e,t){let s=e$(e);return!s||eq.has(s)||s===eY?e8(t):"youtube"===s||s.startsWith(eY)?s:e8(s)}function eQ(e){return eX(String(e.pm2Name||""),String(e.id||""))}function e0(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e||"object"!=typeof e)return null;let s=String(e.id||"").trim();return s?{id:s,name:eJ("string"==typeof e.name?e.name:"",t),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:eX("string"==typeof e.pm2Name?e.pm2Name:"",s),notes:"string"==typeof e.notes?e.notes:void 0}:null}function e1(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let s=t.map((e,t)=>e0(e,t)).filter(e=>null!==e);return eV(s)}catch(e){return[]}}function e5(e){window.localStorage.setItem(eF,JSON.stringify(eV(e)))}let e2=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function e3(e){for(let s of e2)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?eV(t.map((e,t)=>e0(e,t)).filter(e=>null!==e)):[])}}catch(e){}return{fetched:!1,channels:[]}}async function e4(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=null,l=eV(t);for(let t of e2)try{var i;let a=await e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:l,force:!!s.force})});if((null===(i=a.neko)||void 0===i?void 0:i.ok)===!1){let e=a.neko.desired?" desired=".concat(a.neko.desired):"",t=a.neko.current?" current=".concat(a.neko.current):"";n=Error("Neko capacity expansion failed:".concat(e).concat(t," ").concat(a.neko.reason||"unknown error").trim());break}return}catch(e){n=e instanceof Error?e:Error(String(e))}throw null!=n?n:Error("youtube_pro_channels sync failed")}function e6(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function e8(e){return"".concat(eY).concat(e$(e)||"channel")}function e9(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function e7(e){return e.trim().toLowerCase().startsWith("youtube2__")}function te(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function tt(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function ts(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:to(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===te(e.script).trim().toLowerCase()?3:10}let tn="live-hub-youtube-mode-v1",tl=new Set(["douyin_youtube","tiktok","obs","web"]);function ti(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:e8(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function ta(e){return Object.fromEntries(e.map(e=>[e.id,ti(e)]))}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=((null==e?void 0:e.source_display)||(null==e?void 0:e.source_title)||"").trim();if(n)return n;let l=ek(t,s).trim();if(l)return l;let i=((null==e?void 0:e.source_room_id)||"").trim();return i?"抖音直播间 ".concat(i):""}function to(e){return/^(online|running)$/i.test((e||"").trim())}function tc(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"):"youtube_key_rejected"===s?t("密钥被 YouTube 拒绝","Key rejected"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):to(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function td(e){let t=Math.max(0,Math.floor(e||0));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);return s<60?"".concat(s,"m ").concat(t%60,"s"):"".concat(Math.floor(s/60),"h ").concat(s%60,"m")}function tx(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString()}catch(e){return"-"}}function tm(e){let t=(e||"").toLowerCase();return"active"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"ended"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tu(e,t){let s=(e||"").toLowerCase();return"active"===s?t("直播中","Live"):"ended"===s?t("已结束","Ended"):"error"===s?t("异常","Problem"):"idle"===s?t("等待中","Waiting"):t("记录","Record")}function th(e,t){return null==e?t?t("未知","Unknown"):"-":e.toLocaleString()}function tp(e,t){return e?(e.source_title||e.channel_name||"").trim()||(e.source_room_id?t("抖音直播间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.process?t("直播线路 ".concat(e.process),"Relay lane ".concat(e.process)):t("直播事件 #".concat(e.id),"Live event #".concat(e.id))):t("未选择直播","No event selected")}function tb(e,t){return e?e.source_room_id?t("抖音房间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.source_url?e.source_url.replace(/^https?:\/\//,""):t("来源未识别","Unknown source"):"-"}function tg(e,t){let s=Math.max(0,Math.floor(e||0));if(s<60)return t("".concat(s," 秒"),"".concat(s,"s"));let n=Math.floor(s/60);if(n<60)return t("".concat(n," 分 ").concat(s%60," 秒"),"".concat(n,"m ").concat(s%60,"s"));let l=Math.floor(n/60),i=n%60;return t("".concat(l," 小时 ").concat(i," 分"),"".concat(l,"h ").concat(i,"m"))}function tv(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(e){return"-"}}function tf(e,t){var s;if(!e)return"-";let n=(e.status||"").toLowerCase(),l="".concat(e.last_health||""," ").concat(e.last_live_status||""," ").concat(e.last_popup_text||"").toLowerCase();return"error"===n||/error|failed|poor|unstable|异常|错误|失败/.test(l)?t("需要处理","Needs attention"):e.last_popup_text?t("有弹窗","Popup seen"):(null!==(s=e.quality_score)&&void 0!==s?s:100)<50?t("质量偏低","Low quality"):t("正常","Normal")}function ty(e){let t=tf(e,e=>e);return"需要处理"===t||"质量偏低"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"有弹窗"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25"}function tw(e){let t=Number(e||0);return t>=80?"text-emerald-200":t>=55?"text-amber-200":"text-rose-200"}function tj(e){let t=(e||"").toLowerCase();return"critical"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"warning"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"ok"===t?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"number"!=typeof e||Number.isNaN(e)?"-":"".concat(e.toFixed(e>=100?0:2).replace(/\.00$/,"")).concat(t)}function tk(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function t_(e,t){return tk(e).length>0&&0===tk(t).length}function tz(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),v=!!(p&&h.action!==b),f="start"===t&&a,w="stop"===t&&!a,j="restart"===t&&!a,N=f||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!g){if(v){x(m("请等待当前操作完成","Wait for the current action to finish"));return}if(f){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||v?"cursor-not-allowed":""," ").concat(N&&!g?"opacity-45":""," ").concat(v?"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)(y.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)(eA.Z,{className:"".concat(u?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,r]})]})}function tS(e){var t,s,l,i,r,o,d,x,m,u,h,p,b,g,v,f,j,N,_,z,S,C,R,P;let{t:L,busy:M,entries:E,currentProc:U,setCurrentProc:I,urlConfig:Z,setUrlConfig:D,onRunProcess:O,onSaveUrlConfig:B,fetchJson:H,liveProcesses:W,notify:K,onNavigate:F,quickLinks:Y}=e,q=(0,A.useMemo)(()=>E.filter(e9),[E]),J=(0,A.useMemo)(()=>(function(e,t){let s=e.filter(e=>e9(e)&&!e7(e.pm2)),n=s.filter(e=>e9(e)&&e.pm2.trim()===te(e.script).trim()),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(e=>tt(e)&&!e7(e.pm2))){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&&!to(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})(q.length?q:E,W),[E,W,q]),X=(0,A.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(tt).map(e=>[e.pm2.trim(),e])),n=e[0],l=ts(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=ts(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===te(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:""}(J),[W,J]),[Q,ee]=(0,A.useState)("single"),[et,es]=(0,A.useState)([]),[en,el]=(0,A.useState)(""),[ei,ea]=(0,A.useState)(Z),[er,eo]=(0,A.useState)(""),[ec,ed]=(0,A.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!0}),[ex,em]=(0,A.useState)(null),[eu,eh]=(0,A.useState)(!1),[ep,eb]=(0,A.useState)(""),[eg,eN]=(0,A.useState)(!0),[ek,e_]=(0,A.useState)(!1),[ez,eP]=(0,A.useState)(!1),[eL,eM]=(0,A.useState)(null),[eE,eU]=(0,A.useState)({}),[eI,eZ]=(0,A.useState)(!1),[eA,eY]=(0,A.useState)(null),[eG,eq]=(0,A.useState)(0),[eX,e0]=(0,A.useState)(null),[e2,tS]=(0,A.useState)(null),[tC,tR]=(0,A.useState)(!1),[tP,tT]=(0,A.useState)(null),[tL,tM]=(0,A.useState)(!1),[tE,tU]=(0,A.useState)(null),[tI,tZ]=(0,A.useState)(null),tA=(0,A.useRef)(!1),tD=(0,A.useRef)(Z),tO=(0,A.useRef)(ep),tB=(0,A.useRef)([]),tH=(0,A.useRef)(U),tW=(0,A.useRef)(0),tK=(0,A.useRef)(0),tF=(0,A.useCallback)(e=>{tD.current=e,ea(e),D(e)},[D]),tY=(0,A.useCallback)(e=>{tO.current=e,eb(e)},[]);(0,A.useEffect)(()=>{tA.current=!1},[U]),(0,A.useEffect)(()=>{tH.current=U},[U]),(0,A.useEffect)(()=>{"single"===Q&&(tD.current=Z,ea(Z))},[Q,Z]),(0,A.useEffect)(()=>{tO.current=ep},[ep]),(0,A.useEffect)(()=>{tB.current=et},[et]),(0,A.useEffect)(()=>{tW.current+=1,tK.current+=1,tA.current=!1,eM(null)},[Q,en]);let tG=(0,A.useCallback)(async()=>{let e=tH.current.trim();if(!e)return;if("pro"===Q){let t=tB.current.find(e=>e.id===en);if(!t||eQ(t)!==e)return}let t=++tW.current;try{var s,n,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),a=await H("/get_url_config?".concat(i));if(t!==tW.current||e!==tH.current.trim())return;let r=null!==(s=a.content)&&void 0!==s?s:"";if(tA.current)return;if("single"===Q)tF(r);else{let e=null!==(l=null===(n=tB.current.find(e=>e.id===en))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(t_(e,r)){tY(e);return}tY(r)}}catch(e){}},[en,tY,tF,H,Q]);(0,A.useEffect)(()=>{if(!U||!eg)return;let e=window.setInterval(()=>{tA.current||tG()},8e3);return()=>clearInterval(e)},[U,eg,tG]);let tq=async()=>{let e=tH.current.trim();if(!e)return;if("pro"===Q){let t=tB.current.find(e=>e.id===en);if(!t||eQ(t)!==e)return}e_(!0),eM(null),tA.current=!1;let t=++tW.current;try{var s,n,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),a=await H("/get_url_config?".concat(i));if(t!==tW.current||e!==tH.current.trim())return;let r=null!==(s=a.content)&&void 0!==s?s:"";if(tA.current){eM(L("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===Q)tF(r);else{let e=null!==(l=null===(n=tB.current.find(e=>e.id===en))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(t_(e,r)){tY(e),eM(L("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}tY(r)}eM(L("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(s){if(t!==tW.current||e!==tH.current.trim())return;eM(s.message)}finally{t===tW.current&&e_(!1)}};(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(tn);("pro"===e||"single"===e)&&ee(e)}catch(e){}},[]),(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await e3(H);if(t.fetched&&t.channels.length&&!e){let e=eV(t.channels);tB.current=e,es(e),eU(ta(e)),e5(e);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(eF);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=e1(e);if(t.length)return window.localStorage.setItem(eF,JSON.stringify(t)),t}return e1(e)}(),s=eV(t.length>0?t:[{id:e6(),name:"线路 1",streamKey:"",urlLines:"",pm2Name:"youtube",notes:""}]);tB.current=s,es(s),eU(ta(s)),e5(s)})(),()=>{e=!0}},[H]),(0,A.useEffect)(()=>{if(!et.length){en&&el("");return}en&&et.some(e=>e.id===en)||el(et[0].id)},[et,en]);let tJ=et.find(e=>e.id===en)||et[0],tV=(0,A.useCallback)(e=>W.find(t=>t.pm2===e),[W]),t$=(0,A.useCallback)(e=>{var t;return null===(t=tV(e))||void 0===t?void 0:t.process_status},[tV]),tX=tV(U),tQ=tV(U);(0,A.useEffect)(()=>{"single"===Q&&X&&!U&&(tH.current=X,I(X))},[U,Q,X,I]);let t0=(0,A.useCallback)(e=>{let t=eV(e);tB.current=t,es(t),e5(t)},[]),t1=(0,A.useCallback)((e,t)=>{let s=e.trim();if(!s)return;let n=!1,l=tB.current.map(e=>eQ(e)!==s?e:(n=!0,{...e,...t}));n&&t0(l)},[t0]),t5=(0,A.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await e4(H,e,t)},[H]),t2=(0,A.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t0(e),t5(e,t).catch(e=>{K("".concat(L("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[t0,K,t5,L]),t3=(0,A.useMemo)(()=>{var e;return tJ?null!==(e=eE[tJ.id])&&void 0!==e?e:ti(tJ):null},[tJ,eE]);(0,A.useEffect)(()=>{tJ&&eU(e=>e[tJ.id]?e:{...e,[tJ.id]:ti(tJ)})},[tJ]),(0,A.useEffect)(()=>{if(!tJ||"youtube"!==eQ(tJ))return;let e=ec.key.trim();e&&eU(t=>{var s;let n=null!==(s=t[tJ.id])&&void 0!==s?s:ti(tJ);return n.streamKey.trim()===e&&"youtube"===n.pm2Name||n.streamKey.trim()?t:{...t,[tJ.id]:{...n,streamKey:e,pm2Name:"youtube"}}})},[tJ,ec.key]),(0,A.useEffect)(()=>{eY(null)},[en]);let t4=(0,A.useCallback)((e,t)=>{tJ&&(eU(s=>{var n;return{...s,[tJ.id]:{...null!==(n=s[tJ.id])&&void 0!==n?n:ti(tJ),[e]:t}}}),eY(null))},[tJ]),t6=tJ?eQ(tJ):"",t8=tJ&&t3?eQ({id:tJ.id,pm2Name:t3.pm2Name}):"",t9=!!tJ&&!!t3&&t8!==t6,t7=(0,A.useMemo)(()=>{if(!tJ||!t3)return{ok:!1,message:L("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=et.findIndex(e=>e.id===tJ.id),t=eJ(t3.name,e>=0?e:0),s=eQ({id:tJ.id,pm2Name:t3.pm2Name});return s?tl.has(s)?{ok:!1,message:L("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:t3.streamKey.trim(),normalizedNotes:t3.notes.trim()}:et.find(e=>e.id!==tJ.id&&eQ(e)===s)?{ok:!1,message:L("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:t3.streamKey.trim(),normalizedNotes:t3.notes.trim()}:{ok:!0,message:"",normalizedName:t,normalizedPm2:s,normalizedStreamKey:t3.streamKey.trim(),normalizedNotes:t3.notes.trim()}:{ok:!1,message:L("进程名不能为空","PM2 name is required"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:t3.streamKey.trim(),normalizedNotes:t3.notes.trim()}},[tJ,t3,et,L]),se=(0,A.useMemo)(()=>{if(!tJ||!t3)return!1;let e=ti(tJ);return t3.name!==e.name||t3.streamKey!==e.streamKey||e$(t3.pm2Name)!==e$(e.pm2Name)||t3.notes!==e.notes},[tJ,t3]);(0,A.useCallback)(async e=>{let t=e.trim();if(!t)return;let s=++tW.current,n=++tK.current;tA.current=!1,e_(!0),eh(!0),eM(L("正在同步单频道配置...","Syncing single-channel config...")),em(null);try{var l,i;let[e,a]=await Promise.allSettled([H("/get_url_config?".concat(new URLSearchParams({process:t,_ts:String(Date.now())}))),H("/get_config?".concat(new URLSearchParams({process:t,_ts:String(Date.now())})))]);if(s===tW.current&&t===tH.current.trim()&&("fulfilled"===e.status?(tF(null!==(l=e.value.content)&&void 0!==l?l:""),eM(L("单频道配置已实时同步","Single-channel config synced"))):eM(e.reason instanceof Error?e.reason.message:String(e.reason))),n===tK.current&&t===tH.current.trim()){if("fulfilled"===a.status){let e=null!==(i=a.value.content)&&void 0!==i?i:"";eo(e),ed(eS(e))}else em(a.reason instanceof Error?a.reason.message:String(a.reason))}}finally{s===tW.current&&e_(!1),n===tK.current&&eh(!1),t===tH.current.trim()&&eq(e=>e+1)}},[tF,H,L]),(0,A.useCallback)(async()=>{try{var e,t;let s=await e3(H);if(!s.fetched||!s.channels.length)return;let n=eV(s.channels);tB.current=n,es(n),eU(ta(n)),e5(n);let l=null!==(e=n.find(e=>e.id===en))&&void 0!==e?e:n[0];if(!l)return;el(l.id),tY((null!==(t=l.urlLines)&&void 0!==t?t:"").trim());let i=eQ(l);tH.current=i,I(i)}catch(e){}},[en,tY,H,I]);let st=(0,A.useCallback)(e=>{var t,s,n,l;if("pro"===e&&"single"===Q&&!ec.key.trim()){K(L("请先填写并保存 YouTube 推流 key,再切换到多频道 Pro","Fill and save the YouTube stream key before switching to Multi Pro"));return}if("single"===e){let e=tH.current.trim()||X||(null===(t=J[0])||void 0===t?void 0:t.pm2)||"";e&&(tH.current=e,I(e))}if("pro"===e&&et.length){let e=tH.current.trim(),t=null!==(n=null!==(s=et.find(t=>eQ(t)===e))&&void 0!==s?s:et.find(e=>e.id===en))&&void 0!==n?n:et[0];if(tY((null!==(l=null==t?void 0:t.urlLines)&&void 0!==l?l:"").trim()),t){el(t.id);let e=eQ(t);tH.current=e,I(e)}}ee(e);try{window.localStorage.setItem(tn,e)}catch(e){}},[et,tY,en,Q,K,X,I,J,L,ec.key]),ss=(0,A.useCallback)(e=>{var t;tY((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),el(e.id);let s=eQ(e);tH.current=s,I(s)},[tY,I]);(0,A.useEffect)(()=>{if("pro"!==Q||!en)return;let e=et.find(e=>e.id===en);if(!e)return;let t=eQ(e);tH.current=t,I(t)},[Q,en,et,I]);let sn=(0,A.useCallback)(async()=>{let e=tH.current.trim();if(!e)return;let t=++tK.current;eh(!0),em(null);try{var s;let n=new URLSearchParams({process:e,_ts:String(Date.now())}),l=await H("/get_config?".concat(n));if(t!==tK.current||e!==tH.current.trim())return;let i=null!==(s=l.content)&&void 0!==s?s:"";eo(i),ed(eS(i))}catch(s){if(t!==tK.current||e!==tH.current.trim())return;em(s.message)}finally{t===tK.current&&eh(!1)}},[H]);(0,A.useEffect)(()=>{U&&("pro"!==Q||tJ&&U===eQ(tJ))&&(tG(),sn(),eq(e=>e+1))},[tJ,en,U,sn,Q,tG]);let sl=(0,A.useCallback)(async()=>{var e;if(!tJ||!t3)throw Error(L("请选择线路","Pick a lane"));if(!t7.ok)throw Error(t7.message);let t=tO.current,s=et.map(e=>e.id===tJ.id?{...e,name:t7.normalizedName,streamKey:t7.normalizedStreamKey,pm2Name:t7.normalizedPm2,notes:t7.normalizedNotes,urlLines:t}:e);return t0(s),await t5(s,{force:!0}),eU(e=>({...e,[tJ.id]:{name:t7.normalizedName,streamKey:t7.normalizedStreamKey,pm2Name:t7.normalizedPm2,notes:t7.normalizedNotes}})),{next:s,savedLane:null!==(e=s.find(e=>e.id===tJ.id))&&void 0!==e?e:{...tJ,name:t7.normalizedName,streamKey:t7.normalizedStreamKey,pm2Name:t7.normalizedPm2,notes:t7.normalizedNotes,urlLines:t},pm2:t7.normalizedPm2}},[tJ,t3,t7,t0,et,t5,L]),si=(0,A.useCallback)(async()=>{if(tJ){eZ(!0),eY(null);try{let e=await sl();I(e.pm2),eY(L("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;eY(e),K(e)}finally{eZ(!1)}}},[tJ,K,sl,I,L]),sa=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tH.current,s=t.trim();if(!s){em(L("请选择进程","Pick a process"));return}eh(!0),em(null);try{let t=new URLSearchParams({process:s});await H("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),eo(e),t1(s,{streamKey:eS(e).key}),em(L("youtube.ini 已保存","youtube.ini saved"))}catch(e){em(e.message)}finally{eh(!1)}},sr=async()=>{let e=eR(ec);await sa(e)},so=async()=>{eh(!0),em(null);try{var e,t;let s=er||eR(ec),n=await H("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:(t=tH.current,"youtube.".concat(t.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")),content:s,action:"youtube_balanced_preset"})}),l=null!==(e=n.content)&&void 0!==e?e:s;eo(l),ed(eS(l)),em(n.message||L("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){em(e.message)}finally{eh(!1)}},sc=(0,A.useMemo)(()=>{var e,t;if("single"===Q)return ew("key = ".concat(ec.key));let s=null!==(t=null!==(e=null==t3?void 0:t3.streamKey)&&void 0!==e?e:null==tJ?void 0:tJ.streamKey)&&void 0!==t?t:"";return ew("key = ".concat(s))},[Q,null==tJ?void 0:tJ.streamKey,ec.key,null==t3?void 0:t3.streamKey]),sd=sc?"…".concat(sc):"—",sx=async()=>{if(tJ)try{eZ(!0),eY(null),tW.current+=1;let e=tO.current,t=await sl();I(t.pm2),await Promise.resolve(B(e,t.pm2)),tA.current=!1,eY(L("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);eY(e),K(e)}finally{eZ(!1)}},sm=async()=>{let e=tH.current.trim();if(!e){K(L("请选择进程","Pick a process"));return}try{tW.current+=1,await Promise.resolve(B(tD.current,e)),t1(e,{urlLines:tD.current}),tA.current=!1}catch(e){}},su=async()=>{let e="single"===Q?tD.current:tO.current;eP(!0),eM(null);try{var t;let s=await H("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eC(tH.current),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===Q?tF(n):tY(n),tA.current=!0,eM(s.message||L("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){eM(e.message)}finally{eP(!1)}},sh=async()=>{if(!tJ||!t3)return;let e=eS(er||eR(ec)),t=eR({key:t3.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});eZ(!0),eY(null);try{let e=await sl();I(e.pm2),await sa(t,e.pm2),eY(L("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;eY(e),K(e)}finally{eZ(!1)}},sp="single"===Q?ei:ep,sb=(0,A.useMemo)(()=>tk(sp).length,[sp]),sg=(0,A.useMemo)(()=>ej(sp).length,[sp]),sv=(0,A.useMemo)(()=>(0,eK.O0)(Y),[Y]),sf=(0,A.useMemo)(()=>(0,eK.U_)(sv,"pro"===Q&&tJ?et.findIndex(e=>e.id===tJ.id):0),[tJ,et,Q,sv]),sy=sf.link?(0,ev.p)(sf.link.url):(0,ev.p)("http://live.local:9200/"),sw=(0,A.useMemo)(()=>(0,eK.Tc)(sv),[sv]),sj=(0,A.useMemo)(()=>{var e;return[null===(e=sf.link)||void 0===e?void 0:e.url,null==Y?void 0:Y.chromium_remote_debug,null==Y?void 0:Y.srs_api].filter(e=>!!e)},[Y,null===(t=sf.link)||void 0===t?void 0:t.url]),sN=(0,A.useCallback)(async(e,t)=>{if(!tE&&("delete"!==t||window.confirm("".concat(e.label,": 删除容器?浏览器配置和登录数据会保留,之后点“启动”会自动重建。")))){tU("".concat(e.id,":").concat(t)),tZ(null);try{let s=await H("/neko/instance_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,action:t})}),n=s.running?L("运行中","running"):s.exists?L("已停止","stopped"):L("容器不存在","missing"),l=s.message||"".concat(e.label,": ").concat(n);tZ("".concat(l," \xb7 ").concat(n))}catch(t){let e=t.message;tZ(e),K(e)}finally{tU(null)}}},[H,tE,K,L]),sk=(0,A.useCallback)(async e=>{let t=tJ?eQ(tJ):"";return tJ&&e===t?await sl():(t0(et),await t5(et,{force:!0}),{next:et,savedLane:null!=tJ?tJ:null,pm2:e})},[tJ,t0,et,sl,t5]),s_=(0,A.useCallback)(async(e,t)=>{let s=!!tJ&&eQ(tJ)===t;if("stop"!==e){var n,l;let e=et,s=t;try{let n=await sk(t);e=n.next,s=n.pm2}catch(e){K("".concat(L("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>eQ(e)===s),a=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()){K(L("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!tk(a).length){K(L("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&I(t),O(e,t)},[tJ,et,sk,K,O,I,L]),sz=(0,A.useCallback)(async e=>{tR(!0);try{let t=await H("/hub/youtube/live/summary");e0(t);let s=null!=e?e:null==e2?void 0:e2.id;if(s){let e=await H("/hub/youtube/live/events/".concat(encodeURIComponent(String(s))));e.event&&tS(e.event)}}catch(e){}finally{tR(!1)}},[H,null==e2?void 0:e2.id]),sS=(0,A.useCallback)(async e=>{tR(!0);try{let t=await H("/hub/youtube/live/events/".concat(encodeURIComponent(String(e))));tS(t.event||null)}catch(e){K(e.message)}finally{tR(!1)}},[H,K]);(0,A.useEffect)(()=>{sz(null);let e=window.setInterval(()=>void sz(),4e3);return()=>window.clearInterval(e)},[sz]);let sC=(0,A.useCallback)(async()=>{tM(!0);try{let e=await H("/hub/youtube/quality_guard");tT(e)}catch(e){}finally{tM(!1)}},[H]);(0,A.useEffect)(()=>{sC();let e=window.setInterval(()=>void sC(),6e3);return()=>window.clearInterval(e)},[sC]);let sR=!!M||eu||ek||ez||eI,sP="single"===Q?tQ:tX,sT=to(t$(U)),sL=tr(sP,ei),sM=tJ?tr(tV(eQ(tJ)),ep||tJ.urlLines||""):"",sE=e=>{var t;let s=(null===(t=sf.link)||void 0===t?void 0:t.id)===e.id,l=tE==="".concat(e.id,":start"),i=tE==="".concat(e.id,":stop"),a=tE==="".concat(e.id,":delete"),r=!!tE;return(0,n.jsxs)("div",{className:"flex min-h-[2.5rem] items-stretch overflow-hidden rounded-lg border text-xs ring-1 ".concat(s?"border-emerald-400/30 bg-emerald-500/15 text-emerald-50 ring-emerald-400/25":"border-white/10 bg-white/5 text-zinc-200 ring-white/10"),children:[(0,n.jsxs)("a",{href:(0,ev.p)(e.url),target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 px-3 py-2 hover:bg-white/[0.04]",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] text-emerald-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"font-mono text-white/70",children:[e.host||"",e.port?":".concat(e.port):""]})]}),(0,n.jsxs)("div",{className:"flex border-l border-white/10",children:[(0,n.jsxs)("button",{type:"button",disabled:r,title:L("启动 Neko 容器","Start Neko container"),onClick:()=>void sN(e,"start"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 px-2 text-emerald-100 hover:bg-emerald-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[l?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)($.Z,{className:"h-3.5 w-3.5"}),L("启动","Start")]}),(0,n.jsxs)("button",{type:"button",disabled:r,title:L("停止 Neko 容器","Stop Neko container"),onClick:()=>void sN(e,"stop"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-amber-100 hover:bg-amber-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[i?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(eD.Z,{className:"h-3.5 w-3.5"}),L("停止","Stop")]}),(0,n.jsxs)("button",{type:"button",disabled:r,title:L("删除容器,保留浏览器配置数据","Delete container, keep browser profile data"),onClick:()=>void sN(e,"delete"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-rose-100 hover:bg-rose-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[a?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),L("删除","Delete")]})]})]},e.key)},sU=(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:eg,onChange:e=>eN(e.target.checked)}),L("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>void tq(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:L("手动重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>void su(),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:ez?L("去重中...","Deduplicating..."):L("智能去重","Deduplicate")})]}),sI=(null==eX?void 0:eX.active)||[],sZ=(null==eX?void 0:eX.latest)||[],sA=(null==eX?void 0:eX.alerts)||[],sD=(null==eX?void 0:eX.stats)||{},sO=[{label:L("活动事件","Active"),value:null!==(r=sD.active_events)&&void 0!==r?r:sI.length,Icon:a.Z},{label:L("历史事件","History"),value:null!==(o=sD.total_events)&&void 0!==o?o:sZ.length,Icon:eO.Z},{label:L("采样点","Samples"),value:null!==(d=sD.sample_count)&&void 0!==d?d:0,Icon:eB.Z},{label:L("峰值在线","Viewer peak"),value:null!==(x=sD.viewer_peak)&&void 0!==x?x:0,Icon:eH.Z},{label:L("累计时长","Total duration"),value:td(sD.total_duration_seconds),Icon:k.Z}],sB=(0,n.jsxs)("section",{className:"rounded-2xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.08] via-zinc-950/80 to-emerald-500/[0.05] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start 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)(eB.Z,{className:"h-4 w-4 text-cyan-300"}),L("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:L("事件、转播对象、时长、页面采集、弹窗和告警全部写入本地 SQLite,可追溯。","Events, source rooms, duration, browser telemetry, popups, and alerts are stored locally.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sz(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tC?"animate-spin":"")}),L("刷新事件","Refresh events")]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-5",children:sO.map(e=>{let{label:t,value:s,Icon:l}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-zinc-500",children:[(0,n.jsx)(l,{className:"h-3.5 w-3.5 text-cyan-300"}),t]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-lg font-semibold text-white",children:String(s)})]},t)})}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(22rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:L("正在转播","Active relay")}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-100 ring-1 ring-emerald-500/25",children:sI.length})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[(sI.length?sI:sZ.slice(0,1)).map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>void sS(e.id),className:"block w-full rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2 text-left transition hover:bg-white/[0.06]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.source_title||e.channel_name||e.source_room_id||e.process||"#".concat(e.id)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tm(e.status)),children:e.status||"event"})]}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:e.process||"-"}),(0,n.jsx)("span",{children:e.source_room_id?"room:".concat(e.source_room_id):L("未知来源","unknown source")}),(0,n.jsx)("span",{children:td(e.duration_seconds)}),(0,n.jsx)("span",{children:null!=e.last_viewer_count?"".concat(e.last_viewer_count," online"):""})]})]},e.id)),sI.length||sZ.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:L("暂无事件;开始直播或打开 Neko 中的 YouTube Studio 后会自动生成。","No events yet. Start a relay or open YouTube Studio in Neko.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:L("最近事件","Recent events")}),(0,n.jsx)("div",{className:"mt-3 divide-y divide-white/[0.06]",children:sZ.slice(0,8).map(e=>{var t;return(0,n.jsxs)("button",{type:"button",onClick:()=>void sS(e.id),className:"flex w-full items-center justify-between gap-3 py-2 text-left",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.source_title||e.source_room_id||e.channel_name||e.process||"#".concat(e.id)}),(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[10px] text-zinc-600",children:[tx(e.started_at)," \xb7 ",td(e.duration_seconds)]})]}),(0,n.jsxs)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tm(e.status)),children:[null!==(t=e.quality_score)&&void 0!==t?t:0,"/100"]})]},e.id)})})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",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-200/90",children:L("事件详情页","Event detail")}),e2?(0,n.jsx)("button",{type:"button",onClick:()=>tS(null),className:"text-[11px] text-zinc-500 hover:text-zinc-300",children:L("收起","Close")}):null]}),e2?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:e2.source_title||e2.source_room_id||e2.process}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tm(e2.status)),children:e2.status})]}),(0,n.jsxs)("div",{className:"mt-2 grid gap-2 text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Process:"})," ",e2.process||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Room:"})," ",e2.source_room_id||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Started:"})," ",tx(e2.started_at)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Duration:"})," ",td(e2.duration_seconds)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Viewers:"})," ",null!==(m=e2.last_viewer_count)&&void 0!==m?m:"-"," / peak ",null!==(u=e2.viewer_peak)&&void 0!==u?u:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Health:"})," ",e2.last_health||e2.last_live_status||"-"]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[e2.source_url?(0,n.jsx)("a",{href:e2.source_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-[11px] text-violet-100 ring-1 ring-violet-500/25",children:L("打开源直播间","Open source")}):null,e2.last_page_url?(0,n.jsx)("a",{href:e2.last_page_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-[11px] text-cyan-100 ring-1 ring-cyan-500/25",children:L("打开 Studio 页面","Open Studio page")}):null]})]}),(e2.alerts||sA).slice(0,4).length?(0,n.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/[0.06] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-xs font-semibold text-amber-100",children:[(0,n.jsx)(ey.Z,{className:"h-3.5 w-3.5"}),L("弹窗 / 告警","Popups / alerts")]}),(0,n.jsx)("div",{className:"mt-2 space-y-1",children:(e2.alerts||sA).slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"text-[11px] text-amber-100/85",children:[e.title||e.severity||"alert",": ",e.message||"-"]},"".concat(e.id||t)))})]}):null,(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-xs font-semibold text-zinc-300",children:L("采样时间线","Sample timeline")}),(0,n.jsxs)("div",{className:"mt-2 max-h-52 space-y-2 overflow-auto pr-1",children:[(e2.samples||[]).slice(0,12).map(e=>{var t;return(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-2 py-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:tx(e.ts)}),(0,n.jsx)("span",{children:e.source||"sample"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-300",children:[e.live_status||"-"," \xb7 ",e.health||"-"," \xb7 ",null!==(t=e.viewer_count)&&void 0!==t?t:"-"," online"]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-[10px] text-amber-100/80",children:e.popup_text}):null]},e.id)}),(e2.samples||[]).length?null:(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("暂无采样;Chrome 扩展或状态接口会自动写入。","No samples yet. The Chrome extension or status API will fill this.")})]})]})]}):(0,n.jsx)("p",{className:"mt-3 text-xs text-zinc-600",children:L("选择左侧事件查看完整详情。","Select an event to see details.")})]})]})]}),sH=[...sI,...sZ.filter(e=>!sI.some(t=>t.id===e.id))].slice(0,12),sW=e2||sH[0]||null,sK=(null==sW?void 0:sW.samples)||[],sF=(null==sW?void 0:null===(s=sW.alerts)||void 0===s?void 0:s.length)?sW.alerts:sA,sY=[{label:L("正在直播","Live now"),value:String(null!==(h=sD.active_events)&&void 0!==h?h:sI.length),helper:L("当前仍在推流的场次","Events still pushing"),Icon:V.Z,tone:"text-emerald-200"},{label:L("总场次","Total events"),value:String(null!==(p=sD.total_events)&&void 0!==p?p:sZ.length),helper:L("本机数据库里的直播记录","Stored locally"),Icon:eO.Z,tone:"text-cyan-200"},{label:L("累计时长","Total duration"),value:tg(sD.total_duration_seconds,L),helper:L("已结束场次累计","Ended events total"),Icon:k.Z,tone:"text-violet-200"},{label:L("最高在线","Peak viewers"),value:th(null!==(b=sD.viewer_peak)&&void 0!==b?b:0,L),helper:L("Chrome/Studio 采集峰值","Captured from Studio"),Icon:eH.Z,tone:"text-amber-200"}],sG=(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/90 p-6 ring-1 ring-cyan-500/10",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(eB.Z,{className:"h-5 w-5 text-cyan-300"}),L("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:L("这里按运营视角展示:谁在播、转播哪个直播间、播了多久、观众多少、Studio 是否弹窗、有没有异常。机器编号只放在详情底部。","Built for operators: what is live, source room, duration, viewers, Studio popups, and issues. Technical ids stay in the detail footer.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sz(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tC?"animate-spin":"")}),L("刷新","Refresh")]})]}),(0,n.jsx)("div",{className:"mt-5 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:sY.map(e=>{let{label:t,value:s,helper:l,Icon:i,tone:a}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.035] p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)(i,{className:"h-4 w-4 ".concat(a)})]}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold tracking-tight text-white",children:s}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-600",children:l})]},t)})}),(0,n.jsxs)("div",{className:"mt-6 grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(25rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:sI.length?L("正在直播","Live now"):L("最近直播记录","Recent live events")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:sI.length?L("优先显示还在推流的场次。","Active relays are listed first."):L("当前没有正在直播的场次,下方是最近历史。","Nothing is live now; showing recent history.")})]}),(0,n.jsxs)("span",{className:"rounded-full bg-cyan-500/10 px-2.5 py-1 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:[sH.length," ",L("条记录","records")]})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[sH.map(e=>{var t;let s=(null==sW?void 0:sW.id)===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>void sS(e.id),className:"grid w-full gap-3 px-4 py-4 text-left transition md:grid-cols-[minmax(0,1fr)_8rem_7rem_7rem] ".concat(s?"bg-cyan-500/[0.08]":"hover:bg-white/[0.04]"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tm(e.status)),children:tu(e.status,L)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(ty(e)),children:tf(e,L)})]}),(0,n.jsx)("p",{className:"mt-2 truncate text-sm font-semibold text-white",children:tp(e,L)}),(0,n.jsxs)("p",{className:"mt-1 truncate text-xs text-zinc-500",children:[tb(e,L)," ","->"," YouTube"]})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("开始","Started")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tv(e.started_at)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tg(e.duration_seconds,L)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("在线/峰值","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-zinc-300",children:[th(e.last_viewer_count,L)," / ",th(null!==(t=e.viewer_peak)&&void 0!==t?t:0,L)]})]})]},e.id)}),sH.length?null:(0,n.jsxs)("div",{className:"px-4 py-10 text-center",children:[(0,n.jsx)(c.Z,{className:"mx-auto h-8 w-8 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:L("还没有直播记录","No live events yet")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-600",children:L("启动转播或在 Neko 打开 YouTube Studio 后,这里会自动生成可追溯记录。","Start a relay or open YouTube Studio in Neko to create traceable records.")})]})]})]}),(0,n.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:sW?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-cyan-300",children:L("这场直播","Selected event")}),(0,n.jsx)("h4",{className:"mt-1 truncate text-lg font-semibold text-white",children:tp(sW,L)}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-500",children:[tb(sW,L)," ","->"," YouTube"]})]}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs ring-1 ".concat(tm(sW.status)),children:tu(sW.status,L)})]})}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("直播时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:tg(sW.duration_seconds,L)}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tx(sW.started_at)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("观众","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[th(sW.last_viewer_count,L),(0,n.jsxs)("span",{className:"ml-2 text-xs font-normal text-zinc-500",children:[L("峰值","peak")," ",th(null!==(g=sW.viewer_peak)&&void 0!==g?g:0,L)]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:L("来自 Chrome 插件/Studio 页面采集","Captured from Studio")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:L("Studio 状态","Studio status")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(ty(sW)),children:tf(sW,L)})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 text-sm text-zinc-300",children:[(0,n.jsx)("p",{children:sW.last_live_status||sW.last_health||L("暂未采集到 Studio 状态","No Studio status captured yet")}),sW.last_popup_text?(0,n.jsx)("p",{className:"rounded-md border border-amber-500/20 bg-amber-500/[0.08] px-3 py-2 text-xs text-amber-100",children:sW.last_popup_text}):(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:L("没有记录到弹窗。","No popup recorded.")}),sW.last_page_title||sW.last_page_url?(0,n.jsx)("p",{className:"truncate text-xs text-zinc-500",children:sW.last_page_title||sW.last_page_url}):null]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[sW.source_url?(0,n.jsxs)("a",{href:sW.source_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/25",children:[L("打开源直播间","Open source")," ",(0,n.jsx)(G.Z,{className:"h-3 w-3"})]}):null,sW.last_page_url?(0,n.jsxs)("a",{href:sW.last_page_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-xs text-cyan-100 ring-1 ring-cyan-500/25",children:[L("打开 Studio","Open Studio")," ",(0,n.jsx)(G.Z,{className:"h-3 w-3"})]}):null]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:L("采样时间线","Telemetry timeline")}),(0,n.jsxs)("div",{className:"mt-3 max-h-64 space-y-2 overflow-auto pr-1",children:[sK.slice(0,10).map(e=>(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-400",children:tv(e.ts)}),(0,n.jsx)("span",{className:"text-zinc-600",children:e.source||L("采样","sample")})]}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-200",children:[e.live_status||e.health||L("状态未识别","Unknown status"),(0,n.jsxs)("span",{className:"ml-2 text-xs text-zinc-500",children:[L("在线","online")," ",th(e.viewer_count,L)]})]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-100",children:e.popup_text}):null]},e.id)),sK.length?null:(0,n.jsx)("p",{className:"rounded-md border border-white/[0.05] bg-black/20 px-3 py-3 text-xs text-zinc-500",children:e2?L("这场直播暂时没有采样明细。","No telemetry samples for this event yet."):L("点击左侧记录后加载完整采样明细。","Click a record on the left to load full telemetry samples.")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ey.Z,{className:"h-4 w-4 text-amber-300"}),L("告警和弹窗","Alerts and popups")]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[sF.slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/15 bg-amber-500/[0.06] px-3 py-2 text-xs text-amber-100",children:[e.title||e.severity||L("提示","Notice"),": ",e.message||"-"]},"".concat(e.id||t))),sF.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:L("没有告警。","No alerts.")})]})]}),(0,n.jsxs)("p",{className:"truncate text-[11px] text-zinc-700",children:[L("技术标识","Technical id"),": #",sW.id," \xb7 ",sW.process||"-"," \xb7 ",sW.event_uuid||"-"]})]}):(0,n.jsxs)("div",{className:"flex min-h-[24rem] flex-col items-center justify-center text-center",children:[(0,n.jsx)(eB.Z,{className:"h-10 w-10 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:L("等待第一场直播","Waiting for the first live event")}),(0,n.jsx)("p",{className:"mt-1 max-w-sm text-xs text-zinc-600",children:L("开始转播后,这里会变成这场直播的详情页。","After a relay starts, this panel becomes the event detail page.")})]})})]})]}),sq=(null==tP?void 0:tP.summary)||{},sJ=(null==tP?void 0:tP.lanes)||[],sV=(null==tP?void 0:tP.recommendations)||[],s$=(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/90 to-cyan-500/[0.06] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(a.Z,{className:"h-5 w-5 text-emerald-300"}),L("算法友好质量守护","Algorithm-friendly quality guard")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:L("目标不是刷数据,而是让直播信号长期稳定:不断流、不卡顿、Studio 状态可见、异常能追踪。","The goal is stable, policy-safe signal quality: no drops, no stalls, visible Studio state, and traceable issues.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sC(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tL?"animate-spin":"")}),L("重新检测","Check now")]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 md:grid-cols-[12rem_minmax(0,1fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:L("综合分","Score")}),(0,n.jsx)("p",{className:"mt-2 text-5xl font-semibold tracking-tight ".concat(tw(null==tP?void 0:tP.score)),children:null!==(v=null==tP?void 0:tP.score)&&void 0!==v?v:0}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-600",children:L("80 以上适合长时间无人值守","80+ is suitable for long unattended runs")})]}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[[L("推流线路","Lanes"),"".concat(null!==(f=sq.pushing_lanes)&&void 0!==f?f:0,"/").concat(null!==(j=sq.lanes)&&void 0!==j?j:0)],[L("活动事件","Active events"),String(null!==(N=sq.active_events)&&void 0!==N?N:0)],[L("Studio 采样","Studio samples"),String(null!==(_=sq.sample_count)&&void 0!==_?_:0)],[L("最高在线","Viewer peak"),th(null!==(z=sq.viewer_peak)&&void 0!==z?z:0,L)]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold text-white",children:s})]},t)})})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,0.8fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:L("线路质量","Lane quality")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:L("从进程、FFmpeg 日志、配置和事件采样综合判断。","Combined from process state, FFmpeg logs, config, and event telemetry.")})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[sJ.map(e=>{var t,s,l,i,a,r,o,c,d;let x=(e.source_display||e.source_title||"").trim()||e.label||e.process||"-",m=[e.label,e.process].filter(Boolean).join(" \xb7 ");return(0,n.jsxs)("div",{className:"grid gap-3 px-4 py-4 md:grid-cols-[minmax(0,1fr)_6rem_14rem]",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:x}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.is_pushing?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"),children:e.is_pushing?L("推流中","Pushing"):L("未推流","Idle")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.rtmps?"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25":"bg-amber-500/15 text-amber-100 ring-amber-500/25"),children:e.rtmps?"RTMPS":L("非 RTMPS","No RTMPS")})]}),(0,n.jsx)("p",{className:"mt-1 truncate text-xs text-zinc-600",children:m||"-"}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(e.issues||[]).slice(0,3).map((e,t)=>(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tj(e.level)),children:e.text||e.level},"".concat(e.text||t)))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:L("分数","Score")}),(0,n.jsx)("p",{className:"mt-1 text-2xl font-semibold ".concat(tw(e.score)),children:null!==(r=e.score)&&void 0!==r?r:0})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2 font-mono text-[11px] text-zinc-300",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"fps"}),tN(null===(t=e.metrics)||void 0===t?void 0:t.fps)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"speed"}),tN(null===(s=e.metrics)||void 0===s?void 0:s.speed,"x")]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"kbps"}),tN(null===(l=e.metrics)||void 0===l?void 0:l.bitrate)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"drop"}),null!==(o=null===(i=e.metrics)||void 0===i?void 0:i.drop)&&void 0!==o?o:"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"urls"}),null!==(c=e.url_count)&&void 0!==c?c:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"err"}),null!==(d=null===(a=e.metrics)||void 0===a?void 0:a.error_count)&&void 0!==d?d:0]})]})]},e.process||e.label)}),sJ.length?null:(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sm text-zinc-500",children:L("没有发现 YouTube 线路。","No YouTube lanes found.")})]})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:L("下一步建议","Next actions")}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[sV.slice(0,6).map((e,t)=>(0,n.jsx)("p",{className:"rounded-lg px-3 py-2 text-xs ring-1 ".concat(tj(e.level)),children:e.text||"-"},"".concat(e.text||t))),sV.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:L("暂无建议。","No recommendations.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:"FFmpeg"}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:(null==tP?void 0:null===(l=tP.ffmpeg_profile)||void 0===l?void 0:l.target)||"1080p30 / RTMPS / AAC / stable relay"}),(0,n.jsx)("ul",{className:"mt-3 space-y-1.5 text-xs text-zinc-500",children:((null==tP?void 0:null===(i=tP.ffmpeg_profile)||void 0===i?void 0:i.guardrails)||[]).slice(0,4).map(e=>(0,n.jsxs)("li",{children:["- ",e]},e))})]})]})]})]});return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[F?(0,n.jsx)(ef,{t:L,title:L("YouTube 转播链路","YouTube relay chain"),subtitle:L("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:F,steps:[{label:"ShellCrash",sub:L("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:L("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:sf.link?"".concat(L("Chromium 工作室","Chromium studio")," \xb7 ").concat(sf.link.label):L("Chromium 工作室","Chromium studio"),gradient:"from-emerald-400 to-teal-500",openUrl:sy}]}):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:L("YouTube 无人直播","YouTube unmanned live")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:L("单路一条流;多路时每条线路独立保存自己的密钥、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:"ml-auto flex shrink-0 self-start rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>st("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===Q?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:L("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>st("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===Q?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:L("多频道 Pro","Multi Pro")})]})]})}),sj.length?(0,n.jsxs)("div",{className:"space-y-2",children:[tI?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:tI}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[sf.link?(0,n.jsx)("a",{href:sy,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:L("打开当前线路 Neko 工作室","Open lane Neko studio")}):null,sv.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:sv.map(e=>sE(e))}):null,(null==Y?void 0:Y.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,ev.p)(Y.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:L("打开 Chromium 调试","Open Chromium debug")}):null,(null==Y?void 0:Y.srs_api)?(0,n.jsx)("a",{href:(0,ev.p)(Y.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:L("打开 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)(V.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:L("直播开关","Live control")})]}),"single"===Q?(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:L("转播任务","Relay task")}),(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:U,onChange:e=>{let t=e.target.value;tH.current=t,I(t)},children:[U&&!J.some(e=>e.pm2===U)?(0,n.jsxs)("option",{value:U,children:[U,tX?" (".concat(tc(tX,L),")"):""]}):null,J.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=te(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,L)," (",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)(tz,{kind:"start",targetPm2:U,busy:M,online:sT,label:L("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>O("start",U),notify:K,t:L}),(0,n.jsx)(tz,{kind:"stop",targetPm2:U,busy:M,online:sT,label:L("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>O("stop",U),notify:K,t:L}),(0,n.jsx)(tz,{kind:"restart",targetPm2:U,busy:M,online:sT,label:L("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>O("restart",U),notify:K,t:L})]}),(0,n.jsxs)("p",{className:"mt-3 text-center text-xs text-zinc-400",children:[L("当前状态","Current state"),": ",tc(sP,L)]}),(0,n.jsx)("p",{className:"mt-2 text-center text-sm font-semibold text-white",children:sL||L("未配置抖音直播源","No Douyin source configured")}),(0,n.jsxs)("p",{className:"mt-3 text-center font-mono text-[11px] text-zinc-600",children:["key ",L("尾码","suffix"),": ",sd]})]}):(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:L("Pro 转播实况","Pro relay status")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:L("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),sw?(0,n.jsxs)("p",{className:"mt-2 text-[11px] text-zinc-500",children:[L("Neko 实例","Neko instances"),": ",sw]}):null,(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:et.map(e=>{var t,s,l,i;let a=eQ(e),r=tV(a),o=t$(a),c=en===e.id,d=c?ep:(null!==(t=e.urlLines)&&void 0!==t?t:"").trim(),x=c?null!==(l=null!==(s=null==t3?void 0:t3.streamKey)&&void 0!==s?s:e.streamKey)&&void 0!==l?l:"":null!==(i=e.streamKey)&&void 0!==i?i:"",m=tk(d),u=ej(d),h=u[0],p=ew("key = ".concat(x)),b=to(o),g=et.findIndex(t=>t.id===e.id),v=(0,eK.U_)(sv,g).link,f=eJ(e.name,g>=0?g:0),y=tr(r,d);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(c?"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:()=>{tH.current=eQ(e),ss(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:y||L("未配置抖音直播源","No Douyin source")}),(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||"youtube_key_rejected"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":to(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"}(r)),children:tc(r,L)}),v?(0,n.jsxs)("span",{className:"shrink-0 rounded-md bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25",children:[v.label," \xb7 ",v.accessLabel]}):null]}),(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",{title:f,children:[L("线路","Lane")," ",f]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["key …",p||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:a,children:a}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",m.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",u.length]})]}),h?(0,n.jsx)("a",{href:h,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:h,children:y?"".concat(L("打开源站","Open source")," \xb7 ").concat(h.replace(/^https?:\/\//,"")):h.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)(tz,{kind:"start",targetPm2:a,busy:M,online:b,label:L("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void s_("start",a),notify:K,t:L,compact:!0}),(0,n.jsx)(tz,{kind:"stop",targetPm2:a,busy:M,online:b,label:L("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void s_("stop",a),notify:K,t:L,compact:!0}),(0,n.jsx)(tz,{kind:"restart",targetPm2:a,busy:M,online:b,label:L("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void s_("restart",a),notify:K,t:L,compact:!0}),v?(0,n.jsxs)("button",{type:"button",onClick:()=>{window.open((0,ev.p)(v.url),"_blank","noopener,noreferrer")},className:"inline-flex min-h-[2rem] items-center justify-center rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5 text-emerald-100 ring-1 ring-emerald-500/20 transition hover:bg-emerald-500/20",title:"".concat(L("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(v.label).concat(v.port?" :".concat(v.port):""),"aria-label":"".concat(L("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(v.label),children:[(0,n.jsx)("span",{className:"sr-only",children:L("打开该线路 Neko 工作室","Open this lane's Neko studio")}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"\uD83D\uDC31"}),(0,n.jsx)(G.Z,{className:"ml-1 h-3.5 w-3.5 shrink-0","aria-hidden":!0})]}):null]})]},e.id)})})]})})]}),"single"===Q?(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:L("YouTube 相关设置","YouTube settings")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:L("串流参数写进 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:L("串流密钥","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:ec.key,onChange:e=>ed(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:ec.rtmps?"1":"0",onChange:e=>ed(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:L("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:L("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[L("比特率 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:ec.bitrate,onChange:e=>ed(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:ec.fastAudio,onChange:e=>ed(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",L("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:sR,onClick:()=>void sn(),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)(w.Z,{className:"h-3.5 w-3.5 ".concat(eu?"animate-spin":"")}),L("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:sR,onClick:()=>void sr(),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:[eu?(0,n.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):null,L("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>void so(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:L("平衡预设","Balanced preset")}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>{ed(eS(er)),em(L("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:L("从原文同步表单","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:L("高级: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:er,onChange:e=>eo(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:sR,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void sa(er),children:L("保存原文","Save raw")})]}),ex?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:ex}):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:[L("当前线路","Current lane"),tJ?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",sM||L("未配置抖音直播源","No Douyin source")]}):null,se?(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:L("有未保存修改","Unsaved")}):null]}),tJ?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:[L("配置名","Config"),": ",eJ(tJ.name,Math.max(0,et.findIndex(e=>e.id===tJ.id)))," \xb7 PM2: ",t6,t9?" → ".concat(t8):""," \xb7 ","key ",L("尾码","suffix"),": ",sd]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:sR,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=e6(),t={id:e,name:"".concat(L("线路","Ch")," ").concat(et.length+1),streamKey:"",urlLines:"",pm2Name:e8(e),notes:""};eU(s=>({...s,[e]:ti(t)})),t2([...et,t],{force:!0}),el(e),tH.current=eQ(t),I(tH.current),tY("")},children:[(0,n.jsx)(eW.Z,{className:"h-3.5 w-3.5"}),L("新增线路","Add lane")]})]}),tJ?(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!==(S=null==t3?void 0:t3.name)&&void 0!==S?S:"",onChange:e=>t4("name",e.target.value),placeholder:L("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:L("串流密钥","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!==(C=null==t3?void 0:t3.streamKey)&&void 0!==C?C:"",onChange:e=>t4("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:sR,onClick:()=>void si(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:eI?L("保存中...","Saving..."):L("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>void sh(),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:L("写入 youtube.ini","Write youtube.ini")})]}),t7.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:t7.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:L("高级:进程名","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!==(R=null==t3?void 0:t3.pm2Name)&&void 0!==R?R:e8(tJ.id),onChange:e=>t4("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[L("实际生效","Effective"),": ",t8||"—"]}),t7.message&&!t7.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:t7.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!==(P=null==t3?void 0:t3.notes)&&void 0!==P?P:"",onChange:e=>t4("notes",e.target.value),placeholder:L("备注(可选)","Notes (optional)")}),eA?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:eA}):null,(0,n.jsxs)("button",{type:"button",disabled:sR||et.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=et.filter(e=>e.id!==tJ.id);eU(e=>{let t={...e};return delete t[tJ.id],t}),t2(t,{force:!0}),el((null===(e=t[0])||void 0===e?void 0:e.id)||"")},children:[(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),L("删除此线路","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:L("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:L("每条线路独立写入自己的 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:U?eC(U):"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:[L("有效地址","Valid URLs"),": ",sb]}),(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: ",sg]})]}),sU,eL?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eL}):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:ep,onChange:e=>{tA.current=!0,tY(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:sR,onClick:()=>void sx(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:L("保存地址","Save URLs")})})]})]}),"single"===Q?(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:L("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:L("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:U?eC(U):"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:[L("有效地址","Valid URLs"),": ",sb]}),(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: ",sg]})]}),sU,eL?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eL}):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:ei,onChange:e=>{tA.current=!0,tF(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:sR,onClick:()=>void sm(),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:L("保存 URL 配置","Save URL config")})]}):null,(0,n.jsx)(eT,{t:L,currentProc:U,fetchJson:H,urlListText:"single"===Q?ei:ep,keySuffixUi:sd,showKeyRow:!0,pollMs:800,refreshToken:eG}),s$,sG||sB]})}var tC=s(257);let tR=["dashboard","services","live_youtube","live_tiktok","android","studio","network","settings"],tP=()=>void 0!==tC&&tC.env.NEXT_PUBLIC_API_URL||"";function tT(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function tL(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);if(s<60)return"".concat(s,"m");let n=Math.floor(s/60);return n<48?"".concat(n,"h"):"".concat(Math.floor(n/24),"d")}function tM(e){let t=tT(e);return"—"===t?t:"".concat(t,"/s")}function tE(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 tU(e,t){let s=null!=t?t:(e,t)=>t||e,n=(e||"").trim().toLowerCase();return"connected"===n?s("高速可用","Ready"):"configured"===n?s("已配置","Configured"):"detected"===n?s("接口已起","Detected"):"idle"===n?s("等待握手","Idle"):"stale"===n?s("握手过期","Stale"):"down"===n?s("未连接","Down"):e||"—"}function tI(){var e,t,s,L,H,W,K,F,Y,G,q,J,V,$,X,Q,et,es,en,el,ei,ea,er,eo,ec,ed,ex,em,eu,ep,eb,eg,ef,ey,ew,ej,eN,ek,e_,ez,eS,eC,eR,eP,eT,eL,eM,eE,eU,eI,eA,eD,eO,eB,eH,eW,eF,eY,eG,eq,eJ,eV,e$,eX,eQ,e0,e1,e5,e2,e3,e4,e6,e8,e9,e7,te,tt,ts,tn,tl,ti,ta,tr,to,tc,td,tx,tm,tu,th,tp,tb,tg,tv,tf,ty,tw,tj,tN,tk,t_,tz,tC,tI,tZ,tA,tD,tO,tB,tH,tW,tK;let tF=tP(),[tY,tG]=(0,A.useState)("zh"),[tq,tJ]=(0,A.useState)("dark"),[tV,t$]=(0,A.useState)("dashboard"),[tX,tQ]=(0,A.useState)(!1),[t0,t1]=(0,A.useState)(null),[t5,t2]=(0,A.useState)(null),[t3,t4]=(0,A.useState)(!0),[t6,t8]=(0,A.useState)(null),[t9,t7]=(0,A.useState)(null),[se,st]=(0,A.useState)(null),[ss,sn]=(0,A.useState)(!0),[sl,si]=(0,A.useState)([]),[sa,sr]=(0,A.useState)([]),[so,sc]=(0,A.useState)(""),[sd,sx]=(0,A.useState)(""),[sm,su]=(0,A.useState)("/sdcard/app.apk"),[sh,sp]=(0,A.useState)(""),[sb,sg]=(0,A.useState)(null),[sv,sf]=(0,A.useState)(null),[sy,sw]=(0,A.useState)(!0),[sj,sN]=(0,A.useState)(!0),[sk,s_]=(0,A.useState)("tencent-relay-wg0"),[sz,sS]=(0,A.useState)(""),[sC,sR]=(0,A.useState)(null),[sP,sT]=(0,A.useState)(null),[sL,sM]=(0,A.useState)(null),[sE,sU]=(0,A.useState)(!1),[sI,sZ]=(0,A.useState)(!0),[sA,sD]=(0,A.useState)("overlay"),[sO,sB]=(0,A.useState)(""),[sH,sW]=(0,A.useState)(""),[sK,sF]=(0,A.useState)(""),[sY,sG]=(0,A.useState)("255.255.255.255"),[sq,sJ]=(0,A.useState)("9"),[sV,s$]=(0,A.useState)([]),[sX,sQ]=(0,A.useState)(""),[s0,s1]=(0,A.useState)(""),[s5,s2]=(0,A.useState)(""),[s3,s4]=(0,A.useState)([]),[s6,s8]=(0,A.useState)(""),[s9,s7]=(0,A.useState)("115200"),[ne,nt]=(0,A.useState)("AT"),[ns,nn]=(0,A.useState)(""),[nl,ni]=(0,A.useState)(null),na=(0,A.useRef)(null),nr=(0,A.useRef)(null),no=(0,A.useRef)(so),nc=(0,A.useRef)(0),nd=(0,A.useRef)(null),nx=(0,A.useCallback)((e,t)=>"zh"===tY?e:t,[tY]),nm=(0,A.useCallback)(e=>{t7(e),null!=nd.current&&window.clearTimeout(nd.current),nd.current=window.setTimeout(()=>{t7(null),nd.current=null},2800)},[]),nu=(0,A.useCallback)(async(e,t)=>(0,ee.N)("".concat(tF).concat(e),t),[tF]),nh=(0,A.useCallback)(async()=>{if(na.current)return na.current;let e=(async()=>{try{var e;let[t,s]=await Promise.allSettled([nu("/hub/dashboard"),nu("/deploy/check")]);if("fulfilled"!==t.status)throw t.reason;let n=t.value;t1(n),t2(null),st(Date.now()),"fulfilled"===s.status?sf(s.value):sf(null);let l=(null===(e=n.android)||void 0===e?void 0:e.devices)||[];if(l.length&&!sh){let e=l.find(e=>"device"===(e.state||"").toLowerCase());sp((null!=e?e:l[0]).serial)}}catch(e){t2(e.message),sf(null)}finally{t4(!1),na.current=null}})();return na.current=e,e},[sh,nu]),np=(0,A.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===tV?e.set("family","youtube"):"live_tiktok"===tV&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[tV]),nb=(0,A.useCallback)(async()=>{if(nr.current)return nr.current;let e=(async()=>{try{let e=(await nu(np)).entries||[];sr(e),si(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),st(Date.now()),sc(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{nr.current=null}})();return nr.current=e,e},[nu,np]);(0,A.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("view");e&&tR.includes(e)?t$(e):"/youtube-events"===window.location.pathname.replace(/\/$/,"")&&t$("live_youtube");let t=window.localStorage.getItem("live-hub-lang");("zh"===t||"en"===t)&&tG(t);let s=window.localStorage.getItem("live-hub-theme");("light"===s||"dark"===s)&&tJ(s)},[]),(0,A.useEffect)(()=>{let e=new URL(window.location.href);"dashboard"===tV?e.searchParams.delete("view"):e.searchParams.set("view",tV),window.history.replaceState(null,"",e.toString())},[tV]),(0,A.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",tY)},[tY]),(0,A.useEffect)(()=>{document.documentElement.setAttribute("data-theme",tq);try{window.localStorage.setItem("live-hub-theme",tq)}catch(e){}},[tq]),(0,A.useEffect)(()=>{let e=()=>sn("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{if(!tX)return;let e=e=>{"Escape"===e.key&&tQ(!1)};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[tX]),(0,A.useEffect)(()=>()=>{null!=nd.current&&window.clearTimeout(nd.current)},[]),(0,A.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&sw(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&sN(!1)}catch(e){}},[]),(0,A.useEffect)(()=>{nh()},[nh]),(0,A.useEffect)(()=>{nb()},[nb]),(0,A.useEffect)(()=>{if(!sy||!ss||"live_youtube"===tV||"live_tiktok"===tV)return;let e=window.setInterval(()=>{nh()},1e4);return()=>clearInterval(e)},[sy,ss,nh,tV]),(0,A.useEffect)(()=>{if(!sy||!ss)return;let e=window.setInterval(()=>{nb()},"live_youtube"===tV||"live_tiktok"===tV?700:4e3);return()=>clearInterval(e)},[sy,ss,nb,tV]),(0,A.useEffect)(()=>{no.current=so},[so]),(0,A.useEffect)(()=>{so&&"live_youtube"===tV&&(async()=>{let e=no.current.trim(),t=++nc.current;try{let s=new URLSearchParams({process:e,_ts:String(Date.now())}),n=await nu("/get_url_config?".concat(s));if(t!==nc.current||e!==no.current.trim())return;sx(n.content||"")}catch(e){}})()},[so,nu,tV]),(0,A.useEffect)(()=>{"settings"===tV&&(async()=>{try{let e=await nu("/hub/config");sg(e)}catch(e){sg(null)}})()},[nu,tV]);let ng=(0,A.useMemo)(()=>{var e;let t=(null==t0?void 0:null===(e=t0.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,ev.p)(n):s[e]=n;return s},[null==t0?void 0:null===(e=t0.stack)||void 0===e?void 0:e.quick_links]),nv=(0,A.useMemo)(()=>{let e=new Map;for(let t of(null==t0?void 0:t0.services)||[])e.set(t.service_id,t);return e},[null==t0?void 0:t0.services]),nf=(0,A.useMemo)(()=>["homeassistant","frigate","ntfy","wol"].map(e=>nv.get(e)).filter(Boolean),[nv]),ny=nv.get("wol"),nw=(0,A.useMemo)(()=>(0,eK.O0)(ng),[ng]),nj=(0,A.useMemo)(()=>(0,eK.Tc)(nw),[nw]),nN=(0,A.useMemo)(()=>((null==sP?void 0:sP.interfaces)||[]).flatMap(e=>e.peers||[]),[null==sP?void 0:sP.interfaces]),nk=(0,A.useMemo)(()=>((null==sP?void 0:sP.interfaces)||[]).flatMap(e=>e.configured_peers||[]),[null==sP?void 0:sP.interfaces]),n_=(0,A.useMemo)(()=>((null==sP?void 0:sP.repo_configs)||[]).flatMap(e=>e.peers||[]).map(e=>({...e,status_source:"config",config_source:"repo"})),[null==sP?void 0:sP.repo_configs]),nz=nN[0]||nk[0]||n_[0]||null,nS=(0,A.useMemo)(()=>{for(let e of[...nN,...nk,...n_]){let t=e.endpoint_host||function(e){let t=(e||"").trim();if(!t)return"";if(t.startsWith("[")){let e=t.indexOf("]");return e>0?t.slice(1,e):""}let s=t.lastIndexOf(":");return s>0?t.slice(0,s):t}(e.endpoint);if(t)return t}return""},[nk,n_,nN]),nC=(null==sC?void 0:null===(t=sC.windows_route_template)||void 0===t?void 0:t.endpoint_host)||(null==sC?void 0:null===(L=sC.peers)||void 0===L?void 0:null===(s=L.find(e=>e.endpoint_host))||void 0===s?void 0:s.endpoint_host)||nS||"",nR=(0,A.useMemo)(()=>{if(!nC)return"";let e=sO.trim()||"",t=sH.trim()||"";return"route -p add ".concat(nC," mask 255.255.255.255 ").concat(e," metric 1 if ").concat(t)},[nC,sO,sH]),nP=(0,A.useCallback)(async()=>{try{var e;let t=await nu("/hub/network/wireguard/status");sT(null!==(e=t.wireguard)&&void 0!==e?e:null)}catch(e){sT(null)}},[nu]),nT=(0,A.useCallback)(async()=>{sU(!0);try{let e=await nu("/hub/network/system_probe");sM(null!=e?e:null)}catch(e){sM(null)}finally{sU(!1)}},[nu]);(0,A.useEffect)(()=>{"network"===tV&&(nP(),nT())},[nT,nP,tV]);let nL=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=sz.trim();if(!t){nm(nx("请先选择或粘贴 WireGuard 配置","Pick or paste a WireGuard config first"));return}t8(e?"wg:apply":"wg:save");try{var s;let n=await nu("/hub/network/wireguard/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:sk,content:t,route_mode:sA,apply:e})});sR(null!==(s=n.wireguard)&&void 0!==s?s:null),await nP(),nm(e?nx("WireGuard 配置已保存并应用","WireGuard config saved and applied"):nx("WireGuard 配置已保存","WireGuard config saved"))}catch(e){nm(e.message)}finally{t8(null)}},nM=async e=>{t8("wg:neko:".concat(e));try{await nu("/hub/network/wireguard/neko_access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,restart:!0})}),await nP(),await nh(),nm("remote"===e?"Neko switched to WireGuard remote access":"Neko switched back to LAN")}catch(e){nm(e.message),await nP()}finally{t8(null)}},nE=async()=>{await nL(!1)},nU=async e=>{let t=(e||"").trim();if(t){t8("wg:load:".concat(t));try{var s;let e=await nu("/hub/network/wireguard/config/".concat(encodeURIComponent(t)));s_(e.name||t),sS(e.content||""),sR(null!==(s=e.wireguard)&&void 0!==s?s:null),sZ(!0),nm(nx("已载入 WireGuard 配置","WireGuard config loaded"))}catch(e){nm(e.message)}finally{t8(null)}}},nI=async e=>{if(e)try{let t=await e.text();sS(t),sk.trim()||s_(e.name.replace(/\.conf$/i,""))}catch(e){nm(e.message)}},nZ=async(e,t)=>{t8("svc:".concat(e));try{let s=await nu("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?nm(s.detail||s.message||nx("操作失败","Action failed")):nm(s.message||"OK"),await nh()}catch(e){nm(e.message)}finally{t8(null)}},nA=async()=>{let e=sK.trim(),t=sY.trim()||"255.255.255.255",s=Number(sq.trim()||"9");if(!e){nm(nx("请输入 MAC 地址","Enter a MAC address"));return}if(!Number.isInteger(s)||s<1||s>65535){nm(nx("端口必须在 1-65535 之间","Port must be 1-65535"));return}t8("wol:wake");try{let n=await nu("/studio/wol/wake",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e,broadcast:t,port:s})});nm(n.message||nx("唤醒包已发送","Wake packet sent"))}catch(e){nm(e.message)}finally{t8(null)}},nD=(0,A.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await nu(e?"/studio/wol/devices/probe":"/studio/wol/devices",e?{method:"POST"}:void 0);s$(t.devices||[])}catch(t){e&&nm(t.message)}},[nu,nm]),nO=async()=>{let e=sK.trim();if(!e){nm(nx("请输入 MAC 地址","Enter a MAC address"));return}t8("wol:save");try{var t;let s=await nu("/studio/wol/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s0,mac:e,ip:s5})});s$(s.devices||[]),sQ((null===(t=s.device)||void 0===t?void 0:t.mac)||e),nm(s.message||nx("设备已保存","Device saved"))}catch(e){nm(e.message)}finally{t8(null)}},nB=async()=>{let e=(sX||sK).trim();if(e){t8("wol:delete");try{let t=await nu("/studio/wol/devices/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e})});s$(t.devices||[]),sQ(""),sF(""),s1(""),s2(""),nm(nx("设备已删除","Device removed"))}catch(e){nm(e.message)}finally{t8(null)}}},nH=(0,A.useCallback)(async()=>{try{let e=(await nu("/studio/serial/ports")).ports||[];s4(e),s8(t=>{var s;return t&&e.some(e=>e.path===t)?t:(null===(s=e[0])||void 0===s?void 0:s.path)||t})}catch(e){s4([])}},[nu]),nW=(0,A.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await nu("/studio/ops/summary".concat(e?"?refresh=1":""));ni(t)}catch(t){e&&nm(t.message)}},[nu,nm]),nK=async()=>{t8("studio:snapshot");try{let e=await nu("/studio/ops/snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"studio"})});await nW(!1),nm(e.message||nx("系统快照已创建","System snapshot created"))}catch(e){nm(e.message)}finally{t8(null)}};(0,A.useEffect)(()=>{if("studio"!==tV)return;nD(!0),nW(!0);let e=window.setInterval(()=>{nD(!0),nW(!1)},3e4);return()=>window.clearInterval(e)},[nH,nW,nD,tV]);let nF=async(e,t)=>{let s=(null!=t?t:so).trim();if(s){t8("proc:".concat(e,":").concat(s));try{let t=await nu("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});nm(String(t.output||t.message||"OK")),await nb(),"live_youtube"===tV||"live_tiktok"===tV?nh():await nh()}catch(e){nm(e.message)}finally{t8(null)}}},nY=async(e,t)=>{let s=(null!=t?t:so).trim();if(!s)return;let n=null!=e?e:sd,l=++nc.current;t8("save:url");try{let e=new URLSearchParams({process:s});await nu("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),l===nc.current&&s===no.current.trim()&&sx(n),nm(nx("URL 配置已保存","URL config saved"))}catch(e){throw nm(e.message),e}finally{t8(null)}},nG=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!sh){nm(nx("请选择设备","Pick a device"));return}t8("adb:".concat(e));try{let s=await nu("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:sh,payload:t})});nm(s.message||"OK")}catch(e){nm(e.message)}finally{t8(null)}},nq=[{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:"studio",icon:x.Z,labelZh:"工作室",labelEn:"Studio"},{id:"network",icon:m.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:u.Z,labelZh:"设置",labelEn:"Settings"}],nJ=e=>{(async()=>{var t;if(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText){await navigator.clipboard.writeText(e);return}let s=document.createElement("textarea");s.value=e,s.readOnly=!0,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()})().then(()=>nm(nx("已复制","Copied")),()=>nm(nx("复制失败","Copy failed")))},nV=null!==(tc=null==t0?void 0:null===(H=t0.services)||void 0===H?void 0:H.filter(e=>e.running&&e.available).length)&&void 0!==tc?tc:0,n$=null!==(td=null==t0?void 0:null===(W=t0.services)||void 0===W?void 0:W.length)&&void 0!==td?td:0,nX=se?new Date(se).toLocaleTimeString("zh"===tY?"zh-CN":"en-US",{hour12:!1}):nx("未同步","Not synced"),nQ=ss?nx("前台自动刷新","Auto refresh"):nx("后台已暂停刷新","Refresh paused in background");return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===tq?"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"===tq?"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"===tq?"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"===tq?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),t9?(0,n.jsx)(l.E.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},role:"status","aria-live":"polite","aria-atomic":"true",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:t9}):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"===tq?"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)(h.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"===tq?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:nx("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:nq.map(e=>{let t=e.icon,s=tV===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>t$(e.id),"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm font-medium transition ".concat("light"===tq?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"===tq?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),nx(e.labelZh,e.labelEn),s?(0,n.jsx)(p.Z,{className:"ml-auto h-4 w-4 ".concat("light"===tq?"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"===tq?"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"===tq?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>tQ(!0),"aria-label":"Menu",children:(0,n.jsx)(b.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"===tq?"text-slate-900":"text-white"),children:nx((null===(K=nq.find(e=>e.id===tV))||void 0===K?void 0:K.labelZh)||"",(null===(F=nq.find(e=>e.id===tV))||void 0===F?void 0:F.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:[(null==t0?void 0:null===(Y=t0.stack)||void 0===Y?void 0:Y.mdns_host)||"live.local"," \xb7"," ","dark"===tq?nx("夜间","Dark mode"):nx("日间","Light mode")," \xb7 ",nQ," \xb7"," ",nx("最后同步","Last sync")," ",nX]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>tJ(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===tq?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===tq?nx("切换到日间","Switch to light"):nx("切换到夜间","Switch to dark"),"aria-label":"dark"===tq?nx("日间模式","Light mode"):nx("夜间模式","Dark mode"),"aria-pressed":"light"===tq,children:"dark"===tq?(0,n.jsx)(g.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(v.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>tG(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===tq?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===tY?"English":"中文","aria-label":nx("切换语言","Toggle language"),"aria-pressed":"en"===tY,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"===tq?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===tY?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!t6,onClick:()=>void Promise.all([nh(),nb()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===tq?"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:[t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:nx("刷新","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"===tV?(0,n.jsxs)("div",{className:"space-y-6",children:[t5?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[nx("无法加载仪表盘:","Dashboard error: "),t5]}):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"===tq?"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)(O.Z,{snapshot:null!==(tx=null==t0?void 0:t0.snapshot)&&void 0!==tx?tx:null,theme:tq,tr:nx})}),(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"===tq?"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)(D,{tr:nx})}),(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[{icon:j.Z,label:nx("CPU 1m","CPU 1m"),value:null!==(tm=null==t0?void 0:null===(J=t0.snapshot)||void 0===J?void 0:null===(q=J.cpu_load)||void 0===q?void 0:null===(G=q["1m"])||void 0===G?void 0:G.toFixed(2))&&void 0!==tm?tm:"—",sub:nx("负载均值","Load avg")},{icon:a.Z,label:nx("内存","Memory"),value:tT(null==t0?void 0:null===($=t0.snapshot)||void 0===$?void 0:null===(V=$.memory)||void 0===V?void 0:V.available),sub:"/ ".concat(tT(null==t0?void 0:null===(Q=t0.snapshot)||void 0===Q?void 0:null===(X=Q.memory)||void 0===X?void 0:X.total))},{icon:N.Z,label:nx("磁盘可用","Disk free"),value:tT(null==t0?void 0:null===(es=t0.snapshot)||void 0===es?void 0:null===(et=es.disk)||void 0===et?void 0:et.free),sub:"/ ".concat(tT(null==t0?void 0:null===(el=t0.snapshot)||void 0===el?void 0:null===(en=el.disk)||void 0===en?void 0:en.total))},{icon:r.Z,label:nx("服务在线","Services up"),value:"".concat(nV,"/").concat(n$||"—"),sub:nx("基础服务层","Infra layer")},{icon:k.Z,label:nx("运行时间","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==t0?void 0:null===(ei=t0.snapshot)||void 0===ei?void 0:ei.uptime_seconds),sub:nx("自开机","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:t3?"…":e.value}),(0,n.jsx)("p",{className:"mt-0.5 text-[10px] text-zinc-500",children:e.sub})]},e.label))}),(null==t0?void 0:t0.hardware)&&"object"==typeof t0.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:nx("系统硬件与软件能力","Hardware & software profile")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("来自 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:nx("平台","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!==(tu=t0.hardware.arch)&&void 0!==tu?tu:"—")})]}),(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!==(tp=null!==(th=t0.hardware.kernel)&&void 0!==th?th:null===(ea=t0.stack)||void 0===ea?void 0:ea.kernel)&&void 0!==tp?tp:"—")})]}),(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!==(tb=null===(er=t0.stack)||void 0===er?void 0:er.python)&&void 0!==tb?tb:"—")})]}),(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!==(tg=null===(eo=t0.stack)||void 0===eo?void 0:eo.mdns_host)&&void 0!==tg?tg:"—"})]}),(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===(ec=t0.stack)||void 0===ec?void 0:ec.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=t0.hardware.gpu,t=t0.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)?nx("已检测","present"):nx("未检测","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(", "):nx("—","—")})]})]})})()]}),(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=t0.hardware.ffmpeg_hwaccels||[],a=t0.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:[nx("解码","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:[nx("稳定模式","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,sv?(0,n.jsxs)("div",{className:"rounded-2xl border p-5 ".concat(sv.ready?"border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/50 to-cyan-500/[0.05]":"border-amber-500/30 bg-gradient-to-br from-amber-500/[0.1] via-zinc-950/55 to-rose-500/[0.05]"),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:nx("安装验收","Deployment health")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("一键脚本完成后,本机 API、局域网入口、反向代理与 mDNS 的可用性检查。","Post-install checks for loopback API, LAN access, reverse proxy, and mDNS.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[10px] font-semibold ".concat(sv.ready?"bg-emerald-500/20 text-emerald-100 ring-1 ring-emerald-500/30":"bg-amber-500/20 text-amber-100 ring-1 ring-amber-500/30"),children:sv.ready?nx("可交付","Ready"):nx("需处理","Needs attention")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"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-zinc-500",children:nx("验收摘要","Acceptance summary")}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-sm text-white",children:[null!==(tv=sv.pass_count)&&void 0!==tv?tv:0,"/",null!==(tf=sv.total_count)&&void 0!==tf?tf:0,(0,n.jsx)("span",{className:"ml-2 text-[11px] text-zinc-500",children:nx("已通过","checks passed")})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("必需项","Required"),": ",null!==(ty=sv.required_total)&&void 0!==ty?ty:0," \xb7 mDNS"," ",sv.mdns_enabled?nx("已启用","enabled"):nx("已关闭","disabled")," \xb7 edge"," ",sv.live_edge_enabled?nx("已启用","enabled"):nx("已关闭","disabled")]}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:Object.entries(sv.urls||{}).filter(e=>{let[,t]=e;return!!t}).slice(0,4).map(e=>{let[t,s]=e;return(0,n.jsx)("a",{href:(0,ev.p)(s),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-[11px] text-zinc-200 ring-1 ring-white/10",children:t},t)})})]}),(0,n.jsxs)("div",{className:"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-zinc-500",children:(null===(ed=sv.failing_checks)||void 0===ed?void 0:ed.length)?nx("失败项","Failing checks"):nx("当前状态","Current state")}),(null===(ex=sv.failing_checks)||void 0===ex?void 0:ex.length)?(0,n.jsx)("ul",{className:"mt-2 space-y-2 text-[11px] text-zinc-300",children:sv.failing_checks.slice(0,4).map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 px-3 py-2",children:[(0,n.jsx)("span",{className:"font-semibold text-amber-100",children:e.label}),(0,n.jsx)("span",{className:"ml-2 text-zinc-400",children:e.detail||"—"})]},e.id))}):(0,n.jsx)("p",{className:"mt-2 text-[11px] text-emerald-200/90",children:nx("必需检查已全部通过,可直接用浏览器面板交付。","All required checks pass; browser control plane is ready.")}),(sv.hints||[]).length?(0,n.jsx)("ul",{className:"mt-3 list-inside list-disc space-y-1 text-[10px] text-zinc-400",children:(sv.hints||[]).slice(0,3).map(e=>(0,n.jsx)("li",{children:e},e))}):null]})]})]}):null,(null==t0?void 0:null===(em=t0.stack)||void 0===em?void 0:em.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 ",nx("登录","sign-in")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:t0.stack.neko_login.note_zh||nx(nj?"Neko Chromium ".concat(nj," 使用下列账号策略。"):"Neko Chromium 多实例使用下列账号策略。",nj?"Neko Chromium ".concat(nj," uses the policy below."):"Neko Chromium instances use the policy below.")}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-amber-200/85",children:nx("重要:两栏分开填——昵称随意,密码必须是环境变量里的口令(默认 12345678)。用错密码会像一直加载;勿把「用户名/密码」写在一行。","Use two fields: display name is free-form; password must match NEKO_* (default 12345678). Wrong password looks like infinite loading.")}),nw.length?(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:nw.map(e=>(0,n.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg border border-fuchsia-400/20 bg-black/25 px-3 py-2 text-[11px] text-fuchsia-100 ring-1 ring-fuchsia-400/20",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"ml-2 rounded-full bg-fuchsia-500/15 px-1.5 py-0.5 text-[10px] text-fuchsia-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"ml-2 font-mono text-fuchsia-100/75",children:[e.host||"",e.port?":".concat(e.port):""]})]},e.key))}):null,(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:nx("昵称示例","Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-fuchsia-200",children:null!==(tw=t0.stack.neko_login.user_login)&&void 0!==tw?tw:"live"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:nx("连接口令","Access Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-fuchsia-100",children:null!==(tj=t0.stack.neko_login.user_password)&&void 0!==tj?tj:"—"})]}),(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:nx("管理昵称示例","Admin Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-violet-200",children:null!==(tN=t0.stack.neko_login.admin_login)&&void 0!==tN?tN:"admin"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:nx("管理口令","Admin Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-violet-100",children:null!==(tk=t0.stack.neko_login.admin_password)&&void 0!==tk?tk:"—"})]})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:nx("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==t0?void 0:null===(ep=t0.network)||void 0===ep?void 0:null===(eu=ep.interfaces)||void 0===eu?void 0:eu.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)(_.Z,{className:"h-4 w-4 text-cyan-300"}),nx("网络带宽 / 流量","Network bandwidth / traffic")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("实时速率由总览自动刷新间隔计算;累计值来自系统网卡计数器。","Live rates are calculated from dashboard refresh deltas; totals come from kernel counters.")}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(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-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:nx("实时下行","Live down")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:tM(t0.network.total_rx_bps)}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[nx("累计","Total"),": ",tT(t0.network.total_rx_bytes)]})]}),(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-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:nx("实时上行","Live up")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:tM(t0.network.total_tx_bps)}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[nx("累计","Total"),": ",tT(t0.network.total_tx_bytes)]})]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:(t0.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:[nx("链路","Link"),": ",e.operstate||"unknown"," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e.speed_mbps?"".concat(e.speed_mbps," Mbps"):nx("未知速率","unknown speed")]}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:["↓ ",tM(e.rx_bps)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",tT(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:["↑ ",tM(e.tx_bps)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",tT(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==t0?void 0:null===(eg=t0.live_events)||void 0===eg?void 0:null===(eb=eg.pm2_tail)||void 0===eb?void 0:eb.length)||(null==t0?void 0:null===(ey=t0.live_events)||void 0===ey?void 0:null===(ef=ey.process_digest)||void 0===ef?void 0:ef.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:nx("直播 / PM2 事件","Live / PM2 feed")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("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==t0?void 0:null===(ew=t0.live_events)||void 0===ew?void 0:ew.pm2_tail)||[]).join("\n")||nx("暂无 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:nx("进程快照","Process digest")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:((null==t0?void 0:null===(ej=t0.live_events)||void 0===ej?void 0:ej.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(tE(e.status||"")),children:function(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||"—"}(e.status||"",nx)})]},e.pm2))})]})]}):null,null,(null==t0?void 0:t0.probes)&&sj?(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t0.probes.srs?(()=>{var e,t,s,l,i,a,r;let o=null===(e=t0.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?nx("API 正常","API OK"):nx("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 ",nx("根路径","root")," ",null!=p?p:"—",404===p?nx("(无首页不影响推流)"," (no index is OK for streaming)"):null]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("延迟","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,t0.probes.neko?(()=>{var e,t,s,l,i,a,r;let o=null===(e=t0.probes)||void 0===e?void 0:e.neko,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:o.http,x=(null==o?void 0:o.instances)||[],m=null!==(l=null==o?void 0:o.running_count)&&void 0!==l?l:x.filter(e=>{var t;return null===(t=e.tcp)||void 0===t?void 0:t.reachable}).length,u=null!==(i=null==o?void 0:o.required_count)&&void 0!==i?i:x.length;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:"Neko Chromium"}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(m>0?"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:[m,"/",u||"—"," ",nx("在线","online")]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("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!==(a=null==o?void 0:o.port)&&void 0!==a?a:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 HTTP ",null!==(r=null==d?void 0:d.http_code)&&void 0!==r?r:"—"]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("延迟","RTT")," ",(null==d?void 0:d.latency_ms)!=null?"".concat(d.latency_ms," ms"):(null==o?void 0:null===(s=o.tcp)||void 0===s?void 0:s.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),x.length?(0,n.jsx)("div",{className:"mt-3 space-y-2",children:x.map(e=>{var t,s,l,i,a,r,o;return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("p",{className:"text-[11px] font-semibold text-zinc-200",children:["Neko ",null!==(a=e.id)&&void 0!==a?a:"?"]}),(0,n.jsxs)("p",{className:"font-mono text-[10px] text-zinc-500",children:[":",null!==(r=e.port)&&void 0!==r?r:"—"," \xb7 TCP ",(null===(t=e.tcp)||void 0===t?void 0:t.reachable)?"OK":"—"," \xb7 HTTP"," ",null!==(o=null===(s=e.http)||void 0===s?void 0:s.http_code)&&void 0!==o?o:"—"]})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat((null===(l=e.tcp)||void 0===l?void 0:l.reachable)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25"),children:(null===(i=e.tcp)||void 0===i?void 0:i.reachable)?nx("运行中","Running"):nx("未连通","Offline")})]},"".concat(e.id,"-").concat(e.port))})}):null,!(null==d?void 0:d.reachable)&&(null==d?void 0:d.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:d.error}):null]})})():null]}):null]}):null,"services"===tV?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==t0?void 0:t0.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(tE(e.running?"online":e.status)),children:e.running?nx("运行中","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:nx("stopped 为常态:仅当需要透明代理 / 规则分流时再手动点 Start,不建议设置自启。","Stopped is normal; click Start manually only when the proxy is needed. Autostart stays off.")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,ev.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:nx("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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==t0?void 0:null===(eN=t0.services)||void 0===eN?void 0:eN.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:nx("暂无服务数据","No services")})]}):null,"live_youtube"===tV?(0,n.jsx)(tS,{t:nx,busy:t6,entries:sl,currentProc:so,setCurrentProc:sc,urlConfig:sd,setUrlConfig:sx,onRunProcess:(e,t)=>void nF(e,t),onSaveUrlConfig:(e,t)=>nY(e,t),fetchJson:nu,liveProcesses:sa.length?sa:null!==(t_=null==t0?void 0:null===(ek=t0.live)||void 0===ek?void 0:ek.processes)&&void 0!==t_?t_:[],notify:nm,quickLinks:ng,onNavigate:e=>t$(e)}):null,"live_tiktok"===tV?(0,n.jsx)(eZ,{t:nx,busy:!!t6,entries:sl,currentProc:so,setCurrentProc:sc,urlConfig:sd,setUrlConfig:sx,onRunProcess:e=>void nF(e),onSaveUrlConfig:e=>nY(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await nY("原画,".concat(e,",主播: ").concat(s)),await nF("start")},onCopy:nJ,fetchJson:nu,apiPrefix:tF,quickLinks:ng,hdmiStatus:null==t0?void 0:t0.hdmi,notify:nm,onNavigate:e=>t$(e)}):null,"android"===tV?(0,n.jsx)(eh,{t:nx,notify:nm,fetchJson:nu,apiBase:tF,busy:t6,androidSerial:sh,setAndroidSerial:sp,devices:(null==t0?void 0:null===(e_=t0.android)||void 0===e_?void 0:e_.devices)||[],adbAvailable:!!(null==t0?void 0:null===(ez=t0.android)||void 0===ez?void 0:ez.adb_available),apkPath:sm,setApkPath:su,onAndroidAction:(e,t)=>nG(e,null!=t?t:{}),onCopy:nJ,onRefreshDevices:()=>void nh()}):null,"studio"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(x.Z,{className:"h-5 w-5 ".concat("light"===tq?"text-emerald-700":"text-emerald-300")}),nx("工作室","Studio")]}),(0,n.jsx)("p",{className:"mt-1 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"Home Assistant / Frigate / WOL"})]}),(0,n.jsxs)("span",{className:"w-fit rounded-full px-3 py-1 text-[11px] font-semibold ".concat("light"===tq?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200":"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25"),children:[nf.filter(e=>null==e?void 0:e.running).length,"/",nf.length||4," online"]})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[[{id:"homeassistant",label:"Home Assistant",icon:x.Z,fallbackUrl:ng.homeassistant,iconClass:"light"===tq?"text-emerald-700":"text-emerald-300",openClass:"light"===tq?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200 hover:bg-emerald-100":"bg-emerald-500/15 text-emerald-100 ring-1 ring-emerald-400/25 hover:bg-emerald-500/25"},{id:"frigate",label:"Frigate NVR",icon:z.Z,fallbackUrl:ng.frigate,iconClass:"light"===tq?"text-cyan-700":"text-cyan-300",openClass:"light"===tq?"bg-cyan-50 text-cyan-800 ring-1 ring-cyan-200 hover:bg-cyan-100":"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-400/25 hover:bg-cyan-500/25"},{id:"ntfy",label:"ntfy",icon:S.Z,fallbackUrl:ng.ntfy,iconClass:"light"===tq?"text-violet-700":"text-violet-300",openClass:"light"===tq?"bg-violet-50 text-violet-800 ring-1 ring-violet-200 hover:bg-violet-100":"bg-violet-500/15 text-violet-100 ring-1 ring-violet-400/25 hover:bg-violet-500/25"}].map(e=>{let t=nv.get(e.id),s=e.icon,i=(null==t?void 0:t.url)||e.fallbackUrl||"",a=!!t6||(null==t?void 0:t.available)===!1;return(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(s,{className:"h-4 w-4 ".concat(e.iconClass)}),e.label]}),(0,n.jsx)("p",{className:"mt-2 line-clamp-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:(null==t?void 0:t.description)||("frigate"===e.id?"Camera NVR and detection console":"Local automation workspace")})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==t?void 0:t.running)?"online":(null==t?void 0:t.status)||"unknown")),children:(null==t?void 0:t.running)?nx("运行中","Running"):(null==t?void 0:t.status)||"unknown"})]}),(null==t?void 0:t.detail)?(0,n.jsx)("p",{className:"mt-3 line-clamp-4 font-mono text-[11px] ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:t.detail}):null,(0,n.jsxs)("div",{className:"mt-5 flex flex-wrap gap-2",children:[i?(0,n.jsxs)("a",{href:(0,ev.p)(i),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold transition ".concat(e.openClass),children:[(0,n.jsx)(C.Z,{className:"h-3.5 w-3.5"}),nx("打开","Open")]}):null,(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"start"),className:"rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-2 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/25 transition hover:bg-amber-500/25 disabled:opacity-40",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:"Stop"})]})]},e.id)}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(R.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-amber-700":"text-amber-300")}),nx("WOL 网络唤醒","WOL Network Wake")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:(null==ny?void 0:ny.detail)||"broadcast=255.255.255.255;port=9"})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==ny?void 0:ny.status)||"ready")),children:(null==ny?void 0:ny.status)||"ready"})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("select",{value:sX,onChange:e=>{let t=e.target.value;sQ(t);let s=sV.find(e=>e.mac===t);s&&(sF(s.mac),s1(s.name||""),s2(s.ip||""))},className:"min-w-0 flex-1 rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100"),children:[(0,n.jsx)("option",{value:"",children:nx("选择设备","Select device")}),sV.map(e=>(0,n.jsx)("option",{value:e.mac,children:(e.name||e.ip||e.mac)+(e.reachable?" \xb7 online":"")},e.mac))]}),(0,n.jsx)("button",{type:"button",disabled:"wol:probe"===t6,onClick:()=>{t8("wol:probe"),nD(!0).finally(()=>t8(null))},className:"inline-flex items-center justify-center rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/25 transition hover:bg-cyan-500/25 disabled:opacity-40",children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("wol:probe"===t6?"animate-spin":"")})})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("名称","Name")}),(0,n.jsx)("input",{value:s0,onChange:e=>s1(e.target.value),placeholder:"NAS / PC",className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"IP"}),(0,n.jsx)("input",{value:s5,onChange:e=>s2(e.target.value),placeholder:"10.0.0.10",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"MAC"}),(0,n.jsx)("input",{value:sK,onChange:e=>sF(e.target.value),placeholder:"AA:BB:CC:DD:EE:FF",autoCapitalize:"characters",spellCheck:!1,className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"Broadcast"}),(0,n.jsx)("input",{value:sY,onChange:e=>sG(e.target.value),placeholder:"255.255.255.255",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"Port"}),(0,n.jsx)("input",{value:sq,onChange:e=>sJ(e.target.value),inputMode:"numeric",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:wake"===t6||(null==ny?void 0:ny.available)===!1,onClick:()=>void nA(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-amber-500/18 px-3 py-2.5 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/30 transition hover:bg-amber-500/28 disabled:opacity-40",children:["wol:wake"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(R.Z,{className:"h-3.5 w-3.5"}),nx("唤醒","Wake")]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:"wol:save"===t6,onClick:()=>void nO(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:["wol:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),nx("保存","Save")]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:delete"===t6||!(sX||sK),onClick:()=>void nB(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:["wol:delete"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(T.Z,{className:"h-3.5 w-3.5"}),nx("删除","Delete")]})]})]})]})]}),null,(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-emerald-700":"text-emerald-300")}),"System Doctor"]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:[null!==(tz=null==nl?void 0:null===(eS=nl.doctor)||void 0===eS?void 0:eS.services_running)&&void 0!==tz?tz:0,"/",null!==(tC=null==nl?void 0:null===(eC=nl.doctor)||void 0===eC?void 0:eC.services_available)&&void 0!==tC?tC:0," services"]})]}),(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==nl?void 0:null===(eR=nl.doctor)||void 0===eR?void 0:eR.status)||"unknown")),children:[null!==(tI=null==nl?void 0:null===(eP=nl.doctor)||void 0===eP?void 0:eP.score)&&void 0!==tI?tI:0,"/100"]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:[(0,n.jsxs)("p",{children:[nx("严重","Critical"),": ",null!==(tZ=null==nl?void 0:null===(eT=nl.doctor)||void 0===eT?void 0:eT.critical)&&void 0!==tZ?tZ:0," / ",nx("警告","Warnings"),": ",null!==(tA=null==nl?void 0:null===(eL=nl.doctor)||void 0===eL?void 0:eL.warnings)&&void 0!==tA?tA:0]}),((null==nl?void 0:null===(eM=nl.doctor)||void 0===eM?void 0:eM.recommendations)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:"line-clamp-2",children:["- ",e]},e))]})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(N.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-cyan-700":"text-cyan-300")}),nx("设备资产","Device inventory")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:"LAN / USB"})]}),(0,n.jsx)("button",{type:"button",disabled:"studio:ops"===t6,onClick:()=>{t8("studio:ops"),nW(!0).finally(()=>t8(null))},className:"inline-flex items-center justify-center rounded-lg px-2.5 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===tq?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("studio:ops"===t6?"animate-spin":"")})})]}),(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 text-center text-xs",children:[["WOL",null!==(tD=null==nl?void 0:null===(eU=nl.inventory)||void 0===eU?void 0:null===(eE=eU.counts)||void 0===eE?void 0:eE.wol)&&void 0!==tD?tD:0],["Video",null!==(tO=null==nl?void 0:null===(eA=nl.inventory)||void 0===eA?void 0:null===(eI=eA.counts)||void 0===eI?void 0:eI.video)&&void 0!==tO?tO:0]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-lg border px-2 py-2 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"light"===tq?"text-slate-500":"text-zinc-500",children:t})]},t)})})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(h.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-amber-700":"text-amber-300")}),nx("自动化配方","Automation recipes")]}),(0,n.jsx)("div",{className:"mt-4 space-y-2",children:((null==nl?void 0:nl.recipes)||[]).slice(0,3).map(e=>(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-700":"border-white/10 bg-black/30 text-zinc-300"),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"line-clamp-1 font-semibold",children:e.title}),(0,n.jsx)("span",{className:"ready"===e.status?"text-emerald-400":"text-amber-300",children:e.status})]})},e.id||e.title))})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tq?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(r.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-violet-700":"text-violet-300")}),nx("备份快照","Backup snapshots")]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:[((null==nl?void 0:null===(eD=nl.backups)||void 0===eD?void 0:eD.snapshots)||[]).length," snapshots"]})]}),(0,n.jsxs)("button",{type:"button",disabled:"studio:snapshot"===t6,onClick:()=>void nK(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-violet-500/15 px-3 py-2 text-xs font-semibold text-violet-100 ring-1 ring-violet-400/25 transition hover:bg-violet-500/25 disabled:opacity-40",children:["studio:snapshot"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("创建","Create")]})]}),(0,n.jsx)("p",{className:"mt-4 line-clamp-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:(null===(eO=((null==nl?void 0:null===(eB=nl.backups)||void 0===eB?void 0:eB.snapshots)||[])[0])||void 0===eO?void 0:eO.name)||nx("暂无快照","No snapshots yet")})]})]})]}):null,"network"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 shadow-xl ".concat("light"===tq?"border-cyan-200/90 bg-white shadow-cyan-100/50":"border-cyan-500/20 bg-zinc-950/55 shadow-black/30"),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",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-cyan-700":"text-cyan-300")}),"WireGuard VPS"]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("导入 VPS wg-quick 配置,保存到受管配置目录,并生成 Windows 端点旁路路由命令。","Import a VPS wg-quick config, save it under managed config, and generate the Windows endpoint bypass route.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ".concat((null==sP?void 0:sP.active)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-400/25":"bg-amber-500/15 text-amber-200 ring-1 ring-amber-400/25"),children:[tU(null==sP?void 0:null===(eH=sP.quality)||void 0===eH?void 0:eH.status,nx),"number"==typeof(null==sP?void 0:null===(eW=sP.quality)||void 0===eW?void 0:eW.score)?" \xb7 ".concat(sP.quality.score,"/100"):""]}),(null==sC?void 0:sC.relative_path)?(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-[11px] ".concat("light"===tq?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-400/20 bg-cyan-500/10 text-cyan-100"),children:sC.relative_path}):null,(0,n.jsxs)("button",{onClick:()=>{nP(),nT()},disabled:"wg:status"===t6||sE,className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===tq?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(sE?"animate-spin":"")}),sE?nx("探测中","Probing"):nx("刷新","Refresh")]})]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 lg:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("当前接口","Active interfaces")}),(0,n.jsxs)("div",{className:"mt-2 rounded-lg border px-3 py-2 text-xs ".concat("light"===tq?"border-cyan-100 bg-white text-slate-700":"border-cyan-400/15 bg-cyan-500/10 text-cyan-100"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:tU(null==sP?void 0:null===(eF=sP.quality)||void 0===eF?void 0:eF.status,nx)}),(0,n.jsx)("span",{className:"font-mono",children:"number"==typeof(null==sP?void 0:null===(eY=sP.quality)||void 0===eY?void 0:eY.score)?"".concat(sP.quality.score,"/100"):"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===tq?"text-slate-500":"text-cyan-100/75"),children:[nx("新鲜握手","Fresh peers"),": ",null!==(tB=null==sP?void 0:null===(eG=sP.quality)||void 0===eG?void 0:eG.fresh_peer_count)&&void 0!==tB?tB:0,"/",null!==(tH=null==sP?void 0:null===(eq=sP.quality)||void 0===eq?void 0:eq.peer_count)&&void 0!==tH?tH:0," \xb7 ",nx("最佳握手","Best handshake"),": ",tL(null==sP?void 0:null===(eJ=sP.quality)||void 0===eJ?void 0:eJ.best_handshake_age_seconds)]})]}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:((null==sP?void 0:sP.interfaces)||[]).length?((null==sP?void 0:sP.interfaces)||[]).map(e=>{var t,s,l;return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tq?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.name||"wg"}),(0,n.jsx)("span",{className:(null===(t=e.systemd)||void 0===t?void 0:t.active)==="active"?"text-emerald-400":"text-amber-300",children:(null===(s=e.systemd)||void 0===s?void 0:s.active)||"active"})]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[11px]",children:(e.addresses||[]).join(", ")||"—"}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:[e.details_available?nx("运行细节可读","Runtime details readable"):nx("运行细节受限","Runtime details limited"),(null===(l=e.configured_from)||void 0===l?void 0:l.name)?" \xb7 ".concat(nx("配置","Config"),": ").concat(e.configured_from.name):""]})]},e.name||"wg")}):(0,n.jsx)("p",{className:"text-xs ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("未发现 wg show 输出","No wg show output")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("对端与流量","Peer and traffic")}),(()=>{var e;let t=(null==nz?void 0:nz.status_source)==="wg"?nx("运行态","Runtime"):(null==nz?void 0:nz.config_source)==="system"?nx("系统配置","System config"):(null==nz?void 0:nz.config_source)==="repo"?nx("受管配置","Managed config"):nx("配置态","Config");return nz?(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===tq?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Source: ",t]}),(0,n.jsxs)("p",{children:["Endpoint: ",nz.endpoint||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",(nz.allowed_ips||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Handshake:"," ","config"===nz.status_source?nx("运行态需 root/CAP_NET_ADMIN","Runtime details need root/CAP_NET_ADMIN"):tL(nz.latest_handshake_age_seconds)]}),(0,n.jsxs)("p",{children:["RX/TX: ",tT(nz.transfer_rx_bytes)," / ",tT(nz.transfer_tx_bytes)]}),(0,n.jsxs)("p",{children:["Keepalive: ",null!==(e=nz.persistent_keepalive)&&void 0!==e?e:"—"]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("暂无 peer 数据","No peer data yet")})})(),((null==sP?void 0:sP.endpoint_routes)||[]).length?(0,n.jsx)("div",{className:"mt-3 space-y-1 rounded-lg border px-3 py-2 font-mono text-[10px] ".concat("light"===tq?"border-slate-200 bg-white text-slate-600":"border-white/10 bg-zinc-950/60 text-zinc-400"),children:((null==sP?void 0:sP.endpoint_routes)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:e.uses_wireguard_interface?"text-amber-300":"",children:["route ",e.host||"endpoint",": ",e.route||(e.ok?"ok":"unavailable")]},e.host||e.route||"endpoint-route"))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("Neko 访问模式","Neko access mode")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 rounded-lg p-1 text-xs font-semibold ".concat("light"===tq?"bg-slate-200/70":"bg-black/40"),children:["lan","remote"].map(e=>{var t,s;let l=((null==sP?void 0:null===(t=sP.neko_access)||void 0===t?void 0:t.mode)||"lan")===e,i=(null==t6?void 0:t6.startsWith("wg:neko"))||"remote"===e&&!(null==sP?void 0:null===(s=sP.neko_access)||void 0===s?void 0:s.remote_ready);return(0,n.jsx)("button",{onClick:()=>void nM(e),disabled:i,className:"rounded-md px-2.5 py-1.5 transition disabled:opacity-40 ".concat(l?"light"===tq?"bg-white text-cyan-800 shadow-sm":"bg-cyan-500/25 text-cyan-100 ring-1 ring-cyan-400/25":"light"===tq?"text-slate-600 hover:bg-white/60":"text-zinc-300 hover:bg-white/10"),children:"lan"===e?nx("局域网","LAN"):nx("远控","Remote")},e)})}),(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===tq?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["NAT1TO1: ",(null==sP?void 0:null===(eV=sP.neko_access)||void 0===eV?void 0:eV.nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["LAN: ",(null==sP?void 0:null===(e$=sP.neko_access)||void 0===e$?void 0:e$.lan_host)||"-"]}),(0,n.jsxs)("p",{children:["WG: ",(null==sP?void 0:null===(eX=sP.neko_access)||void 0===eX?void 0:eX.wireguard_host)||"-"]}),(0,n.jsxs)("p",{children:["Target: ",(null==sP?void 0:null===(eQ=sP.neko_access)||void 0===eQ?void 0:eQ.target_nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==sP?void 0:null===(e0=sP.shellcrash)||void 0===e0?void 0:e0.running)?"running:".concat((null==sP?void 0:null===(e1=sP.shellcrash)||void 0===e1?void 0:e1.mixed_port)||"7890"):"stopped"]})]}),((null==sP?void 0:null===(e5=sP.neko_access)||void 0===e5?void 0:e5.remote_urls)||[]).length?(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==sP?void 0:null===(e2=sP.neko_access)||void 0===e2?void 0:e2.remote_urls)||[]).slice(0,4).map(e=>(0,n.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg px-2.5 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===tq?"bg-white text-cyan-800 ring-cyan-100 hover:bg-cyan-50":"bg-cyan-500/10 text-cyan-100 ring-cyan-400/20 hover:bg-cyan-500/15"),children:["Neko ",e.id||1," \xb7 ",e.kind||"remote"]},"".concat(e.kind||"remote","-").concat(e.id||0,"-").concat(e.url||"")))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:"Google / Douyin"}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:["google","youtube","douyin"].map(e=>{let t=((null==sL?void 0:sL.direct)||[]).find(t=>t.target===e),s=!!(null==t?void 0:t.ok),l=!t,i=sE&&l,a=(null==t?void 0:t.label)||("google"===e?"Google":"youtube"===e?"YouTube":"Douyin");return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tq?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:a}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(i?"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-500/25":l?"bg-zinc-500/15 text-zinc-300 ring-1 ring-zinc-500/25":s?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:[i?(0,n.jsx)(y.Z,{className:"h-3 w-3 animate-spin"}):null,i?nx("探测中","Probing"):l?nx("等待结果","Waiting"):s?"OK":"FAIL"]})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[10px] ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:[(null==t?void 0:t.elapsed_ms)!=null?"".concat(t.elapsed_ms," ms"):i?nx("正在连接 ".concat(a,"..."),"Connecting ".concat(a,"...")):nx("等待探测结果","Waiting for probe result"),(null==t?void 0:t.status)?" \xb7 HTTP ".concat(t.status):""]}),!s&&(null==t?void 0:t.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:t.error}):null]},e)})}),(0,n.jsxs)("div",{className:"mt-3 space-y-1 font-mono text-[11px] ".concat("light"===tq?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Mode: ",sE?nx("正在探测直连链路与代理链路","Probing direct/proxy paths"):(null==sL?void 0:sL.mode)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==sL?void 0:null===(e3=sL.shellcrash)||void 0===e3?void 0:e3.running)?"running:".concat((null==sL?void 0:null===(e4=sL.shellcrash)||void 0===e4?void 0:e4.mixed_port)||"7890"):"manual/stopped"]}),(0,n.jsxs)("p",{children:["Autostart: ",(null==sL?void 0:null===(e6=sL.shellcrash_policy)||void 0===e6?void 0:e6.autostart_on_direct_fail)?"on direct fail":"off"]}),(0,n.jsxs)("p",{children:["Neko attach: ",(null==sL?void 0:null===(e8=sL.shellcrash_policy)||void 0===e8?void 0:e8.attach_neko)||"auto"]})]}),sE?(0,n.jsxs)("p",{className:"mt-3 inline-flex items-center gap-2 text-xs ".concat("light"===tq?"text-cyan-700":"text-cyan-200"),children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),nx("正在探测 Google / YouTube / Douyin,请等待结果返回。","Probing Google / YouTube / Douyin. Waiting for results.")]}):(null==sL?void 0:sL.summary)?(0,n.jsx)("p",{className:"mt-3 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-500"),children:sL.summary}):null]})]}),(null==sP?void 0:null===(e9=sP.recommendations)||void 0===e9?void 0:e9.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===tq?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-400/20 bg-amber-500/10 text-amber-100"),children:(sP.recommendations||[]).join(" \xb7 ")}):null,(null==sP?void 0:null===(te=sP.quality)||void 0===te?void 0:null===(e7=te.reasons)||void 0===e7?void 0:e7.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===tq?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-black/25 text-zinc-300"),children:(sP.quality.reasons||[]).slice(0,4).join(" \xb7 ")}):null,(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("配置名","Config name")}),(0,n.jsx)("input",{value:sk,onChange:e=>s_(e.target.value),className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===tq?"border-slate-200 bg-white text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/30 text-zinc-100 focus:border-cyan-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("配置文件","Config file")}),(0,n.jsx)("input",{type:"file",accept:".conf,.txt,text/plain",onChange:e=>{var t;nI(null===(t=e.target.files)||void 0===t?void 0:t[0])},className:"mt-1 w-full rounded-lg border px-3 py-2 text-xs file:mr-3 file:rounded-md file:border-0 file:px-3 file:py-1.5 file:text-xs file:font-semibold ".concat("light"===tq?"border-slate-200 bg-white text-slate-700 file:bg-cyan-50 file:text-cyan-800":"border-white/10 bg-black/30 text-zinc-300 file:bg-cyan-500/15 file:text-cyan-100")})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border px-3 py-2 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/25"),children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("保存模式","Save mode")}),["overlay","preserve"].map(e=>(0,n.jsx)("button",{onClick:()=>sD(e),className:"rounded-md px-2.5 py-1 text-[11px] font-semibold transition ".concat(sA===e?"bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/30":"light"===tq?"bg-white text-slate-600 ring-1 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-300 ring-1 ring-white/10 hover:bg-white/10"),children:"overlay"===e?nx("组网不接管默认路由","Overlay only"):nx("保留原路由","Preserve routes")},e)),(0,n.jsx)("button",{onClick:()=>sZ(e=>!e),className:"ml-auto inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-semibold ring-1 transition ".concat("light"===tq?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:sI?nx("锁定","Lock"):nx("编辑","Edit")}),(0,n.jsxs)("button",{onClick:()=>void nL(!1),disabled:"wg:save"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-1.5 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("保存","Save")]}),(0,n.jsxs)("button",{onClick:()=>void nL(!0),disabled:"wg:apply"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-1.5 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:["wg:apply"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(o.Z,{className:"h-3.5 w-3.5"}),nx("保存并应用","Save & apply")]})]}),(0,n.jsx)("textarea",{value:sz,onChange:e=>sS(e.target.value),readOnly:!sI,spellCheck:!1,placeholder:"[Interface] Address = 10.88.0.6/32 PrivateKey = ... [Peer] Endpoint = 129.204.21.129:51820 AllowedIPs = 10.88.0.0/24",className:"min-h-56 w-full resize-y rounded-xl border p-3 font-mono text-xs leading-relaxed outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/40 text-zinc-100 focus:border-cyan-400/60"," ").concat(sI?"":"opacity-75")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{onClick:()=>void nE(),disabled:"wg:save"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("解析并保存","Parse & save")]}),(null==sC?void 0:sC.redacted_config)?(0,n.jsxs)("button",{onClick:()=>nJ(sC.redacted_config||""),className:"inline-flex items-center gap-2 rounded-lg bg-zinc-500/15 px-3 py-2 text-xs font-semibold text-zinc-100 ring-1 ring-white/10 transition hover:bg-zinc-500/25",children:[(0,n.jsx)(U.Z,{className:"h-3.5 w-3.5"}),nx("复制脱敏配置","Copy redacted")]}):null]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:nx("解析结果","Parsed config")}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat("light"===tq?"bg-cyan-100 text-cyan-800":"bg-cyan-500/15 text-cyan-200"),children:[null!==(tW=null==sC?void 0:sC.peer_count)&&void 0!==tW?tW:0," peers"]})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 font-mono text-[11px] ".concat("light"===tq?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Address: ",((null==sC?void 0:null===(tt=sC.interface)||void 0===tt?void 0:tt.addresses)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Endpoint: ",(null==sC?void 0:null===(tn=sC.peers)||void 0===tn?void 0:null===(ts=tn[0])||void 0===ts?void 0:ts.endpoint)||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",((null==sC?void 0:null===(ti=sC.peers)||void 0===ti?void 0:null===(tl=ti[0])||void 0===tl?void 0:tl.allowed_ips)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["MTU: ",null!==(tK=null==sC?void 0:null===(ta=sC.interface)||void 0===ta?void 0:ta.mtu)&&void 0!==tK?tK:"—"]})]}),(null==sC?void 0:null===(tr=sC.warnings)||void 0===tr?void 0:tr.length)?(0,n.jsx)("ul",{className:"mt-3 space-y-1 text-[11px] ".concat("light"===tq?"text-amber-700":"text-amber-200"),children:sC.warnings.map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:nx("已保存配置","Saved configs")}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==sP?void 0:sP.repo_configs)||[]).length?((null==sP?void 0:sP.repo_configs)||[]).map(e=>(0,n.jsx)("button",{onClick:()=>void nU(e.name),className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===tq?"bg-slate-50 text-slate-700 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-200 ring-white/10 hover:bg-white/10"),children:e.name||e.relative_path},e.name||e.relative_path||"wireguard-config")):(0,n.jsx)("span",{className:"text-[11px] ".concat("light"===tq?"text-slate-500":"text-zinc-500"),children:nx("暂无受管配置","No managed configs")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tq?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-xs font-semibold ".concat("light"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(I.Z,{className:"h-3.5 w-3.5"}),nx("Windows 端点路由","Windows endpoint route")]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-1",children:[(0,n.jsx)("input",{value:sO,onChange:e=>sB(e.target.value),placeholder:nx("网关,如 192.168.2.1","Gateway, e.g. 192.168.2.1"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")}),(0,n.jsx)("input",{value:sH,onChange:e=>sW(e.target.value),placeholder:nx("接口 ifIndex,如 21","Interface ifIndex, e.g. 21"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")})]}),(0,n.jsx)("code",{className:"mt-3 block break-all rounded-lg border p-3 text-[11px] ".concat("light"===tq?"border-slate-200 bg-slate-50 text-slate-800":"border-white/10 bg-black/40 text-zinc-200"),children:nR||"route -p add mask 255.255.255.255 metric 1 if "}),(0,n.jsxs)("button",{onClick:()=>nJ(nR),disabled:!nR,className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:[(0,n.jsx)(U.Z,{className:"h-3.5 w-3.5"}),nx("复制命令","Copy command")]})]})]})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===tq?"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"===tq?"text-slate-900":"text-white"),children:[(0,n.jsx)(_.Z,{className:"h-4 w-4 ".concat("light"===tq?"text-violet-600":"text-violet-300")}),nx("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","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:nx("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:nx("本机 / 安卓","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)(p.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===tq?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===tq?"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)(B.d,{embeddedShellCrash:!0,portalLang:tY})})})]}):null,"settings"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===tq?"text-slate-600":"text-zinc-400"),children:nx("常用选项(本机偏好);完整文件与 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:nx("总览自动刷新","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:sy,onChange:e=>{let t=e.target.checked;sw(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}nm(t?nx("已开启刷新","Auto refresh on"):nx("已暂停刷新","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:nx("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:nx("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:sj,onChange:e=>{let t=e.target.checked;sN(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:nx("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==sb?void 0:sb.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[nx("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==sb?void 0:sb.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==t0?void 0:null===(s=t0.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==sb?void 0:null===(to=sb.services)||void 0===to?void 0:to.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"===tq?"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:[nx("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(C.Z,{className:"h-4 w-4"})]})]}):null]},tV)})})]})]}),(0,n.jsx)(i.M,{children:tX?(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:()=>tQ(!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:()=>tQ(!1),className:"rounded-lg p-2",children:(0,n.jsx)(Z.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:nq.map(e=>{let t=e.icon,s=tV===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{t$(e.id),tQ(!1)},"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm transition ".concat(s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-300 hover:bg-white/[0.04]"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat(s?"text-violet-300":"text-violet-400")}),nx(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/644-fd6fe0f98d73fa51.js b/d2ypp2/web-console/out/_next/static/chunks/644-fd6fe0f98d73fa51.js deleted file mode 100644 index 9d9dfaf..0000000 --- a/d2ypp2/web-console/out/_next/static/chunks/644-fd6fe0f98d73fa51.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[644],{7644:function(e,t,s){s.d(t,{Z:function(){return tI}});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(4938),u=s(3420),m=s(8728),h=s(2023),p=s(407),b=s(6840),g=s(7226),v=s(5929),f=s(7945),y=s(1817),w=s(7168),j=s(4822),N=s(4428),k=s(1723),_=s(2926),z=s(3581),S=s(4766),C=s(7580),P=s(9688),R=s(4743),L=s(8930),T=s(3651),M=s(4286),E=s(7265),U=s(8867),I=s(8406),Z=s(2489),A=s(2265);function D(e){let{tr:t}=e,l=(0,A.useRef)(null);return(0,A.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 u=new s.DirectionalLight(16777215,.9);u.position.set(4,8,6),o.add(u);let m=new s.PointLight(8189439,.6,20);m.position.set(-3,2,-2),o.add(m);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 v=new s.Mesh(new s.CylinderGeometry(.22,.28,.95,20),new s.MeshStandardMaterial({color:2487534,emissive:340024,metalness:.25,roughness:.35}));v.position.set(1.05,.35,-.15),v.rotation.z=.12,h.add(v);let f=new s.Mesh(new s.SphereGeometry(.26,16,16),new s.MeshStandardMaterial({color:16657493,emissive:2229520,metalness:.2,roughness:.4}));f.position.set(1.05,.92,-.15),h.add(f);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 _=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)});_.observe(i),e=()=>{cancelAnimationFrame(n),_.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 O=s(9170),B=s(2246),H=s(4794),W=s(221),K=s(8124),F=s(2101),Y=s(9985),J=s(6362),G=s(3468),q=s(6443),V=s(5287),$=s(3276),X=s(9227),Q=s(257),ee=s(1387);class et{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=>{var t;let s=this.canvas.getContext("2d");if(!s){e.close();return}(this.canvas.width!==e.displayWidth||this.canvas.height!==e.displayHeight)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),s.drawImage(e,0,0),e.close(),null===(t=this.onFrame)||void 0===t||t.call(this)},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,s){this.canvas=e,this.onDecodeError=t,this.onFrame=s,this.buf=new Uint8Array(0),this.decoder=null,this.configured=!1,this.configuring=!1,this.ts=0,this.sps=null,this.pps=null}}function es(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoFrame}let en="live-hub-adb-bookmarks-v1";function el(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 u=t-r.left-i,m=s-r.top-a;return u<0||m<0||u>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}function ei(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 u=t-r.left-i,m=s-r.top-a;return u<0||m<0||u>n||m>l?null:{x:Math.max(0,Math.min(o-1,Math.round(u/n*o))),y:Math.max(0,Math.min(c-1,Math.round(m/l*c)))}}let ea=[0,280,450,700,1100];function er(e){switch(e){case"usb":return{Icon:F.Z,zh:"USB",en:"USB",cls:"bg-amber-500/20 text-amber-100 ring-amber-500/35"};case"tcp":return{Icon:_.Z,zh:"网络",en:"TCP",cls:"bg-cyan-500/20 text-cyan-100 ring-cyan-500/35"};case"emulator":return{Icon:T.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 eo="https://github.com/Genymobile/scrcpy",ec="https://github.com/viarotel-org/escrcpy";function ed(e,t){let s=t.startsWith("/")?t:"/".concat(t),n=(e||"").trim().replace(/\/$/,"");return n?"".concat(n).concat(s):s}function ex(e){var t;let{t:s,apiBase:l,fetchJson:i,serial:a,devices:r,setSerial:o,adbAvailable:c,lock:x,overview:u,onAndroidAction:m,notify:p,onRefreshDevices:b}=e,[g,v]=(0,A.useState)(0),[f,y]=(0,A.useState)(450),[j,N]=(0,A.useState)(!1),[k,_]=(0,A.useState)(null),[z,S]=(0,A.useState)(null),[C,P]=(0,A.useState)(!0),[R,L]=(0,A.useState)(""),[T,M]=(0,A.useState)(""),[E,U]=(0,A.useState)("37777"),[I,Z]=(0,A.useState)(""),[D,O]=(0,A.useState)(!1),[B,H]=(0,A.useState)([]),[W,K]=(0,A.useState)(!1),[F,ex]=(0,A.useState)(null),[eu,em]=(0,A.useState)(!1),[eh,ep]=(0,A.useState)(null),[eb,eg]=(0,A.useState)(null),[ev,ef]=(0,A.useState)(!0),ey=(0,A.useRef)(null),ew=(0,A.useRef)(null),ej=(0,A.useRef)(null),eN=(0,A.useRef)(null),ek=(0,A.useRef)(null),e_=(0,A.useRef)(null),ez=(0,A.useRef)(0),eS=(0,A.useRef)(!1),eC=(0,A.useRef)(null),eP=(0,A.useRef)(!1),eR=null===(t=r.find(e=>e.serial===a))||void 0===t?void 0:t.transport,eL=f>0,eT=a?"".concat(ed(l,"/android/screenshot"),"?serial=").concat(encodeURIComponent(a),"&ts=").concat(g).concat(eL?"&fast=1":""):"",eM=(0,A.useCallback)(()=>{v(e=>e+1)},[]),eE=(0,A.useCallback)(()=>{null!=eC.current&&(window.clearTimeout(eC.current),eC.current=null)},[]);(0,A.useEffect)(()=>{let e=()=>ef("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(en);if(e){let t=JSON.parse(e);Array.isArray(t)&&H(t.map(String).filter(Boolean).slice(0,24))}}catch(e){}},[]);let eU=e=>{let t=e.trim();if(!t)return;let n=[t,...B.filter(e=>e!==t)].slice(0,16);H(n);try{window.localStorage.setItem(en,JSON.stringify(n))}catch(e){}p(s("已保存快捷地址","Saved quick address"))};(0,A.useEffect)(()=>{if(!a||!c){S(null);return}let e=!1;return(async()=>{try{let t=await (0,ee.N)("".concat(ed(l,"/android/display_metrics"),"?serial=").concat(encodeURIComponent(a)));if(e)return;"number"==typeof t.width&&"number"==typeof t.height&&S({width:t.width,height:t.height})}catch(e){}})(),()=>{e=!0}},[l,c,a]),(0,A.useEffect)(()=>{if(!c||!a||f<=0||W||!ev)return;let e=window.setInterval(()=>v(e=>e+1),f);return()=>clearInterval(e)},[c,f,ev,a,W]),(0,A.useEffect)(()=>{ev&&c&&a&&!W&&eM()},[c,eM,ev,a,W]),(0,A.useEffect)(()=>{if(!c){eg(null);return}let e=!1;return(async()=>{try{let t=await (0,ee.N)(ed(l,"/android/scrcpy/info"));e||eg(t)}catch(e){}})(),()=>{e=!0}},[l,c]),(0,A.useEffect)(()=>{W||ep(null)},[W]),(0,A.useEffect)(()=>{ex(null),eS.current=!1},[a]),(0,A.useEffect)(()=>{let e=r.find(e=>e.serial===a),t=!!(a&&F===a);if(c&&a&&(null==e?void 0:e.state)==="device"&&(null==eb?void 0:eb.server_jar)&&es()&&!t){K(!0),y(0);return}if(t||!a||!c||eb&&!eb.server_jar||!es()||e&&"device"!==e.state){K(!1);return}},[a,r,c,eb,F]),(0,A.useEffect)(()=>{if(!W||!a||!c){var e,t;eE(),eS.current=!0,eP.current=!1,null===(e=eN.current)||void 0===e||e.close(),eN.current=null,null===(t=ek.current)||void 0===t||t.reset(),ek.current=null,em(!1);return}if(!es()){ep(s("当前浏览器不支持 WebCodecs H.264","WebCodecs H.264 not supported in this browser")),K(!1);return}let n=ej.current;if(!n)return;let i=e=>{var t;eE(),eS.current=!0,null===(t=eN.current)||void 0===t||t.close(),ep(e),K(!1),y(450),ex(a),window.setTimeout(()=>eM(),120)},r=new et(n,e=>i("".concat(s("实时画面解码失败,已切回截图模式","Live stream decode failed, using screenshot mode"),": ").concat(e)),()=>{eP.current=!0,eE()});ek.current=r,eS.current=!1,eP.current=!1;let o=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!==Q&&Q.env.NEXT_PUBLIC_API_URL?String(Q.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 eN.current=o,o.binaryType="arraybuffer",o.onopen=()=>{em(!0),ep(null),eE(),eC.current=window.setTimeout(()=>{eP.current||i(s("实时画面无首帧,已切回截图模式","No first live frame, using screenshot mode"))},5200)},o.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=ek.current)||void 0===t||t.push(e.data)},o.onerror=()=>{ep(s("WebSocket 异常","WebSocket error"))},o.onclose=()=>{var e;em(!1),null===(e=ek.current)||void 0===e||e.reset(),ek.current=null,eE(),W&&!eS.current&&i(s("实时画面连接失败,已切回截图模式","Live stream failed, using screenshot mode"))},()=>{eE(),eS.current=!0,eP.current=!1,o.close(),eN.current=null,r.reset(),ek.current===r&&(ek.current=null)}},[W,a,c,l,eM,eE,s]),(0,A.useEffect)(()=>{a&&c&&(ez.current=0,v(e=>e+1))},[a,c]);let eI=async()=>{let e=R.trim();if(!e){p(s("填写 host:port","Enter host:port"));return}O(!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(),eM()}catch(e){p(e.message)}finally{O(!1)}},eZ=async e=>{O(!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{O(!1)}},eA=async()=>{let e=T.trim(),t=parseInt(E,10)||37777,n=I.trim();if(!e||!n){p(s("填写配对 IP 与码","Host + code required"));return}O(!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{O(!1)}},eD=async e=>{if(!C||x||!c||!a)return;let t=ew.current;if(!t)return;let n=ei(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),eM()},eO=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ew.current;if(!t)return;let n=ei(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),eM())},eB=async e=>{if(!C||x||!c||!a)return;let t=ej.current;if(!t)return;let n=el(t,e.clientX,e.clientY);if(!n)return;let l=Date.now(),i=ey.current;i&&l-i.t<320&&28>Math.abs(i.x-n.x)&&28>Math.abs(i.y-n.y)?(ey.current=null,await m("double_tap",{x:n.x,y:n.y}),p(s("双击","Double tap"))):(ey.current={t:l,x:n.x,y:n.y},await m("tap",{x:n.x,y:n.y})),W||eM()},eH=async e=>{if(e.preventDefault(),x||!c||!a)return;let t=ej.current;if(!t)return;let n=el(t,e.clientX,e.clientY);n&&(await m("long_press",{x:n.x,y:n.y,duration:720}),p(s("长按","Long press")),W||eM())};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 eW=er(eR),eK=eW.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)(Y.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:R,onChange:e=>L(e.target.value),onKeyDown:e=>"Enter"===e.key&&void eI()}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eI(),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:D?"…":"Connect"}),(0,n.jsx)("button",{type:"button",disabled:D||x||!R.trim(),onClick:()=>eU(R),className:"rounded-lg border border-white/10 px-3 py-2 text-xs text-zinc-400 hover:text-zinc-200",children:s("存书签","Pin")})]}),B.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:B.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:()=>L(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:D||x||!a,onClick:()=>void eZ(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:D||x,onClick:()=>void eZ(""),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:D||x,onClick:()=>{b(),eM(),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)(w.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:T,onChange:e=>M(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:E,onChange:e=>U(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:I,onChange:e=>Z(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:D||x,onClick:()=>void eA(),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)(h.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:ec,target:"_blank",rel:"noreferrer",className:"text-emerald-300/90 underline-offset-2 hover:underline",children:"escrcpy"}),s(" / "," / "),(0,n.jsx)("a",{href:eo,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:ec,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)(J.Z,{className:"h-3.5 w-3.5 opacity-70"})]}),(0,n.jsxs)("a",{href:eo,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)(J.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)(G.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=er(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")}),ea.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>y(e),className:"rounded-lg px-2.5 py-1 text-[10px] font-semibold transition ".concat(f===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(eW.cls),children:[(0,n.jsx)(eK,{className:"h-3 w-3"}),"tcp"===eR?s("建议 ≥450ms","Suggest ≥450ms"):s("可试 280ms","Try 280ms")]}),(0,n.jsxs)("button",{type:"button",disabled:x,onClick:()=>void eM(),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)(w.Z,{className:"h-3 w-3 ".concat(j?"animate-spin":"")}),s("下一帧","Next frame")]}),(0,n.jsx)("button",{type:"button",disabled:x||!a,onClick:()=>void m("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:C,onChange:e=>P(e.target.checked)}),(0,n.jsx)(q.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:()=>{K(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(W?"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)(V.Z,{className:"h-3 w-3"}),W?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:e_,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 m(s[0],s[1]),W||eM()})())},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"}),W?(0,n.jsx)("canvas",{ref:ej,className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onClick:eB,onContextMenu:eH}):(0,n.jsx)("img",{ref:ew,src:eT||void 0,alt:"device",className:"max-h-[min(72vh,680px)] w-auto max-w-full rounded-[1.35rem] object-contain ".concat(C?"cursor-crosshair":"cursor-default"),draggable:!1,onLoadStart:()=>{N(!0)},onLoad:()=>{N(!1),ez.current=0,_(null)},onError:()=>{N(!1),ez.current+=1,ez.current<=3?(_(null),window.setTimeout(()=>eM(),380+200*ez.current)):_(s("截图连续失败:检查 USB 授权 / 无线是否断开 / Redroid 端口","Screenshot failed repeatedly"))},onClick:eD,onContextMenu:eO})]}),eu?(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)(V.Z,{className:"h-3 w-3"}),"SCRCPY\xb7WS"]}):f>0&&!W?(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)($.Z,{className:"h-3 w-3"}),"LIVE"]}):W?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)(X.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&&!W?(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")}),u?(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:[u.brand," ",u.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:[u.android_version," (API ",u.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:z?"".concat(z.width,"\xd7").concat(z.height):u.resolution||"—"})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:u.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:()=>{m("key",{keycode:t}),eM()},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:()=>{m("key",{keycode:"24"}),eM()},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:()=>{m("key",{keycode:"25"}),eM()},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:()=>{m("swipe",{direction:e}),eM()},className:"rounded-lg border border-white/10 bg-black/30 py-2 font-mono text-[10px] uppercase text-zinc-300",children:e},e))})]})]})]})]})]})]})}let eu=[{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 em(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 eh(e){var t,s,l,i,a,r,o,c,d,x,u,m,h,p,b;let{t:g,notify:v,fetchJson:f,apiBase:w,busy:j,androidSerial:N,setAndroidSerial:k,devices:_,adbAvailable:z,apkPath:S,setApkPath:C,onAndroidAction:P,onCopy:R,onRefreshDevices:L}=e,[T,E]=(0,A.useState)(null),[I,Z]=(0,A.useState)(null),[D,O]=(0,A.useState)(null),[B,F]=(0,A.useState)(null),[Y,J]=(0,A.useState)(""),[G,q]=(0,A.useState)([]),[V,$]=(0,A.useState)("getprop ro.product.model"),[X,Q]=(0,A.useState)(""),[ee,et]=(0,A.useState)("300"),[es,en]=(0,A.useState)(""),[el,ei]=(0,A.useState)(null),[ea,er]=(0,A.useState)([]),[eo,ec]=(0,A.useState)(null),[ed,eh]=(0,A.useState)("https://"),[ep,eb]=(0,A.useState)(""),[eg,ev]=(0,A.useState)(!1),[ef,ey]=(0,A.useState)(null),ew=!!(j||ef),ej=_.find(e=>e.serial===N)||null,eN=(0,A.useCallback)(async()=>{if(!N||!z){E(null),Z(null);return}ey("overview"),Z(null);try{let e=await f("/android/overview?serial=".concat(encodeURIComponent(N)));E(e)}catch(e){E(null),Z(e.message)}finally{ey(null)}},[z,N,f]),ek=(0,A.useCallback)(async()=>{F(null);try{let e=await f("/redroid/summary");O(e)}catch(e){O(null),F(e.message)}},[f]);(0,A.useEffect)(()=>{eN()},[eN]),(0,A.useEffect)(()=>{ek()},[ek]);let e_=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}ey("packages");try{let e=encodeURIComponent(Y.trim()),t=await f("/android/packages?serial=".concat(encodeURIComponent(N),"&query=").concat(e,"&limit=80"));q(t.packages||[])}catch(e){v(e.message),q([])}finally{ey(null)}},ez=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}let e=V.trim();if(e){ey("shell");try{var t,s;let n=await f("/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)}}},eS=(0,A.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"),ei(null);try{var n;let e=await f("/android/logcat?serial=".concat(encodeURIComponent(N),"&lines=").concat(t));en(null!==(n=e.text)&&void 0!==n?n:"")}catch(e){en(""),ei(e.message)}finally{s||ey(null)}},[N,f,ee]);(0,A.useEffect)(()=>{if(!eg||!N||!z)return;let e=window.setInterval(()=>void eS({silent:!0}),3e3);return eS({silent:!0}),()=>clearInterval(e)},[z,N,eg,eS]);let eC=async()=>{if(!N){v(g("请选择设备","Pick a device"));return}ey("ui"),ec(null);try{let e=await f("/android/ui?serial=".concat(encodeURIComponent(N),"&limit=100"));er(e.nodes||[])}catch(e){er([]),ec(e.message)}finally{ey(null)}},eP=async(e,t)=>{ey("redroid:".concat(e));try{let s=await f("/redroid/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,name:t||""})});s.summary&&O(s.summary),v(s.message||"OK"),await ek(),L()}catch(e){v(e.message)}finally{ey(null)}},eR=async e=>{await P("key",{keycode:e})},eL=async()=>{let e=ep.trim();if(!e){v(g("请输入文字","Enter text"));return}await P("text",{text:e})},eT=async()=>{let e=ed.trim();if(!e||"https://"===e){v(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.")})]}),z?(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(),L()},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:_.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))}),z&&0===_.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")}),I?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:I}):null,T?(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:[T.brand," ",T.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:[T.android_version," (sdk ",T.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:[T.kind||(null==ej?void 0:ej.kind)||"unknown"," / ",T.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:T.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:T.rotation})]}),(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[10px] leading-snug text-zinc-500",children:T.battery}),(0,n.jsx)("div",{className:"line-clamp-3 text-[10px] text-zinc-500",children:T.focus})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[em(null===(t=T.diagnostics)||void 0===t?void 0:t.ready,g("已启动","Boot ready"),g("未完成启动","Boot pending")),em(null===(s=T.diagnostics)||void 0===s?void 0:s.google_play,"Google Play","No Play"),em(null===(l=T.diagnostics)||void 0===l?void 0:l.google_services,"GMS","No GMS"),em(null===(i=T.diagnostics)||void 0===i?void 0:i.magisk,"Magisk","No Magisk"),em(null===(a=T.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=T.diagnostics)||void 0===r?void 0:r.boot_completed)||"-"]}),(0,n.jsxs)("div",{children:["provisioned: ",(null===(o=T.diagnostics)||void 0===o?void 0:o.device_provisioned)||"-"]}),(0,n.jsxs)("div",{children:["setup_complete: ",(null===(c=T.diagnostics)||void 0===c?void 0:c.user_setup_complete)||"-"]}),(0,n.jsxs)("div",{children:["abi: ",(null===(d=T.diagnostics)||void 0===d?void 0:d.abi)||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["hardware: ",(null===(x=T.diagnostics)||void 0===x?void 0:x.hardware)||"-"]})]})]}):I?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 eP("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")})]}),B?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:B}):null,D?(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: ",D.arch||"-"]}),(0,n.jsxs)("div",{className:"truncate",children:["image: ",D.image||"-"]}),(0,n.jsxs)("div",{children:["profile: ",D.device_profile||"-"]}),(0,n.jsxs)("div",{children:["gpu: ",D.gpu_mode||"-"]}),(0,n.jsxs)("div",{children:["adb: 127.0.0.1:",D.default_port||5555]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[em(null===(u=D.requirements)||void 0===u?void 0:u.docker_available,"Docker","No Docker"),em(null===(m=D.requirements)||void 0===m?void 0:m.adb_available,"ADB","No ADB"),em(null===(h=D.requirements)||void 0===h?void 0:h.kvm,"KVM","No KVM"),em(null===(p=D.requirements)||void 0===p?void 0:p.binderfs,"binderfs","No binderfs")]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(D.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 eP("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 eP("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 eP("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 eP("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:[em(null===(t=e.diagnostics)||void 0===t?void 0:t.ready,g("系统就绪","System ready"),g("启动中","Booting")),em(null===(s=e.diagnostics)||void 0===s?void 0:s.google_play,"Play","No Play"),em(null===(l=e.diagnostics)||void 0===l?void 0:l.magisk,"Magisk","No Magisk"),em(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=D.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)(ex,{t:g,apiBase:w,fetchJson:f,serial:N,devices:_,setSerial:k,adbAvailable:z,lock:ew,overview:T,onAndroidAction:P,notify:v,onRefreshDevices:L}),z&&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 eR("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 eR("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 eR("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 eR("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 eR("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 eR("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:ed,onChange:e=>eh(e.target.value),placeholder:"https://"}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eT(),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)(M.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,z&&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)(H.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&&e_()}}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void e_(),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,z&&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)(W.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:eu.map(e=>(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>$(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:V,onChange:e=>$(e.target.value),spellCheck:!1,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ez())}}),(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 ez(),className:"rounded-xl bg-amber-500/20 px-4 py-2 text-sm text-amber-100 ring-1 ring-amber-500/30",children:"shell"===ef?(0,n.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),"Run"]}):"Run"}),X?(0,n.jsxs)("button",{type:"button",disabled:!X,onClick:()=>R(X),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)(U.Z,{className:"h-3.5 w-3.5"}),g("复制输出","Copy")]}):null]}),X?(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:X}):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=>ev(e.target.checked)}),g("每 3 秒自动刷新","Auto every 3s")]}),(0,n.jsx)("button",{type:"button",disabled:ew,onClick:()=>void eS(),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:()=>R(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)(U.Z,{className:"h-3.5 w-3.5"}),g("复制","Copy")]}):null]}),el?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:el}):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,z&&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)(K.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")}),eo?(0,n.jsx)("p",{className:"mt-2 text-xs text-rose-300",children:eo}):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:[ea.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))),ea.length||eo?null:(0,n.jsx)("li",{className:"py-4 text-center text-zinc-600",children:g("尚未加载","Not loaded")})]})]}):null,z&&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:S,onChange:e=>C(e.target.value)}),(0,n.jsx)("button",{type:"button",disabled:ew||!z||!N,onClick:()=>void P("install_apk",{path:S}),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 ep=s(9897),eb=s(4554),eg=s(7689),ev=s(8401);function ef(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,ev.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 ej(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 eN(e){let t=(e||"").trim().replace(/^[\s"'`[\]()()【】]+|[\s"'`[\]()()【】]+$/g,"");return!(t=(t=(t=(t=t.replace(/^(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*/i,"")).replace(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/gi,"")).replace(/(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中).*$/i,"")).trim().replace(/^[\s,,;;||\-—::]+|[\s,,;;||\-—::]+$/g,""))||/^[-—_无未知]+$/i.test(t)||/^(unknown|null|undefined|none|nan)$/i.test(t)||/live\.douyin\.com/i.test(t)||/^\d{5,}$/.test(t)||/^(监测|格式|错误|无录制任务)/.test(t)?"":t.slice(0,48)}function ek(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=function(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!e||e.startsWith("#"))continue;let s=e.match(/https?:\/\/(?:www\.)?live\.douyin\.com\/[a-zA-Z0-9_-]+/i);if(!s||null==s.index)continue;let n=eN(e.slice(s.index+s[0].length));if(n)return n;let l=e.split(/[,,||]/,2);if(l.length>1){let e=eN(l[1]);if(e)return e}}return""}(e)||function(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).slice(-160);for(let e=t.length-1;e>=0;e-=1){let s=t[e],n=s.match(/(?:主播|房间名|直播间|抖音源|源站|标题)\s*[::]\s*(.{1,80})/i),l=s.match(/(?:序号\s*\d+\s*)?(.{1,80}?)\s*(?:等待直播|正在直播|直播中|已开播|开始推流|主播已下播|下播|录制中|推流中)/i),i=eN((null==n?void 0:n[1])||(null==l?void 0:l[1])||"");if(i)return i}return""}(t);if(s)return s;let n=e_(t)||ez(e)[0]||"";return n?"抖音直播间 ".concat(n):""}function e_(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}function ez(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)}function eS(e){let t="",s=!0,n="",l=!0,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 eC(e){return"URL_config.".concat(e.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")}function eP(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 eR(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 eL(e){var t,s,l;let{t:i,currentProc:a,fetchJson:r,urlListText:o,keySuffixUi:c,showKeyRow:d=!0,pollMs:x=1e3,refreshToken:u=0}=e,[m,h]=(0,A.useState)(""),[p,b]=(0,A.useState)(""),[g,v]=(0,A.useState)(""),[f,y]=(0,A.useState)(""),[j,N]=(0,A.useState)(""),[k,_]=(0,A.useState)([]),[z,S]=(0,A.useState)(null),[C,P]=(0,A.useState)(""),[R,L]=(0,A.useState)(""),[T,M]=(0,A.useState)(""),[E,U]=(0,A.useState)(""),[I,Z]=(0,A.useState)(!1),[D,O]=(0,A.useState)(null),[B,H]=(0,A.useState)(0),[W,K]=(0,A.useState)(!0),F=(0,A.useRef)(null),Y=(0,A.useRef)(null),G=(0,A.useRef)(!1),q=(0,A.useRef)(!1),V=(0,A.useRef)(!1),Q=(0,A.useRef)(a),ee=(0,A.useRef)(0),et=ez(o),es=/^(online|running)$/i.test(m),en=e_(p),el=null!==(s=ej(o)[0])&&void 0!==s?s:"",ei=R||en||(null!==(l=null===(t=el.match(/live\.douyin\.com\/([a-zA-Z0-9_-]+)/i))||void 0===t?void 0:t[1])&&void 0!==l?l:null),ea=T||(ei?"https://live.douyin.com/".concat(ei):el||null),er=E||C||ek(o,p)||(ei?"抖音直播间 ".concat(ei):""),eo="youtube_key_rejected"===f.trim().toLowerCase(),ec=(0,A.useCallback)(async()=>{let e=Q.current.trim();if(!e)return;if(q.current){V.current=!0;return}q.current=!0;let t=++ee.current;try{let s=await r("/status?process=".concat(encodeURIComponent(e)));if(t!==ee.current||e!==Q.current.trim())return;let n=s.process_status||"unknown";h(n),b(s.recent_log||""),v(s.recent_error||""),y(s.business_status||""),N(s.business_note||""),_(Array.isArray(s.ffmpeg_pids)?s.ffmpeg_pids:[]),S("number"==typeof s.log_age_seconds?s.log_age_seconds:null),P(s.source_title||""),L(s.source_room_id||""),M(s.source_url||""),U(s.source_display||"");let l=/^(online|running)$/i.test(n);l&&!G.current&&O(Date.now()),l||O(null),G.current=l}catch(s){if(t!==ee.current||e!==Q.current.trim())return;h("error"),y("error"),N(""),_([]),S(null),P(""),L(""),M(""),U("")}finally{q.current=!1,V.current&&(V.current=!1,window.setTimeout(()=>void ec(),0))}},[r]);(0,A.useEffect)(()=>{if(Q.current=a,ee.current+=1,V.current=!1,!a){h(""),b(""),v(""),y(""),N(""),_([]),S(null),P(""),L(""),M(""),U(""),O(null),G.current=!1;return}h(""),b(""),v(""),y(""),N(""),_([]),S(null),P(""),L(""),M(""),U(""),O(null),G.current=!1,ec()},[a,ec]),(0,A.useEffect)(()=>{let e=()=>K("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{a&&ec()},[a,ec,u]),(0,A.useEffect)(()=>{if(I||!W||!a)return;let e=window.setInterval(()=>void ec(),x);return()=>clearInterval(e)},[I,W,a,ec,x]),(0,A.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&ec()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[ec]),(0,A.useEffect)(()=>{if(!D)return;let e=window.setInterval(()=>H(e=>e+1),1e3);return()=>clearInterval(e)},[D]),(0,A.useEffect)(()=>{if(I||!W)return;let e=F.current;e&&(e.scrollTop=e.scrollHeight)},[p,I,W]),(0,A.useEffect)(()=>{if(I||!W)return;let e=Y.current;e&&(e.scrollTop=e.scrollHeight)},[g,I,W]);let ed=null==D?i("—(未检测到在线)","— (not online)"):eR(Math.max(0,Math.floor((Date.now()-D)/1e3))),ex=I?i("已暂停刷新","Paused"):W?i("每秒刷新","~1s refresh"):i("后台暂停","Hidden"),eu=I?"bg-amber-500/20 text-amber-100 ring-amber-500/35":W?"bg-emerald-500/15 text-emerald-200/90 ring-emerald-500/25":"bg-sky-500/15 text-sky-100 ring-sky-500/25";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:B}),(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-white/10 px-2 py-0.5 font-mono text-[10px] text-zinc-300 ring-1 ring-white/10",children:a||"—"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-medium ring-1 ".concat(eu),children:ex})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>void ec(),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)(w.Z,{className:"h-3.5 w-3.5"}),i("立即拉取","Refresh")]}),(0,n.jsxs)("button",{type:"button",onClick:()=>Z(e=>!e),className:"inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs ring-1 ".concat(I?"bg-amber-500/20 text-amber-100 ring-amber-500/35":"border border-white/10 bg-black/30 text-zinc-300"),children:[I?(0,n.jsx)($.Z,{className:"h-3.5 w-3.5"}):(0,n.jsx)(X.Z,{className:"h-3.5 w-3.5"}),I?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"):"youtube_key_rejected"===n?e("YouTube 推流失败:串流密钥无效、过期或不属于当前直播间","YouTube rejected the stream key"):"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,j)})]}),(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:ed})]}),(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:[k.length?k.join(", "):"none",null!=z?" \xb7 log ".concat(eR(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,eo?(0,n.jsx)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/[0.10] px-3 py-2.5 text-xs text-rose-100 ring-1 ring-rose-500/15",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(ey.Z,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-300","aria-hidden":!0}),(0,n.jsx)("p",{children:i("YouTube 已拒绝本次 RTMPS 推流。请从 YouTube Studio 当前直播间复制完整串流密钥,保存到当前线路后重新开始;如果密钥确认无误,再检查到 YouTube RTMPS 的网络/代理。","YouTube rejected this RTMPS publish. Copy the full stream key for the current live event from YouTube Studio, save it to this lane, then start again; if the key is correct, check network/proxy access to YouTube RTMPS.")})]})}):null,ea?(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:en?i("当前直播源站(日志)","Current source (from log)"):es?i("配置中的源站地址","Configured source URL"):i("源站快捷入口","Source quick link")}),(0,n.jsxs)("a",{href:ea,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)(J.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-90"}),er||i("打开抖音直播页","Open Douyin live")]})]}),ei&&er&&!er.includes(ei)?(0,n.jsxs)("p",{className:"mt-2 font-mono text-[10px] text-zinc-600",children:["room:",ei]}):null,et.length>1&&en?(0,n.jsxs)("p",{className:"mt-2 text-[10px] text-zinc-600",children:[i("配置中还有","Also in config:")," ",et.filter(e=>e!==ei).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)),et.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:F,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:p.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:Y,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:g.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 eT(e){return/tiktok/i.test(e.script)||/tiktok/i.test(e.pm2)}let eM=[{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."}],eE="live-hub-tiktok-hdmi-check-v1",eU="live-hub-tiktok-hdmi-notes-v1",eI="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:u,onCopy:m,fetchJson:h,apiPrefix:p,quickLinks:b,hdmiStatus:g,notify:v,onNavigate:f}=e,y=(0,A.useMemo)(()=>i.filter(eT),[i]),w=y.length?y:i,[j,N]=(0,A.useState)("srs"),[k,_]=(0,A.useState)([]),[z,S]=(0,A.useState)(!1),[C,P]=(0,A.useState)(!1),[R,M]=(0,A.useState)("1080p30"),[E,I]=(0,A.useState)("1080p30"),[Z,D]=(0,A.useState)(!1),[O,B]=(0,A.useState)(!0),[H,W]=(0,A.useState)(null),K=(0,A.useRef)(!1),F=(0,A.useRef)(o),[Y,J]=(0,A.useState)(""),[G,q]=(0,A.useState)({}),$=(0,A.useCallback)(e=>{F.current=e,c(e)},[c]),X=(0,A.useCallback)(e=>{N(e);try{window.localStorage.setItem(eI,e)}catch(e){}},[]);(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(eI);("ffmpeg"===e||"replay"===e||"srs"===e)&&("ffmpeg"!==e&&"replay"!==e?N(e):N("srs"))}catch(e){}},[]),(0,A.useEffect)(()=>{K.current=!1},[a]),(0,A.useEffect)(()=>{F.current=o},[o]);let Q=(0,A.useCallback)(async()=>{if(a)try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),s=await h("/get_url_config?".concat(t));$(null!==(e=s.content)&&void 0!==e?e:"")}catch(e){}},[$,a,h]);(0,A.useEffect)(()=>{if(!a||!O||"ffmpeg"!==j)return;let e=window.setInterval(()=>{K.current||Q()},8e3);return()=>clearInterval(e)},[a,O,Q,j]),(0,A.useEffect)(()=>{"ffmpeg"===j&&a&&Q()},[j,a,Q]);let et=(0,A.useCallback)(async()=>{if(a){S(!0);try{var e;let t=await h("/tiktok_replay/list?process=".concat(encodeURIComponent(a)));_(null!==(e=t.files)&&void 0!==e?e:[])}catch(e){v(e.message),_([])}finally{S(!1)}}},[a,h,v]);(0,A.useEffect)(()=>{"replay"===j&&a&&et()},[j,a,et]),(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(eE);e&&q(JSON.parse(e))}catch(e){}try{J(window.localStorage.getItem(eU)||"")}catch(e){}},[]);let es=(0,A.useCallback)(e=>{q(e);try{window.localStorage.setItem(eE,JSON.stringify(e))}catch(e){}},[]),en=e=>{J(e);try{window.localStorage.setItem(eU,e)}catch(e){}},el=async()=>{if(a){D(!0),W(null),K.current=!1;try{var e;let t=new URLSearchParams({process:a,_ts:String(Date.now())}),n=await h("/get_url_config?".concat(t));$(null!==(e=n.content)&&void 0!==e?e:""),W(s("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(e){W(e.message)}finally{D(!1)}}},ei=async()=>{try{await Promise.resolve(x(F.current)),K.current=!1}catch(e){}},ea=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})}),v(s("已删除文件","File removed")),await et()}catch(e){v(e.message)}finally{P(!1)}}},er=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,ee.N)("".concat(p,"/tiktok_replay/upload?process=").concat(encodeURIComponent(a)),{method:"POST",body:e});v(t.message||s("上传成功","Uploaded")),await et()}catch(e){v(e.message)}finally{P(!1)}}},eo=l||Z||C,ec=eM.find(e=>e.id===E),ed=!!(null==g?void 0:g.can_stream_hdmi),ex=(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:[f?(0,n.jsx)(ef,{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:f,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)(T.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)(ep.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(ed?"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30":"bg-rose-500/15 text-rose-200 ring-rose-500/25"),children:ed?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:ex||"—"})]}),(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:()=>m(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)(U.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)(V.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=>X(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:eo,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:ec?s(ec.labelZh,ec.labelEn):E})]})]}),"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)(eb.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)(eg.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:er})]}),(0,n.jsx)("button",{type:"button",disabled:eo||!a,onClick:()=>void et(),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.")}),z?(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:eo,onClick:()=>void(async()=>{try{await Promise.resolve(u(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:eo,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:eo,onClick:()=>void ea(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)(L.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:()=>m(b.srs_rtmp_publish),children:(0,n.jsx)(U.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:()=>m(b.srs_play_flv||b.srs_http),children:(0,n.jsx)(U.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)(ep.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:eM.map(e=>{let t=R===e.id,l=E===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)(ep.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=>es({...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:Y,onChange:e=>en(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:()=>m(o),children:[(0,n.jsx)(U.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:O,onChange:e=>B(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=>{K.current=!0,$(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:eo,onClick:()=>void el(),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:eo,onClick:()=>void ei(),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)(eL,{t:s,currentProc:a,fetchJson:h,urlListText:"ffmpeg"===j?o:"",keySuffixUi:"",showKeyRow:!1})]})}var eA=s(5468),eD=s(1094),eO=s(5621),eB=s(91),eH=s(2208),eW=s(9397),eK=s(90);let eF="live-hub-youtube-pro-v2",eY="youtube2__",eJ=/[^a-zA-Z0-9_.-]+/g,eG=new Set(["youtube","douyin_youtube","tiktok","obs","web"]);function eq(e,t){var s;let n=(e||"").trim();if(!function(e){let t=(e||"").trim();return!t||/\?{2,}/.test(t)||/?{2,}/.test(t)||/�/.test(t)||/锟|绾胯矾|çº|è·|Â/.test(t)||/^(undefined|null|nan)$/i.test(t)}(n))return n;let l=(null===(s=n.match(/\d+/))||void 0===s?void 0:s[0])||String(Math.max(0,t)+1);return"线路 ".concat(l)}function eV(e){return e.map((e,t)=>({...e,name:eq(e.name,t)}))}function e$(e){return(e||"").trim().replace(eJ,"_")}function eX(e,t){let s=e$(e);return!s||eG.has(s)||s===eY?e8(t):s.startsWith(eY)?s:e8(s)}function eQ(e){return eX(String(e.pm2Name||""),String(e.id||""))}function e0(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e||"object"!=typeof e)return null;let s=String(e.id||"").trim();return s?{id:s,name:eq("string"==typeof e.name?e.name:"",t),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:eX("string"==typeof e.pm2Name?e.pm2Name:"",s),notes:"string"==typeof e.notes?e.notes:void 0}:null}function e1(e){if(!e)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let s=t.map((e,t)=>e0(e,t)).filter(e=>null!==e);return eV(s)}catch(e){return[]}}function e5(e){window.localStorage.setItem(eF,JSON.stringify(eV(e)))}let e2=["/hub/youtube_pro_channels","/youtube_pro_channels"];async function e3(e){for(let s of e2)try{var t;let n=await e(s);return{fetched:!0,channels:(t=n.channels,Array.isArray(t)?eV(t.map((e,t)=>e0(e,t)).filter(e=>null!==e)):[])}}catch(e){}return{fetched:!1,channels:[]}}async function e4(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=null,l=eV(t);for(let t of e2)try{var i;let a=await e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channels:l,force:!!s.force})});if((null===(i=a.neko)||void 0===i?void 0:i.ok)===!1){let e=a.neko.desired?" desired=".concat(a.neko.desired):"",t=a.neko.current?" current=".concat(a.neko.current):"";n=Error("Neko capacity expansion failed:".concat(e).concat(t," ").concat(a.neko.reason||"unknown error").trim());break}return}catch(e){n=e instanceof Error?e:Error(String(e))}throw null!=n?n:Error("youtube_pro_channels sync failed")}function e6(){return"ch_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,7))}function e8(e){return"".concat(eY).concat(e$(e)||"channel")}function e9(e){return/youtube/i.test(e.script)||/youtube/i.test(e.pm2)}function e7(e){return e.trim().toLowerCase().startsWith("youtube2__")}function te(e){return(e.split("/").pop()||e).replace(/\.[^.]+$/,"")}function tt(e){var t;return!!e&&(/youtube/i.test(e.pm2)||/youtube/i.test(null!==(t=e.script)&&void 0!==t?t:""))}function ts(e,t){let s=((null==t?void 0:t.business_status)||"").trim().toLowerCase();return(null==t?void 0:t.is_pushing)||"streaming"===s?0:to(null==t?void 0:t.process_status)?1:"youtube"===e.pm2.trim().toLowerCase()?2:"youtube"===te(e.script).trim().toLowerCase()?3:10}let tn="live-hub-youtube-mode-v1",tl=new Set(["youtube","douyin_youtube","tiktok","obs","web"]);function ti(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:e8(e.id),notes:null!==(n=e.notes)&&void 0!==n?n:""}}function ta(e){return Object.fromEntries(e.map(e=>[e.id,ti(e)]))}function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=((null==e?void 0:e.source_display)||(null==e?void 0:e.source_title)||"").trim();if(n)return n;let l=ek(t,s).trim();if(l)return l;let i=((null==e?void 0:e.source_room_id)||"").trim();return i?"抖音直播间 ".concat(i):""}function to(e){return/^(online|running)$/i.test((e||"").trim())}function tc(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"):"youtube_key_rejected"===s?t("密钥被 YouTube 拒绝","Key rejected"):"stale"===s?t("心跳过期","Stale"):"error"===s?t("异常","Error"):to(null==e?void 0:e.process_status)?t("运行中","Running"):((null==e?void 0:e.process_status)||"").trim()||t("未运行","Idle")}function td(e){let t=Math.max(0,Math.floor(e||0));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);return s<60?"".concat(s,"m ").concat(t%60,"s"):"".concat(Math.floor(s/60),"h ").concat(s%60,"m")}function tx(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString()}catch(e){return"-"}}function tu(e){let t=(e||"").toLowerCase();return"active"===t?"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30":"error"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"ended"===t?"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tm(e,t){let s=(e||"").toLowerCase();return"active"===s?t("直播中","Live"):"ended"===s?t("已结束","Ended"):"error"===s?t("异常","Problem"):"idle"===s?t("等待中","Waiting"):t("记录","Record")}function th(e,t){return null==e?t?t("未知","Unknown"):"-":e.toLocaleString()}function tp(e,t){return e?(e.source_title||e.channel_name||"").trim()||(e.source_room_id?t("抖音直播间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.process?t("直播线路 ".concat(e.process),"Relay lane ".concat(e.process)):t("直播事件 #".concat(e.id),"Live event #".concat(e.id))):t("未选择直播","No event selected")}function tb(e,t){return e?e.source_room_id?t("抖音房间 ".concat(e.source_room_id),"Douyin room ".concat(e.source_room_id)):e.source_url?e.source_url.replace(/^https?:\/\//,""):t("来源未识别","Unknown source"):"-"}function tg(e,t){let s=Math.max(0,Math.floor(e||0));if(s<60)return t("".concat(s," 秒"),"".concat(s,"s"));let n=Math.floor(s/60);if(n<60)return t("".concat(n," 分 ").concat(s%60," 秒"),"".concat(n,"m ").concat(s%60,"s"));let l=Math.floor(n/60),i=n%60;return t("".concat(l," 小时 ").concat(i," 分"),"".concat(l,"h ").concat(i,"m"))}function tv(e){if(!e)return"-";try{return new Date(1e3*e).toLocaleString(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(e){return"-"}}function tf(e,t){var s;if(!e)return"-";let n=(e.status||"").toLowerCase(),l="".concat(e.last_health||""," ").concat(e.last_live_status||""," ").concat(e.last_popup_text||"").toLowerCase();return"error"===n||/error|failed|poor|unstable|异常|错误|失败/.test(l)?t("需要处理","Needs attention"):e.last_popup_text?t("有弹窗","Popup seen"):(null!==(s=e.quality_score)&&void 0!==s?s:100)<50?t("质量偏低","Low quality"):t("正常","Normal")}function ty(e){let t=tf(e,e=>e);return"需要处理"===t||"质量偏低"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"有弹窗"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25"}function tw(e){let t=Number(e||0);return t>=80?"text-emerald-200":t>=55?"text-amber-200":"text-rose-200"}function tj(e){let t=(e||"").toLowerCase();return"critical"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/30":"warning"===t?"bg-amber-500/15 text-amber-100 ring-amber-500/30":"ok"===t?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25"}function tN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"number"!=typeof e||Number.isNaN(e)?"-":"".concat(e.toFixed(e>=100?0:2).replace(/\.00$/,"")).concat(t)}function tk(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith("#"))}function t_(e,t){return tk(e).length>0&&0===tk(t).length}function tz(e){let{kind:t,busyKind:s,targetPm2:l,busy:i,online:a,label:r,className:o,baseLock:c,onRun:d,notify:x,t:u,compact:m}=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),v=!!(p&&h.action!==b),f="start"===t&&a,w="stop"===t&&!a,j="restart"===t&&!a,N=f||w||j;return(0,n.jsxs)("button",{type:"button",onClick:()=>{if(!g){if(v){x(u("请等待当前操作完成","Wait for the current action to finish"));return}if(f){x(u("已在直播中,无需重复开始","Already live"));return}if(w){x(u("当前未在直播,无法停止","Not live — cannot stop"));return}if(j){x(u("进程未运行时请使用「开始直播」","Use Start when the process is not running"));return}c||d()}},className:"relative overflow-hidden rounded-xl ring-1 transition ".concat(m?"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||v?"cursor-not-allowed":""," ").concat(N&&!g?"opacity-45":""," ").concat(v?"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)(y.Z,{className:"".concat(m?"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)(eA.Z,{className:"".concat(m?"h-3 w-3":"h-4 w-4"," shrink-0 opacity-90"),"aria-hidden":!0}):null,r]})]})}function tS(e){var t,s,l,i,r,o,d,x,u,m,h,p,b,g,v,f,j,N,_,z,S,C,P,R,T;let{t:M,busy:E,entries:U,currentProc:I,setCurrentProc:Z,urlConfig:D,setUrlConfig:O,onRunProcess:B,onSaveUrlConfig:H,fetchJson:W,liveProcesses:K,notify:F,onNavigate:Y,quickLinks:G}=e,q=(0,A.useMemo)(()=>U.filter(e9),[U]),X=(0,A.useMemo)(()=>(function(e,t){let s=e.filter(e=>e9(e)&&!e7(e.pm2)),n=s.filter(e=>e9(e)&&e.pm2.trim()===te(e.script).trim()),l=n.length?[...n]:s.length?[...s]:[...e],i=new Set(l.map(e=>e.pm2.trim()));for(let e of t.filter(e=>tt(e)&&!e7(e.pm2))){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&&!to(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})(q.length?q:U,K),[U,K,q]),Q=(0,A.useMemo)(()=>(function(e,t){if(!e.length)return"";let s=new Map(t.filter(tt).map(e=>[e.pm2.trim(),e])),n=e[0],l=ts(n,s.get(n.pm2.trim()));for(let t of e.slice(1)){let e=ts(t,s.get(t.pm2.trim()));e"youtube"===e.pm2.trim().toLowerCase());if(n)return n.pm2;let l=e.find(e=>"youtube"===te(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:""}(X),[K,X]),[ee,et]=(0,A.useState)("single"),[es,en]=(0,A.useState)([]),[el,ei]=(0,A.useState)(""),[ea,er]=(0,A.useState)(D),[eo,ec]=(0,A.useState)(""),[ed,ex]=(0,A.useState)({key:"",rtmps:!0,bitrate:"",fastAudio:!0}),[eu,em]=(0,A.useState)(null),[eh,ep]=(0,A.useState)(!1),[eb,eg]=(0,A.useState)(""),[eN,ek]=(0,A.useState)(!0),[e_,ez]=(0,A.useState)(!1),[eR,eT]=(0,A.useState)(!1),[eM,eE]=(0,A.useState)(null),[eU,eI]=(0,A.useState)({}),[eZ,eA]=(0,A.useState)(!1),[eY,eJ]=(0,A.useState)(null),[eG,eX]=(0,A.useState)(0),[e0,e2]=(0,A.useState)(null),[tS,tC]=(0,A.useState)(null),[tP,tR]=(0,A.useState)(!1),[tL,tT]=(0,A.useState)(null),[tM,tE]=(0,A.useState)(!1),[tU,tI]=(0,A.useState)(null),[tZ,tA]=(0,A.useState)(null),tD=(0,A.useRef)(!1),tO=(0,A.useRef)(D),tB=(0,A.useRef)(eb),tH=(0,A.useRef)([]),tW=(0,A.useRef)(I),tK=(0,A.useRef)(new Set),tF=(0,A.useRef)(0),tY=(0,A.useRef)(0),tJ=(0,A.useCallback)(e=>{tO.current=e,er(e),O(e)},[O]),tG=(0,A.useCallback)(e=>{tB.current=e,eg(e)},[]);(0,A.useEffect)(()=>{tD.current=!1},[I]),(0,A.useEffect)(()=>{tW.current=I},[I]),(0,A.useEffect)(()=>{"single"===ee&&(tO.current=D,er(D))},[ee,D]),(0,A.useEffect)(()=>{tB.current=eb},[eb]),(0,A.useEffect)(()=>{tH.current=es},[es]),(0,A.useEffect)(()=>{tK.current=new Set(X.map(e=>e.pm2))},[X]),(0,A.useEffect)(()=>{tF.current+=1,tY.current+=1,tD.current=!1,eE(null)},[ee,el]);let tq=(0,A.useCallback)((e,t)=>{e&&en(s=>{let n=!1,l=s.map(s=>{var l;return s.id!==e||(null!==(l=s.urlLines)&&void 0!==l?l:"")===t?s:(n=!0,{...s,urlLines:t})});return n?(tH.current=l,e5(l),l):s})},[]),tV=(0,A.useCallback)(async()=>{let e=tW.current.trim();if(!e)return;if("pro"===ee){let t=tH.current.find(e=>e.id===el);if(!t||eQ(t)!==e)return}else if(tK.current.size&&!tK.current.has(e))return;let t=++tF.current;try{var s,n,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),a=await W("/get_url_config?".concat(i));if(t!==tF.current||e!==tW.current.trim())return;let r=null!==(s=a.content)&&void 0!==s?s:"";if(tD.current)return;if("single"===ee)tJ(r);else{let e=null!==(l=null===(n=tH.current.find(e=>e.id===el))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(t_(e,r)){tG(e);return}tG(r),tq(el,r)}}catch(e){}},[el,tG,tJ,W,ee,tq]);(0,A.useEffect)(()=>{if(!I||!eN)return;let e=window.setInterval(()=>{tD.current||tV()},8e3);return()=>clearInterval(e)},[I,eN,tV]);let t$=async()=>{let e=tW.current.trim();if(!e)return;if("pro"===ee){let t=tH.current.find(e=>e.id===el);if(!t||eQ(t)!==e)return}else if(tK.current.size&&!tK.current.has(e))return;ez(!0),eE(null),tD.current=!1;let t=++tF.current;try{var s,n,l;let i=new URLSearchParams({process:e,_ts:String(Date.now())}),a=await W("/get_url_config?".concat(i));if(t!==tF.current||e!==tW.current.trim())return;let r=null!==(s=a.content)&&void 0!==s?s:"";if(tD.current){eE(M("检测到本地未保存修改,已保留当前草稿","Kept the local unsaved draft"));return}if("single"===ee)tJ(r);else{let e=null!==(l=null===(n=tH.current.find(e=>e.id===el))||void 0===n?void 0:n.urlLines)&&void 0!==l?l:"";if(t_(e,r)){tG(e),eE(M("服务器暂无已保存 URL,已保留本地草稿","Server has no saved URLs, kept the local draft"));return}tG(r),tq(el,r)}eE(M("已从服务器读取 URL_config","Reloaded URL_config from server"))}catch(s){if(t!==tF.current||e!==tW.current.trim())return;eE(s.message)}finally{t===tF.current&&ez(!1)}};(0,A.useEffect)(()=>{try{let e=window.localStorage.getItem(tn);("pro"===e||"single"===e)&&et(e)}catch(e){}},[]),(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await e3(W);if(t.fetched&&t.channels.length&&!e){let e=eV(t.channels);tH.current=e,en(e),eI(ta(e)),e5(e);return}}catch(e){}if(e)return;let t=function(){let e=window.localStorage.getItem(eF);if(!e&&(e=window.localStorage.getItem("live-hub-youtube-pro-v1"))){let t=e1(e);if(t.length)return window.localStorage.setItem(eF,JSON.stringify(t)),t}return e1(e)}(),s=eV(t.length>0?t:(()=>{let e=e6();return[{id:e,name:"线路 1",streamKey:"",urlLines:"",pm2Name:e8(e),notes:""}]})());tH.current=s,en(s),eI(ta(s)),e5(s)})(),()=>{e=!0}},[W]),(0,A.useEffect)(()=>{if(!es.length){el&&ei("");return}el&&es.some(e=>e.id===el)||ei(es[0].id)},[es,el]);let tX=es.find(e=>e.id===el)||es[0],tQ=(0,A.useCallback)(e=>K.find(t=>t.pm2===e),[K]),t0=(0,A.useCallback)(e=>{var t;return null===(t=tQ(e))||void 0===t?void 0:t.process_status},[tQ]),t1=tQ(I),t5=tX?eQ(tX):"",t2=t5?tQ(t5):void 0,t3="single"===ee&&t5&&t5!==I&&function(e){let t=((null==e?void 0:e.business_status)||"").trim().toLowerCase();return!!((null==e?void 0:e.is_pushing)||to(null==e?void 0:e.process_status)||["streaming","source_live","waiting_source","youtube_key_rejected","error"].includes(t))}(t2)?t5:I,t4="single"===ee?t3:I,t6=tQ(t4),t8=(0,A.useMemo)(()=>!!I&&X.some(e=>e.pm2===I),[I,X]);(0,A.useEffect)(()=>{"single"!==ee||!Q||I&&t8||(tW.current=Q,Z(Q))},[I,t8,ee,Q,Z]);let t9=(0,A.useCallback)(e=>{let t=eV(e);tH.current=t,en(t),e5(t)},[]),t7=(0,A.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};await e4(W,e,t)},[W]),se=(0,A.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t9(e),t7(e,t).catch(e=>{F("".concat(M("多频道列表未同步到服务器","Channel list not saved on server"),": ").concat(e.message))})},[t9,F,t7,M]),st=(0,A.useMemo)(()=>{var e;return tX?null!==(e=eU[tX.id])&&void 0!==e?e:ti(tX):null},[tX,eU]);(0,A.useEffect)(()=>{tX&&eI(e=>e[tX.id]?e:{...e,[tX.id]:ti(tX)})},[tX]),(0,A.useEffect)(()=>{eJ(null)},[el]);let ss=(0,A.useCallback)((e,t)=>{tX&&(eI(s=>{var n;return{...s,[tX.id]:{...null!==(n=s[tX.id])&&void 0!==n?n:ti(tX),[e]:t}}}),eJ(null))},[tX]),sn=tX?eQ(tX):"",sl=tX&&st?eQ({id:tX.id,pm2Name:st.pm2Name}):"",si=!!tX&&!!st&&sl!==sn,sa=(0,A.useMemo)(()=>{if(!tX||!st)return{ok:!1,message:M("请选择线路","Pick a lane"),normalizedName:"",normalizedPm2:"",normalizedStreamKey:"",normalizedNotes:""};let e=es.findIndex(e=>e.id===tX.id),t=eq(st.name,e>=0?e:0),s=eQ({id:tX.id,pm2Name:st.pm2Name});return s?tl.has(s)?{ok:!1,message:M("该进程名保留给系统模块,请换一个","This PM2 name is reserved"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:st.streamKey.trim(),normalizedNotes:st.notes.trim()}:es.find(e=>e.id!==tX.id&&eQ(e)===s)?{ok:!1,message:M("该进程名已被其它线路占用","Another lane already uses this PM2 name"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:st.streamKey.trim(),normalizedNotes:st.notes.trim()}:{ok:!0,message:"",normalizedName:t,normalizedPm2:s,normalizedStreamKey:st.streamKey.trim(),normalizedNotes:st.notes.trim()}:{ok:!1,message:M("进程名不能为空","PM2 name is required"),normalizedName:t,normalizedPm2:s,normalizedStreamKey:st.streamKey.trim(),normalizedNotes:st.notes.trim()}},[tX,st,es,M]),sr=(0,A.useMemo)(()=>{if(!tX||!st)return!1;let e=ti(tX);return st.name!==e.name||st.streamKey!==e.streamKey||e$(st.pm2Name)!==e$(e.pm2Name)||st.notes!==e.notes},[tX,st]),so=(0,A.useCallback)(async e=>{let t=e.trim();if(!t)return;let s=++tF.current,n=++tY.current;tD.current=!1,ez(!0),ep(!0),eE(M("正在同步单频道配置...","Syncing single-channel config...")),em(null);try{var l,i;let[e,a]=await Promise.allSettled([W("/get_url_config?".concat(new URLSearchParams({process:t,_ts:String(Date.now())}))),W("/get_config?".concat(new URLSearchParams({process:t,_ts:String(Date.now())})))]);if(s===tF.current&&t===tW.current.trim()&&("fulfilled"===e.status?(tJ(null!==(l=e.value.content)&&void 0!==l?l:""),eE(M("单频道配置已实时同步","Single-channel config synced"))):eE(e.reason instanceof Error?e.reason.message:String(e.reason))),n===tY.current&&t===tW.current.trim()){if("fulfilled"===a.status){let e=null!==(i=a.value.content)&&void 0!==i?i:"";ec(e),ex(eS(e))}else em(a.reason instanceof Error?a.reason.message:String(a.reason))}}finally{s===tF.current&&ez(!1),n===tY.current&&ep(!1),t===tW.current.trim()&&eX(e=>e+1)}},[tJ,W,M]),sc=(0,A.useCallback)(async()=>{try{var e,t;let s=await e3(W);if(!s.fetched||!s.channels.length)return;let n=eV(s.channels);tH.current=n,en(n),eI(ta(n)),e5(n);let l=null!==(e=n.find(e=>e.id===el))&&void 0!==e?e:n[0];if(!l)return;ei(l.id),tG((null!==(t=l.urlLines)&&void 0!==t?t:"").trim());let i=eQ(l);tW.current=i,Z(i)}catch(e){}},[el,tG,W,Z]),sd=(0,A.useCallback)(async e=>{var t,s;let n=e.trim();if(!n||!tX)return;let l=(null!==(s=null!==(t=null==st?void 0:st.streamKey)&&void 0!==t?t:tX.streamKey)&&void 0!==s?s:"").trim(),i=tB.current||tX.urlLines||"",a=eS(eo||eP(ed)),r={key:l,rtmps:a.rtmps,bitrate:a.bitrate,fastAudio:a.fastAudio},o=eP(r);tF.current+=1,tY.current+=1,tD.current=!1,tJ(i),ec(o),ex(r),eE(M("已同步当前 Pro 线路到单频道","Synced current Pro lane to single-channel")),em(M("已同步当前 Pro 线路到 single youtube.ini","Synced current Pro lane to single youtube.ini")),ez(!0),ep(!0);try{let e=new URLSearchParams({process:n});await W("/save_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o})}),await W("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})}),n===tW.current.trim()&&eX(e=>e+1)}catch(t){let e=t instanceof Error?t.message:String(t);eE(e),em(e),F(e)}finally{ez(!1),ep(!1)}},[tX,st,tJ,W,F,M,eo,ed]),sx=(0,A.useCallback)(async()=>{var e;let t=null!==(e=el?es.find(e=>e.id===el):null)&&void 0!==e?e:es[0];if(!t)return;let s=eQ(t),n=tO.current,l={key:ed.key.trim(),rtmps:ed.rtmps,bitrate:ed.bitrate,fastAudio:ed.fastAudio},i=eP(l),a=eV(es.map(e=>e.id===t.id?{...e,streamKey:l.key,urlLines:n,pm2Name:s}:e));tH.current=a,en(a),e5(a),eI(e=>{var n;return{...e,[t.id]:{...null!==(n=e[t.id])&&void 0!==n?n:ti(t),streamKey:l.key,pm2Name:s}}}),ei(t.id),tG(n),tW.current=s,Z(s),eE(M("已同步单频道到当前 Pro 线路","Synced single-channel to current Pro lane")),em(M("已同步单频道到 Pro youtube.ini","Synced single-channel to Pro youtube.ini")),ez(!0),ep(!0);try{await t7(a,{force:!0});let e=new URLSearchParams({process:s});await W("/save_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})}),await W("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),s===tW.current.trim()&&eX(e=>e+1)}catch(t){let e=t instanceof Error?t.message:String(t);eE(e),em(e),F(e)}finally{ez(!1),ep(!1)}},[el,tG,es,W,F,Z,t7,M,ed]),su=(0,A.useCallback)(e=>{var t,s,n;if("single"===e){let e=Q||(null===(t=X[0])||void 0===t?void 0:t.pm2)||"";e&&(tW.current=e,Z(e),"pro"===ee&&tX?sd(e):so(e))}if("pro"===e&&es.length){let e=null!==(s=es.find(e=>e.id===el))&&void 0!==s?s:es[0];if(tG((null!==(n=null==e?void 0:e.urlLines)&&void 0!==n?n:"").trim()),e){let t=eQ(e);tW.current=t,Z(t)}"single"===ee?sx():sc()}et(e);try{window.localStorage.setItem(tn,e)}catch(e){}},[es,tG,el,tX,ee,Q,sc,so,Z,X,sd,sx]),sm=(0,A.useCallback)(e=>{var t,s;let n=tB.current;tX&&"pro"===ee&&n!==(null!==(t=tX.urlLines)&&void 0!==t?t:"").trim()&&se(es.map(e=>e.id===tX.id?{...e,urlLines:n}:e)),tG((null!==(s=e.urlLines)&&void 0!==s?s:"").trim()),ei(e.id);let l=eQ(e);tW.current=l,Z(l)},[tX,tG,ee,es,Z,se]);(0,A.useEffect)(()=>{if("pro"!==ee||!el)return;let e=es.find(e=>e.id===el);if(!e)return;let t=eQ(e);tW.current=t,Z(t)},[ee,el,es,Z]);let sh=(0,A.useCallback)(async()=>{let e=tW.current.trim();if(!e)return;let t=++tY.current;ep(!0),em(null);try{var s;let n=new URLSearchParams({process:e,_ts:String(Date.now())}),l=await W("/get_config?".concat(n));if(t!==tY.current||e!==tW.current.trim())return;let i=null!==(s=l.content)&&void 0!==s?s:"";ec(i),ex(eS(i))}catch(s){if(t!==tY.current||e!==tW.current.trim())return;em(s.message)}finally{t===tY.current&&ep(!1)}},[W]);(0,A.useEffect)(()=>{if(I){if("pro"===ee){if(!tX||I!==eQ(tX))return}else if(tK.current.size&&!tK.current.has(I))return;tV(),sh(),eX(e=>e+1)}},[tX,el,I,sh,ee,tV]);let sp=(0,A.useCallback)(async()=>{var e;if(!tX||!st)throw Error(M("请选择线路","Pick a lane"));if(!sa.ok)throw Error(sa.message);let t=tB.current,s=es.map(e=>e.id===tX.id?{...e,name:sa.normalizedName,streamKey:sa.normalizedStreamKey,pm2Name:sa.normalizedPm2,notes:sa.normalizedNotes,urlLines:t}:e);return t9(s),await t7(s,{force:!0}),eI(e=>({...e,[tX.id]:{name:sa.normalizedName,streamKey:sa.normalizedStreamKey,pm2Name:sa.normalizedPm2,notes:sa.normalizedNotes}})),{next:s,savedLane:null!==(e=s.find(e=>e.id===tX.id))&&void 0!==e?e:{...tX,name:sa.normalizedName,streamKey:sa.normalizedStreamKey,pm2Name:sa.normalizedPm2,notes:sa.normalizedNotes,urlLines:t},pm2:sa.normalizedPm2}},[tX,st,sa,t9,es,t7,M]),sb=(0,A.useCallback)(async()=>{if(tX){eA(!0),eJ(null);try{let e=await sp();Z(e.pm2),eJ(M("线路设置已保存","Lane settings saved"))}catch(t){let e=t.message;eJ(e),F(e)}finally{eA(!1)}}},[tX,F,sp,Z,M]),sg=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tW.current,s=t.trim();if(!s){em(M("请选择进程","Pick a process"));return}ep(!0),em(null);try{let t=new URLSearchParams({process:s});await W("/save_config?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),ec(e),em(M("youtube.ini 已保存","youtube.ini saved"))}catch(e){em(e.message)}finally{ep(!1)}},sv=async()=>{let e=eP(ed);await sg(e)},sf=async()=>{ep(!0),em(null);try{var e,t;let s=eo||eP(ed),n=await W("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:(t=tW.current,"youtube.".concat(t.replace(/[^a-zA-Z0-9_.-]/g,"_"),".ini")),content:s,action:"youtube_balanced_preset"})}),l=null!==(e=n.content)&&void 0!==e?e:s;ec(l),ex(eS(l)),em(n.message||M("已应用 YouTube 预设","Applied YouTube preset"))}catch(e){em(e.message)}finally{ep(!1)}},sy=(0,A.useMemo)(()=>{var e,t,s;if("single"===ee)return t4&&t4!==I&&t4===t5?ew("key = ".concat(null!==(e=null==tX?void 0:tX.streamKey)&&void 0!==e?e:"")):ew("key = ".concat(ed.key));let n=null!==(s=null!==(t=null==st?void 0:st.streamKey)&&void 0!==t?t:null==tX?void 0:tX.streamKey)&&void 0!==s?s:"";return ew("key = ".concat(n))},[ee,t4,I,t5,null==tX?void 0:tX.streamKey,ed.key,null==st?void 0:st.streamKey]),sw=sy?"…".concat(sy):"—",sj="single"===ee&&!!t4&&!!I&&t4!==I,sN=async()=>{if(tX)try{eA(!0),eJ(null),tF.current+=1;let e=tB.current,t=await sp();Z(t.pm2),await Promise.resolve(H(e,t.pm2)),tD.current=!1,eJ(M("线路与地址已保存","Lane settings and URLs saved"))}catch(t){let e=t instanceof Error?t.message:String(t);eJ(e),F(e)}finally{eA(!1)}},sk=async()=>{let e=tW.current.trim();if(!e){F(M("请选择进程","Pick a process"));return}try{tF.current+=1,await Promise.resolve(H(tO.current,e)),tD.current=!1}catch(e){}},s_=async()=>{let e="single"===ee?tO.current:tB.current;eT(!0),eE(null);try{var t;let s=await W("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:"app-config",path:eC(tW.current),content:e,action:"dedupe_urls"})}),n=null!==(t=s.content)&&void 0!==t?t:e;"single"===ee?tJ(n):tG(n),tD.current=!0,eE(s.message||M("已去重当前 URL 列表","Deduplicated current URL list"))}catch(e){eE(e.message)}finally{eT(!1)}},sz=async()=>{if(!tX||!st)return;let e=eS(eo||eP(ed)),t=eP({key:st.streamKey.trim(),rtmps:e.rtmps,bitrate:e.bitrate,fastAudio:e.fastAudio});eA(!0),eJ(null);try{let e=await sp();Z(e.pm2),await sg(t,e.pm2),eJ(M("线路设置与 youtube.ini 已保存","Lane settings and youtube.ini saved"))}catch(t){let e=t.message;eJ(e),F(e)}finally{eA(!1)}},sS="single"===ee?ea:eb,sC=(0,A.useMemo)(()=>tk(sS).length,[sS]),sP=(0,A.useMemo)(()=>ej(sS).length,[sS]),sR=(0,A.useMemo)(()=>(0,eK.O0)(G),[G]),sL=(0,A.useMemo)(()=>(0,eK.U_)(sR,"pro"===ee&&tX?es.findIndex(e=>e.id===tX.id):0),[tX,es,ee,sR]),sT=sL.link?(0,ev.p)(sL.link.url):(0,ev.p)("http://live.local:9200/"),sM=(0,A.useMemo)(()=>(0,eK.Tc)(sR),[sR]),sE=(0,A.useMemo)(()=>{var e;return[null===(e=sL.link)||void 0===e?void 0:e.url,null==G?void 0:G.chromium_remote_debug,null==G?void 0:G.srs_api].filter(e=>!!e)},[G,null===(t=sL.link)||void 0===t?void 0:t.url]),sU=(0,A.useCallback)(async(e,t)=>{if(!tU&&("delete"!==t||window.confirm("".concat(e.label,": 删除容器?浏览器配置和登录数据会保留,之后点“启动”会自动重建。")))){tI("".concat(e.id,":").concat(t)),tA(null);try{let s=await W("/neko/instance_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id,action:t})}),n=s.running?M("运行中","running"):s.exists?M("已停止","stopped"):M("容器不存在","missing"),l=s.message||"".concat(e.label,": ").concat(n);tA("".concat(l," \xb7 ").concat(n))}catch(t){let e=t.message;tA(e),F(e)}finally{tI(null)}}},[W,tU,F,M]),sI=(0,A.useCallback)(async e=>{let t=tX?eQ(tX):"";return tX&&e===t?await sp():(t9(es),await t7(es,{force:!0}),{next:es,savedLane:null!=tX?tX:null,pm2:e})},[tX,t9,es,sp,t7]),sZ=(0,A.useCallback)(async(e,t)=>{let s=!!tX&&eQ(tX)===t;if("stop"!==e){var n,l;let e=es,s=t;try{let n=await sI(t);e=n.next,s=n.pm2}catch(e){F("".concat(M("当前线路保存失败","Failed to save the active lane"),": ").concat(e.message));return}let i=e.find(e=>eQ(e)===s),a=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(M("请先填写当前线路的推流密钥","Fill the stream key before starting"));return}if(!tk(a).length){F(M("请先填写当前线路的直播地址","Fill the source URLs before starting"));return}t=s}s&&Z(t),B(e,t)},[tX,es,sI,F,B,Z,M]),sA=(0,A.useCallback)(async e=>{tR(!0);try{let t=await W("/hub/youtube/live/summary");e2(t);let s=null!=e?e:null==tS?void 0:tS.id;if(s){let e=await W("/hub/youtube/live/events/".concat(encodeURIComponent(String(s))));e.event&&tC(e.event)}}catch(e){}finally{tR(!1)}},[W,null==tS?void 0:tS.id]),sD=(0,A.useCallback)(async e=>{tR(!0);try{let t=await W("/hub/youtube/live/events/".concat(encodeURIComponent(String(e))));tC(t.event||null)}catch(e){F(e.message)}finally{tR(!1)}},[W,F]);(0,A.useEffect)(()=>{sA(null);let e=window.setInterval(()=>void sA(),4e3);return()=>window.clearInterval(e)},[sA]);let sO=(0,A.useCallback)(async()=>{tE(!0);try{let e=await W("/hub/youtube/quality_guard");tT(e)}catch(e){}finally{tE(!1)}},[W]);(0,A.useEffect)(()=>{sO();let e=window.setInterval(()=>void sO(),6e3);return()=>window.clearInterval(e)},[sO]);let sB=!!E||eh||e_||eR||eZ,sH="single"===ee?t6:t1,sW=to(t0(t3)),sK=tr(sH,"single"===ee&&t4===t5&&t4!==I?null!==(r=null==tX?void 0:tX.urlLines)&&void 0!==r?r:eb:ea),sF=tX?tr(tQ(eQ(tX)),eb||tX.urlLines||""):"",sY=e=>{var t;let s=(null===(t=sL.link)||void 0===t?void 0:t.id)===e.id,l=tU==="".concat(e.id,":start"),i=tU==="".concat(e.id,":stop"),a=tU==="".concat(e.id,":delete"),r=!!tU;return(0,n.jsxs)("div",{className:"flex min-h-[2.5rem] items-stretch overflow-hidden rounded-lg border text-xs ring-1 ".concat(s?"border-emerald-400/30 bg-emerald-500/15 text-emerald-50 ring-emerald-400/25":"border-white/10 bg-white/5 text-zinc-200 ring-white/10"),children:[(0,n.jsxs)("a",{href:(0,ev.p)(e.url),target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 px-3 py-2 hover:bg-white/[0.04]",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] text-emerald-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"font-mono text-white/70",children:[e.host||"",e.port?":".concat(e.port):""]})]}),(0,n.jsxs)("div",{className:"flex border-l border-white/10",children:[(0,n.jsxs)("button",{type:"button",disabled:r,title:M("启动 Neko 容器","Start Neko container"),onClick:()=>void sU(e,"start"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 px-2 text-emerald-100 hover:bg-emerald-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[l?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)($.Z,{className:"h-3.5 w-3.5"}),M("启动","Start")]}),(0,n.jsxs)("button",{type:"button",disabled:r,title:M("停止 Neko 容器","Stop Neko container"),onClick:()=>void sU(e,"stop"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-amber-100 hover:bg-amber-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[i?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(eD.Z,{className:"h-3.5 w-3.5"}),M("停止","Stop")]}),(0,n.jsxs)("button",{type:"button",disabled:r,title:M("删除容器,保留浏览器配置数据","Delete container, keep browser profile data"),onClick:()=>void sU(e,"delete"),className:"inline-flex min-w-[3.75rem] items-center justify-center gap-1 border-l border-white/10 px-2 text-rose-100 hover:bg-rose-500/15 disabled:cursor-not-allowed disabled:opacity-45",children:[a?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(L.Z,{className:"h-3.5 w-3.5"}),M("删除","Delete")]})]})]},e.key)},sJ=(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:eN,onChange:e=>ek(e.target.checked)}),M("每 8 秒自动从服务器刷新","Auto-refresh from server every 8s")]}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>void t$(),className:"rounded-lg border border-white/10 px-3 py-1.5 text-zinc-200 hover:bg-white/5",children:M("手动重新读取","Reload from server")}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>void s_(),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:eR?M("去重中...","Deduplicating..."):M("智能去重","Deduplicate")})]}),sG=(null==e0?void 0:e0.active)||[],sq=(null==e0?void 0:e0.latest)||[],sV=(null==e0?void 0:e0.alerts)||[],s$=(null==e0?void 0:e0.stats)||{},sX=[{label:M("活动事件","Active"),value:null!==(o=s$.active_events)&&void 0!==o?o:sG.length,Icon:a.Z},{label:M("历史事件","History"),value:null!==(d=s$.total_events)&&void 0!==d?d:sq.length,Icon:eO.Z},{label:M("采样点","Samples"),value:null!==(x=s$.sample_count)&&void 0!==x?x:0,Icon:eB.Z},{label:M("峰值在线","Viewer peak"),value:null!==(u=s$.viewer_peak)&&void 0!==u?u:0,Icon:eH.Z},{label:M("累计时长","Total duration"),value:td(s$.total_duration_seconds),Icon:k.Z}],sQ=(0,n.jsxs)("section",{className:"rounded-2xl border border-cyan-500/20 bg-gradient-to-br from-cyan-500/[0.08] via-zinc-950/80 to-emerald-500/[0.05] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start 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)(eB.Z,{className:"h-4 w-4 text-cyan-300"}),M("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:M("事件、转播对象、时长、页面采集、弹窗和告警全部写入本地 SQLite,可追溯。","Events, source rooms, duration, browser telemetry, popups, and alerts are stored locally.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sA(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tP?"animate-spin":"")}),M("刷新事件","Refresh events")]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-5",children:sX.map(e=>{let{label:t,value:s,Icon:l}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-zinc-500",children:[(0,n.jsx)(l,{className:"h-3.5 w-3.5 text-cyan-300"}),t]}),(0,n.jsx)("p",{className:"mt-2 font-mono text-lg font-semibold text-white",children:String(s)})]},t)})}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(22rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-cyan-200/90",children:M("正在转播","Active relay")}),(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-100 ring-1 ring-emerald-500/25",children:sG.length})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[(sG.length?sG:sq.slice(0,1)).map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>void sD(e.id),className:"block w-full rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2 text-left transition hover:bg-white/[0.06]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-white",children:e.source_title||e.channel_name||e.source_room_id||e.process||"#".concat(e.id)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tu(e.status)),children:e.status||"event"})]}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:e.process||"-"}),(0,n.jsx)("span",{children:e.source_room_id?"room:".concat(e.source_room_id):M("未知来源","unknown source")}),(0,n.jsx)("span",{children:td(e.duration_seconds)}),(0,n.jsx)("span",{children:null!=e.last_viewer_count?"".concat(e.last_viewer_count," online"):""})]})]},e.id)),sG.length||sq.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:M("暂无事件;开始直播或打开 Neko 中的 YouTube Studio 后会自动生成。","No events yet. Start a relay or open YouTube Studio in Neko.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-400",children:M("最近事件","Recent events")}),(0,n.jsx)("div",{className:"mt-3 divide-y divide-white/[0.06]",children:sq.slice(0,8).map(e=>{var t;return(0,n.jsxs)("button",{type:"button",onClick:()=>void sD(e.id),className:"flex w-full items-center justify-between gap-3 py-2 text-left",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-xs font-medium text-zinc-200",children:e.source_title||e.source_room_id||e.channel_name||e.process||"#".concat(e.id)}),(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[10px] text-zinc-600",children:[tx(e.started_at)," \xb7 ",td(e.duration_seconds)]})]}),(0,n.jsxs)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tu(e.status)),children:[null!==(t=e.quality_score)&&void 0!==t?t:0,"/100"]})]},e.id)})})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",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-200/90",children:M("事件详情页","Event detail")}),tS?(0,n.jsx)("button",{type:"button",onClick:()=>tC(null),className:"text-[11px] text-zinc-500 hover:text-zinc-300",children:M("收起","Close")}):null]}),tS?(0,n.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:tS.source_title||tS.source_room_id||tS.process}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tu(tS.status)),children:tS.status})]}),(0,n.jsxs)("div",{className:"mt-2 grid gap-2 text-[11px] text-zinc-400 sm:grid-cols-2",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Process:"})," ",tS.process||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Room:"})," ",tS.source_room_id||"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Started:"})," ",tx(tS.started_at)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Duration:"})," ",td(tS.duration_seconds)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Viewers:"})," ",null!==(m=tS.last_viewer_count)&&void 0!==m?m:"-"," / peak ",null!==(h=tS.viewer_peak)&&void 0!==h?h:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"text-zinc-600",children:"Health:"})," ",tS.last_health||tS.last_live_status||"-"]})]}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[tS.source_url?(0,n.jsx)("a",{href:tS.source_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-[11px] text-violet-100 ring-1 ring-violet-500/25",children:M("打开源直播间","Open source")}):null,tS.last_page_url?(0,n.jsx)("a",{href:tS.last_page_url,target:"_blank",rel:"noreferrer",className:"rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-[11px] text-cyan-100 ring-1 ring-cyan-500/25",children:M("打开 Studio 页面","Open Studio page")}):null]})]}),(tS.alerts||sV).slice(0,4).length?(0,n.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/[0.06] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-xs font-semibold text-amber-100",children:[(0,n.jsx)(ey.Z,{className:"h-3.5 w-3.5"}),M("弹窗 / 告警","Popups / alerts")]}),(0,n.jsx)("div",{className:"mt-2 space-y-1",children:(tS.alerts||sV).slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"text-[11px] text-amber-100/85",children:[e.title||e.severity||"alert",": ",e.message||"-"]},"".concat(e.id||t)))})]}):null,(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-xs font-semibold text-zinc-300",children:M("采样时间线","Sample timeline")}),(0,n.jsxs)("div",{className:"mt-2 max-h-52 space-y-2 overflow-auto pr-1",children:[(tS.samples||[]).slice(0,12).map(e=>{var t;return(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-2 py-1.5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 font-mono text-[10px] text-zinc-500",children:[(0,n.jsx)("span",{children:tx(e.ts)}),(0,n.jsx)("span",{children:e.source||"sample"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-300",children:[e.live_status||"-"," \xb7 ",e.health||"-"," \xb7 ",null!==(t=e.viewer_count)&&void 0!==t?t:"-"," online"]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-[10px] text-amber-100/80",children:e.popup_text}):null]},e.id)}),(tS.samples||[]).length?null:(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("暂无采样;Chrome 扩展或状态接口会自动写入。","No samples yet. The Chrome extension or status API will fill this.")})]})]})]}):(0,n.jsx)("p",{className:"mt-3 text-xs text-zinc-600",children:M("选择左侧事件查看完整详情。","Select an event to see details.")})]})]})]}),s0=[...sG,...sq.filter(e=>!sG.some(t=>t.id===e.id))].slice(0,12),s1=tS||s0[0]||null,s5=(null==s1?void 0:s1.samples)||[],s2=(null==s1?void 0:null===(s=s1.alerts)||void 0===s?void 0:s.length)?s1.alerts:sV,s3=[{label:M("正在直播","Live now"),value:String(null!==(p=s$.active_events)&&void 0!==p?p:sG.length),helper:M("当前仍在推流的场次","Events still pushing"),Icon:V.Z,tone:"text-emerald-200"},{label:M("总场次","Total events"),value:String(null!==(b=s$.total_events)&&void 0!==b?b:sq.length),helper:M("本机数据库里的直播记录","Stored locally"),Icon:eO.Z,tone:"text-cyan-200"},{label:M("累计时长","Total duration"),value:tg(s$.total_duration_seconds,M),helper:M("已结束场次累计","Ended events total"),Icon:k.Z,tone:"text-violet-200"},{label:M("最高在线","Peak viewers"),value:th(null!==(g=s$.viewer_peak)&&void 0!==g?g:0,M),helper:M("Chrome/Studio 采集峰值","Captured from Studio"),Icon:eH.Z,tone:"text-amber-200"}],s4=(0,n.jsxs)("section",{className:"rounded-2xl border border-white/[0.08] bg-zinc-950/90 p-6 ring-1 ring-cyan-500/10",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(eB.Z,{className:"h-5 w-5 text-cyan-300"}),M("直播事件中枢","Live event center")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:M("这里按运营视角展示:谁在播、转播哪个直播间、播了多久、观众多少、Studio 是否弹窗、有没有异常。机器编号只放在详情底部。","Built for operators: what is live, source room, duration, viewers, Studio popups, and issues. Technical ids stay in the detail footer.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sA(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tP?"animate-spin":"")}),M("刷新","Refresh")]})]}),(0,n.jsx)("div",{className:"mt-5 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:s3.map(e=>{let{label:t,value:s,helper:l,Icon:i,tone:a}=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.035] p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)(i,{className:"h-4 w-4 ".concat(a)})]}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold tracking-tight text-white",children:s}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-600",children:l})]},t)})}),(0,n.jsxs)("div",{className:"mt-6 grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(25rem,0.9fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:sG.length?M("正在直播","Live now"):M("最近直播记录","Recent live events")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:sG.length?M("优先显示还在推流的场次。","Active relays are listed first."):M("当前没有正在直播的场次,下方是最近历史。","Nothing is live now; showing recent history.")})]}),(0,n.jsxs)("span",{className:"rounded-full bg-cyan-500/10 px-2.5 py-1 text-xs text-cyan-100 ring-1 ring-cyan-500/20",children:[s0.length," ",M("条记录","records")]})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[s0.map(e=>{var t;let s=(null==s1?void 0:s1.id)===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>void sD(e.id),className:"grid w-full gap-3 px-4 py-4 text-left transition md:grid-cols-[minmax(0,1fr)_8rem_7rem_7rem] ".concat(s?"bg-cyan-500/[0.08]":"hover:bg-white/[0.04]"),children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(tu(e.status)),children:tm(e.status,M)}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(ty(e)),children:tf(e,M)})]}),(0,n.jsx)("p",{className:"mt-2 truncate text-sm font-semibold text-white",children:tp(e,M)}),(0,n.jsxs)("p",{className:"mt-1 truncate text-xs text-zinc-500",children:[tb(e,M)," ","->"," YouTube"]})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("开始","Started")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tv(e.started_at)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-300",children:tg(e.duration_seconds,M)})]}),(0,n.jsxs)("div",{className:"self-center",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("在线/峰值","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-zinc-300",children:[th(e.last_viewer_count,M)," / ",th(null!==(t=e.viewer_peak)&&void 0!==t?t:0,M)]})]})]},e.id)}),s0.length?null:(0,n.jsxs)("div",{className:"px-4 py-10 text-center",children:[(0,n.jsx)(c.Z,{className:"mx-auto h-8 w-8 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:M("还没有直播记录","No live events yet")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-600",children:M("启动转播或在 Neko 打开 YouTube Studio 后,这里会自动生成可追溯记录。","Start a relay or open YouTube Studio in Neko to create traceable records.")})]})]})]}),(0,n.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:s1?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-xs text-cyan-300",children:M("这场直播","Selected event")}),(0,n.jsx)("h4",{className:"mt-1 truncate text-lg font-semibold text-white",children:tp(s1,M)}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-500",children:[tb(s1,M)," ","->"," YouTube"]})]}),(0,n.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs ring-1 ".concat(tu(s1.status)),children:tm(s1.status,M)})]})}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("直播时长","Duration")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:tg(s1.duration_seconds,M)}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:tx(s1.started_at)})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("观众","Viewers")}),(0,n.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[th(s1.last_viewer_count,M),(0,n.jsxs)("span",{className:"ml-2 text-xs font-normal text-zinc-500",children:[M("峰值","peak")," ",th(null!==(v=s1.viewer_peak)&&void 0!==v?v:0,M)]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:M("来自 Chrome 插件/Studio 页面采集","Captured from Studio")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:M("Studio 状态","Studio status")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(ty(s1)),children:tf(s1,M)})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 text-sm text-zinc-300",children:[(0,n.jsx)("p",{children:s1.last_live_status||s1.last_health||M("暂未采集到 Studio 状态","No Studio status captured yet")}),s1.last_popup_text?(0,n.jsx)("p",{className:"rounded-md border border-amber-500/20 bg-amber-500/[0.08] px-3 py-2 text-xs text-amber-100",children:s1.last_popup_text}):(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:M("没有记录到弹窗。","No popup recorded.")}),s1.last_page_title||s1.last_page_url?(0,n.jsx)("p",{className:"truncate text-xs text-zinc-500",children:s1.last_page_title||s1.last_page_url}):null]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[s1.source_url?(0,n.jsxs)("a",{href:s1.source_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-violet-500/15 px-2.5 py-1.5 text-xs text-violet-100 ring-1 ring-violet-500/25",children:[M("打开源直播间","Open source")," ",(0,n.jsx)(J.Z,{className:"h-3 w-3"})]}):null,s1.last_page_url?(0,n.jsxs)("a",{href:s1.last_page_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-cyan-500/15 px-2.5 py-1.5 text-xs text-cyan-100 ring-1 ring-cyan-500/25",children:[M("打开 Studio","Open Studio")," ",(0,n.jsx)(J.Z,{className:"h-3 w-3"})]}):null]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsx)("h5",{className:"text-sm font-semibold text-white",children:M("采样时间线","Telemetry timeline")}),(0,n.jsxs)("div",{className:"mt-3 max-h-64 space-y-2 overflow-auto pr-1",children:[s5.slice(0,10).map(e=>(0,n.jsxs)("div",{className:"rounded-md border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[(0,n.jsx)("span",{className:"text-zinc-400",children:tv(e.ts)}),(0,n.jsx)("span",{className:"text-zinc-600",children:e.source||M("采样","sample")})]}),(0,n.jsxs)("p",{className:"mt-1 text-sm text-zinc-200",children:[e.live_status||e.health||M("状态未识别","Unknown status"),(0,n.jsxs)("span",{className:"ml-2 text-xs text-zinc-500",children:[M("在线","online")," ",th(e.viewer_count,M)]})]}),e.popup_text?(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-100",children:e.popup_text}):null]},e.id)),s5.length?null:(0,n.jsx)("p",{className:"rounded-md border border-white/[0.05] bg-black/20 px-3 py-3 text-xs text-zinc-500",children:tS?M("这场直播暂时没有采样明细。","No telemetry samples for this event yet."):M("点击左侧记录后加载完整采样明细。","Click a record on the left to load full telemetry samples.")})]})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,n.jsxs)("h5",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[(0,n.jsx)(ey.Z,{className:"h-4 w-4 text-amber-300"}),M("告警和弹窗","Alerts and popups")]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[s2.slice(0,4).map((e,t)=>(0,n.jsxs)("p",{className:"rounded-md border border-amber-500/15 bg-amber-500/[0.06] px-3 py-2 text-xs text-amber-100",children:[e.title||e.severity||M("提示","Notice"),": ",e.message||"-"]},"".concat(e.id||t))),s2.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:M("没有告警。","No alerts.")})]})]}),(0,n.jsxs)("p",{className:"truncate text-[11px] text-zinc-700",children:[M("技术标识","Technical id"),": #",s1.id," \xb7 ",s1.process||"-"," \xb7 ",s1.event_uuid||"-"]})]}):(0,n.jsxs)("div",{className:"flex min-h-[24rem] flex-col items-center justify-center text-center",children:[(0,n.jsx)(eB.Z,{className:"h-10 w-10 text-zinc-700"}),(0,n.jsx)("p",{className:"mt-3 text-sm font-medium text-zinc-300",children:M("等待第一场直播","Waiting for the first live event")}),(0,n.jsx)("p",{className:"mt-1 max-w-sm text-xs text-zinc-600",children:M("开始转播后,这里会变成这场直播的详情页。","After a relay starts, this panel becomes the event detail page.")})]})})]})]}),s6=(null==tL?void 0:tL.summary)||{},s8=(null==tL?void 0:tL.lanes)||[],s9=(null==tL?void 0:tL.recommendations)||[],s7=(0,n.jsxs)("section",{className:"rounded-2xl border border-emerald-500/20 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/90 to-cyan-500/[0.06] p-6 ring-1 ring-white/[0.04]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold text-white",children:[(0,n.jsx)(a.Z,{className:"h-5 w-5 text-emerald-300"}),M("算法友好质量守护","Algorithm-friendly quality guard")]}),(0,n.jsx)("p",{className:"mt-1 max-w-3xl text-sm text-zinc-400",children:M("目标不是刷数据,而是让直播信号长期稳定:不断流、不卡顿、Studio 状态可见、异常能追踪。","The goal is stable, policy-safe signal quality: no drops, no stalls, visible Studio state, and traceable issues.")})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void sO(),className:"inline-flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.05] px-3 py-2 text-xs text-zinc-200 hover:bg-white/[0.08]",children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(tM?"animate-spin":"")}),M("重新检测","Check now")]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 md:grid-cols-[12rem_minmax(0,1fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:M("综合分","Score")}),(0,n.jsx)("p",{className:"mt-2 text-5xl font-semibold tracking-tight ".concat(tw(null==tL?void 0:tL.score)),children:null!==(f=null==tL?void 0:tL.score)&&void 0!==f?f:0}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-zinc-600",children:M("80 以上适合长时间无人值守","80+ is suitable for long unattended runs")})]}),(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[[M("推流线路","Lanes"),"".concat(null!==(j=s6.pushing_lanes)&&void 0!==j?j:0,"/").concat(null!==(N=s6.lanes)&&void 0!==N?N:0)],[M("活动事件","Active events"),String(null!==(_=s6.active_events)&&void 0!==_?_:0)],[M("Studio 采样","Studio samples"),String(null!==(z=s6.sample_count)&&void 0!==z?z:0)],[M("最高在线","Viewer peak"),th(null!==(S=s6.viewer_peak)&&void 0!==S?S:0,M)]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("p",{className:"text-xs text-zinc-500",children:t}),(0,n.jsx)("p",{className:"mt-2 text-2xl font-semibold text-white",children:s})]},t)})})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,0.8fr)]",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25",children:[(0,n.jsxs)("div",{className:"border-b border-white/[0.06] px-4 py-3",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:M("线路质量","Lane quality")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:M("从进程、FFmpeg 日志、配置和事件采样综合判断。","Combined from process state, FFmpeg logs, config, and event telemetry.")})]}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[s8.map(e=>{var t,s,l,i,a,r,o,c,d;let x=(e.source_display||e.source_title||"").trim()||e.label||e.process||"-",u=[e.label,e.process].filter(Boolean).join(" \xb7 ");return(0,n.jsxs)("div",{className:"grid gap-3 px-4 py-4 md:grid-cols-[minmax(0,1fr)_6rem_14rem]",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("p",{className:"truncate text-sm font-semibold text-white",children:x}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.is_pushing?"bg-emerald-500/15 text-emerald-100 ring-emerald-500/25":"bg-zinc-600/20 text-zinc-300 ring-zinc-500/25"),children:e.is_pushing?M("推流中","Pushing"):M("未推流","Idle")}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[11px] ring-1 ".concat(e.rtmps?"bg-cyan-500/15 text-cyan-100 ring-cyan-500/25":"bg-amber-500/15 text-amber-100 ring-amber-500/25"),children:e.rtmps?"RTMPS":M("非 RTMPS","No RTMPS")})]}),(0,n.jsx)("p",{className:"mt-1 truncate text-xs text-zinc-600",children:u||"-"}),(0,n.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(e.issues||[]).slice(0,3).map((e,t)=>(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(tj(e.level)),children:e.text||e.level},"".concat(e.text||t)))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-[11px] text-zinc-600",children:M("分数","Score")}),(0,n.jsx)("p",{className:"mt-1 text-2xl font-semibold ".concat(tw(e.score)),children:null!==(r=e.score)&&void 0!==r?r:0})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2 font-mono text-[11px] text-zinc-300",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"fps"}),tN(null===(t=e.metrics)||void 0===t?void 0:t.fps)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"speed"}),tN(null===(s=e.metrics)||void 0===s?void 0:s.speed,"x")]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"kbps"}),tN(null===(l=e.metrics)||void 0===l?void 0:l.bitrate)]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"drop"}),null!==(o=null===(i=e.metrics)||void 0===i?void 0:i.drop)&&void 0!==o?o:"-"]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"urls"}),null!==(c=e.url_count)&&void 0!==c?c:0]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"block text-zinc-600",children:"err"}),null!==(d=null===(a=e.metrics)||void 0===a?void 0:a.error_count)&&void 0!==d?d:0]})]})]},e.process||e.label)}),s8.length?null:(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sm text-zinc-500",children:M("没有发现 YouTube 线路。","No YouTube lanes found.")})]})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:M("下一步建议","Next actions")}),(0,n.jsxs)("div",{className:"mt-3 space-y-2",children:[s9.slice(0,6).map((e,t)=>(0,n.jsx)("p",{className:"rounded-lg px-3 py-2 text-xs ring-1 ".concat(tj(e.level)),children:e.text||"-"},"".concat(e.text||t))),s9.length?null:(0,n.jsx)("p",{className:"text-xs text-zinc-600",children:M("暂无建议。","No recommendations.")})]})]}),(0,n.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-black/25 p-4",children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-white",children:"FFmpeg"}),(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-400",children:(null==tL?void 0:null===(l=tL.ffmpeg_profile)||void 0===l?void 0:l.target)||"1080p30 / RTMPS / AAC / stable relay"}),(0,n.jsx)("ul",{className:"mt-3 space-y-1.5 text-xs text-zinc-500",children:((null==tL?void 0:null===(i=tL.ffmpeg_profile)||void 0===i?void 0:i.guardrails)||[]).slice(0,4).map(e=>(0,n.jsxs)("li",{children:["- ",e]},e))})]})]})]})]});return(0,n.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[Y?(0,n.jsx)(ef,{t:M,title:M("YouTube 转播链路","YouTube relay chain"),subtitle:M("与「网络」页相同风格的链路示意:代理 → 编码推流 → 浏览器侧操作工作室。","Same visual language as Network: proxy → encode → browser studio."),onNavigate:Y,steps:[{label:"ShellCrash",sub:M("透明代理","Proxy"),gradient:"from-violet-500 to-fuchsia-500",target:"network"},{label:"FFmpeg",sub:M("推流 / 转码","Stream"),gradient:"from-cyan-400 to-blue-500",target:"live_youtube"},{label:"Neko",sub:sL.link?"".concat(M("Chromium 工作室","Chromium studio")," \xb7 ").concat(sL.link.label):M("Chromium 工作室","Chromium studio"),gradient:"from-emerald-400 to-teal-500",openUrl:sT}]}):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:M("YouTube 无人直播","YouTube unmanned live")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500",children:M("单路一条流;多路时每条线路独立保存自己的密钥、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:"ml-auto flex shrink-0 self-start rounded-xl border border-white/10 bg-black/30 p-1 ".concat(""),"aria-hidden":!1,children:[(0,n.jsx)("button",{type:"button",onClick:()=>su("single"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("single"===ee?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:M("单频道","Single")}),(0,n.jsx)("button",{type:"button",onClick:()=>su("pro"),className:"rounded-lg px-4 py-2 text-xs font-medium transition ".concat("pro"===ee?"bg-violet-500/25 text-white":"text-zinc-500 hover:text-zinc-300"),children:M("多频道 Pro","Multi Pro")})]})]})}),sE.length?(0,n.jsxs)("div",{className:"space-y-2",children:[tZ?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:tZ}):null,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[sL.link?(0,n.jsx)("a",{href:sT,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:M("打开当前线路 Neko 工作室","Open lane Neko studio")}):null,sR.length?(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:sR.map(e=>sY(e))}):null,(null==G?void 0:G.chromium_remote_debug)?(0,n.jsx)("a",{href:(0,ev.p)(G.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:M("打开 Chromium 调试","Open Chromium debug")}):null,(null==G?void 0:G.srs_api)?(0,n.jsx)("a",{href:(0,ev.p)(G.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:M("打开 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)(V.Z,{className:"h-4 w-4"}),(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:M("直播开关","Live control")})]}),"single"===ee?(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:M("转播任务","Relay task")}),(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:I,onChange:e=>{let t=e.target.value;tW.current=t,Z(t)},children:[I&&!X.some(e=>e.pm2===I)?(0,n.jsxs)("option",{value:I,children:[I,t1?" (".concat(tc(t1,M),")"):""]}):null,X.map(e=>(0,n.jsxs)("option",{value:e.pm2,children:[function(e,t){let s=te(e.script).toLowerCase();return s.startsWith("douyin_youtube")?t("抖音→YouTube","Douyin → YouTube"):s.startsWith("youtube")?t("YouTube","YouTube"):e.label}(e,M)," (",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)(tz,{kind:"start",targetPm2:t3,busy:E,online:sW,label:M("开始直播","Start"),className:"bg-emerald-500/20 text-emerald-200 ring-emerald-500/30",baseLock:!1,onRun:()=>B("start",t3),notify:F,t:M}),(0,n.jsx)(tz,{kind:"stop",targetPm2:t3,busy:E,online:sW,label:M("停止直播","Stop"),className:"bg-rose-500/15 text-rose-200 ring-rose-500/25",baseLock:!1,onRun:()=>B("stop",t3),notify:F,t:M}),(0,n.jsx)(tz,{kind:"restart",targetPm2:t3,busy:E,online:sW,label:M("重新开始","Restart"),className:"bg-amber-500/15 text-amber-200 ring-amber-500/25",baseLock:!1,onRun:()=>B("restart",t3),notify:F,t:M})]}),(0,n.jsxs)("p",{className:"mt-3 text-center text-xs text-zinc-400",children:[M("当前状态","Current state"),": ",tc(sH,M)]}),(0,n.jsx)("p",{className:"mt-2 text-center text-sm font-semibold text-white",children:sK||M("未配置抖音直播源","No Douyin source configured")}),sj?(0,n.jsxs)("p",{className:"mt-2 text-center font-mono text-[10px] text-zinc-600",children:[M("当前推流","Streaming"),": ",t4," \xb7 ",M("当前编辑","Editing"),": ",I]}):null,(0,n.jsxs)("p",{className:"mt-3 text-center font-mono text-[11px] text-zinc-600",children:["key ",M("尾码","suffix"),": ",sw]})]}):(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:M("Pro 转播实况","Pro relay status")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:M("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。","Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}),sM?(0,n.jsxs)("p",{className:"mt-2 text-[11px] text-zinc-500",children:[M("Neko 实例","Neko instances"),": ",sM]}):null,(0,n.jsx)("div",{className:"mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1",children:es.map(e=>{var t,s,l,i;let a=eQ(e),r=tQ(a),o=t0(a),c=tk((null!==(t=e.urlLines)&&void 0!==t?t:"").trim()),d=ej((null!==(s=e.urlLines)&&void 0!==s?s:"").trim()),x=d[0],u=ew("key = ".concat(null!==(l=e.streamKey)&&void 0!==l?l:"")),m=el===e.id,h=to(o),p=es.findIndex(t=>t.id===e.id),b=(0,eK.U_)(sR,p).link,g=eq(e.name,p>=0?p:0),v=tr(r,null!==(i=e.urlLines)&&void 0!==i?i:"");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(m?"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:()=>{tW.current=eQ(e),sm(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:v||M("未配置抖音直播源","No Douyin source")}),(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||"youtube_key_rejected"===t||"error"===t||"stale"===t?"bg-rose-500/15 text-rose-100 ring-rose-500/25":to(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"}(r)),children:tc(r,M)}),b?(0,n.jsxs)("span",{className:"shrink-0 rounded-md bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25",children:[b.label," \xb7 ",b.accessLabel]}):null]}),(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",{title:g,children:[M("线路","Lane")," ",g]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["key …",u||"—"]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsx)("span",{className:"truncate",title:a,children:a}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["URL ",c.length]}),(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"}),(0,n.jsxs)("span",{children:["DY ",d.length]})]}),x?(0,n.jsx)("a",{href:x,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:x,children:v?"".concat(M("打开源站","Open source")," \xb7 ").concat(x.replace(/^https?:\/\//,"")):x.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)(tz,{kind:"start",targetPm2:a,busy:E,online:h,label:M("开始","Start"),className:"rounded-lg bg-emerald-500/20 text-emerald-100 ring-emerald-500/30",baseLock:!1,onRun:()=>void sZ("start",a),notify:F,t:M,compact:!0}),(0,n.jsx)(tz,{kind:"stop",targetPm2:a,busy:E,online:h,label:M("停止","Stop"),className:"rounded-lg bg-rose-500/15 text-rose-100 ring-rose-500/25",baseLock:!1,onRun:()=>void sZ("stop",a),notify:F,t:M,compact:!0}),(0,n.jsx)(tz,{kind:"restart",targetPm2:a,busy:E,online:h,label:M("重新开始","Restart"),className:"rounded-lg bg-amber-500/15 text-amber-100 ring-amber-500/25",baseLock:!1,onRun:()=>void sZ("restart",a),notify:F,t:M,compact:!0}),b?(0,n.jsxs)("button",{type:"button",onClick:()=>{window.open((0,ev.p)(b.url),"_blank","noopener,noreferrer")},className:"inline-flex min-h-[2rem] items-center justify-center rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5 text-emerald-100 ring-1 ring-emerald-500/20 transition hover:bg-emerald-500/20",title:"".concat(M("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(b.label).concat(b.port?" :".concat(b.port):""),"aria-label":"".concat(M("打开该线路 Neko 工作室","Open this lane's Neko studio")," \xb7 ").concat(b.label),children:[(0,n.jsx)("span",{className:"sr-only",children:M("打开该线路 Neko 工作室","Open this lane's Neko studio")}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"\uD83D\uDC31"}),(0,n.jsx)(J.Z,{className:"ml-1 h-3.5 w-3.5 shrink-0","aria-hidden":!0})]}):null]})]},e.id)})})]})})]}),"single"===ee?(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:M("YouTube 相关设置","YouTube settings")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:M("串流参数写进 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:M("串流密钥","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:ed.key,onChange:e=>ex(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:ed.rtmps?"1":"0",onChange:e=>ex(t=>({...t,rtmps:"1"===e.target.value})),children:[(0,n.jsx)("option",{value:"1",children:M("是(默认)","Yes")}),(0,n.jsx)("option",{value:"0",children:M("否 → RTMP","No")})]})]}),(0,n.jsxs)("label",{className:"flex flex-col gap-1 text-xs text-zinc-400",children:[M("比特率 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:ed.bitrate,onChange:e=>ex(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:ed.fastAudio,onChange:e=>ex(t=>({...t,fastAudio:e.target.checked}))}),"fast_audio(",M("轻量音频","lighter audio"),")"]})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:sB,onClick:()=>void sh(),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)(w.Z,{className:"h-3.5 w-3.5 ".concat(eh?"animate-spin":"")}),M("重新读取","Reload")]}),(0,n.jsxs)("button",{type:"button",disabled:sB,onClick:()=>void sv(),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:[eh?(0,n.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):null,M("保存 youtube.ini","Save youtube.ini")]}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>void sf(),className:"rounded-xl border border-cyan-500/20 bg-cyan-500/10 px-4 py-2 text-sm text-cyan-100",children:M("平衡预设","Balanced preset")}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>{ex(eS(eo)),em(M("已从下方原文同步到表单","Synced from raw"))},className:"rounded-xl border border-white/10 px-4 py-2 text-sm text-zinc-400",children:M("从原文同步表单","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:M("高级: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:eo,onChange:e=>ec(e.target.value),spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:sB,className:"mt-2 rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs text-cyan-200",onClick:()=>void sg(eo),children:M("保存原文","Save raw")})]}),eu?(0,n.jsx)("p",{className:"mt-2 font-mono text-xs text-zinc-500",children:eu}):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:[M("当前线路","Current lane"),tX?(0,n.jsxs)("span",{className:"ml-2 font-normal text-zinc-400",children:["\xb7 ",sF||M("未配置抖音直播源","No Douyin source")]}):null,sr?(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:M("有未保存修改","Unsaved")}):null]}),tX?(0,n.jsxs)("p",{className:"mt-0.5 font-mono text-[11px] text-zinc-500",children:[M("配置名","Config"),": ",eq(tX.name,Math.max(0,es.findIndex(e=>e.id===tX.id)))," \xb7 PM2: ",sn,si?" → ".concat(sl):""," \xb7 ","key ",M("尾码","suffix"),": ",sw]}):null]}),(0,n.jsxs)("button",{type:"button",disabled:sB,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=e6(),t={id:e,name:"".concat(M("线路","Ch")," ").concat(es.length+1),streamKey:"",urlLines:"",pm2Name:e8(e),notes:""};eI(s=>({...s,[e]:ti(t)})),se([...es,t],{force:!0}),ei(e),tW.current=eQ(t),Z(tW.current),tG("")},children:[(0,n.jsx)(eW.Z,{className:"h-3.5 w-3.5"}),M("新增线路","Add lane")]})]}),tX?(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!==(C=null==st?void 0:st.name)&&void 0!==C?C:"",onChange:e=>ss("name",e.target.value),placeholder:M("线路名称","Lane name")}),(0,n.jsx)("label",{className:"block text-xs text-zinc-500",children:M("串流密钥","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!==(P=null==st?void 0:st.streamKey)&&void 0!==P?P:"",onChange:e=>ss("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:sB,onClick:()=>void sb(),className:"rounded-xl border border-white/10 bg-white/[0.05] px-4 py-2 text-sm text-zinc-100",children:eZ?M("保存中...","Saving..."):M("保存线路设置","Save lane")}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>void sz(),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:M("写入 youtube.ini","Write youtube.ini")})]}),sa.ok?null:(0,n.jsx)("p",{className:"text-xs text-rose-300",children:sa.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:M("高级:进程名","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!==(R=null==st?void 0:st.pm2Name)&&void 0!==R?R:e8(tX.id),onChange:e=>ss("pm2Name",e.target.value),spellCheck:!1,placeholder:"youtube2__…"}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-[11px] text-zinc-500",children:[M("实际生效","Effective"),": ",sl||"—"]}),sa.message&&!sa.ok?(0,n.jsx)("p",{className:"mt-2 text-[11px] text-rose-300",children:sa.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!==(T=null==st?void 0:st.notes)&&void 0!==T?T:"",onChange:e=>ss("notes",e.target.value),placeholder:M("备注(可选)","Notes (optional)")}),eY?(0,n.jsx)("p",{className:"text-xs text-zinc-400",children:eY}):null,(0,n.jsxs)("button",{type:"button",disabled:sB||es.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=es.filter(e=>e.id!==tX.id);eI(e=>{let t={...e};return delete t[tX.id],t}),se(t,{force:!0}),ei((null===(e=t[0])||void 0===e?void 0:e.id)||"")},children:[(0,n.jsx)(L.Z,{className:"h-3.5 w-3.5"}),M("删除此线路","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:M("直播地址列表","URL list")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:M("每条线路独立写入自己的 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:I?eC(I):"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:[M("有效地址","Valid URLs"),": ",sC]}),(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: ",sP]})]}),sJ,eM?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eM}):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:eb,onChange:e=>{tD.current=!0,tG(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:sB,onClick:()=>void sN(),className:"rounded-xl bg-cyan-500/20 px-4 py-2 text-sm text-cyan-100 ring-1 ring-cyan-500/30",children:M("保存地址","Save URLs")})})]})]}),"single"===ee?(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:M("直播地址列表 \xb7 URL_config.ini","URL_config.ini")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-zinc-500",children:M("一行一个地址;可自动刷新或手动重新读取。","One URL per line; auto-refresh or reload.")}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[10px] text-zinc-600",children:I?eC(I):"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:[M("有效地址","Valid URLs"),": ",sC]}),(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: ",sP]})]}),sJ,eM?(0,n.jsx)("p",{className:"mt-2 text-xs text-zinc-500",children:eM}):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:ea,onChange:e=>{tD.current=!0,tJ(e.target.value)},spellCheck:!1}),(0,n.jsx)("button",{type:"button",disabled:sB,onClick:()=>void sk(),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:M("保存 URL 配置","Save URL config")})]}):null,(0,n.jsx)(eL,{t:M,currentProc:t4,fetchJson:W,urlListText:"single"===ee?ea:eb,keySuffixUi:sw,showKeyRow:!0,pollMs:800,refreshToken:eG}),s7,s4||sQ]})}var tC=s(257);let tP=["dashboard","services","live_youtube","live_tiktok","android","studio","network","settings"],tR=()=>void 0!==tC&&tC.env.NEXT_PUBLIC_API_URL||"";function tL(e){if(null==e||!Number.isFinite(e))return"—";if(0===e)return"0 B";let t=["B","KB","MB","GB","TB"],s=e,n=0;for(;s>=1024&&n=10||0===n?0:1)," ").concat(t[n])}function tT(e){if(null==e||!Number.isFinite(e))return"—";let t=Math.max(0,Math.floor(e));if(t<60)return"".concat(t,"s");let s=Math.floor(t/60);if(s<60)return"".concat(s,"m");let n=Math.floor(s/60);return n<48?"".concat(n,"h"):"".concat(Math.floor(n/24),"d")}function tM(e){let t=tL(e);return"—"===t?t:"".concat(t,"/s")}function tE(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 tU(e,t){let s=null!=t?t:(e,t)=>t||e,n=(e||"").trim().toLowerCase();return"connected"===n?s("高速可用","Ready"):"configured"===n?s("已配置","Configured"):"detected"===n?s("接口已起","Detected"):"idle"===n?s("等待握手","Idle"):"stale"===n?s("握手过期","Stale"):"down"===n?s("未连接","Down"):e||"—"}function tI(){var e,t,s,T,H,W,K,F,Y,J,G,q,V,$,X,Q,et,es,en,el,ei,ea,er,eo,ec,ed,ex,eu,em,ep,eb,eg,ef,ey,ew,ej,eN,ek,e_,ez,eS,eC,eP,eR,eL,eT,eM,eE,eU,eI,eA,eD,eO,eB,eH,eW,eF,eY,eJ,eG,eq,eV,e$,eX,eQ,e0,e1,e5,e2,e3,e4,e6,e8,e9,e7,te,tt,ts,tn,tl,ti,ta,tr,to,tc,td,tx,tu,tm,th,tp,tb,tg,tv,tf,ty,tw,tj,tN,tk,t_,tz,tC,tI,tZ,tA,tD,tO,tB,tH,tW,tK;let tF=tR(),[tY,tJ]=(0,A.useState)("zh"),[tG,tq]=(0,A.useState)("dark"),[tV,t$]=(0,A.useState)("dashboard"),[tX,tQ]=(0,A.useState)(!1),[t0,t1]=(0,A.useState)(null),[t5,t2]=(0,A.useState)(null),[t3,t4]=(0,A.useState)(!0),[t6,t8]=(0,A.useState)(null),[t9,t7]=(0,A.useState)(null),[se,st]=(0,A.useState)(null),[ss,sn]=(0,A.useState)(!0),[sl,si]=(0,A.useState)([]),[sa,sr]=(0,A.useState)([]),[so,sc]=(0,A.useState)(""),[sd,sx]=(0,A.useState)(""),[su,sm]=(0,A.useState)("/sdcard/app.apk"),[sh,sp]=(0,A.useState)(""),[sb,sg]=(0,A.useState)(null),[sv,sf]=(0,A.useState)(null),[sy,sw]=(0,A.useState)(!0),[sj,sN]=(0,A.useState)(!0),[sk,s_]=(0,A.useState)("tencent-relay-wg0"),[sz,sS]=(0,A.useState)(""),[sC,sP]=(0,A.useState)(null),[sR,sL]=(0,A.useState)(null),[sT,sM]=(0,A.useState)(null),[sE,sU]=(0,A.useState)(!1),[sI,sZ]=(0,A.useState)(!0),[sA,sD]=(0,A.useState)("overlay"),[sO,sB]=(0,A.useState)(""),[sH,sW]=(0,A.useState)(""),[sK,sF]=(0,A.useState)(""),[sY,sJ]=(0,A.useState)("255.255.255.255"),[sG,sq]=(0,A.useState)("9"),[sV,s$]=(0,A.useState)([]),[sX,sQ]=(0,A.useState)(""),[s0,s1]=(0,A.useState)(""),[s5,s2]=(0,A.useState)(""),[s3,s4]=(0,A.useState)([]),[s6,s8]=(0,A.useState)(""),[s9,s7]=(0,A.useState)("115200"),[ne,nt]=(0,A.useState)("AT"),[ns,nn]=(0,A.useState)(""),[nl,ni]=(0,A.useState)(null),na=(0,A.useRef)(null),nr=(0,A.useRef)(null),no=(0,A.useRef)(so),nc=(0,A.useRef)(0),nd=(0,A.useRef)(null),nx=(0,A.useCallback)((e,t)=>"zh"===tY?e:t,[tY]),nu=(0,A.useCallback)(e=>{t7(e),null!=nd.current&&window.clearTimeout(nd.current),nd.current=window.setTimeout(()=>{t7(null),nd.current=null},2800)},[]),nm=(0,A.useCallback)(async(e,t)=>(0,ee.N)("".concat(tF).concat(e),t),[tF]),nh=(0,A.useCallback)(async()=>{if(na.current)return na.current;let e=(async()=>{try{var e;let[t,s]=await Promise.allSettled([nm("/hub/dashboard"),nm("/deploy/check")]);if("fulfilled"!==t.status)throw t.reason;let n=t.value;t1(n),t2(null),st(Date.now()),"fulfilled"===s.status?sf(s.value):sf(null);let l=(null===(e=n.android)||void 0===e?void 0:e.devices)||[];if(l.length&&!sh){let e=l.find(e=>"device"===(e.state||"").toLowerCase());sp((null!=e?e:l[0]).serial)}}catch(e){t2(e.message),sf(null)}finally{t4(!1),na.current=null}})();return na.current=e,e},[sh,nm]),np=(0,A.useMemo)(()=>{let e=new URLSearchParams({light:"1"});return"live_youtube"===tV?e.set("family","youtube"):"live_tiktok"===tV&&e.set("family","tiktok"),"/process_monitor?".concat(e.toString())},[tV]),nb=(0,A.useCallback)(async()=>{if(nr.current)return nr.current;let e=(async()=>{try{let e=(await nm(np)).entries||[];sr(e),si(e.map(e=>({pm2:e.pm2,script:e.script,label:e.label}))),st(Date.now()),sc(t=>!e.length||t&&e.some(e=>e.pm2===t)?t:e[0].pm2)}catch(e){}finally{nr.current=null}})();return nr.current=e,e},[nm,np]);(0,A.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get("view");e&&tP.includes(e)?t$(e):"/youtube-events"===window.location.pathname.replace(/\/$/,"")&&t$("live_youtube");let t=window.localStorage.getItem("live-hub-lang");("zh"===t||"en"===t)&&tJ(t);let s=window.localStorage.getItem("live-hub-theme");("light"===s||"dark"===s)&&tq(s)},[]),(0,A.useEffect)(()=>{let e=new URL(window.location.href);"dashboard"===tV?e.searchParams.delete("view"):e.searchParams.set("view",tV),window.history.replaceState(null,"",e.toString())},[tV]),(0,A.useEffect)(()=>{window.localStorage.setItem("live-hub-lang",tY)},[tY]),(0,A.useEffect)(()=>{document.documentElement.setAttribute("data-theme",tG);try{window.localStorage.setItem("live-hub-theme",tG)}catch(e){}},[tG]),(0,A.useEffect)(()=>{let e=()=>sn("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,A.useEffect)(()=>{if(!tX)return;let e=e=>{"Escape"===e.key&&tQ(!1)};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[tX]),(0,A.useEffect)(()=>()=>{null!=nd.current&&window.clearTimeout(nd.current)},[]),(0,A.useEffect)(()=>{try{"0"===localStorage.getItem("livehub.autorefresh")&&sw(!1),"0"===localStorage.getItem("livehub.showStreamProbes")&&sN(!1)}catch(e){}},[]),(0,A.useEffect)(()=>{nh()},[nh]),(0,A.useEffect)(()=>{nb()},[nb]),(0,A.useEffect)(()=>{if(!sy||!ss||"live_youtube"===tV||"live_tiktok"===tV)return;let e=window.setInterval(()=>{nh()},1e4);return()=>clearInterval(e)},[sy,ss,nh,tV]),(0,A.useEffect)(()=>{if(!sy||!ss)return;let e=window.setInterval(()=>{nb()},"live_youtube"===tV||"live_tiktok"===tV?700:4e3);return()=>clearInterval(e)},[sy,ss,nb,tV]),(0,A.useEffect)(()=>{no.current=so},[so]),(0,A.useEffect)(()=>{so&&"live_youtube"===tV&&(async()=>{let e=no.current.trim(),t=++nc.current;try{let s=new URLSearchParams({process:e,_ts:String(Date.now())}),n=await nm("/get_url_config?".concat(s));if(t!==nc.current||e!==no.current.trim())return;sx(n.content||"")}catch(e){}})()},[so,nm,tV]),(0,A.useEffect)(()=>{"settings"===tV&&(async()=>{try{let e=await nm("/hub/config");sg(e)}catch(e){sg(null)}})()},[nm,tV]);let ng=(0,A.useMemo)(()=>{var e;let t=(null==t0?void 0:null===(e=t0.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,ev.p)(n):s[e]=n;return s},[null==t0?void 0:null===(e=t0.stack)||void 0===e?void 0:e.quick_links]),nv=(0,A.useMemo)(()=>{let e=new Map;for(let t of(null==t0?void 0:t0.services)||[])e.set(t.service_id,t);return e},[null==t0?void 0:t0.services]),nf=(0,A.useMemo)(()=>["homeassistant","frigate","ntfy","wol"].map(e=>nv.get(e)).filter(Boolean),[nv]),ny=nv.get("wol"),nw=(0,A.useMemo)(()=>(0,eK.O0)(ng),[ng]),nj=(0,A.useMemo)(()=>(0,eK.Tc)(nw),[nw]),nN=(0,A.useMemo)(()=>((null==sR?void 0:sR.interfaces)||[]).flatMap(e=>e.peers||[]),[null==sR?void 0:sR.interfaces]),nk=(0,A.useMemo)(()=>((null==sR?void 0:sR.interfaces)||[]).flatMap(e=>e.configured_peers||[]),[null==sR?void 0:sR.interfaces]),n_=(0,A.useMemo)(()=>((null==sR?void 0:sR.repo_configs)||[]).flatMap(e=>e.peers||[]).map(e=>({...e,status_source:"config",config_source:"repo"})),[null==sR?void 0:sR.repo_configs]),nz=nN[0]||nk[0]||n_[0]||null,nS=(0,A.useMemo)(()=>{for(let e of[...nN,...nk,...n_]){let t=e.endpoint_host||function(e){let t=(e||"").trim();if(!t)return"";if(t.startsWith("[")){let e=t.indexOf("]");return e>0?t.slice(1,e):""}let s=t.lastIndexOf(":");return s>0?t.slice(0,s):t}(e.endpoint);if(t)return t}return""},[nk,n_,nN]),nC=(null==sC?void 0:null===(t=sC.windows_route_template)||void 0===t?void 0:t.endpoint_host)||(null==sC?void 0:null===(T=sC.peers)||void 0===T?void 0:null===(s=T.find(e=>e.endpoint_host))||void 0===s?void 0:s.endpoint_host)||nS||"",nP=(0,A.useMemo)(()=>{if(!nC)return"";let e=sO.trim()||"",t=sH.trim()||"";return"route -p add ".concat(nC," mask 255.255.255.255 ").concat(e," metric 1 if ").concat(t)},[nC,sO,sH]),nR=(0,A.useCallback)(async()=>{try{var e;let t=await nm("/hub/network/wireguard/status");sL(null!==(e=t.wireguard)&&void 0!==e?e:null)}catch(e){sL(null)}},[nm]),nL=(0,A.useCallback)(async()=>{sU(!0);try{let e=await nm("/hub/network/system_probe");sM(null!=e?e:null)}catch(e){sM(null)}finally{sU(!1)}},[nm]);(0,A.useEffect)(()=>{"network"===tV&&(nR(),nL())},[nL,nR,tV]);let nT=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=sz.trim();if(!t){nu(nx("请先选择或粘贴 WireGuard 配置","Pick or paste a WireGuard config first"));return}t8(e?"wg:apply":"wg:save");try{var s;let n=await nm("/hub/network/wireguard/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:sk,content:t,route_mode:sA,apply:e})});sP(null!==(s=n.wireguard)&&void 0!==s?s:null),await nR(),nu(e?nx("WireGuard 配置已保存并应用","WireGuard config saved and applied"):nx("WireGuard 配置已保存","WireGuard config saved"))}catch(e){nu(e.message)}finally{t8(null)}},nM=async e=>{t8("wg:neko:".concat(e));try{await nm("/hub/network/wireguard/neko_access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e,restart:!0})}),await nR(),await nh(),nu("remote"===e?"Neko switched to WireGuard remote access":"Neko switched back to LAN")}catch(e){nu(e.message),await nR()}finally{t8(null)}},nE=async()=>{await nT(!1)},nU=async e=>{let t=(e||"").trim();if(t){t8("wg:load:".concat(t));try{var s;let e=await nm("/hub/network/wireguard/config/".concat(encodeURIComponent(t)));s_(e.name||t),sS(e.content||""),sP(null!==(s=e.wireguard)&&void 0!==s?s:null),sZ(!0),nu(nx("已载入 WireGuard 配置","WireGuard config loaded"))}catch(e){nu(e.message)}finally{t8(null)}}},nI=async e=>{if(e)try{let t=await e.text();sS(t),sk.trim()||s_(e.name.replace(/\.conf$/i,""))}catch(e){nu(e.message)}},nZ=async(e,t)=>{t8("svc:".concat(e));try{let s=await nm("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});"error"===s.status?nu(s.detail||s.message||nx("操作失败","Action failed")):nu(s.message||"OK"),await nh()}catch(e){nu(e.message)}finally{t8(null)}},nA=async()=>{let e=sK.trim(),t=sY.trim()||"255.255.255.255",s=Number(sG.trim()||"9");if(!e){nu(nx("请输入 MAC 地址","Enter a MAC address"));return}if(!Number.isInteger(s)||s<1||s>65535){nu(nx("端口必须在 1-65535 之间","Port must be 1-65535"));return}t8("wol:wake");try{let n=await nm("/studio/wol/wake",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e,broadcast:t,port:s})});nu(n.message||nx("唤醒包已发送","Wake packet sent"))}catch(e){nu(e.message)}finally{t8(null)}},nD=(0,A.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await nm(e?"/studio/wol/devices/probe":"/studio/wol/devices",e?{method:"POST"}:void 0);s$(t.devices||[])}catch(t){e&&nu(t.message)}},[nm,nu]),nO=async()=>{let e=sK.trim();if(!e){nu(nx("请输入 MAC 地址","Enter a MAC address"));return}t8("wol:save");try{var t;let s=await nm("/studio/wol/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s0,mac:e,ip:s5})});s$(s.devices||[]),sQ((null===(t=s.device)||void 0===t?void 0:t.mac)||e),nu(s.message||nx("设备已保存","Device saved"))}catch(e){nu(e.message)}finally{t8(null)}},nB=async()=>{let e=(sX||sK).trim();if(e){t8("wol:delete");try{let t=await nm("/studio/wol/devices/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mac:e})});s$(t.devices||[]),sQ(""),sF(""),s1(""),s2(""),nu(nx("设备已删除","Device removed"))}catch(e){nu(e.message)}finally{t8(null)}}},nH=(0,A.useCallback)(async()=>{try{let e=(await nm("/studio/serial/ports")).ports||[];s4(e),s8(t=>{var s;return t&&e.some(e=>e.path===t)?t:(null===(s=e[0])||void 0===s?void 0:s.path)||t})}catch(e){s4([])}},[nm]),nW=(0,A.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let t=await nm("/studio/ops/summary".concat(e?"?refresh=1":""));ni(t)}catch(t){e&&nu(t.message)}},[nm,nu]),nK=async()=>{t8("studio:snapshot");try{let e=await nm("/studio/ops/snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"studio"})});await nW(!1),nu(e.message||nx("系统快照已创建","System snapshot created"))}catch(e){nu(e.message)}finally{t8(null)}};(0,A.useEffect)(()=>{if("studio"!==tV)return;nD(!0),nW(!0);let e=window.setInterval(()=>{nD(!0),nW(!1)},3e4);return()=>window.clearInterval(e)},[nH,nW,nD,tV]);let nF=async(e,t)=>{let s=(null!=t?t:so).trim();if(s){t8("proc:".concat(e,":").concat(s));try{let t=await nm("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:s})});nu(String(t.output||t.message||"OK")),await nb(),"live_youtube"===tV||"live_tiktok"===tV?nh():await nh()}catch(e){nu(e.message)}finally{t8(null)}}},nY=async(e,t)=>{let s=(null!=t?t:so).trim();if(!s)return;let n=null!=e?e:sd,l=++nc.current;t8("save:url");try{let e=new URLSearchParams({process:s});await nm("/save_url_config?".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),l===nc.current&&s===no.current.trim()&&sx(n),nu(nx("URL 配置已保存","URL config saved"))}catch(e){throw nu(e.message),e}finally{t8(null)}},nJ=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!sh){nu(nx("请选择设备","Pick a device"));return}t8("adb:".concat(e));try{let s=await nm("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:sh,payload:t})});nu(s.message||"OK")}catch(e){nu(e.message)}finally{t8(null)}},nG=[{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:"studio",icon:x.Z,labelZh:"工作室",labelEn:"Studio"},{id:"network",icon:u.Z,labelZh:"网络",labelEn:"Network"},{id:"settings",icon:m.Z,labelZh:"设置",labelEn:"Settings"}],nq=e=>{(async()=>{var t;if(null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText){await navigator.clipboard.writeText(e);return}let s=document.createElement("textarea");s.value=e,s.readOnly=!0,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()})().then(()=>nu(nx("已复制","Copied")),()=>nu(nx("复制失败","Copy failed")))},nV=null!==(tc=null==t0?void 0:null===(H=t0.services)||void 0===H?void 0:H.filter(e=>e.running&&e.available).length)&&void 0!==tc?tc:0,n$=null!==(td=null==t0?void 0:null===(W=t0.services)||void 0===W?void 0:W.length)&&void 0!==td?td:0,nX=se?new Date(se).toLocaleTimeString("zh"===tY?"zh-CN":"en-US",{hour12:!1}):nx("未同步","Not synced"),nQ=ss?nx("前台自动刷新","Auto refresh"):nx("后台已暂停刷新","Refresh paused in background");return(0,n.jsxs)("div",{className:"lp-root min-h-screen transition-colors duration-300 ".concat("light"===tG?"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"===tG?"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"===tG?"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"===tG?"bg-cyan-400/10":"bg-cyan-500/10"),"aria-hidden":!0}),t9?(0,n.jsx)(l.E.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},role:"status","aria-live":"polite","aria-atomic":"true",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:t9}):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"===tG?"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)(h.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"===tG?"text-slate-500":"text-zinc-500"),children:"live.local"}),(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:nx("无人直播系统","Unmanned Live System")})]})]}),(0,n.jsx)("nav",{className:"mt-10 flex flex-1 flex-col gap-1",children:nG.map(e=>{let t=e.icon,s=tV===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>t$(e.id),"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm font-medium transition ".concat("light"===tG?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"===tG?s?"text-violet-600":"text-slate-400":s?"text-violet-300":"text-zinc-600")}),nx(e.labelZh,e.labelEn),s?(0,n.jsx)(p.Z,{className:"ml-auto h-4 w-4 ".concat("light"===tG?"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"===tG?"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"===tG?"border-slate-200 bg-white/80":"border-white/10 bg-white/5"),onClick:()=>tQ(!0),"aria-label":"Menu",children:(0,n.jsx)(b.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"===tG?"text-slate-900":"text-white"),children:nx((null===(K=nG.find(e=>e.id===tV))||void 0===K?void 0:K.labelZh)||"",(null===(F=nG.find(e=>e.id===tV))||void 0===F?void 0:F.labelEn)||"")}),(0,n.jsxs)("p",{className:"truncate text-xs ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:[(null==t0?void 0:null===(Y=t0.stack)||void 0===Y?void 0:Y.mdns_host)||"live.local"," \xb7"," ","dark"===tG?nx("夜间","Dark mode"):nx("日间","Light mode")," \xb7 ",nQ," \xb7"," ",nx("最后同步","Last sync")," ",nX]})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 sm:gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>tq(e=>"dark"===e?"light":"dark"),className:"rounded-xl border p-2 transition ".concat("light"===tG?"border-slate-200 bg-white text-amber-500 shadow-sm":"border-white/10 bg-white/[0.06] text-violet-200"),title:"dark"===tG?nx("切换到日间","Switch to light"):nx("切换到夜间","Switch to dark"),"aria-label":"dark"===tG?nx("日间模式","Light mode"):nx("夜间模式","Dark mode"),"aria-pressed":"light"===tG,children:"dark"===tG?(0,n.jsx)(g.Z,{className:"h-5 w-5",strokeWidth:2}):(0,n.jsx)(v.Z,{className:"h-5 w-5",strokeWidth:2})}),(0,n.jsxs)("button",{type:"button",onClick:()=>tJ(e=>"zh"===e?"en":"zh"),className:"relative rounded-xl border p-2 transition ".concat("light"===tG?"border-slate-200 bg-white text-cyan-600 shadow-sm":"border-white/10 bg-white/[0.06] text-cyan-200"),title:"zh"===tY?"English":"中文","aria-label":nx("切换语言","Toggle language"),"aria-pressed":"en"===tY,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"===tG?"bg-cyan-100 text-cyan-800":"bg-cyan-500/30 text-cyan-100"),children:"zh"===tY?"中":"A"})]}),(0,n.jsxs)("button",{type:"button",disabled:!!t6,onClick:()=>void Promise.all([nh(),nb()]),className:"flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-medium transition disabled:opacity-40 ".concat("light"===tG?"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:[t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:nx("刷新","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"===tV?(0,n.jsxs)("div",{className:"space-y-6",children:[t5?(0,n.jsxs)("div",{className:"rounded-2xl border border-rose-500/25 bg-rose-950/20 p-4 text-sm text-rose-200",children:[nx("无法加载仪表盘:","Dashboard error: "),t5]}):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"===tG?"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)(O.Z,{snapshot:null!==(tx=null==t0?void 0:t0.snapshot)&&void 0!==tx?tx:null,theme:tG,tr:nx})}),(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"===tG?"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)(D,{tr:nx})}),(0,n.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[{icon:j.Z,label:nx("CPU 1m","CPU 1m"),value:null!==(tu=null==t0?void 0:null===(q=t0.snapshot)||void 0===q?void 0:null===(G=q.cpu_load)||void 0===G?void 0:null===(J=G["1m"])||void 0===J?void 0:J.toFixed(2))&&void 0!==tu?tu:"—",sub:nx("负载均值","Load avg")},{icon:a.Z,label:nx("内存","Memory"),value:tL(null==t0?void 0:null===($=t0.snapshot)||void 0===$?void 0:null===(V=$.memory)||void 0===V?void 0:V.available),sub:"/ ".concat(tL(null==t0?void 0:null===(Q=t0.snapshot)||void 0===Q?void 0:null===(X=Q.memory)||void 0===X?void 0:X.total))},{icon:N.Z,label:nx("磁盘可用","Disk free"),value:tL(null==t0?void 0:null===(es=t0.snapshot)||void 0===es?void 0:null===(et=es.disk)||void 0===et?void 0:et.free),sub:"/ ".concat(tL(null==t0?void 0:null===(el=t0.snapshot)||void 0===el?void 0:null===(en=el.disk)||void 0===en?void 0:en.total))},{icon:r.Z,label:nx("服务在线","Services up"),value:"".concat(nV,"/").concat(n$||"—"),sub:nx("基础服务层","Infra layer")},{icon:k.Z,label:nx("运行时间","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==t0?void 0:null===(ei=t0.snapshot)||void 0===ei?void 0:ei.uptime_seconds),sub:nx("自开机","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:t3?"…":e.value}),(0,n.jsx)("p",{className:"mt-0.5 text-[10px] text-zinc-500",children:e.sub})]},e.label))}),(null==t0?void 0:t0.hardware)&&"object"==typeof t0.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:nx("系统硬件与软件能力","Hardware & software profile")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("来自 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:nx("平台","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!==(tm=t0.hardware.arch)&&void 0!==tm?tm:"—")})]}),(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!==(tp=null!==(th=t0.hardware.kernel)&&void 0!==th?th:null===(ea=t0.stack)||void 0===ea?void 0:ea.kernel)&&void 0!==tp?tp:"—")})]}),(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!==(tb=null===(er=t0.stack)||void 0===er?void 0:er.python)&&void 0!==tb?tb:"—")})]}),(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!==(tg=null===(eo=t0.stack)||void 0===eo?void 0:eo.mdns_host)&&void 0!==tg?tg:"—"})]}),(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===(ec=t0.stack)||void 0===ec?void 0:ec.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=t0.hardware.gpu,t=t0.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)?nx("已检测","present"):nx("未检测","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(", "):nx("—","—")})]})]})})()]}),(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=t0.hardware.ffmpeg_hwaccels||[],a=t0.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:[nx("解码","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:[nx("稳定模式","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,sv?(0,n.jsxs)("div",{className:"rounded-2xl border p-5 ".concat(sv.ready?"border-emerald-500/25 bg-gradient-to-br from-emerald-500/[0.08] via-zinc-950/50 to-cyan-500/[0.05]":"border-amber-500/30 bg-gradient-to-br from-amber-500/[0.1] via-zinc-950/55 to-rose-500/[0.05]"),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-white",children:nx("安装验收","Deployment health")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("一键脚本完成后,本机 API、局域网入口、反向代理与 mDNS 的可用性检查。","Post-install checks for loopback API, LAN access, reverse proxy, and mDNS.")})]}),(0,n.jsx)("span",{className:"rounded-full px-3 py-1 text-[10px] font-semibold ".concat(sv.ready?"bg-emerald-500/20 text-emerald-100 ring-1 ring-emerald-500/30":"bg-amber-500/20 text-amber-100 ring-1 ring-amber-500/30"),children:sv.ready?nx("可交付","Ready"):nx("需处理","Needs attention")})]}),(0,n.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,n.jsxs)("div",{className:"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-zinc-500",children:nx("验收摘要","Acceptance summary")}),(0,n.jsxs)("p",{className:"mt-2 font-mono text-sm text-white",children:[null!==(tv=sv.pass_count)&&void 0!==tv?tv:0,"/",null!==(tf=sv.total_count)&&void 0!==tf?tf:0,(0,n.jsx)("span",{className:"ml-2 text-[11px] text-zinc-500",children:nx("已通过","checks passed")})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("必需项","Required"),": ",null!==(ty=sv.required_total)&&void 0!==ty?ty:0," \xb7 mDNS"," ",sv.mdns_enabled?nx("已启用","enabled"):nx("已关闭","disabled")," \xb7 edge"," ",sv.live_edge_enabled?nx("已启用","enabled"):nx("已关闭","disabled")]}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:Object.entries(sv.urls||{}).filter(e=>{let[,t]=e;return!!t}).slice(0,4).map(e=>{let[t,s]=e;return(0,n.jsx)("a",{href:(0,ev.p)(s),target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-[11px] text-zinc-200 ring-1 ring-white/10",children:t},t)})})]}),(0,n.jsxs)("div",{className:"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-zinc-500",children:(null===(ed=sv.failing_checks)||void 0===ed?void 0:ed.length)?nx("失败项","Failing checks"):nx("当前状态","Current state")}),(null===(ex=sv.failing_checks)||void 0===ex?void 0:ex.length)?(0,n.jsx)("ul",{className:"mt-2 space-y-2 text-[11px] text-zinc-300",children:sv.failing_checks.slice(0,4).map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 px-3 py-2",children:[(0,n.jsx)("span",{className:"font-semibold text-amber-100",children:e.label}),(0,n.jsx)("span",{className:"ml-2 text-zinc-400",children:e.detail||"—"})]},e.id))}):(0,n.jsx)("p",{className:"mt-2 text-[11px] text-emerald-200/90",children:nx("必需检查已全部通过,可直接用浏览器面板交付。","All required checks pass; browser control plane is ready.")}),(sv.hints||[]).length?(0,n.jsx)("ul",{className:"mt-3 list-inside list-disc space-y-1 text-[10px] text-zinc-400",children:(sv.hints||[]).slice(0,3).map(e=>(0,n.jsx)("li",{children:e},e))}):null]})]})]}):null,(null==t0?void 0:null===(eu=t0.stack)||void 0===eu?void 0:eu.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 ",nx("登录","sign-in")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:t0.stack.neko_login.note_zh||nx(nj?"Neko Chromium ".concat(nj," 使用下列账号策略。"):"Neko Chromium 多实例使用下列账号策略。",nj?"Neko Chromium ".concat(nj," uses the policy below."):"Neko Chromium instances use the policy below.")}),(0,n.jsx)("p",{className:"mt-2 text-[11px] text-amber-200/85",children:nx("重要:两栏分开填——昵称随意,密码必须是环境变量里的口令(默认 12345678)。用错密码会像一直加载;勿把「用户名/密码」写在一行。","Use two fields: display name is free-form; password must match NEKO_* (default 12345678). Wrong password looks like infinite loading.")}),nw.length?(0,n.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:nw.map(e=>(0,n.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg border border-fuchsia-400/20 bg-black/25 px-3 py-2 text-[11px] text-fuchsia-100 ring-1 ring-fuchsia-400/20",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.label}),(0,n.jsx)("span",{className:"ml-2 rounded-full bg-fuchsia-500/15 px-1.5 py-0.5 text-[10px] text-fuchsia-100",children:e.accessLabel}),(0,n.jsxs)("span",{className:"ml-2 font-mono text-fuchsia-100/75",children:[e.host||"",e.port?":".concat(e.port):""]})]},e.key))}):null,(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:nx("昵称示例","Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-fuchsia-200",children:null!==(tw=t0.stack.neko_login.user_login)&&void 0!==tw?tw:"live"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:nx("连接口令","Access Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-fuchsia-100",children:null!==(tj=t0.stack.neko_login.user_password)&&void 0!==tj?tj:"—"})]}),(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:nx("管理昵称示例","Admin Display Name Example")}),(0,n.jsx)("p",{className:"mt-1 text-violet-200",children:null!==(tN=t0.stack.neko_login.admin_login)&&void 0!==tN?tN:"admin"}),(0,n.jsx)("p",{className:"mt-2 text-[10px] uppercase text-zinc-500",children:nx("管理口令","Admin Password")}),(0,n.jsx)("p",{className:"mt-0.5 text-violet-100",children:null!==(tk=t0.stack.neko_login.admin_password)&&void 0!==tk?tk:"—"})]})]}),(0,n.jsx)("p",{className:"mt-3 text-[10px] text-zinc-600",children:nx("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==t0?void 0:null===(ep=t0.network)||void 0===ep?void 0:null===(em=ep.interfaces)||void 0===em?void 0:em.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)(_.Z,{className:"h-4 w-4 text-cyan-300"}),nx("网络带宽 / 流量","Network bandwidth / traffic")]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("实时速率由总览自动刷新间隔计算;累计值来自系统网卡计数器。","Live rates are calculated from dashboard refresh deltas; totals come from kernel counters.")}),(0,n.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(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-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:nx("实时下行","Live down")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:tM(t0.network.total_rx_bps)}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[nx("累计","Total"),": ",tL(t0.network.total_rx_bytes)]})]}),(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-[10px] uppercase tracking-[0.08em] text-cyan-300/70",children:nx("实时上行","Live up")}),(0,n.jsx)("p",{className:"mt-1 text-lg font-semibold text-cyan-100",children:tM(t0.network.total_tx_bps)}),(0,n.jsxs)("p",{className:"mt-1 text-zinc-500",children:[nx("累计","Total"),": ",tL(t0.network.total_tx_bytes)]})]})]}),(0,n.jsx)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:(t0.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:[nx("链路","Link"),": ",e.operstate||"unknown"," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",e.speed_mbps?"".concat(e.speed_mbps," Mbps"):nx("未知速率","unknown speed")]}),(0,n.jsxs)("p",{className:"mt-2 text-zinc-500",children:["↓ ",tM(e.rx_bps)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",tL(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:["↑ ",tM(e.tx_bps)," ",(0,n.jsx)("span",{className:"text-zinc-600",children:"\xb7"})," ",tL(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==t0?void 0:null===(eg=t0.live_events)||void 0===eg?void 0:null===(eb=eg.pm2_tail)||void 0===eb?void 0:eb.length)||(null==t0?void 0:null===(ey=t0.live_events)||void 0===ey?void 0:null===(ef=ey.process_digest)||void 0===ef?void 0:ef.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:nx("直播 / PM2 事件","Live / PM2 feed")}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("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==t0?void 0:null===(ew=t0.live_events)||void 0===ew?void 0:ew.pm2_tail)||[]).join("\n")||nx("暂无 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:nx("进程快照","Process digest")}),(0,n.jsx)("ul",{className:"mt-3 space-y-2",children:((null==t0?void 0:null===(ej=t0.live_events)||void 0===ej?void 0:ej.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(tE(e.status||"")),children:function(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||"—"}(e.status||"",nx)})]},e.pm2))})]})]}):null,null,(null==t0?void 0:t0.probes)&&sj?(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t0.probes.srs?(()=>{var e,t,s,l,i,a,r;let o=null===(e=t0.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,u=null==o?void 0:o.http,m=null==o?void 0:o.api_port,h=null!==(i=null==o?void 0:o.api_ok)&&void 0!==i?i:(null==u?void 0:u.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?nx("API 正常","API OK"):nx("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!=m?m:"—"," \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==u?void 0:u.http_code)&&void 0!==r?r:"—"," \xb7 ",nx("根路径","root")," ",null!=p?p:"—",404===p?nx("(无首页不影响推流)"," (no index is OK for streaming)"):null]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("延迟","RTT")," ",(null==u?void 0:u.latency_ms)!=null?"".concat(u.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==u?void 0:u.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:u.error}):null]})})():null,t0.probes.neko?(()=>{var e,t,s,l,i,a,r;let o=null===(e=t0.probes)||void 0===e?void 0:e.neko,c=null==o?void 0:null===(t=o.tcp)||void 0===t?void 0:t.reachable,d=null==o?void 0:o.http,x=(null==o?void 0:o.instances)||[],u=null!==(l=null==o?void 0:o.running_count)&&void 0!==l?l:x.filter(e=>{var t;return null===(t=e.tcp)||void 0===t?void 0:t.reachable}).length,m=null!==(i=null==o?void 0:o.required_count)&&void 0!==i?i:x.length;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:"Neko Chromium"}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(u>0?"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:[u,"/",m||"—"," ",nx("在线","online")]})]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] text-zinc-500",children:nx("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!==(a=null==o?void 0:o.port)&&void 0!==a?a:"—"," \xb7 TCP ",c?"OK":"—"," \xb7 HTTP ",null!==(r=null==d?void 0:d.http_code)&&void 0!==r?r:"—"]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] text-zinc-500",children:[nx("延迟","RTT")," ",(null==d?void 0:d.latency_ms)!=null?"".concat(d.latency_ms," ms"):(null==o?void 0:null===(s=o.tcp)||void 0===s?void 0:s.latency_ms)!=null?"".concat(o.tcp.latency_ms," ms"):"—"]}),x.length?(0,n.jsx)("div",{className:"mt-3 space-y-2",children:x.map(e=>{var t,s,l,i,a,r,o;return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-white/[0.05] bg-black/25 px-3 py-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("p",{className:"text-[11px] font-semibold text-zinc-200",children:["Neko ",null!==(a=e.id)&&void 0!==a?a:"?"]}),(0,n.jsxs)("p",{className:"font-mono text-[10px] text-zinc-500",children:[":",null!==(r=e.port)&&void 0!==r?r:"—"," \xb7 TCP ",(null===(t=e.tcp)||void 0===t?void 0:t.reachable)?"OK":"—"," \xb7 HTTP"," ",null!==(o=null===(s=e.http)||void 0===s?void 0:s.http_code)&&void 0!==o?o:"—"]})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat((null===(l=e.tcp)||void 0===l?void 0:l.reachable)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-zinc-500/15 text-zinc-400 ring-1 ring-zinc-500/25"),children:(null===(i=e.tcp)||void 0===i?void 0:i.reachable)?nx("运行中","Running"):nx("未连通","Offline")})]},"".concat(e.id,"-").concat(e.port))})}):null,!(null==d?void 0:d.reachable)&&(null==d?void 0:d.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:d.error}):null]})})():null]}):null]}):null,"services"===tV?(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[((null==t0?void 0:t0.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(tE(e.running?"online":e.status)),children:e.running?nx("运行中","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:nx("stopped 为常态:仅当需要透明代理 / 规则分流时再手动点 Start,不建议设置自启。","Stopped is normal; click Start manually only when the proxy is needed. Autostart stays off.")}):null,(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.url?(0,n.jsx)("a",{href:(0,ev.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:nx("打开面板","Open panel")}):null,(0,n.jsx)("button",{type:"button",disabled:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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:!!t6||!e.available||"android_gateway"===e.service_id&&"skipped"===e.status,title:"android_gateway"===e.service_id&&"skipped"===e.status?nx("单网口无需网关","Not needed on single NIC"):e.available?void 0:e.detail||nx("当前不可操作","Unavailable"),onClick:()=>void nZ(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==t0?void 0:null===(eN=t0.services)||void 0===eN?void 0:eN.length)?null:(0,n.jsx)("p",{className:"text-sm text-zinc-500",children:nx("暂无服务数据","No services")})]}):null,"live_youtube"===tV?(0,n.jsx)(tS,{t:nx,busy:t6,entries:sl,currentProc:so,setCurrentProc:sc,urlConfig:sd,setUrlConfig:sx,onRunProcess:(e,t)=>void nF(e,t),onSaveUrlConfig:(e,t)=>nY(e,t),fetchJson:nm,liveProcesses:sa.length?sa:null!==(t_=null==t0?void 0:null===(ek=t0.live)||void 0===ek?void 0:ek.processes)&&void 0!==t_?t_:[],notify:nu,quickLinks:ng,onNavigate:e=>t$(e)}):null,"live_tiktok"===tV?(0,n.jsx)(eZ,{t:nx,busy:!!t6,entries:sl,currentProc:so,setCurrentProc:sc,urlConfig:sd,setUrlConfig:sx,onRunProcess:e=>void nF(e),onSaveUrlConfig:e=>nY(e),onReplayGoLive:async(e,t)=>{let s=t.replace(/[,,|]/g,"_");await nY("原画,".concat(e,",主播: ").concat(s)),await nF("start")},onCopy:nq,fetchJson:nm,apiPrefix:tF,quickLinks:ng,hdmiStatus:null==t0?void 0:t0.hdmi,notify:nu,onNavigate:e=>t$(e)}):null,"android"===tV?(0,n.jsx)(eh,{t:nx,notify:nu,fetchJson:nm,apiBase:tF,busy:t6,androidSerial:sh,setAndroidSerial:sp,devices:(null==t0?void 0:null===(e_=t0.android)||void 0===e_?void 0:e_.devices)||[],adbAvailable:!!(null==t0?void 0:null===(ez=t0.android)||void 0===ez?void 0:ez.adb_available),apkPath:su,setApkPath:sm,onAndroidAction:(e,t)=>nJ(e,null!=t?t:{}),onCopy:nq,onRefreshDevices:()=>void nh()}):null,"studio"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(x.Z,{className:"h-5 w-5 ".concat("light"===tG?"text-emerald-700":"text-emerald-300")}),nx("工作室","Studio")]}),(0,n.jsx)("p",{className:"mt-1 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"Home Assistant / Frigate / WOL"})]}),(0,n.jsxs)("span",{className:"w-fit rounded-full px-3 py-1 text-[11px] font-semibold ".concat("light"===tG?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200":"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25"),children:[nf.filter(e=>null==e?void 0:e.running).length,"/",nf.length||4," online"]})]}),(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[[{id:"homeassistant",label:"Home Assistant",icon:x.Z,fallbackUrl:ng.homeassistant,iconClass:"light"===tG?"text-emerald-700":"text-emerald-300",openClass:"light"===tG?"bg-emerald-50 text-emerald-800 ring-1 ring-emerald-200 hover:bg-emerald-100":"bg-emerald-500/15 text-emerald-100 ring-1 ring-emerald-400/25 hover:bg-emerald-500/25"},{id:"frigate",label:"Frigate NVR",icon:z.Z,fallbackUrl:ng.frigate,iconClass:"light"===tG?"text-cyan-700":"text-cyan-300",openClass:"light"===tG?"bg-cyan-50 text-cyan-800 ring-1 ring-cyan-200 hover:bg-cyan-100":"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-400/25 hover:bg-cyan-500/25"},{id:"ntfy",label:"ntfy",icon:S.Z,fallbackUrl:ng.ntfy,iconClass:"light"===tG?"text-violet-700":"text-violet-300",openClass:"light"===tG?"bg-violet-50 text-violet-800 ring-1 ring-violet-200 hover:bg-violet-100":"bg-violet-500/15 text-violet-100 ring-1 ring-violet-400/25 hover:bg-violet-500/25"}].map(e=>{let t=nv.get(e.id),s=e.icon,i=(null==t?void 0:t.url)||e.fallbackUrl||"",a=!!t6||(null==t?void 0:t.available)===!1;return(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(s,{className:"h-4 w-4 ".concat(e.iconClass)}),e.label]}),(0,n.jsx)("p",{className:"mt-2 line-clamp-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:(null==t?void 0:t.description)||("frigate"===e.id?"Camera NVR and detection console":"Local automation workspace")})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==t?void 0:t.running)?"online":(null==t?void 0:t.status)||"unknown")),children:(null==t?void 0:t.running)?nx("运行中","Running"):(null==t?void 0:t.status)||"unknown"})]}),(null==t?void 0:t.detail)?(0,n.jsx)("p",{className:"mt-3 line-clamp-4 font-mono text-[11px] ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:t.detail}):null,(0,n.jsxs)("div",{className:"mt-5 flex flex-wrap gap-2",children:[i?(0,n.jsxs)("a",{href:(0,ev.p)(i),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold transition ".concat(e.openClass),children:[(0,n.jsx)(C.Z,{className:"h-3.5 w-3.5"}),nx("打开","Open")]}):null,(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"start"),className:"rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:"Start"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"restart"),className:"rounded-lg bg-amber-500/15 px-3 py-2 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/25 transition hover:bg-amber-500/25 disabled:opacity-40",children:"Restart"}),(0,n.jsx)("button",{type:"button",disabled:a,onClick:()=>void nZ(e.id,"stop"),className:"rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:"Stop"})]})]},e.id)}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(P.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-amber-700":"text-amber-300")}),nx("WOL 网络唤醒","WOL Network Wake")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:(null==ny?void 0:ny.detail)||"broadcast=255.255.255.255;port=9"})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==ny?void 0:ny.status)||"ready")),children:(null==ny?void 0:ny.status)||"ready"})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("select",{value:sX,onChange:e=>{let t=e.target.value;sQ(t);let s=sV.find(e=>e.mac===t);s&&(sF(s.mac),s1(s.name||""),s2(s.ip||""))},className:"min-w-0 flex-1 rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100"),children:[(0,n.jsx)("option",{value:"",children:nx("选择设备","Select device")}),sV.map(e=>(0,n.jsx)("option",{value:e.mac,children:(e.name||e.ip||e.mac)+(e.reachable?" \xb7 online":"")},e.mac))]}),(0,n.jsx)("button",{type:"button",disabled:"wol:probe"===t6,onClick:()=>{t8("wol:probe"),nD(!0).finally(()=>t8(null))},className:"inline-flex items-center justify-center rounded-lg bg-cyan-500/15 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/25 transition hover:bg-cyan-500/25 disabled:opacity-40",children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("wol:probe"===t6?"animate-spin":"")})})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("名称","Name")}),(0,n.jsx)("input",{value:s0,onChange:e=>s1(e.target.value),placeholder:"NAS / PC",className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"IP"}),(0,n.jsx)("input",{value:s5,onChange:e=>s2(e.target.value),placeholder:"10.0.0.10",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"MAC"}),(0,n.jsx)("input",{value:sK,onChange:e=>sF(e.target.value),placeholder:"AA:BB:CC:DD:EE:FF",autoCapitalize:"characters",spellCheck:!1,className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"Broadcast"}),(0,n.jsx)("input",{value:sY,onChange:e=>sJ(e.target.value),placeholder:"255.255.255.255",inputMode:"decimal",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"Port"}),(0,n.jsx)("input",{value:sG,onChange:e=>sq(e.target.value),inputMode:"numeric",className:"mt-1 w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-amber-400":"border-white/10 bg-black/35 text-zinc-100 focus:border-amber-400/60")})]})]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:wake"===t6||(null==ny?void 0:ny.available)===!1,onClick:()=>void nA(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-amber-500/18 px-3 py-2.5 text-xs font-semibold text-amber-100 ring-1 ring-amber-400/30 transition hover:bg-amber-500/28 disabled:opacity-40",children:["wol:wake"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),nx("唤醒","Wake")]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,n.jsxs)("button",{type:"button",disabled:"wol:save"===t6,onClick:()=>void nO(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:["wol:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(R.Z,{className:"h-3.5 w-3.5"}),nx("保存","Save")]}),(0,n.jsxs)("button",{type:"button",disabled:"wol:delete"===t6||!(sX||sK),onClick:()=>void nB(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-rose-500/15 px-3 py-2 text-xs font-semibold text-rose-100 ring-1 ring-rose-400/25 transition hover:bg-rose-500/25 disabled:opacity-40",children:["wol:delete"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(L.Z,{className:"h-3.5 w-3.5"}),nx("删除","Delete")]})]})]})]})]}),null,(0,n.jsxs)("div",{className:"grid gap-4 xl:grid-cols-4",children:[(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-emerald-700":"text-emerald-300")}),"System Doctor"]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:[null!==(tz=null==nl?void 0:null===(eS=nl.doctor)||void 0===eS?void 0:eS.services_running)&&void 0!==tz?tz:0,"/",null!==(tC=null==nl?void 0:null===(eC=nl.doctor)||void 0===eC?void 0:eC.services_available)&&void 0!==tC?tC:0," services"]})]}),(0,n.jsxs)("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold ".concat(tE((null==nl?void 0:null===(eP=nl.doctor)||void 0===eP?void 0:eP.status)||"unknown")),children:[null!==(tI=null==nl?void 0:null===(eR=nl.doctor)||void 0===eR?void 0:eR.score)&&void 0!==tI?tI:0,"/100"]})]}),(0,n.jsxs)("div",{className:"mt-4 space-y-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:[(0,n.jsxs)("p",{children:[nx("严重","Critical"),": ",null!==(tZ=null==nl?void 0:null===(eL=nl.doctor)||void 0===eL?void 0:eL.critical)&&void 0!==tZ?tZ:0," / ",nx("警告","Warnings"),": ",null!==(tA=null==nl?void 0:null===(eT=nl.doctor)||void 0===eT?void 0:eT.warnings)&&void 0!==tA?tA:0]}),((null==nl?void 0:null===(eM=nl.doctor)||void 0===eM?void 0:eM.recommendations)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:"line-clamp-2",children:["- ",e]},e))]})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(N.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-cyan-700":"text-cyan-300")}),nx("设备资产","Device inventory")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:"LAN / USB"})]}),(0,n.jsx)("button",{type:"button",disabled:"studio:ops"===t6,onClick:()=>{t8("studio:ops"),nW(!0).finally(()=>t8(null))},className:"inline-flex items-center justify-center rounded-lg px-2.5 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===tG?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat("studio:ops"===t6?"animate-spin":"")})})]}),(0,n.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2 text-center text-xs",children:[["WOL",null!==(tD=null==nl?void 0:null===(eU=nl.inventory)||void 0===eU?void 0:null===(eE=eU.counts)||void 0===eE?void 0:eE.wol)&&void 0!==tD?tD:0],["Video",null!==(tO=null==nl?void 0:null===(eA=nl.inventory)||void 0===eA?void 0:null===(eI=eA.counts)||void 0===eI?void 0:eI.video)&&void 0!==tO?tO:0]].map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{className:"rounded-lg border px-2 py-2 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:s}),(0,n.jsx)("p",{className:"light"===tG?"text-slate-500":"text-zinc-500",children:t})]},t)})})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(h.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-amber-700":"text-amber-300")}),nx("自动化配方","Automation recipes")]}),(0,n.jsx)("div",{className:"mt-4 space-y-2",children:((null==nl?void 0:nl.recipes)||[]).slice(0,3).map(e=>(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-700":"border-white/10 bg-black/30 text-zinc-300"),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"line-clamp-1 font-semibold",children:e.title}),(0,n.jsx)("span",{className:"ready"===e.status?"text-emerald-400":"text-amber-300",children:e.status})]})},e.id||e.title))})]}),(0,n.jsxs)(l.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"rounded-2xl border p-5 shadow-xl ".concat("light"===tG?"border-slate-200/90 bg-white shadow-slate-200/40":"border-white/[0.08] bg-zinc-950/50 shadow-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(r.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-violet-700":"text-violet-300")}),nx("备份快照","Backup snapshots")]}),(0,n.jsxs)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:[((null==nl?void 0:null===(eD=nl.backups)||void 0===eD?void 0:eD.snapshots)||[]).length," snapshots"]})]}),(0,n.jsxs)("button",{type:"button",disabled:"studio:snapshot"===t6,onClick:()=>void nK(),className:"inline-flex items-center justify-center gap-2 rounded-lg bg-violet-500/15 px-3 py-2 text-xs font-semibold text-violet-100 ring-1 ring-violet-400/25 transition hover:bg-violet-500/25 disabled:opacity-40",children:["studio:snapshot"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("创建","Create")]})]}),(0,n.jsx)("p",{className:"mt-4 line-clamp-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:(null===(eO=((null==nl?void 0:null===(eB=nl.backups)||void 0===eB?void 0:eB.snapshots)||[])[0])||void 0===eO?void 0:eO.name)||nx("暂无快照","No snapshots yet")})]})]})]}):null,"network"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,n.jsxs)("div",{className:"rounded-2xl border p-6 shadow-xl ".concat("light"===tG?"border-cyan-200/90 bg-white shadow-cyan-100/50":"border-cyan-500/20 bg-zinc-950/55 shadow-black/30"),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",{children:[(0,n.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(M.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-cyan-700":"text-cyan-300")}),"WireGuard VPS"]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("导入 VPS wg-quick 配置,保存到受管配置目录,并生成 Windows 端点旁路路由命令。","Import a VPS wg-quick config, save it under managed config, and generate the Windows endpoint bypass route.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("span",{className:"rounded-full px-3 py-1 text-[11px] font-semibold ".concat((null==sR?void 0:sR.active)?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-400/25":"bg-amber-500/15 text-amber-200 ring-1 ring-amber-400/25"),children:[tU(null==sR?void 0:null===(eH=sR.quality)||void 0===eH?void 0:eH.status,nx),"number"==typeof(null==sR?void 0:null===(eW=sR.quality)||void 0===eW?void 0:eW.score)?" \xb7 ".concat(sR.quality.score,"/100"):""]}),(null==sC?void 0:sC.relative_path)?(0,n.jsx)("div",{className:"rounded-lg border px-3 py-2 text-[11px] ".concat("light"===tG?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-400/20 bg-cyan-500/10 text-cyan-100"),children:sC.relative_path}):null,(0,n.jsxs)("button",{onClick:()=>{nR(),nL()},disabled:"wg:status"===t6||sE,className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 text-xs font-semibold ring-1 transition disabled:opacity-40 ".concat("light"===tG?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:[(0,n.jsx)(w.Z,{className:"h-3.5 w-3.5 ".concat(sE?"animate-spin":"")}),sE?nx("探测中","Probing"):nx("刷新","Refresh")]})]})]}),(0,n.jsxs)("div",{className:"mt-5 grid gap-3 lg:grid-cols-2 xl:grid-cols-4",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("当前接口","Active interfaces")}),(0,n.jsxs)("div",{className:"mt-2 rounded-lg border px-3 py-2 text-xs ".concat("light"===tG?"border-cyan-100 bg-white text-slate-700":"border-cyan-400/15 bg-cyan-500/10 text-cyan-100"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:tU(null==sR?void 0:null===(eF=sR.quality)||void 0===eF?void 0:eF.status,nx)}),(0,n.jsx)("span",{className:"font-mono",children:"number"==typeof(null==sR?void 0:null===(eY=sR.quality)||void 0===eY?void 0:eY.score)?"".concat(sR.quality.score,"/100"):"—"})]}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===tG?"text-slate-500":"text-cyan-100/75"),children:[nx("新鲜握手","Fresh peers"),": ",null!==(tB=null==sR?void 0:null===(eJ=sR.quality)||void 0===eJ?void 0:eJ.fresh_peer_count)&&void 0!==tB?tB:0,"/",null!==(tH=null==sR?void 0:null===(eG=sR.quality)||void 0===eG?void 0:eG.peer_count)&&void 0!==tH?tH:0," \xb7 ",nx("最佳握手","Best handshake"),": ",tT(null==sR?void 0:null===(eq=sR.quality)||void 0===eq?void 0:eq.best_handshake_age_seconds)]})]}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:((null==sR?void 0:sR.interfaces)||[]).length?((null==sR?void 0:sR.interfaces)||[]).map(e=>{var t,s,l;return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tG?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:e.name||"wg"}),(0,n.jsx)("span",{className:(null===(t=e.systemd)||void 0===t?void 0:t.active)==="active"?"text-emerald-400":"text-amber-300",children:(null===(s=e.systemd)||void 0===s?void 0:s.active)||"active"})]}),(0,n.jsx)("p",{className:"mt-1 font-mono text-[11px]",children:(e.addresses||[]).join(", ")||"—"}),(0,n.jsxs)("p",{className:"mt-1 text-[11px] ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:[e.details_available?nx("运行细节可读","Runtime details readable"):nx("运行细节受限","Runtime details limited"),(null===(l=e.configured_from)||void 0===l?void 0:l.name)?" \xb7 ".concat(nx("配置","Config"),": ").concat(e.configured_from.name):""]})]},e.name||"wg")}):(0,n.jsx)("p",{className:"text-xs ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("未发现 wg show 输出","No wg show output")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("对端与流量","Peer and traffic")}),(()=>{var e;let t=(null==nz?void 0:nz.status_source)==="wg"?nx("运行态","Runtime"):(null==nz?void 0:nz.config_source)==="system"?nx("系统配置","System config"):(null==nz?void 0:nz.config_source)==="repo"?nx("受管配置","Managed config"):nx("配置态","Config");return nz?(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===tG?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Source: ",t]}),(0,n.jsxs)("p",{children:["Endpoint: ",nz.endpoint||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",(nz.allowed_ips||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Handshake:"," ","config"===nz.status_source?nx("运行态需 root/CAP_NET_ADMIN","Runtime details need root/CAP_NET_ADMIN"):tT(nz.latest_handshake_age_seconds)]}),(0,n.jsxs)("p",{children:["RX/TX: ",tL(nz.transfer_rx_bytes)," / ",tL(nz.transfer_tx_bytes)]}),(0,n.jsxs)("p",{children:["Keepalive: ",null!==(e=nz.persistent_keepalive)&&void 0!==e?e:"—"]})]}):(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("暂无 peer 数据","No peer data yet")})})(),((null==sR?void 0:sR.endpoint_routes)||[]).length?(0,n.jsx)("div",{className:"mt-3 space-y-1 rounded-lg border px-3 py-2 font-mono text-[10px] ".concat("light"===tG?"border-slate-200 bg-white text-slate-600":"border-white/10 bg-zinc-950/60 text-zinc-400"),children:((null==sR?void 0:sR.endpoint_routes)||[]).slice(0,2).map(e=>(0,n.jsxs)("p",{className:e.uses_wireguard_interface?"text-amber-300":"",children:["route ",e.host||"endpoint",": ",e.route||(e.ok?"ok":"unavailable")]},e.host||e.route||"endpoint-route"))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("Neko 访问模式","Neko access mode")}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 rounded-lg p-1 text-xs font-semibold ".concat("light"===tG?"bg-slate-200/70":"bg-black/40"),children:["lan","remote"].map(e=>{var t,s;let l=((null==sR?void 0:null===(t=sR.neko_access)||void 0===t?void 0:t.mode)||"lan")===e,i=(null==t6?void 0:t6.startsWith("wg:neko"))||"remote"===e&&!(null==sR?void 0:null===(s=sR.neko_access)||void 0===s?void 0:s.remote_ready);return(0,n.jsx)("button",{onClick:()=>void nM(e),disabled:i,className:"rounded-md px-2.5 py-1.5 transition disabled:opacity-40 ".concat(l?"light"===tG?"bg-white text-cyan-800 shadow-sm":"bg-cyan-500/25 text-cyan-100 ring-1 ring-cyan-400/25":"light"===tG?"text-slate-600 hover:bg-white/60":"text-zinc-300 hover:bg-white/10"),children:"lan"===e?nx("局域网","LAN"):nx("远控","Remote")},e)})}),(0,n.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[11px] ".concat("light"===tG?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["NAT1TO1: ",(null==sR?void 0:null===(eV=sR.neko_access)||void 0===eV?void 0:eV.nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["LAN: ",(null==sR?void 0:null===(e$=sR.neko_access)||void 0===e$?void 0:e$.lan_host)||"-"]}),(0,n.jsxs)("p",{children:["WG: ",(null==sR?void 0:null===(eX=sR.neko_access)||void 0===eX?void 0:eX.wireguard_host)||"-"]}),(0,n.jsxs)("p",{children:["Target: ",(null==sR?void 0:null===(eQ=sR.neko_access)||void 0===eQ?void 0:eQ.target_nat1to1)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==sR?void 0:null===(e0=sR.shellcrash)||void 0===e0?void 0:e0.running)?"running:".concat((null==sR?void 0:null===(e1=sR.shellcrash)||void 0===e1?void 0:e1.mixed_port)||"7890"):"stopped"]})]}),((null==sR?void 0:null===(e5=sR.neko_access)||void 0===e5?void 0:e5.remote_urls)||[]).length?(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==sR?void 0:null===(e2=sR.neko_access)||void 0===e2?void 0:e2.remote_urls)||[]).slice(0,4).map(e=>(0,n.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"rounded-lg px-2.5 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===tG?"bg-white text-cyan-800 ring-cyan-100 hover:bg-cyan-50":"bg-cyan-500/10 text-cyan-100 ring-cyan-400/20 hover:bg-cyan-500/15"),children:["Neko ",e.id||1," \xb7 ",e.kind||"remote"]},"".concat(e.kind||"remote","-").concat(e.id||0,"-").concat(e.url||"")))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:"Google / Douyin"}),(0,n.jsx)("div",{className:"mt-2 space-y-2",children:["google","youtube","douyin"].map(e=>{let t=((null==sT?void 0:sT.direct)||[]).find(t=>t.target===e),s=!!(null==t?void 0:t.ok),l=!t,i=sE&&l,a=(null==t?void 0:t.label)||("google"===e?"Google":"youtube"===e?"YouTube":"Douyin");return(0,n.jsxs)("div",{className:"rounded-lg border px-3 py-2 text-xs ".concat("light"===tG?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-zinc-950/60 text-zinc-200"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:a}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat(i?"bg-cyan-500/15 text-cyan-100 ring-1 ring-cyan-500/25":l?"bg-zinc-500/15 text-zinc-300 ring-1 ring-zinc-500/25":s?"bg-emerald-500/15 text-emerald-200 ring-1 ring-emerald-500/25":"bg-rose-500/15 text-rose-200 ring-1 ring-rose-500/25"),children:[i?(0,n.jsx)(y.Z,{className:"h-3 w-3 animate-spin"}):null,i?nx("探测中","Probing"):l?nx("等待结果","Waiting"):s?"OK":"FAIL"]})]}),(0,n.jsxs)("p",{className:"mt-1 font-mono text-[10px] ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:[(null==t?void 0:t.elapsed_ms)!=null?"".concat(t.elapsed_ms," ms"):i?nx("正在连接 ".concat(a,"..."),"Connecting ".concat(a,"...")):nx("等待探测结果","Waiting for probe result"),(null==t?void 0:t.status)?" \xb7 HTTP ".concat(t.status):""]}),!s&&(null==t?void 0:t.error)?(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-[10px] text-amber-200/80",children:t.error}):null]},e)})}),(0,n.jsxs)("div",{className:"mt-3 space-y-1 font-mono text-[11px] ".concat("light"===tG?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Mode: ",sE?nx("正在探测直连链路与代理链路","Probing direct/proxy paths"):(null==sT?void 0:sT.mode)||"-"]}),(0,n.jsxs)("p",{children:["ShellCrash: ",(null==sT?void 0:null===(e3=sT.shellcrash)||void 0===e3?void 0:e3.running)?"running:".concat((null==sT?void 0:null===(e4=sT.shellcrash)||void 0===e4?void 0:e4.mixed_port)||"7890"):"manual/stopped"]}),(0,n.jsxs)("p",{children:["Autostart: ",(null==sT?void 0:null===(e6=sT.shellcrash_policy)||void 0===e6?void 0:e6.autostart_on_direct_fail)?"on direct fail":"off"]}),(0,n.jsxs)("p",{children:["Neko attach: ",(null==sT?void 0:null===(e8=sT.shellcrash_policy)||void 0===e8?void 0:e8.attach_neko)||"auto"]})]}),sE?(0,n.jsxs)("p",{className:"mt-3 inline-flex items-center gap-2 text-xs ".concat("light"===tG?"text-cyan-700":"text-cyan-200"),children:[(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}),nx("正在探测 Google / YouTube / Douyin,请等待结果返回。","Probing Google / YouTube / Douyin. Waiting for results.")]}):(null==sT?void 0:sT.summary)?(0,n.jsx)("p",{className:"mt-3 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-500"),children:sT.summary}):null]})]}),(null==sR?void 0:null===(e9=sR.recommendations)||void 0===e9?void 0:e9.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===tG?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-400/20 bg-amber-500/10 text-amber-100"),children:(sR.recommendations||[]).join(" \xb7 ")}):null,(null==sR?void 0:null===(te=sR.quality)||void 0===te?void 0:null===(e7=te.reasons)||void 0===e7?void 0:e7.length)?(0,n.jsx)("div",{className:"mt-3 rounded-xl border px-4 py-3 text-xs ".concat("light"===tG?"border-slate-200 bg-white text-slate-700":"border-white/10 bg-black/25 text-zinc-300"),children:(sR.quality.reasons||[]).slice(0,4).join(" \xb7 ")}):null,(0,n.jsxs)("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("配置名","Config name")}),(0,n.jsx)("input",{value:sk,onChange:e=>s_(e.target.value),className:"mt-1 w-full rounded-lg border px-3 py-2 text-sm outline-none ".concat("light"===tG?"border-slate-200 bg-white text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/30 text-zinc-100 focus:border-cyan-400/60")})]}),(0,n.jsxs)("label",{className:"block",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("配置文件","Config file")}),(0,n.jsx)("input",{type:"file",accept:".conf,.txt,text/plain",onChange:e=>{var t;nI(null===(t=e.target.files)||void 0===t?void 0:t[0])},className:"mt-1 w-full rounded-lg border px-3 py-2 text-xs file:mr-3 file:rounded-md file:border-0 file:px-3 file:py-1.5 file:text-xs file:font-semibold ".concat("light"===tG?"border-slate-200 bg-white text-slate-700 file:bg-cyan-50 file:text-cyan-800":"border-white/10 bg-black/30 text-zinc-300 file:bg-cyan-500/15 file:text-cyan-100")})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border px-3 py-2 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/25"),children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("保存模式","Save mode")}),["overlay","preserve"].map(e=>(0,n.jsx)("button",{onClick:()=>sD(e),className:"rounded-md px-2.5 py-1 text-[11px] font-semibold transition ".concat(sA===e?"bg-cyan-500/20 text-cyan-100 ring-1 ring-cyan-400/30":"light"===tG?"bg-white text-slate-600 ring-1 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-300 ring-1 ring-white/10 hover:bg-white/10"),children:"overlay"===e?nx("组网不接管默认路由","Overlay only"):nx("保留原路由","Preserve routes")},e)),(0,n.jsx)("button",{onClick:()=>sZ(e=>!e),className:"ml-auto inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs font-semibold ring-1 transition ".concat("light"===tG?"bg-white text-slate-700 ring-slate-200 hover:bg-slate-50":"bg-white/5 text-zinc-100 ring-white/10 hover:bg-white/10"),children:sI?nx("锁定","Lock"):nx("编辑","Edit")}),(0,n.jsxs)("button",{onClick:()=>void nT(!1),disabled:"wg:save"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-1.5 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("保存","Save")]}),(0,n.jsxs)("button",{onClick:()=>void nT(!0),disabled:"wg:apply"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-1.5 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:["wg:apply"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(o.Z,{className:"h-3.5 w-3.5"}),nx("保存并应用","Save & apply")]})]}),(0,n.jsx)("textarea",{value:sz,onChange:e=>sS(e.target.value),readOnly:!sI,spellCheck:!1,placeholder:"[Interface] Address = 10.88.0.6/32 PrivateKey = ... [Peer] Endpoint = 129.204.21.129:51820 AllowedIPs = 10.88.0.0/24",className:"min-h-56 w-full resize-y rounded-xl border p-3 font-mono text-xs leading-relaxed outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900 focus:border-cyan-400":"border-white/10 bg-black/40 text-zinc-100 focus:border-cyan-400/60"," ").concat(sI?"":"opacity-75")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{onClick:()=>void nE(),disabled:"wg:save"===t6,className:"inline-flex items-center gap-2 rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-semibold text-cyan-100 ring-1 ring-cyan-400/30 transition hover:bg-cyan-500/30 disabled:opacity-40",children:["wg:save"===t6?(0,n.jsx)(y.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(E.Z,{className:"h-3.5 w-3.5"}),nx("解析并保存","Parse & save")]}),(null==sC?void 0:sC.redacted_config)?(0,n.jsxs)("button",{onClick:()=>nq(sC.redacted_config||""),className:"inline-flex items-center gap-2 rounded-lg bg-zinc-500/15 px-3 py-2 text-xs font-semibold text-zinc-100 ring-1 ring-white/10 transition hover:bg-zinc-500/25",children:[(0,n.jsx)(U.Z,{className:"h-3.5 w-3.5"}),nx("复制脱敏配置","Copy redacted")]}):null]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-slate-50":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:nx("解析结果","Parsed config")}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold ".concat("light"===tG?"bg-cyan-100 text-cyan-800":"bg-cyan-500/15 text-cyan-200"),children:[null!==(tW=null==sC?void 0:sC.peer_count)&&void 0!==tW?tW:0," peers"]})]}),(0,n.jsxs)("div",{className:"mt-3 space-y-2 font-mono text-[11px] ".concat("light"===tG?"text-slate-700":"text-zinc-300"),children:[(0,n.jsxs)("p",{children:["Address: ",((null==sC?void 0:null===(tt=sC.interface)||void 0===tt?void 0:tt.addresses)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["Endpoint: ",(null==sC?void 0:null===(tn=sC.peers)||void 0===tn?void 0:null===(ts=tn[0])||void 0===ts?void 0:ts.endpoint)||"—"]}),(0,n.jsxs)("p",{children:["AllowedIPs: ",((null==sC?void 0:null===(ti=sC.peers)||void 0===ti?void 0:null===(tl=ti[0])||void 0===tl?void 0:tl.allowed_ips)||[]).join(", ")||"—"]}),(0,n.jsxs)("p",{children:["MTU: ",null!==(tK=null==sC?void 0:null===(ta=sC.interface)||void 0===ta?void 0:ta.mtu)&&void 0!==tK?tK:"—"]})]}),(null==sC?void 0:null===(tr=sC.warnings)||void 0===tr?void 0:tr.length)?(0,n.jsx)("ul",{className:"mt-3 space-y-1 text-[11px] ".concat("light"===tG?"text-amber-700":"text-amber-200"),children:sC.warnings.map(e=>(0,n.jsx)("li",{children:e},e))}):null]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsx)("p",{className:"text-xs font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:nx("已保存配置","Saved configs")}),(0,n.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:((null==sR?void 0:sR.repo_configs)||[]).length?((null==sR?void 0:sR.repo_configs)||[]).map(e=>(0,n.jsx)("button",{onClick:()=>void nU(e.name),className:"rounded-lg px-3 py-1.5 text-[11px] font-semibold ring-1 transition ".concat("light"===tG?"bg-slate-50 text-slate-700 ring-slate-200 hover:bg-slate-100":"bg-white/5 text-zinc-200 ring-white/10 hover:bg-white/10"),children:e.name||e.relative_path},e.name||e.relative_path||"wireguard-config")):(0,n.jsx)("span",{className:"text-[11px] ".concat("light"===tG?"text-slate-500":"text-zinc-500"),children:nx("暂无受管配置","No managed configs")})})]}),(0,n.jsxs)("div",{className:"rounded-xl border p-4 ".concat("light"===tG?"border-slate-200 bg-white":"border-white/10 bg-black/30"),children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-xs font-semibold ".concat("light"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(I.Z,{className:"h-3.5 w-3.5"}),nx("Windows 端点路由","Windows endpoint route")]}),(0,n.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-1",children:[(0,n.jsx)("input",{value:sO,onChange:e=>sB(e.target.value),placeholder:nx("网关,如 192.168.2.1","Gateway, e.g. 192.168.2.1"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")}),(0,n.jsx)("input",{value:sH,onChange:e=>sW(e.target.value),placeholder:nx("接口 ifIndex,如 21","Interface ifIndex, e.g. 21"),className:"rounded-lg border px-3 py-2 text-xs outline-none ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-900":"border-white/10 bg-black/35 text-zinc-100")})]}),(0,n.jsx)("code",{className:"mt-3 block break-all rounded-lg border p-3 text-[11px] ".concat("light"===tG?"border-slate-200 bg-slate-50 text-slate-800":"border-white/10 bg-black/40 text-zinc-200"),children:nP||"route -p add mask 255.255.255.255 metric 1 if "}),(0,n.jsxs)("button",{onClick:()=>nq(nP),disabled:!nP,className:"mt-3 inline-flex items-center gap-2 rounded-lg bg-emerald-500/15 px-3 py-2 text-xs font-semibold text-emerald-100 ring-1 ring-emerald-400/25 transition hover:bg-emerald-500/25 disabled:opacity-40",children:[(0,n.jsx)(U.Z,{className:"h-3.5 w-3.5"}),nx("复制命令","Copy command")]})]})]})]})]}),(0,n.jsxs)("div",{className:"rounded-2xl border p-6 ".concat("light"===tG?"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"===tG?"text-slate-900":"text-white"),children:[(0,n.jsx)(_.Z,{className:"h-4 w-4 ".concat("light"===tG?"text-violet-600":"text-violet-300")}),nx("ShellCrash 网络面板","ShellCrash panel")]}),(0,n.jsx)("p",{className:"mt-2 text-xs ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("透明代理与规则分流直接在本页完成,无需跳转;流媒体与其它系统服务请在「服务」页管理。","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:nx("互联网","Internet"),c:"from-cyan-400 to-blue-500"},{tx:"ShellCrash",c:"from-violet-500 to-fuchsia-500"},{tx:nx("本机 / 安卓","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)(p.Z,{className:"hidden h-5 w-5 sm:block ".concat("light"===tG?"text-slate-400":"text-zinc-600")}):null]},e.tx))})]}),(0,n.jsx)("div",{className:"overflow-hidden rounded-2xl border shadow-xl ".concat("light"===tG?"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)(B.d,{embeddedShellCrash:!0,portalLang:tY})})})]}):null,"settings"===tV?(0,n.jsxs)("div",{className:"mx-auto max-w-lg space-y-6",children:[(0,n.jsx)("p",{className:"text-sm ".concat("light"===tG?"text-slate-600":"text-zinc-400"),children:nx("常用选项(本机偏好);完整文件与 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:nx("总览自动刷新","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:sy,onChange:e=>{let t=e.target.checked;sw(t);try{localStorage.setItem("livehub.autorefresh",t?"1":"0")}catch(e){}nu(t?nx("已开启刷新","Auto refresh on"):nx("已暂停刷新","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:nx("总览显示 SRS / Neko 探针","Show SRS/Neko probes")}),(0,n.jsx)("p",{className:"text-[11px] text-zinc-500",children:nx("关闭可精简首页","Hide stream probe cards")})]}),(0,n.jsx)("input",{type:"checkbox",className:"h-5 w-5 accent-violet-500",checked:sj,onChange:e=>{let t=e.target.checked;sN(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:nx("配置快照","Config snapshot")}),(0,n.jsx)("p",{className:"mt-2 font-mono text-[11px] text-zinc-400",children:String((null==sb?void 0:sb.config_root)||"—")}),(0,n.jsxs)("p",{className:"mt-3 text-sm text-zinc-300",children:[nx("主机名","Hostname"),":"," ",(0,n.jsx)("span",{className:"font-mono text-violet-200",children:(()=>{var e,t,s;let n=null==sb?void 0:sb.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==t0?void 0:null===(s=t0.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==sb?void 0:null===(to=sb.services)||void 0===to?void 0:to.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"===tG?"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:[nx("完整配置中心(文件 / JSON)","Full config center (files / JSON)"),(0,n.jsx)(C.Z,{className:"h-4 w-4"})]})]}):null]},tV)})})]})]}),(0,n.jsx)(i.M,{children:tX?(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:()=>tQ(!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:()=>tQ(!1),className:"rounded-lg p-2",children:(0,n.jsx)(Z.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("nav",{className:"mt-4 flex flex-col gap-1",children:nG.map(e=>{let t=e.icon,s=tV===e.id;return(0,n.jsxs)("button",{type:"button",onClick:()=>{t$(e.id),tQ(!1)},"aria-current":s?"page":void 0,className:"flex items-center gap-3 rounded-xl px-3 py-3 text-left text-sm transition ".concat(s?"bg-white/[0.08] text-white shadow-inner shadow-white/5":"text-zinc-300 hover:bg-white/[0.04]"),children:[(0,n.jsx)(t,{className:"h-4 w-4 ".concat(s?"text-violet-300":"text-violet-400")}),nx(e.labelZh,e.labelEn)]},e.id)})})]})}):null})]})}}}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/android/page-69ff6e74a15b80d9.js b/d2ypp2/web-console/out/_next/static/chunks/app/android/page-5f87422c86e34807.js similarity index 54% rename from d2ypp2/web-console/out/_next/static/chunks/app/android/page-69ff6e74a15b80d9.js rename to d2ypp2/web-console/out/_next/static/chunks/app/android/page-5f87422c86e34807.js index 9294e09..3a99d74 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/android/page-69ff6e74a15b80d9.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/android/page-5f87422c86e34807.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[357],{2849:function(n,u,e){Promise.resolve().then(e.bind(e,3946))},3946:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=2849)}),_N_E=n.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[357],{4579:function(n,u,e){Promise.resolve().then(e.bind(e,3946))},3946:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=4579)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/console/page-db00fd3a990c6a05.js b/d2ypp2/web-console/out/_next/static/chunks/app/console/page-f5a0052a001f3016.js similarity index 54% rename from d2ypp2/web-console/out/_next/static/chunks/app/console/page-db00fd3a990c6a05.js rename to d2ypp2/web-console/out/_next/static/chunks/app/console/page-f5a0052a001f3016.js index af7c4bb..2625df2 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/console/page-db00fd3a990c6a05.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/console/page-f5a0052a001f3016.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[443],{2820:function(n,u,e){Promise.resolve().then(e.bind(e,6367))},6367:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=2820)}),_N_E=n.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[443],{6493:function(n,u,e){Promise.resolve().then(e.bind(e,6367))},6367:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=6493)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/layout-d9acbcf8f9ab58b1.js b/d2ypp2/web-console/out/_next/static/chunks/app/layout-5e9a25e086663e5e.js similarity index 69% rename from d2ypp2/web-console/out/_next/static/chunks/app/layout-d9acbcf8f9ab58b1.js rename to d2ypp2/web-console/out/_next/static/chunks/app/layout-5e9a25e086663e5e.js index 9875ffc..8640895 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/layout-d9acbcf8f9ab58b1.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/layout-5e9a25e086663e5e.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{8422:function(e,a,_){Promise.resolve().then(_.t.bind(_,1511,23)),Promise.resolve().then(_.t.bind(_,2221,23)),Promise.resolve().then(_.t.bind(_,7960,23))},7960:function(){},2221:function(e){e.exports={style:{fontFamily:"'__geistMono_c3aa02', '__geistMono_Fallback_c3aa02'"},className:"__className_c3aa02",variable:"__variable_c3aa02"}},1511:function(e){e.exports={style:{fontFamily:"'__geistSans_1e4310', '__geistSans_Fallback_1e4310'"},className:"__className_1e4310",variable:"__variable_1e4310"}}},function(e){e.O(0,[776,971,117,744],function(){return e(e.s=8422)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{2484:function(e,a,_){Promise.resolve().then(_.t.bind(_,1511,23)),Promise.resolve().then(_.t.bind(_,2221,23)),Promise.resolve().then(_.t.bind(_,7960,23))},7960:function(){},2221:function(e){e.exports={style:{fontFamily:"'__geistMono_c3aa02', '__geistMono_Fallback_c3aa02'"},className:"__className_c3aa02",variable:"__variable_c3aa02"}},1511:function(e){e.exports={style:{fontFamily:"'__geistSans_1e4310', '__geistSans_Fallback_1e4310'"},className:"__className_1e4310",variable:"__variable_1e4310"}}},function(e){e.O(0,[776,971,117,744],function(){return e(e.s=2484)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/page-505467ca9505824f.js b/d2ypp2/web-console/out/_next/static/chunks/app/page-505467ca9505824f.js deleted file mode 100644 index 0ba10dc..0000000 --- a/d2ypp2/web-console/out/_next/static/chunks/app/page-505467ca9505824f.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{5052:function(n,e,u){Promise.resolve().then(u.bind(u,7340))},7340:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(7644)}},function(n){n.O(0,[500,166,246,644,971,117,744],function(){return n(n.s=5052)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/page-58e06160be396c5b.js b/d2ypp2/web-console/out/_next/static/chunks/app/page-58e06160be396c5b.js new file mode 100644 index 0000000..c89d9f7 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/chunks/app/page-58e06160be396c5b.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{2195:function(n,e,u){Promise.resolve().then(u.bind(u,7340))},7340:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(7644)}},function(n){n.O(0,[500,166,246,644,971,117,744],function(){return n(n.s=2195)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-766863ba520c08ee.js b/d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-0c73522b1d5c8dc1.js similarity index 54% rename from d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-766863ba520c08ee.js rename to d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-0c73522b1d5c8dc1.js index 1f2faa2..de7a78c 100644 --- a/d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-766863ba520c08ee.js +++ b/d2ypp2/web-console/out/_next/static/chunks/app/shellcrash/page-0c73522b1d5c8dc1.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6],{7564:function(n,u,e){Promise.resolve().then(e.bind(e,3398))},3398:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=7564)}),_N_E=n.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6],{3330:function(n,u,e){Promise.resolve().then(e.bind(e,3398))},3398:function(n,u,e){"use strict";e.r(u),e.d(u,{default:function(){return c}});var t=e(7437),r=e(2246);function c(){return(0,t.jsx)(r.d,{})}}},function(n){n.O(0,[500,246,971,117,744],function(){return n(n.s=3330)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-505c03a44db53360.js b/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-505c03a44db53360.js deleted file mode 100644 index 50488b7..0000000 --- a/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-505c03a44db53360.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[851],{2276:function(n,e,u){Promise.resolve().then(u.bind(u,316))},316:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(7644)}},function(n){n.O(0,[500,166,246,644,971,117,744],function(){return n(n.s=2276)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-de7151b95af37543.js b/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-de7151b95af37543.js new file mode 100644 index 0000000..17786d4 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/chunks/app/youtube-events/page-de7151b95af37543.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[851],{8797:function(n,e,u){Promise.resolve().then(u.bind(u,316))},316:function(n,e,u){"use strict";u.r(e),u.d(e,{default:function(){return t.Z}});var t=u(7644)}},function(n){n.O(0,[500,166,246,644,971,117,744],function(){return n(n.s=8797)}),_N_E=n.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/main-app-5ec094bd229d9247.js b/d2ypp2/web-console/out/_next/static/chunks/main-app-5ec094bd229d9247.js deleted file mode 100644 index 9c0c2d2..0000000 --- a/d2ypp2/web-console/out/_next/static/chunks/main-app-5ec094bd229d9247.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{5629:function(e,n,t){Promise.resolve().then(t.t.bind(t,2846,23)),Promise.resolve().then(t.t.bind(t,9107,23)),Promise.resolve().then(t.t.bind(t,1060,23)),Promise.resolve().then(t.t.bind(t,4707,23)),Promise.resolve().then(t.t.bind(t,80,23)),Promise.resolve().then(t.t.bind(t,6423,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[971,117],function(){return n(4278),n(5629)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/chunks/main-app-cac07468fa8c1d5f.js b/d2ypp2/web-console/out/_next/static/chunks/main-app-cac07468fa8c1d5f.js new file mode 100644 index 0000000..da73051 --- /dev/null +++ b/d2ypp2/web-console/out/_next/static/chunks/main-app-cac07468fa8c1d5f.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{396:function(e,n,t){Promise.resolve().then(t.t.bind(t,2846,23)),Promise.resolve().then(t.t.bind(t,9107,23)),Promise.resolve().then(t.t.bind(t,1060,23)),Promise.resolve().then(t.t.bind(t,4707,23)),Promise.resolve().then(t.t.bind(t,80,23)),Promise.resolve().then(t.t.bind(t,6423,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[971,117],function(){return n(4278),n(396)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/d2ypp2/web-console/out/_next/static/0T-XrNk19a9ZMkGFefL9K/_buildManifest.js b/d2ypp2/web-console/out/_next/static/qH1zlSt29jtuHZ9NIMYFr/_buildManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/0T-XrNk19a9ZMkGFefL9K/_buildManifest.js rename to d2ypp2/web-console/out/_next/static/qH1zlSt29jtuHZ9NIMYFr/_buildManifest.js diff --git a/d2ypp2/web-console/out/_next/static/0T-XrNk19a9ZMkGFefL9K/_ssgManifest.js b/d2ypp2/web-console/out/_next/static/qH1zlSt29jtuHZ9NIMYFr/_ssgManifest.js similarity index 100% rename from d2ypp2/web-console/out/_next/static/0T-XrNk19a9ZMkGFefL9K/_ssgManifest.js rename to d2ypp2/web-console/out/_next/static/qH1zlSt29jtuHZ9NIMYFr/_ssgManifest.js diff --git a/d2ypp2/web-console/out/android.html b/d2ypp2/web-console/out/android.html index 1f7fe1d..cdc754f 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 3c35308..b8430d7 100644 --- a/d2ypp2/web-console/out/android.txt +++ b/d2ypp2/web-console/out/android.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[3946,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","357","static/chunks/app/android/page-69ff6e74a15b80d9.js"],"default",1] +3:I[3946,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","357","static/chunks/app/android/page-5f87422c86e34807.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["0T-XrNk19a9ZMkGFefL9K",[[["",{"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/d69107dc7d1c5fad.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:["qH1zlSt29jtuHZ9NIMYFr",[[["",{"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/d69107dc7d1c5fad.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"}]] 1:null diff --git a/d2ypp2/web-console/out/console.html b/d2ypp2/web-console/out/console.html index 2a93d3a..47f6830 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 5edb19a..a75c5d3 100644 --- a/d2ypp2/web-console/out/console.txt +++ b/d2ypp2/web-console/out/console.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6367,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","443","static/chunks/app/console/page-db00fd3a990c6a05.js"],"default",1] +3:I[6367,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","443","static/chunks/app/console/page-f5a0052a001f3016.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["0T-XrNk19a9ZMkGFefL9K",[[["",{"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/d69107dc7d1c5fad.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:["qH1zlSt29jtuHZ9NIMYFr",[[["",{"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/d69107dc7d1c5fad.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"}]] 1:null diff --git a/d2ypp2/web-console/out/index.html b/d2ypp2/web-console/out/index.html index 75b810b..2d23c80 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 d9044e5..def28ac 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[7340,["500","static/chunks/500-ea37cc8de90441f7.js","166","static/chunks/166-6b01e1456a874782.js","246","static/chunks/246-a56380dcf5ea0340.js","644","static/chunks/644-fd6fe0f98d73fa51.js","931","static/chunks/app/page-505467ca9505824f.js"],"default",1] +3:I[7340,["500","static/chunks/500-ea37cc8de90441f7.js","166","static/chunks/166-6b01e1456a874782.js","246","static/chunks/246-a56380dcf5ea0340.js","644","static/chunks/644-b670e35fa0cddabc.js","931","static/chunks/app/page-58e06160be396c5b.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["0T-XrNk19a9ZMkGFefL9K",[[["",{"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/d69107dc7d1c5fad.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:["qH1zlSt29jtuHZ9NIMYFr",[[["",{"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/d69107dc7d1c5fad.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"}]] 1:null diff --git a/d2ypp2/web-console/out/shellcrash.html b/d2ypp2/web-console/out/shellcrash.html index 38436f0..f8756ee 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 11ee959..409863b 100644 --- a/d2ypp2/web-console/out/shellcrash.txt +++ b/d2ypp2/web-console/out/shellcrash.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[3398,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","6","static/chunks/app/shellcrash/page-766863ba520c08ee.js"],"default",1] +3:I[3398,["500","static/chunks/500-ea37cc8de90441f7.js","246","static/chunks/246-a56380dcf5ea0340.js","6","static/chunks/app/shellcrash/page-0c73522b1d5c8dc1.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["0T-XrNk19a9ZMkGFefL9K",[[["",{"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/d69107dc7d1c5fad.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:["qH1zlSt29jtuHZ9NIMYFr",[[["",{"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/d69107dc7d1c5fad.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"}]] 1:null diff --git a/d2ypp2/web-console/out/youtube-events.html b/d2ypp2/web-console/out/youtube-events.html index 3ce2b6c..ab83c76 100644 --- a/d2ypp2/web-console/out/youtube-events.html +++ b/d2ypp2/web-console/out/youtube-events.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/youtube-events.txt b/d2ypp2/web-console/out/youtube-events.txt index f2f57a4..bf53ea6 100644 --- a/d2ypp2/web-console/out/youtube-events.txt +++ b/d2ypp2/web-console/out/youtube-events.txt @@ -1,7 +1,7 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[316,["500","static/chunks/500-ea37cc8de90441f7.js","166","static/chunks/166-6b01e1456a874782.js","246","static/chunks/246-a56380dcf5ea0340.js","644","static/chunks/644-fd6fe0f98d73fa51.js","851","static/chunks/app/youtube-events/page-505c03a44db53360.js"],"default",1] +3:I[316,["500","static/chunks/500-ea37cc8de90441f7.js","166","static/chunks/166-6b01e1456a874782.js","246","static/chunks/246-a56380dcf5ea0340.js","644","static/chunks/644-b670e35fa0cddabc.js","851","static/chunks/app/youtube-events/page-de7151b95af37543.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -0:["0T-XrNk19a9ZMkGFefL9K",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","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/d69107dc7d1c5fad.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:["qH1zlSt29jtuHZ9NIMYFr",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","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/d69107dc7d1c5fad.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"}]] 1:null diff --git a/d2ypp2/web-console/package-lock.json b/d2ypp2/web-console/package-lock.json index bbfe682..86e14b7 100644 --- a/d2ypp2/web-console/package-lock.json +++ b/d2ypp2/web-console/package-lock.json @@ -26,6 +26,9 @@ "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" + }, + "engines": { + "node": ">=18.18" } }, "node_modules/@alloc/quick-lru": { diff --git a/d2ypp2/web.py b/d2ypp2/web.py index 3b4cdb4..c677859 100644 --- a/d2ypp2/web.py +++ b/d2ypp2/web.py @@ -352,6 +352,31 @@ def _sync_youtube_pro_runtime_files(process: str) -> list[str]: return errors +def _youtube_pro_channel_for_process(process: str) -> dict[str, Any] | None: + target = (process or "").strip() + if not target: + return None + for channel in get_youtube_pro_channels(): + if not isinstance(channel, dict): + continue + if channel_pm2_name(channel) == target: + return dict(channel) + return None + +def _missing_managed_file_notice(rel: str) -> str: + return f"# {rel} has not been created yet; save to write it to disk.\n" + + +def _youtube_ini_content_from_channel(channel: dict[str, Any] | None) -> str: + if not channel: + return "" + key = str(channel.get("streamKey") or "").strip() + if not key: + return "" + rtmps = "0" if key.lower().startswith("rtmp://") else "1" + return f"[youtube]\nkey = {key}\nrtmps = {rtmps}\nfast_audio = 1\n" + + def _normalize_textarea_content(text: str) -> str: return (text or "").replace("\r\n", "\n").replace("\r", "\n").lstrip("\ufeff") @@ -1501,16 +1526,19 @@ async def get_config(request: Request, process: str = Query(..., description=" config_file = CONFIG_DIR / rel if not config_file.is_file(): - sync_errors = _sync_youtube_pro_runtime_files(process) - if sync_errors: - return JSONResponse({"error": "; ".join(sync_errors)}, status_code=400) + channel = _youtube_pro_channel_for_process(process) + channel_content = _youtube_ini_content_from_channel(channel) + if channel_content: + return JSONResponse({"content": channel_content}, headers=_NO_STORE_HEADERS) + if channel and channel_pm2_name(channel) != "youtube": + return JSONResponse({"content": _missing_managed_file_notice(rel)}, headers=_NO_STORE_HEADERS) legacy = CONFIG_DIR / "youtube.ini" if legacy.is_file(): try: return JSONResponse({"content": legacy.read_text(encoding="utf-8")}, headers=_NO_STORE_HEADERS) except OSError as e: return JSONResponse({"error": f"读取失败: {str(e)}"}, status_code=500) - return JSONResponse({"content": f"# {rel} 尚未创建,保存后将写入磁盘\n"}, headers=_NO_STORE_HEADERS) + return JSONResponse({"content": _missing_managed_file_notice(rel)}, headers=_NO_STORE_HEADERS) try: content = config_file.read_text(encoding="utf-8") return JSONResponse({"content": content}, headers=_NO_STORE_HEADERS) @@ -1557,16 +1585,19 @@ async def get_url_config(request: Request, process: str = Query(..., description rel = managed_url_config_relpath(process) config_file = CONFIG_DIR / rel if not config_file.is_file(): - sync_errors = _sync_youtube_pro_runtime_files(process) - if sync_errors: - return JSONResponse({"error": "; ".join(sync_errors)}, status_code=400) + channel = _youtube_pro_channel_for_process(process) + channel_content = _normalize_textarea_content(str(channel.get("urlLines") or "")) if channel else "" + if channel_content.strip(): + return JSONResponse({"content": channel_content}, headers=_NO_STORE_HEADERS) + if channel and channel_pm2_name(channel) != "youtube": + return JSONResponse({"content": _missing_managed_file_notice(rel)}, headers=_NO_STORE_HEADERS) legacy = CONFIG_DIR / "URL_config.ini" if legacy.is_file(): try: return JSONResponse({"content": legacy.read_text(encoding="utf-8")}, headers=_NO_STORE_HEADERS) except OSError as e: return JSONResponse({"error": f"读取失败: {str(e)}"}, status_code=500) - return JSONResponse({"content": f"# {rel} 尚未创建,保存后将写入磁盘\n"}, headers=_NO_STORE_HEADERS) + return JSONResponse({"content": _missing_managed_file_notice(rel)}, headers=_NO_STORE_HEADERS) try: content = config_file.read_text(encoding="utf-8") return JSONResponse({"content": content}, headers=_NO_STORE_HEADERS)