limixbot 0.3.149 → 0.3.150
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/dist/assets/{ActivityPanel-BtjpbSCG.js → ActivityPanel-DbYr6aYG.js} +1 -1
- package/dist/assets/{App-26INIo6C.js → App-DMdy7cvM.js} +112 -112
- package/dist/assets/{AppEventEditor-DtY2Zgk3.js → AppEventEditor-BnXvgtnu.js} +1 -1
- package/dist/assets/{BotSettingsDialog-CIAkenzY.js → BotSettingsDialog-DgDog5Vz.js} +4 -4
- package/dist/assets/{BrowserPanel-CKCdXmHX.js → BrowserPanel-CfxLa87P.js} +2 -2
- package/dist/assets/{BrowserProfilesManager-CY3fpWTL.js → BrowserProfilesManager-h9vTMyYV.js} +1 -1
- package/dist/assets/CloudAddDialog-BarUVj7I.js +1 -0
- package/dist/assets/{ComputerFilesPane-BU-s7BlY.js → ComputerFilesPane-6jyzomuX.js} +1 -1
- package/dist/assets/ComputerPanel-DSFxuBSX.js +2 -0
- package/dist/assets/{DataPanel-VJJAqxxu.js → DataPanel-YetCcoMW.js} +1 -1
- package/dist/assets/{DesktopViewer-uyCSG2he.js → DesktopViewer-BXR4GFU3.js} +1 -1
- package/dist/assets/{GrokMoveDialog-w4WKHjBN.js → GrokMoveDialog-DjSRpKew.js} +1 -1
- package/dist/assets/{InspectorPanel-KeN8Krv4.js → InspectorPanel-CddEUpZ6.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-B0axO0UW.js → KeyboardShortcutsModal-Dnk1-1wi.js} +1 -1
- package/dist/assets/{KnowledgePanel-DahTsWA8.js → KnowledgePanel-DD271XCa.js} +1 -1
- package/dist/assets/LimixResizeHandles-CY1lhGls.js +1 -0
- package/dist/assets/{LiveDesktop-6_ms70VN.js → LiveDesktop-BkeilR0x.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-Ck4LV7UQ.js → LocalVmWorkspace-C-ZV6wNM.js} +1 -1
- package/dist/assets/{MacLocalControl-C-9MRdET.js → MacLocalControl-WmgLxL2q.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-DYzQsZt1.js → MarkdownFilePreview-xo7sq3Gv.js} +1 -1
- package/dist/assets/{MenuMotion-B0aZnuh_.js → MenuMotion-DG3_zhAW.js} +1 -1
- package/dist/assets/{NewBotDialog-Bx1yEPRI.js → NewBotDialog-CdRjfcXW.js} +1 -1
- package/dist/assets/PhoneAppDialog--fCFY0LE.js +1 -0
- package/dist/assets/PlacesRail-DxAWLcZN.js +1 -0
- package/dist/assets/{PluginsPanel-DV_bvv9b.js → PluginsPanel-0vdY_sy3.js} +5 -5
- package/dist/assets/{ProIntroduction-Mbg0N0IP.js → ProIntroduction-DqqHWmYG.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-CAyTUKX7.js → RemoteAgentSettingsPanel-Bpx08vUp.js} +1 -1
- package/dist/assets/{RoomPanel-CnZn0T2L.js → RoomPanel-DmHDsBy5.js} +1 -1
- package/dist/assets/{RoutinesPage-X1fycmDS.js → RoutinesPage-CWVJMviD.js} +3 -3
- package/dist/assets/SettingsModal-LStDRjh3.js +20 -0
- package/dist/assets/{ShareTeamDialog-BTYzF7-V.js → ShareTeamDialog-Cu1bC5ch.js} +1 -1
- package/dist/assets/{SignedInSites-BJlXZ7-O.js → SignedInSites-DxaWkOBZ.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-ZYJ8Q0ap.js → TeamLibraryPanel-CALrJ95_.js} +2 -2
- package/dist/assets/TeamMapPage-CckHySu4.js +1 -0
- package/dist/assets/{TriggersPage-RuEkgSPb.js → TriggersPage-_aLKe0p7.js} +1 -1
- package/dist/assets/VisibilitySection-Bw7GQ8wR.js +22 -0
- package/dist/assets/{WebhookTrigger-C6Y8whIS.js → WebhookTrigger-BDNVmmb9.js} +1 -1
- package/dist/assets/WorksOnGrid-J81hjFzK.js +1 -0
- package/dist/assets/{abnfDiagram-YUKMZFIV-DDXPrZzl.js → abnfDiagram-YUKMZFIV-Bgfbq9qO.js} +1 -1
- package/dist/assets/{activity-BlL5ycb5.js → activity-CTL6M7Nw.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-BiqBgMDV.js → architectureDiagram-47P4ROYG-O3f9TC9A.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-vc1neoFp.js → blockDiagram-E7TT5TSB-ynUBtTdY.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-CQbtBKOv.js → c4Diagram-CRA5TL53-DPsm_A9P.js} +1 -1
- package/dist/assets/{calendar-days-_dtxyR4U.js → calendar-days-BMRd2qAl.js} +1 -1
- package/dist/assets/channel-CDEIRnOe.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-Dq_aCCIt.js → chunk-2Q5K7J3B-DUNGHp3y.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-EcX_ZXzF.js → chunk-5VM5RSS4-D9denHw1.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-BA7CgKU2.js → chunk-7TKQ45FW-Dey4MHBQ.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-DkvVwaph.js → chunk-AW2ZBBNX-CFGfN9SB.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-CdyGRg6v.js → chunk-FVRAUYC3-BUtXxxy9.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-CS-veEVV.js → chunk-HTAEGDNF-Cql4WK8l.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BiUYpinX.js → chunk-JWPE2WC7-CYf-wOeu.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DDPkIuwB.js → chunk-KQW6MTUR-W-3blh4U.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-C4YyKEem.js → chunk-XXDRQBXY-VmWvo27u.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-BjmVbVHi.js → classDiagram-v2-K4WV4PDN-BLqM7WG5.js} +1 -1
- package/dist/assets/{coins-Cu3qn-3t.js → coins-C-LzbiEQ.js} +1 -1
- package/dist/assets/{core-ClKcQma9.js → core-CMPKx_ai.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Bra0B-5z.js → cose-bilkent-JH36ORCC-BPybX2kh.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-BRMKNbnx.js → cynefin-EF2NZ3EQ-Bi_Q7Ytj.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-DMhNix9A.js → cynefinDiagram-3GCD6N5R-Dv7Kek2q.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-BWwdFKCx.js → dagre-W4DXFKR2-D3_ZNQw-.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-D_4J-D-V.js → diagram-2UJZ2QOL-CFngbRxv.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CQ4l30Dm.js → diagram-OVF4WLC6-Py92D3Eq.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-D3W2IEHX.js → diagram-PFPMY2P6-Bj2AziyO.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-C9cpNhET.js → diagram-UMYRVEAY-TFRq5xde.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-DIyquCXt.js → diagram-YEKJPTXX-Djlbu2mG.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-CO6216kK.js → diagram-ZIFT7M5P-6WlLtaDx.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BeHXJPN4.js → ebnfDiagram-VR2GEFS7-CqxlFgJ9.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-BdT_tK3j.js → elk-IJKZMXRS-DDdM00S4.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-Cz_TiHab.js → erDiagram-O2IAPWRE-DlWtXesJ.js} +1 -1
- package/dist/assets/{file-up-flw1aUka.js → file-up-Dqe3RNVz.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-BXLr0anm.js → flowDiagram-OXPTDLAJ-nwNleALg.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-C37QIpaR.js → ganttDiagram-R7TSEDQI-Cs_gbPNT.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-Cs8fTfJZ.js → gitGraphDiagram-XJZIOB7I-C2NPrP0G.js} +1 -1
- package/dist/assets/{import-name-Cw10r2vZ.js → import-name-UStBgXlp.js} +1 -1
- package/dist/assets/{index-C7YXnZFx.js → index-C3QkWpbg.js} +3 -3
- package/dist/assets/{index-CJ2k9T6W.js → index-D8Y6bPwt.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BpliNVPR.js → infoDiagram-5W2HQ5XZ-CLwf4Y1H.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-Dov7w4qz.js → ishikawaDiagram-K3B6WC7H-BzO0Dn0V.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-DoihiGaK.js → journeyDiagram-COXZFDF6-DRbYHF6c.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-D_gNx8dG.js → kanban-definition-P3RFRI5V-BdB-0mlZ.js} +1 -1
- package/dist/assets/{mermaid.core-BYPxVPn-.js → mermaid.core-BQDLCsjv.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-wH2aKxFy.js → mindmap-definition-LZFPQGKD-BA6ze6xb.js} +1 -1
- package/dist/assets/{minimize-sGQL0Xsy.js → minimize--MbSo_De.js} +1 -1
- package/dist/assets/{monitor-zecPzfR5.js → monitor-CHGFGy9c.js} +1 -1
- package/dist/assets/{new-bot-CBPOqYyC.js → new-bot-CstvBWIB.js} +2 -2
- package/dist/assets/org-library-iMfdBShq.js +1 -0
- package/dist/assets/{package-format-ClUc1sA7.js → package-format-BZvL-kqt.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-B7RTZksQ.js → pegDiagram-BGZESJAR-CMJU1HyF.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-B5mPB7O-.js → pieDiagram-CAPJLFHJ-B6sZCFvm.js} +1 -1
- package/dist/assets/{pt-br-D-uO3BNY.js → pt-br-DW318t9V.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-CZqo7j7U.js → quadrantDiagram-GDMTTRAM-DuW0EnlR.js} +1 -1
- package/dist/assets/{rail-Ok0cs7cA.js → rail-BLp5VtOY.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-MFpfIts_.js → railroadDiagram-SM67HX2B-DghH6KW5.js} +1 -1
- package/dist/assets/{remote-desktop-panel-D3PotAlF.js → remote-desktop-panel-Cv5hyn-6.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-CJ49gC_q.js → requirementDiagram-X7JNWC4A-CDOIsz5H.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-DxpTSw3D.js → sankeyDiagram-UM26HJRW-Dgw5A7WO.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-XEyCx2Ue.js → sequenceDiagram-ZO4K6R2Y-c7yMm19a.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-1Fx1tcNn.js → sizeCapture-INFHLROL-BI17YAUb.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CwxyNDK4.js → stateDiagram-v2-TBUQTH76-BnVESwRu.js} +1 -1
- package/dist/assets/{styles-DO3EUxm2.js → styles-CInetnea.js} +7 -7
- package/dist/assets/{swimlanes-N4OXWK64-BuwwuENy.js → swimlanes-N4OXWK64-_n5_yOn8.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DcF6PiTM.js +8 -0
- package/dist/assets/{team-share-CL18_anr.js → team-share-PC0DJAzZ.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CauwqKMA.js → timeline-definition-YOQAKGHF-DJ9vz4Mm.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-YZ3Cf2do.js → usecaseDiagram-VIAY4XPW-pKJIv5SC.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-CDX8i7ID.js → vennDiagram-BLWOH2XV-D3r45Ztx.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CCdRrEMh.js → wardleyDiagram-YMQ3BMBF-B7LVmnGA.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-Vz4NaN0U.js → xychartDiagram-TAQBALBS-BT4mbGTI.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/drivers/agents-proxy.js +6 -6
- package/dist-server/drivers/pi-mcp-extension.ts +3 -3
- package/dist-server/index.js +155 -152
- package/dist-server/limixbot.js +117 -116
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +117 -116
- package/dist-server/server/app-settings/host.js +1 -1
- package/dist-server/server/app-settings/registry-config.js +1 -1
- package/dist-server/server/app-settings/registry-window.js +4 -4
- package/dist-server/server/app-settings/registry.js +3 -3
- package/dist-server/server/checkpoints.js +3 -2
- package/dist-server/server/cli-setup.js +1 -1
- package/dist-server/server/cloud-health.js +1 -1
- package/dist-server/server/drivers/agents-app-settings-tool.js +1 -1
- package/dist-server/server/drivers/agents-catalog.js +1 -1
- package/dist-server/server/drivers/codex-shared-home.js +1 -1
- package/dist-server/server/drivers/codex.js +23 -9
- package/dist-server/server/environment.js +1 -1
- package/dist-server/server/first-reply-rescue.js +10 -3
- package/dist-server/server/fleet-cli.js +2 -2
- package/dist-server/server/fleet-client.js +2 -2
- package/dist-server/server/headless/client.js +2 -2
- package/dist-server/server/headless/commands.js +8 -8
- package/dist-server/server/headless/connect.js +1 -1
- package/dist-server/server/headless/context.js +4 -4
- package/dist-server/server/headless/engine.js +1 -1
- package/dist-server/server/headless/export.js +1 -1
- package/dist-server/server/headless/run.js +3 -3
- package/dist-server/server/headless/team-apply.js +4 -4
- package/dist-server/server/headless/token.js +6 -6
- package/dist-server/server/index.js +1 -1
- package/dist-server/server/lent-computers.js +2 -2
- package/dist-server/server/login-handoff.js +1 -1
- package/dist-server/server/phone-link.js +1 -1
- package/dist-server/server/phone-relay.js +1 -1
- package/dist-server/server/routes/status.js +1 -1
- package/dist-server/server/routes/x-research.js +1 -1
- package/dist-server/server/sentinel/cli.js +6 -6
- package/dist-server/server/themes/routes.js +1 -1
- package/dist-server/server/thread-events.js +2 -0
- package/dist-server/shared/theme.js +1 -1
- package/package.json +1 -1
- package/dist/assets/CloudAddDialog-kWU09Ad1.js +0 -1
- package/dist/assets/ComputerPanel-BIFlIGlF.js +0 -2
- package/dist/assets/LimixResizeHandles-D850ftBI.js +0 -1
- package/dist/assets/PhoneAppDialog-fCMJgYOZ.js +0 -1
- package/dist/assets/PlacesRail-tZyNm-l3.js +0 -1
- package/dist/assets/SettingsModal-D6mYhjwS.js +0 -20
- package/dist/assets/TeamMapPage-D7x-_Igr.js +0 -1
- package/dist/assets/VisibilitySection-CHIMRzr1.js +0 -22
- package/dist/assets/WorksOnGrid-Ho88FaNW.js +0 -1
- package/dist/assets/channel-BzyEyDo_.js +0 -1
- package/dist/assets/org-library-DIJ4T2-a.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CcmXEgRh.js +0 -8
|
@@ -15,7 +15,7 @@ export function phoneLinkPrompt(count = olderPhoneApps) {
|
|
|
15
15
|
return "";
|
|
16
16
|
const phones = count === 1 ? "1 phone paired with this computer has" : `${count} phones paired with this computer have`;
|
|
17
17
|
return ` Phone link: this computer's secure link for older Limix Bot phone apps has ended, and ${phones} an older app that needed it, so it connects on the same Wi-Fi only.`
|
|
18
|
-
+ " If the person says their phone stopped connecting away from Wi-Fi, says \"No route to your computer\" or that \"Anywhere, through
|
|
18
|
+
+ " If the person says their phone stopped connecting away from Wi-Fi, says \"No route to your computer\" or that \"Anywhere, through Limix Bot\" doesn't work, this is why:"
|
|
19
19
|
+ " they update the Limix Bot app on that phone, then open it once on the same Wi-Fi as this computer; if that doesn't reconnect it, they pair it again in Settings → Phone & devices."
|
|
20
20
|
+ " Turning routes off and on, Try reconnecting, force-quitting the app away from that Wi-Fi or checking a VPN won't help.";
|
|
21
21
|
}
|
|
@@ -282,7 +282,7 @@ export function startPhoneRelay(options) {
|
|
|
282
282
|
if (!PAIRING_SESSION_ROUTES.has(`${method} ${path}`))
|
|
283
283
|
return reply(res, 401, { error: "pair this phone first" });
|
|
284
284
|
if (method === "POST" && devices.records().length >= MAX_RELAY_PHONES) {
|
|
285
|
-
return reply(res, 409, { error: `This server has ${MAX_RELAY_PHONES} phones on Limix Bot Relay. Remove one (
|
|
285
|
+
return reply(res, 409, { error: `This server has ${MAX_RELAY_PHONES} phones on Limix Bot Relay. Remove one (limixbot devices revoke ID), then pair again.` });
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
else {
|
|
@@ -57,7 +57,7 @@ export function createStatusRoutes(deps) {
|
|
|
57
57
|
return json(res, 403, { error: "Workspaces need an enterprise licence with the admin feature." });
|
|
58
58
|
const socket = fleetSocketPath();
|
|
59
59
|
if (!fleetAvailable(socket))
|
|
60
|
-
return json(res, 404, { error: "No fleet agent on this server. Run `
|
|
60
|
+
return json(res, 404, { error: "No fleet agent on this server. Run `limixbot fleet init --domain … --operator <this user>` as root." });
|
|
61
61
|
const [, resource, slug, sub] = fleetRoute;
|
|
62
62
|
let forward = null;
|
|
63
63
|
if (method === "GET" && !resource)
|
|
@@ -33,7 +33,7 @@ function parse(schema, body) {
|
|
|
33
33
|
function handleFrom(raw) {
|
|
34
34
|
const handle = normalizeHandle(raw);
|
|
35
35
|
if (!handle)
|
|
36
|
-
throw new XResearchError("bad_input", "handle must be an X handle such as @
|
|
36
|
+
throw new XResearchError("bad_input", "handle must be an X handle such as @example, or an x.com profile link.");
|
|
37
37
|
return handle;
|
|
38
38
|
}
|
|
39
39
|
async function run(action, body, client) {
|
|
@@ -4,15 +4,15 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { checkSentinelInstall } from "../service-unit.js";
|
|
5
5
|
import { defaultSentinelOut, outRefusal } from "./paths.js";
|
|
6
6
|
import { runScan } from "./scan.js";
|
|
7
|
-
export const SENTINEL_USAGE = `
|
|
7
|
+
export const SENTINEL_USAGE = `limixbot sentinel [--data-dir DIR] [--out DIR] [--once] [--json]
|
|
8
8
|
[--queue-wait SECONDS] [--cost USD]
|
|
9
|
-
|
|
9
|
+
limixbot sentinel --check-install [--json]
|
|
10
10
|
|
|
11
|
-
Scans
|
|
11
|
+
Scans a Limix Bot data dir, read-only, for failed tool calls, stopped or
|
|
12
12
|
timed-out turns, long queue waits, expensive turns and retry loops, and keeps
|
|
13
13
|
them as issues in issues.jsonl, outside the data dir: on macOS in
|
|
14
|
-
~/Library/Application Support/
|
|
15
|
-
$XDG_STATE_HOME/
|
|
14
|
+
~/Library/Application Support/limixbot-sentinel, on Linux in
|
|
15
|
+
$XDG_STATE_HOME/limixbot-sentinel (~/.local/state/…), or in --out. Issues
|
|
16
16
|
point at the evidence by id and carry a normalized one-line title; they never
|
|
17
17
|
copy tool output or message text.
|
|
18
18
|
|
|
@@ -61,7 +61,7 @@ export function parseSentinelArgs(argv, env = process.env) {
|
|
|
61
61
|
args.costUsd = scaled;
|
|
62
62
|
}
|
|
63
63
|
else
|
|
64
|
-
return { error: `unknown argument "${arg}"; see
|
|
64
|
+
return { error: `unknown argument "${arg}"; see limixbot sentinel --help`, json };
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
return { error: error instanceof Error ? error.message : String(error), json };
|
|
@@ -78,7 +78,7 @@ export function createThemeRoutes(deps) {
|
|
|
78
78
|
if (path === "/api/themes/import" && method === "POST") {
|
|
79
79
|
const parsed = themeExportSchema.safeParse(await readBody(req, IMPORT_LIMIT));
|
|
80
80
|
if (!parsed.success)
|
|
81
|
-
return json(res, 400, { error: "This is not a
|
|
81
|
+
return json(res, 400, { error: "This is not a Limix Bot theme file." });
|
|
82
82
|
const imported = store.importTheme(person, parsed.data);
|
|
83
83
|
return isRefusal(imported) ? json(res, 400, { error: imported.refusal }) : json(res, 200, imported);
|
|
84
84
|
}
|
|
@@ -138,6 +138,8 @@ export function isRuntimeEvent(value) {
|
|
|
138
138
|
case "session.exited":
|
|
139
139
|
return stringOrMissing(value.reason);
|
|
140
140
|
case "turn.started":
|
|
141
|
+
return value.awaitingAcceptance === undefined || value.awaitingAcceptance === true;
|
|
142
|
+
case "turn.accepted":
|
|
141
143
|
return true;
|
|
142
144
|
case "turn.retrying":
|
|
143
145
|
return (typeof value.attempt === "number" &&
|
|
@@ -213,7 +213,7 @@ const SHORTCUT = "Cmd+Option+Shift+R on a Mac, Ctrl+Alt+Shift+R elsewhere";
|
|
|
213
213
|
/** What a bot needs to restyle the app; app_settings `theme` returns it. */
|
|
214
214
|
export function themeGuide() {
|
|
215
215
|
return [
|
|
216
|
-
"A theme restyles
|
|
216
|
+
"A theme restyles Limix Bot's desktop app and web app for the person who asked, in every window they have open. Phones keep their own look.",
|
|
217
217
|
"",
|
|
218
218
|
"Colours first. `canvas` (hex) is the base background and `accent` (hex) the highlight; the app derives its surfaces, lines and text from them.",
|
|
219
219
|
"`skin` picks the built-in skin underneath, so anything the theme leaves out comes from it. `colors` sets single roles; `light` and `dark` hold canvas, accent and colors used only in that mode.",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,Q as z,R as ve,T as U,t as n,U as se,V as Q,W as X,Y as pe,Z as He,$ as Ee,a0 as ze,a1 as Ue,a2 as qe,a3 as G,a as ue,a4 as $e,a5 as Me,r as c,a6 as We,a7 as Ce,a8 as Ke,X as Ve,a9 as Ge,aa as Je,ab as Qe,ac as Xe}from"./styles-DO3EUxm2.js";import{L as Ye,o as Ze,p as fe,q as we,s as Ae,v as et,C as tt,w as nt,t as J,x as st,y as at,z as lt,F as ot,G as Le,S as dt,H as ct,I as rt,J as it}from"./PlacesRail-tZyNm-l3.js";import{u as ut}from"./App-26INIo6C.js";import"./monitor-zecPzfR5.js";import"./index-C7YXnZFx.js";import"./MenuMotion-B0aZnuh_.js";function pt({name:t,color:l,busy:o,interest:d,openFailed:s,onInterest:u,onOpen:p}){return e.jsxs("div",{"data-cloud-add":"has-cloud",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ve,{color:l,size:32}),e.jsx(U,{title:n("cloudBuy.one.title"),sub:n("cloudBuy.one.sub",{name:t})})]}),e.jsxs("div",{className:se,children:[d!=="sent"&&e.jsx("button",{type:"button",className:Q,disabled:o,onClick:u,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:X,disabled:o,onClick:p,children:n("cloudBuy.setup.open",{name:t})})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[d==="sent"&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.one.thanks")}),d==="failed"&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.one.failed")}),s&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.openFailed",{name:t})})]})]})}function ie({kind:t,line:l,onRetry:o,onClose:d}){return e.jsxs("div",{"data-cloud-add":t,className:z,children:[e.jsx(U,{title:n("cloudAdd.title")}),l?e.jsx("p",{role:"alert",className:"text-[14px] leading-5 text-ink",children:l}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] leading-[18px] text-ink-secondary",children:[e.jsx(Ye,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n("cloudAdd.checking")]}),e.jsxs("div",{className:se,children:[e.jsx("button",{type:"button",className:Q,onClick:d,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:X,onClick:o,children:n("cloudAdd.tryAgain")})]})]})}function ft({plan:t,offer:l,browser:o,late:d,link:s,email:u,busy:p,copied:v,failed:N,onReopen:k,onCopy:I,onChangePlan:q}){const y=l?.plans.find($=>$.tier===t)??null,E=y?Ze(y):fe(t),A=y?.trialDays===1?n("cloudBuy.pay.planTrial.one",{plan:E,due:we(0)}):y?.trialDays?n("cloudBuy.pay.planTrial.many",{plan:E,days:y.trialDays,due:we(0)}):y?n("cloudBuy.pay.planPaid",{plan:E,price:Ae(y.amount/100)}):E;return e.jsxs("div",{"data-cloud-add":d?"waiting-late":o==="signin"?"waiting-signin":"waiting",className:z,children:[e.jsx(U,{title:d?n("cloudBuy.pay.lateTitle"):n("cloudAdd.browserTitle"),sub:d?n("cloudBuy.pay.lateSub"):n(o==="signin"?"cloudBuy.pay.subSignIn":"cloudBuy.pay.sub")}),e.jsx(pe,{items:[{key:"signed-in",state:"done",title:n("cloudBuy.pay.signedIn"),detail:u},{key:"payment",state:"now",title:n("cloudBuy.pay.waiting"),detail:A},{key:"setup",state:"next",title:n("cloudBuy.pay.setup"),detail:n("cloudBuy.pay.setupHint")}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:d?X:Q,disabled:p,onClick:k,children:[e.jsx(et,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:Q,disabled:p,onClick:I,children:[e.jsx(tt,{size:14,"aria-hidden":"true"}),n("cloudBuy.pay.copy")]}),e.jsx("button",{type:"button",className:`${He} ms-1 px-1 py-1`,onClick:q,children:n("cloudAdd.changePlan")})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[v&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.pay.copied")}),N&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.pay.failed")})]})]})}const R=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudBuy.step.starting"],["checking","cloudHome.step.checking"]];function mt({tier:t,trial:l,credit:o},d){if(d)return n("cloudAdd.receivedTitle");const s=fe(t??l?.tier??void 0);return l?o?n("cloudBuy.setup.badgeCredit",{plan:s,credit:Ae(o.grantedUsd)}):n("cloudBuy.setup.badgeTrial",{plan:s}):n("cloudBuy.setup.badgePaid",{plan:s})}function xt({started:t,received:l,step:o,slow:d,ready:s,sleeps:u=!1,name:p,typed:v,color:N,counting:k,busy:I,openFailed:q,onName:y,onColor:E,onOpen:A,onNotNow:$}){const _=s?R.length:Math.max(0,R.findIndex(([i])=>i===o)),C=fe(t.tier??t.trial?.tier??void 0);return e.jsxs("div",{"data-cloud-add":s?"ready":l?"received":"starting","data-cloud-setup":s?"ready":o??"reserving",className:z,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ze,{children:mt(t,l)}),e.jsx(U,{title:s?n("cloudBuy.ready.title",{name:p}):n("cloudBuy.setup.title"),sub:s?n("cloudBuy.ready.sub"):l?n("cloudAccount.purchaseNoteNoDate"):n("cloudBuy.setup.sub")})]}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ee,{value:_/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(pe,{label:n("cloudBuy.setup.progress"),items:R.map(([i,w],j)=>({key:i,title:n(w,{name:p}),state:j<_?"done":j===_?"now":"next"}))}),d&&!s&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"cloud-add-name",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.name")}),e.jsx("input",{id:"cloud-add-name",value:v,maxLength:qe,placeholder:n("cloudSetup.myCloud"),autoComplete:"off",spellCheck:!1,onChange:i=>y(i.target.value),className:Ue})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{id:"cloud-add-color",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.color")}),e.jsx("div",{role:"radiogroup","aria-labelledby":"cloud-add-color",className:"flex flex-wrap gap-2",children:G.map(i=>e.jsx("button",{type:"button",role:"radio","aria-checked":i===N,"aria-label":n(Me[i]),tabIndex:i===N?0:-1,"data-color":i,onClick:()=>E(i),onKeyDown:w=>{const j=G.indexOf(i),M=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!M)return;w.preventDefault();const Y=G[(j+M+G.length)%G.length];E(Y),w.currentTarget.parentElement?.querySelector(`[data-color="${Y}"]`)?.focus()},style:{background:$e(i)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",i===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},i))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.preview")}),e.jsxs("span",{"data-cloud-preview":!0,className:"inline-flex max-w-full items-center gap-2 self-start rounded-[12px] border-[0.5px] border-ink/10 bg-menu py-1.5 pe-3 ps-1.5",children:[e.jsx(ve,{color:N}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium leading-4 text-ink",children:p}),e.jsx("span",{className:"block truncate text-[12px] text-ink-tertiary",children:n(u?"cloudBuy.setup.previewLineSleeps":"cloudBuy.setup.previewLine",{plan:C})})]})]})]})]})]}),s&&k===null&&e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:p})}),e.jsxs("div",{className:se,children:[k!==null&&e.jsx("span",{role:"status",className:"me-1 text-[13px] text-ink-secondary",children:n("cloudBuy.setup.openingIn",{seconds:k})}),k!==null&&e.jsx("button",{type:"button",className:Q,onClick:$,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:X,disabled:!s||I,onClick:A,children:n("cloudBuy.setup.open",{name:p})})]}),q&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:p})})]})}function yt({team:t,step:l,slow:o}){const d=Math.max(0,R.findIndex(([u])=>u===l)),s=t??n("cloudBuy.team.unnamed");return e.jsxs("div",{"data-cloud-add":"team-starting","data-cloud-setup":l??"reserving",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.setupTitle"),sub:n("cloudBuy.team.setupSub")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ee,{value:d/R.length,label:n("cloudBuy.setup.progress")}),e.jsx(pe,{label:n("cloudBuy.setup.progress"),items:R.map(([u,p],v)=>({key:u,title:n(p,{name:s}),state:v<d?"done":v===d?"now":"next"}))}),o&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]})]})}function gt({name:t,busy:l,openFailed:o,onOpen:d}){return e.jsxs("div",{"data-cloud-add":"team-ready",className:z,children:[e.jsx(U,{title:n("cloudBuy.team.readyTitle"),sub:n("cloudBuy.team.readySub",{name:t})}),e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:t})}),e.jsx("div",{className:se,children:e.jsx("button",{type:"button","data-autofocus":!0,className:X,disabled:l,onClick:d,children:n("cloudBuy.setup.open",{name:t})})}),o&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:t})})]})}function ht({view:t,ui:l,actions:o}){switch(t.kind){case"checking":return e.jsx(ie,{kind:"checking",line:null,onClose:o.close});case"unreachable":return e.jsx(ie,{kind:"unreachable",line:n("cloudAdd.unreachable"),onRetry:o.retry,onClose:o.close});case"error":return e.jsx(ie,{kind:`error-${t.reason}`,line:n(t.reason==="rate-limited"?"cloudAdd.rateLimited":"cloudAdd.failed"),onRetry:o.retry,onClose:o.close});case"offer":return e.jsx(ct,{offer:t.offer,current:l.current,now:l.now,busy:l.busy,signedOut:t.signedOut,notice:t.notice?n(t.notice==="code-expired"?"cloudAdd.codeExpired":t.notice==="signin-ended"?"cloudAdd.signInEnded":t.notice==="terms"?"cloudBuy.termsChanged":"cloudAdd.preparing"):null,onStart:o.start,onSignIn:o.signIn});case"sign-in":return e.jsx(dt,{phase:t.phase,email:l.email,code:l.code,profileEmail:l.profileEmail,busy:l.busy,now:l.now,onBack:o.back,onEmail:o.email,onSend:o.sendCode,onChangeEmail:o.changeEmail,onCode:o.code,onResend:o.resend,onBrowser:o.browser});case"signing-in":return e.jsx(ot,{code:t.code,checkout:t.checkout,busy:l.busy,trial:l.offerShown?!!Le(l.offerShown,l.chosen).trialDays:!1,onReopen:o.reopenBrowser,onCancel:o.cancelSignIn});case"waiting":return e.jsx(ft,{plan:t.plan,offer:l.offerShown,browser:t.browser,late:t.late,link:t.link,email:t.email,busy:l.busy,copied:l.copied,failed:l.payFailed,onReopen:o.reopenCheckout,onCopy:o.copyLink,onChangePlan:o.changePlan});case"starting":case"ready":return e.jsx(xt,{started:t,received:t.kind==="starting"&&t.received,step:t.kind==="starting"?t.step:null,slow:t.kind==="starting"&&t.slow,ready:t.kind==="ready",sleeps:lt(t,l.offerShown),name:l.look.name,typed:l.look.typed,color:l.look.color,counting:l.counting,busy:l.busy,openFailed:l.openFailed,onName:o.name,onColor:o.color,onOpen:o.openCloud,onNotNow:o.notNow});case"has-cloud":return e.jsx(pt,{name:l.look.name,color:l.look.color,busy:l.busy,interest:l.interest,openFailed:l.openFailed,onInterest:o.interest,onOpen:o.openCloud});case"team-starting":return e.jsx(yt,{team:t.team,step:t.step,slow:t.slow});case"team-ready":return e.jsx(gt,{name:t.team.name,busy:l.busy,openFailed:l.openFailed,onOpen:()=>o.openTeam(t.team.id)});case"settings":return null}}const bt={offer:"max-w-[920px]",starting:"max-w-[720px]",ready:"max-w-[720px]"};function Be({kind:t,staging:l,onClose:o,children:d}){return e.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onMouseDown:s=>s.stopPropagation(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cloud-add-title","data-cloud-add-dialog":!0,tabIndex:-1,className:ue(Xe,"group/sheet animate-pop-in relative max-h-full w-full overflow-y-auto overscroll-contain outline-none",bt[t]??"max-w-[540px]"),children:[e.jsx("button",{type:"button",onClick:o,"aria-label":n("cloudAdd.close"),className:ue(Je,Ge,"absolute end-4 top-4 z-10"),children:e.jsx(Ve,{size:16})}),l&&e.jsx(Qe,{className:"absolute end-14 top-[22px] z-10 group-has-[[data-night-card]]/sheet:bg-app"}),d]})})}const kt=["offer","checking","unreachable","waiting","sign-in","signing-in"],jt="button:not([disabled]):not([tabindex='-1']), input:not([disabled]):not([tabindex='-1']), [href], [tabindex='0']",St=t=>t.status==="connected"&&t.entitlement?.plan==="free"&&!t.purchase&&!t.machine,Nt=t=>t?.status==="connected"&&t.entitlement?.plan==="pro"&&t.entitlement.status==="active"?t.entitlement.tier??"pro":null;function Lt({now:t=Date.now}){const{state:l,dispatch:o}=ut(),d=l.cloudAdd,s=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[u,p]=c.useState(null),[v,N]=c.useState(void 0),[k,I]=c.useState(null),[q,y]=c.useState(null),[E,A]=c.useState(!1),[$,_]=c.useState(!1),[C,i]=c.useState(!1),[w,j]=c.useState(!1),[M,Y]=c.useState(0),[Z,me]=c.useState([]),[b,h]=c.useState(null),[T,O]=c.useState({email:"",code:""}),[B,ee]=c.useState(null),[F,P]=c.useState(null),[H,S]=c.useState(null),[,Ie]=c.useState(0),[xe,ae]=c.useState(!1),[Te,le]=c.useState(!1),[Oe,Fe]=c.useState(!1),L=!!(d&&s),oe=l.config?.profile?.email?.trim()||null,de=at();c.useEffect(()=>{if(!L||!s)return;let a=!0,r=!1;const g=s.onState(x=>{r=!0,a&&p(x)});return s.state().then(x=>{a&&!r&&p(x)}).catch(()=>{}),()=>{a=!1,g()}},[L,s]);const m=L?nt(u,v,{now:t(),error:q,choosing:$,conflict:E,signIn:b,arrived:xe,terms:Te}):null,ye=L&&m&&kt.includes(m.kind)&&u?`${u.status}:${JSON.stringify(u.offer??null)}:${M}`:null;c.useEffect(()=>{if(!ye||!s?.offer)return;let a=!0;return s.offer().then(r=>{a&&N(r)},()=>{a&&N(null)}),()=>{a=!1}},[ye,s]);const ce=n("cloudSetup.myCloud"),W={typed:B?.typed??ce,color:B?.color??Ce,name:We(B?.typed??ce,ce)},D=()=>{b&&s?.signInCancel?.().catch(()=>{}),o({type:"closeCloudAdd"}),y(null),A(!1),_(!1),j(!1),me([]),I(null),h(null),O({email:"",code:""}),ee(null),P(null),S(null),ae(!1),le(!1)};c.useEffect(()=>{if(!L)return;const a=document.activeElement,r=a&&a!==document.body&&typeof a.focus=="function"?a:null;d?.signIn&&(h({step:"email",intent:!1,problem:null}),O({email:oe??"",code:""}));const g=x=>{if(x.key==="Escape"){x.preventDefault(),D();return}if(x.key!=="Tab")return;const V=[...document.querySelector("[data-cloud-add-dialog]")?.querySelectorAll(jt)??[]];if(!V.length)return;x.preventDefault();const Ne=V.indexOf(document.activeElement);V[Ne===-1?0:(Ne+(x.shiftKey?-1:1)+V.length)%V.length].focus()};return window.addEventListener("keydown",g,!0),(document.querySelector("#cloud-add-title")??document.querySelector("[data-cloud-add-dialog]"))?.focus(),()=>{window.removeEventListener("keydown",g,!0),r?.isConnected&&r.focus()}},[L]),c.useEffect(()=>{if(!(!L||!s?.sheet||de))return s.sheet(!0).catch(()=>{}),()=>{s.sheet?.(!1).catch(()=>{})}},[L,s,de]);const f=m?.kind??null,te=m?.kind==="sign-in"?`sign-in-${m.phase.step}`:f;c.useEffect(()=>{!te||te==="checking"||te==="settings"||document.activeElement?.closest?.("[data-cloud-add-dialog]")||(document.querySelector("[data-cloud-add-dialog] [data-autofocus]")??document.querySelector("#cloud-add-title"))?.focus()},[te]),c.useEffect(()=>{(f==="waiting"||f==="starting"||f==="ready")&&!xe&&ae(!0),(f==="ready"||f==="team-ready")&&s?.readySeen?.().catch(()=>{})},[f]),c.useEffect(()=>{if(!f||!d)return;if(f==="settings"){D(),o({type:"toggleAppSettings",open:!0,section:"cloudAccount"});return}if(f==="checking")return;const a=Z.length===0;a&&J("cloud_dialog_shown",{source:d.source}),["starting","ready"].includes(f)&&Z.includes(f),(a||!Z.includes(f))&&me([...Z,f])},[f]),c.useEffect(()=>{if(!f||!["starting","ready","has-cloud"].includes(f)||B||!s?.look)return;let a=!0;return s.look().then(r=>{a&&ee({typed:r.name,color:Ke(r.color)??Ce,dirty:f!=="has-cloud"})},()=>{}),()=>{a=!1}},[f]),c.useEffect(()=>{if(!B?.dirty||!s?.setLook)return;const a=setTimeout(()=>{s.setLook?.(W.name,B.color).catch(()=>{})},400);return()=>clearTimeout(a)},[B?.typed,B?.color]),c.useEffect(()=>{f!=="ready"||F!==null||P(!de&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[f]);const ge=b?.step==="code"?b.resendAt:0;c.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Ie(t()),1e3);return()=>clearTimeout(a)}),c.useEffect(()=>{if(H!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[H]);const ne=a=>{C||(i(!0),j(!1),a().catch(()=>y("failed")).finally(()=>i(!1)))},he=()=>{C||!s||(i(!0),j(!1),P("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(W.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>D(),()=>j(!0)).finally(()=>i(!1)))},De=a=>{C||!s?.openTeam||(i(!0),j(!1),s.openTeam(a).then(()=>D(),()=>j(!0)).finally(()=>i(!1)))};c.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?P(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(c.useEffect(()=>{if(!be)return;const a=()=>P("off");return window.addEventListener("blur",a),()=>window.removeEventListener("blur",a)},[be]),!L||!m||!d||!s||m.kind==="settings")return null;if(m.kind==="has-cloud"&&u?.status==="connected"&&u.clouds&&window.ogb?.cloudAdd&&(u.addCloud?.canAdd!==!1||u.adding&&!u.adding.done))return e.jsx(Be,{kind:Oe?"offer":"has-cloud",staging:u.staging===!0,onClose:D,children:e.jsx(st,{onClose:D,onFirstCloud:()=>{},onWide:Fe,source:d.source})});const K=v??null,ke=()=>m.kind==="waiting"&&!k?m.plan:K?Le(K,k).tier:null,re=async a=>{if(!a||!s.checkout){y("failed");return}K?.plans.find(x=>x.tier===a)?.trialDays;const r=await s.checkout(a,d.source),g=r.outcome;p(r.state),g==="opened"||g==="signing-in"?(_(!1),y(null),A(!1),S(null),le(!1),J("cloud_checkout_opened",{source:d.source})):g==="rate-limited"?y("rate-limited"):g==="failed"?y("failed"):A(!0)},je=a=>{h({step:"email",intent:a,problem:null}),O({email:T.email||oe||"",code:""})},Se=()=>{if(C||!s.signInStart||!b||b.step==="done")return;const a=b;i(!0),s.signInStart(T.email).then(r=>{r.outcome==="sent"?(h({step:"code",intent:a.intent,email:r.email,resendAt:r.resendAt,problem:null,triesLeft:null,...r.signupOpen===!1?{signupOpen:!1}:{}}),O({email:r.email,code:""}),J("cloud_signin",{source:d.source})):h({...a,problem:r.outcome})},()=>h({...a,problem:"failed"})).finally(()=>i(!1))},_e=a=>{if(!s.signInVerify||b?.step!=="code")return;const r=b,g=r.intent?ke():null;i(!0),(async()=>{try{const x=await s.signInVerify(a);if(x.outcome!=="signed-in"){O({email:T.email,code:""}),h({...r,problem:x.outcome,triesLeft:x.outcome==="wrong-code"?x.triesLeft:null});return}p(x.state),ae(!0),J("cloud_signin",{step:"signed_in",source:d.source}),g&&St(x.state)&&(it(K,x.state.offer,g)?(h({step:"done",intent:!0}),await re(g)):(le(!0),I(g))),h(null),O({email:T.email,code:""})}catch{h({...r,problem:"failed",triesLeft:null})}finally{i(!1)}})()},Re={start:a=>{if(I(a),A(!1),m.kind==="offer"&&m.signedOut&&s.signInStart){je(!0);return}ne(()=>re(a))},signIn:()=>je(!1),back:()=>{h(null),s.signInCancel?.().catch(()=>{})},email:a=>O({email:a,code:T.code}),sendCode:Se,changeEmail:()=>{b&&(h({step:"email",intent:b.intent,problem:null}),s.signInCancel?.().catch(()=>{}))},code:a=>{const r=rt(a);O({email:T.email,code:r}),r.length===8&&!C&&_e(r)},resend:Se,browser:()=>ne(async()=>{const a=b?.intent?ke():null;h(null),await s.signInCancel?.().catch(()=>{}),J("cloud_signin",{source:d.source}),a?await re(a):p(await s.begin())}),reopenBrowser:()=>ne(async()=>p(await s.reopen())),cancelSignIn:()=>ne(async()=>p(await s.cancel())),reopenCheckout:()=>{if(m.kind!=="waiting"||C)return;i(!0),S(null),(s.reopenCheckout?s.reopenCheckout(m.plan,d.source):s.checkout(m.plan,d.source)).then(r=>{p(r.state),r.outcome!=="opened"&&S("pay-failed")},()=>S("pay-failed")).finally(()=>i(!1))},copyLink:()=>{s.copyCheckoutLink?.().then(a=>S(a?"copied":"pay-failed"),()=>S("pay-failed"))},changePlan:()=>{I(m.kind==="waiting"?m.plan:k),_(!0),S(null)},retry:()=>{y(null),A(!1),N(void 0),Y(M+1)},name:a=>ee({typed:a,color:W.color,dirty:!0}),color:a=>ee({typed:W.typed,color:a,dirty:!0}),openCloud:he,openTeam:De,notNow:()=>P("off"),interest:()=>{C||!s.interest||(i(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>i(!1)))},close:D},Pe={chosen:k,current:Nt(u),offerShown:K,now:t(),busy:C,openFailed:w,email:T.email,code:T.code,profileEmail:oe,look:W,counting:typeof F=="number"?F:null,copied:H==="copied",payFailed:H==="pay-failed",interest:H==="interest-sent"?"sent":H==="interest-failed"?"failed":null};return e.jsx(Be,{kind:m.kind,staging:u?.staging===!0,onClose:D,children:e.jsx(ht,{view:m,ui:Pe,actions:Re})})}export{Lt as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DataPanel-VJJAqxxu.js","assets/styles-DO3EUxm2.js","assets/styles-CMOouTIW.css","assets/App-26INIo6C.js","assets/index-C7YXnZFx.js","assets/PlacesRail-tZyNm-l3.js","assets/monitor-zecPzfR5.js","assets/MenuMotion-B0aZnuh_.js","assets/calendar-days-_dtxyR4U.js","assets/LiveDesktop-6_ms70VN.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as ht,r as a,t as n,j as e,a as K,ah as hr,X as gr,ai as vr,o as yr,f as yn,u as wr,s as kr,_ as Pn}from"./styles-DO3EUxm2.js";import{c as jr,a as Nr,b as Sr,i as Cr,d as Ir}from"./remote-desktop-DDRRx8uY.js";import{v as Er}from"./desktop-viewer-CF-OpSo0.js";import{dS as Je,S as zn,E as Rr,w as Pr,bR as zr,bu as Tr,R as pt,P as Ar,U as Ye,dT as Dr,Y as Ge,bt as Lr,af as Mr,dU as Or,G as Ft,C as Tn,dV as $t,dW as Ze,u as Vr,dX as _r,dY as Fr,dZ as $r,d_ as Br,a0 as Wr,d$ as Kr,e0 as Ur,e1 as Hr,e2 as qr,e3 as Xr,k as Yr,bZ as Gr,bY as wn,j as F,e4 as Zr,e5 as Jr,l as Qr,X as es,b_ as kn,e6 as ts,e7 as ns,a1 as rs,e8 as jn,e9 as ss,ea as as,eb as os,m as Nn,x as is,ec as ls,ed as Vt,a8 as cs,a9 as ds,cB as us,ee as ps,ef as ms,Z as xs,A as bs,eg as fs,eh as hs,ei as gs,ej as vs,n as ys,ek as ws,el as ks,em as js}from"./App-26INIo6C.js";import{L as O,p as Sn,M as Ns,w as Ss}from"./MacLocalControl-C-9MRdET.js";import{R as Cs,C as Is}from"./ComputerFilesPane-BU-s7BlY.js";import{L as A,X as An,u as Dn,d as Qe,c as Es,v as Cn,e as mt,W as In}from"./PlacesRail-tZyNm-l3.js";import{u as Bt,B as Rs}from"./BrowserPanel-CKCdXmHX.js";import{M as Me}from"./monitor-zecPzfR5.js";import{C as Ln,w as Ps,a as zs,p as Ts,W as As}from"./WorksOnGrid-Ho88FaNW.js";import{C as Ds}from"./MenuMotion-B0aZnuh_.js";import"./index-C7YXnZFx.js";import"./RoutinesPage-X1fycmDS.js";import"./ProIntroduction-Mbg0N0IP.js";import"./BrowserProfilesManager-CY3fpWTL.js";import"./SignedInSites-BJlXZ7-O.js";import"./minimize-sGQL0Xsy.js";import"./file-up-flw1aUka.js";const Ls=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ms=ht("columns-2",Ls);const Os=[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m14.305 7.53.923-.382",key:"1mlnsw"}],["path",{d:"m15.228 4.852-.923-.383",key:"82mpwg"}],["path",{d:"m16.852 3.228-.383-.924",key:"ln4sir"}],["path",{d:"m16.852 8.772-.383.923",key:"1dejw0"}],["path",{d:"m19.148 3.228.383-.924",key:"192kgf"}],["path",{d:"m19.53 9.696-.382-.924",key:"fiavlr"}],["path",{d:"m20.772 4.852.924-.383",key:"1j8mgp"}],["path",{d:"m20.772 7.148.924.383",key:"zix9be"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]],Vs=ht("monitor-cog",Os);const _s=[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],Fs=ht("monitor-x",_s);const $s=[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]],Bs=ht("usb",$s);function Ws({src:s,name:i,error:d,starting:S,opening:f,disabled:v,refreshing:k=!1,retry:j=0,onOpen:y,onRetry:P}){const[u,m]=a.useState(null),[h,g]=a.useState(null);a.useEffect(()=>{g(null)},[j]);const x=!!(s&&u===s&&h!==s),w=d??(s&&h===s?n("computer.preview.imageFailed"):null);return e.jsxs("div",{className:"relative h-full w-full","aria-busy":!w&&(!x||f||k),children:[s&&e.jsxs("button",{type:"button",onClick:y,disabled:v||S||f||!x,className:"group absolute inset-0 flex h-full w-full items-center justify-center disabled:cursor-wait","aria-label":n("computer.openLiveDesktopAria",{name:i}),title:n("computer.openLiveDesktop"),children:[e.jsx("img",{src:s,alt:n("computer.screenOf",{name:i}),onLoad:()=>{m(s),g(null)},onError:()=>g(s),className:`h-full w-full object-contain transition group-hover:brightness-75 ${x?"":"invisible"}`},j),x&&e.jsxs("span",{className:"absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white",children:[f?e.jsx(A,{size:12,className:"animate-spin"}):e.jsx(Je,{size:12}),f?n("computer.preview.connecting"):n("computer.open")]})]}),!x&&!w&&e.jsxs("div",{role:"status",className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-6 text-center text-[12px] text-ink-secondary",children:[e.jsx(A,{size:18,className:"animate-spin"}),S?n("computer.phase.starting"):n("computer.preview.connectingScreen")]}),x&&k&&!w&&e.jsxs("div",{role:"status",className:"absolute bottom-2 left-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] text-white",children:[e.jsx(A,{size:12,className:"animate-spin"}),n("computer.preview.connectingScreen")]}),w&&e.jsxs("div",{role:"alert",className:`absolute inset-x-0 flex flex-col items-center justify-center gap-2 bg-card/95 p-4 text-center text-[12px] text-ink-secondary ${x?"bottom-0":"inset-y-0"}`,children:[!x&&e.jsx(Me,{size:22}),e.jsxs("span",{children:[x?n("computer.preview.paused"):n("computer.preview.cantConnect")," ",w]}),e.jsx("button",{type:"button",onClick:()=>P(!x),className:"rounded-md bg-control px-3 py-1.5 text-ink hover:bg-raised-hover",children:n("computer.preview.retry")})]})]})}function Ks({bot:s,backend:i,onBackend:d,onAutoStart:S}){return e.jsxs("div",{"data-testid":"vps-choices",children:[e.jsx(Ln,{compact:!0,value:i,onChange:d}),!s.computer&&e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4 rounded-lg bg-inset px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:n("botAccess.cloud.startVps")}),e.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:n("botAccess.cloud.startVpsDescription")})]}),e.jsx(zn,{checked:!!s.autoStartVps,"aria-label":n("botAccess.cloud.startVps"),onClick:S})]})]})}const Us={available:!1,devices:[]};function Hs(){const s=window.ogb?.androidDevice,[i,d]=a.useState(Us),[S,f]=a.useState(!1),v=Bt();return a.useEffect(()=>{if(!s){f(!0);return}if(!v)return;let k=!0,j=0,y=0;const P=async()=>{const m=++j,h=()=>m<y;try{const g=await s.status();k&&!h()&&(y=m,d(g))}catch(g){k&&!h()&&(y=m,d({available:!1,devices:[],reasonCode:"adb-failed",message:g instanceof Error?g.message:String(g)}))}finally{k&&!h()&&f(!0)}};P();const u=window.setInterval(()=>{P()},2e3);return()=>{k=!1,window.clearInterval(u)}},[s,v]),{...i,scanned:S}}function dt(s){return s.model==="Android device"?s.serial:s.model}function qs({status:s}){const i=window.ogb?.androidDevice,d=Bt(),S=s.devices.filter(p=>p.state==="device"),[f,v]=a.useState(S[0]?.serial??s.devices[0]?.serial??""),[k,j]=a.useState(null),[y,P]=a.useState({width:0,height:0}),[u,m]=a.useState(null),h=a.useRef(null),g=a.useRef(null),x=a.useRef({x:0,y:0,timer:null}),w=s.devices.find(p=>p.serial===f)??s.devices[0],$=w?.serial,R=w?.state;a.useEffect(()=>{!w&&s.devices[0]&&v(s.devices[0].serial),w&&!s.devices.some(p=>p.serial===w.serial)&&v(s.devices[0]?.serial??"")},[w,s.devices]),a.useEffect(()=>{if(!i||!$||R!=="device"||!d){if(!d)return;j(null);return}let p=!0,C=null;const V=async()=>{try{const _=await i.frame($);p&&(j(_.dataUrl),m(null))}catch(_){p&&m(_ instanceof Error?_.message:String(_))}finally{p&&(C=window.setTimeout(()=>{V()},850))}};return V(),()=>{p=!1,C!==null&&window.clearTimeout(C)}},[i,$,R,d]),a.useEffect(()=>()=>{x.current.timer&&clearTimeout(x.current.timer)},[]);const D=p=>{!i||!w||w.state!=="device"||i.input(w.serial,p).catch(C=>{m(C instanceof Error?C.message:String(C))})},B=(p,C=!1)=>{if(!h.current||!y.width||!y.height)return null;const _=p.currentTarget.getBoundingClientRect(),L=Math.min(_.width/y.width,_.height/y.height),Y=y.width*L,J=y.height*L,G=_.left+(_.width-Y)/2,Oe=_.top+(_.height-J)/2,Ce=(p.clientX-G)/Y,te=(p.clientY-Oe)/J;return C?{x:Math.max(0,Math.min(1,Ce)),y:Math.max(0,Math.min(1,te))}:Ce>=0&&Ce<=1&&te>=0&&te<=1?{x:Ce,y:te}:null},ye=p=>{if(p.metaKey||p.ctrlKey||p.altKey)return;const C={ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",Backspace:"delete",Delete:"delete",Enter:"enter",Escape:"back",Tab:"tab"};C[p.key]?(p.preventDefault(),D({type:"key",key:C[p.key]})):/^[A-Za-z0-9 _.,@-]$/.test(p.key)&&(p.preventDefault(),D({type:"text",text:p.key}))},me=p=>{if(!y.width||!y.height)return;p.preventDefault();const C=x.current;C.x+=p.deltaX,C.y+=p.deltaY,C.timer&&clearTimeout(C.timer),C.timer=setTimeout(()=>{const V=Math.abs(C.x)>Math.abs(C.y),_=V?C.x:C.y;if(C.x=0,C.y=0,C.timer=null,Math.abs(_)<2)return;const L=Math.max(.18,Math.min(.45,Math.abs(_)/500)),Y=_>0?-1:1,J=V?{x:.5,y:.5}:{x:.5,y:.65},G=V?{x:J.x+Y*L,y:J.y}:{x:J.x,y:J.y+Y*L};D({type:"swipe",fromX:J.x,fromY:J.y,toX:G.x,toY:G.y,durationMs:260,width:y.width,height:y.height})},80)};if(!w)return null;const r=w.state==="device";return e.jsxs("div",{className:"space-y-3 pb-5",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(An,{size:16,className:"text-success"})," ",dt(w)]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:n("computer.android.usbSubtitle")})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] text-success",children:[e.jsx(Rr,{size:12})," ",n("computer.android.usb")]})]}),s.devices.length>1&&e.jsx(Pr,{value:w.serial,onChange:p=>v(p.target.value),className:"mt-3 w-full",children:s.devices.map(p=>e.jsxs("option",{value:p.serial,children:[dt(p)," · ",p.state]},p.serial))})]}),r?e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"application","aria-label":n("computer.android.screenAria",{name:dt(w)}),tabIndex:0,onKeyDown:ye,onWheel:me,onPointerDown:p=>{const C=B(p);C&&(p.currentTarget.setPointerCapture(p.pointerId),g.current={point:C,at:performance.now()})},onPointerUp:p=>{const C=g.current,V=B(p,!0);if(g.current=null,!C||!V)return;Math.hypot(V.x-C.point.x,V.y-C.point.y)<.012?D({type:"tap",...V,...y}):D({type:"swipe",fromX:C.point.x,fromY:C.point.y,toX:V.x,toY:V.y,durationMs:performance.now()-C.at,...y}),p.currentTarget.focus()},onPointerCancel:()=>{g.current=null},className:"mx-auto flex h-[520px] w-full touch-none cursor-pointer items-center justify-center overflow-hidden overscroll-none rounded-[28px] bg-black outline-none ring-1 ring-white/10 focus:ring-2 focus:ring-accent",children:k?e.jsx("img",{ref:h,src:k,alt:n("computer.android.screenAlt",{name:dt(w)}),draggable:!1,onLoad:p=>{P({width:p.currentTarget.naturalWidth,height:p.currentTarget.naturalHeight})},className:"pointer-events-none h-full w-full select-none object-contain"}):e.jsx(A,{size:20,className:"animate-spin text-ink-secondary"})}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:()=>D({type:"key",key:"back"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(zr,{size:13})," ",n("computer.android.back")]}),e.jsxs("button",{onClick:()=>D({type:"key",key:"home"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(Tr,{size:12})," ",n("computer.android.home")]}),e.jsxs("button",{onClick:()=>D({type:"key",key:"recent"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(pt,{size:13})," ",n("computer.android.recent")]})]}),e.jsx("div",{className:"text-center text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.hint")})]}):e.jsx("div",{className:"rounded-xl border border-warning/25 bg-warning/10 p-4 text-[12px] leading-relaxed text-warning",children:w.state==="unauthorized"?n("computer.android.unauthorized"):n("computer.android.badState",{state:w.state})}),u&&e.jsx("div",{className:"rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:u}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[e.jsx(Bs,{size:15,className:"text-accent"})," ",n("computer.android.setupTitle")]}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1.5 pl-4 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx("li",{children:n("computer.android.step1")}),e.jsx("li",{children:n("computer.android.step2").split(/(\{buildNumber\}|\{usbDebugging\})/).map((p,C)=>p==="{buildNumber}"||p==="{usbDebugging}"?e.jsx("span",{className:"text-ink",children:n(p==="{buildNumber}"?"computer.android.buildNumber":"computer.android.usbDebugging")},C):p)}),e.jsxs("li",{children:[n("computer.android.step3a")," ",e.jsx("span",{className:"text-ink",children:n("computer.android.allowUsbDebugging")})," ",n("computer.android.step3b")]})]}),e.jsx("div",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.agentNote")}),e.jsx("div",{className:"mt-2 rounded-lg bg-inset px-3 py-2 text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.harnessNote")})]})]})}const Xs=1500,Ys=2e5,Mn=()=>Array.from(crypto.getRandomValues(new Uint8Array(18)),s=>s.toString(16).padStart(2,"0")).join("");function Gs(s,i){const d=window.setInterval(()=>{s.closed&&(window.clearInterval(d),i())},1e3)}async function Zs({botId:s,title:i,held:d,request:S,join:f,current:v}){let k=null,j=null;!window.ogb?.desktopViewer&&!window.ogb?.openExternal&&(j=window.open("","_blank"),j&&(j.opener=null));const y=()=>new DOMException("The selected conversation changed","AbortError");try{if(!d&&(k=Mn(),!(await S("take",k)).held))throw new O("computer.err.confirmControl");if(!v())throw y();const{joinUrl:P}=await f(AbortSignal.timeout(Ys)),u=typeof P=="string"&&P?P:null;if(!v())throw y();if(!u)throw new O("computer.err.noDesktopLink");if(window.ogb?.desktopViewer){if(!await window.ogb.desktopViewer.open(u,i,s))throw new O("computer.err.openDesktop")}else if(j){j.location.replace(u);const m=k;m&&Gs(j,()=>{S("release",m).catch(()=>{})})}else if(window.ogb?.openExternal){if(!await window.ogb.openExternal(u))throw new O("computer.err.openDesktopLink")}else if(!window.open(u,"_blank","noopener"))throw new O("computer.err.popupBlocked")}catch(P){throw j?.close(),k&&await S("release",k).catch(()=>{}),P}}function _t(s,i){fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})}function Js({botId:s,session:i,held:d,request:S,viewerClose:f}){const[v,k]=a.useState(!1),[j,y]=a.useState(!1),[P,u]=a.useState(!1),m=a.useRef(null),h=a.useRef(f);h.current=f;const g=a.useCallback(()=>{k(!1),y(!1)},[]),x=a.useCallback(()=>{const R=m.current;m.current=null,g(),R&&(_t(`/api/bots/${s}/computer/control`,{action:"release",controlLeaseId:R.id}),R.viewerClose&&_t(R.viewerClose,{}))},[s,g]),w=a.useCallback(async(R=!1)=>{const D=Mn(),B=await S("take",D);if(!B.held)throw new O("computer.err.confirmControl");m.current=B.owned?{id:D,viewerClose:h.current}:null,k(!0),y(R)},[S]),$=a.useCallback(async()=>{const R=m.current?.viewerClose??h.current;m.current=null,g(),u(!0);try{await S("release")}finally{u(!1),R&&_t(R,{})}},[g,S]);return a.useEffect(()=>x,[i,x]),a.useEffect(()=>(window.addEventListener("pagehide",x),()=>window.removeEventListener("pagehide",x)),[x]),a.useEffect(()=>{if(!v||d)return;const R=setTimeout(()=>{m.current=null,g()},Xs);return()=>clearTimeout(R)},[v,d,g]),{here:v,expanded:j,setExpanded:y,handingBack:P,take:w,handBack:$,leave:x}}function Qs({held:s,frame:i,name:d,disabled:S,takeDisabled:f,error:v,onTakeControl:k}){const[j,y]=a.useState(!1),P=a.useCallback(()=>y(!1),[]);return a.useEffect(()=>{s&&y(!1)},[s]),e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>s?k(!0):y(!0),disabled:S,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n(s?"computer.openLiveDesktop":"computer.watchFullScreenTitle"),children:[e.jsx(Je,{size:14}),n("computer.fullScreen")]}),j&&!s&&e.jsx(ea,{frame:i,name:d,takeDisabled:f,error:v,onClose:P,onTakeControl:()=>k(!0)})]})}function ea({frame:s,name:i,takeDisabled:d,error:S,onClose:f,onTakeControl:v}){const k=a.useRef(null),j=a.useRef(null),{dragProps:y,noDragStyle:P}=Dn(),u=Qe().capabilities.windowChrome==="mac-inset",m=a.useRef(null),[h,g]=a.useState(!1);Es(k,f),a.useEffect(()=>j.current?.focus(),[]),a.useEffect(()=>{const $=R=>{R.key!=="Escape"||R.defaultPrevented||!(R.target instanceof Node)||!k.current?.contains(R.target)||(R.preventDefault(),R.stopPropagation(),f())};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[f]),a.useEffect(()=>{const $=document.activeElement;d&&($===m.current||$===document.body)&&k.current?.focus()},[d]);const x="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] focus-visible:outline-2 focus-visible:outline-focus disabled:opacity-50",w=n("computer.screenOf",{name:i});return e.jsxs("div",{ref:k,tabIndex:-1,"data-watch-full-screen":!0,role:"dialog","aria-modal":"true","aria-label":w,className:"fixed inset-0 z-[65] flex flex-col bg-app outline-none",children:[e.jsxs("header",{...y,className:K("flex shrink-0 flex-wrap items-center gap-2 border-b border-hairline/40 bg-panel px-3 py-2",u&&"pl-[86px]"),children:[e.jsx("span",{className:"min-w-0 truncate text-[13px] font-medium text-ink",children:w}),e.jsx("span",{className:"pointer-events-none rounded-full bg-black/70 px-2.5 py-1 text-[11px] font-medium text-white shadow-sm",children:n("computer.watchingBotWorks")}),e.jsxs("button",{ref:j,type:"button",style:P,onClick:f,"aria-label":n("desktopViewer.exitFullscreen"),className:K(x,"ml-auto bg-control text-ink hover:bg-raised-hover"),children:[e.jsx(Ar,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"max-sm:hidden",children:n("desktopViewer.exitFullscreen")})]}),e.jsxs("button",{ref:m,type:"button",style:P,onClick:()=>{g(!0),v()},disabled:d,className:K(x,"bg-accent font-medium text-accent-ink hover:brightness-110"),title:n("computer.takeControlTitle"),children:[e.jsx(Ye,{size:14,"aria-hidden":"true"}),n("computer.takeControl")]})]}),h&&S&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:S}),e.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-inset",children:s?e.jsx("img",{src:s,alt:w,className:"h-full w-full object-contain"}):e.jsxs("span",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx(A,{size:16,className:"animate-spin","aria-hidden":"true"}),n("computer.waitingFrame")]})})]})}function ut(s){for(const i of s?.getTracks()??[])i.stop()}function ta(s){const i=s instanceof DOMException?s.name:"";return i==="NotAllowedError"||i==="AbortError"?{ok:!1,phase:"cancelled",messageKey:"computer.screen.cancelled"}:i==="NotFoundError"||i==="NotReadableError"||i==="NotSupportedError"||i==="SecurityError"?{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableNow"}:{ok:!1,phase:"error",messageKey:"computer.screen.error"}}async function na({beginIntent:s,getDisplayMedia:i}){try{if(!s())return{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableWindow"};const d=await i({video:!0,audio:!1});return d.getVideoTracks().length===0?(ut(d),{ok:!1,phase:"unavailable",messageKey:"computer.screen.noVideoTrack"}):{ok:!0,stream:d}}catch(d){return ta(d)}}const Xe={idle:"computer.screen.idle",ended:"computer.screen.ended",unavailable:"computer.screen.unavailable"};function ra(){const{capabilities:s,ready:i}=Qe(),d=s.screenPreview,S=s.host.platform==="linux",[f,v]=a.useState("idle"),[k,j]=a.useState(Xe.idle),[y,P]=a.useState(""),u=a.useRef(null),m=a.useRef(null),h=a.useRef(0),g=a.useCallback((R,D)=>{h.current+=1;const B=m.current;m.current=null,u.current&&(u.current.srcObject=null),ut(B),v(R),j(D)},[]);a.useEffect(()=>()=>{h.current+=1;const R=m.current;m.current=null,ut(R)},[]);const x=async()=>{if(!d.available||!window.ogb?.beginScreenPreviewIntent||!navigator.mediaDevices?.getDisplayMedia){v("unavailable"),j(Xe.unavailable);return}g("requesting","computer.screen.waiting");const R=h.current,D=await na({beginIntent:()=>window.ogb.beginScreenPreviewIntent(),getDisplayMedia:r=>navigator.mediaDevices.getDisplayMedia(r)});if(R!==h.current){D.ok&&ut(D.stream);return}if(!D.ok){v(D.phase),j(D.messageKey);return}const B=D.stream,ye=B.getVideoTracks()[0];m.current=B,P(ye.label),ye.addEventListener("ended",()=>{m.current===B&&g("ended",Xe.ended)},{once:!0});const me=u.current;if(!me){g("error","computer.screen.displayFailed");return}me.srcObject=B;try{await me.play()}catch{R===h.current&&m.current===B&&g("error","computer.screen.displayFailed");return}R!==h.current||m.current!==B||(v("streaming"),j("computer.screen.active"))};if(!S)return null;const w=y||n("computer.screen.selected"),$=f==="cancelled"||f==="ended"||f==="unavailable"||f==="error";return e.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"local-preview-title",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{id:"local-preview-title",className:"text-[15px] font-medium text-ink",children:n("computer.screen.title")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:n("computer.screen.subtitle")})]}),e.jsx("span",{className:"shrink-0 rounded-full bg-raised px-2 py-1 text-[10px] font-medium text-ink-secondary",children:n("computer.screen.badge")})]}),e.jsxs("div",{className:"relative mt-3 flex aspect-[16/10] items-center justify-center overflow-hidden rounded-lg bg-panel",children:[e.jsx("video",{ref:u,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":n("computer.screen.videoAria"),className:f==="streaming"?"h-full w-full object-contain":"hidden"}),f!=="streaming"&&e.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[f==="requesting"?e.jsx(A,{size:18,className:"animate-spin"}):e.jsx(Me,{size:22}),e.jsx("span",{className:"text-[12px]","aria-live":"polite",children:i?n(d.available?k:Xe.unavailable):n("computer.screen.checking")})]})]}),f==="streaming"&&e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 text-[11px] text-ink-secondary",children:[e.jsx("span",{className:"truncate",title:w,children:d.interaction==="portal-picker"?w:n("vm.dest.local")}),e.jsxs("span",{className:"flex items-center gap-1.5 text-success",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})," ",n("computer.screen.sharing")]})]}),e.jsxs("button",{type:"button",disabled:f==="requesting"||!d.available&&f!=="streaming",onClick:f==="streaming"?()=>g("idle",Xe.idle):()=>{x()},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50",children:[f==="requesting"?e.jsx(A,{size:14,className:"animate-spin"}):f==="streaming"?e.jsx(Dr,{size:13}):$?e.jsx(pt,{size:14}):e.jsx(Me,{size:14}),f==="requesting"?n("computer.screen.choosing"):f==="streaming"?n("computer.screen.stop"):$?n("computer.linux.tryAgain"):d.interaction==="portal-picker"?n("computer.screen.choose"):n("computer.screen.start")]})]})}const sa="https://github.com/leomieo/limix-bot/blob/main/docs/linux-desktop.md#enable-local-control",aa="https://github.com/leomieo/limix-bot/blob/main/docs/linux-desktop.md#omarchy-hyprland-experimental",oa="https://cua.ai/docs/cua-sdk/guides/omarchy";function ia(){const{capabilities:s}=Qe(),i=s.localComputer,[d,S]=a.useState(null),[f,v]=a.useState(null);if(s.host.platform!=="linux")return null;const k=d!==null||i.status==="checking"||i.status==="starting",j=i.available,y=i.reasonCode==="linux-wayland-seat-safety-blocked",P=i.reasonCode==="linux-hyprland-plugin-required",u=i.compositor==="hyprland",m=s.host.session==="wayland",h=i.driverSource==="bundled",g=async x=>{if(window.ogb?.localControl){S(x),v(null);try{if((x==="disable"||x==="retry")&&!(await fetch("/api/local-computer/interrupt",{method:"POST"})).ok){v({key:"computer.linux.stopFailed"});return}await window.ogb.localControl[x]()}catch(w){v(w instanceof Error?w.message:String(w))}finally{S(null)}}};return e.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"linux-local-control-title",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{id:"linux-local-control-title",className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(Vs,{size:16,className:j?"text-success":"text-ink-secondary"}),n("computer.linux.title")]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:u?n("computer.linux.metaOmarchy"):n("computer.linux.meta",{session:m?"Wayland":"Xorg"})})]}),e.jsx("span",{className:K("shrink-0 rounded-full px-2 py-1 text-[10px] font-medium",j?"bg-success/10 text-success":y?"bg-danger/10 text-danger":P||i.enabled?"bg-warning/10 text-warning":"bg-raised text-ink-secondary"),children:j?n("computer.linux.ready"):y?n("computer.linux.waylandBadge"):P?n("computer.linux.pluginBadge"):i.enabled?n("vm.state.attention"):n("vm.dest.off")})]}),y?e.jsx("div",{className:"mt-3 rounded-lg border border-danger/20 bg-danger/5 p-3",children:e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0 text-danger"}),e.jsxs("span",{children:[n("computer.linux.waylandBefore")," ",e.jsx("strong",{className:"font-medium text-ink",children:n("computer.linux.waylandXorg")})," ",n("computer.linux.waylandAfter")]})]})}):P?e.jsxs("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3","data-linux-hyprland-plugin-required":!0,children:[e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsx("span",{children:n("computer.linux.hyprlandPlugin")})]}),e.jsxs("button",{type:"button",onClick:()=>window.open(oa,"_blank","noopener,noreferrer"),className:"mt-2 flex items-center gap-1.5 text-[12px] font-medium text-accent hover:underline",children:[n("computer.linux.omarchyGuide")," ",e.jsx(Cn,{size:11})]})]}):i.enabled?e.jsxs("div",{className:"mt-3 rounded-lg bg-panel p-3 text-[12px] text-ink-secondary",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[j?e.jsx(Lr,{size:15,className:"mt-0.5 shrink-0 text-success"}):k?e.jsx(A,{size:15,className:"mt-0.5 shrink-0 animate-spin"}):e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsx("span",{"aria-live":"polite",children:j?n(u?"computer.linux.hyprlandReady":"computer.linux.readyMsg"):i.message??n("computer.linux.checking")})]}),i.driverPath&&e.jsxs("div",{className:"mt-2 break-all font-mono text-[10px] text-ink-tertiary",title:i.driverPath,children:[h?n("computer.linux.bundledDriver"):i.driverPath,i.driverVersion?` · ${i.driverVersion}`:""]})]}):e.jsx("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3",children:e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ge,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsxs("span",{children:[n("computer.linux.enableBefore")," ",e.jsx("strong",{className:"font-medium text-ink",children:n("vm.dest.local")})," ",n("computer.linux.enableAfter"),m&&!u&&` ${n("computer.linux.waylandInput")}`]})]})}),f&&e.jsx("div",{className:"mt-2 text-[12px] text-danger",children:typeof f=="string"?f:n(f.key)}),!y&&e.jsx("div",{className:"mt-3 flex gap-2",children:P?e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="enable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(pt,{size:14}),n("computer.linux.tryAgain")]}):i.enabled?e.jsxs(e.Fragment,{children:[!j&&e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("retry")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="retry"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(pt,{size:14}),n("computer.linux.tryAgain")]}),e.jsxs("button",{type:"button",disabled:d!==null,onClick:()=>{g("disable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="disable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.linux.disable")]})]}):e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[d==="enable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.linux.enable")]})}),e.jsxs("button",{type:"button",onClick:()=>window.open(u?aa:sa,"_blank","noopener,noreferrer"),className:"mt-2 flex w-full items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[s.host.packaged?n("computer.linux.guide"):n("computer.linux.driverSetup")," ",e.jsx(Cn,{size:11})]})]})}function la(){const{capabilities:s}=Qe(),[i,d]=a.useState(!1),[S,f]=a.useState(null),v=s.localComputer;if(s.host.platform!=="win32"||v.reasonCode==="remote-server"||v.available)return null;const k=async()=>{d(!0),f(null);try{await window.ogb?.localControl?.retry()}catch(j){f(j instanceof Error?j.message:String(j))}finally{d(!1)}};return e.jsx("section",{"data-windows-local-control":v.reasonCode??"unavailable",className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Fs,{size:16,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.windows.title")}),e.jsxs("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:[n("computer.windows.body"),v.reasonCode==="cua-driver-blocked"&&e.jsxs(e.Fragment,{children:[" ",n("computer.windows.blocked")]})]}),v.message&&e.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[e.jsx("summary",{className:"cursor-pointer",children:n("computer.windows.detail")}),e.jsx("p",{className:"mt-1 break-words",children:v.message})]}),S&&e.jsxs("div",{role:"alert",className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[e.jsx(Ge,{size:13,className:"mt-0.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:S})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.jsxs("button",{type:"button",onClick:()=>{k()},disabled:i,className:"inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[i&&e.jsx(A,{size:13,className:"animate-spin","aria-hidden":"true"}),n(i?"computer.windows.starting":"computer.windows.start")]})})]})]})})}const ca={computer:{Icon:Me,label:"computer.tab.computer"},routines:{Icon:Tn,label:"computer.tab.routines"},android:{Icon:An,label:"computer.tab.android"},browser:{Icon:Ft,label:"computer.tab.browser",tour:"computer-browser"},data:{Icon:Or,label:"computer.tab.data",tour:"computer-data"},files:{Icon:Mr,label:"computer.tab.files"}},Ne="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",xt=s=>`computer-panel-tabs-tab-${s}`,On=s=>`computer-panel-tabs-panel-${s}`,da=(s,i)=>({id:xt(s),role:"tab","aria-selected":i,"aria-controls":On(s),tabIndex:i?0:-1}),Se=s=>({role:"tabpanel",id:On(s),"aria-labelledby":xt(s),tabIndex:0});function ua(s){const i=s.currentTarget;Math.abs(s.deltaY)<=Math.abs(s.deltaX)||i.scrollWidth<=i.clientWidth||(i.scrollLeft+=s.deltaY)}function pa(s,i,d){if(s.ctrlKey||s.metaKey||s.altKey)return;const S=Math.max(0,i.findIndex(k=>xt(k)===s.target.id)),f=s.key==="ArrowRight"?1:s.key==="ArrowLeft"?-1:0,v=s.key==="Home"?i[0]:s.key==="End"?i[i.length-1]:f?i[(S+f+i.length)%i.length]:void 0;v&&(s.preventDefault(),d(v),document.getElementById(xt(v))?.focus())}function ma(s,i,d){const S=i.scanned&&i.devices.length===0&&i.reasonCode!=="adb-unavailable"&&i.reasonCode!=="adb-failed";a.useEffect(()=>{!S||$t(s)!=="android"||(d("computer"),Ze(s,"computer"))},[s,S,d])}const Vn="omb-computer-panel-width",bt=360,ft=960,xa=400,En=40;function ba(){try{const s=Number(localStorage.getItem(Vn));if(Number.isFinite(s)&&s>=bt&&s<=ft)return s}catch{}return xa}function fa(){const[s,i]=a.useState(ba),d=a.useRef(null),S=h=>{try{localStorage.setItem(Vn,String(h))}catch{}},f=h=>{d.current={x:h.clientX,width:s},h.currentTarget.setPointerCapture(h.pointerId)},v=h=>{if(!d.current)return;const g=Math.min(ft,Math.max(bt,d.current.width+(d.current.x-h.clientX)));i(g)},k=h=>{d.current&&(d.current=null,h.currentTarget.releasePointerCapture(h.pointerId),S(s))},j=h=>{i(g=>{const x=Math.min(ft,Math.max(bt,g+h));return S(x),x})},y=a.useRef(null),[P,u]=a.useState(null);return a.useEffect(()=>{const h=y.current?.closest("aside");if(!h)return;const g=()=>u(h.offsetWidth);g();const x=new ResizeObserver(g);return x.observe(h),()=>x.disconnect()},[]),{panelWidth:s,separatorRef:y,separatorWidth:P,onSeparatorKeyDown:h=>{if(h.ctrlKey||h.metaKey||h.altKey)return;const g=h.key==="ArrowLeft"?En:h.key==="ArrowRight"?-En:null;g===null||P===null||(h.preventDefault(),j(g))},onResizeStart:f,onResizeMove:v,onResizeEnd:k}}const ha=a.lazy(()=>Pn(()=>import("./DataPanel-VJJAqxxu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(s=>({default:s.DataPanel}))),_n=()=>Pn(()=>import("./LiveDesktop-6_ms70VN.js"),__vite__mapDeps([9,1,2,10,11,5,6,7,3,4])).then(s=>({default:s.LiveDesktop})),ga=a.lazy(_n),Rn=yr({held:yn().optional().default(!1),helpReason:kr().nullable().optional().default(null),help:wr().optional().transform(xs),owned:yn().optional()}).passthrough();function Oa({bot:s,onOpenVmWorkspace:i}){const{dragProps:d}=Dn(),{panelWidth:S,separatorRef:f,separatorWidth:v,onSeparatorKeyDown:k,onResizeStart:j,onResizeMove:y,onResizeEnd:P}=fa(),{state:u,dispatch:m,flushBotPatches:h}=Vr(),g=s.tasks?.find(t=>t.threadId===s.threadId),x=_r(s,g),w=Fr(g),$=$r(s),R=`${s.id}:${s.threadId}:${x}:${s.cloudBackend??"box"}:${$.modelSelection.instanceId}`,[D,B]=a.useState(null),ye=D?.key===R,me=x!=="auto"||ye,r={...$,computer:x==="auto"?ye?D.surface:void 0:x},p=`${r.id}:${r.threadId}:${r.computer}:${r.cloudBackend??"box"}`,C=a.useRef(p);C.current=p;const V=a.useRef(null);a.useEffect(()=>()=>V.current?.abort(),[p]);const _=!!r.busy,L=a.useCallback(t=>`/api/bots/${s.id}/${t}?threadId=${encodeURIComponent(s.threadId)}`,[s.id,s.threadId]),Y=s.computer==="cloud"&&x==="cloud",J=s.computer==="vm"&&x==="vm",{capabilities:G,ready:Oe}=Qe(),Ce=G.localComputer.available,te=G.host.platform==="linux",Ve=Br(u.instances,r),Wt=Wr("local",u.config)&&Kr({capabilities:G,providerSupportsLocal:Ve}),[Kt,gt]=a.useState(null),Ut=Ur({capabilities:G,providerSupportsLocal:Ve}),Fn=Hr(u.config,G),[c,N]=a.useState("checking"),[_e,Ht]=a.useState(null),[xe,ne]=a.useState(null),[vt,yt]=a.useState(null),T=r.cloudBackend??"box",et=!!(_e&&_e.botId===r.id&&_e.computer===s.computer&&_e.cloudBackend===T&&_e.section===(r.section?.trim()??"")),U=!!(xe&&xe.botId===r.id&&xe.threadId===r.threadId&&xe.computer===r.computer&&xe.cloudBackend===T),we=U&&x==="auto"&&T==="box"&&vt?.botId===r.id&&vt.section===(r.section?.trim()??"")?vt:null,W=U&&qr({computer:r.computer,cloudBackend:T,phase:c,botId:r.id,resolvedBotId:xe?.botId??null,resolvedComputer:xe?.computer??null,resolvedCloudBackend:xe?.cloudBackend??null}),Ie=a.useCallback(t=>{ne(null),yt(null),N("checking"),m({type:"updateBot",botId:r.id,patch:t})},[r.id,m]);a.useEffect(()=>{let t=!0;return Ht(null),h(r.id).then(o=>{t&&(o&&!Xr({computer:s.computer,cloudBackend:T,persistedBot:o})||o&&(o.section?.trim()??"")!==(r.section?.trim()??"")||Ht({botId:r.id,computer:s.computer,cloudBackend:T,section:r.section?.trim()??""}))}),()=>{t=!1}},[r.id,s.computer,r.section,T,h]);const[Fe,ae]=a.useState(null),[wt,tt]=a.useState(null),[$n,ce]=a.useState(null),[Bn,Ee]=a.useState(!1),[qt,Wn]=a.useState(0),[Kn,kt]=a.useState(null),[H,$e]=a.useState(null),[Xt,jt]=a.useState(null),[Un,Yt]=a.useState(null),[E,oe]=a.useState(null),[ie,Re]=a.useState(!1),[nt,Gt]=a.useState(!1),[rt,I]=a.useState(null),be=Sn(rt),Q=hr(),[Hn,Pe]=a.useState(()=>$t(r.id)),Be=u.dataResultFocus?.botId===r.id?u.dataResultFocus:void 0,[qn,Xn]=a.useState(),Nt=Hs(),St=Nt.devices.length>0,Zt=gs({advanced:Q,androidConnected:St}),M=ps(Hn,{advanced:Q,androidConnected:St}),Ct=Yr(s.id,M),Jt=Gr(u.config),fe=wn(u.config)&&r.browser!==!1&&(Jt||u.config?.browserEngine?.installable===!0),[Qt,ze]=a.useState(0),[Yn,Gn]=a.useState(!1);a.useEffect(()=>{if(x!=="auto"||!et)return;const t=new AbortController;return B(null),F(L("computer"),{signal:t.signal}).then(o=>{if(t.signal.aborted)return;const l=o.surface;B({key:R,surface:l==="cloud"||l==="vm"||l==="local"||l==="browser"||l==="off"?l:void 0})}).catch(o=>{t.signal.aborted||(I(o instanceof Error?o:String(o)),N("error"))}),()=>t.abort()},[R,x,et,L,Qt]);const It=c==="vm-unavailable"&&H?.resumable===!0,We=a.useRef(0),ke=a.useRef(null);a.useEffect(()=>(ke.current?.signal.aborted&&(ke.current=null,oe(null)),()=>{ke.current?.abort()}),[r.id,r.threadId,r.computer,M]);const st=u.instances.find(t=>t.instanceId===r.modelSelection.instanceId),Te=a.useRef(!1),at=t=>{Te.current=!0,Pe(t),Ze(r.id,t)};a.useEffect(()=>{const t=o=>{o.detail===r.id&&(Te.current=!0,Pe("browser"),Ze(r.id,"browser"))};return window.addEventListener("limix-show-bot-browser",t),()=>window.removeEventListener("limix-show-bot-browser",t)},[r.id]);const en=a.useRef(null),ot=`${s.id}:${s.threadId}:${x}:${s.cloudBackend??"box"}`;a.useEffect(()=>{const t=en.current;t===ot&&(Te.current||!(r.computer==="browser"&&fe))||(t!==ot&&(Te.current=!1),en.current=ot,Pe(r.computer==="browser"&&fe?"browser":t===null?$t(r.id):"computer"))},[ot,r.id,r.computer,fe]),a.useEffect(()=>{!Be||Be.consumed||(Te.current=!0,Xn(Be),Pe("data"),Ze(r.id,"data"),m({type:"dataResultFocusConsumed",requestId:Be.requestId}))},[r.id,m,Be]);const he=u.signInFocus?.botId===r.id?u.signInFocus:void 0,[Zn,Jn]=a.useState(),[Qn,er]=a.useState();Zr(r.id,t=>{at("browser"),er(t)}),a.useEffect(()=>{if(!he||he.consumed)return;const t=he.place==="browser"?"browser":"computer";Te.current=!0,Pe(t),Ze(r.id,t),t==="browser"&&Jn({url:he.url,site:he.site,nonce:he.requestId}),m({type:"signInFocusConsumed",requestId:he.requestId})},[r.id,m,he]),a.useEffect(()=>{let t=!0;const o=window.ogb?.desktopViewer;o?.currentState&&o.currentState().then(b=>{t&&Gt(b.open&&b.contextId===r.id)}).catch(()=>{});const l=o?.onState(b=>{b.contextId===r.id&&Gt(b.open)});return()=>{t=!1,l?.()}},[r.id]),ma(r.id,Nt,Pe),a.useEffect(()=>{We.current=0},[r.id,r.computer]);const tn=!!(st?.snapshot.state==="available"&&st.capabilities?.computerMcp),Et=jr(Nr(st)),nn=u.routines.filter(t=>t.botId===r.id).sort((t,o)=>Number(o.enabled)-Number(t.enabled)||(t.nextRunAt??1/0)-(o.nextRunAt??1/0)),tr=!!(u.config?.box.configured&&Sr(u.instances,r.modelSelection.instanceId)?.snapshot.state==="available"),Ke=u.routineRuns.find(t=>t.botId===r.id&&["queued","running","waiting"].includes(t.status));a.useEffect(()=>{if(M!=="computer")return;let t=!0;if(ne(null),yt(null),N("checking"),tt(null),ce(null),kt(null),$e(null),jt(null),Yt(null),I(null),!(!et||!me)){if(r.computer===void 0){N("auto-unavailable");return}if(r.computer==="off"){N("off");return}if(r.computer==="browser"){N("browser");return}if(r.computer==="local"){Ve||I(new O("computer.err.localEngine")),N(Oe&&Ce&&Ve?"local":"local-unavailable"),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T});return}if(r.computer==="vm"){if(!tn){I(new O("computer.err.vmEngine")),N("vm-unavailable");return}let o;return F(L("local-computer")).then(l=>{if(!t)return;const b=l;if(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),$e(b),b.ready)We.current=0,N("vm");else if(b.container==="running"&&b.imageMatches&&b.managed&&b.network==="loopback"&&b.security==="hardened"&&b.persistence==="durable"&&!b.desktopReady&&We.current<15)We.current+=1,I(null),N("checking"),o=window.setTimeout(()=>ze(z=>z+1),2e3);else{const z=b.mode==="per-bot"&&b.container==="missing"&&b.image&&b.create_supported;I(z||b.resumable?null:new O("computer.err.vmOpenSettings",b.problem,"computer.err.vmNotReady")),N("vm-unavailable")}}).catch(l=>{t&&(I(l.message),N("vm-unavailable"))}),()=>{t=!1,o!==void 0&&window.clearTimeout(o)}}if(r.computer==="cloud"&&!Et){N("error");return}if(!(r.computer!=="cloud"&&!Oe))return T==="vps"?(F(L("computer")).then(o=>{if(!t)return;const l=o;if(jt(l),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),!l.configured){I(new O("computer.err.vpsAlias")),N("vps-unconfigured");return}if(l.ready){ae(l.container??null),N("ready");return}if(l.managed&&l.container!=="missing"&&!l.imageMatches){I(l.problem),N("vps-incompatible");return}if(Y)return N("starting"),F(`/api/bots/${r.id}/computer/provision`,{method:"POST"}).then(b=>{t&&(ae(b.container??null),b.ready?(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),N("ready")):(I(b.problem??new O("computer.err.vpsNotReady")),N("error")))});ae(l.container??null),I(r.autoStartVps?new O("computer.err.vpsAuto",l.problem,"computer.err.vpsNoContainer"):new O("computer.err.vpsManual",l.problem,"computer.err.vpsNoContainer")),N(l.container==="stopped"?"vps-stopped":"vps-unconfigured")}).catch(o=>{t&&(I(o.message),N("error"))}),()=>{t=!1}):(F(L("computer")).then(o=>{if(!t)return;const l=Jr({computer:x==="cloud"?"cloud":void 0,configured:!!o.configured,boatState:typeof o.box?.state=="string"?o.box.state:null,canUseCloud:Et,autoLocal:!1,teamComputer:typeof o.teamComputer?.id=="string"&&typeof o.teamComputer?.name=="string",busy:s.busy});if(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),!o.configured&&r.computer==="cloud"&&!o.teamComputer){N("unconfigured");return}if(l==="team-boat"){yt({id:o.teamComputer.id,name:o.teamComputer.name,botId:r.id,section:r.section?.trim()??""}),ae(typeof o.box?.state=="string"?o.box.state:o.configured?"missing":"unavailable"),I(typeof o.problem=="string"?o.problem:null),N("team-boat");return}if(l==="attach-ready-boat"||r.computer==="cloud"&&l==="show-ready-boat"){ae(typeof o.box?.state=="string"?o.box.state:null),N("ready");return}ae(typeof o.box?.state=="string"?o.box.state:null),N(l)}).catch(o=>{t&&(I(o.message),N("error"))}),()=>{t=!1})}},[r.id,r.threadId,r.computer,r.section,r.autoStartVps,r.vpsAlias,T,Qt,Oe,Wt,te,Ve,st?.driverKind,tn,Et,u.config?.vps?.sshAlias,M,et,me,Y,x,L]),a.useEffect(()=>{if(c!=="busy-boat")return;let t=!0;const o=()=>{if(!s.busy&&x==="cloud"){ze(b=>b+1);return}F(L("computer"),{background:!0}).then(b=>{if(!t)return;const z=typeof b.box?.state=="string"?b.box.state:null;ae(z),ms(z)&&N("ready")}).catch(()=>{})},l=window.setInterval(o,5e3);return()=>{t=!1,window.clearInterval(l)}},[c,L,s.busy,x]);const q=u.computerControl[r.id]??{held:!1,helpReason:null},it=a.useCallback(async(t,o)=>{const l=Rn.parse(await F(`/api/bots/${r.id}/computer/control`,{method:"POST",body:JSON.stringify({action:t,...o?{controlLeaseId:o}:{}})}));return m({type:"computerControl",botId:r.id,held:l.held===!0,helpReason:l.helpReason,help:l.help}),l},[r.id,m]),ee=U?c==="vm"&&H?.viewer_url&&H.target_key?Er({key:H.target_key}):W&&T==="vps"?`vps/${r.id}`:null:null,le=Js({botId:r.id,session:`${p}:${M}`,held:q.held,request:it,viewerClose:ee?.startsWith("vps/")?L("computer/viewer-close"):null}),pe=le.here&&!!ee;a.useEffect(()=>{ee&&_n()},[ee]);const Ae=Bt(),De=a.useRef(0),Rt=a.useRef(r.busy);a.useEffect(()=>{Rt.current=r.busy},[r.busy]),a.useEffect(()=>{if(De.current=0,!!W)return Qr({screens:!0,onFrame:t=>{t.kind!=="screen"||t.botId!==r.id||t.threadId!==r.threadId||(De.current=Date.now(),tt({png:t.png,mime:t.mime??"image/png"}),ce(null),Ee(!1))}})},[W,r.id,r.threadId]),a.useEffect(()=>{if(M!=="computer"||!W||nt||pe||!Ae||E||ie)return;let t=!1,o=-1/0,l=null,b=null;const z=new AbortController;ce(null),Ee(!0);const se=async()=>{if(t||z.signal.aborted||Date.now()-o<(l??(Rt.current?4e3:3e4))||Rt.current&&Date.now()-De.current<1e4)return;t=!0,l=null;const X=Date.now();try{const{png:Z,format:Le}=await F(L("computer/screenshot"),{method:"POST",signal:AbortSignal.any([z.signal,AbortSignal.timeout(9e4)])});if(!z.signal.aborted&&De.current<=X){if(typeof Z!="string"||!Z.trim())throw new O("computer.err.emptyFrame");tt({png:Z,mime:Le==="jpeg"?"image/jpeg":"image/png"}),ce(null),Ee(!1),b=null}}catch(Z){if(!z.signal.aborted&&De.current<=X)if(Z instanceof bs&&Cr(Z)){l=1e3,b??=Date.now();const Le=Date.now()-b>=1e4;ce(Le?Z:null),Ee(!Le)}else b=null,Ee(!1),ce(Z instanceof Error&&Z.name==="TimeoutError"?new O("computer.err.frameTimeout"):Z instanceof Error?Z:new O("computer.err.screenUnavailable"))}finally{t=!1,o=Date.now()}};se();const ue=setInterval(se,1e3);return()=>{z.abort(),clearInterval(ue)}},[M,W,L,T,nt,pe,Ae,E,ie,qt]),a.useEffect(()=>{if(M!=="computer"||c!=="vm"||!U||nt||pe||!Ae)return;const t=new AbortController;let o=!1,l=-1/0,b=null,z=!0;const se=async()=>{if(!(o||t.signal.aborted)&&!(Date.now()-l<(b??(r.busy?3e3:3e4)))){o=!0,b=null;try{const{image:X}=await F(L("local-computer/screenshot"),{method:"POST",signal:t.signal});!t.signal.aborted&&typeof X=="string"&&(kt(X),ce(null))}catch(X){t.signal.aborted||(b=5e3,z?I(X instanceof Error?X.message:String(X)):ce(X instanceof Error?X:new O("computer.err.screenUnavailable")))}finally{o=!1,z=!1,l=Date.now()}}};se();const ue=window.setInterval(()=>{se()},r.busy?3e3:3e4);return()=>{t.abort(),window.clearInterval(ue)}},[M,c,U,L,nt,pe,Ae,r.busy,I,ce,kt]);const[rn,Pt]=a.useState(0);a.useEffect(()=>{if(M!=="computer"||c!=="local"||!U||!window.ogb||te||!Ae)return;let t=!0;Pt(0);const o=async()=>{try{const b=await window.ogb.screenFrame();t&&b?Yt(b):t&&Pt(z=>z+1)}catch{t&&Pt(b=>b+1)}};o();const l=setInterval(o,r.busy?3e3:3e4);return()=>{t=!1,clearInterval(l)}},[M,c,U,te,Ae,r.busy,r.id,r.threadId]);const ge=U?c==="vm"?Kn:c==="local"&&!te?Un:W||r.computer==="cloud"&&c==="starting"?wt&&`data:${wt.mime};base64,${wt.png}`:null:null,nr=!!(ge&&(ee||W)),de=q.help??null,rr=de?u.bots.find(t=>t.id===de.botId)?.name??r.name:r.name;a.useEffect(()=>{let t=!0;return F(`/api/bots/${r.id}/computer/control`).then(o=>{if(!t)return;const l=Rn.parse(o);m({type:"computerControl",botId:r.id,held:l.held===!0,helpReason:l.helpReason,help:l.help})}).catch(()=>{}),()=>{t=!1}},[r.id]);const sn=a.useCallback(async()=>!0,[]),an=a.useCallback(async t=>es({action:t,syncNativeBrowser:M!=="browser",requestControl:it,setNativeBrowserControl:sn}),[M,it,sn]),sr=a.useCallback(async t=>{Re(!0),I(null);try{return await an(t),!0}catch(o){return I(o instanceof Error?o.message:String(o)),!1}finally{Re(!1)}},[an]),lt=!!(de&&de.place!=="browser"&&de.place!=="local"&&(W||c==="vm"||we)),on=t=>de&&e.jsx(ys,{help:de,askerName:rr,takeControl:t&&{onClick:t,disabled:ie||E==="join",pending:E==="join"},onError:I}),ar=async()=>{const t=new AbortController;V.current=t;const o=()=>!t.signal.aborted&&C.current===p;oe("join"),Re(!0),I(null);try{await Zs({botId:r.id,title:n("computer.viewerTitle",{name:r.name}),held:q.held,request:it,join:l=>F(L("computer/join"),{method:"POST",signal:AbortSignal.any([t.signal,l])}),current:o})}catch(l){o()&&I(l instanceof Error?l:String(l))}finally{V.current===t&&(V.current=null,oe(null),Re(!1))}},zt=E==="join"||c==="vm"&&!ee,ve=async(t=!1)=>{if(!ee)return W?ar():void 0;if(le.here)return le.setExpanded(t||le.expanded);Re(!0),I(null);try{await le.take(t)}catch(o){I(o instanceof Error?o:String(o))}finally{Re(!1)}},ln=async()=>{I(null),window.ogb?.desktopViewer?.close(r.id),await le.handBack().catch(t=>I(t instanceof Error?t:String(t)))},Tt=t=>{oe(t),I(null),F(`/api/bots/${r.id}/computer/${t}`,{method:"POST"}).then(o=>{t==="provision"&&(ae(o.container??null),o.ready?(r.computer==="cloud"&&ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),N("ready")):(I(o.problem??new O("computer.err.vpsNotReady")),N("error"))),t==="sleep"&&(ne(null),ae(T==="vps"?"stopped":"archived"),N(T==="vps"?"vps-stopped":Y?"cloud-asleep":"show-sleeping-boat"))}).catch(o=>{I(o.message)}).finally(()=>oe(null))},or=()=>{oe("provision"),I(null),N("starting"),F(`/api/bots/${r.id}/computer/provision`,{method:"POST"}).then(t=>{ae(t.state??null),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),N("ready")}).catch(t=>{if(Ir(t)){N("busy-boat");return}I(t.message),N("error")}).finally(()=>oe(null))},At=async t=>{if((t==="vm-recreate"||t==="vm-delete")&&!window.confirm(t==="vm-delete"?n("computer.confirm.deleteVm",{name:r.name}):n("computer.confirm.replaceVm",{name:r.name}))||ke.current)return;const o=new AbortController;ke.current=o,oe(t),I(null),We.current=0;try{if((t==="vm-recreate"||t==="vm-delete")&&await F(`/api/bots/${r.id}/local-computer/remove`,{method:"POST",body:"{}",signal:o.signal}),t!=="vm-delete"){const l=t==="vm-start"&&H?.mode!=="per-bot"?"/api/local-computer/start":`/api/bots/${r.id}/local-computer/${t==="vm-start"?"start":"run"}`,b=await F(l,{method:"POST",body:"{}",signal:o.signal}),z=await Ss(b,()=>F(L("local-computer"),{signal:o.signal}),o.signal);if(z.container==="stopped"&&z.capacity_limited){$e(z),N("vm-unavailable");return}if(!z.ready)throw new Error(z.problem??n("computer.err.vmNotReady"));$e(z),N("vm")}else $e(l=>l&&{...l,container:"missing",ready:!1}),N("vm-unavailable")}catch(l){if(o.signal.aborted)return;I(l instanceof Error?l.message:String(l)),N("vm-unavailable")}finally{ke.current===o&&!o.signal.aborted&&(ke.current=null,oe(null),ze(l=>l+1))}},ir=async()=>{if(window.confirm(n("computer.confirm.replaceVps",{name:r.name}))){oe("vps-replace"),I(null);try{await F(`/api/bots/${r.id}/computer/remove`,{method:"POST",body:"{}"});const t=await F(`/api/bots/${r.id}/computer/provision`,{method:"POST",body:"{}"});jt(t),ae(t.container??null),t.ready&&r.computer==="cloud"&&ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:T}),N(t.ready?"ready":"error"),t.ready||I(t.problem??new O("computer.err.vpsReplaceNotReady"))}catch(t){I(t instanceof Error?t.message:String(t)),N("error")}finally{oe(null),ze(t=>t+1)}}},cn=()=>{window.sessionStorage.setItem("openmausbot.settings.section","computer"),m({type:"toggleAppSettings",open:!0})},dn=()=>m(ws("vps")),un=U&&(c==="vps-unconfigured"||c==="vps-stopped"||c==="vps-incompatible"),pn=U&&Y&&(c==="vps-stopped"||c==="vps-unconfigured"&&!!Xt?.configured),mn=U&&Y&&c==="vps-incompatible"&&!!Xt?.managed,Dt=Jt||u.config?.browserEngine?.installable===!0,[xn,bn]=a.useState(!1),fn=async()=>{if(!xn){bn(!0),I(null);try{if(!wn(u.config)){const t=await F("/api/config",{method:"PATCH",body:JSON.stringify({features:{browser:!0}})});m({type:"configStatus",config:t})}s.browser===!1&&m({type:"updateBot",botId:s.id,patch:{browser:!0}})}catch(t){I(t instanceof Error?t.message:n("settings.experimental.error"))}finally{bn(!1)}}},lr=()=>{I(null),m({type:"updateBot",botId:s.id,patch:{browser:!1}})},hn=e.jsxs("div",{"data-testid":"browser-switch-row",className:"mb-3 flex items-center gap-3 rounded-xl bg-card px-3 py-2.5",children:[e.jsx(Ft,{size:15,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("computer.browserSwitch.title",{name:r.name})}),!Dt&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:kn(u.config)})]}),e.jsx(zn,{checked:fe,disabled:xn||!fe&&!Dt,"aria-label":n("computer.browserSwitch.title",{name:r.name}),onClick:()=>fe?lr():void fn()})]}),cr=u.config?.managedPolicy,Lt=ts(Fe,s.busy===!0),dr=!U||x!=="cloud"||T!=="box"?void 0:c==="starting"?"starting":c==="busy-boat"?Lt.spinner?"starting":Lt.line==="computer.cloud.asleep"?"asleep":"none":c==="ready"?"on":Fe==="archived"||Fe==="stopped"?"asleep":void 0,Ue=(t,o)=>fs({...hs({bot:r,place:t,seat:Fn,config:u.config,instances:u.instances,local:{ready:Wt,reason:Ut??n("computer.unavailableLocal")},...t==="cloud"?{computer:dr}:{},...t==="auto"&&we?{teamComputer:we.name}:{}}),...o?{refusal:o}:{}}),Mt=r.computer==="cloud"&&T==="box"&&c==="error"&&rt&&!(rt instanceof O)?ns({message:be??"",status:Number(rt.status??0)||void 0},u.config?.box?.included===!0):void 0,re=Ue("cloud",Mt),je=Ue("auto"),ur=rs(G),He=Ps(u.config,G).map(([t,o,l,b])=>{const z=zs(t,s.computer,G),se=Ts(t,s.cloudBackend,cr),ue=t===null?je:t==="cloud"?re:Ue(t),X=!!se||jn(ue),Z=!se&&ss(ue),Le=se??(Z?ue.line:t==="browser"?n("computer.browserOnlyTitle"):void 0);return{mode:t,labelKey:o,descriptionKey:l,Icon:b,simpleLabel:as(t??void 0,G.host.platform),selected:z,managedBy:se,disabled:X,unavailableTitle:Le,view:ue,issue:Z}}),ct=He.find(({selected:t})=>t)?.view??je,pr=t=>{if(t==="start"||t==="wake")return or();if(t==="try-again")return ze(o=>o+1);if(t==="turn-on-browser")return void fn();if(t==="open-vm-settings")return cn();js(t,{botId:s.id,threadId:s.threadId},m)},mr=t=>!!t&&t!=="watch"&&t!=="open-computer-panel"&&(t!=="start"&&t!=="wake"||Y&&!s.busy),qe=(t,o="mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover")=>t.action&&mr(t.action.id)?e.jsx("button",{type:"button","data-testid":"place-action",onClick:()=>pr(t.action.id),className:o,children:t.action.label}):null,gn=t=>{t===null&&s.computer===void 0||t===s.computer||(t==="local"&&ks(s)==="auto"?gt(r.id):Ie(t==="browser"?{computer:t,browser:!0}:{computer:t}))},xr=()=>{s.computer==="local"&&ur&&Ie({computer:null}),m({type:"updateTask",botId:s.id,threadId:s.threadId,patch:{surface:null}})},Ot=w&&s.computer!=="off"&&w!==s.computer?w:void 0,br=t=>K("flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1 text-[13px] transition-colors @max-[28rem]/paneltabs:[&>svg]:hidden @max-[22rem]/paneltabs:px-2",t?"bg-raised text-ink shadow-sm":"text-ink-secondary hover:text-ink"),vn=t=>{t==="browser"&&I(null),at(t)},fr={checking:n("computer.phase.checking"),starting:T==="vps"?n("computer.phase.starting"):re.line,"busy-boat":re.line,unconfigured:re.line,"auto-unavailable":je.line,"team-boat":je.line,"show-ready-boat":n("computer.phase.showReadyBoat"),"show-sleeping-boat":n("computer.phase.showSleepingBoat"),"show-pending-boat":n("computer.phase.showPendingBoat"),"cloud-new":re.line,"cloud-asleep":re.line,"vps-unconfigured":n("computer.phase.vpsUnconfigured"),"vps-incompatible":n("computer.phase.vpsIncompatible"),"vps-stopped":n("computer.phase.vpsStopped"),"local-unavailable":Ut??n("computer.phase.localUnavailable"),"vm-unavailable":n("computer.phase.vmUnavailable"),browser:Ue("browser").line,off:Ue("off").line,error:r.computer==="cloud"&&(Mt||jn(re))?re.line:n("computer.phase.error")};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:K("animate-panel-in relative flex h-full shrink-0 flex-col border-l border-hairline/40 bg-panel","max-md:absolute max-md:inset-0 max-md:z-40 max-md:w-full!"),ref:Ct,"data-computer-panel":!0,style:{width:S},children:[e.jsx("div",{ref:f,role:"separator","aria-orientation":"vertical","aria-label":n("computer.resizeAria"),"aria-valuemin":bt,"aria-valuemax":ft,"aria-valuenow":v??void 0,tabIndex:0,onKeyDown:k,onPointerDown:j,onPointerMove:y,onPointerUp:P,onPointerCancel:P,className:"absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60 max-md:hidden"}),e.jsx("div",{...d,className:"@container/paneltabs ml-1.5 py-3 pl-2.5 pr-4",children:e.jsxs("div",{className:"relative flex min-h-7 items-center justify-center",children:[Q&&e.jsx("button",{onClick:()=>{Nn(Ct.current,r.id),m({type:"toggleComputer",open:!1}),m({type:"toggleSettings",open:!0,section:"access"})},className:"absolute left-0 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:n("computer.botSettings"),children:e.jsx(os,{size:18})}),e.jsx("div",{className:"mx-9 flex min-w-0 touch-pan-x gap-0.5 overflow-x-auto whitespace-nowrap rounded-full bg-inset p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","data-tour":"computer-tabs","data-testid":"computer-tabs",role:"tablist","aria-label":n("computer.tabsAria"),onWheel:ua,onKeyDown:t=>pa(t,Zt,vn),children:Zt.map(t=>{const{Icon:o,label:l,tour:b}=ca[t],z=_?t==="computer"&&vs(x)?"computer-tab-live":t==="browser"&&x==="browser"?"browser-tab-live":void 0:void 0;return e.jsxs("button",{type:"button","data-tour":b,...da(t,t===M),title:n(l),onClick:()=>vn(t),className:br(t===M),children:[e.jsx(o,{size:13})," ",n(l),z&&e.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":n("place.live"),"data-testid":z})]},t)})}),e.jsx("button",{"data-computer-panel-close":!0,onClick:()=>{Nn(Ct.current,r.id),m({type:"toggleComputer",open:!1})},className:"absolute right-0 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("computer.close"),title:n("computer.close"),children:e.jsx(gr,{size:18})})]})}),M==="routines"?e.jsx("div",{...Se("routines"),className:K("min-h-0 flex-1 overflow-y-auto px-4 pb-4",Ne),children:e.jsx(Cs,{bot:r,routines:nn,runs:u.routineRuns,defaultRunOn:tr?"cloud":"maus"},r.id)}):M==="browser"&&fe?e.jsxs("div",{...Se("browser"),className:K("flex min-h-0 flex-1 flex-col px-4 pb-4",Ne),children:[hn,de?.place==="browser"&&e.jsx("div",{className:"-mt-1 mb-3",children:on()}),e.jsx(Rs,{bot:r,signIn:Zn,page:Qn}),be&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be})]}):M==="browser"?e.jsxs("div",{...Se("browser"),className:K("flex-1 overflow-y-auto px-5 pb-5",Ne),"data-testid":"browser-off",children:[hn,e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-3 rounded-xl bg-card px-6 py-8 text-center",children:[e.jsx(Ft,{size:22,className:"text-ink-secondary","aria-hidden":"true"}),e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.browserOff.title")}),e.jsx("p",{className:"text-[12px] leading-5 text-ink-secondary",children:Dt?n("computer.browserOff.body",{name:r.name}):kn(u.config)}),be&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be})]})]}):M==="data"?e.jsx("div",{...Se("data"),className:K("flex min-h-0 flex-1 flex-col overflow-hidden",Ne),children:e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex flex-1 items-center justify-center text-[13px] text-ink-secondary",role:"status",children:n("data.loading")}),children:e.jsx(ha,{bot:r,requestedCard:qn},r.id)})}):M==="files"?e.jsx("div",{...Se("files"),className:K("flex min-h-0 flex-1 flex-col",Ne),children:e.jsx(Is,{bot:r})}):M==="android"&&St?e.jsx("div",{...Se("android"),className:K("flex-1 overflow-y-auto px-4 pt-2",Ne),children:e.jsx(qs,{status:Nt})}):e.jsxs("div",{...Se("computer"),className:K("flex-1 overflow-y-auto px-5 pb-5",Ne),children:[e.jsxs("div",{className:"mb-1.5 mt-2 flex items-center justify-between text-[13px] text-ink-secondary",children:[e.jsx("span",{children:n("computer.screenOf",{name:r.name})}),we&&e.jsx("span",{className:"text-[11px]",children:je.short}),c==="local"&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.local")}),pe&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-ink",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-success"}),n("computer.inControl")]}),c==="vm"&&!pe&&e.jsx("span",{className:"text-[11px]",children:n("vm.dest.vm")}),(c==="show-ready-boat"||c==="show-sleeping-boat"||c==="show-pending-boat")&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.autoBoat")}),U&&r.computer==="cloud"&&T==="vps"&&(c==="ready"||c==="starting")&&!pe&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.vps")})]}),e.jsx("div",{className:K("relative flex aspect-[16/10] w-full items-center justify-center overflow-hidden rounded-xl bg-card",pe&&"ring-2 ring-accent"),children:pe&&ee?e.jsx(a.Suspense,{fallback:e.jsx(A,{size:18,className:"animate-spin text-ink-secondary"}),children:e.jsx(ga,{target:ee,threadId:r.threadId,name:r.name,poster:ge,expanded:le.expanded,onExpandedChange:le.setExpanded,onHandBack:()=>{ln()},handingBack:le.handingBack,onUnreachable:()=>{le.leave(),I(new O("computer.err.openDesktop"))}})}):W||r.computer==="cloud"&&c==="starting"?e.jsx(Ws,{src:ge,name:r.name,error:Sn($n),refreshing:Bn,retry:qt,starting:c==="starting",opening:E==="join",disabled:ie,onOpen:()=>{ve()},onRetry:t=>{De.current=0,t&&tt(null),ce(null),Ee(!0),Wn(o=>o+1)}},`${r.id}:${r.threadId}:${r.computer}:${T}`):ge&&nr?e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:ie||E==="join",className:"group relative flex h-full w-full cursor-pointer items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait","aria-label":n("computer.openLiveDesktopAria",{name:r.name}),title:n("computer.openLiveDesktop"),children:[e.jsx("img",{src:ge,alt:n("computer.screenOf",{name:r.name}),className:"h-full w-full object-contain transition group-hover:brightness-75 group-focus-visible:brightness-75"}),e.jsxs("span",{className:"pointer-events-none absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white opacity-80 shadow-sm transition group-hover:opacity-100 group-focus-visible:opacity-100",children:[E==="join"?e.jsx(A,{size:12,className:"animate-spin"}):e.jsx(Je,{size:12}),n("computer.open")]})]}):ge?e.jsx("img",{src:ge,alt:n("computer.screenOf",{name:r.name}),className:"h-full w-full object-contain",title:c==="vm"?n("computer.watchOnly"):void 0}):e.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[c==="checking"||c==="starting"||c==="busy-boat"&&Lt.spinner||c==="vm"||c==="local"&&!te?e.jsx(A,{size:18,className:"animate-spin"}):c==="off"?e.jsx(mt,{size:22}):e.jsx(Me,{size:22}),e.jsx("span",{className:"text-[12px]",children:we?je.line:W?n("computer.waitingFrame"):c==="ready"?n("computer.autoChooseCloudOpen"):c==="vm"?n("computer.capturingVm"):c==="local"?te?n("computer.linuxReady"):rn>=3?n("computer.needsScreenPerm"):n("computer.capturingLocal"):It?n(E==="vm-start"?"vm.setup.starting":"computer.phase.vmStopped"):fr[c]}),we&&qe(je),r.computer==="cloud"&&(c==="unconfigured"||c==="error")&&re.action?.id!=="add-boat-key"&&qe(re),c==="local"&&!te&&rn>=3&&e.jsx("button",{onClick:()=>window.ogb?.permOpenSettings?.("screen"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openSettings")}),c==="browser"&&fe&&e.jsx("button",{onClick:()=>at("browser"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openBrowserTab")}),(c==="show-ready-boat"||c==="show-sleeping-boat"||c==="show-pending-boat")&&e.jsx("button",{type:"button",onClick:()=>Ie({computer:"cloud"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:c==="show-sleeping-boat"?n("computer.chooseCloudWake"):c==="show-ready-boat"?n("computer.chooseCloudOpen"):n("computer.chooseCloudManage")}),E===null&&(c==="cloud-new"||c==="cloud-asleep")&&qe(re),It&&E!=="vm-start"&&e.jsx("p",{className:"text-[12px]",children:n(H?.stop_reason==="idle"?"vm.stopped.idle":"vm.stopped.detail")}),c==="vm-unavailable"&&(J&&It&&H.mode!=="pool"?e.jsxs("button",{onClick:()=>{At("vm-start")},disabled:E!==null,"aria-busy":E==="vm-start",className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[E==="vm-start"&&e.jsx(A,{size:13,className:"animate-spin"}),n(E==="vm-start"?"vm.setup.starting":"vm.setup.start")]}):J&&H?.mode==="per-bot"&&H.image&&H.create_supported?e.jsxs("button",{onClick:()=>{At(H.container==="missing"?"vm-create":"vm-recreate")},disabled:E!==null,className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(E==="vm-create"||E==="vm-recreate")&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),H.container==="missing"?n("computer.createVm",{name:r.name}):n("computer.replaceVm",{name:r.name})]}):e.jsx("button",{onClick:cn,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openVmSetup")})),c==="vm-unavailable"&&H?.capacity_limited&&e.jsx("p",{className:"text-[12px] text-ink-secondary",children:is("Máy ảo đã được tạo và đang dừng vì đã đủ số máy chạy cùng lúc. Dừng một máy khác rồi bấm Bật.","This desktop has been created and is stopped because the running limit is full. Stop another desktop, then start this one.")}),!Q&&un&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px]",children:n("computer.simple.needsSetup",{name:r.name})}),!pn&&!mn&&e.jsx("button",{type:"button",onClick:()=>vr(!0),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.simple.showAdvanced")})]}),Q&&U&&(c==="vps-unconfigured"||c==="vps-stopped")&&e.jsx("button",{onClick:dn,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openVpsSettings")}),pn&&e.jsxs("button",{onClick:()=>Tt("provision"),disabled:E==="provision",className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[E==="provision"&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),c==="vps-stopped"?n("computer.startVps"):n("computer.prepareVps")]}),mn&&e.jsxs("button",{onClick:()=>{ir()},disabled:E==="vps-replace",className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[E==="vps-replace"&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),n("computer.replaceVps")]})]})}),be&&!Mt&&e.jsx("div",{className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be}),(Yn||c==="unconfigured"&&re.action?.id==="add-boat-key")&&e.jsx("div",{"data-boat-key":!0,className:"mt-3 rounded-xl bg-card py-1.5",children:e.jsx(ls,{id:"box",via:"computer_panel",onSaved:t=>{Gn(!0),t&&ze(o=>o+1)}})}),Q&&c==="vps-unconfigured"&&e.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:n("computer.vpsAliasHint")}),e.jsx("button",{onClick:dn,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:n("computer.openVpsSettings")})]}),Q&&c==="vm"&&H?.mode==="per-bot"&&window.ogb?.desktopWorkspace&&i&&e.jsxs("button",{type:"button",onClick:()=>i(r.id),disabled:E!==null,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg border border-accent/30 bg-accent/10 py-2 text-[13px] font-medium text-ink hover:bg-accent/15 disabled:opacity-50",title:n("computer.twoDesktopsTitle"),children:[e.jsx(Ms,{size:14}),n("computer.twoDesktops")]}),de&&de.place!=="browser"&&on(lt&&!q.held?()=>c==="vm"||W?void ve():void sr("take"):void 0),(W||c==="vm"||we)&&q.held&&e.jsxs("div",{className:"mt-3 rounded-xl border border-accent/25 bg-accent/10 p-4",children:[e.jsxs("div",{className:"text-[13px] leading-relaxed text-ink",children:[n("computer.youHaveWheel"),W&&!ee&&` ${n(Q?"computer.useOpenDesktop":"computer.simple.useFullScreen")}`]}),e.jsxs("button",{onClick:()=>{ln()},disabled:ie||le.handingBack,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[e.jsx(Ye,{size:14}),n("computer.handBack")]})]}),Q&&c==="vm"&&(q.held||!lt)&&e.jsxs("button",{onClick:()=>{ve(q.held)},disabled:ie||!ee,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:q.held?n("computer.openLiveDesktop"):n("computer.takeControlTitle"),children:[ie?e.jsx(A,{size:14,className:"animate-spin"}):q.held?e.jsx(Je,{size:14}):e.jsx(Ye,{size:14}),n(q.held?"computer.fullScreen":"computer.takeControl")]}),Q&&J&&c==="vm"&&H?.mode==="per-bot"&&e.jsxs("button",{onClick:()=>{At("vm-delete")},disabled:E!==null||s.busy,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg border border-danger/30 py-2 text-[13px] text-danger hover:bg-danger/10 disabled:opacity-50",title:s.busy?n("computer.deleteVmBlocked"):n("computer.deleteVmTitle",{name:r.name}),children:[E==="vm-delete"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.deleteVm")]}),!Q&&(W||c==="vm")&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2","data-testid":"computer-actions",children:[!q.held&&!lt&&e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:ie||zt,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-50",title:n("computer.takeControlTitle"),children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Ye,{size:14}),n("computer.takeControl")]}),e.jsx(Qs,{held:q.held,frame:ge,name:r.name,onTakeControl:t=>{ve(t)},disabled:q.held&&zt,takeDisabled:ie||zt,error:be}),W&&Y&&(T==="vps"||Fe!=="archived")&&e.jsxs("button",{type:"button",onClick:()=>Tt("sleep"),disabled:E==="sleep"||s.busy,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.sleepTitle"),children:[E==="sleep"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(In,{size:14}),n("vm.cloud.sleep")]})]}),Q&&W&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[!q.held&&!lt&&e.jsxs("button",{onClick:()=>{ve()},disabled:ie||E==="join",className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.takeControlTitle"),children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Ye,{size:14}),n("computer.takeControl")]}),q.held&&e.jsxs("button",{onClick:()=>{ve(!0)},disabled:E==="join",className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):ee?e.jsx(Je,{size:14}):e.jsx(Me,{size:14}),n(ee?"computer.fullScreen":"computer.openLiveDesktop")]}),Y&&(T==="vps"||Fe!=="archived")&&e.jsxs("button",{onClick:()=>Tt("sleep"),disabled:E==="sleep"||s.busy,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.sleepTitle"),children:[E==="sleep"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(In,{size:14}),n("vm.cloud.sleep")]})]}),c!=="team-boat"&&(r.computer!==void 0||U)&&e.jsxs(e.Fragment,{children:[e.jsx(ra,{}),e.jsx(ia,{}),e.jsx(Ns,{}),e.jsx(la,{})]}),Q?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("computer.worksOn")}),e.jsx("p",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:n(u.config?.cloudHome?"computer.worksOnHintCloudHome":"computer.worksOnHint")}),e.jsx(As,{options:He,onSelect:gn}),w&&e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:n("place.pinnedNote",{place:n(Vt(w))})}),e.jsxs("div",{className:"mt-3 border-t border-hairline/40 pt-3 text-[12px] leading-5 text-ink-secondary","aria-live":"polite","data-testid":"place-line",children:[ct.line,qe(ct,"mt-1 block font-medium text-accent hover:underline")]}),s.computer==="cloud"&&e.jsx(Ln,{compact:!0,value:T,onChange:t=>Ie({cloudBackend:t})})]}),e.jsxs("button",{type:"button",onClick:()=>at("routines"),className:"mt-4 flex w-full items-start gap-3 rounded-xl bg-card p-4 text-left hover:bg-raised",children:[e.jsx(Tn,{size:17,className:"mt-0.5 shrink-0 text-accent"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"block text-[14px] font-medium text-ink",children:[n("computer.tab.routines")," ",e.jsx("span",{className:"ml-1 text-[11px] text-ink-secondary",children:nn.length})]}),e.jsx("span",{className:K("mt-1 block truncate text-[12px]",Ke?ds(Ke):"text-ink-secondary"),children:Ke?`${Ke.routineName} · ${cs(Ke)}`:n("computer.routines.openTitle")})]}),e.jsx(Ds,{size:14,className:"shrink-0 text-ink-secondary rtl:-scale-x-100","aria-hidden":"true"})]})]}):e.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4","data-testid":"where-works",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("computer.simple.whereWorks",{name:r.name})}),e.jsx("div",{role:"group","aria-label":n("computer.destinationAria"),className:"mt-3 grid grid-cols-3 gap-2",children:He.map(({mode:t,Icon:o,selected:l,disabled:b,unavailableTitle:z,simpleLabel:se,issue:ue,view:X})=>e.jsxs("button",{type:"button",disabled:b,title:z,"aria-pressed":l,onClick:()=>gn(t),className:K("flex min-w-0 flex-col items-center gap-1.5 rounded-lg border px-1.5 py-2.5 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",l?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",b?"cursor-not-allowed opacity-50":"hover:border-accent/40 hover:bg-control/60"),children:[e.jsx(o,{size:16,className:K("shrink-0",l?"text-accent":"text-ink-secondary"),"aria-hidden":"true"}),e.jsx("span",{className:"w-full truncate text-[12px] font-medium leading-4",children:se}),ue&&e.jsx("span",{className:"w-full truncate text-[11px] leading-3 text-ink-secondary",children:X.short})]},t??"auto"))}),e.jsxs("div",{className:"mt-3 text-[12px] leading-5 text-ink-secondary","data-testid":"place-line",children:[ct.line,qe(ct,"mt-1 block font-medium text-accent hover:underline")]}),Ot&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:n("place.pinnedNoteSimple",{place:He.find(({mode:t})=>t===Ot)?.simpleLabel??n(Vt(Ot))})}),e.jsx("button",{type:"button",disabled:!!r.busy,title:r.busy?n("place.busy"):void 0,onClick:xr,className:"shrink-0 rounded-md px-2 py-0.5 text-[12px] font-medium leading-5 text-accent-text transition-colors hover:bg-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:bg-transparent","data-testid":"place-unpin",children:n("place.unpinSimple",{place:He.find(({selected:t})=>t)?.simpleLabel??n(Vt(s.computer??"auto"))})})]}),un&&e.jsx(Ks,{bot:r,backend:T,onBackend:t=>Ie({cloudBackend:t}),onAutoStart:()=>m({type:"updateBot",botId:r.id,patch:{autoStartVps:!r.autoStartVps}})})]})]})]}),e.jsx(us,{open:Kt!==null,onCancel:()=>gt(null),onConfirm:()=>{const t=Kt;gt(null),t&&(t===r.id&&(ne(null),N("checking")),m({type:"updateBot",botId:t,patch:{computer:"local",acknowledgeLocalAuto:!0}}))}})]})}export{Oa as ComputerPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as m,j as h}from"./styles-DO3EUxm2.js";import{x as M}from"./App-26INIo6C.js";const H="limix.settings.size",R=640,W=460,y=()=>typeof window<"u"&&window.innerWidth>=768;function b(n,o,l,p,c){const u=Math.max(1,window.innerWidth-p),s=Math.max(1,window.innerHeight-c);n.style.width=`${Math.round(Math.min(Math.max(o,R),u))}px`,n.style.height=`${Math.round(Math.min(Math.max(l,W),s))}px`}function v(n,o){n.style.width="",n.style.height="";try{window.localStorage.removeItem(o)}catch{}}const S=[{sx:1,sy:0,cls:"right-0 top-4 bottom-4 w-1.5",cursor:"cursor-ew-resize"},{sx:-1,sy:0,cls:"left-0 top-4 bottom-4 w-1.5",cursor:"cursor-ew-resize"},{sx:0,sy:1,cls:"bottom-0 left-4 right-4 h-1.5",cursor:"cursor-ns-resize"},{sx:0,sy:-1,cls:"top-0 left-4 right-4 h-1.5",cursor:"cursor-ns-resize"},{sx:1,sy:1,cls:"bottom-0 right-0 h-4 w-4",cursor:"cursor-nwse-resize"},{sx:-1,sy:1,cls:"bottom-0 left-0 h-4 w-4",cursor:"cursor-nesw-resize"}];function C({storageKey:n=H,widthInset:o=32,heightInset:l=96,showGrip:p=!1}={}){const c=m.useRef(null),u=m.useRef(null),s=m.useRef(null),z=M("Kéo để đổi kích thước (bấm đúp để đặt lại)","Drag to resize (double-click to reset)"),E=t=>{s.current={w:t.offsetWidth,h:t.offsetHeight};try{window.localStorage.setItem(n,JSON.stringify(s.current))}catch{}};m.useEffect(()=>{const t=c.current?.parentElement;if(!t)return;t.style.maxWidth="100%",t.style.maxHeight="100%",s.current=null;try{const e=JSON.parse(window.localStorage.getItem(n)??"null");e&&typeof e.w=="number"&&Number.isFinite(e.w)&&typeof e.h=="number"&&Number.isFinite(e.h)&&(s.current={w:e.w,h:e.h})}catch{}const r=()=>{const e=s.current;y()&&e?b(t,e.w,e.h,o,l):(t.style.width="",t.style.height="")};return r(),window.addEventListener("resize",r),()=>{u.current?.abort(),window.removeEventListener("resize",r)}},[n,o,l]);const k=t=>r=>{const e=c.current?.parentElement;if(!e||!y()||r.button!==0)return;r.preventDefault(),u.current?.abort();const i=new AbortController;u.current=i;const f=r.clientX,w=r.clientY,L=e.offsetWidth,N=e.offsetHeight,j=a=>{a.pointerId===r.pointerId&&b(e,L+t.sx*(a.clientX-f)*2,N+t.sy*(a.clientY-w)*2,o,l)},g=()=>{i.abort(),u.current=null,y()&&E(e)},D=a=>{a.pointerId===r.pointerId&&g()},d={signal:i.signal};window.addEventListener("pointermove",j,d),window.addEventListener("pointerup",D,d),window.addEventListener("pointercancel",D,d),window.addEventListener("blur",g,d)},x=()=>{const t=c.current?.parentElement;s.current=null,t&&v(t,n)};return h.jsx("span",{ref:c,className:"contents",children:S.map(t=>p&&t.sx===1&&t.sy===1?h.jsx("button",{type:"button",title:z,"aria-label":M("Đổi kích thước cửa sổ bằng phím mũi tên. Enter để đặt lại.","Resize with arrow keys. Press Enter to reset."),className:"absolute bottom-1 right-1 z-20 hidden size-5 cursor-nwse-resize touch-none items-center justify-center rounded text-ink-secondary hover:text-ink focus-visible:outline-2 focus-visible:outline-accent md:flex",onPointerDown:k(t),onDoubleClick:x,onKeyDown:r=>{const e=c.current?.parentElement;if(!e)return;if(r.key==="Enter"||r.key===" "){r.preventDefault(),x();return}const i=32,f=r.key==="ArrowRight"?i:r.key==="ArrowLeft"?-i:0,w=r.key==="ArrowDown"?i:r.key==="ArrowUp"?-i:0;!f&&!w||(r.preventDefault(),b(e,e.offsetWidth+f,e.offsetHeight+w,o,l),E(e))},children:h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:h.jsx("path",{d:"M3 10 10 3m-3 7 3-3",stroke:"currentColor",strokeLinecap:"round"})})},"grip"):h.jsx("span",{"aria-hidden":"true",title:z,className:`absolute z-20 hidden touch-none md:block ${t.cls} ${t.cursor}`,onPointerDown:k(t),onDoubleClick:x},`${t.sx}${t.sy}`))})}export{C as L};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as t,t as n}from"./styles-DO3EUxm2.js";import{r as c}from"./PlacesRail-tZyNm-l3.js";import{y as x,z as p,Q as m,D as u}from"./App-26INIo6C.js";import"./monitor-zecPzfR5.js";import"./index-C7YXnZFx.js";import"./MenuMotion-B0aZnuh_.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};
|