@hienlh/ppm 0.23.35 → 0.23.37
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 +19 -0
- package/CLAUDE.md +1 -1
- 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-C9WjjsQe.js → accounts-settings-section-BqecmsoA.js} +1 -1
- package/dist/web/assets/accounts-settings-section-BqecmsoA.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-BqecmsoA.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-c9RXWb8Z.js → agent-session-sheet-OiEfPbDF.js} +2 -2
- package/dist/web/assets/agent-session-sheet-OiEfPbDF.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-OiEfPbDF.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-BvueUcUA.js → agent-session-window-content-CVwlys5q.js} +1 -1
- package/dist/web/assets/agent-session-window-content-CVwlys5q.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-CVwlys5q.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-DDrEZMfA.js → ai-resource-editor-Du_9S9kA.js} +1 -1
- package/dist/web/assets/ai-resource-editor-Du_9S9kA.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-Du_9S9kA.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-C7uXe_oX.js → ai-settings-section-CSuiATMV.js} +1 -1
- package/dist/web/assets/{ai-settings-section-Bl1AEwin.js → ai-settings-section-PZglMLRl.js} +1 -1
- package/dist/web/assets/ai-settings-section-PZglMLRl.js.br +0 -0
- package/dist/web/assets/ai-settings-section-PZglMLRl.js.gz +0 -0
- package/dist/web/assets/{android-tab-7NZ2od9I.js → android-tab-CXjsyLHP.js} +1 -1
- package/dist/web/assets/android-tab-CXjsyLHP.js.br +0 -0
- package/dist/web/assets/android-tab-CXjsyLHP.js.gz +0 -0
- package/dist/web/assets/{appearance-settings-section-BHuE4Tk9.js → appearance-settings-section-BM1-xo4F.js} +1 -1
- package/dist/web/assets/appearance-settings-section-BM1-xo4F.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-BM1-xo4F.js.gz +0 -0
- package/dist/web/assets/{apps-panel-C5OWcuRU.js → apps-panel-BU4HzsNe.js} +1 -1
- package/dist/web/assets/apps-panel-BU4HzsNe.js.br +0 -0
- package/dist/web/assets/apps-panel-BU4HzsNe.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-Ct7F_e7T.js → branch-review-tab-BpxQekO5.js} +1 -1
- package/dist/web/assets/branch-review-tab-BpxQekO5.js.br +0 -0
- package/dist/web/assets/branch-review-tab-BpxQekO5.js.gz +0 -0
- package/dist/web/assets/{chat-tab-CQJ8IbuT.js → chat-tab-0gJ05Q2m.js} +1 -1
- package/dist/web/assets/chat-tab-0gJ05Q2m.js.br +0 -0
- package/dist/web/assets/chat-tab-0gJ05Q2m.js.gz +0 -0
- package/dist/web/assets/{chat-tab-BOG8kLRL.js → chat-tab-BxbrkXLz.js} +12 -12
- package/dist/web/assets/chat-tab-BxbrkXLz.js.br +0 -0
- package/dist/web/assets/chat-tab-BxbrkXLz.js.gz +0 -0
- package/dist/web/assets/{code-editor-qJqN7Do4.js → code-editor-BRrPWyxx.js} +4 -4
- package/dist/web/assets/code-editor-BRrPWyxx.js.br +0 -0
- package/dist/web/assets/code-editor-BRrPWyxx.js.gz +0 -0
- package/dist/web/assets/codex-plan-label-BMq1Pj0j.js +1 -0
- package/dist/web/assets/codex-plan-label-BMq1Pj0j.js.br +0 -0
- package/dist/web/assets/codex-plan-label-BMq1Pj0j.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-LMUNqZwR.js → conflict-editor-D6LMYODJ.js} +1 -1
- package/dist/web/assets/conflict-editor-D6LMYODJ.js.br +0 -0
- package/dist/web/assets/conflict-editor-D6LMYODJ.js.gz +0 -0
- package/dist/web/assets/{connection-form-tab-DVx_Ah2L.js → connection-form-tab-TZKBTY_b.js} +1 -1
- package/dist/web/assets/connection-form-tab-TZKBTY_b.js.br +0 -0
- package/dist/web/assets/connection-form-tab-TZKBTY_b.js.gz +0 -0
- package/dist/web/assets/{csv-preview-6jUz39o2.js → csv-preview-BQwhXKFj.js} +1 -1
- package/dist/web/assets/csv-preview-BQwhXKFj.js.br +0 -0
- package/dist/web/assets/csv-preview-BQwhXKFj.js.gz +0 -0
- package/dist/web/assets/{db-tab-parts-BaTFg7AE.js → db-tab-parts-ovTyiRol.js} +1 -1
- package/dist/web/assets/db-tab-parts-ovTyiRol.js.br +0 -0
- package/dist/web/assets/db-tab-parts-ovTyiRol.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-bt7EoAL8.js → design-settings-section-C3Z6BH4L.js} +1 -1
- package/dist/web/assets/design-settings-section-C3Z6BH4L.js.br +0 -0
- package/dist/web/assets/design-settings-section-C3Z6BH4L.js.gz +0 -0
- package/dist/web/assets/{design-tab-BrKidYIP.js → design-tab-C86a4i5X.js} +1 -1
- package/dist/web/assets/design-tab-C86a4i5X.js.br +0 -0
- package/dist/web/assets/design-tab-C86a4i5X.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-Cl_uURB2.js → designs-sidebar-panel-DE6o3mwd.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-DE6o3mwd.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-DE6o3mwd.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-D-O87Yxb.js → diff-viewer-CvCVdYsj.js} +1 -1
- package/dist/web/assets/diff-viewer-CvCVdYsj.js.br +0 -0
- package/dist/web/assets/diff-viewer-CvCVdYsj.js.gz +0 -0
- package/dist/web/assets/{docx-preview-BSSxJWPf.js → docx-preview-C65V_WXK.js} +1 -1
- package/dist/web/assets/docx-preview-C65V_WXK.js.br +0 -0
- package/dist/web/assets/docx-preview-C65V_WXK.js.gz +0 -0
- package/dist/web/assets/{editor-dialog-oaq7S3q1.js → editor-dialog-5e66Mkbr.js} +1 -1
- package/dist/web/assets/editor-dialog-5e66Mkbr.js.br +0 -0
- package/dist/web/assets/editor-dialog-5e66Mkbr.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-b2AmdWLS.js → editor-language-service-D5E8gpKg.js} +1 -1
- package/dist/web/assets/editor-language-service-D5E8gpKg.js.br +0 -0
- package/dist/web/assets/editor-language-service-D5E8gpKg.js.gz +0 -0
- package/dist/web/assets/{explorer-body-C1eUrzzz.js → explorer-body-CKo1b-px.js} +1 -1
- package/dist/web/assets/explorer-body-CKo1b-px.js.br +0 -0
- package/dist/web/assets/explorer-body-CKo1b-px.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-DbdkryVJ.js → explorer-window-content-Cny9rBPR.js} +1 -1
- package/dist/web/assets/explorer-window-content-Cny9rBPR.js.br +0 -0
- package/dist/web/assets/explorer-window-content-Cny9rBPR.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-Dr30Isjd.js → extension-manager-section-Cwm_A0eX.js} +1 -1
- package/dist/web/assets/extension-manager-section-Cwm_A0eX.js.br +0 -0
- package/dist/web/assets/extension-manager-section-Cwm_A0eX.js.gz +0 -0
- package/dist/web/assets/{extension-webview-DZtquSWa.js → extension-webview-DVgUwiLx.js} +1 -1
- package/dist/web/assets/extension-webview-DVgUwiLx.js.br +0 -0
- package/dist/web/assets/extension-webview-DVgUwiLx.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-B_m4WeN9.js → files-settings-section-Bi5Em_JV.js} +1 -1
- package/dist/web/assets/files-settings-section-Bi5Em_JV.js.br +0 -0
- package/dist/web/assets/files-settings-section-Bi5Em_JV.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-BPLnV8sc.js → general-settings-section-DmxA1IOg.js} +1 -1
- package/dist/web/assets/general-settings-section-DmxA1IOg.js.br +0 -0
- package/dist/web/assets/general-settings-section-DmxA1IOg.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-BFKb7zLn.js → git-log-panel-BM7G_THH.js} +1 -1
- package/dist/web/assets/git-log-panel-BM7G_THH.js.br +0 -0
- package/dist/web/assets/git-log-panel-BM7G_THH.js.gz +0 -0
- package/dist/web/assets/{git-review-tab-CcGcCb7q.js → git-review-tab-DN7GixUN.js} +1 -1
- package/dist/web/assets/git-review-tab-DN7GixUN.js.br +0 -0
- package/dist/web/assets/git-review-tab-DN7GixUN.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-bduAeYV2.js → glide-data-grid-Cd-By4_k.js} +1 -1
- package/dist/web/assets/glide-data-grid-Cd-By4_k.js.br +0 -0
- package/dist/web/assets/glide-data-grid-Cd-By4_k.js.gz +0 -0
- package/dist/web/assets/{grid-save-dialog-DaX_t0cC.js → grid-save-dialog-Bysi6jcf.js} +1 -1
- package/dist/web/assets/grid-save-dialog-Bysi6jcf.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-Bysi6jcf.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-CkbQwD0f.js → group-chat-tab-Cwnmgveq.js} +1 -1
- package/dist/web/assets/group-chat-tab-Cwnmgveq.js.br +0 -0
- package/dist/web/assets/group-chat-tab-Cwnmgveq.js.gz +0 -0
- package/dist/web/assets/{impexp-tab-6-NdGUTE.js → impexp-tab-pRKP_Gem.js} +1 -1
- package/dist/web/assets/impexp-tab-pRKP_Gem.js.br +0 -0
- package/dist/web/assets/impexp-tab-pRKP_Gem.js.gz +0 -0
- package/dist/web/assets/index-BvTu5VV7.css +1 -0
- package/dist/web/assets/index-BvTu5VV7.css.br +0 -0
- package/dist/web/assets/index-BvTu5VV7.css.gz +0 -0
- package/dist/web/assets/{index-D3AIiXA6.js → index-Djsgk-RQ.js} +5 -5
- package/dist/web/assets/index-Djsgk-RQ.js.br +0 -0
- package/dist/web/assets/index-Djsgk-RQ.js.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-CscOeEYc.js → jira-watcher-section-D99EOVyT.js} +1 -1
- package/dist/web/assets/{keybindings-store-BQmYGfgT.js → keybindings-store-DMfPHNlt.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-jZkrlYgg.js → keyboard-shortcuts-section-U1icIFbF.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-U1icIFbF.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-U1icIFbF.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-CwBi9v3G.js → language-servers-section-YjP8WoJN.js} +2 -2
- package/dist/web/assets/language-servers-section-YjP8WoJN.js.br +0 -0
- package/dist/web/assets/language-servers-section-YjP8WoJN.js.gz +0 -0
- package/dist/web/assets/{logs-app-Cri-6dD4.js → logs-app-F0bClkEJ.js} +1 -1
- package/dist/web/assets/logs-app-F0bClkEJ.js.br +0 -0
- package/dist/web/assets/logs-app-F0bClkEJ.js.gz +0 -0
- package/dist/web/assets/{logs-tab-P4ITHSkO.js → logs-tab-D1qP9Per.js} +1 -1
- package/dist/web/assets/{logs-window-content-DckWluQx.js → logs-window-content-CFITrRuA.js} +1 -1
- package/dist/web/assets/{lsp-client-CgopGPAn.js → lsp-client-CueAbn9s.js} +1 -1
- package/dist/web/assets/lsp-client-CueAbn9s.js.br +0 -0
- package/dist/web/assets/lsp-client-CueAbn9s.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-Dx7Bz1og.js → markdown-renderer-B_2Teawh.js} +1 -1
- package/dist/web/assets/markdown-renderer-B_2Teawh.js.br +0 -0
- package/dist/web/assets/markdown-renderer-B_2Teawh.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-CjNqNfD9.js → markdown-renderer-CHxQpk27.js} +1 -1
- package/dist/web/assets/{mobile-explorer-sheet-D-3wavHz.js → mobile-explorer-sheet-D3ToEKi8.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-D3ToEKi8.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-D3ToEKi8.js.gz +0 -0
- package/dist/web/assets/{new-design-dialog-CVw_DBjW.js → new-design-dialog-D6LS4c5f.js} +1 -1
- package/dist/web/assets/new-design-dialog-D6LS4c5f.js.br +0 -0
- package/dist/web/assets/{new-design-dialog-CVw_DBjW.js.gz → new-design-dialog-D6LS4c5f.js.gz} +0 -0
- package/dist/web/assets/{notification-store-eU_EHlKR.js → notification-store-CaOtP7gW.js} +1 -1
- package/dist/web/assets/{notifications-settings-section-yMGGccmC.js → notifications-settings-section-CtN-Dp9a.js} +1 -1
- package/dist/web/assets/notifications-settings-section-CtN-Dp9a.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-CtN-Dp9a.js.gz +0 -0
- package/dist/web/assets/{onboarding-entry-CDEhPa4d.js → onboarding-entry-Dt8lTftA.js} +1 -1
- package/dist/web/assets/onboarding-entry-Dt8lTftA.js.br +0 -0
- package/dist/web/assets/onboarding-entry-Dt8lTftA.js.gz +0 -0
- package/dist/web/assets/{ppmbot-settings-section-By_LBVs_.js → ppmbot-settings-section-C14V_1AT.js} +1 -1
- package/dist/web/assets/ppmbot-settings-section-C14V_1AT.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-C14V_1AT.js.gz +0 -0
- package/dist/web/assets/{problems-panel-DD11hanr.js → problems-panel-Cc3oLH10.js} +1 -1
- package/dist/web/assets/problems-panel-Cc3oLH10.js.br +0 -0
- package/dist/web/assets/problems-panel-Cc3oLH10.js.gz +0 -0
- package/dist/web/assets/{process-table-DNUFHYIo.js → process-table-DFSuCzJv.js} +1 -1
- package/dist/web/assets/process-table-DFSuCzJv.js.br +0 -0
- package/dist/web/assets/process-table-DFSuCzJv.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-CDQwoCNQ.js → proxy-settings-section-D_10YLhJ.js} +1 -1
- package/dist/web/assets/proxy-settings-section-D_10YLhJ.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-D_10YLhJ.js.gz +0 -0
- package/dist/web/assets/{query-tab-wOBiiCkN.js → query-tab-BBW66pt8.js} +1 -1
- package/dist/web/assets/query-tab-BBW66pt8.js.br +0 -0
- package/dist/web/assets/query-tab-BBW66pt8.js.gz +0 -0
- package/dist/web/assets/{release-notes-window-content-BvM5fCc3.js → release-notes-window-content-BhkXneq_.js} +1 -1
- package/dist/web/assets/{remote-access-settings-section-Bcejk5yX.js → remote-access-settings-section-D7HZbkf9.js} +1 -1
- package/dist/web/assets/remote-access-settings-section-D7HZbkf9.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-D7HZbkf9.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-yBLT70du.js → remote-desktop-clipboard-notice-D__pMfmv.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-D__pMfmv.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-D__pMfmv.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-BSTcLpWO.js → remote-desktop-mobile-sheet-D5Vkceoa.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-D5Vkceoa.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-D5Vkceoa.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-gMTK58pt.js → remote-desktop-mobile-view-Bt2dcN1D.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-Bt2dcN1D.js.br +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-gMTK58pt.js.gz → remote-desktop-mobile-view-Bt2dcN1D.js.gz} +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-CEVskD11.js → remote-desktop-readiness-gate-BpFfyTsH.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-BpFfyTsH.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-BpFfyTsH.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-ChG6WvBM.js → remote-desktop-window-content-C7-VCR9l.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-C7-VCR9l.js.br +0 -0
- package/dist/web/assets/{remote-desktop-window-content-ChG6WvBM.js.gz → remote-desktop-window-content-C7-VCR9l.js.gz} +0 -0
- package/dist/web/assets/{rename-object-dialog-Db-yXtcA.js → rename-object-dialog-Ci2Q-EjU.js} +1 -1
- package/dist/web/assets/rename-object-dialog-Ci2Q-EjU.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-Ci2Q-EjU.js.gz +0 -0
- package/dist/web/assets/{review-address-setup-Wq2ZAqJq.js → review-address-setup-ClD8hIdZ.js} +1 -1
- package/dist/web/assets/review-address-setup-ClD8hIdZ.js.br +0 -0
- package/dist/web/assets/review-address-setup-ClD8hIdZ.js.gz +0 -0
- package/dist/web/assets/{review-code-6h72L1qs.js → review-code-C6hCzJPK.js} +1 -1
- package/dist/web/assets/review-code-C6hCzJPK.js.br +0 -0
- package/dist/web/assets/review-code-C6hCzJPK.js.gz +0 -0
- package/dist/web/assets/{save-as-dialog-DptZuJOK.js → save-as-dialog-C3x3p2a1.js} +1 -1
- package/dist/web/assets/save-as-dialog-C3x3p2a1.js.br +0 -0
- package/dist/web/assets/save-as-dialog-C3x3p2a1.js.gz +0 -0
- package/dist/web/assets/{schedule-script-editor-BFwoCOJm.js → schedule-script-editor-DTouje50.js} +1 -1
- package/dist/web/assets/schedule-script-editor-DTouje50.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-DTouje50.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-MbRDGxmJ.js → schedules-settings-section-WLKCVgcB.js} +3 -3
- package/dist/web/assets/schedules-settings-section-WLKCVgcB.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-WLKCVgcB.js.gz +0 -0
- package/dist/web/assets/session-changes-chip-DkR0vEXV.js +1 -0
- package/dist/web/assets/session-changes-chip-DkR0vEXV.js.br +0 -0
- package/dist/web/assets/session-changes-chip-DkR0vEXV.js.gz +0 -0
- package/dist/web/assets/{session-review-tab-DwvTrNpU.js → session-review-tab-BiJdqULL.js} +4 -4
- package/dist/web/assets/session-review-tab-BiJdqULL.js.br +0 -0
- package/dist/web/assets/session-review-tab-BiJdqULL.js.gz +0 -0
- package/dist/web/assets/{settings-body-CtfaSVfJ.js → settings-body-Bclb7RrO.js} +1 -1
- package/dist/web/assets/settings-body-Bclb7RrO.js.br +0 -0
- package/dist/web/assets/settings-body-Bclb7RrO.js.gz +0 -0
- package/dist/web/assets/{settings-rows-BnsoteWX.js → settings-rows-DHLeflwQ.js} +1 -1
- package/dist/web/assets/settings-rows-DHLeflwQ.js.br +0 -0
- package/dist/web/assets/settings-rows-DHLeflwQ.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-DxntwUPx.js → settings-section-content-DCAeJ74-.js} +1 -1
- package/dist/web/assets/{settings-section-content-QQdTEhq_.js → settings-section-content-DPgMyITT.js} +2 -2
- package/dist/web/assets/settings-section-content-DPgMyITT.js.br +0 -0
- package/dist/web/assets/settings-section-content-DPgMyITT.js.gz +0 -0
- package/dist/web/assets/{settings-tab-BdcDyiMx.js → settings-tab-BqD_lM3r.js} +1 -1
- package/dist/web/assets/{settings-window-content-q6nyzjJo.js → settings-window-content-zyX-qZcM.js} +1 -1
- package/dist/web/assets/slash-command-picker-DlAIFFRx.js +1 -0
- package/dist/web/assets/slash-command-picker-DlAIFFRx.js.br +0 -0
- package/dist/web/assets/slash-command-picker-DlAIFFRx.js.gz +0 -0
- package/dist/web/assets/{sql-object-tab-CcIcW9Xw.js → sql-object-tab-oJBWJhmf.js} +1 -1
- package/dist/web/assets/sql-object-tab-oJBWJhmf.js.br +0 -0
- package/dist/web/assets/sql-object-tab-oJBWJhmf.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-VQ35jeKe.js → sqlite-viewer-52ODwLuu.js} +1 -1
- package/dist/web/assets/sqlite-viewer-52ODwLuu.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-52ODwLuu.js.gz +0 -0
- package/dist/web/assets/{storage-settings-section-D7WZNfj1.js → storage-settings-section-DLQg2r4O.js} +1 -1
- package/dist/web/assets/storage-settings-section-DLQg2r4O.js.br +0 -0
- package/dist/web/assets/storage-settings-section-DLQg2r4O.js.gz +0 -0
- package/dist/web/assets/{structure-save-dialog-zywcwCve.js → structure-save-dialog-Dsk6LIod.js} +1 -1
- package/dist/web/assets/structure-save-dialog-Dsk6LIod.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-Dsk6LIod.js.gz +0 -0
- package/dist/web/assets/{structure-tab-DfQPOws7.js → structure-tab-CB7hPpzs.js} +1 -1
- package/dist/web/assets/structure-tab-CB7hPpzs.js.br +0 -0
- package/dist/web/assets/structure-tab-CB7hPpzs.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-_ZXLIgj3.js → system-monitor-body-riDaJGUH.js} +2 -2
- package/dist/web/assets/system-monitor-body-riDaJGUH.js.br +0 -0
- package/dist/web/assets/system-monitor-body-riDaJGUH.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-DU9YSWde.js → system-monitor-tab-DGOJrSxt.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-P5UqFoAI.js → system-monitor-window-content-CVdRWw88.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-C-iNC5Tr.js → tab-host-window-content-BHSn8qO0.js} +1 -1
- package/dist/web/assets/tab-host-window-content-BHSn8qO0.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-BHSn8qO0.js.gz +0 -0
- package/dist/web/assets/{table-tab-CXtfbrfa.js → table-tab-C_0OFX08.js} +1 -1
- package/dist/web/assets/table-tab-C_0OFX08.js.br +0 -0
- package/dist/web/assets/table-tab-C_0OFX08.js.gz +0 -0
- package/dist/web/assets/{telegram-bot-token-field-p9-9Q6s9.js → telegram-bot-token-field-C7E5TbgV.js} +1 -1
- package/dist/web/assets/telegram-bot-token-field-C7E5TbgV.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-C7E5TbgV.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-OOZAauPO.js → terminal-tab-CnBA7BeP.js} +1 -1
- package/dist/web/assets/terminal-tab-CnBA7BeP.js.br +0 -0
- package/dist/web/assets/terminal-tab-CnBA7BeP.js.gz +0 -0
- package/dist/web/assets/{tool-cards-BGuRs10L.js → tool-cards-JYbIrLD8.js} +10 -10
- package/dist/web/assets/tool-cards-JYbIrLD8.js.br +0 -0
- package/dist/web/assets/tool-cards-JYbIrLD8.js.gz +0 -0
- package/dist/web/assets/{tools-settings-section-DG0eQmcn.js → tools-settings-section-DjLW6AM1.js} +1 -1
- package/dist/web/assets/tools-settings-section-DjLW6AM1.js.br +0 -0
- package/dist/web/assets/tools-settings-section-DjLW6AM1.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-BSYa1U1f.js → use-inline-blame-8fCUHKP0.js} +1 -1
- package/dist/web/assets/use-inline-blame-8fCUHKP0.js.br +0 -0
- package/dist/web/assets/use-inline-blame-8fCUHKP0.js.gz +0 -0
- package/dist/web/assets/{use-lsp-BojDXxMq.js → use-lsp-DCuYqz2U.js} +1 -1
- package/dist/web/assets/use-lsp-DCuYqz2U.js.br +0 -0
- package/dist/web/assets/use-lsp-DCuYqz2U.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-DEjM319A.js → use-monaco-theme-Do0n80KC.js} +1 -1
- package/dist/web/assets/{use-process-kill-BF3uuOO4.js → use-process-kill-C8aSMLzg.js} +1 -1
- package/dist/web/assets/use-process-kill-C8aSMLzg.js.br +0 -0
- package/dist/web/assets/use-process-kill-C8aSMLzg.js.gz +0 -0
- package/dist/web/assets/{use-sql-schema-info-QLCBuqi5.js → use-sql-schema-info-UitR1tk3.js} +1 -1
- package/dist/web/assets/use-sql-schema-info-UitR1tk3.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-UitR1tk3.js.gz +0 -0
- package/dist/web/assets/{use-websocket-BYVZkJK0.js → use-websocket-DnhUE09Z.js} +1 -1
- package/dist/web/assets/{web-preview-tab-DisllKkq.js → web-preview-tab-BW4ulv7h.js} +1 -1
- package/dist/web/assets/web-preview-tab-BW4ulv7h.js.br +0 -0
- package/dist/web/assets/web-preview-tab-BW4ulv7h.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/docs/architecture/workspace-and-ui.md +22 -9
- package/package.json +1 -1
- package/src/web/components/chat/chat-footer-tools.tsx +50 -23
- package/src/web/components/chat/chat-more-menu.tsx +6 -3
- package/src/web/components/chat/chat-tab.tsx +28 -25
- package/src/web/components/chat/composer-picker-parts.tsx +104 -0
- package/src/web/components/chat/file-picker.tsx +63 -30
- package/src/web/components/chat/footer-chip.ts +20 -10
- package/src/web/components/chat/linked-sessions-panel.tsx +3 -3
- package/src/web/components/chat/message-input.tsx +2 -2
- package/src/web/components/chat/model-thinking-selector.tsx +3 -2
- package/src/web/components/chat/slash-command-picker-row.tsx +91 -0
- package/src/web/components/chat/slash-command-picker.tsx +126 -105
- package/src/web/components/chat/switch-account-view.tsx +17 -6
- package/src/web/components/chat/usage-meters.tsx +25 -3
- package/src/web/components/settings/accounts/account-usage-format.ts +56 -0
- package/src/web/components/settings/design-instructions-editor.tsx +1 -0
- package/src/web/components/ui/start-ellipsis.tsx +3 -1
- package/src/web/lib/chat-account-switch.ts +11 -9
- package/src/web/lib/linked-sessions.ts +10 -0
- package/src/web/styles/globals.css +1 -1
- package/dist/web/assets/accounts-settings-section-C9WjjsQe.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-C9WjjsQe.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-c9RXWb8Z.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-c9RXWb8Z.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-BvueUcUA.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-BvueUcUA.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-DDrEZMfA.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DDrEZMfA.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-Bl1AEwin.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Bl1AEwin.js.gz +0 -0
- package/dist/web/assets/android-tab-7NZ2od9I.js.br +0 -0
- package/dist/web/assets/android-tab-7NZ2od9I.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-BHuE4Tk9.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-BHuE4Tk9.js.gz +0 -0
- package/dist/web/assets/apps-panel-C5OWcuRU.js.br +0 -0
- package/dist/web/assets/apps-panel-C5OWcuRU.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-Ct7F_e7T.js.br +0 -0
- package/dist/web/assets/branch-review-tab-Ct7F_e7T.js.gz +0 -0
- package/dist/web/assets/chat-tab-BOG8kLRL.js.br +0 -0
- package/dist/web/assets/chat-tab-BOG8kLRL.js.gz +0 -0
- package/dist/web/assets/chat-tab-CQJ8IbuT.js.br +0 -0
- package/dist/web/assets/chat-tab-CQJ8IbuT.js.gz +0 -0
- package/dist/web/assets/code-editor-qJqN7Do4.js.br +0 -0
- package/dist/web/assets/code-editor-qJqN7Do4.js.gz +0 -0
- package/dist/web/assets/codex-plan-label-BRsRo1e3.js +0 -1
- package/dist/web/assets/codex-plan-label-BRsRo1e3.js.br +0 -0
- package/dist/web/assets/codex-plan-label-BRsRo1e3.js.gz +0 -0
- package/dist/web/assets/conflict-editor-LMUNqZwR.js.br +0 -0
- package/dist/web/assets/conflict-editor-LMUNqZwR.js.gz +0 -0
- package/dist/web/assets/connection-form-tab-DVx_Ah2L.js.br +0 -0
- package/dist/web/assets/connection-form-tab-DVx_Ah2L.js.gz +0 -0
- package/dist/web/assets/csv-preview-6jUz39o2.js.br +0 -0
- package/dist/web/assets/csv-preview-6jUz39o2.js.gz +0 -0
- package/dist/web/assets/db-tab-parts-BaTFg7AE.js.br +0 -0
- package/dist/web/assets/db-tab-parts-BaTFg7AE.js.gz +0 -0
- package/dist/web/assets/design-settings-section-bt7EoAL8.js.br +0 -0
- package/dist/web/assets/design-settings-section-bt7EoAL8.js.gz +0 -0
- package/dist/web/assets/design-tab-BrKidYIP.js.br +0 -0
- package/dist/web/assets/design-tab-BrKidYIP.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-Cl_uURB2.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-Cl_uURB2.js.gz +0 -0
- package/dist/web/assets/diff-viewer-D-O87Yxb.js.br +0 -0
- package/dist/web/assets/diff-viewer-D-O87Yxb.js.gz +0 -0
- package/dist/web/assets/docx-preview-BSSxJWPf.js.br +0 -0
- package/dist/web/assets/docx-preview-BSSxJWPf.js.gz +0 -0
- package/dist/web/assets/editor-dialog-oaq7S3q1.js.br +0 -0
- package/dist/web/assets/editor-dialog-oaq7S3q1.js.gz +0 -0
- package/dist/web/assets/editor-language-service-b2AmdWLS.js.br +0 -0
- package/dist/web/assets/editor-language-service-b2AmdWLS.js.gz +0 -0
- package/dist/web/assets/explorer-body-C1eUrzzz.js.br +0 -0
- package/dist/web/assets/explorer-body-C1eUrzzz.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-DbdkryVJ.js.br +0 -0
- package/dist/web/assets/explorer-window-content-DbdkryVJ.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-Dr30Isjd.js.br +0 -0
- package/dist/web/assets/extension-manager-section-Dr30Isjd.js.gz +0 -0
- package/dist/web/assets/extension-webview-DZtquSWa.js.br +0 -0
- package/dist/web/assets/extension-webview-DZtquSWa.js.gz +0 -0
- package/dist/web/assets/files-settings-section-B_m4WeN9.js.br +0 -0
- package/dist/web/assets/files-settings-section-B_m4WeN9.js.gz +0 -0
- package/dist/web/assets/general-settings-section-BPLnV8sc.js.br +0 -0
- package/dist/web/assets/general-settings-section-BPLnV8sc.js.gz +0 -0
- package/dist/web/assets/git-log-panel-BFKb7zLn.js.br +0 -0
- package/dist/web/assets/git-log-panel-BFKb7zLn.js.gz +0 -0
- package/dist/web/assets/git-review-tab-CcGcCb7q.js.br +0 -0
- package/dist/web/assets/git-review-tab-CcGcCb7q.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-bduAeYV2.js.br +0 -0
- package/dist/web/assets/glide-data-grid-bduAeYV2.js.gz +0 -0
- package/dist/web/assets/grid-save-dialog-DaX_t0cC.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-DaX_t0cC.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-CkbQwD0f.js.br +0 -0
- package/dist/web/assets/group-chat-tab-CkbQwD0f.js.gz +0 -0
- package/dist/web/assets/impexp-tab-6-NdGUTE.js.br +0 -0
- package/dist/web/assets/impexp-tab-6-NdGUTE.js.gz +0 -0
- package/dist/web/assets/index-CJwhjmpj.css +0 -1
- package/dist/web/assets/index-CJwhjmpj.css.br +0 -0
- package/dist/web/assets/index-CJwhjmpj.css.gz +0 -0
- package/dist/web/assets/index-D3AIiXA6.js.br +0 -0
- package/dist/web/assets/index-D3AIiXA6.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-jZkrlYgg.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-jZkrlYgg.js.gz +0 -0
- package/dist/web/assets/language-servers-section-CwBi9v3G.js.br +0 -0
- package/dist/web/assets/language-servers-section-CwBi9v3G.js.gz +0 -0
- package/dist/web/assets/logs-app-Cri-6dD4.js.br +0 -0
- package/dist/web/assets/logs-app-Cri-6dD4.js.gz +0 -0
- package/dist/web/assets/lsp-client-CgopGPAn.js.br +0 -0
- package/dist/web/assets/lsp-client-CgopGPAn.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-Dx7Bz1og.js.br +0 -0
- package/dist/web/assets/markdown-renderer-Dx7Bz1og.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-D-3wavHz.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-D-3wavHz.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-CVw_DBjW.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-yMGGccmC.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-yMGGccmC.js.gz +0 -0
- package/dist/web/assets/onboarding-entry-CDEhPa4d.js.br +0 -0
- package/dist/web/assets/onboarding-entry-CDEhPa4d.js.gz +0 -0
- package/dist/web/assets/ppmbot-settings-section-By_LBVs_.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-By_LBVs_.js.gz +0 -0
- package/dist/web/assets/problems-panel-DD11hanr.js.br +0 -0
- package/dist/web/assets/problems-panel-DD11hanr.js.gz +0 -0
- package/dist/web/assets/process-table-DNUFHYIo.js.br +0 -0
- package/dist/web/assets/process-table-DNUFHYIo.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-CDQwoCNQ.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-CDQwoCNQ.js.gz +0 -0
- package/dist/web/assets/query-tab-wOBiiCkN.js.br +0 -0
- package/dist/web/assets/query-tab-wOBiiCkN.js.gz +0 -0
- package/dist/web/assets/remote-access-settings-section-Bcejk5yX.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-Bcejk5yX.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-yBLT70du.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-yBLT70du.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BSTcLpWO.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-BSTcLpWO.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-gMTK58pt.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CEVskD11.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CEVskD11.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-ChG6WvBM.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-Db-yXtcA.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-Db-yXtcA.js.gz +0 -0
- package/dist/web/assets/review-address-setup-Wq2ZAqJq.js.br +0 -0
- package/dist/web/assets/review-address-setup-Wq2ZAqJq.js.gz +0 -0
- package/dist/web/assets/review-code-6h72L1qs.js.br +0 -0
- package/dist/web/assets/review-code-6h72L1qs.js.gz +0 -0
- package/dist/web/assets/save-as-dialog-DptZuJOK.js.br +0 -0
- package/dist/web/assets/save-as-dialog-DptZuJOK.js.gz +0 -0
- package/dist/web/assets/schedule-script-editor-BFwoCOJm.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-BFwoCOJm.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-MbRDGxmJ.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-MbRDGxmJ.js.gz +0 -0
- package/dist/web/assets/session-changes-chip-CNqFq2Tr.js +0 -1
- package/dist/web/assets/session-changes-chip-CNqFq2Tr.js.br +0 -0
- package/dist/web/assets/session-changes-chip-CNqFq2Tr.js.gz +0 -0
- package/dist/web/assets/session-review-tab-DwvTrNpU.js.br +0 -0
- package/dist/web/assets/session-review-tab-DwvTrNpU.js.gz +0 -0
- package/dist/web/assets/settings-body-CtfaSVfJ.js.br +0 -0
- package/dist/web/assets/settings-body-CtfaSVfJ.js.gz +0 -0
- package/dist/web/assets/settings-rows-BnsoteWX.js.br +0 -0
- package/dist/web/assets/settings-rows-BnsoteWX.js.gz +0 -0
- package/dist/web/assets/settings-section-content-QQdTEhq_.js.br +0 -0
- package/dist/web/assets/settings-section-content-QQdTEhq_.js.gz +0 -0
- package/dist/web/assets/slash-command-picker-CBzGntUD.js +0 -1
- package/dist/web/assets/slash-command-picker-CBzGntUD.js.br +0 -0
- package/dist/web/assets/slash-command-picker-CBzGntUD.js.gz +0 -0
- package/dist/web/assets/sql-object-tab-CcIcW9Xw.js.br +0 -0
- package/dist/web/assets/sql-object-tab-CcIcW9Xw.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-VQ35jeKe.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-VQ35jeKe.js.gz +0 -0
- package/dist/web/assets/storage-settings-section-D7WZNfj1.js.br +0 -0
- package/dist/web/assets/storage-settings-section-D7WZNfj1.js.gz +0 -0
- package/dist/web/assets/structure-save-dialog-zywcwCve.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-zywcwCve.js.gz +0 -0
- package/dist/web/assets/structure-tab-DfQPOws7.js.br +0 -0
- package/dist/web/assets/structure-tab-DfQPOws7.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-_ZXLIgj3.js.br +0 -0
- package/dist/web/assets/system-monitor-body-_ZXLIgj3.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-C-iNC5Tr.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-C-iNC5Tr.js.gz +0 -0
- package/dist/web/assets/table-tab-CXtfbrfa.js.br +0 -0
- package/dist/web/assets/table-tab-CXtfbrfa.js.gz +0 -0
- package/dist/web/assets/telegram-bot-token-field-p9-9Q6s9.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-p9-9Q6s9.js.gz +0 -0
- package/dist/web/assets/terminal-tab-OOZAauPO.js.br +0 -0
- package/dist/web/assets/terminal-tab-OOZAauPO.js.gz +0 -0
- package/dist/web/assets/tool-cards-BGuRs10L.js.br +0 -0
- package/dist/web/assets/tool-cards-BGuRs10L.js.gz +0 -0
- package/dist/web/assets/tools-settings-section-DG0eQmcn.js.br +0 -0
- package/dist/web/assets/tools-settings-section-DG0eQmcn.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-BSYa1U1f.js.br +0 -0
- package/dist/web/assets/use-inline-blame-BSYa1U1f.js.gz +0 -0
- package/dist/web/assets/use-lsp-BojDXxMq.js.br +0 -0
- package/dist/web/assets/use-lsp-BojDXxMq.js.gz +0 -0
- package/dist/web/assets/use-process-kill-BF3uuOO4.js.br +0 -0
- package/dist/web/assets/use-process-kill-BF3uuOO4.js.gz +0 -0
- package/dist/web/assets/use-sql-schema-info-QLCBuqi5.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-QLCBuqi5.js.gz +0 -0
- package/dist/web/assets/web-preview-tab-DisllKkq.js.br +0 -0
- package/dist/web/assets/web-preview-tab-DisllKkq.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.23.37] - 2026-11-10
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Every usage bar says when it resets**: Switch account's cards give the countdown and the time ("Resets in 3h 12m · 03:52", "Thu 09:00"), in red when the bar is full; the ··· menu and the rings' tooltip give the countdown alone.
|
|
8
|
+
- **Linked sessions that need you or are running are listed first** in the Sessions tab, then unread answers, then idle ones.
|
|
9
|
+
|
|
10
|
+
## [0.23.36] - 2026-11-09
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Chat usage shows both windows**, as two labelled rings ("5h 47%", "Wk 52%") that colour on their own and stay hidden until there is a figure; usage, History and ··· now sit in one chip-shaped group.
|
|
15
|
+
- **The `/` and `@` lists float above the composer** instead of pushing the chips up, with tinted icons by kind, the match highlighted, kind filters and keyboard hints.
|
|
16
|
+
- **Tidier footer on narrow chats and phones**: smaller chips with even padding (still 44px to tap), and the model name is no longer cut by its chevron.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **Switch account's usage bars are all the same length**, whatever the label or figure beside them.
|
|
21
|
+
|
|
3
22
|
## [0.23.35] - 2026-11-09
|
|
4
23
|
|
|
5
24
|
### Changed
|
package/CLAUDE.md
CHANGED
|
@@ -293,7 +293,7 @@ Before planning or implementing a new feature, read `docs/project-roadmap.md` to
|
|
|
293
293
|
- `src/server/ws/chat.ts` — WebSocket chat handler
|
|
294
294
|
- `src/web/hooks/use-chat.ts` — Frontend chat state management
|
|
295
295
|
- `src/services/config.service.ts` — Config from SQLite (`~/.ppm/ppm.db`)
|
|
296
|
-
- Chat footer — under the conversation, after the turn-stop and MCP sign-in bars: one context row then the composer, no rules between them (`chat-tab.tsx`). Left of the row: `activity-chip.tsx` (running agents and linked sessions in one chip, a popover with Agents/Sessions tabs: `use-running-agents.ts`, `linked-sessions-panel.tsx`; unlinking is the synced UI pref `unlinkedSessions`, rules in `src/shared/linked-session-unlinks.ts`, also validated by `/api/settings/ui-prefs`), `session-changes-chip.tsx`, `connection-chip.tsx` (the reconnect stages of `use-reconnect-indicator.ts`; the composer placeholder follows them); right: `chat-footer-tools.tsx` —
|
|
296
|
+
- Chat footer — under the conversation, after the turn-stop and MCP sign-in bars: one context row then the composer, no rules between them (`chat-tab.tsx`). Left of the row: `activity-chip.tsx` (running agents and linked sessions in one chip, a popover with Agents/Sessions tabs: `use-running-agents.ts`, `linked-sessions-panel.tsx`; unlinking is the synced UI pref `unlinkedSessions`, rules in `src/shared/linked-session-unlinks.ts`, also validated by `/api/settings/ui-prefs`), `session-changes-chip.tsx`, `connection-chip.tsx` (the reconnect stages of `use-reconnect-indicator.ts`; the composer placeholder follows them); right: `chat-footer-tools.tsx`, one chip-shaped group (`FOOTER_CLUSTER`) — a labelled ring per usage window (`UsageWindow` in `usage-meters.tsx`; the divider after it is rendered in the same branch, so it can never stand alone before History), History (`chat-history-panel.tsx`) and the ··· menu (`chat-more-menu.tsx`, Switch account in `switch-account-view.tsx` over `src/web/lib/chat-account-switch.ts` + `src/web/hooks/use-switch-accounts.ts`). Every chip opens `footer-popover.tsx` (a bottom sheet below `md`), positioned against the row — chip wrappers must not be `relative`, or the left zone's clip cuts the popover. Shared chip classes in `footer-chip.ts`; motion classes `footer-*` in `globals.css`. The composer (`message-input.tsx`) is the textarea over one bar; the provider is chosen inside the model chip (`ProviderChoiceRow`). The `/` and `@` pickers (`slash-command-picker.tsx` + `slash-command-picker-row.tsx`, `file-picker.tsx`, shared parts in `composer-picker-parts.tsx`) float above the composer from a zero-height `relative` box in `chat-tab.tsx`, over the context row; the footer is `z-index: 20` (`globals.css`) so they and the footer popovers cover the conversation's scroll buttons (z-10). e2e `node tests/e2e/chat-footer-e2e.mjs` (fixture `tests/e2e/fixtures/chat-footer-server.ts`)
|
|
297
297
|
- `src/web/components/floating-window/` — Desktop window manager (drag/resize/z-band/persistence), OS-agnostic
|
|
298
298
|
- `src/web/components/os-explorer/` — OS File Explorer window body: views (List/Icons/Column), skins, mobile sheet, actions, drag-and-drop
|
|
299
299
|
- `src/web/components/settings/` — Settings as its own window kind (`settings-window-content.tsx`) and, below `md` where the window layer does not render, a tab (`settings-tab.tsx`); both mount one `settings-body.tsx`, which picks split-vs-stacked from its OWN width via `@container` — never `useIsMobile()`, because a narrow sidebar is not a phone. Tree in `settings-categories.ts`, id→pane map in `settings-section-content.tsx`, viewport routing in `open-settings.ts` (plain function: the global keybinding handler is not a component). `accounts/` is the single home for account management, one sub-tab per configured provider (Claude + Codex; the tab only shows when that provider is in `ai.providers`). Every provider pane is built from the same parts — `accounts-pane-header.tsx` (header + message strip + `AccountCardShell`) and `account-bucket-row.tsx` (`AccountUsageBar`) — and puts every action behind a dialog, so the sub-tabs cannot drift into different designs again — the chat footer's usage ring and Switch account view and AI Provider’s Codex tab only display, pick and link here. e2e `tests/e2e/settings-window-e2e.mjs`
|
|
@@ -73,4 +73,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
|
|
|
73
73
|
- Third-party extensions (inspect via `ppm ext list`).
|
|
74
74
|
- The Claude Agent SDK internals (separate skill).
|
|
75
75
|
|
|
76
|
-
<!-- Generated for PPM v0.23.
|
|
76
|
+
<!-- Generated for PPM v0.23.37 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -518,4 +518,4 @@ _Base URL: `http://localhost:8080` (default; override via `ppm config set port <
|
|
|
518
518
|
- `ws://<host>/ws/terminal` — PTY terminal multiplexer
|
|
519
519
|
- `ws://<host>/ws/extensions` — extension host channel
|
|
520
520
|
|
|
521
|
-
<!-- Generated from src/server/routes/ for PPM v0.23.
|
|
521
|
+
<!-- Generated from src/server/routes/ for PPM v0.23.37 -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{At as r,Cn as i,Cr as a,J as o,Kr as s,Zr as c,_t as l,cr as u,gr as d,hr as f,ht as p,li as m,ln as h,tr as g,ut as _,xn as v}from"./icons-C1wDt09O.js";import{a as y,r as b}from"./api-client-BnYFnEfK.js";import{n as x}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import{i as S,n as C,t as w}from"./tooltip-C9Mxdsc-.js";import{t as T}from"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import{n as E}from"./use-is-mobile-VRV9eZy1.js";import"./chat-preparation-cache-BOtvRhQ2.js";import{r as D}from"./clipboard-BWcYY8ng.js";import{r as O,t as k}from"./button-CE-YGfFD.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./dialog-DY9KvCIt.js";import{t as I}from"./input-Dln1TrJi.js";import{$n as L,Ir as R,Qn as z,Ri as ee,Zn as te,er as ne,nr as B,tr as V}from"./index-D3AIiXA6.js";import{S as H,a as re,b as ie,g as ae,h as oe,m as se,o as ce,r as le,v as ue,y as de}from"./api-settings-DiEZFMDk.js";import{a as fe,c as pe,d as me,f as U,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce}from"./codex-plan-label-BRsRo1e3.js";var W=e(t(),1),G=n();function we({description:e,onRefresh:t,refreshing:n,disabled:r,actions:i}){return(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),(0,G.jsx)(k,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0 cursor-pointer`,onClick:t,disabled:r||n,title:`Refresh`,"aria-label":`Refresh accounts`,children:(0,G.jsx)(f,{className:`size-4 ${n?`animate-spin`:``}`})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i})]})}function Te({message:e,onDismiss:t}){return e?(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-xs p-2 rounded bg-muted`,role:`status`,children:[(0,G.jsx)(`span`,{className:`flex-1`,children:e}),(0,G.jsx)(`button`,{onClick:t,className:`shrink-0 text-muted-foreground hover:text-foreground cursor-pointer`,"aria-label":`Dismiss message`,children:(0,G.jsx)(m,{className:`size-3.5`})})]}):null}function K({children:e}){return(0,G.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1 -mx-1 px-1 snap-x snap-mandatory scrollbar-thin`,children:e})}function Ee({active:e,flash:t,dense:n,children:r,...i}){return(0,G.jsx)(`div`,{...i,className:[`rounded-md border transition-colors duration-500`,n?`p-2.5 space-y-1.5`:`p-3 space-y-2`,t?`bg-primary/10 border-primary/40`:``,e?`border-primary/30 bg-primary/5`:`border-border/50`,i.className??``].filter(Boolean).join(` `),children:r})}var De=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],q=Array.from({length:24},(e,t)=>t);function Oe(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function ke(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function Ae(e){return q.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function je(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Me(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Ne({accountId:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(!0),[a,o]=(0,W.useState)(`5h`);(0,W.useEffect)(()=>{i(!0),se(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,W.useMemo)(()=>t?Oe(t,a):null,[t,a]),c=(0,W.useMemo)(()=>s?ke(s):[],[s]),l=(0,W.useMemo)(()=>s?Ae(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,G.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,G.jsx)(v,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,G.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,G.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,G.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,G.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,G.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,G.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,G.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:De.map((e,t)=>{let n=c[t]??0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Me(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,G.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:q.map(e=>{let t=l[e]??0;return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,G.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${je(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[De.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),q.map(n=>{let r=s[t][n];return(0,G.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${je(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,G.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,G.jsx)(`span`,{className:`w-4 shrink-0`}),q.map(e=>(0,G.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,G.jsx)(`span`,{children:`Low`}),(0,G.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,G.jsx)(`span`,{children:`High`}),(0,G.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,G.jsx)(`span`,{children:`No data`})]})]})}function Pe({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,G.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,G.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,G.jsx)(m,{className:`size-4`})})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,G.jsxs)(`span`,{className:`contents`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,G.jsx)(Ne,{accountId:t})]})}function Fe({display:e,onConfirm:t,onCancel:n}){let r=E(),i=(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,G.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,G.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,G.jsx)(k,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,G.jsx)(k,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,G.jsx)(T,{open:!0,onClose:n,children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Remove account`})}),i]})})}var Ie=80;function Le({current:e,onSave:t,onCancel:n}){let r=E(),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u=i.trim(),d=!!u&&u!==e&&!o,f=async()=>{if(d){s(!0),l(null);try{await t(u)}catch(e){l(e.message||`Could not rename the account`),s(!1)}}},p=()=>{o||n()},m=(0,G.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,G.jsx)(I,{autoFocus:!0,value:i,maxLength:Ie,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),c&&(0,G.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:c}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,G.jsx)(k,{type:`button`,variant:`outline`,onClick:p,disabled:o,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,G.jsxs)(k,{type:`submit`,disabled:!d,className:`min-h-11 md:min-h-9`,children:[o&&(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,G.jsx)(T,{open:!0,onClose:p,children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),m]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{e||p()},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Rename account`})}),m]})})}function J({label:e,pct:t,reset:n,resetsAt:r}){let i=me(r);return(0,G.jsxs)(`div`,{className:`space-y-1`,"data-testid":`account-usage-bar`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:e}),n&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsxs)(`span`,{className:`text-[10px] text-text-subtle cursor-default`,children:[`↻ `,n]})}),(0,G.jsx)(C,{side:`top`,children:i?`Resets ${i}`:`Resets in`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-border overflow-hidden`,children:t!=null&&(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all ${pe(t)}`,style:{width:`${Math.min(t,100)}%`}})}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums w-10 text-right ${t==null?`text-text-subtle`:ye(t)}`,children:t==null?`—`:`${t}%`})]})]})}function Y({label:e,bucket:t}){return t?(0,G.jsx)(J,{label:e,pct:Math.round(t.utilization*100),reset:U(t),resetsAt:t.resetsAt}):null}function X({hint:e,className:t,children:n,onClick:r}){return(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:r,className:[r?`relative cursor-pointer rounded px-1 -mx-1 underline decoration-dotted underline-offset-2 hover:bg-error/10 after:absolute after:-inset-x-2 after:-inset-y-3 after:content-['']`:`cursor-help`,`text-left`,t].filter(Boolean).join(` `),children:n})}),(0,G.jsx)(C,{side:`top`,className:`max-w-[260px] text-xs leading-relaxed`,children:e})]})}function Re({buckets:e}){return e?.length?(0,G.jsx)(G.Fragment,{children:e.map(e=>(0,G.jsx)(Y,{label:`Weekly (${e.label})`,bucket:e},e.label))}):null}function ze(e){return new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}function Be({credits:e}){if(!e)return null;let t=e.available,n=t===0?`No free resets`:`${t} free reset${t===1?``:`s`}`,r=t===0?`Codex has no free rate-limit resets left for this account.`:`Codex has granted this account ${t} free rate-limit reset${t===1?``:`s`}${e.title?` (${e.title})`:``}.${e.nextExpiresAt?` The next one expires on ${new Date(e.nextExpiresAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}.`:``} A "Use reset" button appears here once a limit is reached; a reset moves the weekly reset date, so spending one earlier wastes it.`;return(0,G.jsxs)(X,{className:`inline-flex items-center gap-1 ${t>0?`text-primary`:``}`,hint:r,children:[(0,G.jsx)(d,{className:`size-3 shrink-0`,"aria-hidden":!0}),n,t>0&&e.nextExpiresAt&&(0,G.jsxs)(`span`,{className:`text-text-subtle`,children:[`· until `,ze(e.nextExpiresAt)]})]})}var Ve={readOnly:`min-w-[220px]`,withActions:`min-w-[330px]`};function He({entry:e,isActive:t,accountInfo:n,onToggle:r,toggling:i,onDelete:a,onRename:c,onExport:u,onViewProfile:d,flash:m,onSelect:_,unselectableReason:v,selecting:y,planLabel:b,dailyGuard:x,onDailyGuardToggle:T,dailyGuardToggling:E,reauthHint:D,onReauth:O,resetCredits:k,resetCreditAction:A,layout:j=`list`}){let{usage:M}=e,N=M.session||M.weekly||M.weeklyOpus||M.weeklySonnet||M.weeklyScoped?.length,P=n?.status??e.accountStatus,F=!!(n&&!n.hasRefreshToken&&n.expiresAt&&n.expiresAt<Math.floor(Date.now()/1e3)),I=ge(n),L=!!n?.reauthRequired||!!D,R=n?.grantExpiresAt?n.grantExpiresAt*1e3:null,z=!!R&&R-Date.now()<5*864e5,ee=!!n&&(I.label===`temp`||I.label===`unknown`||I.label===`expired`&&!F&&!L),te=R?new Date(R).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null,ne=!!(r||a||c||u||d),V=F?`Token expired — sign in again`:L?`Sign in again to use this account`:v??null,H=j===`list`?``:j===`grid`?`flex flex-col justify-evenly overflow-hidden min-h-0`:`shrink-0 snap-start ${ne?Ve.withActions:Ve.readOnly}`;return(0,G.jsxs)(Ee,{active:t,flash:m,dense:j!==`list`,className:[H,F||L?`opacity-50`:``].filter(Boolean).join(` `)||void 0,"data-testid":`account-card`,"data-account-id":e.accountId,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.accountLabel??e.accountId.slice(0,8)}),t&&(0,G.jsx)(X,{className:`text-[10px] text-primary shrink-0 font-medium`,hint:`The next turn will run on this account.`,children:`Active`}),_&&!t&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(e.accountId),disabled:y,className:[`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors cursor-pointer disabled:cursor-wait`,V?`text-text-subtle hover:text-error hover:bg-error/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`].join(` `),children:y?`Switching…`:`Use`})}),(0,G.jsx)(C,{side:`top`,children:V??`Use this account for this chat`})]}),F&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`This token has expired and carries no refresh token, so nothing can renew it. Sign in again to replace it.`,onClick:O?()=>O(e.accountId):void 0,children:`Expired`}),L&&!F&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:D??`Anthropic rejected this account's refresh token, so no turn can run on it. Signing in again is the only thing that restores it.`,onClick:O?()=>O(e.accountId):void 0,children:`Sign in again`}),!e.isOAuth&&!F&&(0,G.jsx)(X,{className:`text-[10px] text-text-subtle shrink-0`,hint:`A static API key rather than a sign-in: nothing to expire and nothing to renew.`,children:`API key`}),b&&(0,G.jsx)(X,{className:`text-[10px] uppercase tracking-wide text-text-subtle shrink-0`,hint:`The subscription this account is on. It decides which quota windows the account has — some plans have a weekly limit and no shorter one.`,children:b}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[c&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>c(e.accountId,e.accountLabel??``),"aria-label":`Rename account`,children:(0,G.jsx)(g,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Rename account`})]}),!F&&d&&n?.profileData&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>d(n.profileData,e.accountId),"aria-label":`View profile`,children:(0,G.jsx)(l,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`View profile`})]}),!F&&u&&e.isOAuth&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-primary hover:bg-surface-elevated transition-colors`,onClick:()=>u(e.accountId),"aria-label":`Export this account`,children:(0,G.jsx)(p,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Export this account`})]}),!F&&r&&(0,G.jsx)(B,{checked:P!==`disabled`,onCheckedChange:()=>r(e.accountId,P),disabled:i||P===`cooldown`,"aria-label":P===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer relative before:absolute before:content-[''] before:-inset-y-3 before:-inset-x-0.5`}),a&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors`,onClick:()=>a(e.accountId,e.accountLabel??e.accountId.slice(0,8)),"aria-label":`Remove account`,children:(0,G.jsx)(s,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Remove account`})]})]})]}),N?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Y,{label:`5-Hour Session`,bucket:M.session}),(0,G.jsx)(Y,{label:`Weekly`,bucket:M.weekly}),(0,G.jsx)(Y,{label:`Weekly (Opus)`,bucket:M.weeklyOpus}),(0,G.jsx)(Y,{label:`Weekly (Sonnet)`,bucket:M.weeklySonnet}),(0,G.jsx)(Re,{buckets:M.weeklyScoped})]}):(0,G.jsx)(`p`,{className:`text-xs text-text-subtle`,children:e.isOAuth?`No usage data yet`:`Usage tracking not available for API keys`}),x&&(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${x.enabled&&x.state.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${x.enabled&&x.state.blocked?`text-error`:`text-text-secondary`}`,children:[(0,G.jsx)(`span`,{children:`Daily guard`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,G.jsx)(o,{className:`size-3.5`})})}),(0,G.jsx)(C,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays.`})]})]}),(0,G.jsx)(`p`,{className:`text-[10px] tabular-nums ${x.enabled&&x.state.blocked?`text-error`:`text-text-subtle`}`,children:x.enabled&&x.state.blocked?`${Math.round(x.state.used*100)}% used / ${Math.round(x.state.cap*100)}% daily cap. New turns paused.`:`Weekday ${x.state.day}/5, ${Math.round(x.state.cap*100)}% daily cap`})]}),T&&(0,G.jsx)(B,{checked:x.enabled,onCheckedChange:T,disabled:E,"aria-label":x.enabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-subtle flex-wrap`,children:[(0,G.jsx)(Be,{credits:k}),A,M.lastFetchedAt&&(0,G.jsxs)(X,{className:`inline-flex items-center gap-1`,hint:`Usage last read from Anthropic on ${new Date(M.lastFetchedAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}. The bars above are only as current as this.`,children:[(0,G.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0}),Ce(new Date(M.lastFetchedAt).getTime())]}),R&&!L&&(0,G.jsxs)(X,{className:[`inline-flex items-center gap-1`,z?`text-warning`:``].filter(Boolean).join(` `),hint:`Sign-in stops working on ${te}. Anthropic ends every sign-in on a fixed schedule from the day it was made, whether or not the account gets used — refreshing does not extend it. After that the account fails until you sign in again.`,children:[(0,G.jsx)(h,{className:`size-3 shrink-0`,"aria-hidden":!0}),`sign-in `,he(R)]}),ee&&(0,G.jsxs)(X,{className:I.color,hint:I.tip,children:[`© `,I.label]})]})]})}function Ue(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function We({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,W.useState)(new Set),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),u(``),f(!1),h(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=y();r&&(n.Authorization=`Bearer ${r}`);let i=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:d,refreshBeforeExport:m})});if(!i.ok){let e=await i.json();throw Error(e.error??`Export failed: ${i.status}`)}let o=await i.text();e&&await D(o)?a?.(`Backup copied to clipboard!`):(Ue(o),a?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!g;return(0,G.jsx)(F,{open:e,onOpenChange:e=>{e||C()},children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,G.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,G.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(R,{className:`text-xs`,children:[`Password `,(0,G.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,G.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>u(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:d,onChange:e=>f(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>h(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),d?(0,G.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,G.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,G.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,G.jsxs)(j,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,G.jsx)(_,{className:`size-3 mr-1`}),` Copy`]}),(0,G.jsx)(k,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(p,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Ge({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await oe({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,G.jsx)(F,{open:e,onOpenChange:e=>{e||f()},children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(R,{className:`text-xs`,children:`Backup data`}),(0,G.jsx)(`textarea`,{value:r,onChange:e=>a(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(R,{className:`text-xs`,children:[`Password `,(0,G.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,G.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,G.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,G.jsxs)(j,{children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,G.jsx)(k,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Z=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ke(e){return Z?.addEventListener(`change`,e),()=>Z?.removeEventListener(`change`,e)}function qe(){return Z?.matches??!0}function Je(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(!0);return(0,W.useEffect)(()=>{r(!0),ce().then(t).finally(()=>r(!1))},[]),n?(0,G.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,G.jsxs)(te,{value:e.strategy,onValueChange:async e=>{t(await H({strategy:e}))},children:[(0,G.jsx)(ne,{className:`w-full h-9 text-xs`,children:(0,G.jsx)(V,{})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(L,{value:`round-robin`,children:`Round-robin`}),(0,G.jsx)(L,{value:`fill-first`,children:`Fill-first`}),(0,G.jsx)(L,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,G.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,G.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await H({maxRetry:n}))}}),(0,G.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,G.jsx)(B,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await H({cooldownEnabled:e}))}})]}),(0,G.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,G.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,G.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,G.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Ye({open:e,onOpenChange:t}){let n=(0,W.useSyncExternalStore)(Ke,qe);return e?n?(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsxs)(N,{className:`text-sm flex items-center gap-2`,children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,G.jsx)(Je,{})]})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,G.jsxs)(`div`,{className:x(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,G.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,G.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,G.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,G.jsx)(m,{className:`size-4`})})]}),(0,G.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,G.jsx)(Je,{})})]})]}):null}var Xe=O(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Q({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:x(Xe({variant:t}),e),...n})}function Ze(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Qe({accounts:e}){let[t,n]=(0,W.useState)([]),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await de(l.map(e=>e.id),a);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:a,items:e}])}catch{}i(!1)}}async function d(e,t){c(t=>new Map(t).set(e,{loading:!0}));try{let n=await ie(t);c(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){c(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function f(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function p(){for(let e of t)for(let t of e.items)for(let n of f(e,t))n.token&&d(n.key,n.token)}return(0,G.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),l.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(B,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,G.jsx)(R,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,G.jsx)(k,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:p,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,G.jsx)(Q,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,G.jsx)(Q,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),f(e,t).map(e=>{let t=s.get(e.key);return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,G.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Ze(e.expires)}),e.token?(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void d(e.key,e.token),children:t?.loading?(0,G.jsx)(v,{className:`size-3 animate-spin`}):`Test`}):(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function $e(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function et({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,W.useState)(new Map),[o,s]=(0,W.useState)(!1);async function c(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await ue(e,o);a(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){a(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function l(){for(let e of n.filter(e=>e.expiresAt!==null))c(e.id)}return(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(B,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,G.jsx)(R,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,G.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:$e(e.expiresAt)})]}),(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void c(e.id),children:t?.loading?(0,G.jsx)(v,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,G.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,G.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,G.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,G.jsx)(Qe,{accounts:n})]}),(0,G.jsx)(j,{children:(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function tt(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:l}=_e(),[d,f]=(0,W.useState)(null),[m,g]=(0,W.useState)(null),[_,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(null),[S,C]=(0,W.useState)(null),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(null),[O,A]=(0,W.useState)(void 0);function j(e){l(),e&&f(e)}async function M(e,t){g(e);try{await ae(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){f(e.message)}g(null),l()}async function N(){if(_){try{await le(_.id),f(`Account "${_.display}" removed.`),l()}catch(e){f(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await ae(b.id,{label:e}),x(null),f(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(we,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:o,disabled:i,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),D(`add`)},children:[(0,G.jsx)(u,{className:`size-4`}),` Add account`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),D(`export`)},children:[(0,G.jsx)(p,{className:`size-4`}),` Export`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`import`),children:[(0,G.jsx)(c,{className:`size-4`}),` Import`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`rotation`),children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`token-test`),children:[(0,G.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,G.jsx)(Te,{message:d,onDismiss:()=>f(null)}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,Ce(new Date(I).getTime())]})]}),i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(h,{className:`size-5 text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,G.jsx)(K,{children:e.map(e=>(0,G.jsx)(He,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:m===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),D(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),D(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),S&&(0,G.jsx)(Pe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),_&&(0,G.jsx)(Fe,{display:_.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,G.jsx)(Le,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,G.jsx)(xe,{open:E===`add`,onOpenChange:e=>{D(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:O}),(0,G.jsx)(We,{open:E===`export`,onOpenChange:e=>{D(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:f}),(0,G.jsx)(Ge,{open:E===`import`,onOpenChange:e=>D(e?`import`:null),onSuccess:j}),(0,G.jsx)(Ye,{open:E===`rotation`,onOpenChange:e=>D(e?`rotation`:null)}),(0,G.jsx)(et,{open:E===`token-test`,onOpenChange:e=>D(e?`token-test`:null),accounts:t})]})}function nt({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let u=(0,W.useRef)(null),d=e===`export`;return(0,G.jsx)(F,{open:e!==null,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-4`}),` `,d?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,G.jsx)(P,{className:`text-xs leading-relaxed`,children:d?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(R,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,G.jsx)(I,{id:`codex-backup-password`,type:`password`,placeholder:d?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:d?`new-password`:`current-password`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,G.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,G.jsx)(`input`,{ref:u,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,G.jsxs)(j,{children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,G.jsxs)(k,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||a,onClick:()=>d?o():u.current?.click(),children:[a?(0,G.jsx)(v,{className:`size-3.5 animate-spin`}):d?(0,G.jsx)(p,{className:`size-3.5`}):(0,G.jsx)(c,{className:`size-3.5`}),d?`Download backup`:`Choose file`]})]})]})})}var rt=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function it({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsx)(N,{className:`text-sm`,children:`Codex Rotation`}),(0,G.jsx)(P,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:rt.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:x(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,G.jsx)(j,{children:(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function at(e){return e==null?null:Math.round(e*100)}function ot({usage:e}){let t=e.session==null&&e.weekly==null;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,G.jsx)(J,{label:`5-Hour Session`,pct:at(e.fiveHour),reset:U(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,G.jsx)(J,{label:`Weekly`,pct:at(e.sevenDay),reset:U(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function st(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}function ct(e){return st(e)&&(e.resetCredits?.available??0)>0}var lt={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`};function ut(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function dt({account:e,usage:t,onDone:n}){let r=E(),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1);if(!ct(t))return null;let c=t.resetCredits;async function l(){s(!0);try{let t=await b.post(`/api/codex-accounts/${e.id}/reset-credit`);n(lt[t.outcome]?.(e.label)??`${e.label}: ${t.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{s(!1),a(!1)}}let u=ut(t.weekly?.resetsAt),f=ut(c.nextExpiresAt),p=(0,G.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,G.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,c.available,` free reset`,c.available===1?``:`s`,`?`]}),(0,G.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,G.jsxs)(`li`,{children:[c.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,G.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,u?`, not ${u} as now`:``,`. You do not also get that one.`]}),f&&(0,G.jsxs)(`li`,{children:[`This spends the reset that expires first (`,f,`).`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,G.jsx)(k,{variant:`outline`,onClick:()=>a(!1),disabled:o,className:`min-h-11`,children:`Keep it`}),(0,G.jsxs)(k,{onClick:()=>void l(),disabled:o,className:`min-h-11 gap-1.5`,children:[o?(0,G.jsx)(v,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),`Use reset`]})]})]});return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`min-h-11 md:min-h-0 md:h-7 gap-1 px-2 text-[11px] cursor-pointer border-primary/40 text-primary`,onClick:()=>a(!0),disabled:o,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Use reset`]}),i&&(r?(0,G.jsx)(T,{open:!0,onClose:()=>{o||a(!1)},children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Use a free reset`}),p]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{!e&&!o&&a(!1)},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Use a free reset`})}),p]})}))]})}var $=1440*60*1e3,ft=7,pt=5;function mt(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-ft*$;if(t<r)return null;let i=Math.min(ft-1,Math.floor((t-r)/$)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*$).getUTCDay();t!==0&&t!==6&&a++}let o=a/pt;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function ht(){let[e,t]=(0,W.useState)(null),n=fe(()=>t(null)),[r,i]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(we,{description:(0,G.jsxs)(G.Fragment,{children:[`Each Codex account keeps its own login (`,(0,G.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,G.jsx)(u,{className:`size-4`}),` Add account`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,G.jsx)(p,{className:`size-4`}),` Export`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,G.jsx)(c,{className:`size-4`}),` Import`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,G.jsx)(Te,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(h,{className:`size-5 text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,G.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,G.jsx)(K,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,G.jsxs)(Ee,{dense:!0,className:`min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>i(e):void 0,children:`Sign in again`}),(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),Se(e.planType)&&(0,G.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Se(e.planType)}),(0,G.jsx)(B,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,G.jsx)(s,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Remove account`})]})]}),(0,G.jsx)(ot,{usage:t}),t.resetCredits&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,G.jsx)(Be,{credits:t.resetCredits}),(0,G.jsx)(dt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=mt(t.weekly);return r?(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,G.jsx)(`span`,{children:`Daily guard`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,G.jsx)(o,{className:`size-3.5`})})}),(0,G.jsx)(C,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,G.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,G.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,G.jsx)(B,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})()]},e.id)})})]}),(0,G.jsx)(ve,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,G.jsx)(nt,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,G.jsx)(be,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,G.jsx)(it,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var gt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function _t(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(`claude`);(0,W.useEffect)(()=>{let e=!1;return re().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=gt.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,G.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,G.jsxs)(`button`,{onClick:()=>r(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":n===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${n===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,G.jsx)(ee,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,G.jsx)(tt,{}):(0,G.jsx)(ht,{})]})}export{_t as AccountsSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{At as r,Cn as i,Cr as a,J as o,Kr as s,Zr as c,_t as l,cr as u,gr as d,hr as f,ht as p,li as m,ln as h,tr as g,ut as _,xn as v}from"./icons-C1wDt09O.js";import{a as y,r as b}from"./api-client-BnYFnEfK.js";import{n as x}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import{i as S,n as C,t as w}from"./tooltip-C9Mxdsc-.js";import{t as T}from"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import{n as E}from"./use-is-mobile-VRV9eZy1.js";import"./chat-preparation-cache-BOtvRhQ2.js";import{r as D}from"./clipboard-BWcYY8ng.js";import{r as O,t as k}from"./button-CE-YGfFD.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./dialog-DY9KvCIt.js";import{t as I}from"./input-Dln1TrJi.js";import{$n as L,Ir as R,Qn as z,Ri as ee,Zn as te,er as ne,nr as B,tr as V}from"./index-Djsgk-RQ.js";import{S as H,a as re,b as ie,g as ae,h as oe,m as se,o as ce,r as le,v as ue,y as de}from"./api-settings-DiEZFMDk.js";import{_ as fe,a as pe,c as me,d as he,f as ge,g as _e,h as U,n as ve,o as ye,r as be,s as xe,t as Se,u as Ce}from"./codex-plan-label-BMq1Pj0j.js";var W=e(t(),1),G=n();function we({description:e,onRefresh:t,refreshing:n,disabled:r,actions:i}){return(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),(0,G.jsx)(k,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0 cursor-pointer`,onClick:t,disabled:r||n,title:`Refresh`,"aria-label":`Refresh accounts`,children:(0,G.jsx)(f,{className:`size-4 ${n?`animate-spin`:``}`})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i})]})}function Te({message:e,onDismiss:t}){return e?(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-xs p-2 rounded bg-muted`,role:`status`,children:[(0,G.jsx)(`span`,{className:`flex-1`,children:e}),(0,G.jsx)(`button`,{onClick:t,className:`shrink-0 text-muted-foreground hover:text-foreground cursor-pointer`,"aria-label":`Dismiss message`,children:(0,G.jsx)(m,{className:`size-3.5`})})]}):null}function K({children:e}){return(0,G.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-1 -mx-1 px-1 snap-x snap-mandatory scrollbar-thin`,children:e})}function Ee({active:e,flash:t,dense:n,children:r,...i}){return(0,G.jsx)(`div`,{...i,className:[`rounded-md border transition-colors duration-500`,n?`p-2.5 space-y-1.5`:`p-3 space-y-2`,t?`bg-primary/10 border-primary/40`:``,e?`border-primary/30 bg-primary/5`:`border-border/50`,i.className??``].filter(Boolean).join(` `),children:r})}var De=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],q=Array.from({length:24},(e,t)=>t);function Oe(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function ke(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function Ae(e){return q.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function je(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Me(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Ne({accountId:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(!0),[a,o]=(0,W.useState)(`5h`);(0,W.useEffect)(()=>{i(!0),se(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,W.useMemo)(()=>t?Oe(t,a):null,[t,a]),c=(0,W.useMemo)(()=>s?ke(s):[],[s]),l=(0,W.useMemo)(()=>s?Ae(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,G.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,G.jsx)(v,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,G.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,G.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,G.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,G.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,G.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,G.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,G.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:De.map((e,t)=>{let n=c[t]??0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,G.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Me(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,G.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,G.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:q.map(e=>{let t=l[e]??0;return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,G.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${je(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[De.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),q.map(n=>{let r=s[t][n];return(0,G.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${je(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,G.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,G.jsx)(`span`,{className:`w-4 shrink-0`}),q.map(e=>(0,G.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,G.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,G.jsx)(`span`,{children:`Low`}),(0,G.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,G.jsx)(`span`,{children:`High`}),(0,G.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,G.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,G.jsx)(`span`,{children:`No data`})]})]})}function Pe({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,G.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,G.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,G.jsx)(m,{className:`size-4`})})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,G.jsxs)(`span`,{className:`contents`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,G.jsx)(Ne,{accountId:t})]})}function Fe({display:e,onConfirm:t,onCancel:n}){let r=E(),i=(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,G.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,G.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,G.jsx)(k,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,G.jsx)(k,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,G.jsx)(T,{open:!0,onClose:n,children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Remove account`})}),i]})})}var Ie=80;function Le({current:e,onSave:t,onCancel:n}){let r=E(),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u=i.trim(),d=!!u&&u!==e&&!o,f=async()=>{if(d){s(!0),l(null);try{await t(u)}catch(e){l(e.message||`Could not rename the account`),s(!1)}}},p=()=>{o||n()},m=(0,G.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,G.jsx)(I,{autoFocus:!0,value:i,maxLength:Ie,onChange:e=>a(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),c&&(0,G.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:c}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,G.jsx)(k,{type:`button`,variant:`outline`,onClick:p,disabled:o,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,G.jsxs)(k,{type:`submit`,disabled:!d,className:`min-h-11 md:min-h-9`,children:[o&&(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,G.jsx)(T,{open:!0,onClose:p,children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),m]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{e||p()},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Rename account`})}),m]})})}function J({label:e,pct:t,reset:n,resetsAt:r}){let i=ge(r);return(0,G.jsxs)(`div`,{className:`space-y-1`,"data-testid":`account-usage-bar`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:e}),n&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsxs)(`span`,{className:`text-[10px] text-text-subtle cursor-default`,children:[`↻ `,n]})}),(0,G.jsx)(C,{side:`top`,children:i?`Resets ${i}`:`Resets in`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-border overflow-hidden`,children:t!=null&&(0,G.jsx)(`div`,{className:`h-full rounded-full transition-all ${me(t)}`,style:{width:`${Math.min(t,100)}%`}})}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums w-10 text-right ${t==null?`text-text-subtle`:_e(t)}`,children:t==null?`—`:`${t}%`})]})]})}function Y({label:e,bucket:t}){return t?(0,G.jsx)(J,{label:e,pct:Math.round(t.utilization*100),reset:U(t),resetsAt:t.resetsAt}):null}function X({hint:e,className:t,children:n,onClick:r}){return(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:r,className:[r?`relative cursor-pointer rounded px-1 -mx-1 underline decoration-dotted underline-offset-2 hover:bg-error/10 after:absolute after:-inset-x-2 after:-inset-y-3 after:content-['']`:`cursor-help`,`text-left`,t].filter(Boolean).join(` `),children:n})}),(0,G.jsx)(C,{side:`top`,className:`max-w-[260px] text-xs leading-relaxed`,children:e})]})}function Re({buckets:e}){return e?.length?(0,G.jsx)(G.Fragment,{children:e.map(e=>(0,G.jsx)(Y,{label:`Weekly (${e.label})`,bucket:e},e.label))}):null}function ze(e){return new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}function Be({credits:e}){if(!e)return null;let t=e.available,n=t===0?`No free resets`:`${t} free reset${t===1?``:`s`}`,r=t===0?`Codex has no free rate-limit resets left for this account.`:`Codex has granted this account ${t} free rate-limit reset${t===1?``:`s`}${e.title?` (${e.title})`:``}.${e.nextExpiresAt?` The next one expires on ${new Date(e.nextExpiresAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}.`:``} A "Use reset" button appears here once a limit is reached; a reset moves the weekly reset date, so spending one earlier wastes it.`;return(0,G.jsxs)(X,{className:`inline-flex items-center gap-1 ${t>0?`text-primary`:``}`,hint:r,children:[(0,G.jsx)(d,{className:`size-3 shrink-0`,"aria-hidden":!0}),n,t>0&&e.nextExpiresAt&&(0,G.jsxs)(`span`,{className:`text-text-subtle`,children:[`· until `,ze(e.nextExpiresAt)]})]})}var Ve={readOnly:`min-w-[220px]`,withActions:`min-w-[330px]`};function He({entry:e,isActive:t,accountInfo:n,onToggle:r,toggling:i,onDelete:a,onRename:c,onExport:u,onViewProfile:d,flash:m,onSelect:_,unselectableReason:v,selecting:y,planLabel:b,dailyGuard:x,onDailyGuardToggle:T,dailyGuardToggling:E,reauthHint:D,onReauth:O,resetCredits:k,resetCreditAction:A,layout:j=`list`}){let{usage:M}=e,N=M.session||M.weekly||M.weeklyOpus||M.weeklySonnet||M.weeklyScoped?.length,P=n?.status??e.accountStatus,F=!!(n&&!n.hasRefreshToken&&n.expiresAt&&n.expiresAt<Math.floor(Date.now()/1e3)),I=fe(n),L=!!n?.reauthRequired||!!D,R=n?.grantExpiresAt?n.grantExpiresAt*1e3:null,z=!!R&&R-Date.now()<5*864e5,ee=!!n&&(I.label===`temp`||I.label===`unknown`||I.label===`expired`&&!F&&!L),te=R?new Date(R).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null,ne=!!(r||a||c||u||d),V=F?`Token expired — sign in again`:L?`Sign in again to use this account`:v??null,H=j===`list`?``:j===`grid`?`flex flex-col justify-evenly overflow-hidden min-h-0`:`shrink-0 snap-start ${ne?Ve.withActions:Ve.readOnly}`;return(0,G.jsxs)(Ee,{active:t,flash:m,dense:j!==`list`,className:[H,F||L?`opacity-50`:``].filter(Boolean).join(` `)||void 0,"data-testid":`account-card`,"data-account-id":e.accountId,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.accountLabel??e.accountId.slice(0,8)}),t&&(0,G.jsx)(X,{className:`text-[10px] text-primary shrink-0 font-medium`,hint:`The next turn will run on this account.`,children:`Active`}),_&&!t&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(e.accountId),disabled:y,className:[`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors cursor-pointer disabled:cursor-wait`,V?`text-text-subtle hover:text-error hover:bg-error/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`].join(` `),children:y?`Switching…`:`Use`})}),(0,G.jsx)(C,{side:`top`,children:V??`Use this account for this chat`})]}),F&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`This token has expired and carries no refresh token, so nothing can renew it. Sign in again to replace it.`,onClick:O?()=>O(e.accountId):void 0,children:`Expired`}),L&&!F&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:D??`Anthropic rejected this account's refresh token, so no turn can run on it. Signing in again is the only thing that restores it.`,onClick:O?()=>O(e.accountId):void 0,children:`Sign in again`}),!e.isOAuth&&!F&&(0,G.jsx)(X,{className:`text-[10px] text-text-subtle shrink-0`,hint:`A static API key rather than a sign-in: nothing to expire and nothing to renew.`,children:`API key`}),b&&(0,G.jsx)(X,{className:`text-[10px] uppercase tracking-wide text-text-subtle shrink-0`,hint:`The subscription this account is on. It decides which quota windows the account has — some plans have a weekly limit and no shorter one.`,children:b}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[c&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>c(e.accountId,e.accountLabel??``),"aria-label":`Rename account`,children:(0,G.jsx)(g,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Rename account`})]}),!F&&d&&n?.profileData&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>d(n.profileData,e.accountId),"aria-label":`View profile`,children:(0,G.jsx)(l,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`View profile`})]}),!F&&u&&e.isOAuth&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-primary hover:bg-surface-elevated transition-colors`,onClick:()=>u(e.accountId),"aria-label":`Export this account`,children:(0,G.jsx)(p,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Export this account`})]}),!F&&r&&(0,G.jsx)(B,{checked:P!==`disabled`,onCheckedChange:()=>r(e.accountId,P),disabled:i||P===`cooldown`,"aria-label":P===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer relative before:absolute before:content-[''] before:-inset-y-3 before:-inset-x-0.5`}),a&&(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors`,onClick:()=>a(e.accountId,e.accountLabel??e.accountId.slice(0,8)),"aria-label":`Remove account`,children:(0,G.jsx)(s,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Remove account`})]})]})]}),N?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(Y,{label:`5-Hour Session`,bucket:M.session}),(0,G.jsx)(Y,{label:`Weekly`,bucket:M.weekly}),(0,G.jsx)(Y,{label:`Weekly (Opus)`,bucket:M.weeklyOpus}),(0,G.jsx)(Y,{label:`Weekly (Sonnet)`,bucket:M.weeklySonnet}),(0,G.jsx)(Re,{buckets:M.weeklyScoped})]}):(0,G.jsx)(`p`,{className:`text-xs text-text-subtle`,children:e.isOAuth?`No usage data yet`:`Usage tracking not available for API keys`}),x&&(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${x.enabled&&x.state.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${x.enabled&&x.state.blocked?`text-error`:`text-text-secondary`}`,children:[(0,G.jsx)(`span`,{children:`Daily guard`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,G.jsx)(o,{className:`size-3.5`})})}),(0,G.jsx)(C,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays.`})]})]}),(0,G.jsx)(`p`,{className:`text-[10px] tabular-nums ${x.enabled&&x.state.blocked?`text-error`:`text-text-subtle`}`,children:x.enabled&&x.state.blocked?`${Math.round(x.state.used*100)}% used / ${Math.round(x.state.cap*100)}% daily cap. New turns paused.`:`Weekday ${x.state.day}/5, ${Math.round(x.state.cap*100)}% daily cap`})]}),T&&(0,G.jsx)(B,{checked:x.enabled,onCheckedChange:T,disabled:E,"aria-label":x.enabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-text-subtle flex-wrap`,children:[(0,G.jsx)(Be,{credits:k}),A,M.lastFetchedAt&&(0,G.jsxs)(X,{className:`inline-flex items-center gap-1`,hint:`Usage last read from Anthropic on ${new Date(M.lastFetchedAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}. The bars above are only as current as this.`,children:[(0,G.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":!0}),he(new Date(M.lastFetchedAt).getTime())]}),R&&!L&&(0,G.jsxs)(X,{className:[`inline-flex items-center gap-1`,z?`text-warning`:``].filter(Boolean).join(` `),hint:`Sign-in stops working on ${te}. Anthropic ends every sign-in on a fixed schedule from the day it was made, whether or not the account gets used — refreshing does not extend it. After that the account fails until you sign in again.`,children:[(0,G.jsx)(h,{className:`size-3 shrink-0`,"aria-hidden":!0}),`sign-in `,Ce(R)]}),ee&&(0,G.jsxs)(X,{className:I.color,hint:I.tip,children:[`© `,I.label]})]})]})}function Ue(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function We({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:a}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,W.useState)(new Set),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),u(``),f(!1),h(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=y();r&&(n.Authorization=`Bearer ${r}`);let i=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:d,refreshBeforeExport:m})});if(!i.ok){let e=await i.json();throw Error(e.error??`Export failed: ${i.status}`)}let o=await i.text();e&&await D(o)?a?.(`Backup copied to clipboard!`):(Ue(o),a?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!g;return(0,G.jsx)(F,{open:e,onOpenChange:e=>{e||C()},children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Export Accounts`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,G.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,G.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(R,{className:`text-xs`,children:[`Password `,(0,G.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,G.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>u(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:d,onChange:e=>f(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>h(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,G.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),d?(0,G.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,G.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,G.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,G.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,G.jsxs)(j,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,G.jsx)(_,{className:`size-3 mr-1`}),` Copy`]}),(0,G.jsx)(k,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(p,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Ge({open:e,onOpenChange:t,onSuccess:n}){let[r,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null);function f(){t(!1),a(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await oe({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,G.jsx)(F,{open:e,onOpenChange:e=>{e||f()},children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Import Accounts`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(R,{className:`text-xs`,children:`Backup data`}),(0,G.jsx)(`textarea`,{value:r,onChange:e=>a(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(R,{className:`text-xs`,children:[`Password `,(0,G.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,G.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,G.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,G.jsxs)(j,{children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,G.jsx)(k,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var Z=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Ke(e){return Z?.addEventListener(`change`,e),()=>Z?.removeEventListener(`change`,e)}function qe(){return Z?.matches??!0}function Je(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(!0);return(0,W.useEffect)(()=>{r(!0),ce().then(t).finally(()=>r(!1))},[]),n?(0,G.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,G.jsxs)(te,{value:e.strategy,onValueChange:async e=>{t(await H({strategy:e}))},children:[(0,G.jsx)(ne,{className:`w-full h-9 text-xs`,children:(0,G.jsx)(V,{})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(L,{value:`round-robin`,children:`Round-robin`}),(0,G.jsx)(L,{value:`fill-first`,children:`Fill-first`}),(0,G.jsx)(L,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,G.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,G.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await H({maxRetry:n}))}}),(0,G.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,G.jsx)(B,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await H({cooldownEnabled:e}))}})]}),(0,G.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,G.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,G.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,G.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function Ye({open:e,onOpenChange:t}){let n=(0,W.useSyncExternalStore)(Ke,qe);return e?n?(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsxs)(N,{className:`text-sm flex items-center gap-2`,children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation & Retry`]})}),(0,G.jsx)(Je,{})]})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,G.jsxs)(`div`,{className:x(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,G.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,G.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation & Retry`]}),(0,G.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,G.jsx)(m,{className:`size-4`})})]}),(0,G.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,G.jsx)(Je,{})})]})]}):null}var Xe=O(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Q({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:x(Xe({variant:t}),e),...n})}function Ze(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function Qe({accounts:e}){let[t,n]=(0,W.useState)([]),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(new Map),l=e.filter(e=>e.hasRefreshToken);async function u(){if(l.length!==0){i(!0);try{let e=await de(l.map(e=>e.id),a);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:a,items:e}])}catch{}i(!1)}}async function d(e,t){c(t=>new Map(t).set(e,{loading:!0}));try{let n=await ie(t);c(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){c(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function f(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function p(){for(let e of t)for(let t of e.items)for(let n of f(e,t))n.token&&d(n.key,n.token)}return(0,G.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),l.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(B,{id:`sim-include-refresh`,checked:a,onCheckedChange:o,className:`cursor-pointer`}),(0,G.jsx)(R,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,G.jsx)(k,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void u(),children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(v,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:p,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,G.jsx)(Q,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,G.jsx)(Q,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),f(e,t).map(e=>{let t=s.get(e.key);return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,G.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Ze(e.expires)}),e.token?(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void d(e.key,e.token),children:t?.loading?(0,G.jsx)(v,{className:`size-3 animate-spin`}):`Test`}):(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,G.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function $e(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function et({open:e,onOpenChange:t,accounts:n}){let[i,a]=(0,W.useState)(new Map),[o,s]=(0,W.useState)(!1);async function c(e){a(t=>new Map(t).set(e,{loading:!0}));try{let t=await ue(e,o);a(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){a(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function l(){for(let e of n.filter(e=>e.expiresAt!==null))c(e.id)}return(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,G.jsx)(P,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(B,{id:`token-test-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,G.jsx)(R,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:l,children:`Test all`})]})]}),n.length===0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,G.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,G.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:$e(e.expiresAt)})]}),(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void c(e.id),children:t?.loading?(0,G.jsx)(v,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,G.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,G.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,G.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,G.jsx)(Qe,{accounts:n})]}),(0,G.jsx)(j,{children:(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function tt(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:i,refreshing:o,flashIds:s,reload:l}=ve(),[d,f]=(0,W.useState)(null),[m,g]=(0,W.useState)(null),[_,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(null),[S,C]=(0,W.useState)(null),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(null),[O,A]=(0,W.useState)(void 0);function j(e){l(),e&&f(e)}async function M(e,t){g(e);try{await ae(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){f(e.message)}g(null),l()}async function N(){if(_){try{await le(_.id),f(`Account "${_.display}" removed.`),l()}catch(e){f(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await ae(b.id,{label:e}),x(null),f(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(we,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:o,disabled:i,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),D(`add`)},children:[(0,G.jsx)(u,{className:`size-4`}),` Add account`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),D(`export`)},children:[(0,G.jsx)(p,{className:`size-4`}),` Export`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`import`),children:[(0,G.jsx)(c,{className:`size-4`}),` Import`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`rotation`),children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>D(`token-test`),children:[(0,G.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,G.jsx)(Te,{message:d,onDismiss:()=>f(null)}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,he(new Date(I).getTime())]})]}),i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(h,{className:`size-5 text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,G.jsx)(K,{children:e.map(e=>(0,G.jsx)(He,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:m===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),D(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),D(`add`)},flash:s.has(e.accountId)},e.accountId))})]}),S&&(0,G.jsx)(Pe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),_&&(0,G.jsx)(Fe,{display:_.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,G.jsx)(Le,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,G.jsx)(xe,{open:E===`add`,onOpenChange:e=>{D(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:O}),(0,G.jsx)(We,{open:E===`export`,onOpenChange:e=>{D(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:f}),(0,G.jsx)(Ge,{open:E===`import`,onOpenChange:e=>D(e?`import`:null),onSuccess:j}),(0,G.jsx)(Ye,{open:E===`rotation`,onOpenChange:e=>D(e?`rotation`:null)}),(0,G.jsx)(et,{open:E===`token-test`,onOpenChange:e=>D(e?`token-test`:null),accounts:t})]})}function nt({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:a,onExport:o,onImport:s,error:l}){let u=(0,W.useRef)(null),d=e===`export`;return(0,G.jsx)(F,{open:e!==null,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsxs)(N,{className:`text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(i,{className:`size-4`}),` `,d?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,G.jsx)(P,{className:`text-xs leading-relaxed`,children:d?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(R,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,G.jsx)(I,{id:`codex-backup-password`,type:`password`,placeholder:d?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:d?`new-password`:`current-password`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),l&&(0,G.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:l}),(0,G.jsx)(`input`,{ref:u,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,G.jsxs)(j,{children:[(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,G.jsxs)(k,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||a,onClick:()=>d?o():u.current?.click(),children:[a?(0,G.jsx)(v,{className:`size-3.5 animate-spin`}):d?(0,G.jsx)(p,{className:`size-3.5`}):(0,G.jsx)(c,{className:`size-3.5`}),d?`Download backup`:`Choose file`]})]})]})})}var rt=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function it({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,G.jsx)(F,{open:e,onOpenChange:t,children:(0,G.jsxs)(M,{className:`sm:max-w-md`,children:[(0,G.jsxs)(A,{children:[(0,G.jsx)(N,{className:`text-sm`,children:`Codex Rotation`}),(0,G.jsx)(P,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:rt.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:x(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,G.jsx)(j,{children:(0,G.jsx)(k,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function at(e){return e==null?null:Math.round(e*100)}function ot({usage:e}){let t=e.session==null&&e.weekly==null;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,G.jsx)(J,{label:`5-Hour Session`,pct:at(e.fiveHour),reset:U(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,G.jsx)(J,{label:`Weekly`,pct:at(e.sevenDay),reset:U(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function st(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}function ct(e){return st(e)&&(e.resetCredits?.available??0)>0}var lt={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`};function ut(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function dt({account:e,usage:t,onDone:n}){let r=E(),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1);if(!ct(t))return null;let c=t.resetCredits;async function l(){s(!0);try{let t=await b.post(`/api/codex-accounts/${e.id}/reset-credit`);n(lt[t.outcome]?.(e.label)??`${e.label}: ${t.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{s(!1),a(!1)}}let u=ut(t.weekly?.resetsAt),f=ut(c.nextExpiresAt),p=(0,G.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,G.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,c.available,` free reset`,c.available===1?``:`s`,`?`]}),(0,G.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,G.jsxs)(`li`,{children:[c.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,G.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,u?`, not ${u} as now`:``,`. You do not also get that one.`]}),f&&(0,G.jsxs)(`li`,{children:[`This spends the reset that expires first (`,f,`).`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,G.jsx)(k,{variant:`outline`,onClick:()=>a(!1),disabled:o,className:`min-h-11`,children:`Keep it`}),(0,G.jsxs)(k,{onClick:()=>void l(),disabled:o,className:`min-h-11 gap-1.5`,children:[o?(0,G.jsx)(v,{className:`size-4 animate-spin`}):(0,G.jsx)(d,{className:`size-4`}),`Use reset`]})]})]});return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`min-h-11 md:min-h-0 md:h-7 gap-1 px-2 text-[11px] cursor-pointer border-primary/40 text-primary`,onClick:()=>a(!0),disabled:o,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Use reset`]}),i&&(r?(0,G.jsx)(T,{open:!0,onClose:()=>{o||a(!1)},children:(0,G.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,G.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Use a free reset`}),p]})}):(0,G.jsx)(F,{open:!0,onOpenChange:e=>{!e&&!o&&a(!1)},children:(0,G.jsxs)(M,{className:`sm:max-w-sm`,children:[(0,G.jsx)(A,{children:(0,G.jsx)(N,{className:`text-sm`,children:`Use a free reset`})}),p]})}))]})}var $=1440*60*1e3,ft=7,pt=5;function mt(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-ft*$;if(t<r)return null;let i=Math.min(ft-1,Math.floor((t-r)/$)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*$).getUTCDay();t!==0&&t!==6&&a++}let o=a/pt;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function ht(){let[e,t]=(0,W.useState)(null),n=pe(()=>t(null)),[r,i]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(we,{description:(0,G.jsxs)(G.Fragment,{children:[`Each Codex account keeps its own login (`,(0,G.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(k,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,G.jsx)(u,{className:`size-4`}),` Add account`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,G.jsx)(p,{className:`size-4`}),` Export`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,G.jsx)(c,{className:`size-4`}),` Import`]}),(0,G.jsxs)(k,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,G.jsx)(a,{className:`size-4`}),` Rotation`]})]})}),(0,G.jsx)(Te,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(h,{className:`size-5 text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,G.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,G.jsx)(K,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,G.jsxs)(Ee,{dense:!0,className:`min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,G.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>i(e):void 0,children:`Sign in again`}),(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),Se(e.planType)&&(0,G.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Se(e.planType)}),(0,G.jsx)(B,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,G.jsx)(s,{className:`size-4`})})}),(0,G.jsx)(C,{side:`top`,children:`Remove account`})]})]}),(0,G.jsx)(ot,{usage:t}),t.resetCredits&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-[10px] text-text-subtle`,children:[(0,G.jsx)(Be,{credits:t.resetCredits}),(0,G.jsx)(dt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})]}),t.session==null&&(()=>{let r=mt(t.weekly);return r?(0,G.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,G.jsx)(`span`,{children:`Daily guard`}),(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,G.jsx)(o,{className:`size-3.5`})})}),(0,G.jsx)(C,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,G.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,G.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,G.jsx)(B,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})()]},e.id)})})]}),(0,G.jsx)(ye,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,G.jsx)(nt,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,G.jsx)(be,{account:r,onClose:()=>i(null),onDone:()=>void n.load()}),(0,G.jsx)(it,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var gt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}];function _t(){let[e,t]=(0,W.useState)(null),[n,r]=(0,W.useState)(`claude`);(0,W.useEffect)(()=>{let e=!1;return re().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let i=gt.filter(t=>t.id===`claude`||e?.has(t.id)),a=i.length>1;return(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":n,children:[a&&(0,G.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:i.map(e=>(0,G.jsxs)(`button`,{onClick:()=>r(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":n===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${n===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,G.jsx)(ee,{providerId:e.id}),e.label]},e.id))}),e===null&&!a&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(v,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),n===`claude`?(0,G.jsx)(tt,{}):(0,G.jsx)(ht,{})]})}export{_t as AccountsSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-
|
|
2
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{li as r}from"./icons-C1wDt09O.js";import{t as i}from"./preload-helper-Bf_JiD2A.js";import"./portal-container-context-Gepuvxdg.js";import{t as a}from"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import{t as o}from"./agent-session-sheet-store-BFD-ONrQ.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-CVwlys5q.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-Djsgk-RQ.js","assets/preload-helper-Bf_JiD2A.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-CE-YGfFD.js","assets/utils-D3xTlJyU.js","assets/createLucideIcon-B2pji242.js","assets/file-diff-CScJM-VZ.js","assets/git-commit-horizontal-ZMFP54eB.js","assets/api-client-BnYFnEfK.js","assets/react-B9hau9ra.js","assets/open-ppm-tab-C6wAF5Lj.js","assets/settings-store-Cklnwn36.js","assets/window-store-p3fp4QWO.js","assets/minimal-mode-rLZOjciW.js","assets/open-settings-vuCTp-VN.js","assets/settings-categories-sKXV68NQ.js","assets/icons-C1wDt09O.js","assets/use-is-mobile-VRV9eZy1.js","assets/tab-store-CXLR7J_N.js","assets/panel-store-BFvcKuvO.js","assets/session-list-sync-triggers-C62M1ApL.js","assets/project-store-DnFo1aDW.js","assets/project-framework-store-CitdSvSB.js","assets/design-tab-metadata-BysOJn1_.js","assets/chat-jump-store-CkbJ2Hcf.js","assets/tab-open-protocol-t-AqWKkB.js","assets/db-types-LVcYlHNQ.js","assets/split-sql-statements-C5bhcfHn.js","assets/open-db-tabs-DnZuFztN.js","assets/explorer-model-CNX4irsF.js","assets/db-sidebar-reveal-Bk54qn9L.js","assets/use-db-driver-installed-DD0dQDfE.js","assets/impexp-state-aY8a9VMO.js","assets/design-canvas-check-kosIWdAZ.js","assets/ppm-tools-DzCUyQDi.js","assets/file-store-hDALQnuJ.js","assets/sql-identifiers-BaPcB1_S.js","assets/db-explorer-store-B1t3UPUk.js","assets/format-file-meta-_BChvxV4.js","assets/fs-api-B-CZY3Fy.js","assets/use-coarse-long-press-B50YnUCI.js","assets/adaptive-context-menu-B5K3ICvf.js","assets/context-menu-DN83E9o4.js","assets/portal-container-context-Gepuvxdg.js","assets/mobile-bottom-sheet-ChuyFObB.js","assets/use-visual-viewport-7Nr3VIas.js","assets/dialog-DY9KvCIt.js","assets/dropdown-menu-DON1ManL.js","assets/input-Dln1TrJi.js","assets/scroll-area-Cvy0PKUL.js","assets/start-ellipsis-Dyj156hB.js","assets/tooltip-C9Mxdsc-.js","assets/chat-preparation-cache-BOtvRhQ2.js","assets/clipboard-BWcYY8ng.js","assets/file-icons-CqEO9_Cu.js","assets/git-repo-store-BCMPqNNv.js","assets/session-collab-store-B4uOfqXy.js","assets/patch-tab-metadata-BSms70-Y.js","assets/ws-auth-BnhpkEZ7.js","assets/streaming-store-anY5ApLn.js","assets/apply-theme-BYP_2EP0.js","assets/resolve-theme-Cjh-nwcQ.js","assets/index-BvTu5VV7.css","assets/libesm-DtxvtpxO.js","assets/tool-cards-JYbIrLD8.js","assets/agent-session-sheet-store-BFD-ONrQ.js","assets/image-preview-geometry-CLs_RB5A.js","assets/use-blob-url-D_v-kf0R.js","assets/html-preview-loads-DU_aD3Ui.js","assets/image-gallery-C9p4iTsi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{li as r}from"./icons-C1wDt09O.js";import{t as i}from"./preload-helper-Bf_JiD2A.js";import"./portal-container-context-Gepuvxdg.js";import{t as a}from"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import{t as o}from"./agent-session-sheet-store-BFD-ONrQ.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-CVwlys5q.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])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsx)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:e.title??`Agent session`}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.sessionId}`,payload:e})})})]}):null}export{u as AgentSessionSheet};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{L as r,P as i,xn as a}from"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import{n as o}from"./utils-D3xTlJyU.js";import"./window-store-p3fp4QWO.js";import"./panel-store-BFvcKuvO.js";import"./project-store-DnFo1aDW.js";import"./project-framework-store-CitdSvSB.js";import"./session-list-sync-triggers-C62M1ApL.js";import"./tab-store-CXLR7J_N.js";import{n as s}from"./use-coarse-long-press-B50YnUCI.js";import"./chat-jump-store-CkbJ2Hcf.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-sKXV68NQ.js";import"./open-settings-vuCTp-VN.js";import"./open-ppm-tab-C6wAF5Lj.js";import"./session-collab-store-B4uOfqXy.js";import"./chat-preparation-cache-BOtvRhQ2.js";import"./file-store-hDALQnuJ.js";import"./streaming-store-anY5ApLn.js";import"./fs-api-B-CZY3Fy.js";import"./tab-open-protocol-t-AqWKkB.js";import"./design-canvas-check-kosIWdAZ.js";import{G as c,W as l}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{L as r,P as i,xn as a}from"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import{n as o}from"./utils-D3xTlJyU.js";import"./window-store-p3fp4QWO.js";import"./panel-store-BFvcKuvO.js";import"./project-store-DnFo1aDW.js";import"./project-framework-store-CitdSvSB.js";import"./session-list-sync-triggers-C62M1ApL.js";import"./tab-store-CXLR7J_N.js";import{n as s}from"./use-coarse-long-press-B50YnUCI.js";import"./chat-jump-store-CkbJ2Hcf.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-sKXV68NQ.js";import"./open-settings-vuCTp-VN.js";import"./open-ppm-tab-C6wAF5Lj.js";import"./session-collab-store-B4uOfqXy.js";import"./chat-preparation-cache-BOtvRhQ2.js";import"./file-store-hDALQnuJ.js";import"./streaming-store-anY5ApLn.js";import"./fs-api-B-CZY3Fy.js";import"./tab-open-protocol-t-AqWKkB.js";import"./design-canvas-check-kosIWdAZ.js";import{G as c,W as l}from"./index-Djsgk-RQ.js";import"./agent-session-sheet-store-BFD-ONrQ.js";import"./libesm-DtxvtpxO.js";import{g as u,h as d,t as f,v as p}from"./tool-cards-JYbIrLD8.js";import"./use-blob-url-D_v-kf0R.js";var m=e(t(),1),h=2e3;function g(e,t){let n=t.reset?[]:e.slice();for(let{ev:e,ts:r,k:i,replace:a}of t.events){let t=n.findIndex(e=>e.k===i);if(t!==-1){a&&(n[t]={k:i,ts:r,ev:e});continue}let o=n.length;for(;o>0&&n[o-1].ts>r;)o--;n.splice(o,0,{k:i,ts:r,ev:e})}return n.length>2e3?n.slice(n.length-h):n}function _(){return`ats-${Math.random().toString(36).slice(2,10)}`}function v(e){let{projectName:t,providerId:n,sessionId:r,source:i,fallbackEvents:a}=e,[o,s]=(0,m.useState)([]),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(!1),[h,v]=(0,m.useState)(!0),[y,b]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=_(),a=[],o;s([]),d(!1),p(!1),v(!0),b(null);let u=()=>{c(JSON.stringify({type:`agent-transcript:subscribe`,subId:e,projectName:t,providerId:n,sessionId:r,source:i,...o?{cursor:o}:{}}))},f=t=>{let n=t.detail;n.subId===e&&(a=g(a,n),o=n.cursor,s(a),d(n.available),p(n.running),v(!1),b(null))},m=t=>{let n=t.detail;n.subId===e&&(d(!1),v(!1),b(n.code))};window.addEventListener(`agent-transcript:events`,f),window.addEventListener(`agent-transcript:error`,m);let h=l(u);return u(),()=>{window.removeEventListener(`agent-transcript:events`,f),window.removeEventListener(`agent-transcript:error`,m),h(),c(JSON.stringify({type:`agent-transcript:unsubscribe`,subId:e}))}},[JSON.stringify([t,n,r,i])]);let x=(0,m.useMemo)(()=>o.map(e=>e.ev),[o]);return{events:u?x:a??[],available:u,running:f,loading:h,error:y}}var y=n();function b(e){return e.filter(e=>e.type===`tool_use`).length}function x({status:e}){return e===`loading`?null:e===`running`?(0,y.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-primary shrink-0`,children:[(0,y.jsx)(a,{className:`size-2.5 animate-spin`}),` running`]}):e===`failed`?(0,y.jsx)(`span`,{className:`text-[10px] text-error shrink-0`,children:`failed`}):(0,y.jsx)(`span`,{className:`text-[10px] text-success shrink-0`,children:`done`})}function S({payload:e}){let t=e??{},n=t.sessionId?d(t.sessionId,t.source):``,c=u(e=>n?e.entries[n]:void 0),{events:l,available:h,running:g,loading:_,error:S}=v({projectName:t.projectName,providerId:t.providerId,sessionId:t.sessionId,source:t.source,fallbackEvents:c}),[C,w]=(0,m.useState)(!1),T=s(),E=(0,m.useMemo)(()=>b(l),[l]),D=l[l.length-1],O=!g&&!!D&&D.type===`tool_result`&&!!D.isError,k=_?`loading`:g?`running`:O?`failed`:`done`;return(0,y.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface @container`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,y.jsx)(`span`,{className:`truncate text-xs font-medium`,children:t.title??`Agent session`}),l.length>0&&(0,y.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:p(E)}),(0,y.jsx)(x,{status:k}),!h&&!_&&(0,y.jsx)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,title:`No live transcript for this session — showing steps already held in memory`,children:`offline`})]}),!!t.prompt&&(0,y.jsxs)(`div`,{className:`border-b border-border/30 shrink-0`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:o(`flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] text-text-subtle hover:text-foreground`,T?`min-h-[44px]`:`min-h-[28px]`),children:[C?(0,y.jsx)(i,{className:`size-3`}):(0,y.jsx)(r,{className:`size-3`}),`Prompt`]}),C&&(0,y.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-text-secondary whitespace-pre-wrap select-text`,children:t.prompt})]}),_&&l.length===0?(0,y.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,y.jsx)(a,{className:`size-3 animate-spin`}),`Loading session…`]}):l.length===0?(0,y.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle px-4 text-center`,children:S?`Could not load this session`:`No recorded steps`}):(0,y.jsx)(f,{events:l,projectName:t.projectName,variant:`window`,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{S as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{Cn as r,Yr as i,r as a,vr as o,xn as s}from"./icons-C1wDt09O.js";import{k as c}from"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import{n as l}from"./utils-D3xTlJyU.js";import{Jn as u,Kn as d,Xn as f,Yn as p,it as m,qn as h,rt as g}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{Cn as r,Yr as i,r as a,vr as o,xn as s}from"./icons-C1wDt09O.js";import{k as c}from"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import{n as l}from"./utils-D3xTlJyU.js";import{Jn as u,Kn as d,Xn as f,Yn as p,it as m,qn as h,rt as g}from"./index-Djsgk-RQ.js";import{t as _}from"./use-monaco-theme-Do0n80KC.js";var v=e(t(),1),y=n();function b({metadata:e}){let t=e?.filePath,n=e?.name,l=e?.resourceType??`skill`,b=e?.scope??`user`,S=e?.readOnly===!0,C=e?.shadowed===!0,w=e?.shadowedBy,T=e?.project??``,[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!0),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=_(),L=(0,v.useRef)(``),R=E!==O;(0,v.useEffect)(()=>{let e=!1;return j(!0),N(null),p(t,T).then(t=>{e||(D(t.content),k(t.content),L.current=t.content)}).catch(t=>{e||N(t.message)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,T]);let z=(0,v.useCallback)(async()=>{if(S||P)return;let e=L.current;if(e!==O){F(!0);try{await f(t,e,T),k(e),D(e),c.success(`Saved`),u.getState().reload()}catch(e){c.error(e.message)}finally{F(!1)}}},[t,T,O,S,P]);(0,v.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[z]);let B=h[l];return(0,y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,y.jsx)(B,{className:`size-4 text-text-subtle`}),(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:n}),(0,y.jsx)(d,{scope:b}),R&&!S&&(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,title:`Unsaved changes`}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsxs)(`span`,{className:`hidden sm:block text-[11px] text-text-subtle`,children:[l,` · markdown`]}),!S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:()=>D(O),disabled:!R||P,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-text-secondary hover:bg-surface-elevated disabled:opacity-40`,children:[(0,y.jsx)(i,{className:`size-3.5`}),` Revert`]}),(0,y.jsxs)(`button`,{onClick:()=>void z(),disabled:!R||P,className:`flex items-center gap-1 rounded bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:[P?(0,y.jsx)(s,{className:`size-3.5 animate-spin`}):(0,y.jsx)(o,{className:`size-3.5`}),` Save`]})]})]}),S&&(0,y.jsx)(x,{icon:r,tone:`muted`,children:`Bundled resource — read-only. Duplicate it (from the AI Resources panel) to make an editable copy.`}),C&&w&&(0,y.jsxs)(x,{icon:a,tone:`warn`,children:[`This `,l,` is overridden by another “`,w.name,`” from a higher-priority source (`,w.source,`). It is currently inactive.`]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1`,children:A?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(s,{className:`size-5 animate-spin text-primary`})}):M?(0,y.jsx)(`div`,{className:`p-6 text-center text-sm text-destructive`,children:M}):(0,y.jsx)(m,{beforeMount:g,height:`100%`,language:`markdown`,theme:I,value:E,onChange:e=>{let t=e??``;L.current=t,D(t)},options:{readOnly:S,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,lineNumbers:`on`}})})]})}function x({icon:e,tone:t,children:n}){return(0,y.jsxs)(`div`,{className:l(`flex items-start gap-2 px-3 py-2 text-[12px] shrink-0 border-b border-border`,t===`warn`?`bg-amber-500/10 text-amber-300`:`bg-surface-elevated text-text-secondary`),children:[(0,y.jsx)(e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,y.jsx)(`span`,{children:n})]})}export{b as AiResourceEditor};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-p3fp4QWO.js";import"./panel-store-BFvcKuvO.js";import"./project-store-DnFo1aDW.js";import"./project-framework-store-CitdSvSB.js";import"./session-list-sync-triggers-C62M1ApL.js";import"./tab-store-CXLR7J_N.js";import"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-sKXV68NQ.js";import"./open-settings-vuCTp-VN.js";import"./chat-preparation-cache-BOtvRhQ2.js";import"./button-CE-YGfFD.js";import"./dialog-DY9KvCIt.js";import"./input-Dln1TrJi.js";import"./api-settings-DiEZFMDk.js";import{t as e}from"./ai-settings-section-
|
|
1
|
+
import"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import"./icons-C1wDt09O.js";import"./api-client-BnYFnEfK.js";import"./settings-store-Cklnwn36.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-p3fp4QWO.js";import"./panel-store-BFvcKuvO.js";import"./project-store-DnFo1aDW.js";import"./project-framework-store-CitdSvSB.js";import"./session-list-sync-triggers-C62M1ApL.js";import"./tab-store-CXLR7J_N.js";import"./mobile-bottom-sheet-ChuyFObB.js";import"./use-visual-viewport-7Nr3VIas.js";import"./use-is-mobile-VRV9eZy1.js";import"./settings-categories-sKXV68NQ.js";import"./open-settings-vuCTp-VN.js";import"./chat-preparation-cache-BOtvRhQ2.js";import"./button-CE-YGfFD.js";import"./dialog-DY9KvCIt.js";import"./input-Dln1TrJi.js";import"./api-settings-DiEZFMDk.js";import{t as e}from"./ai-settings-section-PZglMLRl.js";export{e as AISettingsSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{Kr as r,gt as i,hr as a,r as o}from"./icons-C1wDt09O.js";import{r as s}from"./api-client-BnYFnEfK.js";import{t as c}from"./open-settings-vuCTp-VN.js";import{t as l}from"./button-CE-YGfFD.js";import{t as u}from"./input-Dln1TrJi.js";import{$n as d,Ir as f,Qn as p,Ri as ee,Wn as te,Zn as m,er as h,nr as g,tr as _}from"./index-D3AIiXA6.js";import{a as ne,x as re}from"./api-settings-DiEZFMDk.js";import{n as v,t as ie}from"./leftover-processes-SK8qVlsH.js";function y(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/i.exec(e);if(!t)return e;let n=t[1],r=t[2].slice(1).split(`-`).join(`.`);return`${n[0].toUpperCase()}${n.slice(1)} ${r}`}var b=[`low`,`medium`,`high`,`xhigh`,`max`];function x(e){return typeof e==`string`&&b.includes(e)}function S(e){return b.indexOf(e)}function C(e){if(!e)return null;let t=e.toLowerCase();if(t===`auto`||t===`unset`)return{kind:`auto`};let n=t===`med`?`medium`:t;return x(n)?{kind:`level`,level:n}:Number.isNaN(parseInt(t,10))?null:{kind:`budget`}}function w(e,t){if(!t)return{level:e,reason:null};let n=C(t.env?.value),{observed:r}=t;if(n)return r?{level:r.applied,reason:`env`}:{level:T(n,t),reason:`env`};let i=r&&r.requested===e?r.applied:E(e,t);return i===e?{level:i,reason:null}:{level:i,reason:t.cap&&S(e)>S(t.cap.value)?`cap`:`model`}}function T(e,t){return e.kind===`level`?E(e.level,t):t.cap?e.kind===`budget`?E(`high`,t):t.cap.value===`low`?E(`low`,t):null:null}function E(e,t){if(t.supported?.length===0)return null;let n=t.cap&&S(e)>S(t.cap.value)?t.cap.value:e;return t.supported&&!t.supported.includes(n)&&(n===`xhigh`||n===`max`)?`high`:n}function D(e){if(e.file)return e.file;switch(e.source){case`userSettings`:return`~/.claude/settings.json`;case`projectSettings`:return`.claude/settings.json`;case`localSettings`:return`.claude/settings.local.json`;case`policySettings`:return`managed settings`;case`flagSettings`:return`the settings PPM passes to Claude Code`;case`environment`:return`the environment PPM runs in`}}var O=[{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`,default:!0},{label:`Extra`,value:`xhigh`},{label:`Max`,value:`max`}];function k(e){return e?O.find(t=>t.value===e)?.label??e:``}function A(e,t){let n=k(t);return n?`${e} · ${n}`:e}var j=O.find(e=>e.default).value;function M(e,t){let n=x(e)?e:j;return{pick:n,...w(n,t)}}function N(e){return e.map(e=>typeof e==`string`?e:e.code).join(``)}var P=`Remove it there to use the effort picked in PPM.`;function F(e,t,n){if(!e.reason||!t)return null;let r=t.observed?.model,i=r?y(r.replace(/\[[^\]]*\]$/,``)):n,a=e.level?k(e.level):null,o=C(t.env?.value);if(e.reason===`env`&&t.env&&o){let n=[{code:`CLAUDE_CODE_EFFORT_LEVEL=${t.env.value}`},` in `,{code:D(t.env)}];if(o.kind===`auto`){let e=t.cap?`Claude Code sends ${i}'s default effort, capped at ${k(t.cap.value)}.`:a?`Claude Code sends ${i}'s default, ${a}.`:`no effort is sent, so ${i}'s default applies.`;return{title:`Effort is left to the model`,detail:[...n,` overrides the effort picked here: ${e} `,P]}}if(o.kind===`budget`)return a?{title:`Effort is set to ${a} outside PPM`,detail:[...n,` overrides the effort picked here; with a maxEffortLevel set, Claude Code runs it as ${a}. `,P]}:{title:`A thinking budget replaces the effort`,detail:[...n,` sets a thinking budget instead of an effort level, so the effort picked here is not sent. `,P]};let r=e.level===o.level?``:a?` ${i} runs it as ${a}.`:` ${i} takes no effort level, so none is sent.`;return{title:`Effort is set to ${k(o.level)} outside PPM`,detail:[...n,` overrides the effort picked here.${r} `,P]}}if(e.reason===`cap`&&t.cap){let n=e.level===t.cap.value||!a?``:` ${i} runs it as ${a}.`;return{title:`Effort is capped at ${k(t.cap.value)}`,detail:[{code:`maxEffortLevel: "${t.cap.value}"`},` in `,{code:D(t.cap)},` lowers any effort picked above it.${n}`]}}return a?{title:`Runs at ${a}`,detail:[`${k(e.pick)} isn't available for ${i}, so Claude Code runs it at ${a}.`]}:{title:`${i} takes no effort level`,detail:[`Claude Code sends no effort with ${i}, so the effort picked here has no effect.`]}}var I=e(t(),1),L=n(),R=[128e3,272e3,4e5,512e3,872e3,1e6],z=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function B({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[s,c]=(0,I.useState)(!!n&&!r.includes(Number(n))),l=a?`text-[11px]`:`text-sm`;return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(f,{htmlFor:e,className:l,children:t}),(0,L.jsxs)(`select`,{id:e,value:s?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${l}`,onChange:e=>{let t=e.target.value;c(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,L.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,L.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,L.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),s&&(0,L.jsx)(u,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function ae({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,I.useState)(String(e?.model_context_window??``)),[o,s]=(0,I.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,I.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function f(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,L.jsxs)(`form`,{onSubmit:f,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:R,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,L.jsx)(B,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:z,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,L.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,L.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var oe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],se=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],V={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function H({compact:e}={}){let[t,n]=(0,I.useState)(null),[r,b]=(0,I.useState)(``),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(!1),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(null),[k,A]=(0,I.useState)(0),[j,P]=(0,I.useState)([]),[R,z]=(0,I.useState)(!1);(0,I.useEffect)(()=>{ne().then(e=>{n(e),b(e.default_provider??`claude`)}).catch(e=>O(e.message))},[]),(0,I.useEffect)(()=>{r&&s.get(`/api/settings/ai/providers/status`).then(P).catch(()=>P([]))},[r]);let B=j.find(e=>e.id===r&&!e.registered);(0,I.useEffect)(()=>{r&&(w(!0),s.get(`/api/settings/ai/providers/${r}/models`).then(S).catch(()=>S([])).finally(()=>w(!1)))},[r,!B]);let[H,U]=(0,I.useState)(null),W=t?.providers[r]?.model;(0,I.useEffect)(()=>{if(U(null),!r)return;let e=!0,t=W?`?model=${encodeURIComponent(W)}`:``;return s.get(`/api/settings/ai/providers/${r}/effort-status${t}`).then(({status:t})=>{e&&U(t)}).catch(()=>{}),()=>{e=!1}},[r,W]);let le=async()=>{z(!0);try{let e=await s.post(`/api/settings/ai/providers/${r}/probe`);P(t=>t.map(t=>t.id===e.id?e:t))}catch(e){O(e.message)}finally{z(!1)}},G=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:V[e]??e})):[],K=t?.providers[r],q=K?.type===`agent-sdk`||!K?.type&&r===`claude`,J=F(M(K?.effort,H),H,K?.model?y(K.model):`the model`),Y=async e=>{if(!t)return!1;E(!0),O(null);try{return n(await re(e)),A(e=>e+1),!0}catch(e){return O(e.message),!1}finally{E(!1)}},X=(e,t)=>Y({providers:{[r]:{[e]:t}}}),Z=e?`text-[11px]`:`text-sm`,Q=e?`text-xs`:`text-sm`,ue=e?`space-y-2`:`space-y-4`,de=e?`space-y-1.5`:`space-y-3`,$=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,L.jsxs)(`div`,{className:de,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsx)(`p`,{className:`${Z} text-text-subtle`,children:D?`Error: ${D}`:`Loading...`})]});let fe=q?x:[{value:`__default__`,label:`Auto (default)`},...x];return(0,L.jsxs)(`div`,{className:ue,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-new-chat-provider`,className:e?Z:void 0,children:`New chat provider`}),(0,L.jsxs)(m,{value:t.new_chat_provider_mode??`default`,disabled:T,onValueChange:e=>Y({new_chat_provider_mode:e}),children:[(0,L.jsx)(h,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(p,{children:[(0,L.jsx)(d,{value:`follow-focus`,children:`Follow last focused chat`}),(0,L.jsx)(d,{value:`default`,children:`Always use default provider`})]})]}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-default-provider`,className:e?Z:void 0,children:`Default provider`}),(0,L.jsxs)(m,{value:t.default_provider,disabled:T,onValueChange:e=>Y({default_provider:e}),children:[(0,L.jsx)(h,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:G.map(e=>(0,L.jsx)(d,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-share-provider-context`,className:e?Z:void 0,children:`Share rules and memory between providers`}),(0,L.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,L.jsx)(g,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:T,onCheckedChange:e=>Y({share_provider_context:e})})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-leftover-idle`,className:e?Z:void 0,children:`Stop leftover processes after (idle minutes, 0 = log only)`}),(0,L.jsx)(u,{id:`ai-leftover-idle`,type:`number`,min:0,max:ie,defaultValue:v(t),"aria-describedby":`ai-leftover-idle-description`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let n=parseInt(e.target.value),r=isNaN(n)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),n));e.target.value=String(r??v(t)),r!==null&&Y({leftover_processes_idle_minutes:r})}},`leftover-${k}`),(0,L.jsxs)(`p`,{id:`ai-leftover-idle-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[`Servers, emulators and other processes a chat's commands started and left running are stopped once the chat has been idle this long, and at once when the chat is deleted. At 0 nothing is stopped: the server log names what `,30,` idle minutes would have stopped. Linux with systemd only.`]})]}),G.length>1&&(0,L.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:G.map(e=>(0,L.jsxs)(`button`,{onClick:()=>b(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,L.jsx)(ee,{providerId:e.id}),(0,L.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,L.jsxs)(`div`,{className:de,children:[B&&(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,L.jsxs)(`p`,{className:`${Z} text-text-secondary`,children:[V[r]??r,` is not available in chat — PPM could not start it.`]}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:B.reason}),B.nextProbeAt&&(0,L.jsxs)(`p`,{className:`text-[11px] text-text-subtle`,children:[`Checking again at `,new Date(B.nextProbeAt).toLocaleTimeString()]}),(0,L.jsxs)(l,{variant:`outline`,size:`sm`,onClick:le,disabled:R,className:`gap-1.5 cursor-pointer min-h-11 md:min-h-8`,children:[(0,L.jsx)(a,{className:`size-3.5 ${R?`animate-spin`:``}`}),R?`Checking...`:`Check again`]})]})]}),r===`codex`&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,L.jsx)(`span`,{className:`${Z} text-text-secondary`,children:`Codex accounts & login`}),(0,L.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),x.length>0&&(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-model`,className:e?Z:void 0,children:`Model`}),(0,L.jsxs)(m,{value:q?K?.model??x[0]?.value:K?.model||`__default__`,onValueChange:e=>X(`model`,e===`__default__`?void 0:e),disabled:C,children:[(0,L.jsx)(h,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{placeholder:C?`Loading models...`:`Select model`})}),(0,L.jsx)(p,{className:`max-h-[300px]`,children:fe.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,L.jsx)(ae,{config:K,compact:e,saving:T,onSave:e=>Y({providers:{codex:e}})},JSON.stringify([K?.model_context_window,K?.model_auto_compact_token_limit])),q&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-base-url`,className:e?Z:void 0,children:`Base URL`}),(0,L.jsx)(u,{id:`ai-base-url`,type:`url`,defaultValue:K?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{X(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-api-key`,className:e?Z:void 0,children:`API Key / Token`}),(0,L.jsx)(u,{id:`ai-api-key`,type:`password`,defaultValue:K?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||X(`api_key`,t||void 0)}},`apikey-${r}-${k}`),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-effort`,className:e?Z:void 0,children:`Effort`}),(0,L.jsxs)(m,{value:K?.effort??`high`,onValueChange:e=>X(`effort`,e),children:[(0,L.jsx)(h,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:oe.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]}),J&&(0,L.jsxs)(`div`,{role:`note`,className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,L.jsx)(`p`,{className:`${Z} text-text-secondary`,children:J.title}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:N(J.detail)})]})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-max-turns`,className:e?Z:void 0,children:`Max Turns (up to 1000, 0 = no limit)`}),(0,L.jsx)(u,{id:`ai-max-turns`,type:`number`,min:0,max:1e3,defaultValue:K?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value),n=isNaN(t)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),t));e.target.value=String(n??K?.max_turns??100),n!==null&&X(`max_turns`,n)}},`turns-${r}-${k}`),(K?.max_turns===0||(K?.max_turns??0)>500)&&(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 ${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[(0,L.jsx)(o,{className:`size-3 text-warning shrink-0 mt-px`}),`Every step is a paid model call. With a limit this high, or none, a task left running unattended can go on for hours and run up a large bill.`]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-budget`,className:e?Z:void 0,children:`Max Budget (USD)`}),(0,L.jsx)(u,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:K?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);X(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-thinking`,className:e?Z:void 0,children:`Thinking Budget (tokens)`}),(0,L.jsx)(u,{id:`ai-thinking`,type:`number`,min:0,defaultValue:K?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);X(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-agent-teams`,className:e?Z:void 0,children:`Agent Teams`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,L.jsx)(g,{id:`ai-agent-teams`,checked:K?.agent_teams??!1,onCheckedChange:e=>X(`agent_teams`,e)})]}),K?.agent_teams&&(0,L.jsx)(ce,{compact:e}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-context-1m`,className:e?Z:void 0,children:`1M Context Window`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,L.jsx)(g,{id:`ai-context-1m`,checked:K?.context_1m??!1,onCheckedChange:e=>X(`context_1m`,e)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-inherit-mcp`,className:e?Z:void 0,children:`Inherit Claude Code MCP`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,L.jsx)(g,{id:`ai-inherit-mcp`,checked:K?.inherit_claude_mcp??!0,onCheckedChange:e=>X(`inherit_claude_mcp`,e)})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{className:e?Z:void 0,children:`MCP sign-in`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,L.jsx)(`div`,{className:`-mx-2`,children:(0,L.jsx)(te,{showWhenEmpty:!0})})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-permission-mode`,className:e?Z:void 0,children:`Default Permission Mode`}),(0,L.jsxs)(m,{value:K?.permission_mode??`bypassPermissions`,onValueChange:e=>X(`permission_mode`,e),children:[(0,L.jsx)(h,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:se.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-system-prompt`,className:e?Z:void 0,children:`Additional Instructions`}),(0,L.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:K?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{X(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${k}`)]})]}),T&&(0,L.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),D&&(0,L.jsx)(`p`,{className:`text-xs text-error`,children:D})]})}function ce({compact:e}){let[t,n]=(0,I.useState)([]),[i,o]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null),u=(0,I.useCallback)(async()=>{o(!0);try{n(await s.get(`/api/teams`)??[])}catch{}o(!1)},[]);(0,I.useEffect)(()=>{u()},[u]);let d=async e=>{try{await s.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(f,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,L.jsx)(`button`,{onClick:u,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,L.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,L.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,L.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,L.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,L.jsx)(`button`,{onClick:()=>d(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,L.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,L.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,L.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{F as a,y as c,k as i,O as n,N as o,A as r,M as s,H as t};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{Kr as r,gt as i,hr as a,r as o}from"./icons-C1wDt09O.js";import{r as s}from"./api-client-BnYFnEfK.js";import{t as c}from"./open-settings-vuCTp-VN.js";import{t as l}from"./button-CE-YGfFD.js";import{t as u}from"./input-Dln1TrJi.js";import{$n as d,Ir as f,Qn as p,Ri as ee,Wn as te,Zn as m,er as h,nr as g,tr as _}from"./index-Djsgk-RQ.js";import{a as ne,x as re}from"./api-settings-DiEZFMDk.js";import{n as v,t as ie}from"./leftover-processes-SK8qVlsH.js";function y(e){let t=/^claude-([a-z]+)((?:-\d{1,2})+)(?:-\d{8})?$/i.exec(e);if(!t)return e;let n=t[1],r=t[2].slice(1).split(`-`).join(`.`);return`${n[0].toUpperCase()}${n.slice(1)} ${r}`}var b=[`low`,`medium`,`high`,`xhigh`,`max`];function x(e){return typeof e==`string`&&b.includes(e)}function S(e){return b.indexOf(e)}function C(e){if(!e)return null;let t=e.toLowerCase();if(t===`auto`||t===`unset`)return{kind:`auto`};let n=t===`med`?`medium`:t;return x(n)?{kind:`level`,level:n}:Number.isNaN(parseInt(t,10))?null:{kind:`budget`}}function w(e,t){if(!t)return{level:e,reason:null};let n=C(t.env?.value),{observed:r}=t;if(n)return r?{level:r.applied,reason:`env`}:{level:T(n,t),reason:`env`};let i=r&&r.requested===e?r.applied:E(e,t);return i===e?{level:i,reason:null}:{level:i,reason:t.cap&&S(e)>S(t.cap.value)?`cap`:`model`}}function T(e,t){return e.kind===`level`?E(e.level,t):t.cap?e.kind===`budget`?E(`high`,t):t.cap.value===`low`?E(`low`,t):null:null}function E(e,t){if(t.supported?.length===0)return null;let n=t.cap&&S(e)>S(t.cap.value)?t.cap.value:e;return t.supported&&!t.supported.includes(n)&&(n===`xhigh`||n===`max`)?`high`:n}function D(e){if(e.file)return e.file;switch(e.source){case`userSettings`:return`~/.claude/settings.json`;case`projectSettings`:return`.claude/settings.json`;case`localSettings`:return`.claude/settings.local.json`;case`policySettings`:return`managed settings`;case`flagSettings`:return`the settings PPM passes to Claude Code`;case`environment`:return`the environment PPM runs in`}}var O=[{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`,default:!0},{label:`Extra`,value:`xhigh`},{label:`Max`,value:`max`}];function k(e){return e?O.find(t=>t.value===e)?.label??e:``}function A(e,t){let n=k(t);return n?`${e} · ${n}`:e}var j=O.find(e=>e.default).value;function M(e,t){let n=x(e)?e:j;return{pick:n,...w(n,t)}}function N(e){return e.map(e=>typeof e==`string`?e:e.code).join(``)}var P=`Remove it there to use the effort picked in PPM.`;function F(e,t,n){if(!e.reason||!t)return null;let r=t.observed?.model,i=r?y(r.replace(/\[[^\]]*\]$/,``)):n,a=e.level?k(e.level):null,o=C(t.env?.value);if(e.reason===`env`&&t.env&&o){let n=[{code:`CLAUDE_CODE_EFFORT_LEVEL=${t.env.value}`},` in `,{code:D(t.env)}];if(o.kind===`auto`){let e=t.cap?`Claude Code sends ${i}'s default effort, capped at ${k(t.cap.value)}.`:a?`Claude Code sends ${i}'s default, ${a}.`:`no effort is sent, so ${i}'s default applies.`;return{title:`Effort is left to the model`,detail:[...n,` overrides the effort picked here: ${e} `,P]}}if(o.kind===`budget`)return a?{title:`Effort is set to ${a} outside PPM`,detail:[...n,` overrides the effort picked here; with a maxEffortLevel set, Claude Code runs it as ${a}. `,P]}:{title:`A thinking budget replaces the effort`,detail:[...n,` sets a thinking budget instead of an effort level, so the effort picked here is not sent. `,P]};let r=e.level===o.level?``:a?` ${i} runs it as ${a}.`:` ${i} takes no effort level, so none is sent.`;return{title:`Effort is set to ${k(o.level)} outside PPM`,detail:[...n,` overrides the effort picked here.${r} `,P]}}if(e.reason===`cap`&&t.cap){let n=e.level===t.cap.value||!a?``:` ${i} runs it as ${a}.`;return{title:`Effort is capped at ${k(t.cap.value)}`,detail:[{code:`maxEffortLevel: "${t.cap.value}"`},` in `,{code:D(t.cap)},` lowers any effort picked above it.${n}`]}}return a?{title:`Runs at ${a}`,detail:[`${k(e.pick)} isn't available for ${i}, so Claude Code runs it at ${a}.`]}:{title:`${i} takes no effort level`,detail:[`Claude Code sends no effort with ${i}, so the effort picked here has no effect.`]}}var I=e(t(),1),L=n(),R=[128e3,272e3,4e5,512e3,872e3,1e6],z=[1e5,2e5,23e4,35e4,45e4,75e4,9e5];function B({id:e,label:t,value:n,presets:r,disabled:i,compact:a,onChange:o}){let[s,c]=(0,I.useState)(!!n&&!r.includes(Number(n))),l=a?`text-[11px]`:`text-sm`;return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(f,{htmlFor:e,className:l,children:t}),(0,L.jsxs)(`select`,{id:e,value:s?`custom`:n||`default`,disabled:i,"aria-describedby":`codex-context-help`,className:`w-full min-h-11 sm:min-h-0 rounded-md border border-input bg-background px-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 ${a?`h-7`:`h-9`} ${l}`,onChange:e=>{let t=e.target.value;c(t===`custom`),t!==`custom`&&o(t===`default`?``:t)},children:[(0,L.jsx)(`option`,{value:`default`,children:`Codex default`}),r.map(e=>(0,L.jsxs)(`option`,{value:String(e),children:[e===1e6?`1M`:`${e/1e3}K`,` tokens`]},e)),(0,L.jsx)(`option`,{value:`custom`,children:`Custom...`})]}),s&&(0,L.jsx)(u,{id:`${e}-custom`,"aria-label":`Custom ${t.toLowerCase()}`,type:`number`,min:1,step:1,required:!0,value:n,disabled:i,placeholder:`Enter tokens`,"aria-describedby":`codex-context-help`,className:`min-h-11 sm:min-h-0 ${a?`h-7 text-[11px]`:``}`,onChange:e=>o(e.target.value)})]})}function ae({config:e,compact:t,saving:n,onSave:r}){let[i,a]=(0,I.useState)(String(e?.model_context_window??``)),[o,s]=(0,I.useState)(String(e?.model_auto_compact_token_limit??``)),[c,l]=(0,I.useState)(null),u=t?`text-[11px]`:`text-sm`,d=t?`text-[9px]`:`text-[11px]`;async function f(e){e.preventDefault();let t=i.trim()?Number(i):null,n=o.trim()?Number(o):null;if([t,n].some(e=>e!==null&&(!Number.isSafeInteger(e)||e<=0))){l(`Enter positive whole numbers of tokens, or leave blank for Codex defaults.`);return}if(t!==null&&n!==null&&n>t){l(`Auto-compact threshold must not exceed the context window.`);return}l(null),await r({model_context_window:t,model_auto_compact_token_limit:n})}return(0,L.jsxs)(`form`,{onSubmit:f,className:`space-y-2 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(B,{id:`codex-context-window`,label:`Context window (tokens)`,value:i,presets:R,disabled:n,compact:t,onChange:e=>{a(e),l(null)}}),(0,L.jsx)(B,{id:`codex-compact-threshold`,label:`Auto-compact threshold (tokens)`,value:o,presets:z,disabled:n,compact:t,onChange:e=>{s(e),l(null)}})]}),(0,L.jsx)(`p`,{id:`codex-context-help`,className:`${d} text-muted-foreground`,children:`Choose Codex default to use Codex configuration and model defaults, or Custom to enter a value. Presets are shortcuts, not a list of limits supported by your model; increasing these values does not unlock a larger context window. Applies to new sessions and sessions resumed after a PPM restart.`}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`${u} text-error`,children:c}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`a`,{href:`https://learn.chatgpt.com/docs/config-file/config-reference`,target:`_blank`,rel:`noreferrer`,className:`${d} text-primary underline`,children:`Codex context documentation`}),(0,L.jsx)(`button`,{type:`submit`,disabled:n,className:`min-h-11 sm:min-h-0 rounded-md border border-border px-3 py-1.5 hover:bg-surface-elevated disabled:opacity-50 ${u}`,children:n?`Saving...`:`Save context settings`})]})]})}var oe=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`xhigh`,label:`Extra`},{value:`max`,label:`Max`}],se=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}],V={claude:`Claude`,cursor:`Cursor`,codex:`Codex`,gemini:`Gemini`};function H({compact:e}={}){let[t,n]=(0,I.useState)(null),[r,b]=(0,I.useState)(``),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(!1),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(null),[k,A]=(0,I.useState)(0),[j,P]=(0,I.useState)([]),[R,z]=(0,I.useState)(!1);(0,I.useEffect)(()=>{ne().then(e=>{n(e),b(e.default_provider??`claude`)}).catch(e=>O(e.message))},[]),(0,I.useEffect)(()=>{r&&s.get(`/api/settings/ai/providers/status`).then(P).catch(()=>P([]))},[r]);let B=j.find(e=>e.id===r&&!e.registered);(0,I.useEffect)(()=>{r&&(w(!0),s.get(`/api/settings/ai/providers/${r}/models`).then(S).catch(()=>S([])).finally(()=>w(!1)))},[r,!B]);let[H,U]=(0,I.useState)(null),W=t?.providers[r]?.model;(0,I.useEffect)(()=>{if(U(null),!r)return;let e=!0,t=W?`?model=${encodeURIComponent(W)}`:``;return s.get(`/api/settings/ai/providers/${r}/effort-status${t}`).then(({status:t})=>{e&&U(t)}).catch(()=>{}),()=>{e=!1}},[r,W]);let le=async()=>{z(!0);try{let e=await s.post(`/api/settings/ai/providers/${r}/probe`);P(t=>t.map(t=>t.id===e.id?e:t))}catch(e){O(e.message)}finally{z(!1)}},G=t?Object.keys(t.providers).filter(e=>e!==`mock`).map(e=>({id:e,name:V[e]??e})):[],K=t?.providers[r],q=K?.type===`agent-sdk`||!K?.type&&r===`claude`,J=F(M(K?.effort,H),H,K?.model?y(K.model):`the model`),Y=async e=>{if(!t)return!1;E(!0),O(null);try{return n(await re(e)),A(e=>e+1),!0}catch(e){return O(e.message),!1}finally{E(!1)}},X=(e,t)=>Y({providers:{[r]:{[e]:t}}}),Z=e?`text-[11px]`:`text-sm`,Q=e?`text-xs`:`text-sm`,ue=e?`space-y-2`:`space-y-4`,de=e?`space-y-1.5`:`space-y-3`,$=e?`space-y-1`:`space-y-1.5`;if(!t)return(0,L.jsxs)(`div`,{className:de,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsx)(`p`,{className:`${Z} text-text-subtle`,children:D?`Error: ${D}`:`Loading...`})]});let fe=q?x:[{value:`__default__`,label:`Auto (default)`},...x];return(0,L.jsxs)(`div`,{className:ue,children:[(0,L.jsx)(`h3`,{className:`${Q} font-medium text-text-secondary`,children:`AI Settings`}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-new-chat-provider`,className:e?Z:void 0,children:`New chat provider`}),(0,L.jsxs)(m,{value:t.new_chat_provider_mode??`default`,disabled:T,onValueChange:e=>Y({new_chat_provider_mode:e}),children:[(0,L.jsx)(h,{id:`ai-new-chat-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsxs)(p,{children:[(0,L.jsx)(d,{value:`follow-focus`,children:`Follow last focused chat`}),(0,L.jsx)(d,{value:`default`,children:`Always use default provider`})]})]}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:t.new_chat_provider_mode===`follow-focus`?`New tabs follow the last chat you focused in this project, across panels. Existing tabs keep their provider.`:`New tabs always use the default provider. Existing tabs keep their provider.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-default-provider`,className:e?Z:void 0,children:`Default provider`}),(0,L.jsxs)(m,{value:t.default_provider,disabled:T,onValueChange:e=>Y({default_provider:e}),children:[(0,L.jsx)(h,{id:`ai-default-provider`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:G.map(e=>(0,L.jsx)(d,{value:e.id,children:e.name},e.id))})]}),t.new_chat_provider_mode===`follow-focus`&&(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Used when no chat has been focused in this project yet.`})]}),(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-share-provider-context`,className:e?Z:void 0,children:`Share rules and memory between providers`}),(0,L.jsx)(`p`,{id:`ai-share-provider-context-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Share project rules and memory, plus global instruction files, across providers. Applies from the next project-chat message. Turning off keeps context already sent.`})]}),(0,L.jsx)(g,{id:`ai-share-provider-context`,"aria-describedby":`ai-share-provider-context-description`,checked:t.share_provider_context??!0,disabled:T,onCheckedChange:e=>Y({share_provider_context:e})})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-leftover-idle`,className:e?Z:void 0,children:`Stop leftover processes after (idle minutes, 0 = log only)`}),(0,L.jsx)(u,{id:`ai-leftover-idle`,type:`number`,min:0,max:ie,defaultValue:v(t),"aria-describedby":`ai-leftover-idle-description`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let n=parseInt(e.target.value),r=isNaN(n)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),n));e.target.value=String(r??v(t)),r!==null&&Y({leftover_processes_idle_minutes:r})}},`leftover-${k}`),(0,L.jsxs)(`p`,{id:`ai-leftover-idle-description`,className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[`Servers, emulators and other processes a chat's commands started and left running are stopped once the chat has been idle this long, and at once when the chat is deleted. At 0 nothing is stopped: the server log names what `,30,` idle minutes would have stopped. Linux with systemd only.`]})]}),G.length>1&&(0,L.jsx)(`div`,{className:`flex gap-0.5 border-b border-border/50 -mx-1 px-1`,children:G.map(e=>(0,L.jsxs)(`button`,{onClick:()=>b(e.id),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-t transition-colors ${r===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,L.jsx)(ee,{providerId:e.id}),(0,L.jsx)(`span`,{className:`capitalize`,children:e.name})]},e.id))}),(0,L.jsxs)(`div`,{className:de,children:[B&&(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,L.jsxs)(`p`,{className:`${Z} text-text-secondary`,children:[V[r]??r,` is not available in chat — PPM could not start it.`]}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:B.reason}),B.nextProbeAt&&(0,L.jsxs)(`p`,{className:`text-[11px] text-text-subtle`,children:[`Checking again at `,new Date(B.nextProbeAt).toLocaleTimeString()]}),(0,L.jsxs)(l,{variant:`outline`,size:`sm`,onClick:le,disabled:R,className:`gap-1.5 cursor-pointer min-h-11 md:min-h-8`,children:[(0,L.jsx)(a,{className:`size-3.5 ${R?`animate-spin`:``}`}),R?`Checking...`:`Check again`]})]})]}),r===`codex`&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>c(`accounts`),className:`w-full flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-2 text-left cursor-pointer hover:bg-surface-elevated transition-colors`,children:[(0,L.jsx)(`span`,{className:`${Z} text-text-secondary`,children:`Codex accounts & login`}),(0,L.jsx)(i,{className:`size-3.5 text-text-subtle shrink-0`})]}),x.length>0&&(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-model`,className:e?Z:void 0,children:`Model`}),(0,L.jsxs)(m,{value:q?K?.model??x[0]?.value:K?.model||`__default__`,onValueChange:e=>X(`model`,e===`__default__`?void 0:e),disabled:C,children:[(0,L.jsx)(h,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{placeholder:C?`Loading models...`:`Select model`})}),(0,L.jsx)(p,{className:`max-h-[300px]`,children:fe.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]})]}),r===`codex`&&(0,L.jsx)(ae,{config:K,compact:e,saving:T,onSave:e=>Y({providers:{codex:e}})},JSON.stringify([K?.model_context_window,K?.model_auto_compact_token_limit])),q&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-base-url`,className:e?Z:void 0,children:`Base URL`}),(0,L.jsx)(u,{id:`ai-base-url`,type:`url`,defaultValue:K?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{X(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-api-key`,className:e?Z:void 0,children:`API Key / Token`}),(0,L.jsx)(u,{id:`ai-api-key`,type:`password`,defaultValue:K?.api_key??``,placeholder:`sk-ant-... (optional, overrides accounts)`,className:e?`h-7 text-[11px] font-mono`:`font-mono`,onBlur:e=>{let t=e.target.value.trim();t.startsWith(`••••`)||X(`api_key`,t||void 0)}},`apikey-${r}-${k}`),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Direct API key or OAuth token. Leave empty to use connected accounts.`})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-effort`,className:e?Z:void 0,children:`Effort`}),(0,L.jsxs)(m,{value:K?.effort??`high`,onValueChange:e=>X(`effort`,e),children:[(0,L.jsx)(h,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:oe.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]}),J&&(0,L.jsxs)(`div`,{role:`note`,className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-2`,children:[(0,L.jsx)(o,{className:`size-3.5 text-warning shrink-0 mt-0.5`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,L.jsx)(`p`,{className:`${Z} text-text-secondary`,children:J.title}),(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-words`,children:N(J.detail)})]})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-max-turns`,className:e?Z:void 0,children:`Max Turns (up to 1000, 0 = no limit)`}),(0,L.jsx)(u,{id:`ai-max-turns`,type:`number`,min:0,max:1e3,defaultValue:K?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value),n=isNaN(t)?null:Math.min(Number(e.target.max),Math.max(Number(e.target.min),t));e.target.value=String(n??K?.max_turns??100),n!==null&&X(`max_turns`,n)}},`turns-${r}-${k}`),(K?.max_turns===0||(K?.max_turns??0)>500)&&(0,L.jsxs)(`p`,{className:`flex items-start gap-1.5 ${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:[(0,L.jsx)(o,{className:`size-3 text-warning shrink-0 mt-px`}),`Every step is a paid model call. With a limit this high, or none, a task left running unattended can go on for hours and run up a large bill.`]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-budget`,className:e?Z:void 0,children:`Max Budget (USD)`}),(0,L.jsx)(u,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:K?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);X(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-thinking`,className:e?Z:void 0,children:`Thinking Budget (tokens)`}),(0,L.jsx)(u,{id:`ai-thinking`,type:`number`,min:0,defaultValue:K?.thinking_budget_tokens??``,placeholder:`Adaptive (model decides)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);X(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${r}-${k}`)]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-agent-teams`,className:e?Z:void 0,children:`Agent Teams`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Experimental. Enables multi-agent collaboration with shared tasks and messaging. Uses ~7x more tokens.`})]}),(0,L.jsx)(g,{id:`ai-agent-teams`,checked:K?.agent_teams??!1,onCheckedChange:e=>X(`agent_teams`,e)})]}),K?.agent_teams&&(0,L.jsx)(ce,{compact:e}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-context-1m`,className:e?Z:void 0,children:`1M Context Window`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Requires an entitled account (Max/Team/Enterprise) and an Opus 4 / Sonnet 4 model. Other accounts will error.`})]}),(0,L.jsx)(g,{id:`ai-context-1m`,checked:K?.context_1m??!1,onCheckedChange:e=>X(`context_1m`,e)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(f,{htmlFor:`ai-inherit-mcp`,className:e?Z:void 0,children:`Inherit Claude Code MCP`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Auto-load MCP servers from Claude Code's ~/.claude.json (global + per-project). Your own MCP servers override inherited ones.`})]}),(0,L.jsx)(g,{id:`ai-inherit-mcp`,checked:K?.inherit_claude_mcp??!0,onCheckedChange:e=>X(`inherit_claude_mcp`,e)})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{className:e?Z:void 0,children:`MCP sign-in`}),(0,L.jsx)(`p`,{className:`${e?`text-[9px]`:`text-[11px]`} text-muted-foreground`,children:`Servers that use OAuth stay unavailable to Claude until someone signs in. Project-scoped servers are listed in the project's AI Resources panel.`}),(0,L.jsx)(`div`,{className:`-mx-2`,children:(0,L.jsx)(te,{showWhenEmpty:!0})})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-permission-mode`,className:e?Z:void 0,children:`Default Permission Mode`}),(0,L.jsxs)(m,{value:K?.permission_mode??`bypassPermissions`,onValueChange:e=>X(`permission_mode`,e),children:[(0,L.jsx)(h,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,L.jsx)(_,{})}),(0,L.jsx)(p,{children:se.map(e=>(0,L.jsx)(d,{value:e.value,children:e.label},e.value))})]})]}),(0,L.jsxs)(`div`,{className:$,children:[(0,L.jsx)(f,{htmlFor:`ai-system-prompt`,className:e?Z:void 0,children:`Additional Instructions`}),(0,L.jsx)(`textarea`,{id:`ai-system-prompt`,rows:e?3:4,defaultValue:K?.system_prompt??``,placeholder:`Enter additional instructions for ${r}...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{X(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${r}-${k}`)]})]}),T&&(0,L.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),D&&(0,L.jsx)(`p`,{className:`text-xs text-error`,children:D})]})}function ce({compact:e}){let[t,n]=(0,I.useState)([]),[i,o]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null),u=(0,I.useCallback)(async()=>{o(!0);try{n(await s.get(`/api/teams`)??[])}catch{}o(!1)},[]);(0,I.useEffect)(()=>{u()},[u]);let d=async e=>{try{await s.del(`/api/teams/${encodeURIComponent(e)}`),n(t=>t.filter(t=>t.name!==e)),l(null)}catch{}};return t.length===0&&!i?null:(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(f,{className:e?`text-[11px]`:void 0,children:[`Teams (`,t.length,`)`]}),(0,L.jsx)(`button`,{onClick:u,className:`text-text-subtle hover:text-foreground p-1`,"aria-label":`Refresh teams`,children:(0,L.jsx)(a,{className:`size-3 ${i?`animate-spin`:``}`})})]}),t.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between p-2 rounded bg-surface-elevated text-xs`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.description&&(0,L.jsx)(`div`,{className:`text-text-subtle truncate`,children:e.description}),(0,L.jsxs)(`div`,{className:`text-text-subtle`,children:[e.members?.length??e.memberCount??0,` members`,e.createdAt?` · ${new Date(e.createdAt).toLocaleDateString()}`:``]})]}),c===e.name?(0,L.jsxs)(`div`,{className:`flex gap-1 shrink-0 ml-2`,children:[(0,L.jsx)(`button`,{onClick:()=>d(e.name),className:`px-2 py-1 bg-error text-white rounded text-[10px]`,children:`Delete`}),(0,L.jsx)(`button`,{onClick:()=>l(null),className:`px-2 py-1 bg-panel-2 text-text rounded text-[10px]`,children:`Cancel`})]}):(0,L.jsx)(`button`,{onClick:()=>l(e.name),className:`shrink-0 text-text-subtle hover:text-error p-1 ml-2`,"aria-label":`Delete team ${e.name}`,children:(0,L.jsx)(r,{className:`size-3.5`})})]},e.name))]})}export{F as a,y as c,k as i,O as n,N as o,A as r,M as s,H as t};
|
|
Binary file
|
|
Binary file
|