@hienlh/ppm 0.26.40 → 0.26.41
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/CHANGELOG.md +9 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{accounts-settings-section-CYAzO8P_.js → accounts-settings-section-DQ63-z3j.js} +1 -1
- package/dist/web/assets/accounts-settings-section-DQ63-z3j.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-DQ63-z3j.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-CWTAtKRy.js → agent-session-sheet-B_UZE28a.js} +2 -2
- package/dist/web/assets/agent-session-sheet-B_UZE28a.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-B_UZE28a.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-Cocw6_8x.js → agent-session-window-content-CaFQViPK.js} +1 -1
- package/dist/web/assets/agent-session-window-content-CaFQViPK.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-CaFQViPK.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-51Du3QdU.js → ai-resource-editor-7vq5Se1D.js} +1 -1
- package/dist/web/assets/ai-resource-editor-7vq5Se1D.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-7vq5Se1D.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-D4KGFwFa.js → ai-settings-section-V0gc3BHi.js} +1 -1
- package/dist/web/assets/ai-settings-section-V0gc3BHi.js.br +0 -0
- package/dist/web/assets/ai-settings-section-V0gc3BHi.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-CFeGL_Ml.js → ai-settings-section-hKF3ynbM.js} +1 -1
- package/dist/web/assets/ai-settings-section-hKF3ynbM.js.br +0 -0
- package/dist/web/assets/ai-settings-section-hKF3ynbM.js.gz +0 -0
- package/dist/web/assets/{android-tab-te-hb90I.js → android-tab-DvyizBxM.js} +1 -1
- package/dist/web/assets/android-tab-DvyizBxM.js.br +0 -0
- package/dist/web/assets/android-tab-DvyizBxM.js.gz +0 -0
- package/dist/web/assets/{antigravity-usage-view-Cg38r4bw.js → antigravity-usage-view-BXUaYGNj.js} +1 -1
- package/dist/web/assets/antigravity-usage-view-BXUaYGNj.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-BXUaYGNj.js.gz +0 -0
- package/dist/web/assets/{appearance-settings-section-D9gSM7St.js → appearance-settings-section-DbL1iD0c.js} +1 -1
- package/dist/web/assets/appearance-settings-section-DbL1iD0c.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-DbL1iD0c.js.gz +0 -0
- package/dist/web/assets/{apps-panel-DIDF_Cad.js → apps-panel-g9Cdmx1R.js} +1 -1
- package/dist/web/assets/apps-panel-g9Cdmx1R.js.br +0 -0
- package/dist/web/assets/apps-panel-g9Cdmx1R.js.gz +0 -0
- package/dist/web/assets/{assistant-settings-section-95nrmmY9.js → assistant-settings-section-td2Bmpbb.js} +1 -1
- package/dist/web/assets/assistant-settings-section-td2Bmpbb.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-td2Bmpbb.js.gz +0 -0
- package/dist/web/assets/{assistant-tab-C8A-USZ4.js → assistant-tab-BOo4NPmN.js} +1 -1
- package/dist/web/assets/assistant-tab-BOo4NPmN.js.br +0 -0
- package/dist/web/assets/assistant-tab-BOo4NPmN.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-Cus3OCqZ.js → branch-review-tab-DuAdJEgW.js} +1 -1
- package/dist/web/assets/branch-review-tab-DuAdJEgW.js.br +0 -0
- package/dist/web/assets/branch-review-tab-DuAdJEgW.js.gz +0 -0
- package/dist/web/assets/{chat-tab-E41O8v4F.js → chat-tab-DGSG1nim.js} +1 -1
- package/dist/web/assets/chat-tab-DGSG1nim.js.br +0 -0
- package/dist/web/assets/chat-tab-DGSG1nim.js.gz +0 -0
- package/dist/web/assets/{chat-tab-CmN92HnI.js → chat-tab-cTdIFhvy.js} +3 -3
- package/dist/web/assets/chat-tab-cTdIFhvy.js.br +0 -0
- package/dist/web/assets/chat-tab-cTdIFhvy.js.gz +0 -0
- package/dist/web/assets/{code-editor-Du6G-GMG.js → code-editor-CMpzD-I7.js} +4 -4
- package/dist/web/assets/code-editor-CMpzD-I7.js.br +0 -0
- package/dist/web/assets/code-editor-CMpzD-I7.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-D5D-H60J.js → conflict-editor-BL11j1ee.js} +1 -1
- package/dist/web/assets/conflict-editor-BL11j1ee.js.br +0 -0
- package/dist/web/assets/conflict-editor-BL11j1ee.js.gz +0 -0
- package/dist/web/assets/{connection-form-tab-CnYCTqZJ.js → connection-form-tab-ZIHgNydL.js} +1 -1
- package/dist/web/assets/connection-form-tab-ZIHgNydL.js.br +0 -0
- package/dist/web/assets/{connection-form-tab-CnYCTqZJ.js.gz → connection-form-tab-ZIHgNydL.js.gz} +0 -0
- package/dist/web/assets/{csv-preview-DmhNmXQM.js → csv-preview-DygPsrM9.js} +1 -1
- package/dist/web/assets/csv-preview-DygPsrM9.js.br +0 -0
- package/dist/web/assets/csv-preview-DygPsrM9.js.gz +0 -0
- package/dist/web/assets/{database-drivers-section-DAv805sj.js → database-drivers-section-1P05jOJS.js} +1 -1
- package/dist/web/assets/database-drivers-section-1P05jOJS.js.br +0 -0
- package/dist/web/assets/database-drivers-section-1P05jOJS.js.gz +0 -0
- package/dist/web/assets/{db-tab-parts-ilPoLqK4.js → db-tab-parts-CPweACc-.js} +1 -1
- package/dist/web/assets/db-tab-parts-CPweACc-.js.br +0 -0
- package/dist/web/assets/db-tab-parts-CPweACc-.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-CXmavf1P.js → design-settings-section-B13YpuJ0.js} +1 -1
- package/dist/web/assets/design-settings-section-B13YpuJ0.js.br +0 -0
- package/dist/web/assets/design-settings-section-B13YpuJ0.js.gz +0 -0
- package/dist/web/assets/{design-tab-BIA3YsxM.js → design-tab-DjP31-ys.js} +1 -1
- package/dist/web/assets/design-tab-DjP31-ys.js.br +0 -0
- package/dist/web/assets/design-tab-DjP31-ys.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-CCXtOoYS.js → designs-sidebar-panel-BOa2pnl1.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-BOa2pnl1.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BOa2pnl1.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-DWR3b9JC.js → diff-viewer-avrNPfrj.js} +1 -1
- package/dist/web/assets/diff-viewer-avrNPfrj.js.br +0 -0
- package/dist/web/assets/diff-viewer-avrNPfrj.js.gz +0 -0
- package/dist/web/assets/{docx-preview-1ZRhA5Q1.js → docx-preview-Bt-Nm-9S.js} +1 -1
- package/dist/web/assets/docx-preview-Bt-Nm-9S.js.br +0 -0
- package/dist/web/assets/docx-preview-Bt-Nm-9S.js.gz +0 -0
- package/dist/web/assets/{editor-dialog-CQYKBCA5.js → editor-dialog-Bl5fkjzW.js} +1 -1
- package/dist/web/assets/editor-dialog-Bl5fkjzW.js.br +0 -0
- package/dist/web/assets/editor-dialog-Bl5fkjzW.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-B8KyKiA8.js → editor-language-service-DIpL_WlY.js} +1 -1
- package/dist/web/assets/editor-language-service-DIpL_WlY.js.br +0 -0
- package/dist/web/assets/editor-language-service-DIpL_WlY.js.gz +0 -0
- package/dist/web/assets/{explorer-body-DKBJxWpH.js → explorer-body-DZx0_utr.js} +1 -1
- package/dist/web/assets/explorer-body-DZx0_utr.js.br +0 -0
- package/dist/web/assets/explorer-body-DZx0_utr.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-BswqMaRj.js → explorer-window-content-rQIQsbaL.js} +1 -1
- package/dist/web/assets/explorer-window-content-rQIQsbaL.js.br +0 -0
- package/dist/web/assets/explorer-window-content-rQIQsbaL.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-BjBIjLwN.js → extension-manager-section-BNVrSI8U.js} +1 -1
- package/dist/web/assets/extension-manager-section-BNVrSI8U.js.br +0 -0
- package/dist/web/assets/extension-manager-section-BNVrSI8U.js.gz +0 -0
- package/dist/web/assets/{extension-webview-BO02qaCn.js → extension-webview-CkF7DEDh.js} +1 -1
- package/dist/web/assets/extension-webview-CkF7DEDh.js.br +0 -0
- package/dist/web/assets/extension-webview-CkF7DEDh.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-DftcCs-h.js → files-settings-section-CMT9bJYE.js} +1 -1
- package/dist/web/assets/files-settings-section-CMT9bJYE.js.br +0 -0
- package/dist/web/assets/files-settings-section-CMT9bJYE.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-BEcR5F2b.js → general-settings-section-DoBDWvVA.js} +1 -1
- package/dist/web/assets/general-settings-section-DoBDWvVA.js.br +0 -0
- package/dist/web/assets/general-settings-section-DoBDWvVA.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-CUbhrVwA.js → git-log-panel-CEEN0Hl8.js} +1 -1
- package/dist/web/assets/git-log-panel-CEEN0Hl8.js.br +0 -0
- package/dist/web/assets/git-log-panel-CEEN0Hl8.js.gz +0 -0
- package/dist/web/assets/{git-review-tab-DRA61b2t.js → git-review-tab-CxVKLu-M.js} +1 -1
- package/dist/web/assets/git-review-tab-CxVKLu-M.js.br +0 -0
- package/dist/web/assets/git-review-tab-CxVKLu-M.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-BvF1Wd7y.js → glide-data-grid-C0yMf2WR.js} +1 -1
- package/dist/web/assets/glide-data-grid-C0yMf2WR.js.br +0 -0
- package/dist/web/assets/glide-data-grid-C0yMf2WR.js.gz +0 -0
- package/dist/web/assets/{grid-save-dialog-CjB9VLio.js → grid-save-dialog-B5_4eJa1.js} +1 -1
- package/dist/web/assets/grid-save-dialog-B5_4eJa1.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-B5_4eJa1.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-BGgi1b56.js → group-chat-tab--_N-9ZKm.js} +1 -1
- package/dist/web/assets/group-chat-tab--_N-9ZKm.js.br +0 -0
- package/dist/web/assets/group-chat-tab--_N-9ZKm.js.gz +0 -0
- package/dist/web/assets/{impexp-tab-C4O4SxSd.js → impexp-tab-84l4S5fB.js} +1 -1
- package/dist/web/assets/impexp-tab-84l4S5fB.js.br +0 -0
- package/dist/web/assets/impexp-tab-84l4S5fB.js.gz +0 -0
- package/dist/web/assets/{index-4hOd9rdZ.js → index-CToe9paM.js} +5 -5
- package/dist/web/assets/index-CToe9paM.js.br +0 -0
- package/dist/web/assets/index-CToe9paM.js.gz +0 -0
- package/dist/web/assets/index-D1toZxbF.css +1 -0
- package/dist/web/assets/index-D1toZxbF.css.br +0 -0
- package/dist/web/assets/index-D1toZxbF.css.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-M1hmdiOL.js → jira-watcher-section-DLOy5seB.js} +1 -1
- package/dist/web/assets/{keybindings-store-BLZSALPI.js → keybindings-store-LqldhMUV.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-CQzLAxpQ.js → keyboard-shortcuts-section-BU-fDxXe.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-BU-fDxXe.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-BU-fDxXe.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-DGuUwGd9.js → language-servers-section-RJDv8RC7.js} +2 -2
- package/dist/web/assets/language-servers-section-RJDv8RC7.js.br +0 -0
- package/dist/web/assets/language-servers-section-RJDv8RC7.js.gz +0 -0
- package/dist/web/assets/{logs-app-WZfVMFzz.js → logs-app-B3CiUaZo.js} +1 -1
- package/dist/web/assets/logs-app-B3CiUaZo.js.br +0 -0
- package/dist/web/assets/logs-app-B3CiUaZo.js.gz +0 -0
- package/dist/web/assets/{logs-tab-DqquSLgW.js → logs-tab-mAggf0I1.js} +1 -1
- package/dist/web/assets/{logs-window-content-BNlAfunB.js → logs-window-content-Byp_UkCH.js} +1 -1
- package/dist/web/assets/{lsp-client-D_CidQV4.js → lsp-client-CLe53SLT.js} +1 -1
- package/dist/web/assets/lsp-client-CLe53SLT.js.br +0 -0
- package/dist/web/assets/lsp-client-CLe53SLT.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-Dxw3fmMg.js → markdown-renderer-CjBb-9-Y.js} +1 -1
- package/dist/web/assets/markdown-renderer-CjBb-9-Y.js.br +0 -0
- package/dist/web/assets/markdown-renderer-CjBb-9-Y.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-Bqj9_EwG.js → markdown-renderer-DYZv454R.js} +1 -1
- package/dist/web/assets/markdown-renderer-DYZv454R.js.br +0 -0
- package/dist/web/assets/markdown-renderer-DYZv454R.js.gz +0 -0
- package/dist/web/assets/{mobile-explorer-sheet-M6n7jBUM.js → mobile-explorer-sheet-BqGwUNhS.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-BqGwUNhS.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-BqGwUNhS.js.gz +0 -0
- package/dist/web/assets/{monaco-diff-editor-CT6uDE_q.js → monaco-diff-editor--qXfeWZN.js} +1 -1
- package/dist/web/assets/{new-design-dialog-BujIaJpE.js → new-design-dialog-CtKXkYuy.js} +1 -1
- package/dist/web/assets/new-design-dialog-CtKXkYuy.js.br +0 -0
- package/dist/web/assets/new-design-dialog-CtKXkYuy.js.gz +0 -0
- package/dist/web/assets/{notifications-settings-section-_UHI0jP-.js → notifications-settings-section-DX5xQuXT.js} +1 -1
- package/dist/web/assets/notifications-settings-section-DX5xQuXT.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-DX5xQuXT.js.gz +0 -0
- package/dist/web/assets/{onboarding-entry-B0dLGixW.js → onboarding-entry-CTeUblCQ.js} +1 -1
- package/dist/web/assets/onboarding-entry-CTeUblCQ.js.br +0 -0
- package/dist/web/assets/onboarding-entry-CTeUblCQ.js.gz +0 -0
- package/dist/web/assets/{open-manager-chat-ys3Mntw6.js → open-manager-chat-CJjHfOJa.js} +1 -1
- package/dist/web/assets/open-manager-chat-CJjHfOJa.js.br +0 -0
- package/dist/web/assets/open-manager-chat-CJjHfOJa.js.gz +0 -0
- package/dist/web/assets/{open-manager-chat-BmqzsCHn.js → open-manager-chat-D8ezNjyv.js} +1 -1
- package/dist/web/assets/open-manager-chat-D8ezNjyv.js.br +0 -0
- package/dist/web/assets/open-manager-chat-D8ezNjyv.js.gz +0 -0
- package/dist/web/assets/{problems-panel-gw4v5rlS.js → problems-panel-GqJ_ZBjK.js} +1 -1
- package/dist/web/assets/problems-panel-GqJ_ZBjK.js.br +0 -0
- package/dist/web/assets/problems-panel-GqJ_ZBjK.js.gz +0 -0
- package/dist/web/assets/{process-table-DcdpMd-n.js → process-table-BsYgs4j7.js} +1 -1
- package/dist/web/assets/process-table-BsYgs4j7.js.br +0 -0
- package/dist/web/assets/process-table-BsYgs4j7.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-Dn82m_AD.js → proxy-settings-section-D0VAC8yd.js} +1 -1
- package/dist/web/assets/proxy-settings-section-D0VAC8yd.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-D0VAC8yd.js.gz +0 -0
- package/dist/web/assets/{query-tab-CFxg5WOu.js → query-tab-8ygY98D5.js} +1 -1
- package/dist/web/assets/query-tab-8ygY98D5.js.br +0 -0
- package/dist/web/assets/query-tab-8ygY98D5.js.gz +0 -0
- package/dist/web/assets/{release-notes-window-content-D6O1nIRW.js → release-notes-window-content-D_dO3Pjk.js} +1 -1
- package/dist/web/assets/{remembered-approvals-section-CBcd7DO-.js → remembered-approvals-section-0BSREd9X.js} +1 -1
- package/dist/web/assets/remembered-approvals-section-0BSREd9X.js.br +0 -0
- package/dist/web/assets/remembered-approvals-section-0BSREd9X.js.gz +0 -0
- package/dist/web/assets/{remote-access-settings-section-CY8JHgx3.js → remote-access-settings-section-C45YSmLE.js} +1 -1
- package/dist/web/assets/remote-access-settings-section-C45YSmLE.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-C45YSmLE.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-BI0fR6VN.js → remote-desktop-clipboard-notice-DiszI66Q.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-DiszI66Q.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-DiszI66Q.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-iFYUAFfB.js → remote-desktop-mobile-sheet-BAQO7eaT.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-BAQO7eaT.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BAQO7eaT.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-CZPo5zD9.js → remote-desktop-mobile-view-Clkko7So.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-Clkko7So.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-Clkko7So.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CgE2Rxsr.js +1 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CgE2Rxsr.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CgE2Rxsr.js.gz +0 -0
- package/dist/web/assets/remote-desktop-settings-section-CjOzlNg4.js +1 -0
- package/dist/web/assets/remote-desktop-settings-section-CjOzlNg4.js.br +0 -0
- package/dist/web/assets/remote-desktop-settings-section-CjOzlNg4.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-CkC7aaxg.js → remote-desktop-window-content-Ck8Jle_R.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-Ck8Jle_R.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-Ck8Jle_R.js.gz +0 -0
- package/dist/web/assets/{rename-object-dialog-0CIErjrH.js → rename-object-dialog-eeQ3Ry3F.js} +1 -1
- package/dist/web/assets/rename-object-dialog-eeQ3Ry3F.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-eeQ3Ry3F.js.gz +0 -0
- package/dist/web/assets/{reveal-task-in-sidebar-CoKBziVv.js → reveal-task-in-sidebar-DbDQfS5L.js} +1 -1
- package/dist/web/assets/{review-address-setup-BfTlQWmO.js → review-address-setup-BIMTMFOp.js} +1 -1
- package/dist/web/assets/review-address-setup-BIMTMFOp.js.br +0 -0
- package/dist/web/assets/review-address-setup-BIMTMFOp.js.gz +0 -0
- package/dist/web/assets/{review-code-Bdvn0HTV.js → review-code-DhZOgNP_.js} +1 -1
- package/dist/web/assets/review-code-DhZOgNP_.js.br +0 -0
- package/dist/web/assets/review-code-DhZOgNP_.js.gz +0 -0
- package/dist/web/assets/{save-as-dialog-Ca1l4sTn.js → save-as-dialog-BxuXI-0b.js} +1 -1
- package/dist/web/assets/save-as-dialog-BxuXI-0b.js.br +0 -0
- package/dist/web/assets/save-as-dialog-BxuXI-0b.js.gz +0 -0
- package/dist/web/assets/{schedule-form-DLswvU_a.js → schedule-form-DDgcBzJB.js} +3 -3
- package/dist/web/assets/schedule-form-DDgcBzJB.js.br +0 -0
- package/dist/web/assets/schedule-form-DDgcBzJB.js.gz +0 -0
- package/dist/web/assets/{schedule-script-editor-CchIkvQF.js → schedule-script-editor-rFq5PB24.js} +1 -1
- package/dist/web/assets/schedule-script-editor-rFq5PB24.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-rFq5PB24.js.gz +0 -0
- package/dist/web/assets/{schedules-app-BJYAorq7.js → schedules-app-BrkzKe8d.js} +1 -1
- package/dist/web/assets/schedules-app-BrkzKe8d.js.br +0 -0
- package/dist/web/assets/schedules-app-BrkzKe8d.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-BpbxA54S.js → schedules-settings-section-P801rm0Q.js} +3 -3
- package/dist/web/assets/schedules-settings-section-P801rm0Q.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-P801rm0Q.js.gz +0 -0
- package/dist/web/assets/{schedules-tab-Cd7jVBi3.js → schedules-tab-BnneDXN3.js} +1 -1
- package/dist/web/assets/schedules-tab-BnneDXN3.js.br +0 -0
- package/dist/web/assets/schedules-tab-BnneDXN3.js.gz +0 -0
- package/dist/web/assets/{schedules-ui-sEV5fwQj.js → schedules-ui-DnovuUgI.js} +1 -1
- package/dist/web/assets/schedules-ui-DnovuUgI.js.br +0 -0
- package/dist/web/assets/schedules-ui-DnovuUgI.js.gz +0 -0
- package/dist/web/assets/{schedules-window-content-D2Cs6VnK.js → schedules-window-content-D86LTMtU.js} +1 -1
- package/dist/web/assets/schedules-window-content-D86LTMtU.js.br +0 -0
- package/dist/web/assets/schedules-window-content-D86LTMtU.js.gz +0 -0
- package/dist/web/assets/{session-review-tab-D4Q5RO4O.js → session-review-tab-N7N3m5Ia.js} +1 -1
- package/dist/web/assets/session-review-tab-N7N3m5Ia.js.br +0 -0
- package/dist/web/assets/session-review-tab-N7N3m5Ia.js.gz +0 -0
- package/dist/web/assets/{settings-body-B0GEhsL0.js → settings-body-DXgWdp5L.js} +1 -1
- package/dist/web/assets/settings-body-DXgWdp5L.js.br +0 -0
- package/dist/web/assets/settings-body-DXgWdp5L.js.gz +0 -0
- package/dist/web/assets/{settings-rows-Ypj7sR8g.js → settings-rows-BnbnE7yp.js} +1 -1
- package/dist/web/assets/settings-rows-BnbnE7yp.js.br +0 -0
- package/dist/web/assets/settings-rows-BnbnE7yp.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-CbZgAjZp.js → settings-section-content-BvGekMGG.js} +2 -2
- package/dist/web/assets/settings-section-content-BvGekMGG.js.br +0 -0
- package/dist/web/assets/settings-section-content-BvGekMGG.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-CAnG6Wl5.js → settings-section-content-Sv2MuwGP.js} +1 -1
- package/dist/web/assets/{settings-tab-BGl42sPS.js → settings-tab-X2U8nwEA.js} +1 -1
- package/dist/web/assets/{settings-window-content-TPnDxfrh.js → settings-window-content-3Z7vlcY0.js} +1 -1
- package/dist/web/assets/{sql-object-tab-B22poBWQ.js → sql-object-tab-Cxtq4UUD.js} +1 -1
- package/dist/web/assets/sql-object-tab-Cxtq4UUD.js.br +0 -0
- package/dist/web/assets/sql-object-tab-Cxtq4UUD.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-YW9FzgCn.js → sqlite-viewer-In2COXL1.js} +1 -1
- package/dist/web/assets/sqlite-viewer-In2COXL1.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-In2COXL1.js.gz +0 -0
- package/dist/web/assets/{storage-settings-section-BZVjdPac.js → storage-settings-section-D5Z66RLa.js} +1 -1
- package/dist/web/assets/storage-settings-section-D5Z66RLa.js.br +0 -0
- package/dist/web/assets/storage-settings-section-D5Z66RLa.js.gz +0 -0
- package/dist/web/assets/{structure-save-dialog-CdQgJuij.js → structure-save-dialog-BpgXx5bc.js} +1 -1
- package/dist/web/assets/structure-save-dialog-BpgXx5bc.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-BpgXx5bc.js.gz +0 -0
- package/dist/web/assets/{structure-tab-BRYP8X7D.js → structure-tab-CrKg4mZv.js} +1 -1
- package/dist/web/assets/structure-tab-CrKg4mZv.js.br +0 -0
- package/dist/web/assets/structure-tab-CrKg4mZv.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-CcteBEma.js → system-monitor-body-BMOHavU-.js} +2 -2
- package/dist/web/assets/system-monitor-body-BMOHavU-.js.br +0 -0
- package/dist/web/assets/system-monitor-body-BMOHavU-.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-DyYR1M2F.js → system-monitor-tab-CdabSuCr.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-BLOE7pWQ.js → system-monitor-window-content-BPpT2gHn.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-BZuhqAnf.js → tab-host-window-content-C-IzedFd.js} +1 -1
- package/dist/web/assets/tab-host-window-content-C-IzedFd.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-C-IzedFd.js.gz +0 -0
- package/dist/web/assets/{table-tab-x8ljbNIU.js → table-tab-BgMLAJSd.js} +1 -1
- package/dist/web/assets/table-tab-BgMLAJSd.js.br +0 -0
- package/dist/web/assets/table-tab-BgMLAJSd.js.gz +0 -0
- package/dist/web/assets/{task-detail-mobile-BiyzO2PQ.js → task-detail-mobile-Dj4SwbIb.js} +1 -1
- package/dist/web/assets/task-detail-mobile-Dj4SwbIb.js.br +0 -0
- package/dist/web/assets/task-detail-mobile-Dj4SwbIb.js.gz +0 -0
- package/dist/web/assets/{task-sheet-_diq5iFA.js → task-sheet-DbrpZJYk.js} +1 -1
- package/dist/web/assets/task-sheet-DbrpZJYk.js.br +0 -0
- package/dist/web/assets/task-sheet-DbrpZJYk.js.gz +0 -0
- package/dist/web/assets/{task-status-grid-iSNPKi5R.js → task-status-grid-CDB-h0MQ.js} +1 -1
- package/dist/web/assets/task-status-grid-CDB-h0MQ.js.br +0 -0
- package/dist/web/assets/task-status-grid-CDB-h0MQ.js.gz +0 -0
- package/dist/web/assets/{task-tab-D3FxaT5N.js → task-tab-0ZayP3eM.js} +1 -1
- package/dist/web/assets/task-tab-0ZayP3eM.js.br +0 -0
- package/dist/web/assets/task-tab-0ZayP3eM.js.gz +0 -0
- package/dist/web/assets/{tasks-sidebar-panel-R6pIm7Jg.js → tasks-sidebar-panel-CoytCObb.js} +1 -1
- package/dist/web/assets/tasks-sidebar-panel-CoytCObb.js.br +0 -0
- package/dist/web/assets/{tasks-sidebar-panel-R6pIm7Jg.js.gz → tasks-sidebar-panel-CoytCObb.js.gz} +0 -0
- package/dist/web/assets/{telegram-bot-token-field-DYRVI-4i.js → telegram-bot-token-field-D_Du0TCV.js} +1 -1
- package/dist/web/assets/telegram-bot-token-field-D_Du0TCV.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-D_Du0TCV.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-BolwiWu6.js → terminal-tab-U1TCm4sd.js} +1 -1
- package/dist/web/assets/terminal-tab-U1TCm4sd.js.br +0 -0
- package/dist/web/assets/terminal-tab-U1TCm4sd.js.gz +0 -0
- package/dist/web/assets/{tool-cards-UUoPFqMm.js → tool-cards-C6d2_kWx.js} +3 -3
- package/dist/web/assets/tool-cards-C6d2_kWx.js.br +0 -0
- package/dist/web/assets/tool-cards-C6d2_kWx.js.gz +0 -0
- package/dist/web/assets/{tools-settings-section-DDqE038F.js → tools-settings-section-Bny7pj0V.js} +1 -1
- package/dist/web/assets/tools-settings-section-Bny7pj0V.js.br +0 -0
- package/dist/web/assets/tools-settings-section-Bny7pj0V.js.gz +0 -0
- package/dist/web/assets/{use-db-read-Ba5l6MGg.js → use-db-read-DHbwHptB.js} +1 -1
- package/dist/web/assets/use-db-read-DHbwHptB.js.br +0 -0
- package/dist/web/assets/use-db-read-DHbwHptB.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-L6O_fqFr.js → use-inline-blame-DQnI-NzL.js} +1 -1
- package/dist/web/assets/use-inline-blame-DQnI-NzL.js.br +0 -0
- package/dist/web/assets/use-inline-blame-DQnI-NzL.js.gz +0 -0
- package/dist/web/assets/{use-lsp-B1TMEIl6.js → use-lsp-DHvpQJL1.js} +1 -1
- package/dist/web/assets/use-lsp-DHvpQJL1.js.br +0 -0
- package/dist/web/assets/use-lsp-DHvpQJL1.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-DngIHm88.js → use-monaco-theme-B5TdBov8.js} +1 -1
- package/dist/web/assets/{use-process-kill-6oqUFZee.js → use-process-kill-DsqIf76y.js} +1 -1
- package/dist/web/assets/use-process-kill-DsqIf76y.js.br +0 -0
- package/dist/web/assets/use-process-kill-DsqIf76y.js.gz +0 -0
- package/dist/web/assets/{use-sql-schema-info-CgtNS3Mm.js → use-sql-schema-info-LzVYkqlF.js} +1 -1
- package/dist/web/assets/use-sql-schema-info-LzVYkqlF.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-LzVYkqlF.js.gz +0 -0
- package/dist/web/assets/{use-websocket-CfdMnGFz.js → use-websocket-DXx2DGA6.js} +1 -1
- package/dist/web/assets/{vault-settings-section-CEZOMLcO.js → vault-settings-section-fr4abgU9.js} +1 -1
- package/dist/web/assets/vault-settings-section-fr4abgU9.js.br +0 -0
- package/dist/web/assets/vault-settings-section-fr4abgU9.js.gz +0 -0
- package/dist/web/assets/{voice-settings-section-CXyszRjL.js → voice-settings-section-BU-LKUBY.js} +1 -1
- package/dist/web/assets/voice-settings-section-BU-LKUBY.js.br +0 -0
- package/dist/web/assets/voice-settings-section-BU-LKUBY.js.gz +0 -0
- package/dist/web/assets/{web-browser-settings-section-B4QgwZvJ.js → web-browser-settings-section-BlToGssQ.js} +1 -1
- package/dist/web/assets/web-browser-settings-section-BlToGssQ.js.br +0 -0
- package/dist/web/assets/web-browser-settings-section-BlToGssQ.js.gz +0 -0
- package/dist/web/assets/{web-browser-tab-BqOc1LMD.js → web-browser-tab-qT2WWIq9.js} +1 -1
- package/dist/web/assets/{web-browser-view-DmSWTErd.js → web-browser-view-B-gt8lOz.js} +1 -1
- package/dist/web/assets/web-browser-view-B-gt8lOz.js.br +0 -0
- package/dist/web/assets/web-browser-view-B-gt8lOz.js.gz +0 -0
- package/dist/web/assets/{web-browser-window-content-J8x5p4Qd.js → web-browser-window-content-Dyr3cLTJ.js} +1 -1
- package/dist/web/assets/{web-preview-tab-BovA5aEw.js → web-preview-tab-O1XY_OOx.js} +1 -1
- package/dist/web/assets/web-preview-tab-O1XY_OOx.js.br +0 -0
- package/dist/web/assets/web-preview-tab-O1XY_OOx.js.gz +0 -0
- package/dist/web/assets/{xlsx-preview-5vAG0Bbj.js → xlsx-preview-ssJ6l4xo.js} +1 -1
- package/dist/web/assets/xlsx-preview-ssJ6l4xo.js.br +0 -0
- package/dist/web/assets/xlsx-preview-ssJ6l4xo.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/sw.js +1 -1
- package/dist/web/sw.js.br +0 -0
- package/dist/web/sw.js.gz +0 -0
- package/package.json +1 -1
- package/src/services/remote-desktop/remote-desktop-capture-error.ts +19 -6
- package/src/services/remote-desktop/remote-desktop-requirements.ts +6 -0
- package/src/services/remote-desktop/remote-desktop-session.ts +5 -1
- package/src/services/remote-desktop/remote-desktop-win32-host.ts +8 -28
- package/src/services/remote-desktop/remote-desktop-win32-session-row.ts +97 -0
- package/src/services/remote-desktop/win32-helper/helper-paths.ts +13 -0
- package/src/services/remote-desktop/win32-helper/helper-service.ts +14 -8
- package/src/web/components/remote-desktop/remote-desktop-readiness-gate.tsx +8 -76
- package/src/web/components/remote-desktop/remote-desktop-requirement-row.tsx +102 -0
- package/src/web/components/remote-desktop/use-remote-desktop-readiness.ts +4 -0
- package/src/web/components/settings/remote-desktop-headless-helper.tsx +8 -3
- package/dist/web/assets/accounts-settings-section-CYAzO8P_.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-CYAzO8P_.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-CWTAtKRy.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-CWTAtKRy.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-Cocw6_8x.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-Cocw6_8x.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-51Du3QdU.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-51Du3QdU.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-CFeGL_Ml.js.br +0 -0
- package/dist/web/assets/ai-settings-section-CFeGL_Ml.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-D4KGFwFa.js.br +0 -0
- package/dist/web/assets/ai-settings-section-D4KGFwFa.js.gz +0 -0
- package/dist/web/assets/android-tab-te-hb90I.js.br +0 -0
- package/dist/web/assets/android-tab-te-hb90I.js.gz +0 -0
- package/dist/web/assets/antigravity-usage-view-Cg38r4bw.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-Cg38r4bw.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-D9gSM7St.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-D9gSM7St.js.gz +0 -0
- package/dist/web/assets/apps-panel-DIDF_Cad.js.br +0 -0
- package/dist/web/assets/apps-panel-DIDF_Cad.js.gz +0 -0
- package/dist/web/assets/assistant-settings-section-95nrmmY9.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-95nrmmY9.js.gz +0 -0
- package/dist/web/assets/assistant-tab-C8A-USZ4.js.br +0 -0
- package/dist/web/assets/assistant-tab-C8A-USZ4.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-Cus3OCqZ.js.br +0 -0
- package/dist/web/assets/branch-review-tab-Cus3OCqZ.js.gz +0 -0
- package/dist/web/assets/chat-tab-CmN92HnI.js.br +0 -0
- package/dist/web/assets/chat-tab-CmN92HnI.js.gz +0 -0
- package/dist/web/assets/chat-tab-E41O8v4F.js.br +0 -0
- package/dist/web/assets/chat-tab-E41O8v4F.js.gz +0 -0
- package/dist/web/assets/code-editor-Du6G-GMG.js.br +0 -0
- package/dist/web/assets/code-editor-Du6G-GMG.js.gz +0 -0
- package/dist/web/assets/conflict-editor-D5D-H60J.js.br +0 -0
- package/dist/web/assets/conflict-editor-D5D-H60J.js.gz +0 -0
- package/dist/web/assets/connection-form-tab-CnYCTqZJ.js.br +0 -0
- package/dist/web/assets/csv-preview-DmhNmXQM.js.br +0 -0
- package/dist/web/assets/csv-preview-DmhNmXQM.js.gz +0 -0
- package/dist/web/assets/database-drivers-section-DAv805sj.js.br +0 -0
- package/dist/web/assets/database-drivers-section-DAv805sj.js.gz +0 -0
- package/dist/web/assets/db-tab-parts-ilPoLqK4.js.br +0 -0
- package/dist/web/assets/db-tab-parts-ilPoLqK4.js.gz +0 -0
- package/dist/web/assets/design-settings-section-CXmavf1P.js.br +0 -0
- package/dist/web/assets/design-settings-section-CXmavf1P.js.gz +0 -0
- package/dist/web/assets/design-tab-BIA3YsxM.js.br +0 -0
- package/dist/web/assets/design-tab-BIA3YsxM.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-CCXtOoYS.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-CCXtOoYS.js.gz +0 -0
- package/dist/web/assets/diff-viewer-DWR3b9JC.js.br +0 -0
- package/dist/web/assets/diff-viewer-DWR3b9JC.js.gz +0 -0
- package/dist/web/assets/docx-preview-1ZRhA5Q1.js.br +0 -0
- package/dist/web/assets/docx-preview-1ZRhA5Q1.js.gz +0 -0
- package/dist/web/assets/editor-dialog-CQYKBCA5.js.br +0 -0
- package/dist/web/assets/editor-dialog-CQYKBCA5.js.gz +0 -0
- package/dist/web/assets/editor-language-service-B8KyKiA8.js.br +0 -0
- package/dist/web/assets/editor-language-service-B8KyKiA8.js.gz +0 -0
- package/dist/web/assets/explorer-body-DKBJxWpH.js.br +0 -0
- package/dist/web/assets/explorer-body-DKBJxWpH.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-BswqMaRj.js.br +0 -0
- package/dist/web/assets/explorer-window-content-BswqMaRj.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-BjBIjLwN.js.br +0 -0
- package/dist/web/assets/extension-manager-section-BjBIjLwN.js.gz +0 -0
- package/dist/web/assets/extension-webview-BO02qaCn.js.br +0 -0
- package/dist/web/assets/extension-webview-BO02qaCn.js.gz +0 -0
- package/dist/web/assets/files-settings-section-DftcCs-h.js.br +0 -0
- package/dist/web/assets/files-settings-section-DftcCs-h.js.gz +0 -0
- package/dist/web/assets/general-settings-section-BEcR5F2b.js.br +0 -0
- package/dist/web/assets/general-settings-section-BEcR5F2b.js.gz +0 -0
- package/dist/web/assets/git-log-panel-CUbhrVwA.js.br +0 -0
- package/dist/web/assets/git-log-panel-CUbhrVwA.js.gz +0 -0
- package/dist/web/assets/git-review-tab-DRA61b2t.js.br +0 -0
- package/dist/web/assets/git-review-tab-DRA61b2t.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-BvF1Wd7y.js.br +0 -0
- package/dist/web/assets/glide-data-grid-BvF1Wd7y.js.gz +0 -0
- package/dist/web/assets/grid-save-dialog-CjB9VLio.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-CjB9VLio.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-BGgi1b56.js.br +0 -0
- package/dist/web/assets/group-chat-tab-BGgi1b56.js.gz +0 -0
- package/dist/web/assets/impexp-tab-C4O4SxSd.js.br +0 -0
- package/dist/web/assets/impexp-tab-C4O4SxSd.js.gz +0 -0
- package/dist/web/assets/index-4hOd9rdZ.js.br +0 -0
- package/dist/web/assets/index-4hOd9rdZ.js.gz +0 -0
- package/dist/web/assets/index-PoJeN70H.css +0 -1
- package/dist/web/assets/index-PoJeN70H.css.br +0 -0
- package/dist/web/assets/index-PoJeN70H.css.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CQzLAxpQ.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CQzLAxpQ.js.gz +0 -0
- package/dist/web/assets/language-servers-section-DGuUwGd9.js.br +0 -0
- package/dist/web/assets/language-servers-section-DGuUwGd9.js.gz +0 -0
- package/dist/web/assets/logs-app-WZfVMFzz.js.br +0 -0
- package/dist/web/assets/logs-app-WZfVMFzz.js.gz +0 -0
- package/dist/web/assets/lsp-client-D_CidQV4.js.br +0 -0
- package/dist/web/assets/lsp-client-D_CidQV4.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-Bqj9_EwG.js.br +0 -0
- package/dist/web/assets/markdown-renderer-Bqj9_EwG.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-Dxw3fmMg.js.br +0 -0
- package/dist/web/assets/markdown-renderer-Dxw3fmMg.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-M6n7jBUM.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-M6n7jBUM.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-BujIaJpE.js.br +0 -0
- package/dist/web/assets/new-design-dialog-BujIaJpE.js.gz +0 -0
- package/dist/web/assets/notifications-settings-section-_UHI0jP-.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-_UHI0jP-.js.gz +0 -0
- package/dist/web/assets/onboarding-entry-B0dLGixW.js.br +0 -0
- package/dist/web/assets/onboarding-entry-B0dLGixW.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-BmqzsCHn.js.br +0 -0
- package/dist/web/assets/open-manager-chat-BmqzsCHn.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-ys3Mntw6.js.br +0 -3
- package/dist/web/assets/open-manager-chat-ys3Mntw6.js.gz +0 -0
- package/dist/web/assets/problems-panel-gw4v5rlS.js.br +0 -0
- package/dist/web/assets/problems-panel-gw4v5rlS.js.gz +0 -0
- package/dist/web/assets/process-table-DcdpMd-n.js.br +0 -0
- package/dist/web/assets/process-table-DcdpMd-n.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-Dn82m_AD.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-Dn82m_AD.js.gz +0 -0
- package/dist/web/assets/query-tab-CFxg5WOu.js.br +0 -0
- package/dist/web/assets/query-tab-CFxg5WOu.js.gz +0 -0
- package/dist/web/assets/remembered-approvals-section-CBcd7DO-.js.br +0 -0
- package/dist/web/assets/remembered-approvals-section-CBcd7DO-.js.gz +0 -0
- package/dist/web/assets/remote-access-settings-section-CY8JHgx3.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-CY8JHgx3.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-BI0fR6VN.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-BI0fR6VN.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-iFYUAFfB.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-iFYUAFfB.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-CZPo5zD9.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-CZPo5zD9.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BTQ_ZMu0.js +0 -1
- package/dist/web/assets/remote-desktop-readiness-gate-BTQ_ZMu0.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BTQ_ZMu0.js.gz +0 -0
- package/dist/web/assets/remote-desktop-settings-section-vbhYF1tt.js +0 -1
- package/dist/web/assets/remote-desktop-settings-section-vbhYF1tt.js.br +0 -0
- package/dist/web/assets/remote-desktop-settings-section-vbhYF1tt.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-CkC7aaxg.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-CkC7aaxg.js.gz +0 -0
- package/dist/web/assets/rename-object-dialog-0CIErjrH.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-0CIErjrH.js.gz +0 -0
- package/dist/web/assets/review-address-setup-BfTlQWmO.js.br +0 -0
- package/dist/web/assets/review-address-setup-BfTlQWmO.js.gz +0 -0
- package/dist/web/assets/review-code-Bdvn0HTV.js.br +0 -0
- package/dist/web/assets/review-code-Bdvn0HTV.js.gz +0 -0
- package/dist/web/assets/save-as-dialog-Ca1l4sTn.js.br +0 -0
- package/dist/web/assets/save-as-dialog-Ca1l4sTn.js.gz +0 -0
- package/dist/web/assets/schedule-form-DLswvU_a.js.br +0 -0
- package/dist/web/assets/schedule-form-DLswvU_a.js.gz +0 -0
- package/dist/web/assets/schedule-script-editor-CchIkvQF.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-CchIkvQF.js.gz +0 -0
- package/dist/web/assets/schedules-app-BJYAorq7.js.br +0 -0
- package/dist/web/assets/schedules-app-BJYAorq7.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-BpbxA54S.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-BpbxA54S.js.gz +0 -0
- package/dist/web/assets/schedules-tab-Cd7jVBi3.js.br +0 -0
- package/dist/web/assets/schedules-tab-Cd7jVBi3.js.gz +0 -0
- package/dist/web/assets/schedules-ui-sEV5fwQj.js.br +0 -0
- package/dist/web/assets/schedules-ui-sEV5fwQj.js.gz +0 -0
- package/dist/web/assets/schedules-window-content-D2Cs6VnK.js.br +0 -0
- package/dist/web/assets/schedules-window-content-D2Cs6VnK.js.gz +0 -0
- package/dist/web/assets/session-review-tab-D4Q5RO4O.js.br +0 -0
- package/dist/web/assets/session-review-tab-D4Q5RO4O.js.gz +0 -0
- package/dist/web/assets/settings-body-B0GEhsL0.js.br +0 -0
- package/dist/web/assets/settings-body-B0GEhsL0.js.gz +0 -0
- package/dist/web/assets/settings-rows-Ypj7sR8g.js.br +0 -0
- package/dist/web/assets/settings-rows-Ypj7sR8g.js.gz +0 -0
- package/dist/web/assets/settings-section-content-CbZgAjZp.js.br +0 -0
- package/dist/web/assets/settings-section-content-CbZgAjZp.js.gz +0 -0
- package/dist/web/assets/sql-object-tab-B22poBWQ.js.br +0 -0
- package/dist/web/assets/sql-object-tab-B22poBWQ.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-YW9FzgCn.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-YW9FzgCn.js.gz +0 -0
- package/dist/web/assets/storage-settings-section-BZVjdPac.js.br +0 -0
- package/dist/web/assets/storage-settings-section-BZVjdPac.js.gz +0 -0
- package/dist/web/assets/structure-save-dialog-CdQgJuij.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-CdQgJuij.js.gz +0 -0
- package/dist/web/assets/structure-tab-BRYP8X7D.js.br +0 -0
- package/dist/web/assets/structure-tab-BRYP8X7D.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-CcteBEma.js.br +0 -0
- package/dist/web/assets/system-monitor-body-CcteBEma.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-BZuhqAnf.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-BZuhqAnf.js.gz +0 -0
- package/dist/web/assets/table-tab-x8ljbNIU.js.br +0 -0
- package/dist/web/assets/table-tab-x8ljbNIU.js.gz +0 -0
- package/dist/web/assets/task-detail-mobile-BiyzO2PQ.js.br +0 -0
- package/dist/web/assets/task-detail-mobile-BiyzO2PQ.js.gz +0 -0
- package/dist/web/assets/task-sheet-_diq5iFA.js.br +0 -0
- package/dist/web/assets/task-sheet-_diq5iFA.js.gz +0 -0
- package/dist/web/assets/task-status-grid-iSNPKi5R.js.br +0 -0
- package/dist/web/assets/task-status-grid-iSNPKi5R.js.gz +0 -0
- package/dist/web/assets/task-tab-D3FxaT5N.js.br +0 -0
- package/dist/web/assets/task-tab-D3FxaT5N.js.gz +0 -0
- package/dist/web/assets/tasks-sidebar-panel-R6pIm7Jg.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-DYRVI-4i.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-DYRVI-4i.js.gz +0 -0
- package/dist/web/assets/terminal-tab-BolwiWu6.js.br +0 -0
- package/dist/web/assets/terminal-tab-BolwiWu6.js.gz +0 -0
- package/dist/web/assets/tool-cards-UUoPFqMm.js.br +0 -0
- package/dist/web/assets/tool-cards-UUoPFqMm.js.gz +0 -0
- package/dist/web/assets/tools-settings-section-DDqE038F.js.br +0 -0
- package/dist/web/assets/tools-settings-section-DDqE038F.js.gz +0 -0
- package/dist/web/assets/use-db-read-Ba5l6MGg.js.br +0 -0
- package/dist/web/assets/use-db-read-Ba5l6MGg.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-L6O_fqFr.js.br +0 -0
- package/dist/web/assets/use-inline-blame-L6O_fqFr.js.gz +0 -0
- package/dist/web/assets/use-lsp-B1TMEIl6.js.br +0 -0
- package/dist/web/assets/use-lsp-B1TMEIl6.js.gz +0 -0
- package/dist/web/assets/use-process-kill-6oqUFZee.js.br +0 -0
- package/dist/web/assets/use-process-kill-6oqUFZee.js.gz +0 -0
- package/dist/web/assets/use-sql-schema-info-CgtNS3Mm.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-CgtNS3Mm.js.gz +0 -0
- package/dist/web/assets/vault-settings-section-CEZOMLcO.js.br +0 -0
- package/dist/web/assets/vault-settings-section-CEZOMLcO.js.gz +0 -0
- package/dist/web/assets/voice-settings-section-CXyszRjL.js.br +0 -0
- package/dist/web/assets/voice-settings-section-CXyszRjL.js.gz +0 -0
- package/dist/web/assets/web-browser-settings-section-B4QgwZvJ.js.br +0 -0
- package/dist/web/assets/web-browser-settings-section-B4QgwZvJ.js.gz +0 -0
- package/dist/web/assets/web-browser-view-DmSWTErd.js.br +0 -0
- package/dist/web/assets/web-browser-view-DmSWTErd.js.gz +0 -0
- package/dist/web/assets/web-preview-tab-BovA5aEw.js.br +0 -0
- package/dist/web/assets/web-preview-tab-BovA5aEw.js.gz +0 -0
- package/dist/web/assets/xlsx-preview-5vAG0Bbj.js.br +0 -0
- package/dist/web/assets/xlsx-preview-5vAG0Bbj.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{t}from"./settings-store-DirmJxtu.js";import{D as n,E as r}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{M as i,Sn as a,Tn as o,Zr as s,gr as c,gt as l,j as u,mr as d,ut as f,wn as p}from"./icons-CpR5Vw3J.js";import{j as m,n as h,r as g}from"./api-client-DSCscZEd.js";import{n as _}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-CdpGgbmw.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-B_629iML.js";import{t as v}from"./open-settings-CGqVSUo5.js";import{t as y}from"./button-CtdEWN7U.js";import"./dialog-BWXzvHlC.js";import{r as b}from"./clipboard-DQuoK2EM.js";import{Bn as x,Di as S,Fn as C,Nn as w,Nr as T,Qn as E,Rn as D,c as O,d as k,ki as A,mn as j,zn as M}from"./index-4hOd9rdZ.js";import"./run-in-terminal-Bhp0sfyb.js";import{a as N,i as P,n as F,r as I,t as L}from"./review-address-setup-BfTlQWmO.js";import{t as R}from"./run-in-terminal-button-BP_KVP3Z.js";var z=e(n(),1),B={state:()=>g.get(`/api/tailscale/state`),login:()=>g.post(`/api/tailscale/login`),cancelLogin:()=>g.post(`/api/tailscale/login/cancel`),setService:e=>g.post(`/api/tailscale/service`,e)};function V(e){return e.installed?e.backendState===null?`start`:e.canManage===!1?`operator`:e.backendState===`Running`?!e.magicDns||!e.httpsCertificates?`dns`:e.device?.tags.length?e.service.defined?null:`service`:`tag`:`sign-in`:`install`}function ee(e){let t=V(e);return t===`service`?null:t}var te=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;function ne(e){return e?e.length>63?`Use at most 63 characters.`:te.test(e)?null:`Use lowercase letters, digits and dashes, starting and ending with a letter or digit.`:`Enter a name.`}var H={dns:`https://login.tailscale.com/admin/dns`,accessControls:`https://login.tailscale.com/admin/acls/file`,machines:`https://login.tailscale.com/admin/machines`,services:`https://login.tailscale.com/admin/services`},U=r(),W=[`install`,`start`,`operator`,`sign-in`,`dns`,`tag`,`service`],re={install:`Install Tailscale`,start:`Start Tailscale`,operator:`Let PPM manage Tailscale`,"sign-in":`Sign in to Tailscale`,dns:`Turn on MagicDNS and HTTPS`,tag:`Tag this machine`,service:`Create the service`},ie={darwin:`https://tailscale.com/download/mac`,win32:`https://tailscale.com/download/windows`},ae=`curl -fsSL https://tailscale.com/install.sh | sh`,oe=`sudo systemctl enable --now tailscaled`,G=e=>`sudo tailscale set --operator=${/^[\w.@-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}`,se=`tag:ppm`,ce=e=>`"tagOwners": {\n "${e}": ["autogroup:admin"]\n}`;function le({state:e,onRefresh:t,onSignIn:n,onShowSignIn:r}){let i=V(e),s=i?W.indexOf(i):W.length,l=W.filter(t=>t===`start`?i===`start`:t===`operator`?e.platform===`linux`:!0),u=e=>W.indexOf(e)<s?`done`:e===i?`current`:`todo`,d=(0,U.jsxs)(y,{variant:`outline`,onClick:t,className:`min-h-11 cursor-pointer md:min-h-9`,children:[(0,U.jsx)(c,{className:`size-3.5`}),`Check again`]}),f=e.device?.name||`this machine`,p=e.service.name,m=e.osUser&&e.osUser!==`root`?` && ${G(e.osUser)}`:``,h=`${ae}${m}`,g=`${oe}${m}`,v=`PPM types it into a terminal on this machine; press Enter there and give your password once.`,b={install:()=>e.platform===`linux`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`This installs Tailscale, starts it`,m?` and lets PPM manage it`:``,`. `,v]}),(0,U.jsx)(M,{code:h}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:h,label:`Install in terminal`}),d]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Install the Tailscale app on the machine PPM runs on and open it once.`}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:ie[e.platform]??`https://tailscale.com/download`,children:`Download Tailscale`}),d]})]}),start:()=>e.platform===`linux`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`Tailscale is installed, but its service is not running. `,v]}),(0,U.jsx)(M,{code:g}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:g,label:`Start in terminal`}),d]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Tailscale is installed, but not running. Open the Tailscale app on this machine.`}),(0,U.jsx)(J,{children:d})]}),operator:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`On Linux, Tailscale only takes changes from root and from one user it trusts. PPM runs as `,(0,U.jsx)(q,{children:e.osUser}),`, which has to be named once. `,v]}),(0,U.jsx)(M,{code:G(e.osUser)}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:G(e.osUser),label:`Run in terminal`}),d]})]}),"sign-in":()=>{if(e.login.state===`starting`||e.login.state===`waiting`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Waiting for you to finish signing in.`}),(0,U.jsx)(J,{children:(0,U.jsx)(y,{onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Show sign-in link`})})]});if(e.backendState===`NeedsMachineAuth`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`Signed in. An admin has to approve `,f,` before it joins the tailnet.`]}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.machines,children:`Open machines`}),d]})]});if(e.backendState===`Starting`)return(0,U.jsxs)(K,{children:[(0,U.jsx)(a,{className:`mr-2 inline size-4 animate-spin`}),`Connecting to Tailscale…`]});let t=e.backendState===`Stopped`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:t?`Tailscale is turned off on this machine.`:`Sign this machine in with the account that owns your tailnet.`}),(0,U.jsx)(J,{children:(0,U.jsxs)(y,{onClick:n,className:`min-h-11 cursor-pointer md:min-h-9`,children:[(0,U.jsx)(o,{className:`size-4`}),t?`Turn on`:`Sign in`]})})]})},dns:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`In `,(0,U.jsx)(`b`,{children:`DNS`}),`, turn on `,(0,U.jsx)(`b`,{children:`MagicDNS`}),`, then choose `,(0,U.jsx)(`b`,{children:`Enable HTTPS`}),` under HTTPS Certificates. Every .ts.net address needs both.`]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`MagicDNS `,e.magicDns?`on`:`off`,` · HTTPS `,e.httpsCertificates?`on`:`off`]}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.dns,children:`Open DNS settings`}),d]})]}),tag:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Tailscale only lets a tagged machine host a service.`}),(0,U.jsxs)(`ol`,{className:`list-decimal space-y-3 pl-5 text-sm leading-relaxed text-muted-foreground`,children:[(0,U.jsxs)(`li`,{className:`space-y-2`,children:[(0,U.jsxs)(`p`,{children:[`In `,(0,U.jsx)(`b`,{children:`Access controls`}),`, let admins hand out the tag (once per tailnet):`]}),(0,U.jsx)(M,{code:ce(se)}),(0,U.jsx)(x,{href:H.accessControls,children:`Open access controls`})]}),(0,U.jsxs)(`li`,{className:`space-y-2`,children:[(0,U.jsxs)(`p`,{children:[`In `,(0,U.jsx)(`b`,{children:`Machines`}),`, open the menu of `,f,`, choose `,(0,U.jsx)(`b`,{children:`Edit tags`}),` and add `,(0,U.jsx)(q,{children:se}),`.`]}),(0,U.jsx)(x,{href:H.machines,children:`Open machines`})]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`A tagged machine belongs to the tag rather than to your account.`}),(0,U.jsx)(J,{children:d})]}),service:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`In `,(0,U.jsx)(`b`,{children:`Services`}),`, choose `,(0,U.jsx)(`b`,{children:`Advertise`}),`, then `,(0,U.jsx)(`b`,{children:`Define a Service`}),`: name it `,(0,U.jsx)(q,{children:p}),` and give it the port `,(0,U.jsx)(q,{children:`tcp:443`}),`.`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`The address can be turned on before this; it then waits for the service and for an admin to approve this machine.`}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.services,children:`Open services`}),d]})]})},S={operator:`PPM can change Tailscale's settings.`,"sign-in":e.device?.dnsName?`Signed in as ${e.device.dnsName}`:void 0,dns:`MagicDNS and HTTPS are on.`,tag:e.device?.tags.length?`Tagged ${e.device.tags.join(`, `)}`:void 0,service:`svc:${p} exists in your tailnet.`};return(0,U.jsx)(`ol`,{className:`space-y-1`,"data-testid":`tailscale-steps`,children:l.map((e,t)=>{let n=u(e);return(0,U.jsxs)(`li`,{className:`flex gap-3`,"data-step":e,"data-status":n,children:[(0,U.jsx)(ue,{n:t+1,status:n}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pb-4`,children:[(0,U.jsx)(`div`,{className:_(`pt-0.5 text-sm`,n===`todo`?`text-muted-foreground`:`font-medium`),children:re[e]}),n===`done`&&S[e]&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S[e]}),n===`current`&&b[e]()]})]},e)})})}function ue({n:e,status:t}){return t===`done`?(0,U.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-success`}):(0,U.jsx)(`span`,{className:_(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-medium`,t===`current`?`border-primary text-primary`:`border-border text-muted-foreground`),children:e})}function K({children:e}){return(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:e})}function q({children:e}){return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs text-foreground`,children:e})}function J({children:e}){return(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e})}var Y=`text-sm leading-relaxed text-muted-foreground`;function de({open:e,login:t,osUser:n,onRetry:r,onCancel:i,onClose:o}){let s=(0,U.jsx)(y,{variant:`outline`,onClick:o,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Close`}),c=(0,U.jsx)(y,{onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Try again`}),l,u;if(t.state===`waiting`&&t.url)l=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:Y,children:`Sign in with the account that owns your tailnet. This machine joins as soon as you finish.`}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`rounded-lg p-3`,style:{backgroundColor:`#ffffff`,colorScheme:`light`},children:(0,U.jsx)(j,{value:t.url,size:168,bgColor:`#ffffff`,fgColor:`#000000`,level:`L`,style:{display:`block`}})}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Or scan it with your phone`})]})]}),u=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{variant:`outline`,onClick:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel sign-in`}),(0,U.jsx)(x,{href:t.url,primary:!0,children:`Open sign-in page`})]});else if(t.state===`idle`||t.state===`starting`)l=(0,U.jsxs)(`p`,{className:`flex items-center gap-2 ${Y}`,children:[(0,U.jsx)(a,{className:`size-4 animate-spin`}),`Asking Tailscale for a sign-in link…`]}),u=(0,U.jsx)(y,{variant:`outline`,onClick:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`});else if(t.state===`success`)l=(0,U.jsx)(`p`,{className:Y,children:`Signed in.`}),u=s;else if(t.state===`needs-approval`)l=(0,U.jsx)(`p`,{className:Y,children:`Signed in. An admin has to approve this machine before it joins the tailnet.`}),u=(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(x,{href:H.machines,primary:!0,children:`Open machines`})]});else if(t.state===`needs-operator`){let e=G(n);l=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:Y,children:`Tailscale on this machine only takes changes from root and from one user it trusts. This has to be run once, with your password. PPM types it into a terminal; press Enter there, then sign in again.`}),(0,U.jsx)(M,{code:e})]}),u=(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(y,{variant:`outline`,onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Try again`}),(0,U.jsx)(R,{command:e,label:`Run in terminal`,onRun:o})]})}else l=(0,U.jsx)(`p`,{className:Y,children:t.message??`The sign-in was cancelled.`}),u=(0,U.jsxs)(U.Fragment,{children:[s,c]});return(0,U.jsx)(D,{open:e,title:`Sign in to Tailscale`,onClose:o,children:(0,U.jsxs)(`div`,{className:`space-y-4`,"data-testid":`tailscale-sign-in`,children:[l,(0,U.jsx)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:u})]})})}var fe=4e3,X=e=>e instanceof Error?e.message:String(e);function pe(e){return e.login.state===`starting`||e.login.state===`waiting`||V(e)!==null||e.enabled&&!e.service.approved}function me(e){if(!e)return!1;try{return new URL(e).hostname===window.location.hostname}catch{return!1}}function he(e){return e.enabled?e.backendState===`Running`?e.service.pointsAtPpm?e.service.approved?`On. Open it from any device signed in to your tailnet.`:`On, waiting for an admin to approve this machine.`:`On, but Tailscale is not serving it right now.`:`On, but this machine is not connected to Tailscale.`:`Off.`}function ge(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(!1),[g,b]=(0,z.useState)(``),x=(0,z.useRef)(0),S=(0,z.useRef)(null),C=(0,z.useCallback)(e=>{x.current++,t(e),r(null)},[]),w=(0,z.useCallback)(e=>{x.current++,t(t=>t&&{...t,login:e})},[]),O=(0,z.useCallback)(async()=>{let e=++x.current;try{let n=await B.state();e===x.current&&(t(n),r(null))}catch(t){e===x.current&&r(X(t))}},[]);(0,z.useEffect)(()=>{O()},[O]),(0,z.useEffect)(()=>{let e=()=>void O(),t=()=>{document.visibilityState===`visible`&&O()};return window.addEventListener(`tailscale:changed`,e),window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`tailscale:changed`,e),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[O]);let k=!!e&&pe(e);(0,z.useEffect)(()=>{if(!k)return;let e=setInterval(()=>{document.visibilityState===`visible`&&O()},fe);return()=>clearInterval(e)},[k,O]);let A=e?.service.name??``;(0,z.useEffect)(()=>{b(A)},[A]);let j=e?.login.state;(0,z.useEffect)(()=>{o&&j===`success`&&(c(!1),m.success(`Signed in to Tailscale`))},[o,j]);let M=async()=>{w({state:`starting`,url:null,message:null}),c(!0);try{w(await B.login())}catch(e){w({state:`error`,url:null,message:X(e)})}},N=async()=>{c(!1);try{w(await B.cancelLogin())}catch{}},P=ne(g),F=()=>{!e||g===e.service.name||P||(S.current=(async()=>{a(!0);try{C(await B.setService({name:g}))}catch(t){m.error(`Could not rename the address`,{description:X(t)}),b(e.service.name)}finally{a(!1)}})())},I=async(e,t=!1)=>{await S.current,a(!0);try{C(await B.setService(e?{enabled:!0,replace:t}:{enabled:!1}))}catch(t){let n=t instanceof h?t.body?.code:void 0;e&&n===`conflict`?u(!0):m.error(e?`Could not turn the address on`:`Could not turn the address off`,{description:X(t)})}finally{a(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read Tailscale's state: ${n}`:`Reading Tailscale's state…`});let L=ee(e)!==null,R=e.backendState===`Running`,te=e.authEnabled&&!L&&!P,H=V(e)===null,W=(0,U.jsx)(le,{state:e,onRefresh:()=>void O(),onSignIn:()=>void M(),onShowSignIn:()=>c(!0)});return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`tailscale-settings`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Reach PPM at a private https address from any device signed in to your tailnet. Nothing is opened to the internet, and PPM still asks for its password.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`tailscale-address`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`tailscale-address-switch`,className:`text-sm font-medium`,children:`Private address`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`tailscale-address-status`,children:he(e)})]}),(0,U.jsx)(`div`,{className:`flex min-h-11 shrink-0 items-center`,children:(0,U.jsx)(E,{id:`tailscale-address-switch`,checked:e.enabled,disabled:i||!e.enabled&&!te,onCheckedChange:t=>{!t&&me(e.service.url)?f(!0):I(t)}})})]}),e.enabled&&e.service.url?(0,U.jsx)(ve,{url:e.service.url}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(T,{htmlFor:`tailscale-service-name`,className:`text-xs text-muted-foreground`,children:`Address`}),(0,U.jsxs)(`div`,{className:_(`flex min-h-11 items-center rounded-md border border-input bg-background focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,P&&`border-destructive`),children:[(0,U.jsx)(`input`,{id:`tailscale-service-name`,value:g,onChange:e=>b(e.target.value.toLowerCase()),onBlur:F,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:i||e.enabled,"aria-invalid":!!P,spellCheck:!1,autoCapitalize:`none`,autoComplete:`off`,className:`w-20 min-w-20 flex-1 bg-transparent py-2 pl-3 text-sm outline-none`}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate pr-3 text-sm text-muted-foreground`,children:[`.`,e.dnsSuffix??`your-tailnet.ts.net`]})]}),(0,U.jsx)(`p`,{className:_(`text-xs`,P?`text-destructive`:`text-muted-foreground`),children:P??(e.enabled?`Turn the address off to rename it.`:`The address keeps this name when the machine is renamed.`)})]}),!e.enabled&&!e.authEnabled&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:`PPM's password is off. Turn it on first: anyone in your tailnet could otherwise open PPM.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Open General`})]}),!e.enabled&&e.authEnabled&&L&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Finish the setup below to turn it on.`}),e.enabled&&R&&!e.service.pointsAtPpm&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[(0,U.jsx)(`p`,{children:`Tailscale is not serving this address right now.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>void I(!0),disabled:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Apply again`})]}),e.enabled&&R&&e.service.pointsAtPpm&&!e.service.approved&&(0,U.jsx)(ye,{state:e})]}),H?(0,U.jsxs)(`details`,{className:`group`,children:[(0,U.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer items-center text-sm font-medium`,children:`Setup: every step is done`}),(0,U.jsx)(`div`,{className:`pt-2`,children:W})]}):(0,U.jsxs)(`section`,{className:`space-y-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Setup`}),W]}),(0,U.jsx)(de,{open:o,login:e.login,osUser:e.osUser,onRetry:()=>void M(),onCancel:()=>void N(),onClose:()=>c(!1)}),(0,U.jsx)(D,{open:d,title:`Turn off the address you are using?`,onClose:()=>f(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`This page is open at `,e.service.url,`. Turning the address off disconnects it; reach PPM another way to turn it back on.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>f(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{f(!1),I(!1)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Turn off`})]})]})}),(0,U.jsx)(D,{open:l,title:`Replace svc:${e.service.name}?`,onClose:()=>u(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`On this machine, svc:`,e.service.name,` already serves `,(0,U.jsx)(`code`,{className:`text-xs text-foreground`,children:e.service.target??`something else`}),`. Replacing it points the address at PPM, and what it served stops answering there.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>u(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{u(!1),I(!0,!0)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Replace`})]})]})})]})}var _e=`flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-surface-hover hover:text-foreground`;function ve({url:e,qrHint:t=`Scan with a phone that is signed in to your tailnet`}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!1),o=async()=>{await b(e)&&(r(!0),setTimeout(()=>r(!1),1500))};return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center rounded-md border border-border bg-muted pl-3`,"data-testid":`tailscale-address-url`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void o(),"aria-label":`Copy address`,title:`Copy address`,className:_e,children:n?(0,U.jsx)(u,{className:`size-4 text-success`}):(0,U.jsx)(f,{className:`size-4`})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":`Show QR code`,"aria-pressed":i,title:`Show QR code`,className:_(_e,i&&`text-foreground`),children:(0,U.jsx)(d,{className:`size-4`})}),(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open address`,title:`Open address`,className:_e,children:(0,U.jsx)(l,{className:`size-4`})})]}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`rounded-lg p-3`,style:{backgroundColor:`#ffffff`,colorScheme:`light`},children:(0,U.jsx)(j,{value:e,size:168,bgColor:`#ffffff`,fgColor:`#000000`,level:`L`,style:{display:`block`}})}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]})]})}function ye({state:e}){let t=`svc:${e.service.name}`,n=e.device?.name||`this machine`,r=`"autoApprovers": {\n "services": {\n "${t}": ["${e.device?.tags[0]??`tag:ppm`}"]\n }\n}`;return(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[(0,U.jsx)(`p`,{children:e.service.defined?(0,U.jsxs)(U.Fragment,{children:[`Waiting for approval. In `,(0,U.jsx)(`b`,{children:`Services`}),`, open `,t,` and approve `,n,` under Service hosts.`]}):(0,U.jsxs)(U.Fragment,{children:[`Waiting for the service. Create `,t,` in `,(0,U.jsx)(`b`,{children:`Services`}),` (the last step below), then approve `,n,` as its host.`]})}),(0,U.jsx)(x,{href:H.services,children:`Open services`}),(0,U.jsx)(`p`,{className:`pt-1`,children:`To approve machines with this tag automatically, add this to your access controls:`}),(0,U.jsx)(M,{code:r})]})}function Z({icon:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex gap-3 rounded-md border border-border bg-muted px-4 py-3`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2 text-sm leading-relaxed text-muted-foreground`,children:t})]})}var be=1e4,xe=2e3,Se=e=>e instanceof Error?e.message:String(e);function Ce(e){if(!e)return!1;try{return new URL(e).hostname===window.location.hostname}catch{return!1}}function we(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,o]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,h]=(0,z.useState)(!1),g=k(),_=(0,z.useCallback)(async()=>{try{t(await w.status()),r(null)}catch(e){r(Se(e))}},[]),b=e?e.enabled??!0:!1,x=b&&!!e&&!e.active;(0,z.useEffect)(()=>{_()},[_]),(0,z.useEffect)(()=>{let e=setInterval(()=>{document.visibilityState===`visible`&&_()},x?xe:be);return()=>clearInterval(e)},[x,_]),(0,z.useEffect)(()=>{let e=()=>{_(),g.refreshStatus()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[_,g.refreshStatus]);let S=async e=>{o(!0),t(t=>t&&{...t,enabled:e});try{await w.setEnabled(e),await _()}catch(n){t(t=>t&&{...t,enabled:!e}),m.error(e?`Could not turn the public link on`:`Could not turn the public link off`,{description:Se(n)})}finally{o(!1)}},A=async()=>{d(!1),h(!0);try{await C.disable(),m.success(`Switched to a temporary address`),await Promise.all([g.refreshStatus(),_()])}catch(e){m.error(`Could not switch to a temporary address`,{description:Se(e)})}finally{h(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read the public link's state: ${n}`:`Reading the public link's state…`});let j=g.status,M=j?.authEnabled??!0,N=j?.mode??`quick`,P=N===`named`?j?.hostname??null:null,F=!!P&&window.location.hostname===P,I=g.step.k!==`hidden`&&g.step.k!==`ask-domain`,L=N===`named`&&j?.liveMode===`quick`;return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`public-link-pane`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Open PPM from anywhere through a public https link, served by Cloudflare. Anyone who has the link reaches PPM's sign-in page, so keep the password on. For a link only your own devices can open, use Tailscale instead.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`public-link-switch-card`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`public-link-switch`,className:`text-sm font-medium`,children:`Public link`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`public-link-status`,children:b?x?`On. Waiting for Cloudflare to hand out the link…`:`On. Anyone with the link reaches PPM's sign-in page.`:`Off.`})]}),(0,U.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2`,children:[(i||x)&&(0,U.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`}),(0,U.jsx)(E,{id:`public-link-switch`,checked:b,disabled:i||!b&&!M,onCheckedChange:t=>{!t&&Ce(e.url)?l(!0):S(t)}})]})]}),b&&e.url&&(0,U.jsx)(ve,{url:e.url,qrHint:`Scan to open PPM on a phone`}),!M&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:b?`PPM's password is off while the link is on: anyone who has the link can open PPM. Turn the password on, or the link off.`:`PPM's password is off. Turn it on first: anyone with the link could otherwise open PPM.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Open General`})]})]}),(0,U.jsxs)(`section`,{className:`space-y-3`,"data-testid":`public-link-address`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Address`}),I?(0,U.jsx)(`div`,{className:`rounded-lg border border-border p-4`,children:(0,U.jsx)(O,{step:g.step,t:g})}):(0,U.jsxs)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:[(0,U.jsx)(Q,{title:`Temporary address`,inUse:N===`quick`,description:`A random trycloudflare.com address. It changes every time PPM restarts.`,action:N===`named`&&(0,U.jsx)(y,{variant:`outline`,onClick:()=>d(!0),disabled:f||F,className:`min-h-11 cursor-pointer md:min-h-9`,children:f?(0,U.jsx)(a,{className:`size-4 animate-spin`}):`Switch`})}),(0,U.jsx)(Q,{title:`Your own domain`,inUse:N===`named`,description:P?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,P]}),`. It stays the same after a restart.`]}):`One fixed address on a domain you have on Cloudflare, like ppm.example.com.`,action:N===`quick`&&M&&(0,U.jsx)(y,{onClick:g.answerYes,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Set up`})})]}),!I&&N===`quick`&&!M&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on PPM's password to use your own domain.`}),!I&&F&&(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`This page is open through your domain, so switching would cut it off before the new address could show. Open PPM another way first (Tailscale, or on this machine), then switch.`}),(L||j?.tunnelWarning)&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[L&&(0,U.jsx)(`p`,{children:`PPM could not use your domain and is on a temporary address for now.`}),j?.tunnelWarning&&(0,U.jsx)(`p`,{children:j.tunnelWarning})]})]}),(0,U.jsx)(D,{open:c,title:`Turn off the link you are using?`,onClose:()=>l(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`This page is open at `,e.url,`. Turning the link off disconnects it; reach PPM another way to turn it back on.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>l(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{l(!1),S(!1)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Turn off`})]})]})}),(0,U.jsx)(D,{open:u,title:`Switch to a temporary address?`,onClose:()=>d(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`PPM stops answering at https://`,P,` and gets a new random address instead. Links that use your domain stop working until you set it up again.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>d(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>void A(),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Switch`})]})]})})]})}function Q({title:e,description:t,inUse:n,action:r}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-3`,"data-in-use":n||void 0,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem] space-y-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:e}),n&&(0,U.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary`,children:`In use`})]}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:t})]}),r&&(0,U.jsx)(`div`,{className:`shrink-0`,children:r})]})}var $=`min-h-11 cursor-pointer md:min-h-9`,Te=e=>e instanceof Error?e.message:String(e);function Ee(){let{status:e,setStatus:t,loadError:n,refresh:r,connecting:i}=P(),o=I(e,r),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,h]=(0,z.useState)(!1),g=async e=>{l(!0),t(t=>t&&{...t,enabled:e});try{let t=await N.setEnabled(e);t.applied||F(t,e?`Review address turned on`:`Review address turned off`),await r()}catch(n){t(t=>t&&{...t,enabled:!e}),m.error(e?`Could not turn the review address on`:`Could not turn the review address off`,{description:Te(n)})}finally{l(!1)}},_=async()=>{h(!1),d(!0);try{F(await N.useTemporary(),`Switched to a temporary address`),await r()}catch(e){m.error(`Could not switch to a temporary address`,{description:Te(e)})}finally{d(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read the review address's state: ${n}`:`Reading the review address's state…`});let{enabled:b,mode:x,authEnabled:S}=e,C=x===`quick`?null:e.hostname,w=e.ppmTunnel.named?e.ppmTunnel.hostname:null;return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`review-links-pane`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Share design review links without making PPM public. Reviewers get an address of its own that opens the review pages and nothing else: no editor, chats, files or sign-in page answer there.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`review-links-switch-card`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`review-links-switch`,className:`text-sm font-medium`,children:`Review address`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`review-links-status`,children:b?e.connected?(0,U.jsxs)(U.Fragment,{children:[`On. Review links open at `,(0,U.jsx)(`span`,{className:`break-all font-medium text-foreground`,children:e.url})]}):e.running?`On. Connecting to Cloudflare…`:`On. Starting…`:`Off.`})]}),(0,U.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2`,children:[(c||i&&e.canApply)&&(0,U.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`}),(0,U.jsx)(E,{id:`review-links-switch`,checked:b,disabled:c||!b&&!S,onCheckedChange:e=>void g(e)})]})]}),!S&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:`PPM's password is off, and share links do not open while it is. Turn it on first.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:$,children:`Open General`})]}),b&&!e.canApply&&(0,U.jsx)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:(0,U.jsx)(`p`,{children:e.supervised?"This PPM was started before review addresses existed. Run `ppm restart` to apply these settings.":"Review addresses run under `ppm start`. This PPM was started without it, so nothing serves the address."})})]}),(0,U.jsxs)(`section`,{className:`space-y-3`,"data-testid":`review-links-address`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Address`}),o.flow?(0,U.jsx)(`div`,{className:`rounded-lg border border-border p-4`,"data-testid":`review-links-setup`,children:(0,U.jsx)(L,{setup:o,ppmHostname:w})}):(0,U.jsxs)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:[(0,U.jsx)(Q,{title:`Temporary address`,inUse:x===`quick`,description:`A random trycloudflare.com address of its own. It changes every time PPM restarts, and links already sent stop working then.`,action:x!==`quick`&&(0,U.jsx)(y,{variant:`outline`,onClick:()=>h(!0),disabled:u,className:$,children:u?(0,U.jsx)(a,{className:`size-4 animate-spin`}):`Switch`})}),(0,U.jsx)(Q,{title:`Your domain, its own tunnel`,inUse:x===`named`,description:x===`named`&&C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,C]}),`, on a Cloudflare tunnel of its own.`]}):`A fixed address like share.example.com, on a Cloudflare tunnel of its own. PPM's public link is not involved.`,action:S&&(0,U.jsx)(y,{variant:x===`named`?`outline`:`default`,onClick:()=>o.begin(`named`),className:$,"data-testid":`review-links-setup-named`,children:x===`named`?`Change`:`Set up`})}),(0,U.jsx)(Q,{title:`Your domain, on PPM's tunnel`,inUse:x===`shared`,description:x===`shared`&&C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,C]}),`, on the tunnel of PPM's public link. PPM's own address answers only while that link is on.`]}):`A fixed address like share.example.com, added to the tunnel PPM's public link uses. PPM's own address answers only while that link is on.`,action:S&&e.ppmTunnel.named&&(0,U.jsx)(y,{variant:x===`shared`?`outline`:`default`,onClick:()=>o.begin(`shared`),className:$,"data-testid":`review-links-setup-shared`,children:x===`shared`?`Change`:`Set up`})})]}),!o.flow&&!S&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on PPM's password to use your own domain.`}),!o.flow&&S&&!e.ppmTunnel.named&&(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`To use PPM's tunnel, set your domain up under Public link first. Its link can stay off.`}),b&&e.warning&&(0,U.jsx)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:(0,U.jsx)(`p`,{children:e.warning})})]}),(0,U.jsx)(D,{open:f,title:`Switch to a temporary address?`,onClose:()=>h(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`Review links stop opening at https://`,C,` and get a new random address instead. Links already sent with your domain stop working until you set it up again.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>h(!1),className:$,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>void _(),className:$,children:`Switch`})]})]})})]})}function De(){let e=t(e=>e.minimalMode),n=A(e=>e.tab),r=e&&n===`review-links`?`tailscale`:n,i=A(e=>e.setTab);return(0,U.jsxs)(`div`,{className:`space-y-5`,"data-testid":`remote-access`,"data-tab":r,children:[(0,U.jsx)(`div`,{role:`tablist`,"aria-label":`Remote access`,className:`flex gap-1 overflow-x-auto border-b border-border/50`,children:S.filter(t=>!e||t.id!==`review-links`).map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r===e.id,"data-testid":`remote-access-tab-${e.id}`,onClick:()=>i(e.id),className:_(`flex min-h-11 shrink-0 cursor-pointer items-center whitespace-nowrap rounded-t px-3 text-sm transition-colors md:min-h-9 md:text-xs`,r===e.id?`border-b-2 border-primary font-medium text-primary`:`text-text-subtle hover:text-text-secondary`),children:e.label},e.id))}),(0,U.jsxs)(`div`,{role:`tabpanel`,children:[r===`tailscale`&&(0,U.jsx)(ge,{}),r===`public-link`&&(0,U.jsx)(we,{}),r===`review-links`&&(0,U.jsx)(Ee,{})]})]})}export{De as RemoteAccessSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{t}from"./settings-store-DirmJxtu.js";import{D as n,E as r}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{M as i,Sn as a,Tn as o,Zr as s,gr as c,gt as l,j as u,mr as d,ut as f,wn as p}from"./icons-CpR5Vw3J.js";import{j as m,n as h,r as g}from"./api-client-DSCscZEd.js";import{n as _}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-CdpGgbmw.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-B_629iML.js";import{t as v}from"./open-settings-CGqVSUo5.js";import{t as y}from"./button-CtdEWN7U.js";import"./dialog-BWXzvHlC.js";import{r as b}from"./clipboard-DQuoK2EM.js";import{Bn as x,Di as S,Fn as C,Nn as w,Nr as T,Qn as E,Rn as D,c as O,d as k,ki as A,mn as j,zn as M}from"./index-CToe9paM.js";import"./run-in-terminal-Bhp0sfyb.js";import{a as N,i as P,n as F,r as I,t as L}from"./review-address-setup-BIMTMFOp.js";import{t as R}from"./run-in-terminal-button-BP_KVP3Z.js";var z=e(n(),1),B={state:()=>g.get(`/api/tailscale/state`),login:()=>g.post(`/api/tailscale/login`),cancelLogin:()=>g.post(`/api/tailscale/login/cancel`),setService:e=>g.post(`/api/tailscale/service`,e)};function V(e){return e.installed?e.backendState===null?`start`:e.canManage===!1?`operator`:e.backendState===`Running`?!e.magicDns||!e.httpsCertificates?`dns`:e.device?.tags.length?e.service.defined?null:`service`:`tag`:`sign-in`:`install`}function ee(e){let t=V(e);return t===`service`?null:t}var te=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;function ne(e){return e?e.length>63?`Use at most 63 characters.`:te.test(e)?null:`Use lowercase letters, digits and dashes, starting and ending with a letter or digit.`:`Enter a name.`}var H={dns:`https://login.tailscale.com/admin/dns`,accessControls:`https://login.tailscale.com/admin/acls/file`,machines:`https://login.tailscale.com/admin/machines`,services:`https://login.tailscale.com/admin/services`},U=r(),W=[`install`,`start`,`operator`,`sign-in`,`dns`,`tag`,`service`],re={install:`Install Tailscale`,start:`Start Tailscale`,operator:`Let PPM manage Tailscale`,"sign-in":`Sign in to Tailscale`,dns:`Turn on MagicDNS and HTTPS`,tag:`Tag this machine`,service:`Create the service`},ie={darwin:`https://tailscale.com/download/mac`,win32:`https://tailscale.com/download/windows`},ae=`curl -fsSL https://tailscale.com/install.sh | sh`,oe=`sudo systemctl enable --now tailscaled`,G=e=>`sudo tailscale set --operator=${/^[\w.@-]+$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}`,se=`tag:ppm`,ce=e=>`"tagOwners": {\n "${e}": ["autogroup:admin"]\n}`;function le({state:e,onRefresh:t,onSignIn:n,onShowSignIn:r}){let i=V(e),s=i?W.indexOf(i):W.length,l=W.filter(t=>t===`start`?i===`start`:t===`operator`?e.platform===`linux`:!0),u=e=>W.indexOf(e)<s?`done`:e===i?`current`:`todo`,d=(0,U.jsxs)(y,{variant:`outline`,onClick:t,className:`min-h-11 cursor-pointer md:min-h-9`,children:[(0,U.jsx)(c,{className:`size-3.5`}),`Check again`]}),f=e.device?.name||`this machine`,p=e.service.name,m=e.osUser&&e.osUser!==`root`?` && ${G(e.osUser)}`:``,h=`${ae}${m}`,g=`${oe}${m}`,v=`PPM types it into a terminal on this machine; press Enter there and give your password once.`,b={install:()=>e.platform===`linux`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`This installs Tailscale, starts it`,m?` and lets PPM manage it`:``,`. `,v]}),(0,U.jsx)(M,{code:h}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:h,label:`Install in terminal`}),d]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Install the Tailscale app on the machine PPM runs on and open it once.`}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:ie[e.platform]??`https://tailscale.com/download`,children:`Download Tailscale`}),d]})]}),start:()=>e.platform===`linux`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`Tailscale is installed, but its service is not running. `,v]}),(0,U.jsx)(M,{code:g}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:g,label:`Start in terminal`}),d]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Tailscale is installed, but not running. Open the Tailscale app on this machine.`}),(0,U.jsx)(J,{children:d})]}),operator:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`On Linux, Tailscale only takes changes from root and from one user it trusts. PPM runs as `,(0,U.jsx)(q,{children:e.osUser}),`, which has to be named once. `,v]}),(0,U.jsx)(M,{code:G(e.osUser)}),(0,U.jsxs)(J,{children:[(0,U.jsx)(R,{command:G(e.osUser),label:`Run in terminal`}),d]})]}),"sign-in":()=>{if(e.login.state===`starting`||e.login.state===`waiting`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Waiting for you to finish signing in.`}),(0,U.jsx)(J,{children:(0,U.jsx)(y,{onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Show sign-in link`})})]});if(e.backendState===`NeedsMachineAuth`)return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`Signed in. An admin has to approve `,f,` before it joins the tailnet.`]}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.machines,children:`Open machines`}),d]})]});if(e.backendState===`Starting`)return(0,U.jsxs)(K,{children:[(0,U.jsx)(a,{className:`mr-2 inline size-4 animate-spin`}),`Connecting to Tailscale…`]});let t=e.backendState===`Stopped`;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:t?`Tailscale is turned off on this machine.`:`Sign this machine in with the account that owns your tailnet.`}),(0,U.jsx)(J,{children:(0,U.jsxs)(y,{onClick:n,className:`min-h-11 cursor-pointer md:min-h-9`,children:[(0,U.jsx)(o,{className:`size-4`}),t?`Turn on`:`Sign in`]})})]})},dns:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`In `,(0,U.jsx)(`b`,{children:`DNS`}),`, turn on `,(0,U.jsx)(`b`,{children:`MagicDNS`}),`, then choose `,(0,U.jsx)(`b`,{children:`Enable HTTPS`}),` under HTTPS Certificates. Every .ts.net address needs both.`]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`MagicDNS `,e.magicDns?`on`:`off`,` · HTTPS `,e.httpsCertificates?`on`:`off`]}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.dns,children:`Open DNS settings`}),d]})]}),tag:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{children:`Tailscale only lets a tagged machine host a service.`}),(0,U.jsxs)(`ol`,{className:`list-decimal space-y-3 pl-5 text-sm leading-relaxed text-muted-foreground`,children:[(0,U.jsxs)(`li`,{className:`space-y-2`,children:[(0,U.jsxs)(`p`,{children:[`In `,(0,U.jsx)(`b`,{children:`Access controls`}),`, let admins hand out the tag (once per tailnet):`]}),(0,U.jsx)(M,{code:ce(se)}),(0,U.jsx)(x,{href:H.accessControls,children:`Open access controls`})]}),(0,U.jsxs)(`li`,{className:`space-y-2`,children:[(0,U.jsxs)(`p`,{children:[`In `,(0,U.jsx)(`b`,{children:`Machines`}),`, open the menu of `,f,`, choose `,(0,U.jsx)(`b`,{children:`Edit tags`}),` and add `,(0,U.jsx)(q,{children:se}),`.`]}),(0,U.jsx)(x,{href:H.machines,children:`Open machines`})]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`A tagged machine belongs to the tag rather than to your account.`}),(0,U.jsx)(J,{children:d})]}),service:()=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(K,{children:[`In `,(0,U.jsx)(`b`,{children:`Services`}),`, choose `,(0,U.jsx)(`b`,{children:`Advertise`}),`, then `,(0,U.jsx)(`b`,{children:`Define a Service`}),`: name it `,(0,U.jsx)(q,{children:p}),` and give it the port `,(0,U.jsx)(q,{children:`tcp:443`}),`.`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`The address can be turned on before this; it then waits for the service and for an admin to approve this machine.`}),(0,U.jsxs)(J,{children:[(0,U.jsx)(x,{href:H.services,children:`Open services`}),d]})]})},S={operator:`PPM can change Tailscale's settings.`,"sign-in":e.device?.dnsName?`Signed in as ${e.device.dnsName}`:void 0,dns:`MagicDNS and HTTPS are on.`,tag:e.device?.tags.length?`Tagged ${e.device.tags.join(`, `)}`:void 0,service:`svc:${p} exists in your tailnet.`};return(0,U.jsx)(`ol`,{className:`space-y-1`,"data-testid":`tailscale-steps`,children:l.map((e,t)=>{let n=u(e);return(0,U.jsxs)(`li`,{className:`flex gap-3`,"data-step":e,"data-status":n,children:[(0,U.jsx)(ue,{n:t+1,status:n}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pb-4`,children:[(0,U.jsx)(`div`,{className:_(`pt-0.5 text-sm`,n===`todo`?`text-muted-foreground`:`font-medium`),children:re[e]}),n===`done`&&S[e]&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S[e]}),n===`current`&&b[e]()]})]},e)})})}function ue({n:e,status:t}){return t===`done`?(0,U.jsx)(i,{className:`mt-0.5 size-5 shrink-0 text-success`}):(0,U.jsx)(`span`,{className:_(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border text-[11px] font-medium`,t===`current`?`border-primary text-primary`:`border-border text-muted-foreground`),children:e})}function K({children:e}){return(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:e})}function q({children:e}){return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs text-foreground`,children:e})}function J({children:e}){return(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e})}var Y=`text-sm leading-relaxed text-muted-foreground`;function de({open:e,login:t,osUser:n,onRetry:r,onCancel:i,onClose:o}){let s=(0,U.jsx)(y,{variant:`outline`,onClick:o,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Close`}),c=(0,U.jsx)(y,{onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Try again`}),l,u;if(t.state===`waiting`&&t.url)l=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:Y,children:`Sign in with the account that owns your tailnet. This machine joins as soon as you finish.`}),(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`rounded-lg p-3`,style:{backgroundColor:`#ffffff`,colorScheme:`light`},children:(0,U.jsx)(j,{value:t.url,size:168,bgColor:`#ffffff`,fgColor:`#000000`,level:`L`,style:{display:`block`}})}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Or scan it with your phone`})]})]}),u=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{variant:`outline`,onClick:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel sign-in`}),(0,U.jsx)(x,{href:t.url,primary:!0,children:`Open sign-in page`})]});else if(t.state===`idle`||t.state===`starting`)l=(0,U.jsxs)(`p`,{className:`flex items-center gap-2 ${Y}`,children:[(0,U.jsx)(a,{className:`size-4 animate-spin`}),`Asking Tailscale for a sign-in link…`]}),u=(0,U.jsx)(y,{variant:`outline`,onClick:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`});else if(t.state===`success`)l=(0,U.jsx)(`p`,{className:Y,children:`Signed in.`}),u=s;else if(t.state===`needs-approval`)l=(0,U.jsx)(`p`,{className:Y,children:`Signed in. An admin has to approve this machine before it joins the tailnet.`}),u=(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(x,{href:H.machines,primary:!0,children:`Open machines`})]});else if(t.state===`needs-operator`){let e=G(n);l=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:Y,children:`Tailscale on this machine only takes changes from root and from one user it trusts. This has to be run once, with your password. PPM types it into a terminal; press Enter there, then sign in again.`}),(0,U.jsx)(M,{code:e})]}),u=(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(y,{variant:`outline`,onClick:r,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Try again`}),(0,U.jsx)(R,{command:e,label:`Run in terminal`,onRun:o})]})}else l=(0,U.jsx)(`p`,{className:Y,children:t.message??`The sign-in was cancelled.`}),u=(0,U.jsxs)(U.Fragment,{children:[s,c]});return(0,U.jsx)(D,{open:e,title:`Sign in to Tailscale`,onClose:o,children:(0,U.jsxs)(`div`,{className:`space-y-4`,"data-testid":`tailscale-sign-in`,children:[l,(0,U.jsx)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:u})]})})}var fe=4e3,X=e=>e instanceof Error?e.message:String(e);function pe(e){return e.login.state===`starting`||e.login.state===`waiting`||V(e)!==null||e.enabled&&!e.service.approved}function me(e){if(!e)return!1;try{return new URL(e).hostname===window.location.hostname}catch{return!1}}function he(e){return e.enabled?e.backendState===`Running`?e.service.pointsAtPpm?e.service.approved?`On. Open it from any device signed in to your tailnet.`:`On, waiting for an admin to approve this machine.`:`On, but Tailscale is not serving it right now.`:`On, but this machine is not connected to Tailscale.`:`Off.`}function ge(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(!1),[g,b]=(0,z.useState)(``),x=(0,z.useRef)(0),S=(0,z.useRef)(null),C=(0,z.useCallback)(e=>{x.current++,t(e),r(null)},[]),w=(0,z.useCallback)(e=>{x.current++,t(t=>t&&{...t,login:e})},[]),O=(0,z.useCallback)(async()=>{let e=++x.current;try{let n=await B.state();e===x.current&&(t(n),r(null))}catch(t){e===x.current&&r(X(t))}},[]);(0,z.useEffect)(()=>{O()},[O]),(0,z.useEffect)(()=>{let e=()=>void O(),t=()=>{document.visibilityState===`visible`&&O()};return window.addEventListener(`tailscale:changed`,e),window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`tailscale:changed`,e),window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[O]);let k=!!e&&pe(e);(0,z.useEffect)(()=>{if(!k)return;let e=setInterval(()=>{document.visibilityState===`visible`&&O()},fe);return()=>clearInterval(e)},[k,O]);let A=e?.service.name??``;(0,z.useEffect)(()=>{b(A)},[A]);let j=e?.login.state;(0,z.useEffect)(()=>{o&&j===`success`&&(c(!1),m.success(`Signed in to Tailscale`))},[o,j]);let M=async()=>{w({state:`starting`,url:null,message:null}),c(!0);try{w(await B.login())}catch(e){w({state:`error`,url:null,message:X(e)})}},N=async()=>{c(!1);try{w(await B.cancelLogin())}catch{}},P=ne(g),F=()=>{!e||g===e.service.name||P||(S.current=(async()=>{a(!0);try{C(await B.setService({name:g}))}catch(t){m.error(`Could not rename the address`,{description:X(t)}),b(e.service.name)}finally{a(!1)}})())},I=async(e,t=!1)=>{await S.current,a(!0);try{C(await B.setService(e?{enabled:!0,replace:t}:{enabled:!1}))}catch(t){let n=t instanceof h?t.body?.code:void 0;e&&n===`conflict`?u(!0):m.error(e?`Could not turn the address on`:`Could not turn the address off`,{description:X(t)})}finally{a(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read Tailscale's state: ${n}`:`Reading Tailscale's state…`});let L=ee(e)!==null,R=e.backendState===`Running`,te=e.authEnabled&&!L&&!P,H=V(e)===null,W=(0,U.jsx)(le,{state:e,onRefresh:()=>void O(),onSignIn:()=>void M(),onShowSignIn:()=>c(!0)});return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`tailscale-settings`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Reach PPM at a private https address from any device signed in to your tailnet. Nothing is opened to the internet, and PPM still asks for its password.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`tailscale-address`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`tailscale-address-switch`,className:`text-sm font-medium`,children:`Private address`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`tailscale-address-status`,children:he(e)})]}),(0,U.jsx)(`div`,{className:`flex min-h-11 shrink-0 items-center`,children:(0,U.jsx)(E,{id:`tailscale-address-switch`,checked:e.enabled,disabled:i||!e.enabled&&!te,onCheckedChange:t=>{!t&&me(e.service.url)?f(!0):I(t)}})})]}),e.enabled&&e.service.url?(0,U.jsx)(ve,{url:e.service.url}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(T,{htmlFor:`tailscale-service-name`,className:`text-xs text-muted-foreground`,children:`Address`}),(0,U.jsxs)(`div`,{className:_(`flex min-h-11 items-center rounded-md border border-input bg-background focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,P&&`border-destructive`),children:[(0,U.jsx)(`input`,{id:`tailscale-service-name`,value:g,onChange:e=>b(e.target.value.toLowerCase()),onBlur:F,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:i||e.enabled,"aria-invalid":!!P,spellCheck:!1,autoCapitalize:`none`,autoComplete:`off`,className:`w-20 min-w-20 flex-1 bg-transparent py-2 pl-3 text-sm outline-none`}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate pr-3 text-sm text-muted-foreground`,children:[`.`,e.dnsSuffix??`your-tailnet.ts.net`]})]}),(0,U.jsx)(`p`,{className:_(`text-xs`,P?`text-destructive`:`text-muted-foreground`),children:P??(e.enabled?`Turn the address off to rename it.`:`The address keeps this name when the machine is renamed.`)})]}),!e.enabled&&!e.authEnabled&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:`PPM's password is off. Turn it on first: anyone in your tailnet could otherwise open PPM.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Open General`})]}),!e.enabled&&e.authEnabled&&L&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Finish the setup below to turn it on.`}),e.enabled&&R&&!e.service.pointsAtPpm&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[(0,U.jsx)(`p`,{children:`Tailscale is not serving this address right now.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>void I(!0),disabled:i,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Apply again`})]}),e.enabled&&R&&e.service.pointsAtPpm&&!e.service.approved&&(0,U.jsx)(ye,{state:e})]}),H?(0,U.jsxs)(`details`,{className:`group`,children:[(0,U.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer items-center text-sm font-medium`,children:`Setup: every step is done`}),(0,U.jsx)(`div`,{className:`pt-2`,children:W})]}):(0,U.jsxs)(`section`,{className:`space-y-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Setup`}),W]}),(0,U.jsx)(de,{open:o,login:e.login,osUser:e.osUser,onRetry:()=>void M(),onCancel:()=>void N(),onClose:()=>c(!1)}),(0,U.jsx)(D,{open:d,title:`Turn off the address you are using?`,onClose:()=>f(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`This page is open at `,e.service.url,`. Turning the address off disconnects it; reach PPM another way to turn it back on.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>f(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{f(!1),I(!1)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Turn off`})]})]})}),(0,U.jsx)(D,{open:l,title:`Replace svc:${e.service.name}?`,onClose:()=>u(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`On this machine, svc:`,e.service.name,` already serves `,(0,U.jsx)(`code`,{className:`text-xs text-foreground`,children:e.service.target??`something else`}),`. Replacing it points the address at PPM, and what it served stops answering there.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>u(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{u(!1),I(!0,!0)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Replace`})]})]})})]})}var _e=`flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-surface-hover hover:text-foreground`;function ve({url:e,qrHint:t=`Scan with a phone that is signed in to your tailnet`}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!1),o=async()=>{await b(e)&&(r(!0),setTimeout(()=>r(!1),1500))};return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center rounded-md border border-border bg-muted pl-3`,"data-testid":`tailscale-address-url`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void o(),"aria-label":`Copy address`,title:`Copy address`,className:_e,children:n?(0,U.jsx)(u,{className:`size-4 text-success`}):(0,U.jsx)(f,{className:`size-4`})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":`Show QR code`,"aria-pressed":i,title:`Show QR code`,className:_(_e,i&&`text-foreground`),children:(0,U.jsx)(d,{className:`size-4`})}),(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open address`,title:`Open address`,className:_e,children:(0,U.jsx)(l,{className:`size-4`})})]}),i&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`rounded-lg p-3`,style:{backgroundColor:`#ffffff`,colorScheme:`light`},children:(0,U.jsx)(j,{value:e,size:168,bgColor:`#ffffff`,fgColor:`#000000`,level:`L`,style:{display:`block`}})}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]})]})}function ye({state:e}){let t=`svc:${e.service.name}`,n=e.device?.name||`this machine`,r=`"autoApprovers": {\n "services": {\n "${t}": ["${e.device?.tags[0]??`tag:ppm`}"]\n }\n}`;return(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[(0,U.jsx)(`p`,{children:e.service.defined?(0,U.jsxs)(U.Fragment,{children:[`Waiting for approval. In `,(0,U.jsx)(`b`,{children:`Services`}),`, open `,t,` and approve `,n,` under Service hosts.`]}):(0,U.jsxs)(U.Fragment,{children:[`Waiting for the service. Create `,t,` in `,(0,U.jsx)(`b`,{children:`Services`}),` (the last step below), then approve `,n,` as its host.`]})}),(0,U.jsx)(x,{href:H.services,children:`Open services`}),(0,U.jsx)(`p`,{className:`pt-1`,children:`To approve machines with this tag automatically, add this to your access controls:`}),(0,U.jsx)(M,{code:r})]})}function Z({icon:e,children:t}){return(0,U.jsxs)(`div`,{className:`flex gap-3 rounded-md border border-border bg-muted px-4 py-3`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2 text-sm leading-relaxed text-muted-foreground`,children:t})]})}var be=1e4,xe=2e3,Se=e=>e instanceof Error?e.message:String(e);function Ce(e){if(!e)return!1;try{return new URL(e).hostname===window.location.hostname}catch{return!1}}function we(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,o]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,h]=(0,z.useState)(!1),g=k(),_=(0,z.useCallback)(async()=>{try{t(await w.status()),r(null)}catch(e){r(Se(e))}},[]),b=e?e.enabled??!0:!1,x=b&&!!e&&!e.active;(0,z.useEffect)(()=>{_()},[_]),(0,z.useEffect)(()=>{let e=setInterval(()=>{document.visibilityState===`visible`&&_()},x?xe:be);return()=>clearInterval(e)},[x,_]),(0,z.useEffect)(()=>{let e=()=>{_(),g.refreshStatus()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[_,g.refreshStatus]);let S=async e=>{o(!0),t(t=>t&&{...t,enabled:e});try{await w.setEnabled(e),await _()}catch(n){t(t=>t&&{...t,enabled:!e}),m.error(e?`Could not turn the public link on`:`Could not turn the public link off`,{description:Se(n)})}finally{o(!1)}},A=async()=>{d(!1),h(!0);try{await C.disable(),m.success(`Switched to a temporary address`),await Promise.all([g.refreshStatus(),_()])}catch(e){m.error(`Could not switch to a temporary address`,{description:Se(e)})}finally{h(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read the public link's state: ${n}`:`Reading the public link's state…`});let j=g.status,M=j?.authEnabled??!0,N=j?.mode??`quick`,P=N===`named`?j?.hostname??null:null,F=!!P&&window.location.hostname===P,I=g.step.k!==`hidden`&&g.step.k!==`ask-domain`,L=N===`named`&&j?.liveMode===`quick`;return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`public-link-pane`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Open PPM from anywhere through a public https link, served by Cloudflare. Anyone who has the link reaches PPM's sign-in page, so keep the password on. For a link only your own devices can open, use Tailscale instead.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`public-link-switch-card`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`public-link-switch`,className:`text-sm font-medium`,children:`Public link`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`public-link-status`,children:b?x?`On. Waiting for Cloudflare to hand out the link…`:`On. Anyone with the link reaches PPM's sign-in page.`:`Off.`})]}),(0,U.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2`,children:[(i||x)&&(0,U.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`}),(0,U.jsx)(E,{id:`public-link-switch`,checked:b,disabled:i||!b&&!M,onCheckedChange:t=>{!t&&Ce(e.url)?l(!0):S(t)}})]})]}),b&&e.url&&(0,U.jsx)(ve,{url:e.url,qrHint:`Scan to open PPM on a phone`}),!M&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:b?`PPM's password is off while the link is on: anyone who has the link can open PPM. Turn the password on, or the link off.`:`PPM's password is off. Turn it on first: anyone with the link could otherwise open PPM.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Open General`})]})]}),(0,U.jsxs)(`section`,{className:`space-y-3`,"data-testid":`public-link-address`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Address`}),I?(0,U.jsx)(`div`,{className:`rounded-lg border border-border p-4`,children:(0,U.jsx)(O,{step:g.step,t:g})}):(0,U.jsxs)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:[(0,U.jsx)(Q,{title:`Temporary address`,inUse:N===`quick`,description:`A random trycloudflare.com address. It changes every time PPM restarts.`,action:N===`named`&&(0,U.jsx)(y,{variant:`outline`,onClick:()=>d(!0),disabled:f||F,className:`min-h-11 cursor-pointer md:min-h-9`,children:f?(0,U.jsx)(a,{className:`size-4 animate-spin`}):`Switch`})}),(0,U.jsx)(Q,{title:`Your own domain`,inUse:N===`named`,description:P?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,P]}),`. It stays the same after a restart.`]}):`One fixed address on a domain you have on Cloudflare, like ppm.example.com.`,action:N===`quick`&&M&&(0,U.jsx)(y,{onClick:g.answerYes,className:`min-h-11 cursor-pointer md:min-h-9`,children:`Set up`})})]}),!I&&N===`quick`&&!M&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on PPM's password to use your own domain.`}),!I&&F&&(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`This page is open through your domain, so switching would cut it off before the new address could show. Open PPM another way first (Tailscale, or on this machine), then switch.`}),(L||j?.tunnelWarning)&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:[L&&(0,U.jsx)(`p`,{children:`PPM could not use your domain and is on a temporary address for now.`}),j?.tunnelWarning&&(0,U.jsx)(`p`,{children:j.tunnelWarning})]})]}),(0,U.jsx)(D,{open:c,title:`Turn off the link you are using?`,onClose:()=>l(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`This page is open at `,e.url,`. Turning the link off disconnects it; reach PPM another way to turn it back on.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>l(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>{l(!1),S(!1)},className:`min-h-11 cursor-pointer md:min-h-9`,children:`Turn off`})]})]})}),(0,U.jsx)(D,{open:u,title:`Switch to a temporary address?`,onClose:()=>d(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`PPM stops answering at https://`,P,` and gets a new random address instead. Links that use your domain stop working until you set it up again.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>d(!1),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>void A(),className:`min-h-11 cursor-pointer md:min-h-9`,children:`Switch`})]})]})})]})}function Q({title:e,description:t,inUse:n,action:r}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-3`,"data-in-use":n||void 0,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem] space-y-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:e}),n&&(0,U.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary`,children:`In use`})]}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:t})]}),r&&(0,U.jsx)(`div`,{className:`shrink-0`,children:r})]})}var $=`min-h-11 cursor-pointer md:min-h-9`,Te=e=>e instanceof Error?e.message:String(e);function Ee(){let{status:e,setStatus:t,loadError:n,refresh:r,connecting:i}=P(),o=I(e,r),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,h]=(0,z.useState)(!1),g=async e=>{l(!0),t(t=>t&&{...t,enabled:e});try{let t=await N.setEnabled(e);t.applied||F(t,e?`Review address turned on`:`Review address turned off`),await r()}catch(n){t(t=>t&&{...t,enabled:!e}),m.error(e?`Could not turn the review address on`:`Could not turn the review address off`,{description:Te(n)})}finally{l(!1)}},_=async()=>{h(!1),d(!0);try{F(await N.useTemporary(),`Switched to a temporary address`),await r()}catch(e){m.error(`Could not switch to a temporary address`,{description:Te(e)})}finally{d(!1)}};if(!e)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n?`Could not read the review address's state: ${n}`:`Reading the review address's state…`});let{enabled:b,mode:x,authEnabled:S}=e,C=x===`quick`?null:e.hostname,w=e.ppmTunnel.named?e.ppmTunnel.hostname:null;return(0,U.jsxs)(`div`,{className:`space-y-6`,"data-testid":`review-links-pane`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Share design review links without making PPM public. Reviewers get an address of its own that opens the review pages and nothing else: no editor, chats, files or sign-in page answer there.`}),(0,U.jsxs)(`section`,{className:`space-y-4 rounded-lg border border-border p-4`,"data-testid":`review-links-switch-card`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsx)(T,{htmlFor:`review-links-switch`,className:`text-sm font-medium`,children:`Review address`}),(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,"data-testid":`review-links-status`,children:b?e.connected?(0,U.jsxs)(U.Fragment,{children:[`On. Review links open at `,(0,U.jsx)(`span`,{className:`break-all font-medium text-foreground`,children:e.url})]}):e.running?`On. Connecting to Cloudflare…`:`On. Starting…`:`Off.`})]}),(0,U.jsxs)(`div`,{className:`flex min-h-11 shrink-0 items-center gap-2`,children:[(c||i&&e.canApply)&&(0,U.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`}),(0,U.jsx)(E,{id:`review-links-switch`,checked:b,disabled:c||!b&&!S,onCheckedChange:e=>void g(e)})]})]}),!S&&(0,U.jsxs)(Z,{icon:(0,U.jsx)(p,{className:`size-4`}),children:[(0,U.jsx)(`p`,{children:`PPM's password is off, and share links do not open while it is. Turn it on first.`}),(0,U.jsx)(y,{variant:`outline`,onClick:()=>v(`general`),className:$,children:`Open General`})]}),b&&!e.canApply&&(0,U.jsx)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:(0,U.jsx)(`p`,{children:e.supervised?"This PPM was started before review addresses existed. Run `ppm restart` to apply these settings.":"Review addresses run under `ppm start`. This PPM was started without it, so nothing serves the address."})})]}),(0,U.jsxs)(`section`,{className:`space-y-3`,"data-testid":`review-links-address`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Address`}),o.flow?(0,U.jsx)(`div`,{className:`rounded-lg border border-border p-4`,"data-testid":`review-links-setup`,children:(0,U.jsx)(L,{setup:o,ppmHostname:w})}):(0,U.jsxs)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:[(0,U.jsx)(Q,{title:`Temporary address`,inUse:x===`quick`,description:`A random trycloudflare.com address of its own. It changes every time PPM restarts, and links already sent stop working then.`,action:x!==`quick`&&(0,U.jsx)(y,{variant:`outline`,onClick:()=>h(!0),disabled:u,className:$,children:u?(0,U.jsx)(a,{className:`size-4 animate-spin`}):`Switch`})}),(0,U.jsx)(Q,{title:`Your domain, its own tunnel`,inUse:x===`named`,description:x===`named`&&C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,C]}),`, on a Cloudflare tunnel of its own.`]}):`A fixed address like share.example.com, on a Cloudflare tunnel of its own. PPM's public link is not involved.`,action:S&&(0,U.jsx)(y,{variant:x===`named`?`outline`:`default`,onClick:()=>o.begin(`named`),className:$,"data-testid":`review-links-setup-named`,children:x===`named`?`Change`:`Set up`})}),(0,U.jsx)(Q,{title:`Your domain, on PPM's tunnel`,inUse:x===`shared`,description:x===`shared`&&C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`break-all font-medium text-foreground`,children:[`https://`,C]}),`, on the tunnel of PPM's public link. PPM's own address answers only while that link is on.`]}):`A fixed address like share.example.com, added to the tunnel PPM's public link uses. PPM's own address answers only while that link is on.`,action:S&&e.ppmTunnel.named&&(0,U.jsx)(y,{variant:x===`shared`?`outline`:`default`,onClick:()=>o.begin(`shared`),className:$,"data-testid":`review-links-setup-shared`,children:x===`shared`?`Change`:`Set up`})})]}),!o.flow&&!S&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on PPM's password to use your own domain.`}),!o.flow&&S&&!e.ppmTunnel.named&&(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`To use PPM's tunnel, set your domain up under Public link first. Its link can stay off.`}),b&&e.warning&&(0,U.jsx)(Z,{icon:(0,U.jsx)(s,{className:`size-4 text-warning`}),children:(0,U.jsx)(`p`,{children:e.warning})})]}),(0,U.jsx)(D,{open:f,title:`Switch to a temporary address?`,onClose:()=>h(!1),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[`Review links stop opening at https://`,C,` and get a new random address instead. Links already sent with your domain stop working until you set it up again.`]}),(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-2 md:flex-row md:justify-end`,children:[(0,U.jsx)(y,{variant:`outline`,onClick:()=>h(!1),className:$,children:`Cancel`}),(0,U.jsx)(y,{variant:`destructive`,onClick:()=>void _(),className:$,children:`Switch`})]})]})})]})}function De(){let e=t(e=>e.minimalMode),n=A(e=>e.tab),r=e&&n===`review-links`?`tailscale`:n,i=A(e=>e.setTab);return(0,U.jsxs)(`div`,{className:`space-y-5`,"data-testid":`remote-access`,"data-tab":r,children:[(0,U.jsx)(`div`,{role:`tablist`,"aria-label":`Remote access`,className:`flex gap-1 overflow-x-auto border-b border-border/50`,children:S.filter(t=>!e||t.id!==`review-links`).map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r===e.id,"data-testid":`remote-access-tab-${e.id}`,onClick:()=>i(e.id),className:_(`flex min-h-11 shrink-0 cursor-pointer items-center whitespace-nowrap rounded-t px-3 text-sm transition-colors md:min-h-9 md:text-xs`,r===e.id?`border-b-2 border-primary font-medium text-primary`:`text-text-subtle hover:text-text-secondary`),children:e.label},e.id))}),(0,U.jsxs)(`div`,{role:`tabpanel`,children:[r===`tailscale`&&(0,U.jsx)(ge,{}),r===`public-link`&&(0,U.jsx)(we,{}),r===`review-links`&&(0,U.jsx)(Ee,{})]})]})}export{De as RemoteAccessSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{X as t,t as n}from"./settings-store-DirmJxtu.js";import{D as r,E as i}from"./vendor-markdown-26eoXJk7.js";import{Kr as a,Q as o,Z as s,kr as c,pi as l}from"./icons-CpR5Vw3J.js";import{a as u,r as d}from"./api-client-DSCscZEd.js";import{n as f}from"./utils-DMiycH3O.js";import{t as p}from"./control-size-DFdAJqoq.js";import{t as m}from"./ws-auth-BoXvat-e.js";import{vn as h}from"./index-4hOd9rdZ.js";import{n as g}from"./use-h264-canvas-decoder-CYE63fHm.js";import{r as _}from"./run-in-terminal-Bhp0sfyb.js";import{i as v,s as y}from"./remote-desktop-coords-BI7h18Lu.js";import{i as b,n as x,r as S,t as C}from"./remote-desktop-recording-CmBExjTO.js";function ee(e,t,n=`8081`){let r=m(`/ws/remote-desktop`),i=e.protocol===`https:`?`wss:`:`ws:`;return t&&e.protocol!==`https:`?`ws://${e.hostname}:${n}${r}`:`${i}//${e.host}${r}`}var w=e(r(),1),T=400,E=25,D=6e3;function O(e,{onFailure:t}={}){let[n,r]=(0,w.useState)(`idle`),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)({width:0,height:0}),c=(0,w.useRef)(null),l=(0,w.useRef)(null),d=(0,w.useRef)(null),f=(0,w.useRef)(0),p=(0,w.useRef)(0),m=(0,w.useRef)(null),h=(0,w.useRef)(null),g=(0,w.useRef)(0),_=(0,w.useRef)(t);_.current=t;let v=(0,w.useCallback)(()=>{g.current+=1,m.current&&=(clearInterval(m.current),null),h.current&&=(clearTimeout(h.current),null);try{c.current?.close()}catch{}c.current=null;let e=l.current;e&&(e.srcObject=null,e.remove(),l.current=null),d.current=null},[]),y=(0,w.useCallback)(()=>{v(),r(`idle`),a(null)},[v]);return{status:n,errorMessage:i,start:(0,w.useCallback)(t=>{v();let n=g.current,i=()=>n!==g.current,o=!1,y=(e,t=`error`)=>{i()||o||(o=!0,r(t),a(e),_.current?.())};if(typeof RTCPeerConnection>`u`){y(`This browser has no WebRTC support.`,`unsupported`);return}let b=document.createElement(`video`);b.autoplay=!0,b.muted=!0,b.playsInline=!0,b.setAttribute(`aria-hidden`,`true`),b.style.cssText=`position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none`,document.body.appendChild(b),l.current=b;let x=()=>{if(i())return;let t=e.current;t&&b.videoWidth>0&&((t.width!==b.videoWidth||t.height!==b.videoHeight)&&(t.width=b.videoWidth,t.height=b.videoHeight,s({width:b.videoWidth,height:b.videoHeight})),d.current||=t.getContext(`2d`),d.current?.drawImage(b,0,0,t.width,t.height),f.current+=1),S()},S=()=>typeof b.requestVideoFrameCallback==`function`?b.requestVideoFrameCallback(()=>x()):requestAnimationFrame(()=>x()),C=new RTCPeerConnection({iceServers:[]});c.current=C,C.addTransceiver(`video`,{direction:`recvonly`}),C.ontrack=e=>{let t=new MediaStream;t.addTrack(e.track),b.srcObject=t,b.play().catch(()=>{}),S()},C.onconnectionstatechange=()=>{i()||(C.connectionState===`connected`&&(h.current&&=(clearTimeout(h.current),null),r(`ready`),a(null)),C.connectionState===`failed`&&y(`The WebRTC connection failed.`))},m.current=setInterval(async()=>{if(!(i()||!c.current))try{(await c.current.getStats()).forEach(e=>{e.type===`inbound-rtp`&&e.kind===`video`&&(p.current=e.bytesReceived??0)})}catch{}},1e3),(async()=>{try{if(await C.setLocalDescription(await C.createOffer()),await k(C),i())return;let e=u(),n=await A(t,C.localDescription.sdp,e,i);if(i())return;if(!n){y(`The host's WebRTC relay never produced a stream.`);return}if(await C.setRemoteDescription({type:`answer`,sdp:n}),i()||C.connectionState===`connected`)return;h.current=setTimeout(()=>{h.current=null,C.connectionState!==`connected`&&y(`The WebRTC connection did not come up.`)},D)}catch(e){y(e.message)}})()},[e,v]),stop:y,getFrameCount:()=>f.current,getTotalBytes:()=>p.current,frameSize:o}}function k(e){return e.iceGatheringState===`complete`?Promise.resolve():new Promise(t=>{let n=()=>{e.iceGatheringState===`complete`&&(e.removeEventListener(`icegatheringstatechange`,n),t())};e.addEventListener(`icegatheringstatechange`,n),setTimeout(()=>{e.removeEventListener(`icegatheringstatechange`,n),t()},2e3)})}async function A(e,t,n,r){for(let i=0;i<E;i++){if(r())return null;let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/sdp`,...n?{Authorization:`Bearer ${n}`}:{},"x-ppm-client":`web`},body:t});if(i.ok)return await i.text();if(i.status!==404&&i.status!==502)throw Error(`the host refused the WebRTC handshake (${i.status})`);await new Promise(e=>setTimeout(e,T))}return null}var j=120,M=400;function te(){let e=(0,w.useRef)(null),t=(0,w.useRef)(null),n=(0,w.useRef)(null),r=(0,w.useRef)(0),i=(0,w.useRef)(0),[a,o]=(0,w.useState)(`idle`),s=(0,w.useCallback)(()=>{try{t.current?.close()}catch{}t.current=null,n.current=null;let a=e.current;e.current=null,a&&a.close().catch(()=>{}),r.current=0,i.current=0,o(e=>e===`unsupported`?e:`idle`)},[]),c=(0,w.useCallback)(t=>{let i=e.current;if(!i){t.close();return}let a=t.numberOfFrames,o=t.numberOfChannels,s=i.createBuffer(o,a,t.sampleRate);for(let e=0;e<o;e++){let n=new Float32Array(a);t.copyTo(n,{planeIndex:e,format:`f32-planar`}),s.copyToChannel(n,e)}t.close();let c=i.currentTime,l=(r.current-c)*1e3;(l<0||l>M)&&(r.current=c+j/1e3);let u=i.createBufferSource();u.buffer=s,u.connect(i.destination),n.current&&u.connect(n.current),u.start(r.current),r.current+=s.duration},[]),l=(0,w.useCallback)(async(a,l)=>{if(typeof AudioDecoder>`u`||typeof AudioContext>`u`){o(`unsupported`);return}s();let u=new AudioContext({sampleRate:l,latencyHint:`interactive`});e.current=u,u.state===`suspended`&&await u.resume().catch(()=>{}),n.current=u.createMediaStreamDestination();let d=new AudioDecoder({output:c,error:()=>{try{t.current?.reset()}catch{}}});try{d.configure({codec:`opus`,sampleRate:l,numberOfChannels:a})}catch{o(`unsupported`);return}t.current=d,r.current=0,i.current=0,o(`playing`)},[c,s]),u=(0,w.useCallback)(e=>{let n=t.current;if(!n||n.state!==`configured`)return;let r=i.current;i.current+=2e4;try{n.decode(new EncodedAudioChunk({type:`key`,timestamp:r,data:e}))}catch{}},[]),d=(0,w.useCallback)(()=>n.current?n.current.stream.getAudioTracks():[],[]);return(0,w.useEffect)(()=>()=>s(),[s]),{status:a,configure:l,decodePacket:u,reset:s,getTracks:d}}var N=i();function ne(e){if(!e||typeof e!=`object`)return null;let t=e;return t.reason===`elevated-window`?{app:typeof t.app==`string`&&t.app?t.app:null}:null}function P(e){return`Windows is ignoring input: ${e??`the window in front`} runs as administrator. Bring another window to the front on the PC.`}function F({blocked:e,positionClassName:t=`absolute inset-x-0 top-2 mx-auto w-fit max-w-[92%]`}){let[n,r]=(0,w.useState)(null);return(0,w.useEffect)(()=>{e||r(null)},[e]),!e||n&&n.app===e.app?null:(0,N.jsxs)(`div`,{role:`status`,className:f(`z-40 flex items-center gap-2 rounded-lg border border-amber-300/30 bg-black/85 px-3 py-2 text-xs text-amber-50 shadow-lg`,t),"data-testid":`remote-desktop-input-blocked`,children:[(0,N.jsx)(c,{className:`size-4 shrink-0 text-amber-300`}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:P(e.app)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(e),"aria-label":`Dismiss`,className:f(`inline-flex shrink-0 items-center justify-center rounded text-white/60 hover:bg-white/10 hover:text-white`,p),"data-testid":`remote-desktop-input-blocked-dismiss`,children:(0,N.jsx)(l,{className:`size-3.5`})})]})}var re=5e3,ie=2,I=`ppm.remoteDesktop.webrtcUnusable`;function ae(){try{return sessionStorage.getItem(I)===`1`}catch{return!1}}function oe(){try{sessionStorage.setItem(I,`1`)}catch{}}function L(e,{displayId:r}={}){let i=(0,w.useRef)(null),a=(0,w.useRef)(0),[o,s]=(0,w.useState)(`connecting`),[c,l]=(0,w.useState)(null),[u,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(()=>({preset:t(n.getState().remoteDesktopQuality)??`balanced`,held:1})),h=(0,w.useRef)(t(n.getState().remoteDesktopQuality)),[_,v]=(0,w.useState)(null),b=(0,w.useRef)(null),x=n(e=>e.remoteDesktopShowCursor),S=n(e=>e.remoteDesktopClipboardSync),C=(0,w.useRef)(x),T=(0,w.useRef)(S);(0,w.useEffect)(()=>{C.current=x},[x]),(0,w.useEffect)(()=>{T.current=S},[S]);let E=(0,w.useRef)(n.getState().remoteDesktopCodec),[D,k]=(0,w.useState)(E.current),A=g(e),j=(0,w.useRef)(!1),M=O(e,{onFailure:(0,w.useCallback)(()=>{typeof VideoDecoder>`u`||j.current||(j.current=!0,oe(),f(e=>e+1))},[])}),[N,P]=(0,w.useState)(`websocket`),F=te(),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(null),[W,G]=(0,w.useState)(null),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useCallback)(e=>{let t=i.current;t?.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),Z=(0,w.useCallback)(e=>{let n=t(e.preset);n&&m({preset:n,held:typeof e.held==`number`&&e.held>0&&e.held<1?e.held:1})},[]),Q=(0,w.useCallback)(e=>{if(e!==`custom`)return{type:`quality`,preset:e};let t=n.getState();return{type:`quality`,preset:`custom`,percent:t.remoteDesktopCustomQualityPercent,fps:t.remoteDesktopCustomFps}},[]),se=(0,w.useCallback)(e=>{h.current=e,n.getState().setRemoteDesktopQuality(e),X(Q(e))},[Q,X]),ce=(0,w.useCallback)((e,t)=>{let r=n.getState();r.setRemoteDesktopCustomQuality(e,t),r.setRemoteDesktopQuality(`custom`),h.current=`custom`,X(Q(`custom`))},[Q,X]),le=(0,w.useCallback)(e=>{V(null),X({type:`privacy`,enabled:e})},[X]),ue=(0,w.useCallback)(e=>{L(e),e||F.reset(),X({type:`audio`,enabled:e})},[F,X]),de=(0,w.useCallback)(e=>{E.current=e,n.getState().setRemoteDesktopCodec(e),k(e),e&&X({type:`codec`,encoder:e})},[X]),fe=(0,w.useCallback)(e=>{q(null),X({type:`resolution`,modeId:e})},[X]),pe=(0,w.useCallback)(e=>{C.current=e,n.getState().setRemoteDesktopShowCursor(e),X({type:`cursor`,show:e})},[X]),$=(0,w.useCallback)((e,t,n=!1)=>{X({type:`clipboard`,text:e,paste:t,shift:n})},[X]),me=(0,w.useCallback)(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{b.current=null,X({type:`clipboardRead`})},350)},[X]),he=(0,w.useCallback)(()=>v(null),[]);(0,w.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]),(0,w.useEffect)(()=>{let e=!1,t=null;s(`connecting`),l(null),P(`websocket`),z(!1),V(null),Y(null),a.current=0,A.reset(),(async()=>{let n;try{n=(await d.post(`/api/remote-desktop/session`)).nonce}catch(t){e||(s(`error`),l(t.message));return}if(e)return;let o=ee(window.location,!1,void 0),c=new WebSocket(o);c.binaryType=`arraybuffer`,i.current=c,c.onopen=()=>{c.send(JSON.stringify({type:`auth`,nonce:n,...r?{displayId:r}:{},cursor:C.current,...E.current?{codec:E.current}:{},webrtc:!(j.current||ae())})),h.current&&c.send(JSON.stringify(Q(h.current))),t=setInterval(()=>X({type:`ping`}),re)},c.onmessage=t=>{if(typeof t.data==`string`){let n;try{n=JSON.parse(t.data)}catch{return}if(n.type===`webrtc`&&typeof n.whepPath==`string`)P(`webrtc`),Z(n),k(typeof n.encoder==`string`?n.encoder:null),M.start(n.whepPath),s(`streaming`);else if(n.type===`config`&&typeof n.codec==`string`)Z(n),k(typeof n.encoder==`string`?n.encoder:null),A.configure(n.codec).then(()=>{e||s(`streaming`)});else if(n.type===`quality`)Z(n);else if(n.type===`codec`)k(typeof n.encoder==`string`?n.encoder:null);else if(n.type===`resolution`)U(typeof n.modeId==`string`?n.modeId:null),G(typeof n.original==`string`?n.original:null),q(null);else if(n.type===`resolutionError`)q(typeof n.message==`string`?n.message:`The host refused the mode.`);else if(n.type===`inputBlocked`)Y(ne(n.blocked));else if(n.type===`privacy`)z(n.enabled===!0),V(typeof n.reason==`string`?n.reason:null);else if(n.type===`audio`){let e=n.enabled===!0;if(L(e),!e){F.reset();return}let t=typeof n.channels==`number`?n.channels:2,r=typeof n.sampleRate==`number`?n.sampleRate:48e3;F.configure(t,r)}else if(n.type===`clipboard`&&typeof n.text==`string`){if(!T.current)return;let t=n.text;y(t).then(n=>{!n&&!e&&v(t)})}else n.type===`error`&&(s(`error`),l(typeof n.message==`string`?n.message:`Server error`));return}let n=new Uint8Array(t.data);if(!(n.length<1)){if(a.current+=n.length,n[0]===ie){F.decodePacket(n.subarray(1));return}A.decodeAccessUnit(n.subarray(1),n[0]===1)}},c.onerror=()=>{e||(s(`error`),l(`WebSocket error`))},c.onclose=()=>{e||s(e=>e===`error`?e:`closed`)}})();let n=()=>{if(document.hidden||e)return;let t=i.current;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`ping`})):f(e=>e+1)};return document.addEventListener(`visibilitychange`,n),()=>{e=!0,document.removeEventListener(`visibilitychange`,n),t&&clearInterval(t);try{i.current?.close()}catch{}i.current=null;try{A.reset()}catch{}try{M.stop()}catch{}try{F.reset()}catch{}}},[u,r]);let ge=(0,w.useCallback)(()=>f(e=>e+1),[]),_e=(0,w.useCallback)(()=>N===`webrtc`?M.getTotalBytes():a.current,[N,M]);return{connState:o,errorMessage:c,transport:N,decoderStatus:N===`webrtc`?M.status:A.status,decoderErrorMessage:N===`webrtc`?M.errorMessage:A.errorMessage,sendMessage:X,reconnect:ge,getTotalBytes:_e,getFrameCount:N===`webrtc`?M.getFrameCount:A.getFrameCount,frameSize:N===`webrtc`?M.frameSize:A.frameSize,quality:p,setQuality:se,setCustomQuality:ce,showCursor:x,setShowCursor:pe,codec:D,setCodec:de,audioOn:I,setAudioOn:ue,getAudioTracks:F.getTracks,privacyOn:R,privacyError:B,setPrivacyOn:le,hostModeId:H,hostOriginalModeId:W,resolutionError:K,inputBlocked:J,setHostMode:fe,pendingHostClipboard:_,clearHostClipboard:he,sendClipboard:$,requestHostClipboard:me}}function R(e){let t=new Map;for(let n of e){if(n.width<=0||n.height<=0)continue;let e=`${n.width}x${n.height}`,r=t.get(e);(!r||z(n,r))&&t.set(e,n)}return[...t.values()].sort((e,t)=>t.width*t.height-e.width*e.height||t.refresh-e.refresh).map(e=>({id:e.id,width:e.width,height:e.height,refresh:e.refresh,current:e.current,preferred:e.preferred}))}function z(e,t){return e.current===t.current?e.preferred===t.preferred?e.refresh>t.refresh:e.preferred:e.current}function B(e,t,n){if(!t||t.width<=0||t.height<=0)return null;let r=e.filter(e=>e.width===t.width&&e.height===t.height);if(r.length===0)return null;let i=e.find(e=>e.id===n)??e.find(e=>e.current)??null;return i&&i.width===t.width&&i.height===t.height?null:r.reduce((e,t)=>z(t,e)?t:e)}function V(){if(typeof window>`u`||!window.screen)return null;let e=Math.round(window.screen.width),t=Math.round(window.screen.height);return e>0&&t>0?{width:e,height:t}:null}function H(e){let t=`${e.width} × ${e.height}`;return e.refresh>0?`${t} · ${e.refresh} Hz`:t}function U(e,t){let n=(0,w.useRef)(null),r=(0,w.useRef)([]),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(0),c=(0,w.useRef)(null);c.current===null&&(c.current=S());let l=(0,w.useCallback)(()=>{n.current?.stop()},[]),u=(0,w.useCallback)(()=>{let i=e.current,o=c.current;if(!i||!o||n.current)return;let l=i.captureStream();for(let e of t?.()??[])l.addTrack(e);let u;try{u=new MediaRecorder(l,{mimeType:o})}catch{return}r.current=[],u.ondataavailable=e=>{e.data.size>0&&r.current.push(e.data)},u.onstop=()=>{let e=new Blob(r.current,{type:o});r.current=[],n.current=null,a(!1),s(0),e.size>0&&C(e,b(x(o)))},u.start(1e3),n.current=u,a(!0),s(0)},[e,t]),d=(0,w.useCallback)(()=>{n.current?l():u()},[u,l]);return(0,w.useEffect)(()=>{if(!i)return;let e=Date.now(),t=setInterval(()=>{let t=Date.now()-e;s(Math.floor(t/1e3)),t>=72e5&&l()},1e3);return()=>clearInterval(t)},[i,l]),(0,w.useEffect)(()=>()=>{n.current?.stop()},[]),{recording:i,elapsedSec:o,supported:c.current!==null,toggle:d}}var W={fps:0,kbps:0};function G(e,t){let n=t.atMs-e.atMs;if(n<=0)return W;let r=n/1e3,i=Math.max(0,t.frameCount-e.frameCount),a=Math.max(0,t.totalBytes-e.totalBytes);return{fps:i/r,kbps:a/1024/r}}var K=500;function q({canvasRef:e,getFrameCount:t,getTotalBytes:r,positionClassName:i=`left-1 top-1`}){let a=n(e=>e.remoteDesktopStatsVisible),[o,s]=(0,w.useState)({fps:0,kbps:0,width:0,height:0}),c=(0,w.useRef)({frameCount:0,totalBytes:0,atMs:0});return(0,w.useEffect)(()=>{if(!a)return;c.current={frameCount:t(),totalBytes:r(),atMs:performance.now()};let n=setInterval(()=>{let n={frameCount:t(),totalBytes:r(),atMs:performance.now()},{fps:i,kbps:a}=G(c.current,n);c.current=n;let o=e.current;s({fps:i,kbps:a,width:o?.width??0,height:o?.height??0})},K);return()=>clearInterval(n)},[a,e,t,r]),a?(0,N.jsxs)(`div`,{className:`pointer-events-none absolute z-40 rounded bg-black/60 px-1.5 py-0.5 font-mono text-[10px] text-white/80 ${i}`,"data-testid":`remote-desktop-stats-overlay`,children:[Math.round(o.fps),` fps · `,Math.round(o.kbps),` KB/s · `,o.width,`×`,o.height]}):null}function J(){let{caps:e}=h(!1),t=e?.displays??[],[n,r]=(0,w.useState)(void 0),i=t.find(e=>e.id===n)??t.find(e=>e.primary)??t[0];return{displays:t,displayId:n,current:i,select:r,next:(0,w.useCallback)(()=>{t.length<2||r(t[(t.findIndex(e=>e.id===i?.id)+1)%t.length]?.id)},[t,i])}}function Y({pendingText:e,onDismiss:t,missingToolAction:n,onDismissMissingTool:r,positionClassName:i=`absolute bottom-2 left-1/2 max-w-[92%] -translate-x-1/2`}){let[c,l]=(0,w.useState)(!1);return e===null?n==null?null:(0,N.jsxs)(X,{onDismiss:r??(()=>{}),testId:`remote-desktop-clipboard-missing-tool`,positionClassName:i,children:[(0,N.jsx)(s,{className:`size-4 shrink-0 text-amber-300`}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:`The host has no clipboard tool installed.`}),n.kind===`terminal`&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>_(n.command),title:n.command,className:`inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,children:[(0,N.jsx)(a,{className:`size-3.5`}),` `,n.label]})]}):(0,N.jsxs)(X,{onDismiss:t,testId:`remote-desktop-clipboard-pending`,positionClassName:i,children:[(0,N.jsx)(o,{className:`size-4 shrink-0 text-emerald-400`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c?`Could not copy — select the text manually:`:`Copied on the host:`,(0,N.jsx)(`span`,{className:`ml-1 text-white/60`,children:Z(e)})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{v(e)?t():l(!0)},className:`min-h-8 shrink-0 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,"data-testid":`remote-desktop-clipboard-copy`,children:`Copy here`})]})}function X({children:e,onDismiss:t,testId:n,positionClassName:r}){return(0,N.jsxs)(`div`,{className:f(`z-50 flex items-center gap-2 rounded-lg border border-white/10 bg-black/85 px-3 py-2 text-xs text-white shadow-lg`,r),"data-testid":n,children:[e,(0,N.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Dismiss`,className:`flex size-8 shrink-0 items-center justify-center rounded text-white/60 hover:bg-white/10 hover:text-white`,children:(0,N.jsx)(l,{className:`size-3.5`})})]})}function Z(e){let t=e.replace(/\s+/g,` `).trim();return t.length>60?`${t.slice(0,60)}…`:t}export{B as a,H as c,U as i,L as l,J as n,V as o,q as r,R as s,Y as t,F as u};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{X as t,t as n}from"./settings-store-DirmJxtu.js";import{D as r,E as i}from"./vendor-markdown-26eoXJk7.js";import{Kr as a,Q as o,Z as s,kr as c,pi as l}from"./icons-CpR5Vw3J.js";import{a as u,r as d}from"./api-client-DSCscZEd.js";import{n as f}from"./utils-DMiycH3O.js";import{t as p}from"./control-size-DFdAJqoq.js";import{t as m}from"./ws-auth-BoXvat-e.js";import{vn as h}from"./index-CToe9paM.js";import{n as g}from"./use-h264-canvas-decoder-CYE63fHm.js";import{r as _}from"./run-in-terminal-Bhp0sfyb.js";import{i as v,s as y}from"./remote-desktop-coords-BI7h18Lu.js";import{i as b,n as x,r as S,t as C}from"./remote-desktop-recording-CmBExjTO.js";function ee(e,t,n=`8081`){let r=m(`/ws/remote-desktop`),i=e.protocol===`https:`?`wss:`:`ws:`;return t&&e.protocol!==`https:`?`ws://${e.hostname}:${n}${r}`:`${i}//${e.host}${r}`}var w=e(r(),1),T=400,E=25,D=6e3;function O(e,{onFailure:t}={}){let[n,r]=(0,w.useState)(`idle`),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)({width:0,height:0}),c=(0,w.useRef)(null),l=(0,w.useRef)(null),d=(0,w.useRef)(null),f=(0,w.useRef)(0),p=(0,w.useRef)(0),m=(0,w.useRef)(null),h=(0,w.useRef)(null),g=(0,w.useRef)(0),_=(0,w.useRef)(t);_.current=t;let v=(0,w.useCallback)(()=>{g.current+=1,m.current&&=(clearInterval(m.current),null),h.current&&=(clearTimeout(h.current),null);try{c.current?.close()}catch{}c.current=null;let e=l.current;e&&(e.srcObject=null,e.remove(),l.current=null),d.current=null},[]),y=(0,w.useCallback)(()=>{v(),r(`idle`),a(null)},[v]);return{status:n,errorMessage:i,start:(0,w.useCallback)(t=>{v();let n=g.current,i=()=>n!==g.current,o=!1,y=(e,t=`error`)=>{i()||o||(o=!0,r(t),a(e),_.current?.())};if(typeof RTCPeerConnection>`u`){y(`This browser has no WebRTC support.`,`unsupported`);return}let b=document.createElement(`video`);b.autoplay=!0,b.muted=!0,b.playsInline=!0,b.setAttribute(`aria-hidden`,`true`),b.style.cssText=`position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none`,document.body.appendChild(b),l.current=b;let x=()=>{if(i())return;let t=e.current;t&&b.videoWidth>0&&((t.width!==b.videoWidth||t.height!==b.videoHeight)&&(t.width=b.videoWidth,t.height=b.videoHeight,s({width:b.videoWidth,height:b.videoHeight})),d.current||=t.getContext(`2d`),d.current?.drawImage(b,0,0,t.width,t.height),f.current+=1),S()},S=()=>typeof b.requestVideoFrameCallback==`function`?b.requestVideoFrameCallback(()=>x()):requestAnimationFrame(()=>x()),C=new RTCPeerConnection({iceServers:[]});c.current=C,C.addTransceiver(`video`,{direction:`recvonly`}),C.ontrack=e=>{let t=new MediaStream;t.addTrack(e.track),b.srcObject=t,b.play().catch(()=>{}),S()},C.onconnectionstatechange=()=>{i()||(C.connectionState===`connected`&&(h.current&&=(clearTimeout(h.current),null),r(`ready`),a(null)),C.connectionState===`failed`&&y(`The WebRTC connection failed.`))},m.current=setInterval(async()=>{if(!(i()||!c.current))try{(await c.current.getStats()).forEach(e=>{e.type===`inbound-rtp`&&e.kind===`video`&&(p.current=e.bytesReceived??0)})}catch{}},1e3),(async()=>{try{if(await C.setLocalDescription(await C.createOffer()),await k(C),i())return;let e=u(),n=await A(t,C.localDescription.sdp,e,i);if(i())return;if(!n){y(`The host's WebRTC relay never produced a stream.`);return}if(await C.setRemoteDescription({type:`answer`,sdp:n}),i()||C.connectionState===`connected`)return;h.current=setTimeout(()=>{h.current=null,C.connectionState!==`connected`&&y(`The WebRTC connection did not come up.`)},D)}catch(e){y(e.message)}})()},[e,v]),stop:y,getFrameCount:()=>f.current,getTotalBytes:()=>p.current,frameSize:o}}function k(e){return e.iceGatheringState===`complete`?Promise.resolve():new Promise(t=>{let n=()=>{e.iceGatheringState===`complete`&&(e.removeEventListener(`icegatheringstatechange`,n),t())};e.addEventListener(`icegatheringstatechange`,n),setTimeout(()=>{e.removeEventListener(`icegatheringstatechange`,n),t()},2e3)})}async function A(e,t,n,r){for(let i=0;i<E;i++){if(r())return null;let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/sdp`,...n?{Authorization:`Bearer ${n}`}:{},"x-ppm-client":`web`},body:t});if(i.ok)return await i.text();if(i.status!==404&&i.status!==502)throw Error(`the host refused the WebRTC handshake (${i.status})`);await new Promise(e=>setTimeout(e,T))}return null}var j=120,M=400;function te(){let e=(0,w.useRef)(null),t=(0,w.useRef)(null),n=(0,w.useRef)(null),r=(0,w.useRef)(0),i=(0,w.useRef)(0),[a,o]=(0,w.useState)(`idle`),s=(0,w.useCallback)(()=>{try{t.current?.close()}catch{}t.current=null,n.current=null;let a=e.current;e.current=null,a&&a.close().catch(()=>{}),r.current=0,i.current=0,o(e=>e===`unsupported`?e:`idle`)},[]),c=(0,w.useCallback)(t=>{let i=e.current;if(!i){t.close();return}let a=t.numberOfFrames,o=t.numberOfChannels,s=i.createBuffer(o,a,t.sampleRate);for(let e=0;e<o;e++){let n=new Float32Array(a);t.copyTo(n,{planeIndex:e,format:`f32-planar`}),s.copyToChannel(n,e)}t.close();let c=i.currentTime,l=(r.current-c)*1e3;(l<0||l>M)&&(r.current=c+j/1e3);let u=i.createBufferSource();u.buffer=s,u.connect(i.destination),n.current&&u.connect(n.current),u.start(r.current),r.current+=s.duration},[]),l=(0,w.useCallback)(async(a,l)=>{if(typeof AudioDecoder>`u`||typeof AudioContext>`u`){o(`unsupported`);return}s();let u=new AudioContext({sampleRate:l,latencyHint:`interactive`});e.current=u,u.state===`suspended`&&await u.resume().catch(()=>{}),n.current=u.createMediaStreamDestination();let d=new AudioDecoder({output:c,error:()=>{try{t.current?.reset()}catch{}}});try{d.configure({codec:`opus`,sampleRate:l,numberOfChannels:a})}catch{o(`unsupported`);return}t.current=d,r.current=0,i.current=0,o(`playing`)},[c,s]),u=(0,w.useCallback)(e=>{let n=t.current;if(!n||n.state!==`configured`)return;let r=i.current;i.current+=2e4;try{n.decode(new EncodedAudioChunk({type:`key`,timestamp:r,data:e}))}catch{}},[]),d=(0,w.useCallback)(()=>n.current?n.current.stream.getAudioTracks():[],[]);return(0,w.useEffect)(()=>()=>s(),[s]),{status:a,configure:l,decodePacket:u,reset:s,getTracks:d}}var N=i();function ne(e){if(!e||typeof e!=`object`)return null;let t=e;return t.reason===`elevated-window`?{app:typeof t.app==`string`&&t.app?t.app:null}:null}function P(e){return`Windows is ignoring input: ${e??`the window in front`} runs as administrator. Bring another window to the front on the PC.`}function F({blocked:e,positionClassName:t=`absolute inset-x-0 top-2 mx-auto w-fit max-w-[92%]`}){let[n,r]=(0,w.useState)(null);return(0,w.useEffect)(()=>{e||r(null)},[e]),!e||n&&n.app===e.app?null:(0,N.jsxs)(`div`,{role:`status`,className:f(`z-40 flex items-center gap-2 rounded-lg border border-amber-300/30 bg-black/85 px-3 py-2 text-xs text-amber-50 shadow-lg`,t),"data-testid":`remote-desktop-input-blocked`,children:[(0,N.jsx)(c,{className:`size-4 shrink-0 text-amber-300`}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:P(e.app)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(e),"aria-label":`Dismiss`,className:f(`inline-flex shrink-0 items-center justify-center rounded text-white/60 hover:bg-white/10 hover:text-white`,p),"data-testid":`remote-desktop-input-blocked-dismiss`,children:(0,N.jsx)(l,{className:`size-3.5`})})]})}var re=5e3,ie=2,I=`ppm.remoteDesktop.webrtcUnusable`;function ae(){try{return sessionStorage.getItem(I)===`1`}catch{return!1}}function oe(){try{sessionStorage.setItem(I,`1`)}catch{}}function L(e,{displayId:r}={}){let i=(0,w.useRef)(null),a=(0,w.useRef)(0),[o,s]=(0,w.useState)(`connecting`),[c,l]=(0,w.useState)(null),[u,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(()=>({preset:t(n.getState().remoteDesktopQuality)??`balanced`,held:1})),h=(0,w.useRef)(t(n.getState().remoteDesktopQuality)),[_,v]=(0,w.useState)(null),b=(0,w.useRef)(null),x=n(e=>e.remoteDesktopShowCursor),S=n(e=>e.remoteDesktopClipboardSync),C=(0,w.useRef)(x),T=(0,w.useRef)(S);(0,w.useEffect)(()=>{C.current=x},[x]),(0,w.useEffect)(()=>{T.current=S},[S]);let E=(0,w.useRef)(n.getState().remoteDesktopCodec),[D,k]=(0,w.useState)(E.current),A=g(e),j=(0,w.useRef)(!1),M=O(e,{onFailure:(0,w.useCallback)(()=>{typeof VideoDecoder>`u`||j.current||(j.current=!0,oe(),f(e=>e+1))},[])}),[N,P]=(0,w.useState)(`websocket`),F=te(),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(null),[W,G]=(0,w.useState)(null),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useCallback)(e=>{let t=i.current;t?.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),Z=(0,w.useCallback)(e=>{let n=t(e.preset);n&&m({preset:n,held:typeof e.held==`number`&&e.held>0&&e.held<1?e.held:1})},[]),Q=(0,w.useCallback)(e=>{if(e!==`custom`)return{type:`quality`,preset:e};let t=n.getState();return{type:`quality`,preset:`custom`,percent:t.remoteDesktopCustomQualityPercent,fps:t.remoteDesktopCustomFps}},[]),se=(0,w.useCallback)(e=>{h.current=e,n.getState().setRemoteDesktopQuality(e),X(Q(e))},[Q,X]),ce=(0,w.useCallback)((e,t)=>{let r=n.getState();r.setRemoteDesktopCustomQuality(e,t),r.setRemoteDesktopQuality(`custom`),h.current=`custom`,X(Q(`custom`))},[Q,X]),le=(0,w.useCallback)(e=>{V(null),X({type:`privacy`,enabled:e})},[X]),ue=(0,w.useCallback)(e=>{L(e),e||F.reset(),X({type:`audio`,enabled:e})},[F,X]),de=(0,w.useCallback)(e=>{E.current=e,n.getState().setRemoteDesktopCodec(e),k(e),e&&X({type:`codec`,encoder:e})},[X]),fe=(0,w.useCallback)(e=>{q(null),X({type:`resolution`,modeId:e})},[X]),pe=(0,w.useCallback)(e=>{C.current=e,n.getState().setRemoteDesktopShowCursor(e),X({type:`cursor`,show:e})},[X]),$=(0,w.useCallback)((e,t,n=!1)=>{X({type:`clipboard`,text:e,paste:t,shift:n})},[X]),me=(0,w.useCallback)(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{b.current=null,X({type:`clipboardRead`})},350)},[X]),he=(0,w.useCallback)(()=>v(null),[]);(0,w.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]),(0,w.useEffect)(()=>{let e=!1,t=null;s(`connecting`),l(null),P(`websocket`),z(!1),V(null),Y(null),a.current=0,A.reset(),(async()=>{let n;try{n=(await d.post(`/api/remote-desktop/session`)).nonce}catch(t){e||(s(`error`),l(t.message));return}if(e)return;let o=ee(window.location,!1,void 0),c=new WebSocket(o);c.binaryType=`arraybuffer`,i.current=c,c.onopen=()=>{c.send(JSON.stringify({type:`auth`,nonce:n,...r?{displayId:r}:{},cursor:C.current,...E.current?{codec:E.current}:{},webrtc:!(j.current||ae())})),h.current&&c.send(JSON.stringify(Q(h.current))),t=setInterval(()=>X({type:`ping`}),re)},c.onmessage=t=>{if(typeof t.data==`string`){let n;try{n=JSON.parse(t.data)}catch{return}if(n.type===`webrtc`&&typeof n.whepPath==`string`)P(`webrtc`),Z(n),k(typeof n.encoder==`string`?n.encoder:null),M.start(n.whepPath),s(`streaming`);else if(n.type===`config`&&typeof n.codec==`string`)Z(n),k(typeof n.encoder==`string`?n.encoder:null),A.configure(n.codec).then(()=>{e||s(`streaming`)});else if(n.type===`quality`)Z(n);else if(n.type===`codec`)k(typeof n.encoder==`string`?n.encoder:null);else if(n.type===`resolution`)U(typeof n.modeId==`string`?n.modeId:null),G(typeof n.original==`string`?n.original:null),q(null);else if(n.type===`resolutionError`)q(typeof n.message==`string`?n.message:`The host refused the mode.`);else if(n.type===`inputBlocked`)Y(ne(n.blocked));else if(n.type===`privacy`)z(n.enabled===!0),V(typeof n.reason==`string`?n.reason:null);else if(n.type===`audio`){let e=n.enabled===!0;if(L(e),!e){F.reset();return}let t=typeof n.channels==`number`?n.channels:2,r=typeof n.sampleRate==`number`?n.sampleRate:48e3;F.configure(t,r)}else if(n.type===`clipboard`&&typeof n.text==`string`){if(!T.current)return;let t=n.text;y(t).then(n=>{!n&&!e&&v(t)})}else n.type===`error`&&(s(`error`),l(typeof n.message==`string`?n.message:`Server error`));return}let n=new Uint8Array(t.data);if(!(n.length<1)){if(a.current+=n.length,n[0]===ie){F.decodePacket(n.subarray(1));return}A.decodeAccessUnit(n.subarray(1),n[0]===1)}},c.onerror=()=>{e||(s(`error`),l(`WebSocket error`))},c.onclose=()=>{e||s(e=>e===`error`?e:`closed`)}})();let n=()=>{if(document.hidden||e)return;let t=i.current;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`ping`})):f(e=>e+1)};return document.addEventListener(`visibilitychange`,n),()=>{e=!0,document.removeEventListener(`visibilitychange`,n),t&&clearInterval(t);try{i.current?.close()}catch{}i.current=null;try{A.reset()}catch{}try{M.stop()}catch{}try{F.reset()}catch{}}},[u,r]);let ge=(0,w.useCallback)(()=>f(e=>e+1),[]),_e=(0,w.useCallback)(()=>N===`webrtc`?M.getTotalBytes():a.current,[N,M]);return{connState:o,errorMessage:c,transport:N,decoderStatus:N===`webrtc`?M.status:A.status,decoderErrorMessage:N===`webrtc`?M.errorMessage:A.errorMessage,sendMessage:X,reconnect:ge,getTotalBytes:_e,getFrameCount:N===`webrtc`?M.getFrameCount:A.getFrameCount,frameSize:N===`webrtc`?M.frameSize:A.frameSize,quality:p,setQuality:se,setCustomQuality:ce,showCursor:x,setShowCursor:pe,codec:D,setCodec:de,audioOn:I,setAudioOn:ue,getAudioTracks:F.getTracks,privacyOn:R,privacyError:B,setPrivacyOn:le,hostModeId:H,hostOriginalModeId:W,resolutionError:K,inputBlocked:J,setHostMode:fe,pendingHostClipboard:_,clearHostClipboard:he,sendClipboard:$,requestHostClipboard:me}}function R(e){let t=new Map;for(let n of e){if(n.width<=0||n.height<=0)continue;let e=`${n.width}x${n.height}`,r=t.get(e);(!r||z(n,r))&&t.set(e,n)}return[...t.values()].sort((e,t)=>t.width*t.height-e.width*e.height||t.refresh-e.refresh).map(e=>({id:e.id,width:e.width,height:e.height,refresh:e.refresh,current:e.current,preferred:e.preferred}))}function z(e,t){return e.current===t.current?e.preferred===t.preferred?e.refresh>t.refresh:e.preferred:e.current}function B(e,t,n){if(!t||t.width<=0||t.height<=0)return null;let r=e.filter(e=>e.width===t.width&&e.height===t.height);if(r.length===0)return null;let i=e.find(e=>e.id===n)??e.find(e=>e.current)??null;return i&&i.width===t.width&&i.height===t.height?null:r.reduce((e,t)=>z(t,e)?t:e)}function V(){if(typeof window>`u`||!window.screen)return null;let e=Math.round(window.screen.width),t=Math.round(window.screen.height);return e>0&&t>0?{width:e,height:t}:null}function H(e){let t=`${e.width} × ${e.height}`;return e.refresh>0?`${t} · ${e.refresh} Hz`:t}function U(e,t){let n=(0,w.useRef)(null),r=(0,w.useRef)([]),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(0),c=(0,w.useRef)(null);c.current===null&&(c.current=S());let l=(0,w.useCallback)(()=>{n.current?.stop()},[]),u=(0,w.useCallback)(()=>{let i=e.current,o=c.current;if(!i||!o||n.current)return;let l=i.captureStream();for(let e of t?.()??[])l.addTrack(e);let u;try{u=new MediaRecorder(l,{mimeType:o})}catch{return}r.current=[],u.ondataavailable=e=>{e.data.size>0&&r.current.push(e.data)},u.onstop=()=>{let e=new Blob(r.current,{type:o});r.current=[],n.current=null,a(!1),s(0),e.size>0&&C(e,b(x(o)))},u.start(1e3),n.current=u,a(!0),s(0)},[e,t]),d=(0,w.useCallback)(()=>{n.current?l():u()},[u,l]);return(0,w.useEffect)(()=>{if(!i)return;let e=Date.now(),t=setInterval(()=>{let t=Date.now()-e;s(Math.floor(t/1e3)),t>=72e5&&l()},1e3);return()=>clearInterval(t)},[i,l]),(0,w.useEffect)(()=>()=>{n.current?.stop()},[]),{recording:i,elapsedSec:o,supported:c.current!==null,toggle:d}}var W={fps:0,kbps:0};function G(e,t){let n=t.atMs-e.atMs;if(n<=0)return W;let r=n/1e3,i=Math.max(0,t.frameCount-e.frameCount),a=Math.max(0,t.totalBytes-e.totalBytes);return{fps:i/r,kbps:a/1024/r}}var K=500;function q({canvasRef:e,getFrameCount:t,getTotalBytes:r,positionClassName:i=`left-1 top-1`}){let a=n(e=>e.remoteDesktopStatsVisible),[o,s]=(0,w.useState)({fps:0,kbps:0,width:0,height:0}),c=(0,w.useRef)({frameCount:0,totalBytes:0,atMs:0});return(0,w.useEffect)(()=>{if(!a)return;c.current={frameCount:t(),totalBytes:r(),atMs:performance.now()};let n=setInterval(()=>{let n={frameCount:t(),totalBytes:r(),atMs:performance.now()},{fps:i,kbps:a}=G(c.current,n);c.current=n;let o=e.current;s({fps:i,kbps:a,width:o?.width??0,height:o?.height??0})},K);return()=>clearInterval(n)},[a,e,t,r]),a?(0,N.jsxs)(`div`,{className:`pointer-events-none absolute z-40 rounded bg-black/60 px-1.5 py-0.5 font-mono text-[10px] text-white/80 ${i}`,"data-testid":`remote-desktop-stats-overlay`,children:[Math.round(o.fps),` fps · `,Math.round(o.kbps),` KB/s · `,o.width,`×`,o.height]}):null}function J(){let{caps:e}=h(!1),t=e?.displays??[],[n,r]=(0,w.useState)(void 0),i=t.find(e=>e.id===n)??t.find(e=>e.primary)??t[0];return{displays:t,displayId:n,current:i,select:r,next:(0,w.useCallback)(()=>{t.length<2||r(t[(t.findIndex(e=>e.id===i?.id)+1)%t.length]?.id)},[t,i])}}function Y({pendingText:e,onDismiss:t,missingToolAction:n,onDismissMissingTool:r,positionClassName:i=`absolute bottom-2 left-1/2 max-w-[92%] -translate-x-1/2`}){let[c,l]=(0,w.useState)(!1);return e===null?n==null?null:(0,N.jsxs)(X,{onDismiss:r??(()=>{}),testId:`remote-desktop-clipboard-missing-tool`,positionClassName:i,children:[(0,N.jsx)(s,{className:`size-4 shrink-0 text-amber-300`}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:`The host has no clipboard tool installed.`}),n.kind===`terminal`&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>_(n.command),title:n.command,className:`inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,children:[(0,N.jsx)(a,{className:`size-3.5`}),` `,n.label]})]}):(0,N.jsxs)(X,{onDismiss:t,testId:`remote-desktop-clipboard-pending`,positionClassName:i,children:[(0,N.jsx)(o,{className:`size-4 shrink-0 text-emerald-400`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c?`Could not copy — select the text manually:`:`Copied on the host:`,(0,N.jsx)(`span`,{className:`ml-1 text-white/60`,children:Z(e)})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{v(e)?t():l(!0)},className:`min-h-8 shrink-0 rounded bg-white/15 px-2.5 text-xs hover:bg-white/25`,"data-testid":`remote-desktop-clipboard-copy`,children:`Copy here`})]})}function X({children:e,onDismiss:t,testId:n,positionClassName:r}){return(0,N.jsxs)(`div`,{className:f(`z-50 flex items-center gap-2 rounded-lg border border-white/10 bg-black/85 px-3 py-2 text-xs text-white shadow-lg`,r),"data-testid":n,children:[e,(0,N.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Dismiss`,className:`flex size-8 shrink-0 items-center justify-center rounded text-white/60 hover:bg-white/10 hover:text-white`,children:(0,N.jsx)(l,{className:`size-3.5`})})]})}function Z(e){let t=e.replace(/\s+/g,` `).trim();return t.length>60?`${t.slice(0,60)}…`:t}export{B as a,H as c,U as i,L as l,J as n,V as o,q as r,R as s,Y as t,F as u};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-desktop-mobile-view-
|
|
2
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-DirmJxtu.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import{yt as r}from"./vendor-ui-BQzUk4nq.js";import"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import{t as i}from"./preload-helper-uTix4PVD.js";import{n as a}from"./portal-container-context-C84rlnJ6.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./control-size-DFdAJqoq.js";import{yn as o}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-desktop-mobile-view-Clkko7So.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-CToe9paM.js","assets/preload-helper-uTix4PVD.js","assets/vendor-ui-BQzUk4nq.js","assets/vendor-markdown-26eoXJk7.js","assets/button-CtdEWN7U.js","assets/utils-DMiycH3O.js","assets/createLucideIcon-nOpXneg9.js","assets/extension-icons-BSSI8zJe.js","assets/git-commit-horizontal-BJpjDb3H.js","assets/icons-CpR5Vw3J.js","assets/api-client-DSCscZEd.js","assets/react-BH62_kP1.js","assets/open-ppm-tab-d8_3ai-M.js","assets/settings-store-DirmJxtu.js","assets/settings-events-BzBnHQWJ.js","assets/window-store-Bl6ySrZZ.js","assets/minimal-mode-DDuML1Oi.js","assets/file-browser-locate-C6ckBRTU.js","assets/use-explorer-open-state-xgkY0uH0.js","assets/use-is-mobile-CrfIt67b.js","assets/panel-store-B5zTGca0.js","assets/session-list-sync-triggers-_I5gGBSe.js","assets/project-store-BaGmhKos.js","assets/project-framework-store-vI8djw4a.js","assets/vault-Q5oPy0h3.js","assets/open-assistant-uhdReWoG.js","assets/patch-tab-metadata-DzBKXZ8Z.js","assets/assistant-settings-tab-store-BFJ4pM3_.js","assets/settings-categories-B_629iML.js","assets/open-settings-CGqVSUo5.js","assets/tab-store-CdpGgbmw.js","assets/design-tab-metadata-o2TAAwEt.js","assets/chat-jump-store-BzDl2wpf.js","assets/vault-focus-store-BYABW4-C.js","assets/assistant-managers-DBFW4Vy_.js","assets/assistant-persona-CiWkGBFh.js","assets/assistant-settings-B17q1iTi.js","assets/assistant-digest-XqNJJf0c.js","assets/assistant-settings-dialog-WD7-nag4.js","assets/feature-intros-CHJ2c-NE.js","assets/session-collab-BD1AwcUC.js","assets/dialog-BWXzvHlC.js","assets/portal-container-context-C84rlnJ6.js","assets/mobile-bottom-sheet-C78UMLrn.js","assets/use-visual-viewport-tMLO63yY.js","assets/assistant-settings-api-DvAT6QKt.js","assets/open-db-tabs-SyNM2EhJ.js","assets/explorer-model-CMB2DLaE.js","assets/db-connection-config-DKVbmtru.js","assets/db-types-C1hMYmOv.js","assets/db-sidebar-reveal-DT3XJ69t.js","assets/db-drivers-BIKN5HLb.js","assets/impexp-state-HsrqffES.js","assets/design-canvas-check-DAc84j07.js","assets/model-thinking-selector-helpers-CSb4sOPu.js","assets/input-CCVoN0-P.js","assets/file-store-DvNGR1CA.js","assets/slash-command-picker-xIZbJS-p.js","assets/build-message-with-attachments-Dcfq8TCF.js","assets/task-format-BZIV3kD8.js","assets/open-task-C-XSSORs.js","assets/use-manager-chats-7IXu1wX5.js","assets/open-chat-session-B8FHbA1S.js","assets/open-chat-in-window-v7025zeE.js","assets/clipboard-DQuoK2EM.js","assets/ppm-tools-Bpl4lgH9.js","assets/db-ai-tools-x8SPCTHe.js","assets/split-sql-statements-0B9v-kNm.js","assets/tab-open-protocol-D5UyfEsm.js","assets/user-message-parse-DG85Nt5-.js","assets/voice-message-CNThCsr3.js","assets/set-manager-chat-dialog-CZm1uMTC.js","assets/provider-selector-CpYLloT9.js","assets/chat-preparation-cache-D6KJ1ZMi.js","assets/provider-logos-zWlJBGXd.js","assets/use-coarse-long-press-r69G14r1.js","assets/task-chip-peek-dtuuhUxI.js","assets/task-links-card-D4IzxjS0.js","assets/dropdown-menu-DMZtzfk5.js","assets/radio-dot-UO7SfziL.js","assets/control-size-DFdAJqoq.js","assets/adaptive-context-menu-BY4ki-EE.js","assets/start-ellipsis-BQ0FJowG.js","assets/tooltip-CECVgROB.js","assets/use-voice-message-recorder-BxjLFY10.js","assets/api-settings-DOq_SIAU.js","assets/format-date-E9rSy4Po.js","assets/image-gallery-BvIkGPUA.js","assets/session-collab-client-BxXx812Z.js","assets/send-to-chat-Saa9Tfu2.js","assets/notification-store-hHQ6I1WT.js","assets/unsaved-grid-rows-store-DKZSxIbb.js","assets/sql-identifiers-D62yiJWh.js","assets/db-explorer-store-Bzw8bf2f.js","assets/format-file-meta-B4qeznFu.js","assets/fs-api-COsHlRxJ.js","assets/scroll-area-DKwnCaCu.js","assets/use-git-repo-BjCnSkJ0.js","assets/git-repo-store-BCgyxqGc.js","assets/use-schedules-b8L8CH0W.js","assets/file-icons-wTYRmxJu.js","assets/global-ws-channel-C7BkbuOy.js","assets/ws-auth-BoXvat-e.js","assets/streaming-store-Dq4AjFuk.js","assets/apply-theme-BeLRfsSu.js","assets/resolve-theme-BHAgAaFk.js","assets/index-D1toZxbF.css","assets/remote-desktop-coords-BI7h18Lu.js","assets/remote-desktop-clipboard-notice-DiszI66Q.js","assets/use-h264-canvas-decoder-CYE63fHm.js","assets/remote-desktop-recording-CmBExjTO.js","assets/run-in-terminal-Bhp0sfyb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-DirmJxtu.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import{yt as r}from"./vendor-ui-BQzUk4nq.js";import"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import{t as i}from"./preload-helper-uTix4PVD.js";import{n as a}from"./portal-container-context-C84rlnJ6.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./control-size-DFdAJqoq.js";import{yn as o}from"./index-CToe9paM.js";import"./run-in-terminal-Bhp0sfyb.js";import{n as s,t as c}from"./remote-desktop-readiness-gate-CgE2Rxsr.js";var l=e(t(),1),u=e(r(),1),d=n(),f=(0,l.lazy)(()=>i(()=>import(`./remote-desktop-mobile-view-Clkko7So.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113])));function p(){let e=o(e=>e.isOpen),t=o(e=>e.close),n=a();return e?(0,u.createPortal)((0,d.jsx)(`div`,{className:`fixed inset-0 z-[45] bg-black`,"data-testid":`remote-desktop-mobile-sheet`,children:(0,d.jsx)(s,{onCancel:t,children:(0,d.jsx)(c,{onCancel:t,children:(0,d.jsx)(l.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-text-2`,children:`Loading…`}),children:(0,d.jsx)(f,{onClose:t})})})})}),n??document.getElementById(`root`)??document.body):null}export{p as RemoteDesktopMobileSheet};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{Y as t,Z as n,t as r}from"./settings-store-DirmJxtu.js";import{D as i,E as a}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{Bn as o,Dr as s,Fr as c,Ht as l,Rn as u,Wn as d,Xt as f,Z as p,bi as m,dn as h,li as g,pi as _,q as v,rn as ee,si as te,vt as ne,yr as y}from"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import{n as b}from"./utils-DMiycH3O.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import{t as x}from"./use-visual-viewport-tMLO63yY.js";import"./control-size-DFdAJqoq.js";import"./ws-auth-BoXvat-e.js";import{vn as S}from"./index-4hOd9rdZ.js";import"./use-h264-canvas-decoder-CYE63fHm.js";import"./run-in-terminal-Bhp0sfyb.js";import{a as re,i as C,l as ie,n as w,o as T,r as ae,s as oe,t as se,u as E}from"./remote-desktop-clipboard-notice-BI0fR6VN.js";import{n as D,r as O}from"./remote-desktop-coords-BI7h18Lu.js";import{a as ce}from"./remote-desktop-recording-CmBExjTO.js";var k=e(i(),1);function le(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function ue(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function A(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function j(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function M(e,t,n){return Math.min(Math.max(e,t),n)}function N(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function P(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function F(e,t,n,r,i,a){let o=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&o>10){e.moved=!0;let r=D(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=D(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let s=(t-e.last.x)/i.scale,c=(n-e.last.y)/i.scale;return o>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:M(a.xFrac+s/e.rect.width,0,1),yFrac:M(a.yFrac+c/e.rect.height,0,1)},sendCursorMove:!0}}function I(e,t,n,r,i,a){let o={x:t,y:n,t:performance.now()},s=le(e.start,o,10,300);if(r===`touch`){let r=D(t,n,e.rect,i);return!e.moved&&s?N(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&s?N(a.xFrac,a.yFrac,`left`):[]}function L(e,t,n){let r=j(e,t);return{startDistance:A(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function R(e,t,n,r){let i=A(t,n),a=j(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=A(e.startMid,a);if(t>15)e.gesture=ue(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:M(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function z(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=D(e.lastMid.x,e.lastMid.y,t,n);return N(r.xFrac,r.yFrac,`right`)}return[]}var B={scale:1,panX:0,panY:0},V=40,H=120;function de({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:i}){let[a,o]=(0,k.useState)(B),[s,c]=(0,k.useState)({xFrac:.5,yFrac:.5}),l=(0,k.useRef)(a),u=(0,k.useRef)(s),d=(0,k.useRef)(n);d.current=n;let f=(0,k.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),p=(0,k.useRef)(0),m=(0,k.useCallback)(()=>{p.current=0;let e=f.current;e.transform&&=(l.current=e.transform,o(e.transform),null),e.cursor&&(u.current=e.cursor,c(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/V)*H}),e.wheelPx=0)},[r]),h=(0,k.useCallback)(()=>{p.current||=requestAnimationFrame(m)},[m]),g=(0,k.useCallback)(()=>{l.current=B,o(B)},[]);return(0,k.useEffect)(()=>{let n=e.current;if(!n||!i)return;let a=null,o=null,s=e=>e.forEach(r),c=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:O(e,r.width,r.height)},m=e=>{e.preventDefault(),e.stopPropagation();let t=c();if(e.touches.length===1){o=null;let n=e.touches[0];a=P(n.clientX,n.clientY,t)}else if(e.touches.length===2){a=null;let[t,n]=[e.touches[0],e.touches[1]];o=L({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current.scale)}else a=null,o=null},g=e=>{if(e.preventDefault(),e.stopPropagation(),a&&e.touches.length===1){let t=e.touches[0],n=F(a,t.clientX,t.clientY,d.current,l.current,u.current);n.message&&r(n.message),n.cursor&&(u.current=n.cursor,f.current.cursor=n.cursor,f.current.sendCursorMove=!!n.sendCursorMove,h());return}if(o&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=R(o,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current);r.transform&&(l.current=r.transform,f.current.transform=r.transform,h()),r.wheelDeltaPx&&(f.current.wheelPx+=r.wheelDeltaPx,h())}},_=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(a){let e=t?t.clientX:a.last.x,n=t?t.clientY:a.last.y;s(I(a,e,n,d.current,l.current,u.current)),a=null}o&&=(s(z(o,c(),l.current)),null)},v=e=>{e.stopPropagation(),a?.moved&&d.current===`touch`&&s(I(a,a.last.x,a.last.y,`touch`,l.current,u.current)),a=null,o=null};return n.addEventListener(`touchstart`,m,{passive:!1}),n.addEventListener(`touchmove`,g,{passive:!1}),n.addEventListener(`touchend`,_,{passive:!1}),n.addEventListener(`touchcancel`,v,{passive:!1}),()=>{p.current&&cancelAnimationFrame(p.current),n.removeEventListener(`touchstart`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,_),n.removeEventListener(`touchcancel`,v)}},[e,t,i,r,h]),{transform:a,virtualCursor:n===`mouse`?s:null,resetZoom:g}}function U(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function fe(e,t,n){let r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let i=r.current;if(!i||!t)return;let a=()=>e({type:`releaseAll`}),o=e=>e.code!==``&&e.key!==`Unidentified`,s=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},c=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},l=t=>{U(t.inputType,t.data,e)&&t.preventDefault()},u=t=>{t.data&&e({type:`text`,text:t.data}),i.value=``},d=e=>{let t=e.clipboardData?.getData(`text/plain`);!t||!n||(e.preventDefault(),n(t))},f=()=>a(),p=()=>{document.hidden&&a()};return i.addEventListener(`keydown`,s),i.addEventListener(`keyup`,c),i.addEventListener(`beforeinput`,l),i.addEventListener(`compositionend`,u),i.addEventListener(`paste`,d),i.addEventListener(`blur`,f),document.addEventListener(`visibilitychange`,p),()=>{i.removeEventListener(`keydown`,s),i.removeEventListener(`keyup`,c),i.removeEventListener(`beforeinput`,l),i.removeEventListener(`compositionend`,u),i.removeEventListener(`paste`,d),i.removeEventListener(`blur`,f),document.removeEventListener(`visibilitychange`,p),a()}},[t,e,n]),{inputRef:r,show:(0,k.useCallback)(()=>r.current?.focus(),[])}}var W=a();function G({onClick:e,label:t,active:n,children:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:b(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,W.jsx)(`span`,{children:t})]})}function pe({displayLabel:e,onNextDisplay:t,qualityLabel:n,onNextQuality:r,mode:i,onToggleMode:a,onOpenKeyboard:o,onResetZoom:c,settingsOpen:l,onToggleSettings:p,onClose:v}){return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,W.jsx)(G,{onClick:a,label:i===`mouse`?`Mouse`:`Touch`,active:!0,children:i===`mouse`?(0,W.jsx)(d,{className:`size-5`}):(0,W.jsx)(f,{className:`size-5`})}),(0,W.jsx)(G,{onClick:o,label:`Keyboard`,children:(0,W.jsx)(h,{className:`size-5`})}),(0,W.jsx)(G,{onClick:c,label:`Reset zoom`,children:(0,W.jsx)(m,{className:`size-5`})}),e!==null&&(0,W.jsx)(G,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,W.jsx)(u,{className:`size-5`})}),(0,W.jsx)(G,{onClick:r,label:n,children:(0,W.jsx)(g,{className:`size-5`})}),(0,W.jsx)(G,{onClick:p,label:`More`,active:l,children:(0,W.jsx)(s,{className:`size-5`})}),(0,W.jsx)(G,{onClick:v,label:`Close`,children:(0,W.jsx)(_,{className:`size-5`})})]})}function me(e){return(e.includes(`ControlLeft`)||e.includes(`MetaLeft`))&&(e.includes(`KeyC`)||e.includes(`KeyX`))}var K=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],q=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],J=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function Y({onClick:e,active:t,className:n,children:r}){return(0,W.jsx)(`button`,{type:`button`,onClick:e,className:b(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function he({sendMessage:e,onCopyCombo:t}){let[n,r]=(0,k.useState)(new Set),i=(0,k.useRef)(n);i.current=n,(0,k.useEffect)(()=>()=>{i.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let a=(0,k.useCallback)(t=>{r(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),o=(0,k.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),s=(0,k.useCallback)(n=>{n.forEach(t=>e({type:`key`,code:t,down:!0})),[...n].reverse().forEach(t=>e({type:`key`,code:t,down:!1})),me(n)&&t?.()},[e,t]);return(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[K.map(e=>(0,W.jsx)(Y,{onClick:()=>a(e.code),active:n.has(e.code),children:e.label},e.code)),(0,W.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),q.map(e=>(0,W.jsx)(Y,{onClick:()=>o(e.code),children:e.label},e.code)),(0,W.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),J.map(e=>(0,W.jsx)(Y,{onClick:()=>s(e.codes),children:e.label},e.label))]})}function X({icon:e,label:t,hint:n,checked:r,onToggle:i,testId:a,disabled:o}){return(0,W.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:o,onClick:i,"data-testid":a,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-white/80 active:bg-white/10 disabled:opacity-50`,children:[(0,W.jsx)(`span`,{className:`shrink-0 opacity-80`,children:e}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-xs`,children:t}),n&&(0,W.jsx)(`span`,{className:`block truncate text-[10px] text-white/45`,children:n})]}),(0,W.jsx)(`span`,{className:b(`relative h-5 w-9 shrink-0 rounded-full transition-colors`,r?`bg-primary`:`bg-white/20`),children:(0,W.jsx)(`span`,{className:b(`absolute top-0.5 size-4 rounded-full bg-white transition-all`,r?`left-[1.125rem]`:`left-0.5`)})})]})}function ge({statsVisible:e,onToggleStats:t,showCursor:n,onSetShowCursor:r,clipboardEnabled:i,onSetClipboardEnabled:a,audioOn:o,audioReason:s,onSetAudioOn:u,privacyOn:f,privacyReason:m,onSetPrivacyOn:h,hostModes:g,hostModeId:_,hostOriginalModeId:y,onSetHostMode:x,canResizeHost:S,resolutionError:C,recording:ie,recordingSupported:w,onToggleRecording:ae,onScreenshot:se}){let E=(0,k.useMemo)(()=>oe(g),[g]),D=(0,k.useMemo)(()=>T(),[]),O=(0,k.useMemo)(()=>re(g,D,_),[g,D,_]);return(0,W.jsxs)(`div`,{className:`mx-2 mb-1 space-y-0.5 rounded-xl border border-white/10 bg-black/90 p-1`,"data-testid":`remote-desktop-mobile-settings`,children:[(0,W.jsx)(X,{icon:(0,W.jsx)(l,{className:`size-4`}),label:`Quality monitor`,checked:e,onToggle:t,testId:`remote-desktop-mobile-stats-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(d,{className:`size-4`}),label:`Show remote cursor`,hint:`Restarts the stream`,checked:n,onToggle:()=>r(!n),testId:`remote-desktop-mobile-cursor-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(p,{className:`size-4`}),label:`Sync clipboard`,hint:`Off: Ctrl+V pastes the host's own clipboard`,checked:i,onToggle:()=>a(!i),testId:`remote-desktop-mobile-clipboard-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(te,{className:`size-4`}),label:`Play host audio`,hint:s??void 0,checked:o,disabled:s!==null,onToggle:()=>u(!o),testId:`remote-desktop-mobile-audio-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(ne,{className:`size-4`}),label:`Privacy mode`,hint:m??`Blocks the host's own keyboard and mouse`,checked:f,disabled:m!==null&&!f,onToggle:()=>h(!f),testId:`remote-desktop-mobile-privacy-toggle`}),S&&E.length>1&&(0,W.jsxs)(`div`,{className:`px-3 pt-1`,children:[(0,W.jsx)(`div`,{className:`pb-1.5 text-[10px] uppercase tracking-wide text-white/40`,children:`Resolution`}),(0,W.jsxs)(`div`,{className:`flex max-h-28 flex-wrap gap-1.5 overflow-y-auto`,children:[y&&y!==_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>x(y),"data-testid":`remote-desktop-mobile-resolution-original`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Original`}),O&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>x(O.id),"data-testid":`remote-desktop-mobile-resolution-fit-local`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Fit local`}),E.map(e=>{let t=(_??E.find(e=>e.current)?.id)===e.id;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>x(e.id),"data-testid":`remote-desktop-mobile-resolution-${e.width}x${e.height}`,className:b(`min-h-9 rounded-md px-2.5 py-1 text-[11px] tabular-nums`,t?`bg-white/25 text-white`:`bg-white/10 text-white/70 active:bg-white/20`),children:[e.width,`×`,e.height]},e.id)})]}),C&&(0,W.jsx)(`div`,{className:`pt-1.5 text-[10px] leading-tight text-red-400`,children:C})]}),(0,W.jsxs)(`button`,{type:`button`,onClick:se,"data-testid":`remote-desktop-mobile-screenshot`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:[(0,W.jsx)(ee,{className:`size-4 opacity-80`}),` Save screenshot`]}),w&&(0,W.jsx)(`button`,{type:`button`,onClick:ae,"data-testid":`remote-desktop-mobile-record`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:ie?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{className:`size-4 text-red-500`}),` Stop recording`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(v,{className:`size-4 opacity-80`}),` Start recording`]})})]})}function _e({onClose:e}){let i=(0,k.useRef)(null),a=(0,k.useRef)(null),[s,c]=(0,k.useState)(`mouse`),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(!1),p=w(),{connState:m,errorMessage:h,decoderStatus:g,decoderErrorMessage:_,sendMessage:v,reconnect:ee,getTotalBytes:te,getFrameCount:ne,quality:b,setQuality:re,showCursor:T,setShowCursor:oe,audioOn:D,setAudioOn:le,getAudioTracks:ue,privacyOn:A,privacyError:j,setPrivacyOn:M,hostModeId:N,hostOriginalModeId:P,resolutionError:F,setHostMode:I,inputBlocked:L,pendingHostClipboard:R,clearHostClipboard:z,sendClipboard:B,requestHostClipboard:V}=ie(a,{displayId:p.displayId}),H=r(e=>e.remoteDesktopStatsVisible),U=r(e=>e.toggleRemoteDesktopStatsVisible),G=r(e=>e.remoteDesktopClipboardSync),me=r(e=>e.setRemoteDesktopClipboardSync),K=r(e=>e.remoteDesktopQuality),q=m===`streaming`,{transform:J,virtualCursor:Y,resetZoom:X}=de({containerRef:i,canvasRef:a,mode:s,sendMessage:v,enabled:q}),[_e,ve]=(0,k.useState)(!1),ye=(0,k.useCallback)(e=>{ve(!0),B(e,!0)},[B]),{caps:Z}=S(!1),Q=C(a,ue),{inputRef:be,show:xe}=fe(v,q,G?ye:void 0),$=x(!0)?.keyboardInset??0,Se=(0,k.useCallback)(()=>c(e=>e===`mouse`?`touch`:`mouse`),[]),Ce=(0,k.useCallback)(()=>{xe(),u(!0)},[xe]),we=g===`unsupported`?_:m===`error`?h:m===`closed`?`Disconnected`:m===`connecting`?`Connecting…`:null,Te={transform:`translate(${J.panX}px, ${J.panY}px) scale(${J.scale})`},Ee=`${(Y?.xFrac??.5)*100}%`,De=`${(Y?.yFrac??.5)*100}%`;if(Y&&i.current&&a.current?.width&&a.current.height){let e=i.current.getBoundingClientRect(),t=O({left:0,top:0,width:e.width,height:e.height},a.current.width,a.current.height);Ee=`${t.left+Y.xFrac*t.width}px`,De=`${t.top+Y.yFrac*t.height}px`}return(0,W.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":m,children:[(0,W.jsxs)(`div`,{ref:i,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:$},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,W.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:Te,children:[(0,W.jsx)(`canvas`,{ref:a,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),s===`mouse`&&Y&&q&&(0,W.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:Ee,top:De,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/J.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),we&&(0,W.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,W.jsx)(o,{className:`size-6 opacity-70`}),(0,W.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:we}),(m===`error`||m===`closed`)&&g!==`unsupported`&&(0,W.jsxs)(`button`,{onClick:ee,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,W.jsx)(y,{className:`size-3.5`}),` Reconnect`]})]}),(0,W.jsx)(E,{blocked:L}),(0,W.jsx)(`input`,{ref:be,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>u(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,W.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:$>0?{transform:`translateY(-${$}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[(0,W.jsx)(se,{pendingText:R,onDismiss:z,missingToolAction:_e&&Z&&!Z.clipboard.available?Z.clipboard.action:null,onDismissMissingTool:()=>ve(!1),positionClassName:`mx-2 mb-1 max-w-[calc(100%-1rem)]`}),d&&(0,W.jsx)(ge,{statsVisible:H,onToggleStats:U,showCursor:T,onSetShowCursor:oe,clipboardEnabled:G,onSetClipboardEnabled:me,audioOn:D,audioReason:Z&&!Z.audio.available?Z.audio.reason:null,onSetAudioOn:le,privacyOn:A,privacyReason:j??(Z&&!Z.privacy.available?Z.privacy.reason:null),hostModes:Z?.resolutions?.modes??[],hostModeId:N,hostOriginalModeId:P,onSetHostMode:I,canResizeHost:Z?.inputReady??!1,resolutionError:F,onSetPrivacyOn:M,recording:Q.recording,recordingSupported:Q.supported,onToggleRecording:Q.toggle,onScreenshot:()=>void ce(a.current)}),l&&(0,W.jsx)(he,{sendMessage:v,onCopyCombo:G?V:void 0}),(0,W.jsx)(pe,{displayLabel:p.displays.length>1?p.current?.label??null:null,onNextDisplay:p.next,qualityLabel:n(K),onNextQuality:()=>re(t(K)),mode:s,onToggleMode:Se,onOpenKeyboard:Ce,onResetZoom:X,settingsOpen:d,onToggleSettings:()=>f(e=>!e),onClose:e})]}),(0,W.jsx)(ae,{canvasRef:a,getFrameCount:ne,getTotalBytes:te,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{_e as default};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{Y as t,Z as n,t as r}from"./settings-store-DirmJxtu.js";import{D as i,E as a}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{Bn as o,Dr as s,Fr as c,Ht as l,Rn as u,Wn as d,Xt as f,Z as p,bi as m,dn as h,li as g,pi as _,q as v,rn as ee,si as te,vt as ne,yr as y}from"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import{n as b}from"./utils-DMiycH3O.js";import"./window-store-Bl6ySrZZ.js";import"./panel-store-B5zTGca0.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import{t as x}from"./use-visual-viewport-tMLO63yY.js";import"./control-size-DFdAJqoq.js";import"./ws-auth-BoXvat-e.js";import{vn as S}from"./index-CToe9paM.js";import"./use-h264-canvas-decoder-CYE63fHm.js";import"./run-in-terminal-Bhp0sfyb.js";import{a as re,i as C,l as ie,n as w,o as T,r as ae,s as oe,t as se,u as E}from"./remote-desktop-clipboard-notice-DiszI66Q.js";import{n as D,r as O}from"./remote-desktop-coords-BI7h18Lu.js";import{a as ce}from"./remote-desktop-recording-CmBExjTO.js";var k=e(i(),1);function le(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function ue(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function A(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function j(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function M(e,t,n){return Math.min(Math.max(e,t),n)}function N(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function P(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function F(e,t,n,r,i,a){let o=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&o>10){e.moved=!0;let r=D(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=D(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let s=(t-e.last.x)/i.scale,c=(n-e.last.y)/i.scale;return o>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:M(a.xFrac+s/e.rect.width,0,1),yFrac:M(a.yFrac+c/e.rect.height,0,1)},sendCursorMove:!0}}function I(e,t,n,r,i,a){let o={x:t,y:n,t:performance.now()},s=le(e.start,o,10,300);if(r===`touch`){let r=D(t,n,e.rect,i);return!e.moved&&s?N(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&s?N(a.xFrac,a.yFrac,`left`):[]}function L(e,t,n){let r=j(e,t);return{startDistance:A(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function R(e,t,n,r){let i=A(t,n),a=j(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=A(e.startMid,a);if(t>15)e.gesture=ue(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:M(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function z(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=D(e.lastMid.x,e.lastMid.y,t,n);return N(r.xFrac,r.yFrac,`right`)}return[]}var B={scale:1,panX:0,panY:0},V=40,H=120;function de({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:i}){let[a,o]=(0,k.useState)(B),[s,c]=(0,k.useState)({xFrac:.5,yFrac:.5}),l=(0,k.useRef)(a),u=(0,k.useRef)(s),d=(0,k.useRef)(n);d.current=n;let f=(0,k.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),p=(0,k.useRef)(0),m=(0,k.useCallback)(()=>{p.current=0;let e=f.current;e.transform&&=(l.current=e.transform,o(e.transform),null),e.cursor&&(u.current=e.cursor,c(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/V)*H}),e.wheelPx=0)},[r]),h=(0,k.useCallback)(()=>{p.current||=requestAnimationFrame(m)},[m]),g=(0,k.useCallback)(()=>{l.current=B,o(B)},[]);return(0,k.useEffect)(()=>{let n=e.current;if(!n||!i)return;let a=null,o=null,s=e=>e.forEach(r),c=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:O(e,r.width,r.height)},m=e=>{e.preventDefault(),e.stopPropagation();let t=c();if(e.touches.length===1){o=null;let n=e.touches[0];a=P(n.clientX,n.clientY,t)}else if(e.touches.length===2){a=null;let[t,n]=[e.touches[0],e.touches[1]];o=L({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current.scale)}else a=null,o=null},g=e=>{if(e.preventDefault(),e.stopPropagation(),a&&e.touches.length===1){let t=e.touches[0],n=F(a,t.clientX,t.clientY,d.current,l.current,u.current);n.message&&r(n.message),n.cursor&&(u.current=n.cursor,f.current.cursor=n.cursor,f.current.sendCursorMove=!!n.sendCursorMove,h());return}if(o&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=R(o,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current);r.transform&&(l.current=r.transform,f.current.transform=r.transform,h()),r.wheelDeltaPx&&(f.current.wheelPx+=r.wheelDeltaPx,h())}},_=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(a){let e=t?t.clientX:a.last.x,n=t?t.clientY:a.last.y;s(I(a,e,n,d.current,l.current,u.current)),a=null}o&&=(s(z(o,c(),l.current)),null)},v=e=>{e.stopPropagation(),a?.moved&&d.current===`touch`&&s(I(a,a.last.x,a.last.y,`touch`,l.current,u.current)),a=null,o=null};return n.addEventListener(`touchstart`,m,{passive:!1}),n.addEventListener(`touchmove`,g,{passive:!1}),n.addEventListener(`touchend`,_,{passive:!1}),n.addEventListener(`touchcancel`,v,{passive:!1}),()=>{p.current&&cancelAnimationFrame(p.current),n.removeEventListener(`touchstart`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,_),n.removeEventListener(`touchcancel`,v)}},[e,t,i,r,h]),{transform:a,virtualCursor:n===`mouse`?s:null,resetZoom:g}}function U(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function fe(e,t,n){let r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let i=r.current;if(!i||!t)return;let a=()=>e({type:`releaseAll`}),o=e=>e.code!==``&&e.key!==`Unidentified`,s=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},c=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},l=t=>{U(t.inputType,t.data,e)&&t.preventDefault()},u=t=>{t.data&&e({type:`text`,text:t.data}),i.value=``},d=e=>{let t=e.clipboardData?.getData(`text/plain`);!t||!n||(e.preventDefault(),n(t))},f=()=>a(),p=()=>{document.hidden&&a()};return i.addEventListener(`keydown`,s),i.addEventListener(`keyup`,c),i.addEventListener(`beforeinput`,l),i.addEventListener(`compositionend`,u),i.addEventListener(`paste`,d),i.addEventListener(`blur`,f),document.addEventListener(`visibilitychange`,p),()=>{i.removeEventListener(`keydown`,s),i.removeEventListener(`keyup`,c),i.removeEventListener(`beforeinput`,l),i.removeEventListener(`compositionend`,u),i.removeEventListener(`paste`,d),i.removeEventListener(`blur`,f),document.removeEventListener(`visibilitychange`,p),a()}},[t,e,n]),{inputRef:r,show:(0,k.useCallback)(()=>r.current?.focus(),[])}}var W=a();function G({onClick:e,label:t,active:n,children:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:b(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,W.jsx)(`span`,{children:t})]})}function pe({displayLabel:e,onNextDisplay:t,qualityLabel:n,onNextQuality:r,mode:i,onToggleMode:a,onOpenKeyboard:o,onResetZoom:c,settingsOpen:l,onToggleSettings:p,onClose:v}){return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,W.jsx)(G,{onClick:a,label:i===`mouse`?`Mouse`:`Touch`,active:!0,children:i===`mouse`?(0,W.jsx)(d,{className:`size-5`}):(0,W.jsx)(f,{className:`size-5`})}),(0,W.jsx)(G,{onClick:o,label:`Keyboard`,children:(0,W.jsx)(h,{className:`size-5`})}),(0,W.jsx)(G,{onClick:c,label:`Reset zoom`,children:(0,W.jsx)(m,{className:`size-5`})}),e!==null&&(0,W.jsx)(G,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,W.jsx)(u,{className:`size-5`})}),(0,W.jsx)(G,{onClick:r,label:n,children:(0,W.jsx)(g,{className:`size-5`})}),(0,W.jsx)(G,{onClick:p,label:`More`,active:l,children:(0,W.jsx)(s,{className:`size-5`})}),(0,W.jsx)(G,{onClick:v,label:`Close`,children:(0,W.jsx)(_,{className:`size-5`})})]})}function me(e){return(e.includes(`ControlLeft`)||e.includes(`MetaLeft`))&&(e.includes(`KeyC`)||e.includes(`KeyX`))}var K=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],q=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],J=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function Y({onClick:e,active:t,className:n,children:r}){return(0,W.jsx)(`button`,{type:`button`,onClick:e,className:b(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function he({sendMessage:e,onCopyCombo:t}){let[n,r]=(0,k.useState)(new Set),i=(0,k.useRef)(n);i.current=n,(0,k.useEffect)(()=>()=>{i.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let a=(0,k.useCallback)(t=>{r(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),o=(0,k.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),s=(0,k.useCallback)(n=>{n.forEach(t=>e({type:`key`,code:t,down:!0})),[...n].reverse().forEach(t=>e({type:`key`,code:t,down:!1})),me(n)&&t?.()},[e,t]);return(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[K.map(e=>(0,W.jsx)(Y,{onClick:()=>a(e.code),active:n.has(e.code),children:e.label},e.code)),(0,W.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),q.map(e=>(0,W.jsx)(Y,{onClick:()=>o(e.code),children:e.label},e.code)),(0,W.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),J.map(e=>(0,W.jsx)(Y,{onClick:()=>s(e.codes),children:e.label},e.label))]})}function X({icon:e,label:t,hint:n,checked:r,onToggle:i,testId:a,disabled:o}){return(0,W.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:o,onClick:i,"data-testid":a,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-white/80 active:bg-white/10 disabled:opacity-50`,children:[(0,W.jsx)(`span`,{className:`shrink-0 opacity-80`,children:e}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-xs`,children:t}),n&&(0,W.jsx)(`span`,{className:`block truncate text-[10px] text-white/45`,children:n})]}),(0,W.jsx)(`span`,{className:b(`relative h-5 w-9 shrink-0 rounded-full transition-colors`,r?`bg-primary`:`bg-white/20`),children:(0,W.jsx)(`span`,{className:b(`absolute top-0.5 size-4 rounded-full bg-white transition-all`,r?`left-[1.125rem]`:`left-0.5`)})})]})}function ge({statsVisible:e,onToggleStats:t,showCursor:n,onSetShowCursor:r,clipboardEnabled:i,onSetClipboardEnabled:a,audioOn:o,audioReason:s,onSetAudioOn:u,privacyOn:f,privacyReason:m,onSetPrivacyOn:h,hostModes:g,hostModeId:_,hostOriginalModeId:y,onSetHostMode:x,canResizeHost:S,resolutionError:C,recording:ie,recordingSupported:w,onToggleRecording:ae,onScreenshot:se}){let E=(0,k.useMemo)(()=>oe(g),[g]),D=(0,k.useMemo)(()=>T(),[]),O=(0,k.useMemo)(()=>re(g,D,_),[g,D,_]);return(0,W.jsxs)(`div`,{className:`mx-2 mb-1 space-y-0.5 rounded-xl border border-white/10 bg-black/90 p-1`,"data-testid":`remote-desktop-mobile-settings`,children:[(0,W.jsx)(X,{icon:(0,W.jsx)(l,{className:`size-4`}),label:`Quality monitor`,checked:e,onToggle:t,testId:`remote-desktop-mobile-stats-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(d,{className:`size-4`}),label:`Show remote cursor`,hint:`Restarts the stream`,checked:n,onToggle:()=>r(!n),testId:`remote-desktop-mobile-cursor-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(p,{className:`size-4`}),label:`Sync clipboard`,hint:`Off: Ctrl+V pastes the host's own clipboard`,checked:i,onToggle:()=>a(!i),testId:`remote-desktop-mobile-clipboard-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(te,{className:`size-4`}),label:`Play host audio`,hint:s??void 0,checked:o,disabled:s!==null,onToggle:()=>u(!o),testId:`remote-desktop-mobile-audio-toggle`}),(0,W.jsx)(X,{icon:(0,W.jsx)(ne,{className:`size-4`}),label:`Privacy mode`,hint:m??`Blocks the host's own keyboard and mouse`,checked:f,disabled:m!==null&&!f,onToggle:()=>h(!f),testId:`remote-desktop-mobile-privacy-toggle`}),S&&E.length>1&&(0,W.jsxs)(`div`,{className:`px-3 pt-1`,children:[(0,W.jsx)(`div`,{className:`pb-1.5 text-[10px] uppercase tracking-wide text-white/40`,children:`Resolution`}),(0,W.jsxs)(`div`,{className:`flex max-h-28 flex-wrap gap-1.5 overflow-y-auto`,children:[y&&y!==_&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>x(y),"data-testid":`remote-desktop-mobile-resolution-original`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Original`}),O&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>x(O.id),"data-testid":`remote-desktop-mobile-resolution-fit-local`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Fit local`}),E.map(e=>{let t=(_??E.find(e=>e.current)?.id)===e.id;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>x(e.id),"data-testid":`remote-desktop-mobile-resolution-${e.width}x${e.height}`,className:b(`min-h-9 rounded-md px-2.5 py-1 text-[11px] tabular-nums`,t?`bg-white/25 text-white`:`bg-white/10 text-white/70 active:bg-white/20`),children:[e.width,`×`,e.height]},e.id)})]}),C&&(0,W.jsx)(`div`,{className:`pt-1.5 text-[10px] leading-tight text-red-400`,children:C})]}),(0,W.jsxs)(`button`,{type:`button`,onClick:se,"data-testid":`remote-desktop-mobile-screenshot`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:[(0,W.jsx)(ee,{className:`size-4 opacity-80`}),` Save screenshot`]}),w&&(0,W.jsx)(`button`,{type:`button`,onClick:ae,"data-testid":`remote-desktop-mobile-record`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:ie?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{className:`size-4 text-red-500`}),` Stop recording`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(v,{className:`size-4 opacity-80`}),` Start recording`]})})]})}function _e({onClose:e}){let i=(0,k.useRef)(null),a=(0,k.useRef)(null),[s,c]=(0,k.useState)(`mouse`),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(!1),p=w(),{connState:m,errorMessage:h,decoderStatus:g,decoderErrorMessage:_,sendMessage:v,reconnect:ee,getTotalBytes:te,getFrameCount:ne,quality:b,setQuality:re,showCursor:T,setShowCursor:oe,audioOn:D,setAudioOn:le,getAudioTracks:ue,privacyOn:A,privacyError:j,setPrivacyOn:M,hostModeId:N,hostOriginalModeId:P,resolutionError:F,setHostMode:I,inputBlocked:L,pendingHostClipboard:R,clearHostClipboard:z,sendClipboard:B,requestHostClipboard:V}=ie(a,{displayId:p.displayId}),H=r(e=>e.remoteDesktopStatsVisible),U=r(e=>e.toggleRemoteDesktopStatsVisible),G=r(e=>e.remoteDesktopClipboardSync),me=r(e=>e.setRemoteDesktopClipboardSync),K=r(e=>e.remoteDesktopQuality),q=m===`streaming`,{transform:J,virtualCursor:Y,resetZoom:X}=de({containerRef:i,canvasRef:a,mode:s,sendMessage:v,enabled:q}),[_e,ve]=(0,k.useState)(!1),ye=(0,k.useCallback)(e=>{ve(!0),B(e,!0)},[B]),{caps:Z}=S(!1),Q=C(a,ue),{inputRef:be,show:xe}=fe(v,q,G?ye:void 0),$=x(!0)?.keyboardInset??0,Se=(0,k.useCallback)(()=>c(e=>e===`mouse`?`touch`:`mouse`),[]),Ce=(0,k.useCallback)(()=>{xe(),u(!0)},[xe]),we=g===`unsupported`?_:m===`error`?h:m===`closed`?`Disconnected`:m===`connecting`?`Connecting…`:null,Te={transform:`translate(${J.panX}px, ${J.panY}px) scale(${J.scale})`},Ee=`${(Y?.xFrac??.5)*100}%`,De=`${(Y?.yFrac??.5)*100}%`;if(Y&&i.current&&a.current?.width&&a.current.height){let e=i.current.getBoundingClientRect(),t=O({left:0,top:0,width:e.width,height:e.height},a.current.width,a.current.height);Ee=`${t.left+Y.xFrac*t.width}px`,De=`${t.top+Y.yFrac*t.height}px`}return(0,W.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":m,children:[(0,W.jsxs)(`div`,{ref:i,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:$},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,W.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:Te,children:[(0,W.jsx)(`canvas`,{ref:a,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),s===`mouse`&&Y&&q&&(0,W.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:Ee,top:De,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/J.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),we&&(0,W.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,W.jsx)(o,{className:`size-6 opacity-70`}),(0,W.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:we}),(m===`error`||m===`closed`)&&g!==`unsupported`&&(0,W.jsxs)(`button`,{onClick:ee,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,W.jsx)(y,{className:`size-3.5`}),` Reconnect`]})]}),(0,W.jsx)(E,{blocked:L}),(0,W.jsx)(`input`,{ref:be,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>u(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,W.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:$>0?{transform:`translateY(-${$}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[(0,W.jsx)(se,{pendingText:R,onDismiss:z,missingToolAction:_e&&Z&&!Z.clipboard.available?Z.clipboard.action:null,onDismissMissingTool:()=>ve(!1),positionClassName:`mx-2 mb-1 max-w-[calc(100%-1rem)]`}),d&&(0,W.jsx)(ge,{statsVisible:H,onToggleStats:U,showCursor:T,onSetShowCursor:oe,clipboardEnabled:G,onSetClipboardEnabled:me,audioOn:D,audioReason:Z&&!Z.audio.available?Z.audio.reason:null,onSetAudioOn:le,privacyOn:A,privacyReason:j??(Z&&!Z.privacy.available?Z.privacy.reason:null),hostModes:Z?.resolutions?.modes??[],hostModeId:N,hostOriginalModeId:P,onSetHostMode:I,canResizeHost:Z?.inputReady??!1,resolutionError:F,onSetPrivacyOn:M,recording:Q.recording,recordingSupported:Q.supported,onToggleRecording:Q.toggle,onScreenshot:()=>void ce(a.current)}),l&&(0,W.jsx)(he,{sendMessage:v,onCopyCombo:G?V:void 0}),(0,W.jsx)(pe,{displayLabel:p.displays.length>1?p.current?.label??null:null,onNextDisplay:p.next,qualityLabel:n(K),onNextQuality:()=>re(t(K)),mode:s,onToggleMode:Se,onOpenKeyboard:Ce,onResetZoom:X,settingsOpen:d,onToggleSettings:()=>f(e=>!e),onClose:e})]}),(0,W.jsx)(ae,{canvasRef:a,getFrameCount:ne,getTotalBytes:te,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{_e as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{t}from"./settings-store-DirmJxtu.js";import{D as n,E as r}from"./vendor-markdown-26eoXJk7.js";import{Ar as i,Kr as a,N as o,Sn as s,gt as c,kr as l,q as u,r as d,zn as f}from"./icons-CpR5Vw3J.js";import{r as p}from"./api-client-DSCscZEd.js";import{i as m}from"./control-size-DFdAJqoq.js";import{vn as h}from"./index-CToe9paM.js";import{r as g}from"./run-in-terminal-Bhp0sfyb.js";var _=e(n(),1),v=r();function y({onCancel:e,children:n}){let r=t(e=>e.remoteDesktopWarningDismissed),i=t(e=>e.setRemoteDesktopWarningDismissed),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1);if(r||a)return(0,v.jsx)(v.Fragment,{children:n});let u=()=>{s&&i(!0),o(!0)};return(0,v.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-warning-gate`,children:(0,v.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(f,{className:`size-5 shrink-0 text-primary`}),(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:`Remote Desktop`}),(0,v.jsx)(`span`,{className:`ml-auto rounded-full bg-amber-500/20 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-300`,children:`Beta`})]}),(0,v.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-white/80`,children:[(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,v.jsxs)(`span`,{children:[`This streams the host's `,(0,v.jsx)(`strong`,{children:`whole screen`}),` and lets you `,(0,v.jsx)(`strong`,{children:`move its mouse and type`}),` as if you were sitting at it. Anything you do here happens on the real desktop.`]})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,v.jsx)(`span`,{children:`Anyone signed in to this PPM can do the same. Avoid opening it over a public share link you don't fully trust; a private network (Tailscale, LAN) is safer.`})]}),(0,v.jsxs)(`li`,{className:`flex gap-2`,children:[(0,v.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,v.jsx)(`span`,{children:`Still beta: the host must be unlocked with an active session, UAC prompts stay hidden, and a person at the host will fight you for the cursor.`})]})]}),(0,v.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 text-sm text-white/70`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`size-4 accent-primary`,"data-testid":`remote-desktop-warning-dont-show`}),`Don't show this again`]}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,"data-testid":`remote-desktop-warning-cancel`,children:`Cancel`}),(0,v.jsx)(`button`,{type:`button`,onClick:u,className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`remote-desktop-warning-continue`,children:`Continue`})]})]})})}var b=5e3;function x(e){let t=e;return!!t&&typeof t.action==`string`&&Number.isFinite(t.deadlineMs)&&Number.isFinite(t.armedMs)}function S(e){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(0),a=(0,_.useCallback)(()=>i(e=>e+1),[]);return(0,_.useEffect)(()=>{if(!e){n(null);return}let t=!1;return p.get(`/api/remote-desktop/headless-helper/rescue`).then(e=>{t||n(x(e)?e:null)}).catch(()=>{t||n(null)}),()=>{t=!0}},[e,r]),(0,_.useEffect)(()=>{if(!e)return;let t=setInterval(a,b);return()=>clearInterval(t)},[e,a]),{rescue:t,refresh:a,confirm:(0,_.useCallback)(async()=>{try{return await p.post(`/api/remote-desktop/headless-helper/confirm`)}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}finally{a()}},[a])}}var C=3*6e4;function w(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function T({rescue:e,now:t,onConfirm:n}){let[r,a]=(0,_.useState)(!1),[o,c]=(0,_.useState)(null),l=t>=e.deadlineMs,u=t>=e.deadlineMs+C,d=async()=>{a(!0),c(null);try{let e=await n();!e.ok&&!e.pending&&c(e.message||`The PC did not answer.`)}finally{a(!1)}};return(0,v.jsxs)(`div`,{role:`status`,className:`pointer-events-auto flex w-full max-w-xl flex-col gap-2 rounded-lg border border-amber-300/30 bg-black/85 px-3 py-2 text-xs text-amber-50 shadow-lg backdrop-blur md:flex-row md:items-center`,"data-testid":`remote-desktop-rescue-bar`,children:[(0,v.jsx)(i,{className:`hidden size-4 shrink-0 text-amber-300 md:block`}),(0,v.jsxs)(`p`,{className:`min-w-0 flex-1 leading-relaxed`,children:[u?`The safety net did not report back. Its log is in Settings → Remote Desktop. Dismissing still makes sure the session at this PC has a screen.`:l?`Safety net is running: Windows is making sure the session at this PC has a screen.`:(0,v.jsxs)(v.Fragment,{children:[`Safety net: unless you confirm by `,(0,v.jsx)(`strong`,{children:w(e.deadlineMs)}),`, Windows turns the virtual display on for the session at this PC. It never signs you out.`]}),o&&(0,v.jsx)(`span`,{className:`mt-1 block text-red-300`,role:`alert`,children:o})]}),(!l||u)&&(0,v.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>void d(),className:`inline-flex items-center justify-center gap-1.5 ${m} shrink-0 self-end bg-amber-300 font-medium text-black hover:bg-amber-200 disabled:opacity-60 md:self-auto`,"data-testid":`remote-desktop-rescue-confirm`,children:[r&&(0,v.jsx)(s,{className:`size-3.5 animate-spin`}),u?`Dismiss`:`I can still reach this PC`]})]})}function E({label:e}){let[t,n]=(0,_.useState)({state:`idle`}),r=(0,_.useRef)(0),[i,a]=(0,_.useState)(!1),[o,c]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=!1,t=!1,i=async()=>{if(t)return;t=!0;let i=r.current;try{let t=await p.get(`/api/remote-desktop/requirements/ffmpeg/install`);!e&&i===r.current&&(n(t),c(null))}catch(t){!e&&i===r.current&&c(t.message)}finally{t=!1}};i();let a=setInterval(i,2e3);return()=>{e=!0,clearInterval(a)}},[]);let l=async()=>{r.current++,a(!0),c(null);try{let e=await p.post(`/api/remote-desktop/requirements/ffmpeg/install`);r.current++,n(e)}catch(e){c(e.message)}finally{a(!1)}},u=i||t.state===`installing`;return(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,v.jsxs)(`button`,{type:`button`,disabled:u||t.state===`installed`,onClick:()=>void l(),className:`inline-flex items-center justify-center ${m} self-start bg-white/10 hover:bg-white/20 disabled:opacity-50`,children:[u&&(0,v.jsx)(s,{className:`size-3.5 animate-spin`}),u?`Installing ffmpeg…`:t.state===`installed`?`Installed — checking…`:e]}),u&&(0,v.jsx)(`p`,{role:`status`,className:`text-xs text-white/70`,children:`Installing on the host. You can close this panel and return later.`}),(o||t.error)&&(0,v.jsx)(`p`,{role:`alert`,className:`text-sm text-red-300`,children:o||t.error})]})}function D({className:e,label:t,run:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),c=async()=>{i(!0),o(null);try{o(await n())}finally{i(!1)}};return(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`${e} self-start disabled:opacity-50`,disabled:r,onClick:()=>void c(),children:[r&&(0,v.jsx)(s,{className:`size-3.5 animate-spin`}),t]}),a?.message&&(0,v.jsx)(`p`,{role:a.ok||a.pending?`status`:`alert`,className:`text-xs ${a.ok?`text-emerald-300`:a.pending?`text-white/70`:`text-red-300`}`,"data-result":a.ok?`ok`:a.pending?`pending`:`failed`,children:a.message})]})}var O=`inline-flex items-center justify-center ${m}`;function k({req:e,...t}){return(0,v.jsxs)(`li`,{className:`flex gap-2`,"data-testid":`remote-desktop-requirement-${e.id}`,"data-ok":e.ok,children:[e.ok?(0,v.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-emerald-400`}):(0,v.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.title,!e.ok&&(0,v.jsx)(`span`,{className:`ml-2 text-xs font-normal text-white/50`,children:e.gates===`video`?`required`:e.gates===`choice`?`choose one`:`for mouse & keyboard`})]}),!e.ok&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`p`,{className:`text-sm text-white/70`,children:e.detail}),e.steps&&e.steps.length>0&&(0,v.jsx)(`ol`,{className:`flex list-decimal flex-col gap-1 pl-5 text-sm text-white/80 marker:text-white/50`,"data-testid":`remote-desktop-requirement-${e.id}-steps`,children:e.steps.map(e=>(0,v.jsx)(`li`,{children:e},e))}),e.warning&&(0,v.jsxs)(`p`,{className:`flex gap-2 rounded-md border border-amber-300/30 bg-amber-300/10 px-3 py-2 text-xs text-amber-100`,"data-testid":`remote-desktop-requirement-${e.id}-warning`,children:[(0,v.jsx)(d,{className:`mt-px size-3.5 shrink-0 text-amber-300`}),(0,v.jsx)(`span`,{children:e.warning})]}),e.safety&&(0,v.jsxs)(`p`,{className:`flex gap-2 rounded-md border border-emerald-300/25 bg-emerald-300/10 px-3 py-2 text-xs text-emerald-50`,"data-testid":`remote-desktop-requirement-${e.id}-safety`,children:[(0,v.jsx)(i,{className:`mt-px size-3.5 shrink-0 text-emerald-300`}),(0,v.jsx)(`span`,{children:e.safety})]}),e.actions.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions.map(n=>(0,v.jsx)(A,{action:n,reqId:e.id,...t},n.label))})]})]})]})}function A({action:e,reqId:t,onHostAction:n,onTerminal:r,onAccept:i}){let o=`${O} bg-white/10 hover:bg-white/20`;return e.kind===`install`?(0,v.jsx)(E,{label:e.label}):e.kind===`continue`?(0,v.jsx)(`button`,{type:`button`,className:o,onClick:i,"data-testid":`remote-desktop-requirement-${t}-continue`,children:e.label}):e.kind===`terminal`?(0,v.jsxs)(`button`,{type:`button`,className:o,onClick:()=>r(e.command),title:e.command,children:[(0,v.jsx)(a,{className:`size-3.5`}),` `,e.label]}):e.kind===`link`?(0,v.jsxs)(`a`,{className:o,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,v.jsx)(c,{className:`size-3.5`}),` `,e.label]}):(0,v.jsx)(D,{className:o,label:e.label,run:()=>n(t,e.action)})}function j({onCancel:e,children:t}){let[n,r]=(0,_.useState)(!1),{caps:i,failed:a,runHostAction:o}=h(!n),s=S(i?.platform===`win32`);return(0,v.jsxs)(`div`,{className:`relative h-full w-full`,children:[n||i?.videoReady&&i.inputReady&&!M(i)?t:(0,v.jsx)(N,{caps:i,failed:a,onCancel:e,onAccept:()=>r(!0),runHostAction:async(e,t)=>{let n=await o(e,t);return s.refresh(),n}}),s.rescue&&(0,v.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-2 z-50 flex justify-center px-4`,children:(0,v.jsx)(T,{rescue:s.rescue,now:Date.now(),onConfirm:s.confirm})})]})}function M(e){return e.requirements.some(e=>!e.ok&&e.gates===`choice`)}function N({caps:e,failed:t,onCancel:n,onAccept:r,runHostAction:i}){let a=e?.requirements.filter(e=>!e.ok&&e.gates!==`choice`)??[],o=!!e?.videoReady&&!e.inputReady,c=!!e&&M(e),l=e=>{g(e),n()};return(0,v.jsx)(`div`,{className:`flex h-full w-full overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-readiness-gate`,children:(0,v.jsxs)(`div`,{className:`m-auto flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(f,{className:`size-5 shrink-0 text-primary`}),(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:`This host needs a few things`})]}),!e&&!t&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/70`,children:[(0,v.jsx)(s,{className:`size-4 animate-spin`}),` Checking the host…`]}),t&&(0,v.jsx)(`p`,{className:`text-sm text-red-300`,children:`Could not reach the host's remote-desktop service.`}),(0,v.jsx)(`ul`,{className:`flex flex-col gap-3`,children:e?.requirements.map(e=>(0,v.jsx)(k,{req:e,onHostAction:i,onTerminal:l,onAccept:r},e.id))}),a.length>0&&(0,v.jsx)(`p`,{className:`text-xs text-white/50`,children:`Re-checking every few seconds — this updates by itself once fixed.`}),(0,v.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:n,className:`${O} bg-white/10 hover:bg-white/20`,children:`Cancel`}),!c&&(0,v.jsx)(`button`,{type:`button`,disabled:!e?.videoReady,onClick:r,className:`${O} bg-primary font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40`,"data-testid":`remote-desktop-readiness-continue`,children:o?`Continue (view only)`:`Continue`})]})]})})}export{y as n,j as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{Rn as r,Sn as i,Xr as a,ht as o,j as s,r as c}from"./icons-CpR5Vw3J.js";import{j as l,r as u}from"./api-client-DSCscZEd.js";import"./portal-container-context-C84rlnJ6.js";import{t as d}from"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{n as f}from"./use-is-mobile-CrfIt67b.js";import{t as p}from"./button-CtdEWN7U.js";import{a as m,n as h,o as g,t as _}from"./dialog-BWXzvHlC.js";import{i as v}from"./control-size-DFdAJqoq.js";import{t as y}from"./separator-TnMkIcEp.js";var b=e(t(),1),x=n(),S=`Set up the headless helper`;function C({onConfirm:e,onCancel:t}){let n=f(),r=(0,x.jsxs)(`div`,{className:`space-y-3 text-sm`,"data-testid":`headless-helper-confirm`,children:[(0,x.jsx)(`p`,{children:`Windows will show an administrator prompt on this PC. After you approve it, PPM installs:`}),(0,x.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`li`,{children:[`A small script in `,(0,x.jsx)(`code`,{children:`Program Files\\PPM\\RemoteDesktopHelper`}),` that only administrators can change.`]}),(0,x.jsxs)(`li`,{children:[`Scheduled tasks under `,(0,x.jsx)(`code`,{children:`\\PPM-RemoteDesktop`}),` that run that script as SYSTEM. They take no input, only your Windows user can start them, they only ever move your own session, and they make at most a few changes per half hour.`]}),(0,x.jsx)(`li`,{children:`A safety net: after PPM brings your session back or turns the virtual display on, you have 5 minutes to confirm you can still reach the PC. If you don't, Windows turns the virtual display on for the session at the PC's screen. It never signs you out. PPM also never turns the virtual display off while it is the only screen of someone signed in at the PC.`}),(0,x.jsx)(`li`,{children:`A virtual display driver (Virtual Display Driver 25.7.23, MIT, signed by SignPath Foundation). PPM checks its signature and the hash of every file before installing it, leaves it off, and turns it on only while a Remote Desktop session needs a screen. Windows may ask once more whether to trust the publisher.`})]}),(0,x.jsxs)(`p`,{className:`flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed`,children:[(0,x.jsx)(c,{className:`mt-px size-3.5 shrink-0 text-amber-500`}),(0,x.jsxs)(`span`,{children:[`When PPM brings your session back, it is signed in at this PC's own screen and `,(0,x.jsx)(`strong`,{children:`left unlocked`}),`: anyone at the PC, or anyone who plugs a monitor in, sees and can use your desktop. Some antivirus tools flag SYSTEM tasks like this one.`]})]}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The prompt appears on the PC itself, so do this while you are at it or connected with RDP or TeamViewer.`}),(0,x.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 pt-1 md:flex-row md:justify-end`,children:[(0,x.jsx)(p,{variant:`outline`,onClick:t,className:v,children:`Cancel`}),(0,x.jsx)(p,{onClick:e,className:v,"data-testid":`headless-helper-confirm-install`,children:`Install (admin prompt on the PC)`})]})]});return n?(0,x.jsx)(d,{open:!0,onClose:t,children:(0,x.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,x.jsx)(`h2`,{className:`mb-3 text-base font-semibold`,children:S}),r]})}):(0,x.jsx)(_,{open:!0,onOpenChange:e=>{e||t()},children:(0,x.jsxs)(h,{className:`sm:max-w-md`,children:[(0,x.jsx)(m,{children:(0,x.jsx)(g,{className:`text-sm`,children:S})}),r]})})}function w(e){if(e.job?.state===`running`)return e.job.kind===`install`?`Waiting for the administrator prompt on the PC…`:`Removing — approve the administrator prompt on the PC…`;if(e.otherUser)return`Installed for another Windows user. Reinstall to use it from this account.`;if(e.tooOld??(e.outdated&&!e.usable))return`Installed by an older PPM without the safety net, so PPM will not use it. Reinstall to update it.`;if(e.usable){let t=e.outdated?` A newer version is available: Reinstall to update it (optional).`:``;return(e.virtualDisplay?`Set up. From the Remote Desktop checklist PPM can bring your session back and turn on a virtual display.`:`Set up. PPM can bring your session back from the Remote Desktop checklist.`)+t}return e.installed?`Installed, but its tasks are missing. Reinstall to repair it.`:`Not set up.`}function T(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null),c=(0,b.useCallback)(async()=>{try{t(await u.get(`/api/remote-desktop/headless-helper`))}catch{t(null)}},[]);(0,b.useEffect)(()=>{c()},[c]);let l=e?.job?.state===`running`;(0,b.useEffect)(()=>{if(!l)return;let e=setInterval(()=>void c(),2e3);return()=>clearInterval(e)},[l,c]);let d=async e=>{r(!1),o(null);try{await u.post(`/api/remote-desktop/headless-helper/${e}`)}catch(e){o(e instanceof Error?e.message:String(e))}await c()};if(!e?.supported)return null;let f=e.job?.state===`error`?e.job.message:null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(y,{}),(0,x.jsxs)(`section`,{className:`space-y-3`,"data-testid":`headless-helper-section`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-sm font-medium`,children:`Run without a monitor (Windows)`}),(0,x.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`When a Remote Desktop (RDP) window closes, Windows leaves your session disconnected and draws nothing, so there is no picture to capture; with no monitor plugged in there is no screen at all. This helper lets PPM bring the session back to this PC's own screen and turn on a virtual display for the session, from the Remote Desktop checklist, without TeamViewer. Setting it up needs one administrator prompt on the PC.`})]}),(0,x.jsxs)(`p`,{className:`flex items-center gap-2 text-xs`,"data-testid":`headless-helper-status`,children:[l?(0,x.jsx)(i,{className:`size-3.5 animate-spin`}):e.usable?(0,x.jsx)(s,{className:`size-3.5 text-emerald-500`}):null,w(e)]}),(a||f)&&(0,x.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:a||f}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,x.jsx)(p,{className:v,disabled:l,onClick:()=>r(!0),"data-testid":`headless-helper-install`,children:e.installed?`Reinstall`:`Set up`}),e.installed&&(0,x.jsx)(p,{variant:`outline`,className:v,disabled:l,onClick:()=>void d(`uninstall`),children:`Remove`})]}),n&&(0,x.jsx)(C,{onConfirm:()=>void d(`install`),onCancel:()=>r(!1)})]})]})}var E=e=>`${Math.round(e/1e6)} MB`;function D(){let[e,t]=(0,b.useState)(null),[n,c]=(0,b.useState)(!1),d=(0,b.useRef)(null),f=(0,b.useCallback)(async()=>{try{t(await u.get(`/api/remote-desktop/relay`))}catch{}},[]);(0,b.useEffect)(()=>{f()},[f]);let m=!!e?.job&&!e.job.done;(0,b.useEffect)(()=>{if(m)return d.current=setTimeout(()=>void f(),700),()=>{d.current&&clearTimeout(d.current)}},[m,e,f]);let h=async()=>{c(!0);try{await u.post(`/api/remote-desktop/relay/install`),await f()}catch(e){l.error(`Could not start the download`,{description:e instanceof Error?e.message:String(e)})}finally{c(!1)}},g=async()=>{c(!0);try{await u.post(`/api/remote-desktop/relay/uninstall`),await f()}catch(e){l.error(`Could not remove the relay`,{description:e instanceof Error?e.message:String(e)})}finally{c(!1)}},_=e?.job??null,v=_&&_.totalBytes>0?Math.round(_.receivedBytes/_.totalBytes*100):null,S=typeof window<`u`&&!window.isSecureContext;return(0,x.jsxs)(`div`,{className:`space-y-6`,children:[(0,x.jsxs)(`section`,{className:`space-y-3`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h3`,{className:`text-sm font-medium`,children:`WebRTC relay`}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:`Streams the desktop over WebRTC instead of a WebSocket. It repackages the video this host already encoded — it never re-encodes, so the picture and the CPU cost are unchanged.`})]}),S&&(0,x.jsxs)(`p`,{className:`rounded-md bg-muted px-4 py-3 text-xs leading-relaxed`,children:[`You are reading this over plain HTTP. Browsers only expose the WebCodecs video decoder on HTTPS or localhost, so `,(0,x.jsx)(`strong`,{children:`Remote Desktop cannot show a picture on this address`}),` without the relay. Installing it fixes that; so does reaching PPM through its HTTPS tunnel.`]}),!e?.available&&!e?.installed&&(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:[`MediaMTX publishes no build for this platform. You can install it yourself and put`,(0,x.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`mediamtx`}),`on this host's PATH — PPM generates its own configuration either way.`]}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e?.installed?(0,x.jsx)(s,{className:`size-4 text-emerald-500`}):(0,x.jsx)(r,{className:`size-4 text-muted-foreground`}),(0,x.jsx)(`span`,{children:e?.installed?e.source===`system`?`Installed on this host (not by PPM)`:`Installed — MediaMTX ${e.pinnedVersion}`:`Not installed`})]}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2 sm:ml-auto`,children:[!e?.installed&&e?.available&&(0,x.jsx)(p,{onClick:h,disabled:n||m,className:`min-h-11 px-4`,children:m?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{className:`size-4 animate-spin`}),`Downloading`,v===null?``:` ${v}%`]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{className:`size-4`}),`Install`]})}),e?.installed&&e.source===`bundled`&&(0,x.jsxs)(p,{variant:`outline`,onClick:g,disabled:n||m,className:`min-h-11 px-4`,children:[(0,x.jsx)(a,{className:`size-4`}),`Remove`]})]})]}),m&&_&&(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E(_.receivedBytes),_.totalBytes>0?` of ${E(_.totalBytes)}`:``]}),_?.error&&(0,x.jsx)(`p`,{className:`text-xs text-destructive`,children:_.error}),e?.path&&(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground break-all`,children:e.path})]}),(0,x.jsx)(y,{}),(0,x.jsxs)(`section`,{className:`space-y-2`,children:[(0,x.jsx)(`h3`,{className:`text-sm font-medium`,children:`What changes when it is on`}),(0,x.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground leading-relaxed`,children:[(0,x.jsx)(`li`,{children:`The picture works on a plain-HTTP LAN address, not only over HTTPS or localhost.`}),(0,x.jsx)(`li`,{children:`A lost packet costs one retransmission instead of stalling the whole stream.`}),(0,x.jsx)(`li`,{children:`Keyboard, mouse, clipboard and host audio keep using the same WebSocket.`}),(0,x.jsx)(`li`,{children:`Video leaves this host on its own UDP port, protected by per-session credentials.`})]})]}),(0,x.jsx)(T,{})]})}export{D as RemoteDesktopSettingsSection};
|
|
Binary file
|
|
Binary file
|