agentroam-runtime-darwin-arm64 0.2.0-preview.81 → 0.2.0-preview.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +8 -8
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +5 -5
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/composer/route.js +1 -0
- package/runtime/.next/server/app/api/agent/composer/route.js.nft.json +1 -0
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +1 -1
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/calendar/route.js +2 -2
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/collaboration/route.js +2 -2
- package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
- package/runtime/.next/server/app/api/engine-threads.body +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers.body +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/messaging/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid.body +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/session-views/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
- package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/todos/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +4 -4
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +34 -33
- package/runtime/.next/server/chunks/1298.js +1 -1
- package/runtime/.next/server/chunks/5303.js +2 -2
- package/runtime/.next/server/chunks/5801.js +1 -1
- package/runtime/.next/server/chunks/6703.js +1 -1
- package/runtime/.next/server/chunks/9119.js +3 -3
- package/runtime/.next/server/chunks/9457.js +1 -1
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/app/web/error-828d278147a0619d.js +1 -0
- package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +1 -0
- package/runtime/.next/static/chunks/app/web/{page-b0da5ef19349a66b.js → page-f008ab6dfeab7ce7.js} +1 -1
- package/runtime/.next/static/chunks/{main-68faabab5d101471.js → main-9c08f7656f9692e6.js} +1 -1
- package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
- package/runtime/lib/remote-control/application/paced-video-sender.mjs +20 -1
- package/runtime/lib/remote-control/application/remote-video-session.mjs +18 -4
- package/runtime/lib/remote-control/infrastructure/native-video-encoder.mjs +15 -2
- package/runtime/lib/remote-control/infrastructure/werift-video-transport.mjs +3 -1
- package/runtime/lib/remote-control/remote-authorization.mjs +2 -2
- package/runtime/lib/remote-control/remote-video-signal.mjs +2 -0
- package/runtime/lib/todo-completion-worker.mjs +45 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/node_modules/.package-lock.json +129 -129
- package/runtime/node_modules/@agent/core/dist/index.js +286 -68
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +444 -127
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -79
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -52
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2g5j09ba.mjs +16 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-q4cwy1ja.mjs → core-664d5mmy.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zn1abzvs.mjs → core-70sfhqm6.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-kvdt1szx.mjs +18 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x6bt758j.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -23
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +84 -83
- package/runtime/node_modules/caniuse-lite/package.json +1 -1
- package/runtime/node_modules/mediabunny/README.md +4 -0
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +11 -11
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +12 -12
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +185 -127
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.worker.js +8 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js +4 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/aes.js +6 -4
- package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-demuxer.js +6 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-segmented-input.js +17 -5
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +2 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +34 -18
- package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +3 -8
- package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +5 -12
- package/runtime/node_modules/mediabunny/dist/modules/src/misc.js +19 -5
- package/runtime/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js +4 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -13
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
- package/runtime/node_modules/mediabunny/dist/modules/src/segmented-input.js +70 -65
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/worker.js +26 -0
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/adts/adts-demuxer.ts +5 -0
- package/runtime/node_modules/mediabunny/src/aes.ts +7 -4
- package/runtime/node_modules/mediabunny/src/hls/hls-demuxer.ts +7 -0
- package/runtime/node_modules/mediabunny/src/hls/hls-segmented-input.ts +19 -6
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +2 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +15 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +37 -19
- package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
- package/runtime/node_modules/mediabunny/src/media-sink.ts +3 -12
- package/runtime/node_modules/mediabunny/src/media-source.ts +5 -20
- package/runtime/node_modules/mediabunny/src/misc.ts +26 -5
- package/runtime/node_modules/mediabunny/src/mp3/mp3-demuxer.ts +5 -0
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +30 -19
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
- package/runtime/node_modules/mediabunny/src/segmented-input.ts +76 -79
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/node_modules/mediabunny/src/worker.ts +28 -0
- package/runtime/package-lock.json +162 -162
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/AIHubView-CNKanNZa.js +1 -0
- package/runtime/webapp/dist/assets/{AgentManager-dXI31b0a.js → AgentManager-B8TTqJaL.js} +2 -2
- package/runtime/webapp/dist/assets/AiHubPane-Coyn3P-J.js +1 -0
- package/runtime/webapp/dist/assets/App-BGIGpBp3.js +68 -0
- package/runtime/webapp/dist/assets/BrowserLivePanel-DnzJOz5w.js +61 -0
- package/runtime/webapp/dist/assets/CalendarPage-D0oaq2_l.js +1 -0
- package/runtime/webapp/dist/assets/{CalendarView-QfbrlL9X.js → CalendarView-QXZbXnXA.js} +3 -3
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-CE8OML-A.js +1 -0
- package/runtime/webapp/dist/assets/CollaborationDashboard-CV18iiBO.js +1 -0
- package/runtime/webapp/dist/assets/{CollaborationPage-B1tiqgnG.js → CollaborationPage-B2mIAc-h.js} +2 -2
- package/runtime/webapp/dist/assets/{FilePreview-CPY6dP8Q.js → FilePreview-BCEiERA1.js} +9 -9
- package/runtime/webapp/dist/assets/{FileTree-BBgrOian.js → FileTree-CMbs1Gj3.js} +2 -2
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BxFS-0sF.js +1 -0
- package/runtime/webapp/dist/assets/FlowStudioPane-CVP0Q6zR.js +5 -0
- package/runtime/webapp/dist/assets/HostProjectPicker-DUUgM2Cm.js +1 -0
- package/runtime/webapp/dist/assets/{LSPServerList-B-R7HDSP.js → LSPServerList-COMVmsvb.js} +1 -1
- package/runtime/webapp/dist/assets/{MCPServerList-CTc0iAwT.js → MCPServerList-C_juD6B4.js} +1 -1
- package/runtime/webapp/dist/assets/{MemoryViewer-Dzh_miRv.js → MemoryViewer-Et2vysSN.js} +1 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-DwJhkRJd.js +1 -0
- package/runtime/webapp/dist/assets/RemoteDesktopPage-Cqsea4X7.js +1 -0
- package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-BA_HQv3V.js → RemoteDesktopTabBridge-BFzNwpUn.js} +1 -1
- package/runtime/webapp/dist/assets/{RunningSessionsIcon-BvFSI9OF.js → RunningSessionsIcon-D_cOqmmk.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboard-DcPPoXe2.js → SessionDashboard-yjdEKypJ.js} +2 -2
- package/runtime/webapp/dist/assets/{SessionDashboardBridge-CjoeUy-v.js → SessionDashboardBridge-Kc_1Et9r.js} +1 -1
- package/runtime/webapp/dist/assets/{SettingsPanel-DmdXDQUm.js → SettingsPanel-t26XhKHP.js} +2 -2
- package/runtime/webapp/dist/assets/{SkillManager-CS_skFZj.js → SkillManager-nZU7b1sc.js} +1 -1
- package/runtime/webapp/dist/assets/{TaskPaneTerminal-BFHDRCb9.js → TaskPaneTerminal-BPaCKman.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-Dr_nY9pI.js → TerminalPane-CiIpI1Id.js} +1 -1
- package/runtime/webapp/dist/assets/TodoPage-CG__S6_l.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-FEEApB15.js → abnfDiagram-VCTEODGH-DmKjGVfG.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-CycwMc2c.js → arc-D6bpvBke.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BFq9JapX.js → architectureDiagram-5GKGNRK7-NEKc2BYf.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DkOJ55Ag.js → blockDiagram-I7D4REHJ-V6G00twZ.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CRvi_3RM.js → c4Diagram-7LVT6UL2-CojA33V5.js} +1 -1
- package/runtime/webapp/dist/assets/{calendar-days-CLwKstxM.js → calendar-days-DXE_2mLa.js} +1 -1
- package/runtime/webapp/dist/assets/channel-D66Qxmo0.js +1 -0
- package/runtime/webapp/dist/assets/{check-8EVJMrTV.js → check-UipgMBET.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-down-ChNxfI2x.js → chevron-down-Dvinwg2S.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-right-Cbkc_d70.js → chevron-right-BGU3tcLA.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cklzvs8u.js → chunk-2Q5K7J3B-DObpPEgk.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-NxozE5UP.js → chunk-5VM5RSS4-PaTzAg6w.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-Dyb8E7YM.js → chunk-F27PBJKO-Pn4gut94.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BqbMMc1n.js → chunk-IMKFNOWR-nRaVFzK9.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-do0R2H6U.js → chunk-JWPE2WC7-CxssjKKN.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-B2HIaynf.js → chunk-POPQ4Y6H-CweDXr-B.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-C_zmjkwn.js → chunk-SVP7TREG-C7T3FGE-.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Dh2bZgM1.js → chunk-TICWLB2K-Nc0H-0_V.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CnqciVDz.js → chunk-XXDRQBXY-D_GQGF5g.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BAX0-S6b.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BAX0-S6b.js +1 -0
- package/runtime/webapp/dist/assets/{client-I0ZVCjOI.js → client-Bb0hpbIR.js} +1 -1
- package/runtime/webapp/dist/assets/{codeSyntax-C8n4_KZS.js → codeSyntax-DHonp3tF.js} +3 -3
- package/runtime/webapp/dist/assets/{collaboration-lVxWL5ce.js → collaboration-e_iziKU1.js} +1 -1
- package/runtime/webapp/dist/assets/composer-file-routing-CWyT7leB.js +6 -0
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CulKVUkj.js → cose-bilkent-JH36ORCC-Ac_FBan4.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-C1LUI1_G.js → cynefin-OW5HDTMX-vr6c389q.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-D3Ymzw_P.js → cynefinDiagram-5FMLGOSQ-sXmUCrp_.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DRaL0cGu.js → dagre-GXQ25YYZ-B0DmGxDv.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-D8gLHoZo.js → diagram-S7CK7UJ4-Dn-2jJ6S.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CaVU0aQT.js → diagram-UQ7AKVKN-BcasYsju.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-LFAKRvZz.js → diagram-VSXAHHWV-DCgGkc82.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXpxUERc.js → diagram-VX7I27RA-Cjs0Ny4i.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-vAiik55G.js → diagram-Z3DM3KII-0nyddp0v.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-MaFL7Kgb.js → ebnfDiagram-PWID7BFC-By7gCUsz.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DuEu79B3.js → erDiagram-RLTQ6QDP-DdwBp45A.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-ZVLWtslN.js → file-types-nujx8XUw.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BAQ6nP2D.js → flowDiagram-HODETNUW-DbOwRaT9.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C48VBnPy.js → ganttDiagram-EL5Y4UJY-CG8obc7O.js} +3 -3
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-BfWAh9Kr.js → gitGraphDiagram-WWUBYQGX-ru6aSu_g.js} +1 -1
- package/runtime/webapp/dist/assets/{history-D4E3D_aM.js → history-DaBh5_SJ.js} +1 -1
- package/runtime/webapp/dist/assets/{image-plus-DQV_EEAN.js → image-plus-Cm9jq1yo.js} +1 -1
- package/runtime/webapp/dist/assets/index-BAGzBXQc.css +1 -0
- package/runtime/webapp/dist/assets/index-YrEOkxAg.js +500 -0
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BM7P_-u_.js → infoDiagram-27XIBGKW-Crx1iSbW.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Cwd8XR-p.js → ishikawaDiagram-5VMMS53U-ClQPMEk5.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-MOgiksTh.js → journeyDiagram-3NMN7TZE-DHso2Xht.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DulC5OLL.js → kanban-definition-UXKFOSKX-D6psIAhv.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-Dku9sXQ7.js → layout-B6AVZ9v9.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-B3-dddD7.js → linear-CEZOUjlB.js} +1 -1
- package/runtime/webapp/dist/assets/{list-todo-Bik5IY2r.js → list-todo-D9ChIz0f.js} +1 -1
- package/runtime/webapp/dist/assets/{loader-circle-C5C-IzGK.js → loader-circle-CAHZbD5s.js} +1 -1
- package/runtime/webapp/dist/assets/{locate-fixed-CHkezEEh.js → locate-fixed-2R48MVg_.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-CRRXKysA.js → mermaid.core-DH0df9xk.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CaaP-nEb.js → mindmap-definition-YA3MSWOX-QWt8leZC.js} +1 -1
- package/runtime/webapp/dist/assets/{mobileViewport-CekmYKqS.js → mobileViewport-CKvpvxYc.js} +1 -1
- package/runtime/webapp/dist/assets/new-session-window-CiRwM3Od.js +191 -0
- package/runtime/webapp/dist/assets/{new-session-window-BfDMd-h3.css → new-session-window-DIU2v1uh.css} +1 -1
- package/runtime/webapp/dist/assets/{page-_fFyRId-.js → page-Cd9ci9uo.js} +6 -6
- package/runtime/webapp/dist/assets/{pause-BsmUCuwZ.js → pause-ddt7BLlm.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BqybPEwk.js → pegDiagram-XKGWAZYB-JNBt0nDx.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BX1H2lh2.js → pieDiagram-E7YTZNPT-g0hnDqNp.js} +1 -1
- package/runtime/webapp/dist/assets/{pin-BsEEYq8M.js → pin-BTP5lC_c.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Btnywv1k.js → quadrantDiagram-AXDQQJYC-mLZASjSm.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-Da_TV1ER.js → railroadDiagram-O6MQD6OU-CAXNAZhB.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-5V1Aow9h.js → requirementDiagram-BXWQKSXE-BC8y1ZXE.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-ccw-BbSby0GQ.js → rotate-ccw-CHFTy38a.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-BMdX-ln4.js → rotate-cw-CFCtRFDl.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-D_OIVihV.js → sankeyDiagram-P5KCCOFB-Boi5NPjT.js} +1 -1
- package/runtime/webapp/dist/assets/{send-Cb7EWSJF.js → send-CzCncLlt.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-LKeF5Mri.js → sequenceDiagram-WJ2MYXX4-D4ccoVEB.js} +1 -1
- package/runtime/webapp/dist/assets/{session-dashboard-BFqNDCc8.js → session-dashboard-C0KfSCDl.js} +1 -1
- package/runtime/webapp/dist/assets/{session-tree-BK_qaCnb.js → session-tree-CTzXmV6R.js} +1 -1
- package/runtime/webapp/dist/assets/{shield-check-C-r87aMq.js → shield-check-Da6EGdIt.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-B6j7Q_MN.js → sizeCapture-INFHLROL-Cd5jIVgK.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-zhPFqHdQ.js → stateDiagram-D77RDMKH-DXlmaNwu.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Dh6coc1l.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-C_FCENx1.js → swimlanes-42K2YHIH-DyhRB_e0.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BzriATjP.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-C3DBXjDU.js → timeline-definition-24CTP7MA-Bkfs9Mi-.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-DjggJGbw.js → trash-2-C682LDDA.js} +1 -1
- package/runtime/webapp/dist/assets/{types-BQCEWNQz.js → types-CfOuS-6l.js} +1 -1
- package/runtime/webapp/dist/assets/{use-session-activity-BbTXGW7Z.js → use-session-activity-C9Cn92Hj.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CssdTIB0.js → vennDiagram-4TSXK5OY-APWT64sw.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C58K2vVU.js → wardleyDiagram-VM6X3IG4-H7xLoxwM.js} +1 -1
- package/runtime/webapp/dist/assets/{web-B4y8vdRZ.js → web-CT8e03DV.js} +1 -1
- package/runtime/webapp/dist/assets/{web-D9rJZXHW.js → web-DG022HwJ.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQi8bD6A.js → xychartDiagram-S5SC5T6Z-DIrxZ4UJ.js} +1 -1
- package/runtime/webapp/dist/assets/{zoom-out-iMMWRXJs.js → zoom-out-CRN76HNZ.js} +1 -1
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/ws-server.mjs +5 -0
- package/runtime/.next/static/chunks/app/web/error-30cea9cffce0ebc2.js +0 -1
- package/runtime/.next/static/chunks/app/web/layout-d8a4f4131e7f2330.js +0 -1
- package/runtime/.next/static/chunks/main-app-30a478479a347a9e.js +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0e6mn0ck.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0ssqfy51.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82ghff97.mjs +0 -39
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82yhcz2x.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b8jr1m8m.mjs +0 -23
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cj0jh226.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ebtbxtjf.mjs +0 -28
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-pb4erfqh.mjs +0 -42
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rs058s2g.mjs +0 -16
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-w6pv4szb.mjs +0 -18
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wjeh40nr.mjs +0 -20
- package/runtime/webapp/dist/assets/AIHubView-CM6ugXG3.js +0 -1
- package/runtime/webapp/dist/assets/AiHubPane-DFzC3nbd.js +0 -1
- package/runtime/webapp/dist/assets/App-mF6ELC07.js +0 -68
- package/runtime/webapp/dist/assets/BrowserLivePanel-CamAULwS.js +0 -61
- package/runtime/webapp/dist/assets/CalendarPage-BbYdGYWn.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationCreateDialog-CWhmFQtA.js +0 -1
- package/runtime/webapp/dist/assets/CollaborationDashboard-XL5SnFOu.js +0 -1
- package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BXDuKlrL.js +0 -1
- package/runtime/webapp/dist/assets/FlowStudioPane-lnjLcd9c.js +0 -5
- package/runtime/webapp/dist/assets/HostProjectPicker-DN_vGqQb.js +0 -1
- package/runtime/webapp/dist/assets/NewSessionWindow-zjqAUfKb.js +0 -1
- package/runtime/webapp/dist/assets/RemoteDesktopPage-9AhztqA2.js +0 -1
- package/runtime/webapp/dist/assets/TodoPage-guIvBCW0.js +0 -1
- package/runtime/webapp/dist/assets/artifact-links-B0ApmgK6.js +0 -2
- package/runtime/webapp/dist/assets/channel-BwDuyJO4.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BfyV8P0w.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BfyV8P0w.js +0 -1
- package/runtime/webapp/dist/assets/composer-file-routing-qSvJpT-v.js +0 -6
- package/runtime/webapp/dist/assets/download-BE31-Qm0.js +0 -6
- package/runtime/webapp/dist/assets/index-DSgLFE4Q.js +0 -489
- package/runtime/webapp/dist/assets/index-zQk0NCEB.css +0 -1
- package/runtime/webapp/dist/assets/new-session-window-Dgl7UWPR.js +0 -190
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DWnBZAiI.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DOZCbCJP.js +0 -8
- package/runtime/webapp/dist/assets/x-BYUglEo9.js +0 -6
- /package/runtime/.next/static/{5rv6PMhU7yq1sI1ClFWRU → _rMvYWpbWkNWrFkCQx3rK}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{5rv6PMhU7yq1sI1ClFWRU → _rMvYWpbWkNWrFkCQx3rK}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var ui=t=>{throw TypeError(t)};var Hi=(t,e,r)=>e.has(t)||ui("Cannot "+r);var hi=(t,e,r)=>e.has(t)?ui("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var xr=(t,e,r)=>(Hi(t,e,"access private method"),r);import{c as Re,j as c,r as h,E as Ki,a as Cr,F as di,X as Xi}from"./index-YrEOkxAg.js";import{L as Ne}from"./loader-circle-CAHZbD5s.js";import{C as Yi}from"./chevron-down-Dvinwg2S.js";import{d as Zi,E as _i}from"./RemoteDesktopTabBridge-BFzNwpUn.js";import{M as fi,Z as Gi,a as Ji}from"./zoom-out-CRN76HNZ.js";import{R as Qi}from"./rotate-ccw-CHFTy38a.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const en=Re("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
|
|
7
|
+
* @license lucide-react v0.468.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Rr=Re("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
|
|
12
|
+
* @license lucide-react v0.468.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const pi=Re("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
|
|
17
|
+
* @license lucide-react v0.468.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const tn=Re("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
22
|
+
* @license lucide-react v0.468.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const rn=Re("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
27
|
+
* @license lucide-react v0.468.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const mi=Re("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
32
|
+
* @license lucide-react v0.468.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const nr=Re("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
|
|
37
|
+
* @license lucide-react v0.468.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const vi=Re("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/**
|
|
42
|
+
* @license lucide-react v0.468.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const nn=Re("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
|
|
47
|
+
* @license lucide-react v0.468.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const yi=Re("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
52
|
+
* @license lucide-react v0.468.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const sn=Re("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
57
|
+
* @license lucide-react v0.468.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const on=Re("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function sr({label:t,title:e,value:r,busy:n,disabled:s,compact:l,onChange:u,children:p}){return c.jsxs("span",{className:`live-view-select${l?" live-view-select--compact":""}`,children:[c.jsx("select",{"aria-label":t,"aria-busy":n,title:e,value:r,disabled:s||n,onChange:v=>u(v.target.value),children:p}),n?c.jsx("span",{className:"live-view-select-icon",role:"status","aria-label":`${t}正在切换`,children:c.jsx(Ne,{size:14,className:"spin","aria-hidden":"true"})}):c.jsx(Yi,{size:14,className:"live-view-select-icon","aria-hidden":"true"})]})}function an({disabled:t,onPaste:e,onError:r}){const[n,s]=h.useState(!1),[l,u]=h.useState(!1),p=h.useRef(null),v=h.useRef(!1),d=h.useRef(!0),m=h.useRef(!t);m.current=!t,h.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),h.useEffect(()=>{var k;l&&((k=p.current)==null||k.focus({preventScroll:!0}))},[l]);const w=async k=>{if(!(v.current||t)){v.current=!0,s(!0),r(null);try{const E=await k();if(!d.current||!m.current)return;if(E===null){u(!0),r("浏览器限制读取剪贴板,请长按“系统粘贴”使用系统菜单,粘贴后自动输入电脑");return}if(!E)throw new Error("剪贴板里没有文字");await e(E),d.current&&u(!1)}catch(E){d.current&&r(E instanceof Error?E.message:"粘贴失败,请重试")}finally{v.current=!1,d.current&&s(!1)}}};return l?c.jsx("input",{ref:p,className:"browser-live-native-paste","aria-label":"系统粘贴",placeholder:"系统粘贴",disabled:t||n,defaultValue:"",autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onPaste:k=>{k.preventDefault();const E=k.clipboardData.getData("text/plain");w(()=>Promise.resolve(E))}}):c.jsx("button",{type:"button",disabled:t||n,title:"直接粘贴当前手机或电脑剪贴板的文字",onClick:()=>void w(Zi),children:n?"粘贴中…":"粘贴"})}const cn=5e3,ln=1e4;class un{constructor(){this.startedAt=null,this.lastFrameAt=null,this.lastFrameCount=null}begin(e){this.startedAt=e,this.lastFrameAt=null,this.lastFrameCount=null}resume(e){this.startedAt!==null&&(this.startedAt=e),this.lastFrameAt!==null&&(this.lastFrameAt=e)}observe(e,r){return typeof e!="number"||!Number.isFinite(e)||e<0||e===this.lastFrameCount||(this.lastFrameCount=e,e===0)?!1:(this.lastFrameAt=r,!0)}evaluate(e){const r=this.lastFrameAt??this.startedAt;if(r===null)return{state:"streaming",silentForMs:0};const n=Math.max(0,e-r),s=this.lastFrameAt===null?cn:ln;return{state:n>=s?"stalled":"streaming",silentForMs:n}}}const bi="cli-desktop:primary",F=Object.freeze({version:1,channelLabel:"agentroam.compound.v1",tileSize:64,maxDimension:4096,maxFramePixels:8388608,maxTileBytes:32768,maxMessageBytes:48e3,maxTiles:128,maxCacheEntries:4096,maxCachePixels:10485760,maxEntropy:24,initialEntropy:6.3,sampleIntervalMs:250,acknowledgementTimeoutMs:2e3});function Tr(t,e){return[t==null?void 0:t.x,t==null?void 0:t.y,t==null?void 0:t.width,t==null?void 0:t.height].every(Number.isSafeInteger)&&t.x>=0&&t.y>=0&&t.width>0&&t.height>0&&t.x+t.width<=e.width&&t.y+t.height<=e.height}function hn(t){return typeof t.epoch=="string"&&t.epoch.length>0&&t.epoch.length<=120&&Number.isSafeInteger(t.revision)&&t.revision>=0&&Number.isFinite(t.timestamp)&&t.timestamp>=0&&Number.isInteger(t.width)&&t.width>0&&t.width<=F.maxDimension&&Number.isInteger(t.height)&&t.height>0&&t.height<=F.maxDimension&&t.width*t.height<=F.maxFramePixels}function Ir(t,e){const r=t-e>>>0;return r!==0&&r<2147483648}function dn(t,e){return Number.isSafeInteger(t==null?void 0:t.sourceRevision)&&t.sourceRevision>=0&&Tr(t,e)&&Tr({x:t.sourceX,y:t.sourceY,width:t.width,height:t.height},e)&&(t.sourceX!==t.x||t.sourceY!==t.y)}var fn=ArrayBuffer,Z=Uint8Array,ar=Uint16Array,pn=Int16Array,cr=Int32Array,jr=function(t,e,r){if(Z.prototype.slice)return Z.prototype.slice.call(t,e,r);(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var n=new Z(r-e);return n.set(t.subarray(e,r)),n},Dt=function(t,e,r,n){if(Z.prototype.fill)return Z.prototype.fill.call(t,e,r,n);for((r==null||r<0)&&(r=0),(n==null||n>t.length)&&(n=t.length);r<n;++r)t[r]=e;return t},mn=function(t,e,r,n){if(Z.prototype.copyWithin)return Z.prototype.copyWithin.call(t,e,r,n);for((r==null||r<0)&&(r=0),(n==null||n>t.length)&&(n=t.length);r<n;)t[e++]=t[r++]},vn=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],G=function(t,e,r){var n=new Error(e||vn[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,G),!r)throw n;return n},wi=function(t,e,r){for(var n=0,s=0;n<r;++n)s|=t[e++]<<(n<<3);return s},yn=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},bn=function(t,e){var r=t[0]|t[1]<<8|t[2]<<16;if(r==3126568&&t[3]==253){var n=t[4],s=n>>5&1,l=n>>2&1,u=n&3,p=n>>6;n&8&&G(0);var v=6-s,d=u==3?4:u,m=wi(t,v,d);v+=d;var w=p?1<<p:s,k=wi(t,v,w)+(p==1&&256),E=k;if(!s){var W=1<<10+(t[5]>>3);E=W+(W>>3)*(t[5]&7)}E>2145386496&&G(1);var I=new Z((e==1?k||E:e?0:E)+12);return I[0]=1,I[4]=4,I[8]=8,{b:v+w,y:0,l:0,d:m,w:e&&e!=1?e:I.subarray(12),e:E,o:new cr(I.buffer,0,3),u:k,c:l,m:Math.min(131072,E)}}else if((r>>4|t[3]<<20)==25481893)return yn(t,4)+8;G(0)},rt=function(t){for(var e=0;1<<e<=t;++e);return e-1},Ft=function(t,e,r){var n=(e<<3)+4,s=(t[e]&15)+5;s>r&&G(3);for(var l=1<<s,u=l,p=-1,v=-1,d=-1,m=l,w=new fn(512+(l<<2)),k=new pn(w,0,256),E=new ar(w,0,256),W=new ar(w,512,l),I=512+(l<<1),q=new Z(w,I,l),oe=new Z(w,I+l);p<255&&u>0;){var Y=rt(u+1),V=n>>3,B=(1<<Y+1)-1,O=(t[V]|t[V+1]<<8|t[V+2]<<16)>>(n&7)&B,R=(1<<Y)-1,$=B-u-1,b=O&R;if(b<$?(n+=Y,O=b):(n+=Y+1,O>R&&(O-=$)),k[++p]=--O,O==-1?(u+=O,q[--m]=p):u-=O,!O)do{var te=n>>3;v=(t[te]|t[te+1]<<8)>>(n&7)&3,n+=2,p+=v}while(v==3)}(p>255||u)&&G(0);for(var L=0,H=(l>>1)+(l>>3)+3,ae=l-1,_=0;_<=p;++_){var N=k[_];if(N<1){E[_]=-N;continue}for(d=0;d<N;++d){q[L]=_;do L=L+H&ae;while(L>=m)}}for(L&&G(0),d=0;d<l;++d){var S=E[q[d]]++,J=oe[d]=s-rt(S);W[d]=(S<<J)-l}return[n+7>>3,{b:s,s:q,n:oe,t:W}]},wn=function(t,e){var r=0,n=-1,s=new Z(292),l=t[e],u=s.subarray(0,256),p=s.subarray(256,268),v=new ar(s.buffer,268);if(l<128){var d=Ft(t,e+1,6),m=d[0],w=d[1];e+=l;var k=m<<3,E=t[e];E||G(0);for(var W=0,I=0,q=w.b,oe=q,Y=(++e<<3)-8+rt(E);Y-=q,!(Y<k);){var V=Y>>3;if(W+=(t[V]|t[V+1]<<8)>>(Y&7)&(1<<q)-1,u[++n]=w.s[W],Y-=oe,Y<k)break;V=Y>>3,I+=(t[V]|t[V+1]<<8)>>(Y&7)&(1<<oe)-1,u[++n]=w.s[I],q=w.n[W],W=w.t[W],oe=w.n[I],I=w.t[I]}++n>255&&G(0)}else{for(n=l-127;r<n;r+=2){var B=t[++e];u[r]=B>>4,u[r+1]=B&15}++e}var O=0;for(r=0;r<n;++r){var R=u[r];R>11&&G(0),O+=R&&1<<R-1}var $=rt(O)+1,b=1<<$,te=b-O;for(te&te-1&&G(0),u[n++]=rt(te)+1,r=0;r<n;++r){var R=u[r];++p[u[r]=R&&$+1-R]}var L=new Z(b<<1),H=L.subarray(0,b),ae=L.subarray(b);for(v[$]=0,r=$;r>0;--r){var _=v[r];Dt(ae,r,_,v[r-1]=_+p[r]*(1<<$-r))}for(v[0]!=b&&G(0),r=0;r<n;++r){var N=u[r];if(N){var S=v[N];Dt(H,r,S,v[N]=S+(1<<$-N))}}return[e,{n:ae,b:$,s:H}]},gn=Ft(new Z([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],kn=Ft(new Z([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],xn=Ft(new Z([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],Mi=function(t,e){for(var r=t.length,n=new cr(r),s=0;s<r;++s)n[s]=e,e+=1<<t[s];return n},Pr=new Z(new cr([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),Cn=Mi(Pr,0),Nr=new Z(new cr([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),Rn=Mi(Nr,3),qt=function(t,e,r){var n=t.length,s=e.length,l=t[n-1],u=(1<<r.b)-1,p=-r.b;l||G(0);for(var v=0,d=r.b,m=(n<<3)-8+rt(l)-d,w=-1;m>p&&w<s;){var k=m>>3,E=(t[k]|t[k+1]<<8|t[k+2]<<16)>>(m&7);v=(v<<d|E)&u,e[++w]=r.s[v],m-=d=r.n[v]}(m!=p||w+1!=s)&&G(0)},jn=function(t,e,r){var n=6,s=e.length,l=s+3>>2,u=l<<1,p=l+u;qt(t.subarray(n,n+=t[0]|t[1]<<8),e.subarray(0,l),r),qt(t.subarray(n,n+=t[2]|t[3]<<8),e.subarray(l,u),r),qt(t.subarray(n,n+=t[4]|t[5]<<8),e.subarray(u,p),r),qt(t.subarray(n),e.subarray(p),r)},En=function(t,e,r){var n,s=e.b,l=t[s],u=l>>1&3;e.l=l&1;var p=l>>3|t[s+1]<<5|t[s+2]<<13,v=(s+=3)+p;if(u==1)return s>=t.length?void 0:(e.b=s+1,r?(Dt(r,t[s],e.y,e.y+=p),r):Dt(new Z(p),t[s]));if(!(v>t.length)){if(u==0)return e.b=v,r?(r.set(t.subarray(s,v),e.y),e.y+=p,r):jr(t,s,v);if(u==2){var d=t[s],m=d&3,w=d>>2&3,k=d>>4,E=0,W=0;m<2?w&1?k|=t[++s]<<4|(w&2&&t[++s]<<12):k=d>>3:(W=w,w<2?(k|=(t[++s]&63)<<4,E=t[s]>>6|t[++s]<<2):w==2?(k|=t[++s]<<4|(t[++s]&3)<<12,E=t[s]>>2|t[++s]<<6):(k|=t[++s]<<4|(t[++s]&63)<<12,E=t[s]>>6|t[++s]<<2|t[++s]<<10)),++s;var I=r?r.subarray(e.y,e.y+e.m):new Z(e.m),q=I.length-k;if(m==0)I.set(t.subarray(s,s+=k),q);else if(m==1)Dt(I,t[s++],q);else{var oe=e.h;if(m==2){var Y=wn(t,s);E+=s-(s=Y[0]),e.h=oe=Y[1]}else oe||G(0);(W?jn:qt)(t.subarray(s,s+=E),I.subarray(q),oe)}var V=t[s++];if(V){V==255?V=(t[s++]|t[s++]<<8)+32512:V>127&&(V=V-128<<8|t[s++]);var B=t[s++];B&3&&G(0);for(var O=[kn,xn,gn],R=2;R>-1;--R){var $=B>>(R<<1)+2&3;if($==1){var b=new Z([0,0,t[s++]]);O[R]={s:b.subarray(2,3),n:b.subarray(0,1),t:new ar(b.buffer,0,1),b:0}}else $==2?(n=Ft(t,s,9-(R&1)),s=n[0],O[R]=n[1]):$==3&&(e.t||G(0),O[R]=e.t[R])}var te=e.t=O,L=te[0],H=te[1],ae=te[2],_=t[v-1];_||G(0);var N=(v<<3)-8+rt(_)-ae.b,S=N>>3,J=0,Le=(t[S]|t[S+1]<<8)>>(N&7)&(1<<ae.b)-1;S=(N-=H.b)>>3;var Ae=(t[S]|t[S+1]<<8)>>(N&7)&(1<<H.b)-1;S=(N-=L.b)>>3;var $e=(t[S]|t[S+1]<<8)>>(N&7)&(1<<L.b)-1;for(++V;--V;){var je=ae.s[Le],j=ae.n[Le],ye=L.s[$e],C=L.n[$e],be=H.s[Ae],Je=H.n[Ae];S=(N-=be)>>3;var yt=1<<be,qe=yt+((t[S]|t[S+1]<<8|t[S+2]<<16|t[S+3]<<24)>>>(N&7)&yt-1);S=(N-=Nr[ye])>>3;var De=Rn[ye]+((t[S]|t[S+1]<<8|t[S+2]<<16)>>(N&7)&(1<<Nr[ye])-1);S=(N-=Pr[je])>>3;var Fe=Cn[je]+((t[S]|t[S+1]<<8|t[S+2]<<16)>>(N&7)&(1<<Pr[je])-1);if(S=(N-=j)>>3,Le=ae.t[Le]+((t[S]|t[S+1]<<8)>>(N&7)&(1<<j)-1),S=(N-=C)>>3,$e=L.t[$e]+((t[S]|t[S+1]<<8)>>(N&7)&(1<<C)-1),S=(N-=Je)>>3,Ae=H.t[Ae]+((t[S]|t[S+1]<<8)>>(N&7)&(1<<Je)-1),qe>3)e.o[2]=e.o[1],e.o[1]=e.o[0],e.o[0]=qe-=3;else{var D=qe-(Fe!=0);D?(qe=D==3?e.o[0]-1:e.o[D],D>1&&(e.o[2]=e.o[1]),e.o[1]=e.o[0],e.o[0]=qe):qe=e.o[0]}for(var R=0;R<Fe;++R)I[J+R]=I[q+R];J+=Fe,q+=Fe;var Ee=J-qe;if(Ee<0){var we=-Ee,He=e.e+Ee;we>De&&(we=De);for(var R=0;R<we;++R)I[J+R]=e.w[He+R];J+=we,De-=we,Ee=0}for(var R=0;R<De;++R)I[J+R]=I[Ee+R];J+=De}if(J!=q)for(;q<I.length;)I[J++]=I[q++];else J=I.length;r?e.y+=J:I=jr(I,0,J)}else if(r){if(e.y+=k,q)for(var R=0;R<k;++R)I[R]=I[q+R]}else q&&(I=jr(I,q));return e.b=v,I}G(2)}},Mn=function(t,e){if(t.length==1)return t[0];for(var r=new Z(e),n=0,s=0;n<t.length;++n){var l=t[n];r.set(l,s),s+=l.length}return r};function Sn(t,e){for(var r=[],n=+!e,s=0,l=0;t.length;){var u=bn(t,n||e);if(typeof u=="object"){for(n?(e=null,u.w.length==u.u&&(r.push(e=u.w),l+=u.u)):(r.push(e),u.e=0);!u.l;){var p=En(t,u,e);p||G(5),e?u.e=u.y:(r.push(p),l+=p.length,mn(u.w,0,p.length),u.w.set(p,u.w.length-p.length))}s=u.b+u.c*4}else s=u;t=t.subarray(s)}return Mn(r,l)}const vt=30,Er=10,Tn=new TextEncoder,In=new TextDecoder("utf-8",{fatal:!0});function lr(t,e,r){let n;if(typeof t=="string"){if(t.length>Math.ceil(F.maxTileBytes/3)*4||t.length%4!==0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t))throw new Error("Invalid compound image");n=Uint8Array.from(atob(t),v=>v.charCodeAt(0))}else n=t;const s=[137,80,78,71,13,10,26,10];if(!(n instanceof Uint8Array)||n.length<24||n.length>F.maxTileBytes||s.some((v,d)=>n[d]!==v)||String.fromCharCode(...n.subarray(12,16))!=="IHDR")throw new Error("Invalid PNG header");const l=new DataView(n.buffer,n.byteOffset,n.byteLength),u=l.getUint32(16),p=l.getUint32(20);if(u<1||p<1||u>F.tileSize||p>F.tileSize||e!==void 0&&u!==e||r!==void 0&&p!==r)throw new Error("Invalid PNG dimensions");return n}function Pn(t){return[t.cacheId,t.x,t.y,t.width,t.height].every(Number.isSafeInteger)&&t.cacheId>=1&&t.cacheId<=F.maxCacheEntries&&t.x>=0&&t.y>=0&&t.width>0&&t.height>0&&t.width<=F.tileSize&&t.height<=F.tileSize&&t.x%F.tileSize===0&&t.y%F.tileSize===0&&t.x+t.width<=F.maxDimension&&t.y+t.height<=F.maxDimension}function Nn(t){return t.version===1&&t.kind==="tiles"&&typeof t.epoch=="string"&&t.epoch.length>0&&Tn.encode(t.epoch).length<=120&&Number.isSafeInteger(t.revision)&&t.revision>=0&&Number.isSafeInteger(t.sequence)&&t.sequence>0&&Number.isInteger(t.rtpTimestamp)&&t.rtpTimestamp>=0&&t.rtpTimestamp<=4294967295&&Array.isArray(t.tiles)&&t.tiles.length>0&&t.tiles.length<=F.maxTiles}function Si(t){if(t[0]===65&&t[1]===82&&t[2]===67&&t[3]===90)return Si(Ln(t));if(t.length<vt||t.length>F.maxMessageBytes||[65,82,67,86,1,1].some((v,d)=>t[d]!==v))throw new Error("Invalid compound binary header");const e=new DataView(t.buffer,t.byteOffset,t.byteLength),r=e.getUint16(6),n=e.getUint16(28);if(!r||r>120||!n||n>F.maxTiles||vt+r+n*Er>t.length)throw new Error("Invalid compound binary lengths");const s={version:1,kind:"tiles",epoch:In.decode(t.subarray(vt,vt+r)),revision:e.getFloat64(8),sequence:e.getFloat64(16),rtpTimestamp:e.getUint32(24),tiles:[]};let l=vt+r;const u=new Set,p=new Set;for(let v=0;v<n;v++){if(l+Er>t.length)throw new Error("Truncated compound tile");const d={cacheId:e.getUint16(l),x:e.getUint16(l+2),y:e.getUint16(l+4),width:e.getUint8(l+6),height:e.getUint8(l+7)},m=e.getUint16(l+8);l+=Er;const w=`${d.x},${d.y}`;if(!Pn(d)||u.has(w)||l+m>t.length)throw new Error("Invalid compound tile bounds");if(u.add(w),m){if(p.has(d.cacheId))throw new Error("Duplicate compound cache insertion");p.add(d.cacheId),d.data=lr(t.subarray(l,l+m),d.width,d.height),l+=m}s.tiles.push(d)}if(l!==t.length||!Nn(s))throw new Error("Invalid compound binary batch");return s}function Ln(t){if(t.length<14||t.length>F.maxMessageBytes)throw new Error("Invalid compressed compound length");const e=new DataView(t.buffer,t.byteOffset).getUint32(4);if(e<vt||e>F.maxMessageBytes)throw new Error("Invalid compound output length");const r=t.subarray(8);if([40,181,47,253].some((w,k)=>r[k]!==w))throw new Error("Invalid Zstd magic");const n=r[4],s=(n&32)!==0,l=n>>>6;if(n&27)throw new Error("Unsupported Zstd dictionary/reserved bits");let u=5;if(!s){const w=r[u++],k=2**(10+(w>>>3));if(k+k/8*(w&7)>65536)throw new Error("Compound Zstd window too large")}const p=l===0?s?1:0:l===1?2:l===2?4:8;if(!p||u+p>r.length)throw new Error("Zstd content size required");let v=0;for(let w=0;w<p;w++)v+=r[u+w]*2**(8*w);if(p===2&&(v+=256),v!==e)throw new Error("Zstd content size differs");u+=p;let d=!1;for(;!d;){if(u+3>r.length)throw new Error("Truncated Zstd block");const w=r[u]|r[u+1]<<8|r[u+2]<<16;u+=3,d=(w&1)!==0;const k=w>>>1&3,E=w>>>3;if(k===3||E>131072)throw new Error("Invalid Zstd block");if(u+=k===1?1:E,u>r.length)throw new Error("Truncated Zstd payload")}if(n&4&&(u+=4),u!==r.length)throw new Error("Trailing compound Zstd data");const m=Sn(r,new Uint8Array(e));if(m.length!==e||m[3]!==86)throw new Error("Invalid decompressed compound packet");return m}function or(t){return Number.isInteger(t)&&Number(t)>=0&&Number(t)<=4294967295}function An(t){return Number.isSafeInteger(t)&&Number(t)>=0}async function qn(t){const e=lr(t),r=new Blob([new Uint8Array(e).buffer],{type:"image/png"});if(typeof createImageBitmap=="function"){const s=await createImageBitmap(r);return{source:s,width:s.width,height:s.height,close:()=>s.close()}}const n=URL.createObjectURL(r);try{const s=await new Promise((l,u)=>{const p=new Image;p.onload=()=>l(p),p.onerror=()=>u(new Error("PNG decode failed")),p.src=n});return{source:s,width:s.naturalWidth,height:s.naturalHeight,close:()=>{s.src=""}}}finally{URL.revokeObjectURL(n)}}class gi{constructor(e){this.options=e,this.channel=null,this.observedVideo=null,this.stopped=!1,this.generation=0,this.epoch=null,this.revision=-1,this.width=0,this.height=0,this.assets=new Map,this.cachePixels=0,this.barriers=new Map,this.hasPixels=!1,this.decoding=!1,this.pending=null,this.batches=[],this.decodingBytes=0,this.lastReceivedSequence=0,this.previousCanvas=null,this.presentedAt=0,this.lastSequence=0,this.decodeImage=e.decodeImage??qn}static supported(){return typeof HTMLVideoElement<"u"&&typeof HTMLVideoElement.prototype.requestVideoFrameCallback=="function"}attach(e){const r=s=>{if(s.channel.label!==F.channelLabel||this.stopped)return;if(this.channel){s.channel.close();return}this.channel=s.channel,s.channel.binaryType="arraybuffer";const l=()=>this.feedback({kind:"ready",version:1,formats:["binary-zstd-v1","binary-v1","json-v1"],features:["window-v1","scroll-v1","qoe-v1","cursor-v1"],maxTileBytes:F.maxTileBytes});s.channel.onopen=l,s.channel.onmessage=u=>this.receive(u.data),s.channel.onclose=()=>this.stop(),s.channel.readyState==="open"&&l(),this.observeVideo()},n=()=>this.observeVideo();e.addEventListener("datachannel",r),e.addEventListener("track",n),this.removePeerListener=()=>{e.removeEventListener("datachannel",r),e.removeEventListener("track",n)}}observeVideo(){const e=this.options.getVideo();if(this.stopped||!this.channel||!e||this.observedVideo===e)return;if(typeof e.requestVideoFrameCallback!="function"){this.fail();return}this.observedVideo=e;const r=(n,s)=>{this.stopped||(this.presentFrame(s.rtpTimestamp),this.stopped||(this.callback=e.requestVideoFrameCallback(r)))};this.callback=e.requestVideoFrameCallback(r)}presentFrame(e){if(!this.stopped){if(!or(e)){this.fail();return}this.presentedRtp=e,this.presentedAt=Date.now(),this.reportPresentation(),this.renderVisibility()}}receive(e){if(!this.stopped)try{if(e instanceof ArrayBuffer||e instanceof Uint8Array){const n=Si(e instanceof Uint8Array?e:new Uint8Array(e));this.receiveTiles({...n,binary:!0,wireBytes:e.byteLength,tiles:n.tiles.map(s=>({...s,key:`slot:${s.cacheId}`}))});return}if(typeof e!="string"||e.length>F.maxMessageBytes)throw new Error("Invalid compound envelope");const r=JSON.parse(e);if(!r||r.version!==1)throw new Error("Unsupported compound version");if(r.kind==="ping"&&Number.isFinite(r.t0)){const n=Date.now();this.feedback({kind:"pong",t0:r.t0,t1:n,t2:Date.now()});return}if(r.kind==="reset"){const n={epoch:r.epoch,revision:r.revision,timestamp:0,width:r.width,height:r.height};if(!hn(n))throw new Error("Invalid compound geometry");this.clearAssets(),this.epoch=r.epoch,this.width=r.width,this.height=r.height,this.revision=r.revision,this.lastSequence=0,this.lastReceivedSequence=0,this.previousCanvas=null,this.barriers.clear();const s=this.options.getCanvas();s&&(s.width=this.width,s.height=this.height),this.clearPlacements();return}if(r.epoch!==this.epoch)return;if(r.kind==="disabled"){this.stop();return}if(!An(r.revision))throw new Error("Invalid compound revision");if(r.kind==="invalidate"){if(r.revision>this.revision){this.saveScrollBase();const n=r.rects;if(n!==void 0&&(!Array.isArray(n)||!n.length||n.length>32||!n.every(s=>Tr(s,{width:this.width,height:this.height}))))throw new Error("Invalid dirty regions");this.revision=r.revision,this.clearPlacements(n)}}else if(r.kind==="frame"){if(!or(r.rtpTimestamp))throw new Error("Invalid presentation barrier");for(r.revision>this.revision&&(this.revision=r.revision,this.clearPlacements()),this.barriers.set(r.rtpTimestamp,r.revision);this.barriers.size>128;)this.barriers.delete(this.barriers.keys().next().value);this.renderVisibility(),this.reportPresentation()}else if(r.kind==="scroll"){const n=r.copy;if(r.revision!==this.revision)return;if(!dn(n,{width:this.width,height:this.height})||!or(r.rtpTimestamp)||!Number.isSafeInteger(r.sequence)||Number(r.sequence)<=this.lastReceivedSequence)throw new Error("Invalid scroll command");this.lastReceivedSequence=Number(r.sequence);const s=this.previousCanvas,l=this.options.getCanvas(),u=l==null?void 0:l.getContext("2d"),p=!!s&&s.revision===n.sourceRevision&&!!u;p&&(u.clearRect(n.x,n.y,n.width,n.height),u.drawImage(s.canvas,n.sourceX,n.sourceY,n.width,n.height,n.x,n.y,n.width,n.height),this.hasPixels=!0,this.sourceRtp=r.rtpTimestamp,this.renderVisibility()),this.previousCanvas=null,this.feedback({kind:"ack",epoch:this.epoch,sequence:r.sequence,ok:p})}else r.kind==="tiles"&&this.receiveTiles({...r,binary:!1,wireBytes:new TextEncoder().encode(e).length})}catch{this.fail()}}receiveTiles(e){if(!(e.epoch!==this.epoch||e.revision!==this.revision)){if(!or(e.rtpTimestamp)||!Number.isSafeInteger(e.sequence)||e.sequence<=this.lastReceivedSequence||!Array.isArray(e.tiles)||!e.tiles.length||e.tiles.length>F.maxTiles)throw new Error("Invalid tile batch");if(this.lastReceivedSequence=e.sequence,this.decoding){if(this.batches.length>=3||this.decodingBytes+this.batches.reduce((r,n)=>r+(n.wireBytes??0),0)+(e.wireBytes??0)>64e3)throw new Error("Compound decode window exceeded");this.batches.push(e)}else this.applyTiles(e)}}validTile(e,r=!1){return typeof(e==null?void 0:e.key)=="string"&&(r?/^slot:[1-9][0-9]{0,3}$/.test(e.key):/^[a-f0-9]{64}$/.test(e.key))&&[e.x,e.y,e.width,e.height].every(Number.isSafeInteger)&&e.x>=0&&e.y>=0&&e.width>0&&e.height>0&&e.width<=F.tileSize&&e.height<=F.tileSize&&e.x%F.tileSize===0&&e.y%F.tileSize===0&&e.x+e.width<=this.width&&e.y+e.height<=this.height}async applyTiles(e){this.decoding=!0,this.decodingBytes=e.wireBytes??0;const r=this.generation,n=new Map;let s=!1;try{const l=this.options.getCanvas(),u=l==null?void 0:l.getContext("2d");if(!u)throw new Error("Canvas unavailable");for(const p of e.tiles){if(!this.validTile(p,e.binary))throw new Error("Invalid tile bounds");let v=this.assets.get(p.key);if(e.binary&&v&&p.data!==void 0)throw new Error("Compound cache slot already occupied");if(!v){if(typeof p.data!="string"&&!(p.data instanceof Uint8Array))throw new Error("Missing cached tile");lr(p.data,p.width,p.height);const d=await this.decodeImage(p.data);if(this.stopped||this.generation!==r){d.close();return}if(d.width!==p.width||d.height!==p.height||this.cachePixels+p.width*p.height>F.maxCachePixels||this.assets.size>=F.maxCacheEntries)throw d.close(),new Error("Compound image cache limit exceeded");v=d,this.assets.set(p.key,v),n.set(p.key,v),this.cachePixels+=p.width*p.height}if(v.width!==p.width||v.height!==p.height)throw new Error("Cached tile dimensions differ");if(this.stopped||this.generation!==r)return;u.drawImage(v.source,p.x,p.y,p.width,p.height)}if(this.stopped||this.generation!==r)return;this.sourceRtp=this.sourceRtp===void 0||Ir(e.rtpTimestamp,this.sourceRtp)?e.rtpTimestamp:this.sourceRtp,this.hasPixels=!0,this.lastSequence=e.sequence,s=!0,this.feedback({kind:"ack",epoch:this.epoch,sequence:e.sequence,ok:!0}),this.renderVisibility()}catch{!this.stopped&&this.generation===r&&(this.clearPlacements(),this.feedback({kind:"ack",epoch:this.epoch,sequence:e.sequence,ok:!1}))}finally{if(!s)for(const[u,p]of n)this.assets.get(u)===p&&(this.assets.delete(u),this.cachePixels-=p.width*p.height,p.close());this.decoding=!1,this.decodingBytes=0;const l=this.batches.shift();this.pending=null,!this.stopped&&l&&l.epoch===this.epoch&&l.revision===this.revision&&this.applyTiles(l)}}renderVisibility(){const e=this.options.getCanvas(),r=this.options.getVideo();if(!e)return;const n=this.presentedRtp,s=n!==void 0&&this.sourceRtp!==void 0&&(n===this.sourceRtp||Ir(n,this.sourceRtp))&&this.barriers.get(n)===this.revision;e.style.visibility=!this.stopped&&this.hasPixels&&s&&(r==null?void 0:r.videoWidth)===this.width&&r.videoHeight===this.height?"visible":"hidden"}feedback(e){var r;if(((r=this.channel)==null?void 0:r.readyState)==="open"&&this.channel.bufferedAmount<4096)try{this.channel.send(JSON.stringify(e))}catch{}}reportPresentation(){this.presentedRtp===void 0||this.reportedRtp===this.presentedRtp||this.barriers.get(this.presentedRtp)!==this.revision||(this.reportedRtp=this.presentedRtp,this.feedback({kind:"presented",epoch:this.epoch,rtpTimestamp:this.presentedRtp,presentedAt:this.presentedAt}))}saveScrollBase(){var n,s,l;const e=this.options.getCanvas();if(!e)return;const r=((s=(n=this.options).createCanvas)==null?void 0:s.call(n))??(typeof document<"u"?document.createElement("canvas"):null);r&&(r.width=this.width,r.height=this.height,(l=r.getContext("2d"))==null||l.drawImage(e,0,0),this.previousCanvas={canvas:r,revision:this.revision})}clearPlacements(e){this.generation+=1,this.pending=null,this.batches=[],e||(this.hasPixels=!1,this.sourceRtp=void 0);const r=this.options.getCanvas(),n=r==null?void 0:r.getContext("2d");if(e)for(const s of e)n==null||n.clearRect(s.x,s.y,s.width,s.height);else r&&(n==null||n.clearRect(0,0,r.width,r.height));r&&(r.style.visibility="hidden")}clearAssets(){for(const e of this.assets.values())e.close();this.assets.clear(),this.cachePixels=0}fail(){this.feedback({kind:"unsupported",version:1}),this.stop()}stop(){var e,r,n;this.stopped||(this.stopped=!0,this.clearPlacements(),this.clearAssets(),this.barriers.clear(),this.previousCanvas=null,this.callback!==void 0&&((e=this.observedVideo)==null||e.cancelVideoFrameCallback(this.callback)),(r=this.removePeerListener)==null||r.call(this),(n=this.channel)==null||n.close(),this.channel=null)}}class Dn{constructor(e){this.options=e,this.stopped=!1,this.receivedAt=-1/0}attach(e){const r=s=>{if(!(s.channel.label!=="agentroam.cursor.v1"||this.stopped)){if(this.channel){s.channel.close();return}this.channel=s.channel,s.channel.onmessage=l=>this.receive(l.data),s.channel.onclose=()=>{this.state=void 0,this.hide()},this.observe()}},n=()=>this.observe();e.addEventListener("datachannel",r),e.addEventListener("track",n),this.remove=()=>{e.removeEventListener("datachannel",r),e.removeEventListener("track",n)}}observe(){const e=this.options.getVideo();if(!e||this.video===e||!this.channel||typeof e.requestVideoFrameCallback!="function")return;this.video=e;const r=(n,s)=>{this.stopped||(this.rtp=s.rtpTimestamp,this.render(),this.frameCallback=e.requestVideoFrameCallback(r))};this.frameCallback=e.requestVideoFrameCallback(r)}receive(e){var r;if(!(this.stopped||typeof e!="string"||e.length>12e3))try{const n=JSON.parse(e);if(![n.sequence,n.cutoverRtp].every(Number.isSafeInteger)||n.cutoverRtp<0||n.cutoverRtp>4294967295||![n.x,n.y].every(s=>Number.isFinite(s)&&s>=0&&s<=1)||typeof n.active!="boolean"||typeof n.visible!="boolean"||this.state&&n.sequence<=this.state.sequence)return;if(n.shape&&n.shape!==((r=this.state)==null?void 0:r.shape)&&(this.image=void 0,this.imageData=void 0),this.state={...this.state,...n},this.receivedAt=Date.now(),typeof n.image=="string"&&n.image!==this.imageData&&n.image.length<=8192&&/^[A-Za-z0-9+/]+={0,2}$/.test(n.image)){lr(n.image),this.imageData=n.image;const s=new Image;s.onload=()=>{!this.stopped&&this.imageData===n.image&&s.naturalWidth<=64&&s.naturalHeight<=64&&(this.image=s,this.render())},s.src=`data:image/png;base64,${n.image}`}this.observe(),this.render()}catch{}}localPoint(e){typeof e.x!="number"||typeof e.y!="number"||!Number.isFinite(e.x)||!Number.isFinite(e.y)||(this.local={x:Math.max(0,Math.min(1,e.x)),y:Math.max(0,Math.min(1,e.y)),at:Date.now()},this.render())}render(){var d;const e=this.state,r=this.options.getVideo(),n=this.options.getCanvas();if(!n)return;if(!(e!=null&&e.active)||!e.visible||this.stopped||Date.now()-this.receivedAt>2e3||!(r!=null&&r.videoWidth)||r.videoWidth>4096||r.videoHeight>4096||r.videoWidth*r.videoHeight>8388608||this.rtp===void 0||this.activatedCutover!==e.cutoverRtp&&this.rtp!==e.cutoverRtp&&!Ir(this.rtp,e.cutoverRtp)){this.hide();return}this.activatedCutover=e.cutoverRtp,n.width!==r.videoWidth&&(n.width=r.videoWidth),n.height!==r.videoHeight&&(n.height=r.videoHeight);const s=n.getContext("2d");if(!s)return;s.clearRect(0,0,n.width,n.height);const l=this.local&&Date.now()-this.local.at<150?this.local:e,u=l.x*n.width,p=l.y*n.height,v=(m,w,k)=>typeof m=="number"&&Number.isFinite(m)?Math.max(0,Math.min(k,m)):w;if(this.image)s.drawImage(this.image,u-v(e.hotX,0,128),p-v(e.hotY,0,128),v(e.drawWidth,this.image.naturalWidth,128),v(e.drawHeight,this.image.naturalHeight,128));else{s.save(),s.translate(u,p);const m=v(e.pixelScale,1,4);s.scale(m,m),s.lineWidth=2,s.strokeStyle="white",s.fillStyle="black",s.beginPath(),e.shape==="text"?(s.moveTo(0,-8),s.lineTo(0,8),s.moveTo(-4,-8),s.lineTo(4,-8),s.moveTo(-4,8),s.lineTo(4,8)):(s.moveTo(0,0),s.lineTo(0,20),s.lineTo(5,15),s.lineTo(9,23),s.lineTo(13,21),s.lineTo(9,13),s.lineTo(17,13),s.closePath(),s.fill()),s.stroke(),s.restore()}n.style.visibility="visible",(d=n.parentElement)==null||d.classList.add("has-independent-cursor")}hide(){var r;const e=this.options.getCanvas();e&&(e.style.visibility="hidden",(r=e.parentElement)==null||r.classList.remove("has-independent-cursor"))}stop(){var e,r,n;this.stopped=!0,this.hide(),(e=this.remove)==null||e.call(this),(r=this.channel)==null||r.close(),this.frameCallback!==void 0&&((n=this.video)==null||n.cancelVideoFrameCallback(this.frameCallback)),this.image&&(this.image.src="")}}function ki(t,e){return t.kind==="pointer"&&t.action==="move"&&t.probe!==!0&&!e&&[t.x,t.y].every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0&&r<=1)}const Mr=()=>Object.assign(new Error("输入会话已切换"),{code:"ECANCELED"});class zn{constructor(e,r=1,n=()=>{}){this.stream=e,this.version=r,this.onError=n,this.sequence=0,this.barrier=0,this.index=0,this.pressed=!1,this.stopped=!1,this.visible=!0,this.pending=new Map,this.queue=[]}attach(e){if(!this.stream||this.stream.length<16||this.stream.length>64)return;const r=n=>{const s=n.channel;if(!this.stopped){if(s.label==="agentroam.input.v1"){if(this.channel){s.close();return}this.channel=s,s.onclose=()=>{this.channel===s&&(this.channel=void 0)}}else if(s.label==="agentroam.input.reliable.v1"&&this.version===2){if(this.reliable){s.close();return}this.reliable=s,s.onmessage=l=>this.receipt(l.data),s.onclose=()=>{if(this.reliable===s&&(this.reliable=void 0),!this.stopped)for(const l of this.pending.values())this.fallback(l)}}}};e.addEventListener("datachannel",r),this.remove=()=>e.removeEventListener("datachannel",r)}prepare(e){var s;if(this.cancelCheckpoint(),this.stopped||!this.stream)return{fast:!1,input:e};const r=++this.sequence;if(ki(e,this.pressed)&&this.visible&&((s=this.channel)==null?void 0:s.readyState)==="open"&&this.channel.bufferedAmount<16e3)try{return this.channel.send(JSON.stringify({kind:"move",stream:this.stream,sequence:r,barrier:this.barrier,x:e.x,y:e.y,mobile:e.mobile===!0})),{fast:!0,input:e}}catch{}return this.noteReliable(e,r),{fast:!1,input:{...e,direct:{stream:this.stream,sequence:r}}}}dispatch(e,r){var n;if(this.stopped)return Promise.reject(Mr());if(this.version!==2||!this.stream){const s=this.prepare(e);return s.fast?(this.scheduleCheckpoint(e,r),Promise.resolve(null)):r(s.input)}if(this.cancelCheckpoint(),ki(e,this.pressed)&&this.visible&&((n=this.channel)==null?void 0:n.readyState)==="open"&&this.channel.bufferedAmount<16e3){const s=++this.sequence;try{return this.channel.send(JSON.stringify({kind:"move",stream:this.stream,sequence:s,barrier:this.barrier,x:e.x,y:e.y,mobile:e.mobile===!0})),this.scheduleCheckpoint(e,r),Promise.resolve(null)}catch{}}return this.enqueue(e,r)}enqueue(e,r){if(this.stopped)return Promise.reject(Mr());if(this.pending.size>=16&&this.queue.length>=64)return Promise.reject(Object.assign(new Error("输入队列繁忙,请稍后重试"),{code:"EBUSY"}));const n=++this.sequence,s=++this.index;return this.noteReliable(e,n),new Promise((l,u)=>{this.queue.push({index:s,sequence:n,input:{...e,direct:{stream:this.stream,sequence:n,index:s}},fallback:r,resolve:l,reject:u}),this.pump()})}pump(){var e;for(;!this.stopped&&this.pending.size<16&&this.queue.length;){const r=this.queue.shift();this.pending.set(r.index,r);const n=JSON.stringify({kind:"request",stream:this.stream,index:r.index,sequence:r.sequence,input:r.input});if(((e=this.reliable)==null?void 0:e.readyState)==="open"&&new TextEncoder().encode(n).length<=12288&&this.reliable.bufferedAmount<64e3)try{r.timer=setTimeout(()=>this.fallback(r),750),this.reliable.send(n);continue}catch{}this.fallback(r)}}fallback(e){this.stopped||e.fallingBack||this.pending.get(e.index)!==e||(e.fallingBack=!0,clearTimeout(e.timer),Promise.resolve().then(()=>e.fallback(e.input)).then(r=>this.settle(e,r),r=>this.settle(e,null,r instanceof Error?r:new Error(String(r)))))}receipt(e){if(!(typeof e!="string"||e.length>32768))try{const r=JSON.parse(e),n=this.pending.get(r.index);if(!n||r.kind!=="result"||r.stream!==this.stream||r.sequence!==n.sequence)return;r.ok===!0?this.settle(n,{input:r.result}):r.ok===!1&&this.settle(n,null,Object.assign(new Error(String(r.error||"输入失败")),{code:r.code}))}catch{}}settle(e,r,n){this.pending.get(e.index)===e&&(clearTimeout(e.timer),this.pending.delete(e.index),n?(e.reject(n),this.stop()):(e.resolve(r),this.pump()))}noteReliable(e,r){e.kind==="pointer"&&e.action==="down"&&(this.pressed=!0),e.kind==="pointer"&&e.action==="up"&&(this.pressed=!1),this.barrier=r}scheduleCheckpoint(e,r){this.checkpoint=setTimeout(()=>{if(this.checkpoint=void 0,this.stopped||!this.visible||this.pressed)return;const n=this.version===2?0:++this.sequence;this.version!==2&&this.noteReliable(e,n),(this.version===2?this.enqueue(e,r):r({...e,direct:{stream:this.stream,sequence:n}})).then(l=>{var p;const u=(p=l==null?void 0:l.input)==null?void 0:p.error;u&&this.onError(new Error(u))}).catch(l=>{(l==null?void 0:l.code)!=="ECANCELED"&&this.onError(l)})},40)}cancelCheckpoint(){clearTimeout(this.checkpoint),this.checkpoint=void 0}setVisible(e){this.visible=e,e||this.cancelCheckpoint()}stop(){var e,r,n;this.stopped=!0,this.cancelCheckpoint(),(e=this.remove)==null||e.call(this);for(const s of[...this.pending.values(),...this.queue])clearTimeout(s.timer),s.reject(Mr());this.pending.clear(),this.queue=[],(r=this.channel)==null||r.close(),this.channel=void 0,(n=this.reliable)==null||n.close(),this.reliable=void 0}}class xi{constructor(){this.targetMs=40,this.sequence=-1,this.observedAt=-1/0,this.healthy=0}observe(e,r,n){if(!e||!e.visible||!Number.isSafeInteger(e.sequence)||e.sequence<=this.sequence||!Number.isFinite(n)||(e.intervalMs??0)<250||(e.intervalMs??1/0)>5e3||(e.decodedFrames??0)<3||!Number.isFinite(e.jitterBufferMs)||(this.sequence=e.sequence,n-this.observedAt<750))return;this.observedAt=n;const s=Math.max(20,Math.min(150,(Number.isFinite(r)?Math.max(0,r)*2:10)+20));return s>this.targetMs?(this.targetMs=Math.min(150,Math.max(s,this.targetMs+10)),this.healthy=0):(e.decodeMs??0)<25&&(e.droppedRatio??0)<.02?++this.healthy>=3&&(this.targetMs=Math.max(s,this.targetMs-10),this.healthy=0):this.healthy=0,Math.round(this.targetMs)}}class Fn{constructor(e){this.peer=e,this.policy=new xi,this.lowLatency=!1,this.applied=new Map,this.unsupported=new WeakSet}setLowLatency(e){e?this.applyTarget(20):this.lowLatency&&(this.restore(),this.policy=new xi),this.lowLatency=e}apply(e,r){var n;return(n=e.receiver)!=null&&n.visible?this.applyTarget(this.lowLatency?20:this.policy.observe(e.receiver,e.jitterMs,r)):(this.restore(),{playoutControl:!1})}applyTarget(e){const r=this.peer.getReceivers().find(l=>{var u;return((u=l.track)==null?void 0:u.kind)==="video"});if(!r||this.unsupported.has(r))return{playoutControl:!1};const n="jitterBufferTarget"in r?"jitterBufferTarget":"playoutDelayHint"in r?"playoutDelayHint":void 0;if(!n)return{playoutControl:!1};if(e!==void 0){const l=n==="jitterBufferTarget"?e:e/1e3,u=this.applied.has(r)?this.applied.get(r).original:r[n];try{if(r[n]!==l&&(r[n]=l),!Number.isFinite(r[n])||Math.abs(r[n]-l)>.001)throw new Error("Receiver ignored playout target");this.applied.set(r,{key:n,original:u,value:l})}catch{return this.unsupported.add(r),this.restoreReceiver(r),{playoutControl:!1}}}const s=this.applied.get(r);return s?{playoutControl:!0,playoutTargetMs:s.value*(s.key==="jitterBufferTarget"?1:1e3)}:{playoutControl:!1}}restoreReceiver(e){const r=this.applied.get(e);if(r){try{e[r.key]===r.value&&(r.key==="jitterBufferTarget"?e.jitterBufferTarget=r.original:e.playoutDelayHint=r.original)}catch{}this.applied.delete(e)}}restore(){for(const e of this.applied.keys())this.restoreReceiver(e)}stop(){this.restore()}}class Vn{constructor(e,r){this.peer=e,this.attemptId=r,this.pending=[],this.ready=!1,this.stopped=!1,this.credentials=[]}accepts(e){return!this.stopped&&(e===void 0||e===this.attemptId)}async answer(e){if(await this.peer.setRemoteDescription(e),this.stopped)return null;this.credentials=[...(e.sdp??"").matchAll(/^a=ice-ufrag:([^\r\n]+)$/gm)].map(s=>s[1].trim()),this.ready=!0;const r=this.pending;this.pending=[];for(const s of r)await this.addIceCandidate(s);if(this.stopped)return null;const n=await this.peer.createAnswer();return this.stopped?null:(await this.peer.setLocalDescription(n),this.stopped?null:this.peer.localDescription)}async addIceCandidate(e,r){if(this.accepts(r)){if(!this.ready){this.pending.length<64&&this.pending.push(e);return}e.usernameFragment&&!this.credentials.includes(e.usernameFragment)||await this.peer.addIceCandidate(e)}}stop(){this.stopped=!0,this.pending=[]}}var zt,Lr;class Bn{constructor(){hi(this,zt);this.points=new Map,this.origin=null,this.originDistance=0,this.moved=!1}reset(){this.points.clear(),this.origin=null,this.originDistance=0,this.moved=!1}down(e,r,n=!1){n&&this.reset(),this.points.size||(this.origin=r,this.moved=!1),this.points.set(e,r),this.points.size>1&&(this.moved=!0),this.originDistance=xr(this,zt,Lr).call(this)}move(e,r){const n=this.points.get(e);if(!n)return null;const s=[...this.points.values()];if(this.points.set(e,r),this.origin&&Math.hypot(r.x-this.origin.x,r.y-this.origin.y)>8&&(this.moved=!0),this.points.size===1)return this.moved?{scale:1,distanceRatio:1,from:n,to:r,pointers:1}:null;if(this.points.size!==2)return null;const l=[...this.points.values()],u=m=>({x:(m[0].x+m[1].x)/2,y:(m[0].y+m[1].y)/2}),p=m=>Math.hypot(m[0].x-m[1].x,m[0].y-m[1].y),v=p(s),d=this.originDistance>0?p(l)/this.originDistance:1;return{scale:v>0?p(l)/v:1,distanceRatio:d,from:u(s),to:u(l),pointers:this.points.size}}up(e,r,n=!1){if(!this.points.has(e))return!1;const s=!n&&!this.moved&&this.points.size===1&&!!this.origin&&Math.hypot(r.x-this.origin.x,r.y-this.origin.y)<=8;return this.points.delete(e),n&&(this.moved=!0),this.points.size===2&&(this.originDistance=xr(this,zt,Lr).call(this)),this.points.size||this.reset(),s}}zt=new WeakSet,Lr=function(){const e=[...this.points.values()];return e.length>=2?Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y):0};function On(t,e,r){const n=Math.max(t.top,e.top-r.top),s=Math.max(t.left,e.left-r.left),l=Math.min(t.top+t.height,e.top+e.height-r.top),u=Math.min(t.left+t.width,e.left+e.width-r.left);return{top:n,left:s,height:Math.max(0,l-n),width:Math.max(0,u-s)}}function Ci(t){const e=t.visualViewport;return{top:(e==null?void 0:e.offsetTop)??0,left:(e==null?void 0:e.offsetLeft)??0,width:(e==null?void 0:e.width)??t.innerWidth,height:(e==null?void 0:e.height)??t.innerHeight}}function Un(t,e=window,r=!1){let n=null,s=null;try{e.parent!==e&&e.parent.location.origin===e.location.origin&&(n=e.parent,s=e.frameElement)}catch{}let l=null,u=null;const p=()=>{let k=Ci(e);if(n&&s&&!e.document.fullscreenElement){const E={top:0,left:0,width:e.innerWidth,height:e.innerHeight};k=r?E:On(E,Ci(n),s.getBoundingClientRect())}for(const[E,W]of Object.entries(k))t.style.setProperty(`--browser-live-${E}`,`${W}px`)},v=()=>{l!==null&&e.cancelAnimationFrame(l),l=e.requestAnimationFrame(()=>{l=null,p()}),u!==null&&e.clearTimeout(u),u=e.setTimeout(p,250)},d=[e,e.document];e.visualViewport&&d.push(e.visualViewport),n&&(d.push(n),d.push(n.document),n.visualViewport&&d.push(n.visualViewport));const m=["resize","scroll","orientationchange","pageshow","visibilitychange","fullscreenchange","transitionend"];for(const k of d)for(const E of m)k.addEventListener(E,v);const w=s&&typeof ResizeObserver<"u"?new ResizeObserver(v):null;return s&&(w==null||w.observe(s)),p(),()=>{for(const k of d)for(const E of m)k.removeEventListener(E,v);l!==null&&e.cancelAnimationFrame(l),u!==null&&e.clearTimeout(u),w==null||w.disconnect();for(const k of["top","left","width","height"])t.style.removeProperty(`--browser-live-${k}`)}}const ee=t=>typeof t=="number"&&Number.isFinite(t)?t:void 0;function Wn(t,e){var r;try{const n=(r=t==null?void 0:t.getVideoPlaybackQuality)==null?void 0:r.call(t);if(n&&Number.isFinite(n.totalVideoFrames)&&Number.isFinite(n.droppedVideoFrames))return Math.max(0,n.totalVideoFrames-n.droppedVideoFrames)}catch{}return ee(t==null?void 0:t.webkitDecodedFrameCount)??ee(e)}function $n(t){var r,n,s;const e=new Set;for(const l of t??[]){if(((r=l.mimeType)==null?void 0:r.toLowerCase())!=="video/h264")continue;const u=(s=(n=/(?:^|;)\s*profile-level-id=([0-9a-f]{6})/i.exec(l.sdpFmtpLine??""))==null?void 0:n[1])==null?void 0:s.toLowerCase();u!=null&&u.startsWith("64")&&e.add("high"),(!u||u.startsWith("42"))&&e.add("baseline")}return[...e]}function Hn(){var e;if(typeof RTCRtpReceiver>"u"||typeof RTCRtpReceiver.getCapabilities!="function")return["baseline"];const t=$n((e=RTCRtpReceiver.getCapabilities("video"))==null?void 0:e.codecs);return t.length?t:["baseline"]}function Kn(t){var r,n;const e=(n=(r=/(?:^|;)\s*profile-level-id=([0-9a-f]{6})/i.exec(typeof t=="string"?t:""))==null?void 0:r[1])==null?void 0:n.toLowerCase();if(e!=null&&e.startsWith("64"))return"high";if(!e||e.startsWith("42"))return"baseline"}function Xn(t,e,r=Date.now(),n){const l=[...typeof t.values=="function"?t.values():t],u=l.find(j=>j.type==="inbound-rtp"&&(j.kind==="video"||j.mediaType==="video"));if(!u)return null;const p=l.find(j=>j.id===u.codecId),v=l.find(j=>j.type==="candidate-pair"&&j.state==="succeeded"&&(j.nominated===!0||j.selected===!0)),d=l.find(j=>j.id===(v==null?void 0:v.localCandidateId)),m=l.find(j=>j.id===(v==null?void 0:v.remoteCandidateId)),w=[d==null?void 0:d.candidateType,m==null?void 0:m.candidateType].map(String),k=["relay","srflx","prflx","host"].find(j=>w.includes(j))??void 0,E=ee(u.bytesReceived)??0,W=ee(u.packetsReceived)??0,I=ee(u.packetsLost)??0,q=ee(u.framesDropped)??0,oe=e?Math.max(1,r-e.at):0,Y=e?Math.max(0,W-e.packetsReceived):0,V=e?Math.max(0,I-e.packetsLost):0,B=e?Math.max(0,q-e.framesDropped):0,O=ee(v==null?void 0:v.currentRoundTripTime),R=ee(u.jitter),$=typeof u.decoderImplementation=="string"?u.decoderImplementation.slice(0,120):void 0,b=typeof u.powerEfficientDecoder=="boolean"?u.powerEfficientDecoder:void 0,te=$!==void 0||b!==void 0?{implementation:$,powerEfficient:b,acceleration:b===!0?"hardware":b===!1?"software":"unknown"}:void 0,L=ee(u.framesDecoded),H=ee(u.totalDecodeTime),ae=e!==null&&L!==void 0&&e.framesDecoded!==void 0&&L>=e.framesDecoded&&q>=e.framesDropped&&r>e.at&&r-e.at<=5e3,_=ae?L-e.framesDecoded:void 0,N=ae&&_>0&&H!==void 0&&(e==null?void 0:e.totalDecodeTime)!==void 0&&H>=e.totalDecodeTime?(H-e.totalDecodeTime)*1e3/_:void 0,S=((e==null?void 0:e.sequence)??0)+1,J=ee(u.jitterBufferEmittedCount),Le=e&&J!==void 0&&e.jitterBufferEmittedCount!==void 0&&r>e.at&&r-e.at<=5e3?J-e.jitterBufferEmittedCount:0,Ae=j=>{const ye=ee(u[j]),C=e==null?void 0:e[j];if(Le<=0||ye===void 0||C===void 0||ye<C)return;const be=(ye-C)*1e3/Le;return Number.isFinite(be)&&be>=0&&be<=6e4?be:void 0},$e={jitterBufferMs:Ae("jitterBufferDelay"),jitterBufferTargetMs:Ae("jitterBufferTargetDelay"),jitterBufferMinimumMs:Ae("jitterBufferMinimumDelay")},je={...n?{receiver:{sequence:S,visible:n.visible,viewport:n.viewport,width:ee(u.frameWidth),height:ee(u.frameHeight),...Object.fromEntries(Object.entries($e).filter(([,j])=>j!==void 0)),...ae?{intervalMs:r-e.at,decodedFrames:_,...N!==void 0?{decodeMs:N}:{},..._+B>0?{droppedRatio:B/(_+B)}:{},...Number.isFinite(n.presentationDelayMs)?{presentationDelayMs:n.presentationDelayMs}:{}}:{}}}:{},codec:typeof(p==null?void 0:p.mimeType)=="string"?p.mimeType.replace(/^video\//i,""):void 0,codecProfile:Kn(p==null?void 0:p.sdpFmtpLine),decoder:te,width:ee(u.frameWidth),height:ee(u.frameHeight),fps:ee(u.framesPerSecond),rttMs:O!==void 0?O*1e3:void 0,jitterMs:R!==void 0?R*1e3:void 0,lossRate:Y+V>0?V/(Y+V):0,droppedFrames:B,receiveBitrate:e?Math.max(0,Math.round((E-e.bytesReceived)*8e3/oe)):void 0,availableBitrate:ee(v==null?void 0:v.availableIncomingBitrate),candidateType:k,protocol:(d==null?void 0:d.protocol)==="tcp"||(m==null?void 0:m.protocol)==="tcp"?"tcp":v?"udp":void 0};for(const j of Object.keys(je))je[j]===void 0&&delete je[j];return{sample:je,cursor:{at:r,bytesReceived:E,packetsReceived:W,packetsLost:I,framesDropped:q,sequence:S,...H!==void 0?{totalDecodeTime:H}:{},...L!==void 0?{framesDecoded:L}:{},...Object.fromEntries(["jitterBufferDelay","jitterBufferTargetDelay","jitterBufferMinimumDelay","jitterBufferEmittedCount"].map(j=>[j,ee(u[j])]).filter(([,j])=>j!==void 0))}}}function Yn(t){if(!t)return null;const e=[t.candidateType==="relay"?"TURN 中继":t.candidateType?"P2P 直连":null];return t.codec&&e.push(t.codec),t.width&&t.height&&e.push(`${t.width}x${t.height}${t.fps?`@${Math.round(t.fps)}`:""}`),t.receiveBitrate&&e.push(`${(t.receiveBitrate/1e6).toFixed(1)}Mbps`),t.rttMs!==void 0&&e.push(`${Math.round(t.rttMs)}ms`),e.filter(Boolean).join(" · ")||null}function Zn(t){const e=t==null?void 0:t.decoder;if(!e)return null;const r=e.acceleration==="hardware"?"硬件解码":e.acceleration==="software"?"软件解码":"解码方式未知";return e.implementation?`${r} · ${e.implementation}`:r}const _n={"agent-controlled":"Agent 操作中","handoff-requested":"正在交接","user-controlled":"你正在操作","return-requested":"正在归还",resyncing:"Agent 正在同步页面"},Gn={smooth:"流畅",hd:"高清",original:"原画"};function Sr(t){return t==="desktop"?"桌面屏幕":t==="ego-browser"?"ego-browser":"内置 Browser"}function Ri(t,e,r){var n,s;return t||(((n=e.find(l=>l.agentSessionId===r))==null?void 0:n.id)??((s=e[0])==null?void 0:s.id)??null)}function Jn(t){return!!(t&&t.availability==="ready"&&!t.isController&&!t.controlledByAnotherViewer&&(t.state==="agent-controlled"||t.state==="handoff-requested"))}function ji(t){return(t==null?void 0:t.backend)==="desktop"&&t.platform==="darwin"?"Meta":"Control"}function Ei(t){return[t.altKey?"Alt":"",t.ctrlKey?"Control":"",t.metaKey?"Meta":"",t.shiftKey?"Shift":""].filter(Boolean)}function Qn(t){const e=new Uint8Array(t.length*2),r=new DataView(e.buffer);for(let s=0;s<t.length;s+=1){const l=Math.max(-1,Math.min(1,t[s]));r.setInt16(s*2,l<0?l*32768:l*32767,!0)}let n="";for(let s=0;s<e.length;s+=8192)n+=String.fromCharCode(...e.subarray(s,s+8192));return btoa(n)}function es(t,e){const r=atob(t),n=Math.floor(r.length/2/e),s=Array.from({length:e},()=>new Float32Array(n));for(let l=0;l<n;l+=1)for(let u=0;u<e;u+=1){const p=(l*e+u)*2,v=r.charCodeAt(p)|r.charCodeAt(p+1)<<8;s[u][l]=(v&32768?v-65536:v)/32768}return s}async function ts(t){const e=[],r=()=>{for(const s of e.splice(0))s()};let n=!1;t.addEventListener("abort",r);try{if(t.aborted)return null;const s=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1});if(e.push(()=>{for(const k of s.getTracks())k.stop()}),t.aborted)return null;const l=window.AudioContext,u=new l({latencyHint:"interactive"});e.push(()=>{u.close().catch(()=>{})});const p=new l({latencyHint:"interactive"});if(e.push(()=>{p.close().catch(()=>{})}),await Promise.all([u.resume(),p.resume()]),t.aborted)return null;const v=p.createGain();v.connect(p.destination);const d=u.createMediaStreamSource(s),m=u.createScriptProcessor(2048,1,1),w=u.createGain();return w.gain.value=0,d.connect(m),m.connect(w),w.connect(u.destination),n=!0,{stream:s,microphoneContext:u,remoteContext:p,remoteGain:v,source:d,processor:m,sink:w,dispose:r}}finally{t.removeEventListener("abort",r),n||r()}}function rs(t,e){return t?t.state==="user-controlled"&&t.isController===!0&&e.state==="handoff-requested"||t.state==="agent-controlled"&&e.state==="return-requested":!1}const is=2;function ns(t,e,r,n,s=.02){if(!t||!e||!e.width||!e.height)return!1;const l=t.x/e.width-s,u=t.y/e.height-s,p=(t.x+t.w)/e.width+s,v=(t.y+t.h)/e.height+s;return r>=l&&r<=p&&n>=u&&n<=v}function ss(t,e,r=is){const n={deltaX:Math.round(t.x-e.x),deltaY:Math.round(t.y-e.y)};return Math.abs(n.deltaX)<r&&Math.abs(n.deltaY)<r?null:n}function fs({open:t,active:e=!0,embedded:r=!1,showPlayoutExperiment:n=!1,agentSessionId:s,sessionDesktop:l,onClose:u,onFullscreenChange:p}){const v=h.useContext(Ki),d=typeof window>"u"?void 0:window.browserLiveApi,m=l!==void 0,w=(l==null?void 0:l.expanded)===!0,k=m&&t&&e,[E,W]=h.useState(null);h.useEffect(()=>{var x;const i=(x=d==null?void 0:d.readDesktopLockState)==null?void 0:x.bind(d);if(!k||!i){W(null);return}const a=new AbortController;let o;const y=async()=>{const g=await i(a.signal).catch(()=>null);a.signal.aborted||(W(g),o=setTimeout(y,2e3))};return y(),()=>{a.abort(),clearTimeout(o)}},[d,k]);const I=h.useRef(u);I.current=u;const q=h.useRef(null),oe=h.useRef(null);h.useLayoutEffect(()=>{if(!(!t||r||!q.current))return Un(q.current,window,document.body.dataset.remoteDesktop==="1")},[t,r,w]);const[Y,V]=h.useState(!1),B=m?w:Y;h.useEffect(()=>{p==null||p(B)},[B,p]);const O=async()=>{const i=oe.current;if(i){if(B){document.fullscreenElement===i&&await document.exitFullscreen().catch(()=>{}),V(!1);return}V(!0),i.requestFullscreen&&await i.requestFullscreen().catch(()=>{})}};h.useEffect(()=>{if(!t){V(!1);return}if(m&&!w)return;const i=oe.current,a=()=>V(document.fullscreenElement===i),o=y=>{y.key==="Escape"&&(document.fullscreenElement===i||i!=null&&i.classList.contains("is-fullscreen"))&&(y.preventDefault(),y.stopPropagation(),document.fullscreenElement===i&&document.exitFullscreen().catch(()=>{}),m?I.current():V(!1))};return document.addEventListener("fullscreenchange",a),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("keydown",o,!0),i&&document.fullscreenElement===i&&document.exitFullscreen().catch(()=>{})}},[t,m,w]);const[R,$]=h.useState([]),[b,te]=h.useState(null),[L,H]=h.useState(null),[ae,_]=h.useState("hd"),[N,S]=h.useState("balanced"),[J,Le]=h.useState(!1),[Ae,$e]=h.useState(!1),je=h.useRef(!1),[j,ye]=h.useState(null),[C,be]=h.useState(null),[Je,yt]=h.useState(!1),[qe,De]=h.useState(0),[Fe,D]=h.useState(null),[Ee,we]=h.useState(!1),[He,Ar]=h.useState(null),[Ti,bt]=h.useState(!1),[wt,it]=h.useState(""),[nt,qr]=h.useState(!1),[Dr,st]=h.useState(null),[ze,gt]=h.useState(1),zr=h.useRef(ze);zr.current=ze;const[U,kt]=h.useState(!1),[ot,Ii]=h.useState({width:0,height:0}),pe=h.useRef(null),at=h.useRef(null),Vt=h.useRef(!1),Ke=h.useRef(null),Xe=h.useRef(new Bn),xt=h.useRef(ze),Bt=h.useRef(null);h.useLayoutEffect(()=>{xt.current=ze;const i=Bt.current,a=pe.current,o=a==null?void 0:a.querySelector(".browser-live-image-hit-area");if(!i||!a||!o)return;const y=o.getBoundingClientRect();a.scrollLeft+=y.left+i.x*y.width-i.clientX,a.scrollTop+=y.top+i.y*y.height-i.clientY,Bt.current=null},[ze]);const Ye=h.useRef(null),[Me,Ot]=h.useState(!1),ct=h.useRef(!1),Ut=h.useRef(0),Ze=h.useRef(null);h.useEffect(()=>{t||(bt(!1),it(""),st(null))},[t]);const[Pi,Ct]=h.useState(!1),Rt=h.useRef(null),Wt=h.useRef(0),Se=h.useRef("none"),ue=h.useRef(null),ur=h.useRef(null),[Fr,$t]=h.useState(null),[jt,Ni]=h.useState(!1),Vr=h.useRef(null),[Te,Ie]=h.useState("off"),[Br,Et]=h.useState(null),Qe=h.useRef(null),re=h.useRef(null),ie=h.useRef(null),Ht=h.useRef(0),Ve=h.useRef(null),Or=h.useRef(null),Ur=h.useRef(null),_e=h.useRef(null),me=h.useRef(null),he=h.useRef(null),lt=h.useRef(null),et=h.useRef(new un),Mt=h.useRef(!1),[Wr,Kt]=h.useState(null),[Be,St]=h.useState("idle"),[Xt,$r]=h.useState(!1),[Yt,Hr]=h.useState(!1),Zt=h.useRef(!1),_t=h.useRef(!1),Tt=h.useRef(null),hr=h.useRef(null),dr=h.useRef(null),fr=h.useRef(null),pr=h.useRef(null),Gt=h.useRef(null),ut=h.useRef(null),ht=h.useRef(0),Kr=h.useRef(0),It=h.useRef(0),Jt=h.useRef(null);h.useLayoutEffect(()=>{ct.current=Me,Me&&Ct(!1)},[Me]);const f=h.useMemo(()=>R.find(i=>i.id===b)??null,[b,R]),z=(f==null?void 0:f.backend)==="desktop",Xr=z&&(f==null?void 0:f.platform)==="win32",Li=(f==null?void 0:f.availability)==="unavailable"&&(f==null?void 0:f.capabilityErrorCode)==="desktop-locked",P=!m&&(f==null?void 0:f.isController)&&f.state==="user-controlled",dt=f==null?void 0:f.audioCapabilities,ft=!!(dt!=null&&dt.fullDuplex&&dt.systemAudio&&dt.microphonePlayback&&dt.selfPlaybackExclusion),tt=!!(f!=null&&f.online&&f.availability==="ready"&&!f.controlledByAnotherViewer),mr=!m&&Jn(f),Pt=Ee||(f==null?void 0:f.state)==="handoff-requested";h.useEffect(()=>{if(!t||!d||!b||m){$t(null);return}let i=!0;const a=()=>{const y=performance.now();d.request("browser:ping",{t:y}).then(()=>{i&&$t(Math.round(performance.now()-y))}).catch(()=>{i&&$t(null)})};a();const o=window.setInterval(a,3e3);return()=>{i=!1,window.clearInterval(o),$t(null)}},[d,t,b,m]),h.useEffect(()=>{const i=navigator;if(!P||!i.wakeLock)return;let a=!1,o=null;return i.wakeLock.request("screen").then(y=>{if(a){y.release();return}o=y,Vr.current=y}).catch(()=>{}),()=>{a=!0,o==null||o.release().catch(()=>{}),Vr.current=null}},[P]);const pt=(C==null?void 0:C.viewport)??(f==null?void 0:f.viewport),vr=pt&&ot.width&&ot.height?Math.min(ot.width/pt.width,ot.height/pt.height):null;h.useEffect(()=>{var i;gt(1),kt(!1),at.current=null,Xe.current.reset(),Bt.current=null,Ze.current=null,(i=pe.current)==null||i.scrollTo(0,0)},[t,b]),h.useEffect(()=>{const i=pe.current;if(!t||!i)return;const a=new ResizeObserver(()=>{Ii({width:i.clientWidth,height:i.clientHeight})});return a.observe(i),()=>a.disconnect()},[t,z,w]),h.useEffect(()=>{const i=pe.current;if(!t||!i||!P||U)return;const a=o=>o.preventDefault();return i.addEventListener("wheel",a,{passive:!1}),()=>i.removeEventListener("wheel",a)},[t,P,U]);const Ai=h.useCallback(()=>{Ut.current+=1;const i=Ye.current;i&&(Me?(i.blur(),Ot(!1)):(Cr.flushSync(()=>kt(!1)),i.focus({preventScroll:!0})))},[Me]);h.useEffect(()=>{var i;(!e||!P||U)&&(Ut.current+=1,(i=Ye.current)==null||i.blur(),Ot(!1))},[e,P,U,Me]);const Qt=h.useCallback(i=>{const a=(C==null?void 0:C.viewport)??(f==null?void 0:f.viewport),o=pe.current,y=o==null?void 0:o.querySelector(".browser-live-image-hit-area");if(!i||!a||!o||!y)return;const x=y.getBoundingClientRect(),g=o.getBoundingClientRect(),T=x.top+i.y/a.height*x.height,M=T+i.h/a.height*x.height,A=16;T>=g.top+A&&M<=g.bottom-A||(o.scrollTop+=T-(g.top+Math.max(A,g.height*.3)))},[C==null?void 0:C.viewport,f==null?void 0:f.viewport]);h.useEffect(()=>{if(!Me||!Ze.current)return;const i=window.setTimeout(()=>Qt(Ze.current),420);return()=>window.clearTimeout(i)},[Me,ot.width,ot.height,Qt]);const yr=h.useCallback((i,a=!1)=>{var y;const o=i&&typeof i.input=="object"&&i.input!==null?i.input:i;if(typeof(o==null?void 0:o.editable)=="boolean"){if(!o.editable&&o.kind==="control"){Ze.current=null;return}if(o.editable){const x=o.bounds,g=x&&["x","y","w","h"].every(T=>typeof x[T]=="number")?{x:x.x,y:x.y,w:x.w,h:x.h}:null;g&&(Ze.current=g),a&&!ct.current&&!window.matchMedia("(pointer: coarse)").matches&&((y=Ye.current)==null||y.focus({preventScroll:!0})),ct.current?Qt(g??Ze.current):Ct(!0)}else Ze.current=null}},[Qt]),Pe=h.useCallback((i=!0)=>{var x,g,T,M,A;(x=Jt.current)==null||x.abort(),Jt.current=null;const a=Tt.current;Tt.current=null;for(const K of(a==null?void 0:a.getTracks())??[])K.stop();(g=dr.current)==null||g.disconnect(),(T=fr.current)==null||T.disconnect(),(M=pr.current)==null||M.disconnect(),dr.current=null,fr.current=null,pr.current=null;const o=hr.current;hr.current=null,o&&o.close().catch(()=>{});const y=Gt.current;Gt.current=null,(A=ut.current)==null||A.disconnect(),ut.current=null,ht.current=0,It.current=0,y&&y.close().catch(()=>{}),Zt.current=!1,_t.current=!1,$r(!1),Hr(!1),St("idle"),i&&d&&b&&d.request("browser:webrtc",{sessionId:b,data:{kind:"audio-stop"}}).catch(()=>{})},[d,b]),Yr=h.useCallback(i=>{var xe;if(_t.current||typeof i.data!="string")return;const a=Gt.current,o=Number(i.sampleRate),y=Number(i.channels);if(!a||!Number.isSafeInteger(o)||!Number.isSafeInteger(y)||y<1||y>2)return;const x=es(i.data,y);if(!((xe=x[0])!=null&&xe.length))return;const g=a.createBuffer(y,x[0].length,o);for(let de=0;de<y;de+=1)g.copyToChannel(x[de],de);const T=a.createBufferSource();T.buffer=g;const M=ut.current;if(!M)return;T.connect(M);const A=a.currentTime,K=Math.max(A+.02,ht.current);ht.current=K-A>.35?A+.02:K,T.start(ht.current),ht.current+=g.duration},[]),qi=h.useCallback(async()=>{var a;if(!d||!b||!P||!ft||document.visibilityState!=="visible")return;const i=new AbortController;(a=Jt.current)==null||a.abort(),Jt.current=i,D(null),St("starting");try{const o=await ts(i.signal);if(!o||i.signal.aborted||document.visibilityState!=="visible"){o==null||o.dispose();return}const{stream:y,microphoneContext:x,remoteContext:g,remoteGain:T,source:M,processor:A,sink:K}=o;Tt.current=y,hr.current=x,dr.current=M,fr.current=A,pr.current=K,Gt.current=g,ut.current=T,Kr.current=0,A.onaudioprocess=xe=>{if(i.signal.aborted||Zt.current||!Tt.current||!d||!b||It.current>=4)return;const de=new Float32Array(xe.inputBuffer.getChannelData(0));It.current+=1,d.request("browser:webrtc",{sessionId:b,data:{kind:"audio-microphone",sequence:++Kr.current,sampleRate:x.sampleRate,channels:1,data:Qn(de)}}).catch(()=>{}).finally(()=>{It.current=Math.max(0,It.current-1)})},await d.request("browser:webrtc",{sessionId:b,data:{kind:"audio-start"}})}catch(o){if(i.signal.aborted)return;Pe(!1),St("failed"),D(o instanceof Error?o.message:"无法开始语音")}},[d,P,b,Pe,ft]);h.useEffect(()=>{t&&e&&P&&ft||Be!=="idle"&&Pe(!0)},[e,Be,P,t,Pe,ft]),h.useEffect(()=>{const i=()=>{document.visibilityState!=="visible"&&Be!=="idle"&&Pe(!0)};return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[Be,Pe]),h.useEffect(()=>()=>Pe(!0),[Pe]);const Zr=h.useMemo(()=>[{urls:"stun:stun.l.google.com:19302"}],[]),_r=h.useCallback(async(i,a,o,y,x,g)=>{var M,A,K,xe,de,Ge;if(!d||!i||!a)return;let T;try{const Ce=re.current;re.current=null,(M=ie.current)==null||M.stop(),ie.current=null,(A=_e.current)==null||A.stop(),(K=me.current)==null||K.stop(),me.current=null,(xe=he.current)==null||xe.stop(),he.current=null,(de=lt.current)==null||de.stop(),Ce==null||Ce.close();let X=re.current;if(!X){X=new RTCPeerConnection({iceServers:o!=null&&o.length?o:Zr}),T=new Vn(X,g),ie.current=T;const se=new gi({getVideo:()=>Ve.current,getCanvas:()=>Or.current});se.attach(X);const fe=new Dn({getVideo:()=>Ve.current,getCanvas:()=>Ur.current});fe.attach(X),(Ge=_e.current)==null||Ge.stop(),_e.current=fe;const mt=new zn(y,x===2?2:1,ce=>D(ce.message));mt.setVisible(document.visibilityState!=="hidden"),mt.attach(X),me.current=mt,he.current=new Fn(X),lt.current=se,X.onicecandidate=ce=>{!ce.candidate||re.current!==X||d.request("browser:webrtc",{sessionId:i,data:{kind:"ice",candidate:ce.candidate.toJSON(),...g?{attemptId:g}:{}}}).catch(()=>{})},X.ontrack=ce=>{var le;if(re.current!==X)return;ce.track.kind==="video"&&je.current&&document.visibilityState!=="hidden"&&((le=he.current)==null||le.setLowLatency(!0));const We=Ve.current;We&&ce.streams[0]&&(We.srcObject=ce.streams[0],We.play().catch(()=>{}))},X.onconnectionstatechange=()=>{if(re.current!==X)return;const ce=X==null?void 0:X.connectionState;ce==="connected"?Ie("live"):(ce==="failed"||ce==="disconnected"||ce==="closed")&&Ie("failed")},re.current=X}const ne=await T.answer(a);if(!ne||ie.current!==T)return;Ie("connecting"),await d.request("browser:webrtc",{sessionId:i,data:{kind:"answer",sdp:ne.toJSON(),...g?{attemptId:g}:{}}})}catch(Ce){if(T?ie.current!==T:ie.current!==null)return;d.request("browser:webrtc",{sessionId:i,data:{kind:"viewer-trace",event:"negotiation-failed",attemptId:g,error:Ce instanceof Error?Ce.message.slice(0,300):"WebRTC negotiation failed"}}).catch(()=>{}),Ie("failed")}},[d,Zr]),Gr=h.useCallback((i,a)=>{if(a){if(a.kind==="quality-state"&&["smooth","hd","original"].includes(String(a.quality))){_(String(a.quality)),ye(null),typeof a.error=="string"&&D(a.error);return}if(a.kind==="audio-system"){Yr(a);return}if(a.kind==="audio-state"){const o=String(a.state);["idle","starting","live","failed"].includes(o)&&St(o),typeof a.error=="string"&&(D(a.error),Pe(!1),St("failed"));return}if(a.kind==="offer"){typeof a.warning=="string"&&D(a.warning),_r(i,a.sdp,Array.isArray(a.iceServers)?a.iceServers:void 0,typeof a.inputStream=="string"?a.inputStream:void 0,typeof a.inputVersion=="number"?a.inputVersion:void 0,typeof a.attemptId=="string"?a.attemptId:void 0);return}if(a.kind==="ice"){const o=a.candidate,y=ie.current;y&&o&&y.addIceCandidate(o,a.attemptId).catch(()=>{});return}if(a.kind==="state"){if(a.attemptId!==void 0&&ie.current&&!ie.current.accepts(a.attemptId))return;const o=String(a.state);o==="connected"?(Ie("live"),Le(a.maxFrameRate===60),a.maxFrameRate!==60&&S("balanced")):(o==="failed"||o==="disconnected"||o==="closed")&&Ie("failed")}}},[_r,Yr,Pe]),[Oe,Jr]=h.useState(null);h.useEffect(()=>{if(!C){Jr(null);return}const i=typeof C.data=="string"?`data:${C.mime};base64,${C.data}`:URL.createObjectURL(new Blob([C.data],{type:C.mime}));let a=!1,o=!1;const y=new Image;return y.src=i,y.decode().then(()=>{a||(o=!0,Jr(i))}).catch(()=>{}),()=>{a=!0,!o&&i.startsWith("blob:")&&URL.revokeObjectURL(i)}},[C]),h.useEffect(()=>()=>{Oe!=null&&Oe.startsWith("blob:")&&URL.revokeObjectURL(Oe)},[Oe]);const ge=h.useCallback(i=>{m&&(i.id!==bi||i.backend!=="desktop")||($(a=>{const o=a.findIndex(x=>x.id===i.id);if(o>=0&&rs(a[o],i))return a;if(o<0)return[i,...a];const y=[...a];return y[o]=i,y.sort((x,g)=>g.updatedAt-x.updatedAt)}),te(a=>m?i.id:Ri(a,[i],s)),we(!1))},[s,m]),er=h.useCallback(async()=>{if(!(!d||!t)){yt(!0),D(null);try{const i=await d.request("browser:list"),a=m?i.sessions.filter(o=>o.id===bi&&o.backend==="desktop"):i.sessions;$(a),te(o=>{var x;const y=o&&a.some(g=>g.id===o)?o:null;return m?((x=a[0])==null?void 0:x.id)??null:Ri(y,a,s)}),b&&!m&&await d.request("browser:watch",{sessionId:b}).then(o=>ge(o.session)).catch(()=>{}),De(o=>o+1)}catch(i){D(i instanceof Error?i.message:"无法读取浏览器会话")}finally{yt(!1)}}},[s,d,ge,t,b,m]);h.useEffect(()=>{if(!(!t||!d))return er(),d.onEvent(i=>{var a,o,y,x,g,T;if(i.type==="browser:connection"){(a=_e.current)==null||a.stop(),(o=me.current)==null||o.stop(),me.current=null,(y=he.current)==null||y.stop(),he.current=null,(x=lt.current)==null||x.stop(),(g=re.current)==null||g.close(),re.current=null,(T=ie.current)==null||T.stop(),ie.current=null,Ie("off"),we(!1),$([]),be(null),i.connected===!0?er():D("远程连接已断开,正在重新连接");return}if(i.type==="browser:frame"){if(i.sessionDesktop===!0!==m||m&&!k)return;const M=i;M.sessionId===b&&be(M);return}if(i.type==="browser:webrtc"){if(m)return;const M=i.data;i.sessionId===b&&Gr(b,M);return}if(i.session&&typeof i.session=="object"&&ge(i.session),i.type==="browser:closed"){const M=i.session;M&&($(A=>A.filter(K=>K.id!==M.id)),M.id===b&&(be(null),te(null)))}})},[d,Gr,ge,t,er,b,m,k]),h.useEffect(()=>{if(!(!t||!d||!b||m))return be(null),D(null),Mt.current=!1,Kt(null),d.request("browser:watch",{sessionId:b}).then(i=>ge(i.session)).catch(i=>D(i instanceof Error?i.message:"无法观看浏览器")),()=>{d.request("browser:unwatch").catch(()=>{})}},[d,ge,t,b,m]),h.useEffect(()=>{if(!k||!d||!b)return;let i=!0;return d.request("browser:desktop-watch",{sessionId:b,expanded:w}).then(({session:a})=>{i&&(ge(a),D(null))}).catch(a=>{i&&D(a instanceof Error?a.message:"无法观看桌面")}),()=>{i=!1}},[k,d,b,w,qe,ge]),h.useEffect(()=>{if(!(!k||!d||!b))return()=>{d.request("browser:desktop-unwatch").catch(()=>{})}},[k,d,b]),h.useEffect(()=>{m&&!k&&be(null)},[m,k]),h.useEffect(()=>{var i,a,o,y,x,g,T,M,A,K,xe,de;if(!t||!d||!P||!z||!b){Mt.current=!1,Kt(null),Ht.current=0,(i=_e.current)==null||i.stop(),(a=me.current)==null||a.stop(),me.current=null,(o=he.current)==null||o.stop(),he.current=null,(y=lt.current)==null||y.stop(),(x=re.current)==null||x.close(),re.current=null,(g=ie.current)==null||g.stop(),ie.current=null,Ve.current&&(Ve.current.srcObject=null),Qe.current=null,Et(null),Ie("off");return}return(T=_e.current)==null||T.stop(),(M=me.current)==null||M.stop(),me.current=null,(A=he.current)==null||A.stop(),he.current=null,(K=lt.current)==null||K.stop(),(xe=re.current)==null||xe.close(),re.current=null,(de=ie.current)==null||de.stop(),ie.current=null,Qe.current=null,Et(null),Ie("connecting"),Le(!1),et.current.begin(performance.now()),d.request("browser:webrtc",{sessionId:b,data:{kind:"start",inputVersion:2,receiverProfiles:Hn(),...N!=="balanced"?{motionMode:N}:{},...gi.supported()?{compoundVersion:1}:{}}}).catch(()=>Ie("failed")),()=>{var Ge,Ce,X,ne,se,fe;(Ge=_e.current)==null||Ge.stop(),(Ce=me.current)==null||Ce.stop(),me.current=null,(X=he.current)==null||X.stop(),he.current=null,(ne=lt.current)==null||ne.stop(),(se=re.current)==null||se.close(),re.current=null,(fe=ie.current)==null||fe.stop(),ie.current=null,Ve.current&&(Ve.current.srcObject=null),Qe.current=null,Et(null),d.request("browser:webrtc",{sessionId:b,data:{kind:"stop"}}).catch(()=>{})}},[d,P,z,t,b,qe,N]),h.useEffect(()=>{if(!t||!P||!z||Te!=="failed"||Ht.current>=2)return;const i=window.setTimeout(()=>{Ht.current+=1,De(a=>a+1)},2e3*(Ht.current+1));return()=>window.clearTimeout(i)},[t,P,z,Te]),h.useEffect(()=>{if(!d||!b||Te!=="live"){Qe.current=null,Et(null);return}let i=!0,a=!1;const o=Ve.current,y=typeof(o==null?void 0:o.requestVideoFrameCallback)=="function";let x,g=null,T=!1,M=0,A,K=-1/0,xe=0;et.current.begin(performance.now());const de=ne=>{if(!i||document.visibilityState==="hidden")return;const se=performance.now(),fe=et.current.observe(ne,se);fe&&(!T||se-M>=2e3)&&(T=!0,M=se,d.request("browser:webrtc",{sessionId:b,data:{kind:"viewer-trace",event:"playback-ready"}}).catch(()=>{})),fe&&Mt.current&&(Mt.current=!1,Kt(null),d.request("browser:webrtc",{sessionId:b,data:{kind:"viewer-trace",event:"stall-recovered",...g?{sample:g}:{}}}).catch(()=>{}))};if(y&&o){const ne=(se,fe)=>{de(fe.presentedFrames),document.visibilityState!=="hidden"&&Number.isFinite(fe.expectedDisplayTime)&&(A=Math.max(0,se-fe.expectedDisplayTime),K=performance.now()),i&&(x=o.requestVideoFrameCallback(ne))};x=o.requestVideoFrameCallback(ne)}const Ge=()=>{var ne,se;Qe.current=null,A=void 0,K=-1/0,(ne=me.current)==null||ne.setVisible(document.visibilityState!=="hidden"),document.visibilityState==="hidden"&&((se=he.current)==null||se.stop()),document.visibilityState!=="hidden"&&et.current.resume(performance.now())};document.addEventListener("visibilitychange",Ge);const Ce=async()=>{var se,fe,mt;const ne=re.current;if(!(!ne||a)){a=!0;try{const ce=await ne.getStats().catch(()=>null);if(!i||ne!==re.current)return;const We=performance.now(),le=ce&&Xn(ce,Qe.current,Date.now(),{visible:document.visibilityState!=="hidden",...We-K<=2e3?{presentationDelayMs:A}:{},viewport:{width:((se=pe.current)==null?void 0:se.clientWidth)??0,height:((fe=pe.current)==null?void 0:fe.clientHeight)??0,pixelRatio:Math.min(4,Math.max(1,window.devicePixelRatio||1)),zoom:Math.min(4,Math.max(1,zr.current))}});if(le){le.sample.receiver&&(le.sample.receiver.sequence=++xe);const ir=(mt=he.current)==null?void 0:mt.apply(le.sample,We);ir&&le.sample.receiver&&Object.assign(le.sample.receiver,ir),Qe.current=le.cursor,g=le.sample,Et(le.sample),d.request("browser:webrtc",{sessionId:b,data:{kind:"stats",...le.sample}}).catch(()=>{})}const ci=Wn(o,le==null?void 0:le.cursor.framesDecoded);y||de(ci);const $i=y||ci!==void 0||!(o!=null&&o.videoWidth);if(document.visibilityState!=="hidden"&&$i&&et.current.evaluate(We).state==="stalled"){const ir=et.current.evaluate(We);et.current.begin(We),Ie(li=>li==="live"?"failed":li),Mt.current=!0,Kt("实时画面超时,已切换为 JPEG 兜底画面"),d.request("browser:webrtc",{sessionId:b,data:{kind:"viewer-trace",event:"jpeg-fallback",silentForMs:ir.silentForMs,...g?{sample:g}:{}}}).catch(()=>{})}}catch{}finally{a=!1}}};Ce();const X=window.setInterval(()=>void Ce(),1e3);return()=>{i=!1,T&&d.request("browser:webrtc",{sessionId:b,data:{kind:"viewer-trace",event:"jpeg-fallback"}}).catch(()=>{}),window.clearInterval(X),x!==void 0&&(o==null||o.cancelVideoFrameCallback(x)),document.removeEventListener("visibilitychange",Ge)}},[d,b,Te]);const Qr=h.useCallback(async()=>{if(!(!d||!f||m)){we(!0),D(null);try{const i=await d.request("browser:takeover",{sessionId:f.id});ge(i.session)}catch(i){we(!1),D(i instanceof Error?i.message:"无法接管浏览器")}}},[d,ge,f,m]),Di=h.useCallback(async()=>{if(!(!d||!f)){we(!0),D(null);try{const i=await d.request("browser:return",{sessionId:f.id});ge(i.session)}catch(i){we(!1),D(i instanceof Error?i.message:"无法归还浏览器")}}},[d,ge,f]),br=h.useCallback(async(i,a)=>{if(!(!d||!b)){Ar(i),D(null);try{await d.request("browser:system",{sessionId:b,action:i,...a?{password:a}:{}}),window.setTimeout(()=>De(o=>o+1),800)}catch(o){D(o instanceof Error?o.message:"系统操作失败")}finally{Ar(null)}}},[d,b]),zi=h.useCallback(async()=>{if(!(!d||!b||!wt)){qr(!0),st(null);try{await d.request("browser:system",{sessionId:b,action:"unlock",password:wt}),it(""),bt(!1),window.setTimeout(()=>De(i=>i+1),2500)}catch(i){st(i instanceof Error?i.message:"解锁失败")}finally{it(""),qr(!1)}}},[d,b,wt]),Nt=h.useCallback(i=>{var y,x;if(!d||L||j||!(f!=null&&f.isController)||f.state!=="user-controlled")return Promise.resolve(null);i.kind==="pointer"&&((y=_e.current)==null||y.localPoint(i));const a={...i,mobile:window.matchMedia("(pointer: coarse)").matches},o=g=>d.request("browser:input",{sessionId:f.id,input:g});return(((x=me.current)==null?void 0:x.dispatch(a,o))??o(a)).then(g=>{var T;if((T=g==null?void 0:g.input)!=null&&T.error)throw new Error(g.input.error);return g}).catch(g=>((g==null?void 0:g.code)!=="ECANCELED"&&D(g instanceof Error?g.message:"浏览器输入失败"),null))},[d,f,L,j]),Q=h.useCallback(i=>{Nt(i)},[Nt]),ke=h.useCallback((i,a,o=[])=>{Q({kind:"key",action:"down",key:i,code:a,text:"",modifiers:o}),Q({kind:"key",action:"up",key:i,code:a,text:"",modifiers:o})},[Q]),Lt=h.useCallback(i=>{ke(i,`Key${i.toUpperCase()}`,[ji(f)])},[ke,f]),Fi=h.useCallback(async i=>{var g,T;if(!d||!(f!=null&&f.isController)||f.state!=="user-controlled"||L||j)throw new Error("连接正在切换,请稍后重试");const a={kind:"key",action:"down",text:i,key:"",code:"",modifiers:[],mobile:window.matchMedia("(pointer: coarse)").matches},o=M=>d.request("browser:input",{sessionId:f.id,input:M}),y=await(((g=me.current)==null?void 0:g.dispatch(a,o))??o(a)),x=(T=y==null?void 0:y.input)==null?void 0:T.error;if(x)throw new Error(x)},[d,f,L,j]),wr=h.useCallback((i,a,o=!1)=>{const y=++Ut.current;Nt({kind:"pointer",action:"up",...i,button:"left",...a&&a>1?{click:a}:{}}).then(x=>{y===Ut.current&&yr(x,o)})},[yr,Nt]),tr=h.useRef(!1),rr=h.useRef(""),ei=h.useCallback(i=>{const a=rr.current;if(i!==a){if(i.startsWith(a)){const o=i.slice(a.length);o&&Q({kind:"key",action:"down",text:o,key:"",code:"",modifiers:[]})}rr.current=i}},[Q]),ve=(f==null?void 0:f.displays)??null,ti=i=>{if(!P||U)return;const a=Ye.current,o=i.code==="KeyA"&&!i.shiftKey&&!i.altKey&&(ji(f)==="Meta"?i.metaKey:i.ctrlKey);a&&i.target===a&&o&&(i.preventDefault(),a.value="",rr.current=""),!(i.target===Ye.current&&i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey)&&(Q({kind:"key",action:"down",key:i.key,code:i.code,text:i.key.length===1?i.key:"",modifiers:Ei(i)}),["Backspace","Tab","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Escape"].includes(i.key)&&i.preventDefault())},ri=i=>{!P||U||i.target===Ye.current&&i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey||Q({kind:"key",action:"up",key:i.key,code:i.code,modifiers:Ei(i)})};h.useEffect(()=>{if(!j)return;const i=window.setTimeout(()=>{ye(null),D("画质切换未完成,请刷新画面后重试")},14e3);return()=>window.clearTimeout(i)},[j]),h.useEffect(()=>{ye(null),_("hd")},[t,b]);const Vi=i=>{!d||!tt||L||j||!b||(ye(i),d.request("browser:webrtc",{sessionId:b,data:{kind:"quality",quality:i}}).catch(a=>{ye(null),D(a instanceof Error?a.message:"画质切换失败")}))};h.useEffect(()=>{if(!L)return;if(ve!=null&&ve.some(a=>a.id===L&&a.selected)){H(null);return}const i=window.setTimeout(()=>{H(null),D("切换屏幕未完成,请刷新画面后重试")},14e3);return()=>window.clearTimeout(i)},[ve,L]),h.useEffect(()=>{H(null)},[t,b]);const gr=h.useRef(0),Bi=h.useCallback(i=>{!d||L||j||!b||!tt||!(ve!=null&&ve.some(a=>a.id===i&&!a.selected))||(H(i),d.request("browser:set-display",{sessionId:b,displayId:i}).catch(a=>{H(null),D(a instanceof Error?a.message:"切换屏幕失败")}))},[d,ve,b,tt,L,j]),Ue=h.useCallback(i=>{const a=i.currentTarget.getBoundingClientRect(),o=(C==null?void 0:C.viewport)??(f==null?void 0:f.viewport);if(!o)return null;const y=Math.min(a.width/o.width,a.height/o.height),x=o.width*y,g=o.height*y,T=(a.width-x)/2,M=(a.height-g)/2,A=(i.clientX-a.left-T)/x,K=(i.clientY-a.top-M)/g;return A<0||A>1||K<0||K>1?null:{x:A,y:K}},[C==null?void 0:C.viewport,f==null?void 0:f.viewport]);if(!t||typeof document>"u")return null;const ii=(f==null?void 0:f.online)&&!f.controlledByAnotherViewer,Oi=(f==null?void 0:f.availability)==="unavailable"?z?"桌面直播不可用":"浏览器直播不可用":(f==null?void 0:f.availability)==="starting"?"正在连接画面":z&&(f==null?void 0:f.state)==="agent-controlled"?"未被远程控制":f?_n[f.state]:z?"等待桌面直播":"等待浏览器",ni=(f==null?void 0:f.availability)==="unavailable"?z?"桌面直播不可用":"浏览器直播不可用":(f==null?void 0:f.availability)==="starting"?"正在连接画面":R.length?"等待第一帧":z||m?"暂无桌面直播":"暂无浏览器直播",Ui=(f==null?void 0:f.availability)==="unavailable"?f.capabilityError||(z?"需要在桌面 App 中开启并授予屏幕录制权限":"当前浏览器不支持实时画面传输"):R.length?"画面开始后会自动显示":z||m?"在桌面 App 设置中开启「桌面直播与远程控制」后,画面会出现在这里":"Agent 开始浏览网页后,会话会出现在这里",Wi=Yn(Br),si=Zn(Br),oi=Te==="live"?Wi||"WebRTC 实时流":Te==="connecting"?"正在连接 WebRTC":Oe?"JPEG 兜底":null,kr=C&&Oe&&(!m||(f==null?void 0:f.availability)==="ready"),At=k&&E===!0?"电脑已锁屏,解锁后自动恢复桌面画面":null;if(l&&!w)return c.jsxs("button",{type:"button",className:"session-desktop-preview",onClick:l.onExpand,"aria-label":"全屏查看桌面",children:[kr?c.jsx("img",{src:Oe,alt:"实时桌面预览",draggable:!1}):c.jsx("span",{className:"session-desktop-preview-empty",children:At||Fe||(f==null?void 0:f.capabilityError)||(Je?"正在连接桌面":ni)}),kr&&At&&c.jsx("span",{className:"session-desktop-lock-notice",children:At}),c.jsxs("span",{className:"session-desktop-preview-expand",children:[c.jsx(fi,{size:14,"aria-hidden":"true"}),"全屏"]})]});const ai=c.jsxs("div",{ref:q,className:`browser-live-backdrop${r?" browser-live-backdrop--embedded":""}${m?" browser-live-backdrop--session":""}`,style:{visibility:e?void 0:"hidden",pointerEvents:e?void 0:"none"},"aria-hidden":!e,"data-tab-swipe-ignore":!0,role:"presentation",onMouseDown:i=>{!r&&i.target===i.currentTarget&&u()},children:[c.jsxs("section",{ref:oe,className:`browser-live-panel ${B?"is-fullscreen":""}${m?" browser-live-panel--session":""}`,role:r?"region":"dialog","aria-modal":r?void 0:!0,"aria-label":m?"会话桌面":"浏览器直播",children:[c.jsxs("header",{className:"browser-live-header",children:[c.jsxs("div",{className:"browser-live-heading",children:[c.jsx(di,{size:17,"aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("strong",{children:m?"桌面":"浏览器直播"}),c.jsx("span",{children:l?`${l.status} · 只读`:f?Sr(f.backend):"实时观看与接管"})]}),!m&&v]}),c.jsxs("div",{className:"browser-live-header-actions",children:[!m&&c.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>void O(),title:B?"退出全屏":"全屏","aria-label":B?"退出全屏":"全屏","aria-pressed":B,children:B?c.jsx(nr,{size:17}):c.jsx(fi,{size:17})}),c.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>void er(),title:"刷新画面与会话","aria-label":"刷新直播画面与会话",children:c.jsx(Qi,{size:15,className:Je?"spin":void 0,"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"ui-icon-button",onClick:u,title:m?"退出全屏":"关闭","aria-label":m?"退出全屏":"关闭浏览器直播",children:m?c.jsx(nr,{size:17,"aria-hidden":"true"}):c.jsx(Xi,{size:17,"aria-hidden":"true"})})]})]}),c.jsxs("div",{className:`browser-live-surface ${P?"is-controlling":""} has-zoom ${P&&!U&&jt?"has-quickkeys":""}`,children:[At&&c.jsx("span",{className:"session-desktop-lock-notice",role:"status",children:At}),c.jsxs("div",{className:"browser-live-zoom",role:"group","aria-label":"桌面画面缩放",children:[B&&!m&&c.jsxs("button",{type:"button","aria-label":"退出全屏",title:"退出全屏",onClick:()=>void O(),children:[c.jsx(nr,{size:15,"aria-hidden":"true"}),"退出全屏"]}),J&&z&&c.jsxs(sr,{label:"视频帧率",title:"切换视频帧率会重新连接画面",value:N,busy:!1,disabled:!P||Te!=="live",compact:!0,onChange:i=>{(i==="balanced"||i==="motion-30"||i==="motion-60")&&S(i)},children:[c.jsx("option",{value:"balanced",children:"30 帧 · 自适应"}),c.jsx("option",{value:"motion-30",children:"30 帧 · 帧率优先"}),c.jsx("option",{value:"motion-60",children:"60 帧 · 帧率优先"})]}),n&&z&&c.jsxs(sr,{label:"播放缓冲",title:"远程桌面播放缓冲对照",value:Ae?"low":"adaptive",busy:!1,disabled:Te!=="live",compact:!0,onChange:i=>{var o;const a=i==="low";je.current=a,$e(a),(o=he.current)==null||o.setLowLatency(a)},children:[c.jsx("option",{value:"adaptive",children:"自适应"}),c.jsx("option",{value:"low",children:"20 ms"})]}),R.length>1&&c.jsx("div",{className:"browser-live-session-tabs",role:"tablist","aria-label":"切换直播屏幕",children:R.map(i=>c.jsx("button",{type:"button",role:"tab","aria-selected":i.id===b,className:i.id===b?"is-active":"",title:`${Sr(i.backend)} · ${i.title||"浏览器"}`,onClick:()=>te(i.id),children:i.title||Sr(i.backend)},i.id))}),!m&&z&&ve&&ve.length>1&&c.jsx(sr,{label:"选择直播屏幕",title:tt?"选择直播屏幕":"其他设备控制中或画面暂不可用",value:(ve.find(i=>i.selected)??ve[0]).id,busy:!!L,disabled:!C||!tt||j||ve.length<2,onChange:Bi,children:ve.map((i,a)=>c.jsx("option",{value:i.id,children:`第 ${a+1} 屏${i.primary?"(主屏)":""}`},i.id))}),!m&&z&&c.jsxs(sr,{label:"视频画质",title:tt?"视频画质":"其他设备控制中或画面暂不可用",value:ae,busy:j!==null,disabled:!tt||!!L,compact:!0,onChange:Vi,children:[c.jsx("option",{value:"smooth",children:"流畅"}),c.jsx("option",{value:"hd",children:"高清"}),c.jsx("option",{value:"original",children:"原画"})]}),z&&P&&ft&&Be!=="live"&&c.jsxs("button",{type:"button","aria-label":"开始语音",title:"开始双向语音",disabled:Be==="starting",onClick:()=>void qi(),children:[Be==="starting"?c.jsx(Ne,{size:15,className:"spin","aria-hidden":"true"}):c.jsx(mi,{size:15,"aria-hidden":"true"}),Be==="starting"?"正在连接":"开始语音"]}),z&&P&&ft&&Be==="live"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button","aria-label":Xt?"取消麦克风静音":"麦克风静音","aria-pressed":Xt,title:Xt?"打开麦克风":"关闭麦克风",onClick:()=>{var a;const i=!Zt.current;Zt.current=i;for(const o of((a=Tt.current)==null?void 0:a.getAudioTracks())??[])o.enabled=!i;$r(i)},children:Xt?c.jsx(rn,{size:15,"aria-hidden":"true"}):c.jsx(mi,{size:15,"aria-hidden":"true"})}),c.jsx("button",{type:"button","aria-label":Yt?"取消扬声器静音":"扬声器静音","aria-pressed":Yt,title:Yt?"打开电脑声音":"关闭电脑声音",onClick:()=>{const i=!_t.current;_t.current=i,ut.current&&(ut.current.gain.value=i?0:1),Hr(i),i&&(ht.current=0)},children:Yt?c.jsx(on,{size:15,"aria-hidden":"true"}):c.jsx(sn,{size:15,"aria-hidden":"true"})}),c.jsx("button",{type:"button","aria-label":"结束语音",title:"结束双向语音",onClick:()=>Pe(!0),children:c.jsx(nn,{size:15,"aria-hidden":"true"})})]}),c.jsx("button",{type:"button","aria-label":"缩小桌面画面",title:"缩小",disabled:!C||ze<=.5,onClick:()=>gt(i=>Math.max(.5,i-.25)),children:c.jsx(Gi,{size:16})}),c.jsxs("output",{"aria-label":"桌面缩放比例",children:[Math.round(ze*100),"%"]}),c.jsx("button",{type:"button","aria-label":"放大桌面画面",title:"放大",disabled:!C||ze>=5,onClick:()=>gt(i=>Math.min(5,i+.25)),children:c.jsx(Ji,{size:16})}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>{var i;gt(1),kt(!1),(i=pe.current)==null||i.scrollTo(0,0)},children:"适应窗口"}),c.jsxs("button",{type:"button","aria-label":"移动桌面画面","aria-pressed":U,title:"拖动或滚动画面,不发送远程输入",disabled:!C,onClick:()=>kt(i=>!i),children:[c.jsx(en,{size:15}),"移动画面"]}),!m&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:`browser-live-keyboard ${Me?"is-typing":""}`,children:[c.jsxs("button",{type:"button","aria-label":"唤起键盘","aria-pressed":Me,title:"唤起/收起键盘(无法识别输入框时可手动唤起)",className:Pi&&!Me?"is-hint":void 0,disabled:!C||!P,onPointerDown:i=>i.preventDefault(),onClick:()=>{Ct(!1),Ai()},children:[c.jsx(Rr,{size:15}),"键盘"]}),c.jsx("input",{ref:Ye,className:"browser-live-mobile-input","aria-label":"浏览器键盘输入",tabIndex:-1,disabled:!C||!P,defaultValue:"",inputMode:"text",autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onFocus:()=>{kt(!1),ct.current=!0,Ot(!0),Ct(!1)},onKeyDown:ti,onKeyUp:ri,onCompositionStart:()=>{tr.current=!0},onCompositionEnd:i=>{tr.current=!1,U||ei(i.target.value)},onBlur:i=>{ct.current=!1,tr.current=!1,rr.current="",i.target.value="",Ot(!1)},onChange:i=>{!U&&!tr.current&&ei(i.target.value)}})]}),c.jsxs("button",{type:"button","aria-label":"快捷键条","aria-pressed":jt,title:"展开/收起快捷键(Esc/Tab/复制/粘贴/方向键)",disabled:!C||!P,onClick:()=>Ni(i=>!i),children:[c.jsx(Rr,{size:15}),jt?"收起":"快捷键"]}),c.jsxs("button",{type:"button","aria-label":"窗口控制",title:"全屏看不到左上角按钮时用:第 1 次点=退出全屏(ESC + Ctrl+Cmd+F),第 2 次点=关闭窗口(Cmd+W)",disabled:!C||!P,onClick:()=>{const i=Date.now();if(i-gr.current<2500){ke("w","KeyW",["Meta"]),gr.current=0;return}gr.current=i,ke("Escape","Escape"),window.setTimeout(()=>{ke("f","KeyF",["Control","Meta"])},150)},children:[c.jsx(Rr,{size:15}),"窗口"]})]}),!m&&Xr&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button","aria-label":"锁屏",title:"锁屏(锁屏后仍可从空态区唤醒或远程解锁)",disabled:!C||!!He,onClick:()=>void br("lock"),children:[He==="lock"?c.jsx(Ne,{size:15,className:"spin"}):c.jsx(tn,{size:15}),"锁屏"]}),c.jsxs("button",{type:"button","aria-label":"唤醒屏幕",title:"唤醒显示器或锁屏界面",disabled:!!He,onClick:()=>void br("wake"),children:[He==="wake"?c.jsx(Ne,{size:15,className:"spin"}):c.jsx(yi,{size:15}),"唤醒"]})]})]}),P&&!U&&jt&&c.jsxs("div",{className:"browser-live-quickkeys",role:"group","aria-label":"快捷键",children:[c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("Escape","Escape"),children:"Esc"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("Tab","Tab"),children:"Tab"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>Lt("c"),children:"复制"}),c.jsx(an,{disabled:!C||!!L||!!j,onPaste:Fi,onError:D},b),c.jsx("button",{type:"button",disabled:!C,onClick:()=>Lt("a"),children:"全选"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>Lt("z"),children:"撤销"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>Lt("s"),children:"保存"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>Lt("f"),children:"查找"}),c.jsx("button",{type:"button",disabled:!C,title:"退出当前前台应用(Cmd+Q)",onClick:()=>ke("q","KeyQ",["Meta"]),children:"⌘Q"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("ArrowLeft","ArrowLeft"),children:"←"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("ArrowUp","ArrowUp"),children:"↑"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("ArrowDown","ArrowDown"),children:"↓"}),c.jsx("button",{type:"button",disabled:!C,onClick:()=>ke("ArrowRight","ArrowRight"),children:"→"})]}),!(P&&!U&&jt)&&c.jsx("div",{className:"browser-live-touch-hint",children:m?"拖动画面 · 双指缩放":mr?"画面当前为只读 · 点击画面开始控制":"滑动滚动 · 轻点点击 · 双击打开 · 长按拖动 · 按住1秒右键 · 双指缩放"}),c.jsxs("div",{ref:pe,className:"browser-live-viewport",onMouseDown:i=>{ct.current&&i.preventDefault()},children:[kr?c.jsxs("div",{className:"browser-live-image-hit-area",style:vr&&pt?{width:pt.width*vr*ze,height:pt.height*vr*ze,cursor:U?"grab":void 0}:void 0,tabIndex:P&&!U?0:-1,onContextMenu:i=>i.preventDefault(),onPointerDown:i=>{if(i.pointerType==="touch"){i.preventDefault(),Xe.current.down(i.pointerId,{x:i.clientX,y:i.clientY},i.isPrimary),Ke.current=P&&!U?Ue(i):null;const o=Ke.current;o&&z&&(f==null?void 0:f.platform)==="darwin"&&Nt({kind:"pointer",action:"move",...o,probe:!0}).then(y=>{Ke.current===o&&yr(y)}),i.currentTarget.setPointerCapture(i.pointerId),ue.current&&window.clearTimeout(ue.current),Se.current="none",Rt.current=P&&!U?{x:i.clientX,y:i.clientY}:null,Wt.current=i.timeStamp,Rt.current&&(ue.current=window.setTimeout(()=>{Se.current="armed"},550));return}if(U&&pe.current){const o=pe.current;at.current={x:i.clientX,y:i.clientY,left:o.scrollLeft,top:o.scrollTop},i.currentTarget.setPointerCapture(i.pointerId);return}if(!P)return;const a=Ue(i);a&&(Vt.current=!0,i.currentTarget.setPointerCapture(i.pointerId),Q({kind:"pointer",action:"down",...a,button:"left"}))},onPointerMove:i=>{if(i.pointerType==="touch"){i.preventDefault();const o=Xe.current.move(i.pointerId,{x:i.clientX,y:i.clientY}),y=pe.current;if(!o||!y)return;const x=o.pointers===2&&Math.abs(o.distanceRatio-1)>.05,g=Math.max(.5,Math.min(5,xt.current*o.scale));if(x&&g!==xt.current){const M=i.currentTarget.getBoundingClientRect();Bt.current={x:(o.from.x-M.left)/M.width,y:(o.from.y-M.top)/M.height,clientX:o.to.x,clientY:o.to.y},xt.current=g,Cr.flushSync(()=>gt(g));return}if(ue.current&&(window.clearTimeout(ue.current),ue.current=null),Se.current==="armed"&&Rt.current&&Ke.current&&(Se.current="drag",Q({kind:"pointer",action:"down",...Ke.current,button:"left"})),Se.current==="drag"){const M=Ue(i);M&&Q({kind:"pointer",action:"move",...M,button:"left"});return}const T=xt.current<=1.001;if(P&&!U&&(o.pointers>=2||T)){const M=ss(o.from,o.to);if(M){const A=Ke.current??Ue(i);A&&Q({kind:"pointer",action:"wheel",...A,...M})}return}y.scrollLeft+=o.from.x-o.to.x,y.scrollTop+=o.from.y-o.to.y;return}if(U&&at.current&&pe.current){const o=at.current;pe.current.scrollTo(o.left+o.x-i.clientX,o.top+o.y-i.clientY);return}if(!P)return;if(!Vt.current){const o=Ue(i);o&&Q({kind:"pointer",action:"move",...o,button:"left"});return}const a=Ue(i);a&&Q({kind:"pointer",action:"move",...a,button:"left"})},onPointerUp:i=>{if(i.pointerType==="touch"){i.preventDefault(),ue.current&&(window.clearTimeout(ue.current),ue.current=null);const o=Ue(i);Ke.current=null;const y=Xe.current.up(i.pointerId,{x:i.clientX,y:i.clientY});if(Se.current==="armed"){Se.current="none";const x=i.timeStamp-Wt.current;if(y&&x>=800&&o&&P&&!U){Xe.current.reset(),Q({kind:"pointer",action:"down",...o,button:"right"}),Q({kind:"pointer",action:"up",...o,button:"right"});return}}if(Se.current==="drag"){Se.current="none",Xe.current.reset(),o&&P&&Q({kind:"pointer",action:"up",...o,button:"left"});return}if(y&&o&&P&&!U){const x=(C==null?void 0:C.viewport)??(f==null?void 0:f.viewport);if(ns(Ze.current,x,o.x,o.y)){const M=Ye.current;M&&document.activeElement!==M&&M.focus({preventScroll:!0}),Ct(!1)}const g=ur.current;g!==null&&Date.now()-g.at<400&&x!==void 0&&Math.hypot((o.x-g.x)*x.width,(o.y-g.y)*x.height)<x.width*.03?(Q({kind:"pointer",action:"down",...o,button:"left",click:2}),wr(o,2,!0),ur.current=null):(Q({kind:"pointer",action:"down",...o,button:"left"}),wr(o,void 0,!0),ur.current={at:Date.now(),x:o.x,y:o.y})}return}if(U){at.current=null;return}if(!P)return;const a=Ue(i);Vt.current=!1,a&&wr(a)},onPointerCancel:i=>{Xe.current.up(i.pointerId,{x:i.clientX,y:i.clientY},!0),at.current=null,Vt.current=!1,Ke.current=null,ue.current&&(window.clearTimeout(ue.current),ue.current=null),Se.current="none",Rt.current=null,Wt.current=0},onLostPointerCapture:i=>{Xe.current.up(i.pointerId,{x:i.clientX,y:i.clientY},!0),ue.current&&(window.clearTimeout(ue.current),ue.current=null),Se.current="none",Rt.current=null,Wt.current=0},onWheel:i=>{if(!P||U)return;const a=Ue(i);a&&Q({kind:"pointer",action:"wheel",...a,deltaX:i.deltaX,deltaY:i.deltaY})},onKeyDown:ti,onKeyUp:ri,children:[c.jsx("img",{src:Oe,alt:(f==null?void 0:f.title)||"浏览器实时画面",draggable:!1,decoding:"async"}),c.jsx("video",{ref:Ve,className:`browser-live-video ${Te==="live"?"is-live":""}`,"aria-label":z?"桌面实时视频流":"浏览器实时视频流",autoPlay:!0,playsInline:!0,muted:!0}),c.jsx("canvas",{ref:Or,className:"browser-live-compound","aria-hidden":"true",style:{display:Te==="live"?"block":"none",visibility:"hidden"}}),c.jsx("canvas",{ref:Ur,className:"browser-live-compound browser-live-cursor","aria-hidden":"true",style:{display:Te==="live"?"block":"none",visibility:"hidden"}}),j&&c.jsxs("div",{className:"browser-live-quality-pending",role:"status",children:[c.jsx(Ne,{size:13,className:"spin","aria-hidden":"true"}),"正在切换至",Gn[j]??j,"画质…"]})]}):c.jsxs("div",{className:"browser-live-empty",children:[Je||(f==null?void 0:f.availability)==="starting"?c.jsx(Ne,{size:22,className:"spin","aria-hidden":"true"}):c.jsx(di,{size:24,"aria-hidden":"true"}),c.jsx("strong",{children:Je?m?"正在连接桌面":"正在连接浏览器":ni}),c.jsx("span",{children:Ui}),!m&&Li&&c.jsxs("div",{role:"group","aria-label":"锁屏远程操作",style:{display:"flex",gap:8,marginTop:12},children:[c.jsxs("button",{type:"button",className:"browser-live-control-button",disabled:!!He,onClick:()=>void br("wake"),children:[He==="wake"?c.jsx(Ne,{size:14,className:"spin","aria-hidden":"true"}):c.jsx(yi,{size:14,"aria-hidden":"true"}),"唤醒屏幕"]}),Xr&&c.jsxs("button",{type:"button",className:"browser-live-control-button",disabled:nt,onClick:()=>{st(null),bt(!0)},children:[c.jsx(pi,{size:14,"aria-hidden":"true"}),"远程解锁"]})]})]}),mr&&c.jsx("button",{type:"button",className:"browser-live-takeover-prompt","aria-label":Pt?"正在开始控制远程桌面":"点击画面开始控制远程桌面",disabled:Pt||!ii||(f==null?void 0:f.state)!=="agent-controlled",onClick:()=>void Qr(),children:c.jsxs("span",{className:"browser-live-takeover-card","aria-live":"polite",children:[c.jsx("span",{className:"browser-live-takeover-icon","aria-hidden":"true",children:Pt?c.jsx(Ne,{size:20,className:"spin"}):c.jsx(vi,{size:20})}),c.jsxs("span",{children:[c.jsx("strong",{children:Pt?"正在开始控制":"点击画面开始控制"}),c.jsx("small",{children:Pt?"正在把鼠标和键盘切换到你的设备":`当前画面只读,点击不会发送到${z?" Mac":"浏览器"}`})]})]})})]}),B&&!m&&c.jsxs("button",{type:"button",className:"browser-live-exit-fullscreen",onClick:()=>void O(),children:[c.jsx(nr,{size:14,"aria-hidden":"true"}),"退出全屏"]}),P&&!U&&c.jsxs("div",{className:"browser-live-control-cue",children:[c.jsx(vi,{size:13,"aria-hidden":"true"}),c.jsxs("span",{children:[z?"当前输入会发送到本机":"当前输入会发送到浏览器",z&&oi?` · ${oi}`:"",z&&si?` · ${si}`:"",Fr!=null?` · 控制 ${Fr}ms`:""]})]})]}),!B&&c.jsxs("footer",{className:"browser-live-footer",children:[c.jsxs("div",{className:"browser-live-location",children:[c.jsx("span",{className:`browser-live-status-dot is-${(f==null?void 0:f.state)??"idle"}`,"aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("strong",{children:Oi}),c.jsx("span",{title:f==null?void 0:f.url,children:(f==null?void 0:f.capabilityError)||(z?mr?"点击画面开始控制后,单击和拖拽才会发送到本机":"本机屏幕":f==null?void 0:f.url)||Fe||"等待可观看的直播会话"})]}),(f==null?void 0:f.url)&&!z&&c.jsx(_i,{size:13,"aria-hidden":"true"})]}),f&&(P?c.jsxs("button",{type:"button",className:"browser-live-control-button is-return",onClick:()=>void Di(),disabled:Ee,children:[Ee&&c.jsx(Ne,{size:14,className:"spin","aria-hidden":"true"}),z?"结束控制":"归还给 Agent"]}):c.jsxs("button",{type:"button",className:"browser-live-control-button",onClick:()=>void Qr(),disabled:!ii||Ee||f.state!=="agent-controlled"||f.availability!=="ready",children:[Ee&&c.jsx(Ne,{size:14,className:"spin","aria-hidden":"true"}),f.controlledByAnotherViewer?"其他设备操作中":z?"开始控制":"接管浏览器"]}))]}),(Fe??Wr)&&c.jsx("div",{className:"browser-live-error",role:"alert",children:Fe??Wr})]}),Ti&&c.jsx("div",{className:"browser-live-unlock-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&!nt&&(bt(!1),it(""),st(null))},children:c.jsxs("form",{className:"browser-live-unlock-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"browser-live-unlock-title",onSubmit:i=>{i.preventDefault(),zi()},children:[c.jsxs("div",{className:"browser-live-unlock-heading",children:[c.jsx(pi,{size:18,"aria-hidden":"true"}),c.jsx("strong",{id:"browser-live-unlock-title",children:"远程解锁 Windows"})]}),c.jsx("label",{htmlFor:"browser-live-unlock-password",children:"Windows 密码或 PIN"}),c.jsx("input",{id:"browser-live-unlock-password",type:"password",autoComplete:"off",autoFocus:!0,maxLength:256,value:wt,disabled:nt,onChange:i=>it(i.target.value)}),Dr&&c.jsx("p",{role:"alert",children:Dr}),c.jsxs("div",{className:"browser-live-unlock-actions",children:[c.jsx("button",{type:"button",className:"browser-live-control-button is-return",disabled:nt,onClick:()=>{bt(!1),it(""),st(null)},children:"取消"}),c.jsxs("button",{type:"submit",className:"browser-live-control-button",disabled:nt||!wt,children:[nt&&c.jsx(Ne,{size:14,className:"spin","aria-hidden":"true"}),"解锁"]})]})]})})]});return r?ai:Cr.createPortal(ai,document.body)}export{es as decodePcm16Base64,fs as default,Qn as encodePcm16Base64,rs as isStaleControlReply,ts as prepareVoiceAudio,ns as remoteFieldContains,ji as remoteShortcutModifier,Ri as selectBrowserLiveSessionId,Jn as shouldOfferVisualTakeover,ss as touchScrollDelta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,u as i,j as n}from"./index-YrEOkxAg.js";import m from"./CalendarView-QXZbXnXA.js";import"./calendar-days-DXE_2mLa.js";import"./chevron-right-BGU3tcLA.js";import"./locate-fixed-2R48MVg_.js";import"./list-todo-D9ChIz0f.js";import"./chevron-down-Dvinwg2S.js";import"./check-UipgMBET.js";import"./pause-ddt7BLlm.js";function E(){const[a,o]=r.useState(i.getState().skin);return r.useEffect(()=>i.subscribe(t=>o(t.skin)),[]),r.useEffect(()=>{document.documentElement.dataset.skin=a},[a]),n.jsx(m,{initialTaskId:new URLSearchParams(location.search).get("task")??void 0,loadOverview:async(t,s)=>{const e=window.agentApi;if(!(e!=null&&e.calendarOverview))throw new Error("当前环境不支持日历视图");return e.calendarOverview({from:t,to:s})}})}export{E as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $,r as l,j as e,
|
|
1
|
+
import{c as $,r as l,j as e,w as me,N as Ae,A as pe,X as xe,x as De,R as Ee}from"./index-YrEOkxAg.js";import{C as $e}from"./calendar-days-DXE_2mLa.js";import{C as Te}from"./chevron-right-BGU3tcLA.js";import{L as Me}from"./locate-fixed-2R48MVg_.js";import{L as ge}from"./list-todo-D9ChIz0f.js";import{C as Le}from"./chevron-down-Dvinwg2S.js";import{C as je}from"./check-UipgMBET.js";import{P as ze}from"./pause-ddt7BLlm.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,7 +18,7 @@ import{c as $,r as l,j as e,v as me,N as Ae,A as pe,w as De,R as Ee}from"./index
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const fe=$("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
|
|
22
22
|
* @license lucide-react v0.468.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
@@ -28,4 +28,4 @@ import{c as $,r as l,j as e,v as me,N as Ae,A as pe,w as De,R as Ee}from"./index
|
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Fe=$("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),B=["customer-agent","codex","claude","workbuddy","zcode","opencode","deepseek"],Z={"customer-agent":"AgentRoam",codex:"Codex",claude:"Claude Code",workbuddy:"WorkBuddy",zcode:"ZCode",opencode:"OpenCode",deepseek:"DeepSeek"};function I(s){const a=new Date(s),m=`${a.getMonth()+1}`.padStart(2,"0"),x=`${a.getDate()}`.padStart(2,"0");return`${a.getFullYear()}-${m}-${x}`}function _e({detail:s,onSave:a,onClose:m}){const{task:x,schedule:i}=s,g=i.trigger.kind==="cron",[f,p]=l.useState(i.target.agentType),[v,F]=l.useState(()=>{if(i.trigger.kind==="cron")return i.trigger.expression;const u=new Date(i.trigger.at);return new Date(u.getTime()-u.getTimezoneOffset()*6e4).toISOString().slice(0,19)}),[T,Y]=l.useState(i.enabled),[A,M]=l.useState([]),[j,r]=l.useState(!1),[D,w]=l.useState("");l.useEffect(()=>{var h,b;let u=!0;return(b=(h=window.agentApi)==null?void 0:h.getRuntimeHealth)==null||b.call(h).then(E=>{u&&M(E.filter(N=>!N.available).map(N=>N.agentType))}).catch(()=>{}),()=>{u=!1}},[]);async function C(u){if(u.preventDefault(),j)return;const h=g?{kind:"cron",expression:v.trim()}:{kind:"once",at:new Date(v).getTime()};if(h.kind==="once"&&(!Number.isFinite(h.at)||T&&h.at<=Date.now())){w("请选择有效的未来执行时间");return}r(!0),w("");const b=i.target,E=f===b.agentType?void 0:{agentType:f,cwd:b.cwd,permissionMode:b.permissionMode},N=h.kind==="once"&&i.trigger.kind==="once"?h.at!==i.trigger.at:h.kind==="cron"&&i.trigger.kind==="cron"&&h.expression!==i.trigger.expression;try{await a({type:"schedule",taskId:x.id,expectedVersion:x.version,enabled:T,...E?{target:E}:{},...N?{trigger:h}:{}})}catch(L){w(L instanceof Error?L.message:"执行计划保存失败")}finally{r(!1)}}return e.jsxs("form",{className:"cal-schedule-editor",onSubmit:C,"aria-label":"编辑执行计划",children:[e.jsxs("label",{children:["执行 Agent",e.jsxs("select",{value:f,onChange:u=>p(u.target.value),disabled:j,children:[!me(i.target.agentType)&&e.jsx("option",{value:i.target.agentType,children:i.target.agentType}),Ae.map(u=>e.jsx("option",{value:u,disabled:A.includes(u)&&u!==i.target.agentType,children:pe[u]},u))]})]}),e.jsxs("label",{children:[g?`执行规则(${i.timeZone})`:"执行时间(本地时间)",e.jsx("input",{type:g?"text":"datetime-local",step:g?void 0:1,value:v,required:!0,disabled:j,onChange:u=>F(u.target.value)})]}),e.jsxs("label",{className:"cal-schedule-enabled",children:[e.jsx("input",{type:"checkbox",checked:T,disabled:j,onChange:u=>Y(u.target.checked)}),"启用执行计划"]}),D&&e.jsx("p",{role:"alert",children:D}),e.jsxs("div",{className:"cal-schedule-actions",children:[e.jsx("button",{type:"button",className:"cal-nav-btn",onClick:m,disabled:j,children:"取消"}),e.jsx("button",{type:"submit",className:"cal-nav-btn",disabled:j,children:j?"保存中":"保存"})]})]})}const ue=["一","二","三","四","五","六","日"],Ue={upcoming:"待执行",paused:"已暂停",completed:"已完成",failed:"失败",overdue:"已过期",pending:"待处理","in-progress":"进行中",unscheduled:"未排期"},Oe=3e4;function Ve(s){const a=new Date(s);return a.setHours(0,0,0,0),a.getTime()}function V(s){const a=new Date(s);return`${`${a.getHours()}`.padStart(2,"0")}:${`${a.getMinutes()}`.padStart(2,"0")}`}function Ye(s,a){return`${s}年${a+1}月`}function he({task:s,schedule:a,reminders:m,executions:x}){var g,f;return s.dueAt!==void 0?s.dueAt:a!=null&&a.enabled&&a.nextFireAt!==null?a.nextFireAt:s.status==="completed"&&(a==null?void 0:a.trigger.kind)==="once"?a.trigger.at:(a&&((g=x.find(p=>p.scheduleId===a.id&&(s.status==="completed"||p.generation===a.generation)))==null?void 0:g.scheduledAt))??((f=m.find(p=>p.enabled&&p.nextFireAt!==null))==null?void 0:f.nextFireAt)??void 0}function qe(s,a){const m=new Date(s,a,1),x=(m.getDay()+6)%7,i=Ve(m.getTime())-x*864e5;return Array.from({length:42},(g,f)=>{const p=i+f*864e5,v=new Date(p);return{key:I(p),day:v.getDate(),inMonth:v.getMonth()===a,ms:p}})}function Ge({kind:s,size:a=12}){return s==="cron"?e.jsx(je,{size:a,"aria-hidden":"true"}):s==="run"?e.jsx(Fe,{size:a,"aria-hidden":"true"}):e.jsx(Ie,{size:a,"aria-hidden":"true"})}function ke({state:s}){return s==="completed"?e.jsx(fe,{size:12,className:"cal-mark is-done",role:"img","aria-label":"已完成"}):s==="failed"?e.jsx(xe,{size:12,className:"cal-mark is-fail","aria-label":"失败"}):s==="in-progress"?e.jsx("span",{className:"cal-pulse","aria-label":"进行中"}):s==="paused"?e.jsx(ze,{size:11,className:"cal-mark is-pause","aria-label":"已暂停"}):null}function ve({source:s,executionAgentType:a}){return!a||a==="customer-agent"?{tone:s,label:Z[s]}:me(a)?{tone:a==="claude-code"?"claude":a==="deepseek-harness"?"deepseek":a,label:pe[a]}:{tone:s,label:a}}function He({entry:s,onClick:a,highlighted:m}){const x=`cal-chip kind-${s.kind} is-${s.state}${m?" is-highlight":""}`,{tone:i,label:g}=ve(s),f=`${g} · ${s.title}`,p=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cal-chip-dot","aria-hidden":"true"}),e.jsx("span",{className:"cal-chip-time",children:s.kind==="todo"?s.dueAt?V(s.dueAt):"待办":V(s.at)}),e.jsx("span",{className:"cal-chip-title",children:s.title}),e.jsx(ke,{state:s.state}),s.state==="overdue"&&e.jsx("span",{className:"cal-tag is-overdue",children:"过期"}),s.state==="paused"&&e.jsx("span",{className:"cal-tag is-paused",children:"暂停"})]});return a?e.jsx("button",{type:"button",className:x,"data-source":i,onClick:a,title:f,children:p}):e.jsx("div",{className:x,"data-source":i,title:f,children:p})}function Ke({entry:s,highlighted:a,onEditSchedule:m}){const{tone:x,label:i}=ve(s);return e.jsxs("article",{className:`cal-entry is-${s.state}${a?" is-highlight":""}`,"data-source":x,"data-task-id":s.taskId,children:[e.jsxs("div",{className:"cal-entry-top",children:[e.jsx("span",{className:"cal-entry-src",children:i}),e.jsx("span",{className:`cal-entry-state is-${s.state}`,children:Ue[s.state]??s.state}),e.jsxs("span",{className:"cal-entry-time",children:[e.jsx(Ge,{kind:s.kind}),s.kind==="todo"?s.dueAt?V(s.dueAt):"无截止":V(s.at)]})]}),e.jsx("h4",{className:`cal-entry-title ${s.state==="completed"?"is-struck":""}`,children:s.title}),e.jsxs("div",{className:"cal-entry-meta",children:[s.scheduleLabel&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(Re,{size:11}),s.scheduleLabel]}),s.recurring&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(je,{size:11}),"循环"]}),s.sessionTitle&&e.jsxs("span",{className:"cal-meta-pill",title:s.sessionTitle,children:[e.jsx(ge,{size:11}),s.sessionTitle]})]}),s.executedAt!==void 0&&e.jsxs("p",{className:"cal-entry-detail",children:["执行记录:",new Date(s.executedAt).toLocaleString("zh-CN",{hour12:!1})]}),s.kind==="cron"&&s.state==="overdue"&&e.jsx("p",{className:"cal-entry-detail",children:"计划时间已过,未找到执行结果;不代表执行成功或失败。"}),s.detail&&e.jsx("p",{className:"cal-entry-detail",children:s.detail}),s.cwd&&e.jsx("p",{className:"cal-entry-cwd",title:s.cwd,children:s.cwd}),m&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:m,children:"编辑执行计划"})]})}function st({loadOverview:s,onClose:a,initialTaskId:m,focusKey:x=0}){const[i,g]=l.useState([]),[f,p]=l.useState(""),[v,F]=l.useState(""),[T,Y]=l.useState(""),[A,M]=l.useState(null),j=l.useRef(0),r=typeof window>"u"?void 0:window.agentApi,D=new Date,w=I(D.getTime()),[C,u]=l.useState({year:D.getFullYear(),month:D.getMonth()}),[h,b]=l.useState(null),[E,N]=l.useState(!0),[L,_]=l.useState(""),[be,X]=l.useState(!1),[q,S]=l.useState(w),[U,J]=l.useState(()=>new Set(B)),[G,H]=l.useState(!0),Q=l.useRef({from:"",to:""}),z=l.useRef(!0),O=l.useRef(0),ee=l.useCallback(async t=>{const n=++O.current;J(c=>new Set([...c,"customer-agent"])),F(t);try{const c=r!=null&&r.todoGet?await r.todoGet(t):void 0;if(n!==O.current)return;const o=c&&he(c);if(o!==void 0){const d=new Date(o);u({year:d.getFullYear(),month:d.getMonth()}),S(I(o))}else H(!0)}catch{n===O.current&&H(!0)}},[r]);l.useEffect(()=>(m&&ee(m),()=>{O.current++}),[m,x,ee]);const K=l.useMemo(()=>qe(C.year,C.month),[C]),te=K[0].key,se=K[41].key;Q.current={from:te,to:se};const y=l.useCallback(async t=>{var o;const{from:n,to:c}=Q.current;t==="initial"?N(!0):X(!0);try{const d=typeof window>"u"?void 0:window.agentApi,[R,k]=await Promise.all([s(n,c),(o=d==null?void 0:d.todoList)==null?void 0:o.call(d,{limit:200}).catch(()=>{})]);if(!z.current)return;k&&g(k.items.filter(re=>re.task.status!=="cancelled"&&he(re)===void 0)),b(R),_("")}catch(d){if(!z.current)return;_(d instanceof Error?d.message:"日历加载失败")}finally{z.current&&(N(!1),X(!1))}},[s]);l.useEffect(()=>{z.current=!0,y("initial");const t=setInterval(()=>{document.visibilityState==="visible"&&y("refresh")},Oe),n=()=>{document.visibilityState==="visible"&&y("refresh")};return document.addEventListener("visibilitychange",n),()=>{z.current=!1,clearInterval(t),document.removeEventListener("visibilitychange",n)}},[y,te,se]);const ae=t=>{u(n=>{const c=new Date(n.year,n.month+t,1);return{year:c.getFullYear(),month:c.getMonth()}})},ne=()=>{const t=new Date;u({year:t.getFullYear(),month:t.getMonth()}),S(I(t.getTime()))},ce=l.useMemo(()=>{const t=new Map;if(!h)return t;for(const[n,c]of Object.entries(h.days)){const o=c.filter(d=>d.kind!=="todo"&&U.has(d.source));o.length&&t.set(n,o)}return t},[h,U]),P=ce.get(q)??[],le=l.useMemo(()=>h?B.filter(t=>{var n;return!((n=h.sources[t])!=null&&n.ok)}).map(t=>{var n;return{source:t,error:((n=h.sources[t])==null?void 0:n.error)??""}}):[],[h]),Ne=t=>{J(n=>{const c=new Set(n);return c.has(t)?c.delete(t):c.add(t),c})},W=new Date(`${q}T00:00:00`),ye=`${W.getMonth()+1} 月 ${W.getDate()} 日 · 周${ue[(W.getDay()+6)%7]}`,we=async t=>{var n;p(t.task.id);try{const c=await((n=r==null?void 0:r.todoCommand)==null?void 0:n.call(r,{type:"complete",taskId:t.task.id,expectedVersion:t.task.version},crypto.randomUUID()));c&&g(o=>o.map(d=>d.task.id===c.task.id?c:d)),await y("refresh")}catch(c){_(c instanceof Error?c.message:"待办更新失败")}finally{p("")}},Ce=async t=>{var c;const n=++j.current;try{const o=await((c=r==null?void 0:r.todoGet)==null?void 0:c.call(r,t));n===j.current&&(o!=null&&o.schedule)&&M({...o,schedule:o.schedule})}catch(o){n===j.current&&_(o instanceof Error?o.message:"读取执行计划失败")}},ie=()=>{j.current++,M(null)},Se=async t=>{var o;if(!(r!=null&&r.todoCommand))throw new Error("当前服务不支持编辑待办");const n=await r.todoCommand(t,crypto.randomUUID());ie();const c=(o=n.schedule)==null?void 0:o.nextFireAt;if(c!=null){const d=new Date(c);u({year:d.getFullYear(),month:d.getMonth()}),S(I(c)),F(n.task.id)}await y("refresh")};return e.jsxs("div",{className:"cal-root",children:[e.jsx("div",{className:"cal-aurora","aria-hidden":"true"}),e.jsxs("header",{className:"cal-header",children:[e.jsxs("div",{className:"cal-title",children:[e.jsx("span",{className:"cal-title-icon",children:e.jsx($e,{size:20,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h1",{children:"智能体日历"}),e.jsx("p",{children:"定时任务与待办"})]})]}),e.jsxs("div",{className:"cal-nav",children:[a&&e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"返回聊天",title:"返回聊天",onClick:a,children:e.jsx(xe,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"上个月",onClick:()=>ae(-1),children:e.jsx(De,{size:17})}),e.jsx("button",{type:"button",className:"cal-month",onClick:ne,title:"回到今天",children:Ye(C.year,C.month)}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"下个月",onClick:()=>ae(1),children:e.jsx(Te,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"回到今天",title:"回到今天",onClick:ne,children:e.jsx(Me,{size:17})}),e.jsx("button",{type:"button",className:`cal-refresh ${be?"is-spinning":""}`,"aria-label":"刷新",title:"刷新",onClick:()=>void y("refresh"),children:e.jsx(Ee,{size:17})})]})]}),e.jsx("div",{className:"cal-filters",children:e.jsx("div",{className:"cal-sources",role:"group","aria-label":"按来源筛选",children:B.map(t=>{var n;return e.jsxs("button",{type:"button","data-source":t,className:`cal-source-chip ${U.has(t)?"is-on":"is-off"}`,onClick:()=>Ne(t),"aria-pressed":U.has(t),children:[e.jsx("span",{className:"cal-source-dot","aria-hidden":"true"}),Z[t],h&&e.jsx("span",{className:"cal-source-n",children:((n=h.sources[t])==null?void 0:n.entries)||0})]},t)})})}),le.length>0&&e.jsx("div",{className:"cal-source-errors",role:"status",children:le.map(({source:t,error:n})=>e.jsxs("span",{className:"cal-source-error","data-source":t,title:n,children:[e.jsx(de,{size:12}),Z[t]," 读取异常"]},t))}),L&&e.jsxs("div",{className:"cal-error",role:"alert",children:[e.jsx(de,{size:16}),L,e.jsx("button",{type:"button",onClick:()=>void y("initial"),children:"重试"})]}),e.jsxs("div",{className:"cal-body",children:[e.jsxs("div",{className:"cal-grid-wrap",children:[e.jsx("div",{className:"cal-weekdays",children:ue.map(t=>e.jsxs("span",{className:t==="六"||t==="日"?"is-weekend":"",children:["周",t]},t))}),E&&!h?e.jsx("div",{className:"cal-grid is-skeleton",children:Array.from({length:42},(t,n)=>e.jsxs("div",{className:"cal-cell cal-skeleton-cell",children:[e.jsx("span",{className:"cal-skel-bar"}),e.jsx("span",{className:"cal-skel-bar is-short"})]},n))}):e.jsx("div",{className:"cal-grid",children:K.map(t=>{const n=ce.get(t.key)??[],c=n.slice(0,3),o=n.length-c.length,d=n.some(k=>k.state==="overdue"),R=`cal-cell ${t.inMonth?"":"is-other"} ${t.key===w?"is-today":""} ${t.key===q?"is-selected":""} ${d?"has-overdue":""}`;return e.jsxs("div",{className:R,role:"button",tabIndex:0,onClick:()=>S(t.key),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),S(t.key))},children:[e.jsxs("div",{className:"cal-cell-head",children:[e.jsx("span",{className:"cal-cell-date",children:t.day}),t.key===w&&e.jsx("span",{className:"cal-today-pill",children:"今天"}),n.length>0&&e.jsx("span",{className:"cal-cell-n",children:n.length})]}),e.jsxs("div",{className:"cal-chips",children:[c.map(k=>e.jsx(He,{entry:k,highlighted:k.taskId===v,onClick:()=>S(t.key)},k.id)),o>0&&e.jsxs("button",{type:"button",className:"cal-more",onClick:()=>S(t.key),children:["+",o," 更多"]})]})]},t.key)})})]}),e.jsxs("aside",{className:"cal-detail",children:[e.jsxs("div",{className:"cal-detail-head",children:[e.jsx("h2",{children:ye}),e.jsxs("span",{className:"cal-detail-n",children:[P.length," 项"]})]}),e.jsx("div",{className:"cal-detail-list",children:P.length===0?e.jsxs("div",{className:"cal-empty",children:[e.jsx(oe,{size:28,strokeWidth:1.4}),e.jsx("p",{children:"这一天没有安排"}),e.jsx("small",{children:"点击其他日期查看安排与提醒"})]}):P.map(t=>{var n;return e.jsx(Ke,{entry:t,highlighted:t.taskId===v,onEditSchedule:r!=null&&r.todoGet&&r.todoCommand&&t.taskId&&((n=t.scheduleRef)!=null&&n.startsWith("agentroam:todo_execution_schedules:"))?()=>void Ce(t.taskId):void 0},t.id)})})]})]}),e.jsxs("section",{className:`cal-unscheduled ${G?"is-open":""}`,children:[e.jsxs("button",{type:"button",className:"cal-unscheduled-head",onClick:()=>H(t=>!t),"aria-expanded":G,children:[e.jsx(ge,{size:16}),e.jsx("span",{children:"无日期待办"}),e.jsxs("span",{className:"cal-unscheduled-n",children:[i.length," 项"]}),e.jsx(Le,{size:16,className:"cal-unscheduled-chev"})]}),G&&e.jsxs("div",{className:"cal-unscheduled-body",children:[i.length>0&&e.jsx("div",{className:"cal-unsched-schedule-list",children:i.map(t=>{var d;const n=T===t.task.id,c=t.task.status==="completed",o=t.task.status==="in_progress"?"进行中":t.task.status==="failed"?"执行失败":"";return e.jsxs("div",{className:`cal-unsched-schedule ${t.task.id===v?"is-highlight":""}`,"data-source":"customer-agent",children:[e.jsxs("div",{className:"cal-unsched-row",children:[c?e.jsx(ke,{state:"completed"}):e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":`完成 ${t.task.title}`,disabled:!!f,onClick:()=>void we(t),children:e.jsx(fe,{size:13})}),e.jsx("button",{type:"button",className:`cal-unsched-title${c?" is-struck":""}`,"aria-expanded":n,title:n?"收起详情":"查看详情",onClick:()=>Y(n?"":t.task.id),children:t.task.title})]}),o&&e.jsx("p",{children:o}),n&&e.jsxs("div",{className:"cal-unsched-expand",children:[t.task.description&&e.jsx("p",{children:t.task.description}),((d=t.schedule)==null?void 0:d.enabled)&&e.jsxs("p",{children:["下次执行:",t.schedule.nextFireAt?new Date(t.schedule.nextFireAt).toLocaleString("zh-CN",{hour12:!1}):"—"," · ",t.schedule.target.agentType]}),t.reminders.some(R=>R.enabled)&&e.jsx("p",{children:"已设置提醒"}),(r==null?void 0:r.todoCommand)&&t.schedule&&!c&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:()=>M({...t,schedule:t.schedule}),children:"编辑执行计划"})]})]},t.task.id)})}),i.length===0&&e.jsxs("div",{className:"cal-empty is-inline",children:[e.jsx(oe,{size:24,strokeWidth:1.4}),e.jsx("p",{children:"没有无日期待办"})]})]})]}),A&&e.jsx("div",{className:"cal-schedule-overlay",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cal-schedule-title",className:"cal-schedule-dialog",children:[e.jsx("h2",{id:"cal-schedule-title",children:A.task.title}),e.jsx(_e,{detail:A,onSave:Se,onClose:ie},A.task.id)]})})]})}export{Ke as EntryRow,st as default,he as personalTodoCalendarTime};
|
|
31
|
+
*/const Fe=$("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),B=["customer-agent","codex","claude","workbuddy","zcode","opencode","deepseek"],Z={"customer-agent":"AgentRoam",codex:"Codex",claude:"Claude Code",workbuddy:"WorkBuddy",zcode:"ZCode",opencode:"OpenCode",deepseek:"DeepSeek"};function I(s){const a=new Date(s),m=`${a.getMonth()+1}`.padStart(2,"0"),x=`${a.getDate()}`.padStart(2,"0");return`${a.getFullYear()}-${m}-${x}`}function _e({detail:s,onSave:a,onClose:m}){const{task:x,schedule:i}=s,g=i.trigger.kind==="cron",[j,p]=l.useState(i.target.agentType),[v,F]=l.useState(()=>{if(i.trigger.kind==="cron")return i.trigger.expression;const u=new Date(i.trigger.at);return new Date(u.getTime()-u.getTimezoneOffset()*6e4).toISOString().slice(0,19)}),[T,Y]=l.useState(i.enabled),[A,M]=l.useState([]),[f,r]=l.useState(!1),[D,w]=l.useState("");l.useEffect(()=>{var h,b;let u=!0;return(b=(h=window.agentApi)==null?void 0:h.getRuntimeHealth)==null||b.call(h).then(E=>{u&&M(E.filter(N=>!N.available).map(N=>N.agentType))}).catch(()=>{}),()=>{u=!1}},[]);async function C(u){if(u.preventDefault(),f)return;const h=g?{kind:"cron",expression:v.trim()}:{kind:"once",at:new Date(v).getTime()};if(h.kind==="once"&&(!Number.isFinite(h.at)||T&&h.at<=Date.now())){w("请选择有效的未来执行时间");return}r(!0),w("");const b=i.target,E=j===b.agentType?void 0:{agentType:j,cwd:b.cwd,permissionMode:b.permissionMode},N=h.kind==="once"&&i.trigger.kind==="once"?h.at!==i.trigger.at:h.kind==="cron"&&i.trigger.kind==="cron"&&h.expression!==i.trigger.expression;try{await a({type:"schedule",taskId:x.id,expectedVersion:x.version,enabled:T,...E?{target:E}:{},...N?{trigger:h}:{}})}catch(L){w(L instanceof Error?L.message:"执行计划保存失败")}finally{r(!1)}}return e.jsxs("form",{className:"cal-schedule-editor",onSubmit:C,"aria-label":"编辑执行计划",children:[e.jsxs("label",{children:["执行 Agent",e.jsxs("select",{value:j,onChange:u=>p(u.target.value),disabled:f,children:[!me(i.target.agentType)&&e.jsx("option",{value:i.target.agentType,children:i.target.agentType}),Ae.map(u=>e.jsx("option",{value:u,disabled:A.includes(u)&&u!==i.target.agentType,children:pe[u]},u))]})]}),e.jsxs("label",{children:[g?`执行规则(${i.timeZone})`:"执行时间(本地时间)",e.jsx("input",{type:g?"text":"datetime-local",step:g?void 0:1,value:v,required:!0,disabled:f,onChange:u=>F(u.target.value)})]}),e.jsxs("label",{className:"cal-schedule-enabled",children:[e.jsx("input",{type:"checkbox",checked:T,disabled:f,onChange:u=>Y(u.target.checked)}),"启用执行计划"]}),D&&e.jsx("p",{role:"alert",children:D}),e.jsxs("div",{className:"cal-schedule-actions",children:[e.jsx("button",{type:"button",className:"cal-nav-btn",onClick:m,disabled:f,children:"取消"}),e.jsx("button",{type:"submit",className:"cal-nav-btn",disabled:f,children:f?"保存中":"保存"})]})]})}const ue=["一","二","三","四","五","六","日"],Ue={upcoming:"待执行",paused:"已暂停",completed:"已完成",failed:"失败",overdue:"已过期",pending:"待处理","in-progress":"进行中",unscheduled:"未排期"},Oe=3e4;function Ve(s){const a=new Date(s);return a.setHours(0,0,0,0),a.getTime()}function V(s){const a=new Date(s);return`${`${a.getHours()}`.padStart(2,"0")}:${`${a.getMinutes()}`.padStart(2,"0")}`}function Ye(s,a){return`${s}年${a+1}月`}function he({task:s,schedule:a,reminders:m,executions:x}){var g,j;return s.dueAt!==void 0?s.dueAt:a!=null&&a.enabled&&a.nextFireAt!==null?a.nextFireAt:s.status==="completed"&&(a==null?void 0:a.trigger.kind)==="once"?a.trigger.at:(a&&((g=x.find(p=>p.scheduleId===a.id&&(s.status==="completed"||p.generation===a.generation)))==null?void 0:g.scheduledAt))??((j=m.find(p=>p.enabled&&p.nextFireAt!==null))==null?void 0:j.nextFireAt)??void 0}function qe(s,a){const m=new Date(s,a,1),x=(m.getDay()+6)%7,i=Ve(m.getTime())-x*864e5;return Array.from({length:42},(g,j)=>{const p=i+j*864e5,v=new Date(p);return{key:I(p),day:v.getDate(),inMonth:v.getMonth()===a,ms:p}})}function Ge({kind:s,size:a=12}){return s==="cron"?e.jsx(fe,{size:a,"aria-hidden":"true"}):s==="run"?e.jsx(Fe,{size:a,"aria-hidden":"true"}):e.jsx(Ie,{size:a,"aria-hidden":"true"})}function ke({state:s}){return s==="completed"?e.jsx(je,{size:12,className:"cal-mark is-done",role:"img","aria-label":"已完成"}):s==="failed"?e.jsx(xe,{size:12,className:"cal-mark is-fail","aria-label":"失败"}):s==="in-progress"?e.jsx("span",{className:"cal-pulse","aria-label":"进行中"}):s==="paused"?e.jsx(ze,{size:11,className:"cal-mark is-pause","aria-label":"已暂停"}):null}function ve({source:s,executionAgentType:a}){return!a||a==="customer-agent"?{tone:s,label:Z[s]}:me(a)?{tone:a==="claude-code"?"claude":a==="deepseek-harness"?"deepseek":a,label:pe[a]}:{tone:s,label:a}}function He({entry:s,onClick:a,highlighted:m}){const x=`cal-chip kind-${s.kind} is-${s.state}${m?" is-highlight":""}`,{tone:i,label:g}=ve(s),j=`${g} · ${s.title}`,p=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cal-chip-dot","aria-hidden":"true"}),e.jsx("span",{className:"cal-chip-time",children:s.kind==="todo"?s.dueAt?V(s.dueAt):"待办":V(s.at)}),e.jsx("span",{className:"cal-chip-title",children:s.title}),e.jsx(ke,{state:s.state}),s.state==="overdue"&&e.jsx("span",{className:"cal-tag is-overdue",children:"过期"}),s.state==="paused"&&e.jsx("span",{className:"cal-tag is-paused",children:"暂停"})]});return a?e.jsx("button",{type:"button",className:x,"data-source":i,onClick:a,title:j,children:p}):e.jsx("div",{className:x,"data-source":i,title:j,children:p})}function Ke({entry:s,highlighted:a,onEditSchedule:m}){const{tone:x,label:i}=ve(s);return e.jsxs("article",{className:`cal-entry is-${s.state}${a?" is-highlight":""}`,"data-source":x,"data-task-id":s.taskId,children:[e.jsxs("div",{className:"cal-entry-top",children:[e.jsx("span",{className:"cal-entry-src",children:i}),e.jsx("span",{className:`cal-entry-state is-${s.state}`,children:Ue[s.state]??s.state}),e.jsxs("span",{className:"cal-entry-time",children:[e.jsx(Ge,{kind:s.kind}),s.kind==="todo"?s.dueAt?V(s.dueAt):"无截止":V(s.at)]})]}),e.jsx("h4",{className:`cal-entry-title ${s.state==="completed"?"is-struck":""}`,children:s.title}),e.jsxs("div",{className:"cal-entry-meta",children:[s.scheduleLabel&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(Re,{size:11}),s.scheduleLabel]}),s.recurring&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(fe,{size:11}),"循环"]}),s.sessionTitle&&e.jsxs("span",{className:"cal-meta-pill",title:s.sessionTitle,children:[e.jsx(ge,{size:11}),s.sessionTitle]})]}),s.executedAt!==void 0&&e.jsxs("p",{className:"cal-entry-detail",children:["执行记录:",new Date(s.executedAt).toLocaleString("zh-CN",{hour12:!1})]}),s.kind==="cron"&&s.state==="overdue"&&e.jsx("p",{className:"cal-entry-detail",children:"计划时间已过,未找到执行结果;不代表执行成功或失败。"}),s.detail&&e.jsx("p",{className:"cal-entry-detail",children:s.detail}),s.cwd&&e.jsx("p",{className:"cal-entry-cwd",title:s.cwd,children:s.cwd}),m&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:m,children:"编辑执行计划"})]})}function tt({loadOverview:s,onClose:a,initialTaskId:m,focusKey:x=0}){const[i,g]=l.useState([]),[j,p]=l.useState(""),[v,F]=l.useState(""),[T,Y]=l.useState(""),[A,M]=l.useState(null),f=l.useRef(0),r=typeof window>"u"?void 0:window.agentApi,D=new Date,w=I(D.getTime()),[C,u]=l.useState({year:D.getFullYear(),month:D.getMonth()}),[h,b]=l.useState(null),[E,N]=l.useState(!0),[L,_]=l.useState(""),[be,X]=l.useState(!1),[q,S]=l.useState(w),[U,J]=l.useState(()=>new Set(B)),[G,H]=l.useState(!0),Q=l.useRef({from:"",to:""}),z=l.useRef(!0),O=l.useRef(0),ee=l.useCallback(async t=>{const n=++O.current;J(c=>new Set([...c,"customer-agent"])),F(t);try{const c=r!=null&&r.todoGet?await r.todoGet(t):void 0;if(n!==O.current)return;const o=c&&he(c);if(o!==void 0){const d=new Date(o);u({year:d.getFullYear(),month:d.getMonth()}),S(I(o))}else H(!0)}catch{n===O.current&&H(!0)}},[r]);l.useEffect(()=>(m&&ee(m),()=>{O.current++}),[m,x,ee]);const K=l.useMemo(()=>qe(C.year,C.month),[C]),te=K[0].key,se=K[41].key;Q.current={from:te,to:se};const y=l.useCallback(async t=>{var o;const{from:n,to:c}=Q.current;t==="initial"?N(!0):X(!0);try{const d=typeof window>"u"?void 0:window.agentApi,[R,k]=await Promise.all([s(n,c),(o=d==null?void 0:d.todoList)==null?void 0:o.call(d,{limit:200}).catch(()=>{})]);if(!z.current)return;k&&g(k.items.filter(re=>re.task.status!=="cancelled"&&he(re)===void 0)),b(R),_("")}catch(d){if(!z.current)return;_(d instanceof Error?d.message:"日历加载失败")}finally{z.current&&(N(!1),X(!1))}},[s]);l.useEffect(()=>{z.current=!0,y("initial");const t=setInterval(()=>{document.visibilityState==="visible"&&y("refresh")},Oe),n=()=>{document.visibilityState==="visible"&&y("refresh")};return document.addEventListener("visibilitychange",n),()=>{z.current=!1,clearInterval(t),document.removeEventListener("visibilitychange",n)}},[y,te,se]);const ae=t=>{u(n=>{const c=new Date(n.year,n.month+t,1);return{year:c.getFullYear(),month:c.getMonth()}})},ne=()=>{const t=new Date;u({year:t.getFullYear(),month:t.getMonth()}),S(I(t.getTime()))},ce=l.useMemo(()=>{const t=new Map;if(!h)return t;for(const[n,c]of Object.entries(h.days)){const o=c.filter(d=>d.kind!=="todo"&&U.has(d.source));o.length&&t.set(n,o)}return t},[h,U]),P=ce.get(q)??[],le=l.useMemo(()=>h?B.filter(t=>{var n;return!((n=h.sources[t])!=null&&n.ok)}).map(t=>{var n;return{source:t,error:((n=h.sources[t])==null?void 0:n.error)??""}}):[],[h]),Ne=t=>{J(n=>{const c=new Set(n);return c.has(t)?c.delete(t):c.add(t),c})},W=new Date(`${q}T00:00:00`),ye=`${W.getMonth()+1} 月 ${W.getDate()} 日 · 周${ue[(W.getDay()+6)%7]}`,we=async t=>{var n;p(t.task.id);try{const c=await((n=r==null?void 0:r.todoCommand)==null?void 0:n.call(r,{type:"complete",taskId:t.task.id,expectedVersion:t.task.version},crypto.randomUUID()));c&&g(o=>o.map(d=>d.task.id===c.task.id?c:d)),await y("refresh")}catch(c){_(c instanceof Error?c.message:"待办更新失败")}finally{p("")}},Ce=async t=>{var c;const n=++f.current;try{const o=await((c=r==null?void 0:r.todoGet)==null?void 0:c.call(r,t));n===f.current&&(o!=null&&o.schedule)&&M({...o,schedule:o.schedule})}catch(o){n===f.current&&_(o instanceof Error?o.message:"读取执行计划失败")}},ie=()=>{f.current++,M(null)},Se=async t=>{var o;if(!(r!=null&&r.todoCommand))throw new Error("当前服务不支持编辑待办");const n=await r.todoCommand(t,crypto.randomUUID());ie();const c=(o=n.schedule)==null?void 0:o.nextFireAt;if(c!=null){const d=new Date(c);u({year:d.getFullYear(),month:d.getMonth()}),S(I(c)),F(n.task.id)}await y("refresh")};return e.jsxs("div",{className:"cal-root",children:[e.jsx("div",{className:"cal-aurora","aria-hidden":"true"}),e.jsxs("header",{className:"cal-header",children:[e.jsxs("div",{className:"cal-title",children:[e.jsx("span",{className:"cal-title-icon",children:e.jsx($e,{size:20,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h1",{children:"智能体日历"}),e.jsx("p",{children:"定时任务与待办"})]})]}),e.jsxs("div",{className:"cal-nav",children:[a&&e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"返回聊天",title:"返回聊天",onClick:a,children:e.jsx(xe,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"上个月",onClick:()=>ae(-1),children:e.jsx(De,{size:17})}),e.jsx("button",{type:"button",className:"cal-month",onClick:ne,title:"回到今天",children:Ye(C.year,C.month)}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"下个月",onClick:()=>ae(1),children:e.jsx(Te,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"回到今天",title:"回到今天",onClick:ne,children:e.jsx(Me,{size:17})}),e.jsx("button",{type:"button",className:`cal-refresh ${be?"is-spinning":""}`,"aria-label":"刷新",title:"刷新",onClick:()=>void y("refresh"),children:e.jsx(Ee,{size:17})})]})]}),e.jsx("div",{className:"cal-filters",children:e.jsx("div",{className:"cal-sources",role:"group","aria-label":"按来源筛选",children:B.map(t=>{var n;return e.jsxs("button",{type:"button","data-source":t,className:`cal-source-chip ${U.has(t)?"is-on":"is-off"}`,onClick:()=>Ne(t),"aria-pressed":U.has(t),children:[e.jsx("span",{className:"cal-source-dot","aria-hidden":"true"}),Z[t],h&&e.jsx("span",{className:"cal-source-n",children:((n=h.sources[t])==null?void 0:n.entries)||0})]},t)})})}),le.length>0&&e.jsx("div",{className:"cal-source-errors",role:"status",children:le.map(({source:t,error:n})=>e.jsxs("span",{className:"cal-source-error","data-source":t,title:n,children:[e.jsx(de,{size:12}),Z[t]," 读取异常"]},t))}),L&&e.jsxs("div",{className:"cal-error",role:"alert",children:[e.jsx(de,{size:16}),L,e.jsx("button",{type:"button",onClick:()=>void y("initial"),children:"重试"})]}),e.jsxs("div",{className:"cal-body",children:[e.jsxs("div",{className:"cal-grid-wrap",children:[e.jsx("div",{className:"cal-weekdays",children:ue.map(t=>e.jsxs("span",{className:t==="六"||t==="日"?"is-weekend":"",children:["周",t]},t))}),E&&!h?e.jsx("div",{className:"cal-grid is-skeleton",children:Array.from({length:42},(t,n)=>e.jsxs("div",{className:"cal-cell cal-skeleton-cell",children:[e.jsx("span",{className:"cal-skel-bar"}),e.jsx("span",{className:"cal-skel-bar is-short"})]},n))}):e.jsx("div",{className:"cal-grid",children:K.map(t=>{const n=ce.get(t.key)??[],c=n.slice(0,3),o=n.length-c.length,d=n.some(k=>k.state==="overdue"),R=`cal-cell ${t.inMonth?"":"is-other"} ${t.key===w?"is-today":""} ${t.key===q?"is-selected":""} ${d?"has-overdue":""}`;return e.jsxs("div",{className:R,role:"button",tabIndex:0,onClick:()=>S(t.key),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),S(t.key))},children:[e.jsxs("div",{className:"cal-cell-head",children:[e.jsx("span",{className:"cal-cell-date",children:t.day}),t.key===w&&e.jsx("span",{className:"cal-today-pill",children:"今天"}),n.length>0&&e.jsx("span",{className:"cal-cell-n",children:n.length})]}),e.jsxs("div",{className:"cal-chips",children:[c.map(k=>e.jsx(He,{entry:k,highlighted:k.taskId===v,onClick:()=>S(t.key)},k.id)),o>0&&e.jsxs("button",{type:"button",className:"cal-more",onClick:()=>S(t.key),children:["+",o," 更多"]})]})]},t.key)})})]}),e.jsxs("aside",{className:"cal-detail",children:[e.jsxs("div",{className:"cal-detail-head",children:[e.jsx("h2",{children:ye}),e.jsxs("span",{className:"cal-detail-n",children:[P.length," 项"]})]}),e.jsx("div",{className:"cal-detail-list",children:P.length===0?e.jsxs("div",{className:"cal-empty",children:[e.jsx(oe,{size:28,strokeWidth:1.4}),e.jsx("p",{children:"这一天没有安排"}),e.jsx("small",{children:"点击其他日期查看安排与提醒"})]}):P.map(t=>{var n;return e.jsx(Ke,{entry:t,highlighted:t.taskId===v,onEditSchedule:r!=null&&r.todoGet&&r.todoCommand&&t.taskId&&((n=t.scheduleRef)!=null&&n.startsWith("agentroam:todo_execution_schedules:"))?()=>void Ce(t.taskId):void 0},t.id)})})]})]}),e.jsxs("section",{className:`cal-unscheduled ${G?"is-open":""}`,children:[e.jsxs("button",{type:"button",className:"cal-unscheduled-head",onClick:()=>H(t=>!t),"aria-expanded":G,children:[e.jsx(ge,{size:16}),e.jsx("span",{children:"无日期待办"}),e.jsxs("span",{className:"cal-unscheduled-n",children:[i.length," 项"]}),e.jsx(Le,{size:16,className:"cal-unscheduled-chev"})]}),G&&e.jsxs("div",{className:"cal-unscheduled-body",children:[i.length>0&&e.jsx("div",{className:"cal-unsched-schedule-list",children:i.map(t=>{var d;const n=T===t.task.id,c=t.task.status==="completed",o=t.task.status==="in_progress"?"进行中":t.task.status==="failed"?"执行失败":"";return e.jsxs("div",{className:`cal-unsched-schedule ${t.task.id===v?"is-highlight":""}`,"data-source":"customer-agent",children:[e.jsxs("div",{className:"cal-unsched-row",children:[c?e.jsx(ke,{state:"completed"}):e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":`完成 ${t.task.title}`,disabled:!!j,onClick:()=>void we(t),children:e.jsx(je,{size:13})}),e.jsx("button",{type:"button",className:`cal-unsched-title${c?" is-struck":""}`,"aria-expanded":n,title:n?"收起详情":"查看详情",onClick:()=>Y(n?"":t.task.id),children:t.task.title})]}),o&&e.jsx("p",{children:o}),n&&e.jsxs("div",{className:"cal-unsched-expand",children:[t.task.description&&e.jsx("p",{children:t.task.description}),((d=t.schedule)==null?void 0:d.enabled)&&e.jsxs("p",{children:["下次执行:",t.schedule.nextFireAt?new Date(t.schedule.nextFireAt).toLocaleString("zh-CN",{hour12:!1}):"—"," · ",t.schedule.target.agentType]}),t.reminders.some(R=>R.enabled)&&e.jsx("p",{children:"已设置提醒"}),(r==null?void 0:r.todoCommand)&&t.schedule&&!c&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:()=>M({...t,schedule:t.schedule}),children:"编辑执行计划"})]})]},t.task.id)})}),i.length===0&&e.jsxs("div",{className:"cal-empty is-inline",children:[e.jsx(oe,{size:24,strokeWidth:1.4}),e.jsx("p",{children:"没有无日期待办"})]})]})]}),A&&e.jsx("div",{className:"cal-schedule-overlay",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cal-schedule-title",className:"cal-schedule-dialog",children:[e.jsx("h2",{id:"cal-schedule-title",children:A.task.title}),e.jsx(_e,{detail:A,onSave:Se,onClose:ie},A.task.id)]})})]})}export{Ke as EntryRow,tt as default,he as personalTodoCalendarTime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as n,k as H,X as O,h as U,l as K}from"./index-YrEOkxAg.js";import{C as V,a as Y}from"./types-CfOuS-6l.js";import{H as Z}from"./HostProjectPicker-DUUgM2Cm.js";import{c as L,A as P}from"./client-Bb0hpbIR.js";import{C as G}from"./chevron-right-BGU3tcLA.js";import{c as q,b as ee,S as _}from"./session-tree-CTzXmV6R.js";import{S as te}from"./file-types-nujx8XUw.js";import{U as ae}from"./collaboration-e_iziKU1.js";import{F as se}from"./trash-2-C682LDDA.js";import{C as Q}from"./chevron-down-Dvinwg2S.js";function le({title:r,expanded:s,onToggle:o}){const g=`${s?"收起":"展开"}子会话:${r}`;return e.jsx("button",{type:"button",className:"sidebar-session-toggle ui-icon-button ui-icon-button--small","aria-label":g,title:g,"aria-expanded":s,onClick:o,children:e.jsx(G,{size:15,className:`sidebar-session-disclosure${s?" is-expanded":""}`,"aria-hidden":"true"})})}function re(){const[r,s]=n.useState(()=>new Set);function o(g){s(S=>{const h=new Set(S);return h.has(g)?h.delete(g):h.add(g),h})}return{expandedIds:r,toggle:o,collapseAll:()=>s(new Set)}}function ne(r,s){return[...new Map([...r,...s].map(o=>[o.id,o])).values()]}function ce({value:r,onChange:s}){const[o,g]=n.useState(""),S=re(),[h,w]=n.useState({data:[],nextCursor:null,total:0}),[x,v]=n.useState(!0),[u,b]=n.useState(""),[l,d]=n.useState(0),i=n.useRef(0),j=n.useRef(!1);n.useEffect(()=>{const t=++i.current;let c=!0;j.current=!0,v(!0),b(""),w({data:[],nextCursor:null,total:0});const p=setTimeout(()=>{L({action:"sessionCatalog",query:o,limit:20}).then(f=>{c&&t===i.current&&w({...f,data:q(f)})}).catch(f=>{c&&t===i.current&&b(f instanceof Error?f.message:"无法加载会话")}).finally(()=>{c&&t===i.current&&(j.current=!1,v(!1))})},o?200:0);return()=>{c=!1,clearTimeout(p)}},[o,l]);const y=async()=>{if(j.current||!h.nextCursor)return;const t=i.current;j.current=!0,v(!0),b("");try{const c=await L({action:"sessionCatalog",query:o,limit:20,cursor:h.nextCursor});t===i.current&&w(p=>({...c,data:ne(p.data,q(c))}))}catch(c){t===i.current&&b(c instanceof Error?c.message:"加载更多失败")}finally{t===i.current&&(j.current=!1,v(!1))}},A=new Set(r.map(t=>t.id)),C=ee(h.data),z=new Map(h.data.map(t=>[t.id,t])),N=({session:t,children:c})=>{const p=S.expandedIds.has(t.id);return e.jsxs("div",{children:[e.jsxs("div",{className:"collab-monitor-entry",children:[e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${t.title}`,checked:A.has(t.id),disabled:!A.has(t.id)&&r.length>=200,onChange:f=>s(f.target.checked?[...r,{id:t.id,agentType:t.agentType,title:t.title,cwd:t.cwd,projectId:t.projectId}]:r.filter(D=>D.id!==t.id))}),e.jsx(H,{agentType:t.agentType,size:18}),e.jsx(_,{session:t}),e.jsxs("span",{className:"collab-monitor-row-text",children:[e.jsx("strong",{children:t.title}),e.jsxs("small",{children:[P[t.agentType]," · ",t.cwd]})]}),e.jsx("em",{className:t.status==="running"?"is-running":"",children:t.status==="running"?"运行中":t.status==="failed"?"异常":t.status==="completed"?"已完成":"空闲"})]}),c.length>0&&e.jsx(le,{title:t.title,expanded:p,onToggle:()=>S.toggle(t.id)})]}),p&&c.length>0&&e.jsx("div",{className:"collab-monitor-children",role:"group","aria-label":`${t.title}的子会话`,children:c.map(N)})]},t.id)};return e.jsxs("section",{className:"collab-monitor-picker","aria-label":"关联原始会话",children:[e.jsx("div",{className:"collab-monitor-heading",children:e.jsxs("strong",{children:["关联原始会话 ",e.jsxs("small",{children:["选填 · 已选 ",r.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),r.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:r.map(t=>e.jsxs("span",{title:`${P[t.agentType]} · ${t.cwd}`,children:[e.jsx(H,{agentType:t.agentType,size:14}),e.jsx(_,{session:z.get(t.id)??t}),e.jsx("span",{children:t.title}),e.jsx("button",{type:"button","aria-label":`取消关联${t.title}`,onClick:()=>s(r.filter(c=>c.id!==t.id)),children:e.jsx(O,{size:13})})]},t.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(te,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:o,onChange:t=>g(t.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":x,onScroll:t=>{const c=t.currentTarget;c.scrollHeight-c.scrollTop-c.clientHeight<64&&y()},children:[C.map(N),!x&&!u&&!C.length&&e.jsx("p",{className:"collab-muted",children:o?"没有匹配的会话":"暂无可接入会话"}),x&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),h.nextCursor&&!u&&e.jsx("button",{type:"button",className:"collab-monitor-more",disabled:x,onClick:()=>void y(),children:"加载更多会话"})]}),u&&e.jsxs("p",{className:"collab-error",role:"alert",children:[u," ",e.jsx("button",{type:"button",onClick:()=>d(t=>t+1),children:"重新加载"})]})]})}function I({children:r,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:r}),e.jsx(Q,{size:16,"aria-hidden":"true"})]})}function M(r){return{id:crypto.randomUUID(),name:r===0?"群主":`成员 ${r}`,agentType:"codex",role:""}}function oe({member:r,index:s,owner:o,supervisor:g,health:S,onChange:h,onRemove:w}){const[x,v]=n.useState([]),[u,b]=n.useState([]);return n.useEffect(()=>{let l=!0;return v([]),b([]),r.agentType==="customer-agent"?(window.agentApi.getSettings().then(d=>{l&&b(d.profiles.map(({id:i,name:j,modelId:y})=>({id:i,name:j,modelId:y})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(r.agentType).then(d=>{l&&v(d.models)}).catch(()=>{}),()=>{l=!1})},[r.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[o?e.jsx(V,{size:14}):e.jsx(ae,{size:14}),o?"群主":`成员 ${s}`,g?" · 监工":""]}),w&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${r.name}`,onClick:w,children:e.jsx(O,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:r.name,maxLength:100,onChange:l=>h({...r,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(I,{value:r.agentType,onChange:l=>h({...r,agentType:l.target.value,model:void 0,profileId:void 0}),children:Y.map(l=>{var d,i;return e.jsxs("option",{value:l,disabled:((d=S.find(j=>j.agentType===l))==null?void 0:d.available)===!1,children:[P[l],((i=S.find(j=>j.agentType===l))==null?void 0:i.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",r.agentType==="customer-agent"?e.jsxs(I,{value:r.profileId||"",onChange:l=>{const d=u.find(i=>i.id===l.target.value);h({...r,profileId:d==null?void 0:d.id,model:d?{id:d.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),u.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(I,{value:r.model?`${r.model.providerID||""}|${r.model.id}`:"",onChange:l=>{const d=x.find(i=>`${i.providerID||""}|${i.id}`===l.target.value);h({...r,model:d?{id:d.id,...d.providerID?{providerID:d.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),x.map(l=>e.jsxs("option",{value:`${l.providerID||""}|${l.id}`,children:[l.displayName||l.id,l.providerDisplayName?` · ${l.providerDisplayName}`:""]},`${l.providerID}|${l.id}`))]})]})]}),e.jsxs("details",{className:"collab-role-options",open:g||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:r.role.trim()?"已设置":o?"默认安排与汇总":"留空由群主分配"}),e.jsx(Q,{size:14})]}),e.jsx("textarea",{"aria-label":`${o?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:r.role,placeholder:g?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":o?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>h({...r,role:l.target.value})}),g&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function be({cwd:r,initialGroup:s,health:o,onClose:g,onCreated:S}){var F;const[h,w]=n.useState((s==null?void 0:s.name)||""),[x,v]=n.useState((s==null?void 0:s.cwd)||r||""),[u,b]=n.useState(()=>s?structuredClone(s.members):[M(0),M(1)]),[l,d]=n.useState((s==null?void 0:s.ownerId)||u[0].id),[i,j]=n.useState((s==null?void 0:s.maxParallel)||3),[y,A]=n.useState(()=>{var a;return structuredClone(((a=s==null?void 0:s.monitoring)==null?void 0:a.targets)??[])}),[C,z]=n.useState(s?((F=s.monitoring)==null?void 0:F.supervisorId)??"":u[0].id),[N,t]=n.useState(!1),[c,p]=n.useState(""),[f,D]=n.useState(!1),[W,R]=n.useState(!!(s!=null&&s.cwd)),[k,B]=n.useState(!1),X=async()=>{if(p(""),K()){D(!0);return}B(!0);try{const a=await window.agentApi.openFileDialog();a&&(v(a),R(!0))}catch(a){p(a instanceof Error?a.message:"无法选择工作目录")}finally{B(!1)}};return n.useEffect(()=>{const a=m=>{m.key==="Escape"&&!N&&!f&&!k&&g()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[g,N,f,k]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:a=>{a.target===a.currentTarget&&!N&&g()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async a=>{a.preventDefault(),t(!0),p("");try{if(!x.trim())throw new Error("请先选择工作目录");const m=u.find($=>{var E;return((E=o.find(J=>J.agentType===$.agentType))==null?void 0:E.available)===!1});if(m&&!s)throw new Error(`${m.name} 选择的 Agent 当前不可用`);const T=await L({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:h.trim()||"协作群",cwd:x.trim(),ownerId:l,members:u,maxParallel:Math.min(i,u.length),...y.length?{monitoring:{targets:y,...C?{supervisorId:C}:{}}}:{}}});S(T)}catch(m){p(m instanceof Error?m.message:String(m))}finally{t(!1)}},children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"一起完成一件事"}),e.jsx("h2",{id:"collab-create-title",children:s?"修改协作群":"拉个协作群"})]}),e.jsx("button",{type:"button","aria-label":"关闭群设置",onClick:g,disabled:N,children:e.jsx(O,{size:20})})]}),e.jsxs("div",{className:"collab-create-scroll",children:[e.jsxs("div",{className:"collab-group-fields",children:[e.jsxs("label",{children:[e.jsx("span",{children:"群名称"}),e.jsx("input",{autoFocus:!0,value:h,maxLength:100,placeholder:"例如:产品开发小组",onChange:a=>w(a.target.value)})]}),e.jsxs("label",{children:[e.jsx("span",{children:"工作目录"}),e.jsxs("button",{type:"button",className:"collab-directory-picker","aria-label":"选择工作目录","aria-haspopup":"dialog","aria-expanded":f,title:x||"选择工作目录",disabled:N||k,onClick:()=>void X(),children:[e.jsx(se,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:x?void 0:"collab-muted",children:k?"正在选择…":x||"选择工作目录"}),e.jsx(U,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),u.map((a,m)=>e.jsx(oe,{member:a,index:m,owner:a.id===l,supervisor:y.length>0&&a.id===C,health:o,onChange:T=>b($=>$.map(E=>E.id===T.id?T:E)),onRemove:a.id!==l&&u.length>2?()=>{a.id===C&&z(""),b(T=>T.filter($=>$.id!==a.id))}:void 0},a.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(I,{value:l,onChange:a=>d(a.target.value),children:u.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("button",{type:"button",disabled:u.length>=20,onClick:()=>b(a=>[...a,M(a.length)]),children:[e.jsx(U,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(I,{value:Math.min(i,u.length),onChange:a=>j(Number(a.target.value)),children:u.map((a,m)=>e.jsxs("option",{value:m+1,children:[m+1," 人"]},m+1))})]})]}),e.jsx(ce,{value:y,onChange:A}),y.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(I,{"aria-label":"选择监工成员",value:C,onChange:a=>z(a.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.name," · ",P[a.agentType]]},a.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),c&&e.jsx("p",{className:"collab-error",role:"alert",children:c}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:N||k||!x.trim(),type:"submit",children:N?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(Z,{open:f,initialPath:W?x:void 0,onCancel:()=>D(!1),onConfirm:a=>{v(a),R(!0),D(!1),p("")}})]})}export{be as C,le as S,re as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,u as O,j as e,R as P,h as S,X as $,k as _,a as g}from"./index-YrEOkxAg.js";import{C as B,a as G,b as M}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as H}from"./CollaborationCreateDialog-CE8OML-A.js";import{c as R,A as z}from"./client-Bb0hpbIR.js";import{p as U}from"./SessionDashboardBridge-Kc_1Et9r.js";import{U as T}from"./collaboration-e_iziKU1.js";import{S as Y,i as q}from"./file-types-nujx8XUw.js";import{P as F,T as Q}from"./trash-2-C682LDDA.js";import{C as X}from"./types-CfOuS-6l.js";import{A as J}from"./session-tree-CTzXmV6R.js";import"./HostProjectPicker-DUUgM2Cm.js";import"./chevron-right-BGU3tcLA.js";import"./chevron-down-Dvinwg2S.js";function K(){const[u,m]=t.useState([]),[x,h]=t.useState(!0),[f,o]=t.useState(""),l=t.useRef(0),r=t.useCallback(async()=>{const n=++l.current;h(!0);try{const i=await R({action:"groups"});l.current===n&&(m(i),o(""))}catch(i){l.current===n&&o(i instanceof Error?i.message:String(i))}finally{l.current===n&&h(!1)}},[]);return t.useEffect(()=>{r();const n=()=>{r()};return window.addEventListener("focus",n),()=>{l.current++,window.removeEventListener("focus",n)}},[r]),{groups:u,loading:x,error:f,refresh:r}}function de({onOpen:u,onChanged:m,onClose:x,onViewDashboard:h,cwd:f}){const{groups:o,loading:l,error:r,refresh:n}=K(),[i,L]=t.useState(""),[c,b]=t.useState(null),[j,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,I]=t.useState([]),E=O(s=>s.skin);t.useEffect(()=>{!l&&window.parent!==window&&window.parent.postMessage({type:B},window.location.origin)},[l]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&I(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:G,groupId:s.id,title:s.name},window.location.origin):location.assign(`?view=collaboration&groupId=${encodeURIComponent(s.id)}`)},A=(s,a)=>{m==null||m(s,a),window.parent!==window&&window.parent.postMessage({type:M,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),n()},k=o.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("main",{className:"collab-dashboard",children:[e.jsxs("header",{className:"collab-dashboard-heading",children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"协作空间"}),e.jsxs("h1",{children:["群聊列表 ",e.jsx("small",{children:o.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>h?h():U({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:l,onClick:()=>void n(),children:e.jsx(P,{size:17})}),e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:17}),"新增群聊"]}),x&&e.jsx("button",{"aria-label":"关闭群看板",onClick:x,children:e.jsx($,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(Y,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:i,onChange:s=>L(s.target.value)})]}),r&&e.jsxs("div",{className:"collab-error",role:"alert",children:[r,e.jsx("button",{onClick:()=>void n(),children:"重试"})]}),l&&o.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!r&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(T,{size:32}),e.jsx("h2",{children:i?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:i?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!i&&e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:16}),"新建第一个群"]})]}):e.jsx("section",{className:"collab-dashboard-grid","aria-label":"已保存的群聊","aria-busy":l,children:k.map(s=>{const a=s.members.find(d=>d.id===s.ownerId);return e.jsxs("article",{className:"collab-group-card",children:[e.jsxs("div",{className:"collab-card-heading",children:[e.jsxs("button",{className:"collab-card-title",onClick:()=>C(s),title:s.name,children:[e.jsx(T,{size:20}),e.jsx("h2",{children:s.name})]}),e.jsxs("div",{className:"collab-card-actions",children:[e.jsx("button",{"aria-label":`修改${s.name}`,title:"修改群设置",onClick:()=>b(s),children:e.jsx(F,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(Q,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(X,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&z[a.agentType]})]}),e.jsxs("div",{className:"collab-card-members","aria-label":`${s.members.length} 名群成员`,children:[s.members.slice(0,7).map(d=>e.jsx("span",{title:`${d.name} · ${z[d.agentType]}`,children:e.jsx(_,{agentType:d.agentType,size:18})},d.id)),e.jsxs("small",{children:[s.members.length," 人 · 最多 ",s.maxParallel," 人并行"]})]}),e.jsxs("p",{className:"collab-card-path",title:s.cwd,children:[e.jsx(q,{size:14}),e.jsx("span",{children:s.cwd})]}),e.jsxs("footer",{children:[e.jsxs("time",{dateTime:s.createdAt,children:[new Date(s.createdAt).toLocaleDateString("zh-CN")," 创建"]}),e.jsxs("button",{onClick:()=>C(s),children:["进入群聊",e.jsx(J,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(H,{cwd:f,initialGroup:c==="new"?void 0:c,health:D,onClose:()=>b(null),onCreated:s=>{const a=c==="new";b(null),A(s.id,s),a&&C(s)}},c==="new"?"new":c.id),document.body),j&&g.createPortal(e.jsx("div",{className:"collab-modal-backdrop",children:e.jsxs("section",{className:"collab-delete-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"collab-delete-title","aria-describedby":"collab-delete-description",children:[e.jsxs("h2",{id:"collab-delete-title",children:["删除“",j.name,"”?"]}),e.jsx("p",{id:"collab-delete-description",children:"删除后将停止监工并取消关联定时任务,原始业务会话和工作目录文件会保留。进行中的协作需要先停止。"}),v&&e.jsx("p",{className:"collab-error",role:"alert",children:v}),e.jsxs("footer",{children:[e.jsx("button",{autoFocus:!0,disabled:p,onClick:()=>w(null),children:"取消"}),e.jsx("button",{className:"collab-delete-confirm",disabled:p,onClick:async()=>{y(!0),N("");try{await R({action:"deleteGroup",groupId:j.id}),A(j.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{de as default};
|