@hienlh/ppm 0.23.5 → 0.23.6

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.
Files changed (305) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/cli-reference.md +4 -4
  4. package/assets/skills/ppm/references/http-api.md +2 -1
  5. package/dist/web/assets/accounts-settings-section-DUVO32SQ.js +1 -0
  6. package/dist/web/assets/accounts-settings-section-DUVO32SQ.js.br +0 -0
  7. package/dist/web/assets/accounts-settings-section-DUVO32SQ.js.gz +0 -0
  8. package/dist/web/assets/{ai-resource-editor-DKcsVDle.js → ai-resource-editor-Dn_wB-o5.js} +1 -1
  9. package/dist/web/assets/ai-resource-editor-Dn_wB-o5.js.br +0 -0
  10. package/dist/web/assets/ai-resource-editor-Dn_wB-o5.js.gz +0 -0
  11. package/dist/web/assets/{ai-settings-section-D7zJ-hCO.js → ai-settings-section-CEbW8jRy.js} +1 -1
  12. package/dist/web/assets/ai-settings-section-CEbW8jRy.js.br +0 -0
  13. package/dist/web/assets/ai-settings-section-CEbW8jRy.js.gz +0 -0
  14. package/dist/web/assets/{ai-settings-section-OPqC2bYG.js → ai-settings-section-D-mwEYFZ.js} +1 -1
  15. package/dist/web/assets/{appearance-settings-section-DL466x83.js → appearance-settings-section-tw6TpFb6.js} +1 -1
  16. package/dist/web/assets/appearance-settings-section-tw6TpFb6.js.br +0 -0
  17. package/dist/web/assets/appearance-settings-section-tw6TpFb6.js.gz +0 -0
  18. package/dist/web/assets/{branch-review-tab-Dag86n_R.js → branch-review-tab-MBuMWp_i.js} +1 -1
  19. package/dist/web/assets/branch-review-tab-MBuMWp_i.js.br +0 -0
  20. package/dist/web/assets/branch-review-tab-MBuMWp_i.js.gz +0 -0
  21. package/dist/web/assets/{chat-tab-QFDhzzBZ.js → chat-tab-DVvnqhw6.js} +1 -1
  22. package/dist/web/assets/chat-tab-DVvnqhw6.js.br +0 -0
  23. package/dist/web/assets/chat-tab-DVvnqhw6.js.gz +0 -0
  24. package/dist/web/assets/chat-tab-DaEHva22.js +15 -0
  25. package/dist/web/assets/chat-tab-DaEHva22.js.br +0 -0
  26. package/dist/web/assets/chat-tab-DaEHva22.js.gz +0 -0
  27. package/dist/web/assets/{code-editor-K-IN8VwJ.js → code-editor-Bu9lhTVp.js} +3 -3
  28. package/dist/web/assets/code-editor-Bu9lhTVp.js.br +0 -0
  29. package/dist/web/assets/code-editor-Bu9lhTVp.js.gz +0 -0
  30. package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js +1 -0
  31. package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js.br +0 -0
  32. package/dist/web/assets/codex-reset-credit-button-CbmE5mRX.js.gz +0 -0
  33. package/dist/web/assets/{conflict-editor-qMGJH0Bx.js → conflict-editor-BA3y-qSH.js} +1 -1
  34. package/dist/web/assets/conflict-editor-BA3y-qSH.js.br +0 -0
  35. package/dist/web/assets/conflict-editor-BA3y-qSH.js.gz +0 -0
  36. package/dist/web/assets/{csv-preview-D2I742dl.js → csv-preview-BioxkrQF.js} +1 -1
  37. package/dist/web/assets/csv-preview-BioxkrQF.js.br +0 -0
  38. package/dist/web/assets/csv-preview-BioxkrQF.js.gz +0 -0
  39. package/dist/web/assets/{database-viewer-Bz4LjgIa.js → database-viewer-BSoJ0E6p.js} +1 -1
  40. package/dist/web/assets/database-viewer-BSoJ0E6p.js.br +0 -0
  41. package/dist/web/assets/database-viewer-BSoJ0E6p.js.gz +0 -0
  42. package/dist/web/assets/{design-tab-C987MtMR.js → design-tab-iU2CviE3.js} +1 -1
  43. package/dist/web/assets/design-tab-iU2CviE3.js.br +0 -0
  44. package/dist/web/assets/design-tab-iU2CviE3.js.gz +0 -0
  45. package/dist/web/assets/{designs-sidebar-panel-CapP1yXq.js → designs-sidebar-panel-DHh5QsH9.js} +1 -1
  46. package/dist/web/assets/designs-sidebar-panel-DHh5QsH9.js.br +0 -0
  47. package/dist/web/assets/designs-sidebar-panel-DHh5QsH9.js.gz +0 -0
  48. package/dist/web/assets/{diff-viewer-CdXi7cZN.js → diff-viewer-lctWoSmG.js} +1 -1
  49. package/dist/web/assets/diff-viewer-lctWoSmG.js.br +0 -0
  50. package/dist/web/assets/diff-viewer-lctWoSmG.js.gz +0 -0
  51. package/dist/web/assets/{editor-language-service-Zle_PZV8.js → editor-language-service-fPG56hQO.js} +1 -1
  52. package/dist/web/assets/editor-language-service-fPG56hQO.js.br +0 -0
  53. package/dist/web/assets/editor-language-service-fPG56hQO.js.gz +0 -0
  54. package/dist/web/assets/{explorer-body-DHMQR1Rk.js → explorer-body-BgF7FsxI.js} +1 -1
  55. package/dist/web/assets/explorer-body-BgF7FsxI.js.br +0 -0
  56. package/dist/web/assets/explorer-body-BgF7FsxI.js.gz +0 -0
  57. package/dist/web/assets/{explorer-window-content-Df40nQBk.js → explorer-window-content-C21w_7lf.js} +1 -1
  58. package/dist/web/assets/explorer-window-content-C21w_7lf.js.br +0 -0
  59. package/dist/web/assets/explorer-window-content-C21w_7lf.js.gz +0 -0
  60. package/dist/web/assets/{extension-manager-section-B2nZzJ2b.js → extension-manager-section-rbkXsZVR.js} +1 -1
  61. package/dist/web/assets/extension-manager-section-rbkXsZVR.js.br +0 -0
  62. package/dist/web/assets/extension-manager-section-rbkXsZVR.js.gz +0 -0
  63. package/dist/web/assets/{extension-webview-BGoDxkdF.js → extension-webview-uPO0WgCq.js} +1 -1
  64. package/dist/web/assets/extension-webview-uPO0WgCq.js.br +0 -0
  65. package/dist/web/assets/extension-webview-uPO0WgCq.js.gz +0 -0
  66. package/dist/web/assets/{files-settings-section-DC3OzzOl.js → files-settings-section-CT7mDb0L.js} +1 -1
  67. package/dist/web/assets/files-settings-section-CT7mDb0L.js.br +0 -0
  68. package/dist/web/assets/files-settings-section-CT7mDb0L.js.gz +0 -0
  69. package/dist/web/assets/{general-settings-section-i41W43ER.js → general-settings-section-DANPfMRN.js} +1 -1
  70. package/dist/web/assets/general-settings-section-DANPfMRN.js.br +0 -0
  71. package/dist/web/assets/general-settings-section-DANPfMRN.js.gz +0 -0
  72. package/dist/web/assets/{git-log-panel-DHzPIkJg.js → git-log-panel-BJPkLiEw.js} +1 -1
  73. package/dist/web/assets/git-log-panel-BJPkLiEw.js.br +0 -0
  74. package/dist/web/assets/git-log-panel-BJPkLiEw.js.gz +0 -0
  75. package/dist/web/assets/{glide-data-grid-Dj4vrDvj.js → glide-data-grid-R4PcAntf.js} +1 -1
  76. package/dist/web/assets/glide-data-grid-R4PcAntf.js.br +0 -0
  77. package/dist/web/assets/glide-data-grid-R4PcAntf.js.gz +0 -0
  78. package/dist/web/assets/{group-chat-tab-DfwZb-fI.js → group-chat-tab-BXMdo8w9.js} +1 -1
  79. package/dist/web/assets/group-chat-tab-BXMdo8w9.js.br +0 -0
  80. package/dist/web/assets/group-chat-tab-BXMdo8w9.js.gz +0 -0
  81. package/dist/web/assets/{index-jG9mLs-J.js → index-C8nGqkKN.js} +5 -5
  82. package/dist/web/assets/index-C8nGqkKN.js.br +0 -0
  83. package/dist/web/assets/index-C8nGqkKN.js.gz +0 -0
  84. package/dist/web/assets/{index-DMA-So69.css → index-DvClbTQx.css} +1 -1
  85. package/dist/web/assets/index-DvClbTQx.css.br +0 -0
  86. package/dist/web/assets/{index-DMA-So69.css.gz → index-DvClbTQx.css.gz} +0 -0
  87. package/dist/web/assets/{jira-watcher-section-BJ9edGEP.js → jira-watcher-section-DHRoyWcG.js} +1 -1
  88. package/dist/web/assets/{keybindings-store-BlapkC6O.js → keybindings-store-BGKlQQAv.js} +1 -1
  89. package/dist/web/assets/{keyboard-shortcuts-section-CxdGSNGr.js → keyboard-shortcuts-section-BKej4mUf.js} +1 -1
  90. package/dist/web/assets/keyboard-shortcuts-section-BKej4mUf.js.br +0 -0
  91. package/dist/web/assets/keyboard-shortcuts-section-BKej4mUf.js.gz +0 -0
  92. package/dist/web/assets/{markdown-renderer-ok96IgnS.js → markdown-renderer-BHtYqkYZ.js} +1 -1
  93. package/dist/web/assets/markdown-renderer-BHtYqkYZ.js.br +0 -0
  94. package/dist/web/assets/markdown-renderer-BHtYqkYZ.js.gz +0 -0
  95. package/dist/web/assets/{markdown-renderer-DJ9EVU1B.js → markdown-renderer-vDNuKjel.js} +1 -1
  96. package/dist/web/assets/{mobile-explorer-sheet-Cc03LUKy.js → mobile-explorer-sheet-DtvxS7-r.js} +1 -1
  97. package/dist/web/assets/mobile-explorer-sheet-DtvxS7-r.js.br +0 -0
  98. package/dist/web/assets/mobile-explorer-sheet-DtvxS7-r.js.gz +0 -0
  99. package/dist/web/assets/{new-design-dialog-Drkjb_LI.js → new-design-dialog-DS_XrpTG.js} +1 -1
  100. package/dist/web/assets/new-design-dialog-DS_XrpTG.js.br +0 -0
  101. package/dist/web/assets/new-design-dialog-DS_XrpTG.js.gz +0 -0
  102. package/dist/web/assets/{notification-store-DCyxho0O.js → notification-store-Dnnj20Ky.js} +1 -1
  103. package/dist/web/assets/{ppmbot-settings-section-C8PFlvaq.js → ppmbot-settings-section-D8AES1BA.js} +1 -1
  104. package/dist/web/assets/ppmbot-settings-section-D8AES1BA.js.br +0 -0
  105. package/dist/web/assets/ppmbot-settings-section-D8AES1BA.js.gz +0 -0
  106. package/dist/web/assets/{problems-panel-CFYO0Ro3.js → problems-panel-DTBG4beI.js} +1 -1
  107. package/dist/web/assets/problems-panel-DTBG4beI.js.br +0 -0
  108. package/dist/web/assets/problems-panel-DTBG4beI.js.gz +0 -0
  109. package/dist/web/assets/{process-table-BVeRguFg.js → process-table-D_gR2XA6.js} +1 -1
  110. package/dist/web/assets/process-table-D_gR2XA6.js.br +0 -0
  111. package/dist/web/assets/process-table-D_gR2XA6.js.gz +0 -0
  112. package/dist/web/assets/{proxy-settings-section-BcHIEANE.js → proxy-settings-section-CqtmbeRj.js} +1 -1
  113. package/dist/web/assets/proxy-settings-section-CqtmbeRj.js.br +0 -0
  114. package/dist/web/assets/proxy-settings-section-CqtmbeRj.js.gz +0 -0
  115. package/dist/web/assets/{remote-desktop-clipboard-notice-BGsp0edA.js → remote-desktop-clipboard-notice-Djt6cpNL.js} +1 -1
  116. package/dist/web/assets/remote-desktop-clipboard-notice-Djt6cpNL.js.br +0 -0
  117. package/dist/web/assets/remote-desktop-clipboard-notice-Djt6cpNL.js.gz +0 -0
  118. package/dist/web/assets/{remote-desktop-mobile-sheet-DxkmF8qb.js → remote-desktop-mobile-sheet-BQxhJUkm.js} +2 -2
  119. package/dist/web/assets/remote-desktop-mobile-sheet-BQxhJUkm.js.br +0 -0
  120. package/dist/web/assets/remote-desktop-mobile-sheet-BQxhJUkm.js.gz +0 -0
  121. package/dist/web/assets/{remote-desktop-mobile-view-DMD0M9Jh.js → remote-desktop-mobile-view-DGnT8RY7.js} +1 -1
  122. package/dist/web/assets/remote-desktop-mobile-view-DGnT8RY7.js.br +0 -0
  123. package/dist/web/assets/remote-desktop-mobile-view-DGnT8RY7.js.gz +0 -0
  124. package/dist/web/assets/{remote-desktop-readiness-gate-CsZCCRJI.js → remote-desktop-readiness-gate-DNJF8TcF.js} +1 -1
  125. package/dist/web/assets/remote-desktop-readiness-gate-DNJF8TcF.js.br +0 -0
  126. package/dist/web/assets/remote-desktop-readiness-gate-DNJF8TcF.js.gz +0 -0
  127. package/dist/web/assets/{remote-desktop-window-content-DrHw_vwY.js → remote-desktop-window-content-Ds0DKmM0.js} +1 -1
  128. package/dist/web/assets/remote-desktop-window-content-Ds0DKmM0.js.br +0 -0
  129. package/dist/web/assets/remote-desktop-window-content-Ds0DKmM0.js.gz +0 -0
  130. package/dist/web/assets/{schedules-settings-section-Ci0O2Ng6.js → schedules-settings-section-BKoPovy2.js} +1 -1
  131. package/dist/web/assets/schedules-settings-section-BKoPovy2.js.br +0 -0
  132. package/dist/web/assets/schedules-settings-section-BKoPovy2.js.gz +0 -0
  133. package/dist/web/assets/{settings-body-B6JGOIYb.js → settings-body-k2qPgRFe.js} +2 -2
  134. package/dist/web/assets/settings-body-k2qPgRFe.js.br +0 -0
  135. package/dist/web/assets/settings-body-k2qPgRFe.js.gz +0 -0
  136. package/dist/web/assets/{settings-tab-CIQM4fNE.js → settings-tab-Bb23VdBu.js} +1 -1
  137. package/dist/web/assets/{settings-window-content-BGNNz-E5.js → settings-window-content-ClarWusz.js} +1 -1
  138. package/dist/web/assets/{sql-query-editor-4iCGE4h2.js → sql-query-editor-BjIMi9Wk.js} +1 -1
  139. package/dist/web/assets/sql-query-editor-BjIMi9Wk.js.br +0 -0
  140. package/dist/web/assets/sql-query-editor-BjIMi9Wk.js.gz +0 -0
  141. package/dist/web/assets/{sqlite-viewer-CK6DulYk.js → sqlite-viewer-BNcA6Irq.js} +1 -1
  142. package/dist/web/assets/sqlite-viewer-BNcA6Irq.js.br +0 -0
  143. package/dist/web/assets/sqlite-viewer-BNcA6Irq.js.gz +0 -0
  144. package/dist/web/assets/{system-monitor-body-J9JtvAWV.js → system-monitor-body-D0T3ggt2.js} +2 -2
  145. package/dist/web/assets/system-monitor-body-D0T3ggt2.js.br +0 -0
  146. package/dist/web/assets/system-monitor-body-D0T3ggt2.js.gz +0 -0
  147. package/dist/web/assets/{system-monitor-tab-DjBeRE81.js → system-monitor-tab-I1Igmoey.js} +1 -1
  148. package/dist/web/assets/{system-monitor-window-content-BT7-ugFx.js → system-monitor-window-content-C5SeUv1H.js} +1 -1
  149. package/dist/web/assets/{tab-host-window-content-CWBaWKjA.js → tab-host-window-content-CIRGNCvi.js} +1 -1
  150. package/dist/web/assets/tab-host-window-content-CIRGNCvi.js.br +0 -0
  151. package/dist/web/assets/tab-host-window-content-CIRGNCvi.js.gz +0 -0
  152. package/dist/web/assets/{team-member-sheet-Br6mrxrw.js → team-member-sheet-CwXpLi3X.js} +2 -2
  153. package/dist/web/assets/team-member-sheet-CwXpLi3X.js.br +0 -0
  154. package/dist/web/assets/team-member-sheet-CwXpLi3X.js.gz +0 -0
  155. package/dist/web/assets/{team-member-window-content-CwCy7ZWf.js → team-member-window-content-4swiiDz7.js} +1 -1
  156. package/dist/web/assets/team-member-window-content-4swiiDz7.js.br +0 -0
  157. package/dist/web/assets/team-member-window-content-4swiiDz7.js.gz +0 -0
  158. package/dist/web/assets/{terminal-tab-BW14RpCb.js → terminal-tab-BGcdtMMT.js} +1 -1
  159. package/dist/web/assets/terminal-tab-BGcdtMMT.js.br +0 -0
  160. package/dist/web/assets/terminal-tab-BGcdtMMT.js.gz +0 -0
  161. package/dist/web/assets/{tool-cards-CgOBEUnb.js → tool-cards-D0-krtA2.js} +2 -2
  162. package/dist/web/assets/tool-cards-D0-krtA2.js.br +0 -0
  163. package/dist/web/assets/tool-cards-D0-krtA2.js.gz +0 -0
  164. package/dist/web/assets/{use-inline-blame-Bzjfru4n.js → use-inline-blame-pKaXyGU-.js} +1 -1
  165. package/dist/web/assets/use-inline-blame-pKaXyGU-.js.br +0 -0
  166. package/dist/web/assets/use-inline-blame-pKaXyGU-.js.gz +0 -0
  167. package/dist/web/assets/{use-lsp-hGdjL2hV.js → use-lsp-71azTXQz.js} +1 -1
  168. package/dist/web/assets/use-lsp-71azTXQz.js.br +0 -0
  169. package/dist/web/assets/use-lsp-71azTXQz.js.gz +0 -0
  170. package/dist/web/assets/{use-monaco-theme-rH6epJYA.js → use-monaco-theme-C88KphGx.js} +1 -1
  171. package/dist/web/assets/{use-websocket-QwURkjpV.js → use-websocket-Chk9guIU.js} +1 -1
  172. package/dist/web/assets/{video-preview-P9T-ZVdN.js → video-preview-DxEX-uGo.js} +1 -1
  173. package/dist/web/assets/video-preview-DxEX-uGo.js.br +0 -0
  174. package/dist/web/assets/video-preview-DxEX-uGo.js.gz +0 -0
  175. package/dist/web/index.html +2 -2
  176. package/dist/web/index.html.br +0 -0
  177. package/dist/web/index.html.gz +0 -0
  178. package/dist/web/sw.js +1 -1
  179. package/dist/web/sw.js.br +0 -0
  180. package/dist/web/sw.js.gz +0 -0
  181. package/package.json +1 -1
  182. package/src/providers/codex-app-server/codex-reset-credit.ts +49 -0
  183. package/src/server/routes/codex-accounts.ts +14 -0
  184. package/src/services/codex-reset-credit.service.ts +70 -0
  185. package/src/services/edge-forwarder.ts +191 -191
  186. package/src/services/windows-process-tree.ts +351 -351
  187. package/src/shared/usage-extra.ts +19 -0
  188. package/src/types/chat.ts +2 -0
  189. package/src/web/components/chat/codex-usage-panel.tsx +4 -0
  190. package/src/web/components/settings/accounts/account-card.tsx +5 -1
  191. package/src/web/components/settings/accounts/account-usage-extras.tsx +3 -2
  192. package/src/web/components/settings/accounts/codex-accounts-section.tsx +3 -1
  193. package/src/web/components/settings/accounts/codex-reset-credit-button.tsx +120 -0
  194. package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js +0 -1
  195. package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js.br +0 -0
  196. package/dist/web/assets/accounts-settings-section-CgG5P3Jm.js.gz +0 -0
  197. package/dist/web/assets/ai-resource-editor-DKcsVDle.js.br +0 -0
  198. package/dist/web/assets/ai-resource-editor-DKcsVDle.js.gz +0 -0
  199. package/dist/web/assets/ai-settings-section-D7zJ-hCO.js.br +0 -0
  200. package/dist/web/assets/ai-settings-section-D7zJ-hCO.js.gz +0 -0
  201. package/dist/web/assets/appearance-settings-section-DL466x83.js.br +0 -0
  202. package/dist/web/assets/appearance-settings-section-DL466x83.js.gz +0 -0
  203. package/dist/web/assets/branch-review-tab-Dag86n_R.js.br +0 -0
  204. package/dist/web/assets/branch-review-tab-Dag86n_R.js.gz +0 -0
  205. package/dist/web/assets/chat-tab-CcYZLXls.js +0 -15
  206. package/dist/web/assets/chat-tab-CcYZLXls.js.br +0 -0
  207. package/dist/web/assets/chat-tab-CcYZLXls.js.gz +0 -0
  208. package/dist/web/assets/chat-tab-QFDhzzBZ.js.br +0 -0
  209. package/dist/web/assets/chat-tab-QFDhzzBZ.js.gz +0 -0
  210. package/dist/web/assets/code-editor-K-IN8VwJ.js.br +0 -0
  211. package/dist/web/assets/code-editor-K-IN8VwJ.js.gz +0 -0
  212. package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js +0 -1
  213. package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js.br +0 -0
  214. package/dist/web/assets/codex-sign-in-again-dialog-C8JvblLG.js.gz +0 -0
  215. package/dist/web/assets/conflict-editor-qMGJH0Bx.js.br +0 -0
  216. package/dist/web/assets/conflict-editor-qMGJH0Bx.js.gz +0 -0
  217. package/dist/web/assets/csv-preview-D2I742dl.js.br +0 -0
  218. package/dist/web/assets/csv-preview-D2I742dl.js.gz +0 -0
  219. package/dist/web/assets/database-viewer-Bz4LjgIa.js.br +0 -0
  220. package/dist/web/assets/database-viewer-Bz4LjgIa.js.gz +0 -0
  221. package/dist/web/assets/design-tab-C987MtMR.js.br +0 -0
  222. package/dist/web/assets/design-tab-C987MtMR.js.gz +0 -0
  223. package/dist/web/assets/designs-sidebar-panel-CapP1yXq.js.br +0 -0
  224. package/dist/web/assets/designs-sidebar-panel-CapP1yXq.js.gz +0 -0
  225. package/dist/web/assets/diff-viewer-CdXi7cZN.js.br +0 -0
  226. package/dist/web/assets/diff-viewer-CdXi7cZN.js.gz +0 -0
  227. package/dist/web/assets/editor-language-service-Zle_PZV8.js.br +0 -0
  228. package/dist/web/assets/editor-language-service-Zle_PZV8.js.gz +0 -0
  229. package/dist/web/assets/explorer-body-DHMQR1Rk.js.br +0 -0
  230. package/dist/web/assets/explorer-body-DHMQR1Rk.js.gz +0 -0
  231. package/dist/web/assets/explorer-window-content-Df40nQBk.js.br +0 -0
  232. package/dist/web/assets/explorer-window-content-Df40nQBk.js.gz +0 -0
  233. package/dist/web/assets/extension-manager-section-B2nZzJ2b.js.br +0 -0
  234. package/dist/web/assets/extension-manager-section-B2nZzJ2b.js.gz +0 -0
  235. package/dist/web/assets/extension-webview-BGoDxkdF.js.br +0 -0
  236. package/dist/web/assets/extension-webview-BGoDxkdF.js.gz +0 -0
  237. package/dist/web/assets/files-settings-section-DC3OzzOl.js.br +0 -0
  238. package/dist/web/assets/files-settings-section-DC3OzzOl.js.gz +0 -0
  239. package/dist/web/assets/general-settings-section-i41W43ER.js.br +0 -0
  240. package/dist/web/assets/general-settings-section-i41W43ER.js.gz +0 -0
  241. package/dist/web/assets/git-log-panel-DHzPIkJg.js.br +0 -0
  242. package/dist/web/assets/git-log-panel-DHzPIkJg.js.gz +0 -0
  243. package/dist/web/assets/glide-data-grid-Dj4vrDvj.js.br +0 -0
  244. package/dist/web/assets/glide-data-grid-Dj4vrDvj.js.gz +0 -0
  245. package/dist/web/assets/group-chat-tab-DfwZb-fI.js.br +0 -0
  246. package/dist/web/assets/group-chat-tab-DfwZb-fI.js.gz +0 -0
  247. package/dist/web/assets/index-DMA-So69.css.br +0 -0
  248. package/dist/web/assets/index-jG9mLs-J.js.br +0 -0
  249. package/dist/web/assets/index-jG9mLs-J.js.gz +0 -0
  250. package/dist/web/assets/keyboard-shortcuts-section-CxdGSNGr.js.br +0 -0
  251. package/dist/web/assets/keyboard-shortcuts-section-CxdGSNGr.js.gz +0 -0
  252. package/dist/web/assets/markdown-renderer-ok96IgnS.js.br +0 -0
  253. package/dist/web/assets/markdown-renderer-ok96IgnS.js.gz +0 -0
  254. package/dist/web/assets/mobile-explorer-sheet-Cc03LUKy.js.br +0 -0
  255. package/dist/web/assets/mobile-explorer-sheet-Cc03LUKy.js.gz +0 -0
  256. package/dist/web/assets/new-design-dialog-Drkjb_LI.js.br +0 -0
  257. package/dist/web/assets/new-design-dialog-Drkjb_LI.js.gz +0 -0
  258. package/dist/web/assets/ppmbot-settings-section-C8PFlvaq.js.br +0 -0
  259. package/dist/web/assets/ppmbot-settings-section-C8PFlvaq.js.gz +0 -0
  260. package/dist/web/assets/problems-panel-CFYO0Ro3.js.br +0 -0
  261. package/dist/web/assets/problems-panel-CFYO0Ro3.js.gz +0 -0
  262. package/dist/web/assets/process-table-BVeRguFg.js.br +0 -0
  263. package/dist/web/assets/process-table-BVeRguFg.js.gz +0 -0
  264. package/dist/web/assets/proxy-settings-section-BcHIEANE.js.br +0 -0
  265. package/dist/web/assets/proxy-settings-section-BcHIEANE.js.gz +0 -0
  266. package/dist/web/assets/remote-desktop-clipboard-notice-BGsp0edA.js.br +0 -0
  267. package/dist/web/assets/remote-desktop-clipboard-notice-BGsp0edA.js.gz +0 -0
  268. package/dist/web/assets/remote-desktop-mobile-sheet-DxkmF8qb.js.br +0 -0
  269. package/dist/web/assets/remote-desktop-mobile-sheet-DxkmF8qb.js.gz +0 -0
  270. package/dist/web/assets/remote-desktop-mobile-view-DMD0M9Jh.js.br +0 -0
  271. package/dist/web/assets/remote-desktop-mobile-view-DMD0M9Jh.js.gz +0 -0
  272. package/dist/web/assets/remote-desktop-readiness-gate-CsZCCRJI.js.br +0 -0
  273. package/dist/web/assets/remote-desktop-readiness-gate-CsZCCRJI.js.gz +0 -0
  274. package/dist/web/assets/remote-desktop-window-content-DrHw_vwY.js.br +0 -0
  275. package/dist/web/assets/remote-desktop-window-content-DrHw_vwY.js.gz +0 -0
  276. package/dist/web/assets/schedules-settings-section-Ci0O2Ng6.js.br +0 -0
  277. package/dist/web/assets/schedules-settings-section-Ci0O2Ng6.js.gz +0 -0
  278. package/dist/web/assets/settings-body-B6JGOIYb.js.br +0 -0
  279. package/dist/web/assets/settings-body-B6JGOIYb.js.gz +0 -0
  280. package/dist/web/assets/sql-query-editor-4iCGE4h2.js.br +0 -3
  281. package/dist/web/assets/sql-query-editor-4iCGE4h2.js.gz +0 -0
  282. package/dist/web/assets/sqlite-viewer-CK6DulYk.js.br +0 -0
  283. package/dist/web/assets/sqlite-viewer-CK6DulYk.js.gz +0 -0
  284. package/dist/web/assets/system-monitor-body-J9JtvAWV.js.br +0 -0
  285. package/dist/web/assets/system-monitor-body-J9JtvAWV.js.gz +0 -0
  286. package/dist/web/assets/tab-host-window-content-CWBaWKjA.js.br +0 -0
  287. package/dist/web/assets/tab-host-window-content-CWBaWKjA.js.gz +0 -0
  288. package/dist/web/assets/team-member-sheet-Br6mrxrw.js.br +0 -0
  289. package/dist/web/assets/team-member-sheet-Br6mrxrw.js.gz +0 -0
  290. package/dist/web/assets/team-member-window-content-CwCy7ZWf.js.br +0 -0
  291. package/dist/web/assets/team-member-window-content-CwCy7ZWf.js.gz +0 -0
  292. package/dist/web/assets/terminal-tab-BW14RpCb.js.br +0 -0
  293. package/dist/web/assets/terminal-tab-BW14RpCb.js.gz +0 -0
  294. package/dist/web/assets/tool-cards-CgOBEUnb.js.br +0 -0
  295. package/dist/web/assets/tool-cards-CgOBEUnb.js.gz +0 -0
  296. package/dist/web/assets/use-inline-blame-Bzjfru4n.js.br +0 -0
  297. package/dist/web/assets/use-inline-blame-Bzjfru4n.js.gz +0 -0
  298. package/dist/web/assets/use-lsp-hGdjL2hV.js.br +0 -0
  299. package/dist/web/assets/use-lsp-hGdjL2hV.js.gz +0 -0
  300. package/dist/web/assets/video-preview-P9T-ZVdN.js.br +0 -0
  301. package/dist/web/assets/video-preview-P9T-ZVdN.js.gz +0 -0
  302. package/packages/vscode-compat/node_modules/.bin/tsc.bunx +0 -0
  303. package/packages/vscode-compat/node_modules/.bin/tsc.exe +0 -0
  304. package/packages/vscode-compat/node_modules/.bin/tsserver.bunx +0 -0
  305. package/packages/vscode-compat/node_modules/.bin/tsserver.exe +0 -0
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{En as r,Gt as i,Nt as a,On as o,Tn as s,Zn as c,or as l,pr as u,ut as d,xr as f,z as p}from"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{_ as m,a as h,c as g,d as _,f as v,g as y,i as b,l as x,m as S,n as C,o as w,p as T,r as ee,s as E,t as D,u as te}from"./settings-store-Br5c1efC.js";import{n as ne}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import{t as re}from"./window-store-B4cbZ5rr.js";import{t as ie}from"./button-Ci9EUgqd.js";import{a as ae,i as O,n as k,o as A,r as j,t as M}from"./dialog-B8clVkyi.js";import"./ws-auth-kXgsX2Js.js";import{B as oe,an as N,cn as P,dn as F,fn as I,hn as L,in as se,ln as R,mn as z,on as B,pn as V,sn as H,un as U}from"./index-jG9mLs-J.js";import"./run-in-terminal-HIdNgYim.js";import{n as W,t as G}from"./remote-desktop-readiness-gate-CsZCCRJI.js";import{a as K,c as ce,h as q,i as le,l as ue,m as J,n as de,o as Y,p as fe,r as pe,s as me,t as he,u as X}from"./remote-desktop-clipboard-notice-BGsp0edA.js";var Z=e(t(),1);function ge(e,t,n,r){let i=(0,Z.useCallback)((n,r,i,a)=>{let o=e.current;if(!o)return;let{xFrac:s,yFrac:c}=X(n,r,o.getBoundingClientRect());t({type:`pointer`,xFrac:s,yFrac:c,button:i,down:a})},[e,t]);(0,Z.useEffect)(()=>{let a=e.current;if(!a||!n)return;let o=e=>e===0?`left`:e===2?`right`:null,s=()=>t({type:`releaseAll`}),c=null,l=0,u=()=>{l=0,c&&=(i(c.x,c.y,null,null),null)},d=()=>{l&&=(cancelAnimationFrame(l),0),c&&=(i(c.x,c.y,null,null),null)},f=e=>{e.preventDefault(),a.setPointerCapture(e.pointerId),a.focus(),d(),i(e.clientX,e.clientY,o(e.button),!0)},p=e=>{c={x:e.clientX,y:e.clientY},l||=requestAnimationFrame(u)},m=e=>{d(),i(e.clientX,e.clientY,o(e.button),!1)},h=e=>e.preventDefault(),g=!1,_=e=>{if(r&&q(e)){g=e.shiftKey;return}e.preventDefault(),t({type:`key`,code:e.code,down:!0}),r&&J(e)&&r.onCopyCombo()},v=e=>{r&&q(e)||(e.preventDefault(),t({type:`key`,code:e.code,down:!1}))},y=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`);t&&r?.onPasteText(t,g),g=!1},b=()=>{document.hidden&&s()};return a.tabIndex=0,a.addEventListener(`pointerdown`,f),a.addEventListener(`pointermove`,p),a.addEventListener(`pointerup`,m),a.addEventListener(`contextmenu`,h),a.addEventListener(`keydown`,_),a.addEventListener(`keyup`,v),a.addEventListener(`paste`,y),a.addEventListener(`blur`,s),document.addEventListener(`visibilitychange`,b),()=>{l&&cancelAnimationFrame(l),a.removeEventListener(`pointerdown`,f),a.removeEventListener(`pointermove`,p),a.removeEventListener(`pointerup`,m),a.removeEventListener(`contextmenu`,h),a.removeEventListener(`keydown`,_),a.removeEventListener(`keyup`,v),a.removeEventListener(`blur`,s),document.removeEventListener(`visibilitychange`,b)}},[e,n,i,t,r])}var Q={h264_nvenc:`NVIDIA NVENC`,h264_qsv:`Intel QuickSync`,h264_vaapi:`VAAPI (GPU)`,h264_amf:`AMD AMF`,h264_videotoolbox:`Apple VideoToolbox`,libx264:`Software (x264)`};function _e(e){return Object.hasOwn(Q,e)?Q[e]:e}var $=n(),ve=`flex size-7 shrink-0 items-center justify-center rounded bg-black/40 text-white/70 outline-none hover:bg-black/60 hover:text-white data-[state=open]:bg-black/70 data-[state=open]:text-white`;function ye({displays:e,currentDisplayId:t,onSelectDisplay:n,quality:o,qualityChoice:s,onSetQuality:c,onOpenCustomQuality:l,codecs:h,codec:g,onSetCodec:_,hostModes:v,hostModeId:x,hostOriginalModeId:S,onSetHostMode:C,canResizeHost:w,resolutionError:T,viewStyle:E,customScale:D,onSetViewStyle:te,onSetCustomScale:re,showCursor:ie,onSetShowCursor:ae,audioOn:O,audioReason:k,onSetAudioOn:A,privacyOn:j,privacyReason:M,privacyCanBlank:oe,onSetPrivacyOn:W,recording:G,recordingElapsedSec:K,recordingSupported:q,onToggleRecording:le,onScreenshot:J,clipboardEnabled:de,onSetClipboardEnabled:fe,statsVisible:pe,onToggleStats:he}){let X=(0,Z.useMemo)(()=>ce(v),[v]),ge=(0,Z.useMemo)(()=>me(),[]),Q=(0,Z.useMemo)(()=>Y(v,ge,x),[v,ge,x]),ye=!!(S&&S!==x),Se=t??e.find(e=>e.primary)?.id??e[0]?.id??``;return(0,$.jsxs)(`div`,{className:`absolute right-1 top-1 z-40 flex items-center gap-1`,"data-testid":`remote-desktop-toolbar`,children:[e.length>1&&(0,$.jsxs)(se,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display`,title:`Display`,children:(0,$.jsx)(r,{className:`size-3.5`})}),(0,$.jsxs)(B,{align:`end`,className:`w-64`,children:[(0,$.jsx)(P,{children:`Display`}),(0,$.jsx)(R,{value:Se,onValueChange:n,children:e.map(e=>(0,$.jsxs)(U,{value:e.id,"data-testid":`remote-desktop-display-${e.id}`,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))})]})]}),(0,$.jsxs)(se,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display settings`,title:`Display settings`,"data-testid":`remote-desktop-settings-trigger`,children:(0,$.jsx)(u,{className:`size-3.5`})}),(0,$.jsxs)(B,{align:`end`,className:`w-64`,children:[(0,$.jsx)(P,{children:`Scale`}),(0,$.jsx)(R,{value:E,onValueChange:e=>te(e),children:b.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-view-style-${e}`,children:ee[e]},e))}),E===`custom`&&(0,$.jsx)(xe,{scale:D,onSet:re}),(0,$.jsx)(F,{}),(0,$.jsxs)(I,{children:[(0,$.jsxs)(z,{"data-testid":`remote-desktop-quality-submenu`,children:[`Image quality`,o.held<1&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,"data-testid":`remote-desktop-quality-held`,children:[Math.round(o.held*100),`% — link limited`]})]}),(0,$.jsx)(V,{className:`w-56`,children:(0,$.jsxs)(R,{value:s,onValueChange:e=>e===`custom`?l():c(e),children:[m.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-quality-${e}`,children:y[e].label},e)),(0,$.jsx)(U,{value:`custom`,"data-testid":`remote-desktop-quality-custom`,children:`Custom…`})]})})]}),h.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{"data-testid":`remote-desktop-codec-submenu`,children:`Codec`}),(0,$.jsx)(V,{className:`w-56`,children:(0,$.jsxs)(R,{value:g??`auto`,onValueChange:e=>_(e===`auto`?null:e),children:[(0,$.jsxs)(U,{value:`auto`,children:[`Auto · `,_e(h[0])]}),h.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-codec-${e}`,children:_e(e)},e))]})})]}),w&&X.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{"data-testid":`remote-desktop-resolution-submenu`,children:`Resolution`}),(0,$.jsxs)(V,{className:`max-h-80 w-56 overflow-y-auto`,children:[ye&&S&&(0,$.jsx)(H,{onSelect:()=>C(S),"data-testid":`remote-desktop-resolution-original`,children:`Original`}),Q&&(0,$.jsxs)(H,{onSelect:()=>C(Q.id),"data-testid":`remote-desktop-resolution-fit-local`,children:[`Fit local `,Q.width,`×`,Q.height]}),(ye||Q)&&(0,$.jsx)(F,{}),(0,$.jsx)(R,{value:x??X.find(e=>e.current)?.id??``,onValueChange:C,children:X.map(e=>(0,$.jsxs)(U,{value:e.id,"data-testid":`remote-desktop-resolution-${e.width}x${e.height}`,children:[ue(e),e.preferred&&(0,$.jsx)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:`native`})]},e.id))}),T&&(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] leading-tight text-destructive`,children:T})]})]}),(0,$.jsx)(F,{}),(0,$.jsx)(N,{checked:ie,onCheckedChange:ae,"data-testid":`remote-desktop-show-cursor`,children:`Show remote cursor`}),(0,$.jsx)(N,{checked:de,onCheckedChange:fe,"data-testid":`remote-desktop-clipboard-toggle`,children:`Sync clipboard`}),(0,$.jsx)(N,{checked:O,disabled:k!==null,onCheckedChange:A,"data-testid":`remote-desktop-audio-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Play host audio`}),k&&(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:k})]})}),(0,$.jsx)(F,{}),(0,$.jsx)(N,{checked:j,disabled:M!==null&&!j,onCheckedChange:W,"data-testid":`remote-desktop-privacy-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Privacy mode`}),(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:M??(oe?`Blocks the host's keyboard and mouse, and blanks its screen`:`Blocks the host's keyboard and mouse (its screen stays on)`)})]})}),(0,$.jsx)(F,{}),(0,$.jsxs)(H,{onSelect:J,"data-testid":`remote-desktop-screenshot`,children:[(0,$.jsx)(i,{className:`size-3.5`}),` Save screenshot`]}),q&&(0,$.jsx)(H,{onSelect:le,"data-testid":`remote-desktop-record`,children:G?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`size-3.5 text-red-500`}),` Stop recording · `,be(K)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-3.5`}),` Start recording`]})})]})]}),j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>W(!1),title:`Privacy mode is on — click to release the host`,"aria-label":`Turn privacy mode off`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-amber-500/85 px-1.5 text-[10px] font-medium text-black hover:bg-amber-400`,"data-testid":`remote-desktop-privacy-indicator`,children:[(0,$.jsx)(d,{className:`size-3`}),` Host locked`]}),G&&(0,$.jsxs)(`button`,{type:`button`,onClick:le,title:`Stop recording`,"aria-label":`Stop recording`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-red-600/80 px-1.5 text-[10px] font-medium tabular-nums text-white hover:bg-red-600`,"data-testid":`remote-desktop-recording-indicator`,children:[(0,$.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-white`}),be(K)]}),(0,$.jsx)(`button`,{type:`button`,onClick:he,"aria-label":`Toggle stats overlay`,"aria-pressed":pe,title:`Quality monitor`,className:ne(ve,pe&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,$.jsx)(a,{className:`size-3.5`})})]})}function be(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t>0?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function xe({scale:e,onSet:t}){let[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(null),a=E(Math.round(w(e)*100)),o=n??a,l=g(o);(0,Z.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let u=e=>{r(e),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r(null),t(e/100)},300)},d=e=>t=>{t.preventDefault(),u(E(o+e*1))},f=`flex size-6 shrink-0 items-center justify-center rounded hover:bg-accent disabled:opacity-40`;return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,"data-testid":`remote-desktop-zoom-row`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(-1),disabled:o<=5,"aria-label":`Decrease`,children:(0,$.jsx)(s,{className:`size-3.5`})}),(0,$.jsxs)(`span`,{className:`relative flex-1 py-2.5`,children:[(0,$.jsx)(`input`,{type:`range`,min:0,max:1,step:1/(C-5),value:l,"aria-label":`Scale`,"aria-valuetext":`${o}%`,"data-testid":`remote-desktop-zoom-slider`,onKeyDown:e=>e.stopPropagation(),onChange:e=>u(x(te(Number(e.target.value)))),className:`h-1 w-full cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`pointer-events-none absolute top-0 -translate-x-1/2 rounded bg-primary px-1.5 text-[10px] leading-4 tabular-nums text-primary-foreground`,style:{left:`${l*100}%`},"data-testid":`remote-desktop-zoom-value`,children:[o,`%`]})]}),(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(1),disabled:o>=C,"aria-label":`Increase`,children:(0,$.jsx)(c,{className:`size-3.5`})})]})})}var Se=400;function Ce({open:e,onOpenChange:t,percent:n,fps:r,more:i,onSetMore:a,onCommit:o,frameSize:s}){let[c,l]=(0,Z.useState)(n),[u,d]=(0,Z.useState)(r),f=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{e&&(l(n),d(r))},[e,n,r]),(0,Z.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=i?_:100,m=(e,t)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(e,t),Se)},h=e=>{let t=T(e,i);l(t),m(t,u)},g=e=>{let t=v(e);d(t),m(c,t)},y=e=>{a(e);let t=T(c,e);t!==c&&(l(t),m(t,u))},b=S(c,s.width,s.height);return(0,$.jsx)(M,{open:e,onOpenChange:t,children:(0,$.jsxs)(k,{className:`sm:max-w-md`,"data-testid":`remote-desktop-custom-quality-dialog`,children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(A,{children:`Custom image quality`}),(0,$.jsx)(j,{children:s.width>0?`${c}% of the base rate for ${s.width}×${s.height} — about ${(b/1e3).toFixed(1)} Mbit/s`:`Waiting for the first frame`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:10,max:p,step:1,value:Math.min(c,p),onChange:e=>h(Number(e.target.value)),"aria-label":`Bitrate`,"data-testid":`remote-desktop-custom-bitrate`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:[c,`%`]}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`Bitrate`}),(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>y(e.target.checked),"data-testid":`remote-desktop-custom-more`,className:`size-3.5 accent-primary`}),`More`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:5,max:120,step:1,value:u,onChange:e=>g(Number(e.target.value)),"aria-label":`FPS`,"data-testid":`remote-desktop-custom-fps`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsx)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:u}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`FPS`}),(0,$.jsx)(`span`,{className:`w-[4.25rem] shrink-0`,"aria-hidden":!0})]})]}),(0,$.jsx)(O,{children:(0,$.jsx)(ie,{onClick:()=>t(!1),children:`Close`})})]})})}function we({id:e}){let t=re(e=>e.close),n=(0,Z.useCallback)(()=>t(e),[t,e]);return(0,$.jsx)(W,{onCancel:n,children:(0,$.jsx)(G,{onCancel:n,children:(0,$.jsx)(Te,{})})})}function Te(){let e=(0,Z.useRef)(null),t=de(),{connState:n,errorMessage:r,decoderStatus:i,decoderErrorMessage:a,sendMessage:s,reconnect:c,getFrameCount:u,getTotalBytes:d,frameSize:f,quality:p,setQuality:m,setCustomQuality:g,showCursor:_,setShowCursor:v,codec:y,setCodec:b,audioOn:x,setAudioOn:S,getAudioTracks:C,privacyOn:w,privacyError:T,setPrivacyOn:ee,hostModeId:E,hostOriginalModeId:te,resolutionError:re,setHostMode:ie,pendingHostClipboard:ae,clearHostClipboard:O,sendClipboard:k,requestHostClipboard:A}=fe(e,{displayId:t.displayId}),j=D(e=>e.remoteDesktopStatsVisible),M=D(e=>e.toggleRemoteDesktopStatsVisible),N=D(e=>e.remoteDesktopViewStyle),P=D(e=>e.remoteDesktopCustomScale),F=D(e=>e.setRemoteDesktopViewStyle),I=D(e=>e.setRemoteDesktopCustomScale),L=D(e=>e.remoteDesktopClipboardSync),se=D(e=>e.remoteDesktopQuality),R=D(e=>e.remoteDesktopCustomQualityPercent),z=D(e=>e.remoteDesktopCustomFps),B=D(e=>e.remoteDesktopCustomQualityMore),V=D(e=>e.setRemoteDesktopCustomQualityMore),[H,U]=(0,Z.useState)(!1),W=D(e=>e.setRemoteDesktopClipboardSync),{caps:G}=oe(!1),[ce,q]=(0,Z.useState)(!1),ue=(0,Z.useMemo)(()=>L?{onPasteText:(e,t)=>{q(!0),k(e,!0,t)},onCopyCombo:A}:void 0,[L,k,A]);ge(e,s,n===`streaming`,ue);let J=le(e,C),Y=h(N,P,f),me=i===`unsupported`?a:n===`error`?r:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,$.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,$.jsx)(`div`,{className:ne(`flex h-full w-full`,Y?`overflow-auto`:`overflow-hidden`),children:(0,$.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,"data-view-style":N,className:ne(`m-auto outline-none`,!Y&&`max-h-full max-w-full`),style:Y?{width:Y.width,height:Y.height}:void 0})}),(0,$.jsx)(pe,{canvasRef:e,getFrameCount:u,getTotalBytes:d}),(0,$.jsx)(ye,{displays:t.displays,currentDisplayId:t.current?.id,onSelectDisplay:t.select,quality:p,qualityChoice:se,onSetQuality:m,onOpenCustomQuality:()=>U(!0),codecs:G?.encoders??[],codec:y,onSetCodec:b,hostModes:G?.resolutions?.modes??[],hostModeId:E,hostOriginalModeId:te,onSetHostMode:ie,canResizeHost:G?.inputReady??!1,resolutionError:re,viewStyle:N,customScale:P,onSetViewStyle:F,onSetCustomScale:I,showCursor:_,onSetShowCursor:v,audioOn:x,audioReason:G&&!G.audio.available?G.audio.reason:null,onSetAudioOn:S,privacyOn:w,privacyReason:T??(G&&!G.privacy.available?G.privacy.reason:null),privacyCanBlank:G?.privacy?.canBlank??!1,onSetPrivacyOn:ee,recording:J.recording,recordingElapsedSec:J.elapsedSec,recordingSupported:J.supported,onToggleRecording:J.toggle,onScreenshot:()=>void K(e.current),clipboardEnabled:L,onSetClipboardEnabled:W,statsVisible:j,onToggleStats:M}),(0,$.jsx)(he,{pendingText:ae,onDismiss:O,missingToolAction:ce&&G&&!G.clipboard.available?G.clipboard.action:null,onDismissMissingTool:()=>q(!1)}),(0,$.jsx)(Ce,{open:H,onOpenChange:U,percent:R,fps:z,more:B,onSetMore:V,onCommit:g,frameSize:f}),me&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,$.jsx)(o,{className:`size-6 opacity-70`}),(0,$.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:me}),(n===`error`||n===`closed`)&&i!==`unsupported`&&(0,$.jsxs)(`button`,{onClick:c,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Reconnect`]})]})]})}export{we as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{En as r,Gt as i,Nt as a,On as o,Tn as s,Zn as c,or as l,pr as u,ut as d,xr as f,z as p}from"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{_ as m,a as h,c as g,d as _,f as v,g as y,i as b,l as x,m as S,n as C,o as w,p as T,r as ee,s as E,t as D,u as te}from"./settings-store-Br5c1efC.js";import{n as ne}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-BUQ-CPsd.js";import{t as re}from"./window-store-B4cbZ5rr.js";import{t as ie}from"./button-Ci9EUgqd.js";import{a as ae,i as O,n as k,o as A,r as j,t as M}from"./dialog-B8clVkyi.js";import"./ws-auth-kXgsX2Js.js";import{B as oe,an as N,cn as P,dn as F,fn as I,hn as L,in as se,ln as R,mn as z,on as B,pn as V,sn as H,un as U}from"./index-C8nGqkKN.js";import"./run-in-terminal-HIdNgYim.js";import{n as W,t as G}from"./remote-desktop-readiness-gate-DNJF8TcF.js";import{a as K,c as ce,h as q,i as le,l as ue,m as J,n as de,o as Y,p as fe,r as pe,s as me,t as he,u as X}from"./remote-desktop-clipboard-notice-Djt6cpNL.js";var Z=e(t(),1);function ge(e,t,n,r){let i=(0,Z.useCallback)((n,r,i,a)=>{let o=e.current;if(!o)return;let{xFrac:s,yFrac:c}=X(n,r,o.getBoundingClientRect());t({type:`pointer`,xFrac:s,yFrac:c,button:i,down:a})},[e,t]);(0,Z.useEffect)(()=>{let a=e.current;if(!a||!n)return;let o=e=>e===0?`left`:e===2?`right`:null,s=()=>t({type:`releaseAll`}),c=null,l=0,u=()=>{l=0,c&&=(i(c.x,c.y,null,null),null)},d=()=>{l&&=(cancelAnimationFrame(l),0),c&&=(i(c.x,c.y,null,null),null)},f=e=>{e.preventDefault(),a.setPointerCapture(e.pointerId),a.focus(),d(),i(e.clientX,e.clientY,o(e.button),!0)},p=e=>{c={x:e.clientX,y:e.clientY},l||=requestAnimationFrame(u)},m=e=>{d(),i(e.clientX,e.clientY,o(e.button),!1)},h=e=>e.preventDefault(),g=!1,_=e=>{if(r&&q(e)){g=e.shiftKey;return}e.preventDefault(),t({type:`key`,code:e.code,down:!0}),r&&J(e)&&r.onCopyCombo()},v=e=>{r&&q(e)||(e.preventDefault(),t({type:`key`,code:e.code,down:!1}))},y=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`);t&&r?.onPasteText(t,g),g=!1},b=()=>{document.hidden&&s()};return a.tabIndex=0,a.addEventListener(`pointerdown`,f),a.addEventListener(`pointermove`,p),a.addEventListener(`pointerup`,m),a.addEventListener(`contextmenu`,h),a.addEventListener(`keydown`,_),a.addEventListener(`keyup`,v),a.addEventListener(`paste`,y),a.addEventListener(`blur`,s),document.addEventListener(`visibilitychange`,b),()=>{l&&cancelAnimationFrame(l),a.removeEventListener(`pointerdown`,f),a.removeEventListener(`pointermove`,p),a.removeEventListener(`pointerup`,m),a.removeEventListener(`contextmenu`,h),a.removeEventListener(`keydown`,_),a.removeEventListener(`keyup`,v),a.removeEventListener(`blur`,s),document.removeEventListener(`visibilitychange`,b)}},[e,n,i,t,r])}var Q={h264_nvenc:`NVIDIA NVENC`,h264_qsv:`Intel QuickSync`,h264_vaapi:`VAAPI (GPU)`,h264_amf:`AMD AMF`,h264_videotoolbox:`Apple VideoToolbox`,libx264:`Software (x264)`};function _e(e){return Object.hasOwn(Q,e)?Q[e]:e}var $=n(),ve=`flex size-7 shrink-0 items-center justify-center rounded bg-black/40 text-white/70 outline-none hover:bg-black/60 hover:text-white data-[state=open]:bg-black/70 data-[state=open]:text-white`;function ye({displays:e,currentDisplayId:t,onSelectDisplay:n,quality:o,qualityChoice:s,onSetQuality:c,onOpenCustomQuality:l,codecs:h,codec:g,onSetCodec:_,hostModes:v,hostModeId:x,hostOriginalModeId:S,onSetHostMode:C,canResizeHost:w,resolutionError:T,viewStyle:E,customScale:D,onSetViewStyle:te,onSetCustomScale:re,showCursor:ie,onSetShowCursor:ae,audioOn:O,audioReason:k,onSetAudioOn:A,privacyOn:j,privacyReason:M,privacyCanBlank:oe,onSetPrivacyOn:W,recording:G,recordingElapsedSec:K,recordingSupported:q,onToggleRecording:le,onScreenshot:J,clipboardEnabled:de,onSetClipboardEnabled:fe,statsVisible:pe,onToggleStats:he}){let X=(0,Z.useMemo)(()=>ce(v),[v]),ge=(0,Z.useMemo)(()=>me(),[]),Q=(0,Z.useMemo)(()=>Y(v,ge,x),[v,ge,x]),ye=!!(S&&S!==x),Se=t??e.find(e=>e.primary)?.id??e[0]?.id??``;return(0,$.jsxs)(`div`,{className:`absolute right-1 top-1 z-40 flex items-center gap-1`,"data-testid":`remote-desktop-toolbar`,children:[e.length>1&&(0,$.jsxs)(se,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display`,title:`Display`,children:(0,$.jsx)(r,{className:`size-3.5`})}),(0,$.jsxs)(B,{align:`end`,className:`w-64`,children:[(0,$.jsx)(P,{children:`Display`}),(0,$.jsx)(R,{value:Se,onValueChange:n,children:e.map(e=>(0,$.jsxs)(U,{value:e.id,"data-testid":`remote-desktop-display-${e.id}`,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))})]})]}),(0,$.jsxs)(se,{children:[(0,$.jsx)(L,{className:ve,"aria-label":`Display settings`,title:`Display settings`,"data-testid":`remote-desktop-settings-trigger`,children:(0,$.jsx)(u,{className:`size-3.5`})}),(0,$.jsxs)(B,{align:`end`,className:`w-64`,children:[(0,$.jsx)(P,{children:`Scale`}),(0,$.jsx)(R,{value:E,onValueChange:e=>te(e),children:b.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-view-style-${e}`,children:ee[e]},e))}),E===`custom`&&(0,$.jsx)(xe,{scale:D,onSet:re}),(0,$.jsx)(F,{}),(0,$.jsxs)(I,{children:[(0,$.jsxs)(z,{"data-testid":`remote-desktop-quality-submenu`,children:[`Image quality`,o.held<1&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,"data-testid":`remote-desktop-quality-held`,children:[Math.round(o.held*100),`% — link limited`]})]}),(0,$.jsx)(V,{className:`w-56`,children:(0,$.jsxs)(R,{value:s,onValueChange:e=>e===`custom`?l():c(e),children:[m.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-quality-${e}`,children:y[e].label},e)),(0,$.jsx)(U,{value:`custom`,"data-testid":`remote-desktop-quality-custom`,children:`Custom…`})]})})]}),h.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{"data-testid":`remote-desktop-codec-submenu`,children:`Codec`}),(0,$.jsx)(V,{className:`w-56`,children:(0,$.jsxs)(R,{value:g??`auto`,onValueChange:e=>_(e===`auto`?null:e),children:[(0,$.jsxs)(U,{value:`auto`,children:[`Auto · `,_e(h[0])]}),h.map(e=>(0,$.jsx)(U,{value:e,"data-testid":`remote-desktop-codec-${e}`,children:_e(e)},e))]})})]}),w&&X.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{"data-testid":`remote-desktop-resolution-submenu`,children:`Resolution`}),(0,$.jsxs)(V,{className:`max-h-80 w-56 overflow-y-auto`,children:[ye&&S&&(0,$.jsx)(H,{onSelect:()=>C(S),"data-testid":`remote-desktop-resolution-original`,children:`Original`}),Q&&(0,$.jsxs)(H,{onSelect:()=>C(Q.id),"data-testid":`remote-desktop-resolution-fit-local`,children:[`Fit local `,Q.width,`×`,Q.height]}),(ye||Q)&&(0,$.jsx)(F,{}),(0,$.jsx)(R,{value:x??X.find(e=>e.current)?.id??``,onValueChange:C,children:X.map(e=>(0,$.jsxs)(U,{value:e.id,"data-testid":`remote-desktop-resolution-${e.width}x${e.height}`,children:[ue(e),e.preferred&&(0,$.jsx)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:`native`})]},e.id))}),T&&(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] leading-tight text-destructive`,children:T})]})]}),(0,$.jsx)(F,{}),(0,$.jsx)(N,{checked:ie,onCheckedChange:ae,"data-testid":`remote-desktop-show-cursor`,children:`Show remote cursor`}),(0,$.jsx)(N,{checked:de,onCheckedChange:fe,"data-testid":`remote-desktop-clipboard-toggle`,children:`Sync clipboard`}),(0,$.jsx)(N,{checked:O,disabled:k!==null,onCheckedChange:A,"data-testid":`remote-desktop-audio-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Play host audio`}),k&&(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:k})]})}),(0,$.jsx)(F,{}),(0,$.jsx)(N,{checked:j,disabled:M!==null&&!j,onCheckedChange:W,"data-testid":`remote-desktop-privacy-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Privacy mode`}),(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:M??(oe?`Blocks the host's keyboard and mouse, and blanks its screen`:`Blocks the host's keyboard and mouse (its screen stays on)`)})]})}),(0,$.jsx)(F,{}),(0,$.jsxs)(H,{onSelect:J,"data-testid":`remote-desktop-screenshot`,children:[(0,$.jsx)(i,{className:`size-3.5`}),` Save screenshot`]}),q&&(0,$.jsx)(H,{onSelect:le,"data-testid":`remote-desktop-record`,children:G?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`size-3.5 text-red-500`}),` Stop recording · `,be(K)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-3.5`}),` Start recording`]})})]})]}),j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>W(!1),title:`Privacy mode is on — click to release the host`,"aria-label":`Turn privacy mode off`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-amber-500/85 px-1.5 text-[10px] font-medium text-black hover:bg-amber-400`,"data-testid":`remote-desktop-privacy-indicator`,children:[(0,$.jsx)(d,{className:`size-3`}),` Host locked`]}),G&&(0,$.jsxs)(`button`,{type:`button`,onClick:le,title:`Stop recording`,"aria-label":`Stop recording`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-red-600/80 px-1.5 text-[10px] font-medium tabular-nums text-white hover:bg-red-600`,"data-testid":`remote-desktop-recording-indicator`,children:[(0,$.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-white`}),be(K)]}),(0,$.jsx)(`button`,{type:`button`,onClick:he,"aria-label":`Toggle stats overlay`,"aria-pressed":pe,title:`Quality monitor`,className:ne(ve,pe&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,$.jsx)(a,{className:`size-3.5`})})]})}function be(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t>0?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function xe({scale:e,onSet:t}){let[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(null),a=E(Math.round(w(e)*100)),o=n??a,l=g(o);(0,Z.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let u=e=>{r(e),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r(null),t(e/100)},300)},d=e=>t=>{t.preventDefault(),u(E(o+e*1))},f=`flex size-6 shrink-0 items-center justify-center rounded hover:bg-accent disabled:opacity-40`;return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,"data-testid":`remote-desktop-zoom-row`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(-1),disabled:o<=5,"aria-label":`Decrease`,children:(0,$.jsx)(s,{className:`size-3.5`})}),(0,$.jsxs)(`span`,{className:`relative flex-1 py-2.5`,children:[(0,$.jsx)(`input`,{type:`range`,min:0,max:1,step:1/(C-5),value:l,"aria-label":`Scale`,"aria-valuetext":`${o}%`,"data-testid":`remote-desktop-zoom-slider`,onKeyDown:e=>e.stopPropagation(),onChange:e=>u(x(te(Number(e.target.value)))),className:`h-1 w-full cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`pointer-events-none absolute top-0 -translate-x-1/2 rounded bg-primary px-1.5 text-[10px] leading-4 tabular-nums text-primary-foreground`,style:{left:`${l*100}%`},"data-testid":`remote-desktop-zoom-value`,children:[o,`%`]})]}),(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(1),disabled:o>=C,"aria-label":`Increase`,children:(0,$.jsx)(c,{className:`size-3.5`})})]})})}var Se=400;function Ce({open:e,onOpenChange:t,percent:n,fps:r,more:i,onSetMore:a,onCommit:o,frameSize:s}){let[c,l]=(0,Z.useState)(n),[u,d]=(0,Z.useState)(r),f=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{e&&(l(n),d(r))},[e,n,r]),(0,Z.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=i?_:100,m=(e,t)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(e,t),Se)},h=e=>{let t=T(e,i);l(t),m(t,u)},g=e=>{let t=v(e);d(t),m(c,t)},y=e=>{a(e);let t=T(c,e);t!==c&&(l(t),m(t,u))},b=S(c,s.width,s.height);return(0,$.jsx)(M,{open:e,onOpenChange:t,children:(0,$.jsxs)(k,{className:`sm:max-w-md`,"data-testid":`remote-desktop-custom-quality-dialog`,children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(A,{children:`Custom image quality`}),(0,$.jsx)(j,{children:s.width>0?`${c}% of the base rate for ${s.width}×${s.height} — about ${(b/1e3).toFixed(1)} Mbit/s`:`Waiting for the first frame`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:10,max:p,step:1,value:Math.min(c,p),onChange:e=>h(Number(e.target.value)),"aria-label":`Bitrate`,"data-testid":`remote-desktop-custom-bitrate`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:[c,`%`]}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`Bitrate`}),(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>y(e.target.checked),"data-testid":`remote-desktop-custom-more`,className:`size-3.5 accent-primary`}),`More`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:5,max:120,step:1,value:u,onChange:e=>g(Number(e.target.value)),"aria-label":`FPS`,"data-testid":`remote-desktop-custom-fps`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsx)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:u}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`FPS`}),(0,$.jsx)(`span`,{className:`w-[4.25rem] shrink-0`,"aria-hidden":!0})]})]}),(0,$.jsx)(O,{children:(0,$.jsx)(ie,{onClick:()=>t(!1),children:`Close`})})]})})}function we({id:e}){let t=re(e=>e.close),n=(0,Z.useCallback)(()=>t(e),[t,e]);return(0,$.jsx)(W,{onCancel:n,children:(0,$.jsx)(G,{onCancel:n,children:(0,$.jsx)(Te,{})})})}function Te(){let e=(0,Z.useRef)(null),t=de(),{connState:n,errorMessage:r,decoderStatus:i,decoderErrorMessage:a,sendMessage:s,reconnect:c,getFrameCount:u,getTotalBytes:d,frameSize:f,quality:p,setQuality:m,setCustomQuality:g,showCursor:_,setShowCursor:v,codec:y,setCodec:b,audioOn:x,setAudioOn:S,getAudioTracks:C,privacyOn:w,privacyError:T,setPrivacyOn:ee,hostModeId:E,hostOriginalModeId:te,resolutionError:re,setHostMode:ie,pendingHostClipboard:ae,clearHostClipboard:O,sendClipboard:k,requestHostClipboard:A}=fe(e,{displayId:t.displayId}),j=D(e=>e.remoteDesktopStatsVisible),M=D(e=>e.toggleRemoteDesktopStatsVisible),N=D(e=>e.remoteDesktopViewStyle),P=D(e=>e.remoteDesktopCustomScale),F=D(e=>e.setRemoteDesktopViewStyle),I=D(e=>e.setRemoteDesktopCustomScale),L=D(e=>e.remoteDesktopClipboardSync),se=D(e=>e.remoteDesktopQuality),R=D(e=>e.remoteDesktopCustomQualityPercent),z=D(e=>e.remoteDesktopCustomFps),B=D(e=>e.remoteDesktopCustomQualityMore),V=D(e=>e.setRemoteDesktopCustomQualityMore),[H,U]=(0,Z.useState)(!1),W=D(e=>e.setRemoteDesktopClipboardSync),{caps:G}=oe(!1),[ce,q]=(0,Z.useState)(!1),ue=(0,Z.useMemo)(()=>L?{onPasteText:(e,t)=>{q(!0),k(e,!0,t)},onCopyCombo:A}:void 0,[L,k,A]);ge(e,s,n===`streaming`,ue);let J=le(e,C),Y=h(N,P,f),me=i===`unsupported`?a:n===`error`?r:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,$.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,$.jsx)(`div`,{className:ne(`flex h-full w-full`,Y?`overflow-auto`:`overflow-hidden`),children:(0,$.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,"data-view-style":N,className:ne(`m-auto outline-none`,!Y&&`max-h-full max-w-full`),style:Y?{width:Y.width,height:Y.height}:void 0})}),(0,$.jsx)(pe,{canvasRef:e,getFrameCount:u,getTotalBytes:d}),(0,$.jsx)(ye,{displays:t.displays,currentDisplayId:t.current?.id,onSelectDisplay:t.select,quality:p,qualityChoice:se,onSetQuality:m,onOpenCustomQuality:()=>U(!0),codecs:G?.encoders??[],codec:y,onSetCodec:b,hostModes:G?.resolutions?.modes??[],hostModeId:E,hostOriginalModeId:te,onSetHostMode:ie,canResizeHost:G?.inputReady??!1,resolutionError:re,viewStyle:N,customScale:P,onSetViewStyle:F,onSetCustomScale:I,showCursor:_,onSetShowCursor:v,audioOn:x,audioReason:G&&!G.audio.available?G.audio.reason:null,onSetAudioOn:S,privacyOn:w,privacyReason:T??(G&&!G.privacy.available?G.privacy.reason:null),privacyCanBlank:G?.privacy?.canBlank??!1,onSetPrivacyOn:ee,recording:J.recording,recordingElapsedSec:J.elapsedSec,recordingSupported:J.supported,onToggleRecording:J.toggle,onScreenshot:()=>void K(e.current),clipboardEnabled:L,onSetClipboardEnabled:W,statsVisible:j,onToggleStats:M}),(0,$.jsx)(he,{pendingText:ae,onDismiss:O,missingToolAction:ce&&G&&!G.clipboard.available?G.clipboard.action:null,onDismissMissingTool:()=>q(!1)}),(0,$.jsx)(Ce,{open:H,onOpenChange:U,percent:R,fps:z,more:B,onSetMore:V,onCommit:g,frameSize:f}),me&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,$.jsx)(o,{className:`size-6 opacity-70`}),(0,$.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:me}),(n===`error`||n===`closed`)&&i!==`unsupported`&&(0,$.jsxs)(`button`,{onClick:c,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Reconnect`]})]})]})}export{we as default};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{n as d,s as f}from"./api-client-c8YOpTlT.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CjYTq8DI.js";import{n as m}from"./use-is-mobile-BClDZJP5.js";import{t as h}from"./button-Ci9EUgqd.js";import{a as ee,n as g,o as _,t as v}from"./dialog-B8clVkyi.js";import{t as y}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as b}from"./input-CG8PS8mS.js";import{t as x}from"./scroll-area-XonvWYn_.js";import{Jt as S,Kt as C,Zt as w,ct as T,dt as E,ft as te,lt as D,qt as O,st as k,tn as A,ut as j}from"./index-jG9mLs-J.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await d.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await d.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(A,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(O,{children:[(0,I.jsxs)(S,{onClick:async()=>{try{let t=await d.post(`/api/schedules/${e.id}/run-now`);f.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){f.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(S,{onClick:async()=>{try{await d.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){f.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(S,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(w,{}),(0,I.jsxs)(S,{variant:`destructive`,onClick:async()=>{try{await d.del(`/api/schedules/${e.id}`),f.success(`Schedule deleted`),n()}catch(e){f.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[f,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),d.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let S=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),C=(e,t)=>o(n=>({...n,[e]:t})),w=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(b,{value:a.name,onChange:e=>C(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(b,{value:a.cron_expr,onChange:e=>C(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:S?`Next: ${S.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(k,{value:a.project_path,onValueChange:e=>C(`project_path`,e),children:[(0,I.jsx)(j,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(E,{placeholder:`Select project`})}),(0,I.jsx)(T,{children:s.map(e=>(0,I.jsx)(D,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>C(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(k,{value:a.permission_mode,onValueChange:e=>C(`permission_mode`,e),children:[(0,I.jsx)(j,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(E,{})}),(0,I.jsx)(T,{children:le.map(e=>(0,I.jsx)(D,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(b,{type:`number`,min:1,value:a.max_turns,onChange:e=>C(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(b,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>C(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(te,{checked:a.enabled,onCheckedChange:e=>C(`enabled`,e)})]}),f&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:f}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!S){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await d.patch(`/api/schedules/${t.id}`,e):await d.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(y,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(x,{className:`flex-1 min-h-0 px-3 pb-3`,children:w})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:O})}),w]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{n as d,s as f}from"./api-client-c8YOpTlT.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CjYTq8DI.js";import{n as m}from"./use-is-mobile-BClDZJP5.js";import{t as h}from"./button-Ci9EUgqd.js";import{a as ee,n as g,o as _,t as v}from"./dialog-B8clVkyi.js";import{t as y}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as b}from"./input-CG8PS8mS.js";import{t as x}from"./scroll-area-XonvWYn_.js";import{Jt as S,Kt as C,Zt as w,ct as T,dt as E,ft as te,lt as D,qt as O,st as k,tn as A,ut as j}from"./index-C8nGqkKN.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await d.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await d.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(A,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(O,{children:[(0,I.jsxs)(S,{onClick:async()=>{try{let t=await d.post(`/api/schedules/${e.id}/run-now`);f.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){f.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(S,{onClick:async()=>{try{await d.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){f.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(S,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(w,{}),(0,I.jsxs)(S,{variant:`destructive`,onClick:async()=>{try{await d.del(`/api/schedules/${e.id}`),f.success(`Schedule deleted`),n()}catch(e){f.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[f,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),d.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let S=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),C=(e,t)=>o(n=>({...n,[e]:t})),w=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(b,{value:a.name,onChange:e=>C(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(b,{value:a.cron_expr,onChange:e=>C(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:S?`Next: ${S.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(k,{value:a.project_path,onValueChange:e=>C(`project_path`,e),children:[(0,I.jsx)(j,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(E,{placeholder:`Select project`})}),(0,I.jsx)(T,{children:s.map(e=>(0,I.jsx)(D,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>C(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(k,{value:a.permission_mode,onValueChange:e=>C(`permission_mode`,e),children:[(0,I.jsx)(j,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(E,{})}),(0,I.jsx)(T,{children:le.map(e=>(0,I.jsx)(D,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(b,{type:`number`,min:1,value:a.max_turns,onChange:e=>C(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(b,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>C(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(te,{checked:a.enabled,onCheckedChange:e=>C(`enabled`,e)})]}),f&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:f}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!S){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await d.patch(`/api/schedules/${t.id}`,e):await d.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(y,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:O}),(0,I.jsx)(x,{className:`flex-1 min-h-0 px-3 pb-3`,children:w})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:O})}),w]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-i41W43ER.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-jG9mLs-J.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-BHh12_0v.js","assets/vendor-markdown-QKPNiWEd.js","assets/button-Ci9EUgqd.js","assets/utils-btZ8C8-R.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-c8YOpTlT.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DMA-So69.css","assets/onboarding-entry-CmUqv1kl.js","assets/separator-sQj04Ari.js","assets/appearance-settings-section-DL466x83.js","assets/ai-settings-section-OPqC2bYG.js","assets/ai-settings-section-D7zJ-hCO.js","assets/api-settings-BmvNoCbn.js","assets/accounts-settings-section-CgG5P3Jm.js","assets/codex-sign-in-again-dialog-C8JvblLG.js","assets/ppmbot-settings-section-C8PFlvaq.js","assets/notifications-settings-section-C05WYqcE.js","assets/jira-watcher-section-BJ9edGEP.js","assets/extension-manager-section-B2nZzJ2b.js","assets/proxy-settings-section-BcHIEANE.js","assets/schedules-settings-section-Ci0O2Ng6.js","assets/keyboard-shortcuts-section-CxdGSNGr.js","assets/files-settings-section-DC3OzzOl.js","assets/query-audit-section-UKG_smyt.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{At as r,Ft as i,Ln as a,Qt as o,S as s,Zt as c,_ as l,j as u,l as d,ot as f,pr as p,tr as m,un as h,v as g,x as _,y as v}from"./icons-CO_II6D-.js";import{t as y}from"./preload-helper-BEFjQwLd.js";import{n as b}from"./utils-btZ8C8-R.js";import{t as x}from"./button-Ci9EUgqd.js";import{t as S}from"./scroll-area-XonvWYn_.js";import{t as C}from"./separator-sQj04Ari.js";var w=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],T=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:p},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:a},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:g},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:v},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:l},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:_},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:m},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:i},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:s},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:o},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:r},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:f}];function E(e){return typeof e==`string`&&T.some(t=>t.id===e)}function D(e){return T.find(t=>t.id===e)}function O(e){return T.filter(t=>t.group===e)}var k=n();function A({active:e,onSelect:t}){return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:w.map(n=>{let r=O(n.id);return r.length===0?null:(0,k.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,k.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,k.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:b(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,k.jsx)(r,{className:b(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,k.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function j({onSelect:e}){return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:w.map(t=>{let n=O(t.id);return n.length===0?null:(0,k.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,k.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,k.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,k.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,k.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,k.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,k.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,k.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var M=e(t(),1),N={general:(0,M.lazy)(()=>y(()=>import(`./general-settings-section-i41W43ER.js`).then(e=>({default:e.GeneralSettingsSection})),__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]))),appearance:(0,M.lazy)(()=>y(()=>import(`./appearance-settings-section-DL466x83.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([41,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,40]))),"ai-provider":(0,M.lazy)(()=>y(()=>import(`./ai-settings-section-OPqC2bYG.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([42,4,1,5,6,7,9,11,3,10,13,43,2,8,12,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,44]))),accounts:(0,M.lazy)(()=>y(()=>import(`./accounts-settings-section-CgG5P3Jm.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([45,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,46,44]))),ppmbot:(0,M.lazy)(()=>y(()=>import(`./ppmbot-settings-section-C8PFlvaq.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([47,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,40]))),notifications:(0,M.lazy)(()=>y(()=>import(`./notifications-settings-section-C05WYqcE.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([48,4,1,5,40,7,19]))),jira:(0,M.lazy)(()=>y(()=>import(`./jira-watcher-section-BJ9edGEP.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([49,2,1,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]))),extensions:(0,M.lazy)(()=>y(()=>import(`./extension-manager-section-B2nZzJ2b.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([50,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]))),proxy:(0,M.lazy)(()=>y(()=>import(`./proxy-settings-section-BcHIEANE.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([51,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,44]))),schedules:(0,M.lazy)(()=>y(()=>import(`./schedules-settings-section-Ci0O2Ng6.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([52,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]))),shortcuts:(0,M.lazy)(()=>y(()=>import(`./keyboard-shortcuts-section-CxdGSNGr.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([53,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]))),files:(0,M.lazy)(()=>y(()=>import(`./files-settings-section-DC3OzzOl.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([54,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,40]))),"query-audit":(0,M.lazy)(()=>y(()=>import(`./query-audit-section-UKG_smyt.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([55,1,4,5,6,7,9,24,44,28,19])))};function P({category:e}){let t=N[e];return(0,k.jsx)(M.Suspense,{fallback:(0,k.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,k.jsx)(h,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,k.jsx)(t,{})})}function F({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,M.useState)(e??`general`),[i,a]=(0,M.useState)(e===void 0),o=D(n),s=o.icon;function c(e){r(e),a(!1),t?.(e)}return(0,k.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,k.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,k.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,k.jsx)(A,{active:n,onSelect:c})}),(0,k.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,k.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,k.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,k.jsx)(x,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>a(!0),children:(0,k.jsx)(d,{className:`size-4`})}),(0,k.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:o.label})]}),(0,k.jsx)(C,{}),(0,k.jsx)(S,{className:`flex-1 min-h-0`,children:(0,k.jsx)(`div`,{className:`p-4 pb-8`,children:(0,k.jsx)(P,{category:n})})})]}),i&&(0,k.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,k.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,k.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,k.jsx)(C,{}),(0,k.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,k.jsx)(j,{onSelect:c})})]})]})]})})}export{E as n,F as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-DANPfMRN.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-C8nGqkKN.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-BHh12_0v.js","assets/vendor-markdown-QKPNiWEd.js","assets/button-Ci9EUgqd.js","assets/utils-btZ8C8-R.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-c8YOpTlT.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DvClbTQx.css","assets/onboarding-entry-CmUqv1kl.js","assets/separator-sQj04Ari.js","assets/appearance-settings-section-tw6TpFb6.js","assets/ai-settings-section-D-mwEYFZ.js","assets/ai-settings-section-CEbW8jRy.js","assets/api-settings-BmvNoCbn.js","assets/accounts-settings-section-DUVO32SQ.js","assets/codex-reset-credit-button-CbmE5mRX.js","assets/ppmbot-settings-section-D8AES1BA.js","assets/notifications-settings-section-C05WYqcE.js","assets/jira-watcher-section-DHRoyWcG.js","assets/extension-manager-section-rbkXsZVR.js","assets/proxy-settings-section-CqtmbeRj.js","assets/schedules-settings-section-BKoPovy2.js","assets/keyboard-shortcuts-section-BKej4mUf.js","assets/files-settings-section-CT7mDb0L.js","assets/query-audit-section-UKG_smyt.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{At as r,Ft as i,Ln as a,Qt as o,S as s,Zt as c,_ as l,j as u,l as d,ot as f,pr as p,tr as m,un as h,v as g,x as _,y as v}from"./icons-CO_II6D-.js";import{t as y}from"./preload-helper-BEFjQwLd.js";import{n as b}from"./utils-btZ8C8-R.js";import{t as x}from"./button-Ci9EUgqd.js";import{t as S}from"./scroll-area-XonvWYn_.js";import{t as C}from"./separator-sQj04Ari.js";var w=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],T=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:p},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:a},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:g},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:v},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:l},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:_},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:m},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:i},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:s},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:o},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:r},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:f}];function E(e){return typeof e==`string`&&T.some(t=>t.id===e)}function D(e){return T.find(t=>t.id===e)}function O(e){return T.filter(t=>t.group===e)}var k=n();function A({active:e,onSelect:t}){return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:w.map(n=>{let r=O(n.id);return r.length===0?null:(0,k.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,k.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,k.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:b(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,k.jsx)(r,{className:b(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,k.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function j({onSelect:e}){return(0,k.jsx)(S,{className:`h-full`,children:(0,k.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:w.map(t=>{let n=O(t.id);return n.length===0?null:(0,k.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,k.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,k.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,k.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,k.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,k.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,k.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,k.jsx)(u,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var M=e(t(),1),N={general:(0,M.lazy)(()=>y(()=>import(`./general-settings-section-DANPfMRN.js`).then(e=>({default:e.GeneralSettingsSection})),__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]))),appearance:(0,M.lazy)(()=>y(()=>import(`./appearance-settings-section-tw6TpFb6.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([41,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,40]))),"ai-provider":(0,M.lazy)(()=>y(()=>import(`./ai-settings-section-D-mwEYFZ.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([42,4,1,5,6,7,9,11,3,10,13,43,2,8,12,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,44]))),accounts:(0,M.lazy)(()=>y(()=>import(`./accounts-settings-section-DUVO32SQ.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([45,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,46,44]))),ppmbot:(0,M.lazy)(()=>y(()=>import(`./ppmbot-settings-section-D8AES1BA.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([47,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,40]))),notifications:(0,M.lazy)(()=>y(()=>import(`./notifications-settings-section-C05WYqcE.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([48,4,1,5,40,7,19]))),jira:(0,M.lazy)(()=>y(()=>import(`./jira-watcher-section-DHRoyWcG.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([49,2,1,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]))),extensions:(0,M.lazy)(()=>y(()=>import(`./extension-manager-section-rbkXsZVR.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([50,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]))),proxy:(0,M.lazy)(()=>y(()=>import(`./proxy-settings-section-CqtmbeRj.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([51,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,44]))),schedules:(0,M.lazy)(()=>y(()=>import(`./schedules-settings-section-BKoPovy2.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([52,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]))),shortcuts:(0,M.lazy)(()=>y(()=>import(`./keyboard-shortcuts-section-BKej4mUf.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([53,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]))),files:(0,M.lazy)(()=>y(()=>import(`./files-settings-section-CT7mDb0L.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([54,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,40]))),"query-audit":(0,M.lazy)(()=>y(()=>import(`./query-audit-section-UKG_smyt.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([55,1,4,5,6,7,9,24,44,28,19])))};function P({category:e}){let t=N[e];return(0,k.jsx)(M.Suspense,{fallback:(0,k.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,k.jsx)(h,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,k.jsx)(t,{})})}function F({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,M.useState)(e??`general`),[i,a]=(0,M.useState)(e===void 0),o=D(n),s=o.icon;function c(e){r(e),a(!1),t?.(e)}return(0,k.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,k.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,k.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,k.jsx)(A,{active:n,onSelect:c})}),(0,k.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,k.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,k.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,k.jsx)(x,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>a(!0),children:(0,k.jsx)(d,{className:`size-4`})}),(0,k.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:o.label})]}),(0,k.jsx)(C,{}),(0,k.jsx)(S,{className:`flex-1 min-h-0`,children:(0,k.jsx)(`div`,{className:`p-4 pb-8`,children:(0,k.jsx)(P,{category:n})})})]}),i&&(0,k.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,k.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,k.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,k.jsx)(C,{}),(0,k.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,k.jsx)(j,{onSelect:c})})]})]})]})})}export{E as n,F as t};
@@ -1 +1 @@
1
- import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./button-Ci9EUgqd.js";import"./scroll-area-XonvWYn_.js";import"./separator-sQj04Ari.js";import{n as t,t as n}from"./settings-body-B6JGOIYb.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
1
+ import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./button-Ci9EUgqd.js";import"./scroll-area-XonvWYn_.js";import"./separator-sQj04Ari.js";import{n as t,t as n}from"./settings-body-k2qPgRFe.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
@@ -1 +1 @@
1
- import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import{t}from"./window-store-B4cbZ5rr.js";import"./button-Ci9EUgqd.js";import"./scroll-area-XonvWYn_.js";import"./separator-sQj04Ari.js";import{n,t as r}from"./settings-body-B6JGOIYb.js";var i=e();function a({id:e,payload:a}){let o=t(e=>e.setPayload);return(0,i.jsx)(r,{initialCategory:n(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
1
+ import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import{t}from"./window-store-B4cbZ5rr.js";import"./button-Ci9EUgqd.js";import"./scroll-area-XonvWYn_.js";import"./separator-sQj04Ari.js";import{n,t as r}from"./settings-body-k2qPgRFe.js";var i=e();function a({id:e,payload:a}){let o=t(e=>e.setPayload);return(0,i.jsx)(r,{initialCategory:n(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{C as r,S as i}from"./index-jG9mLs-J.js";import{t as a}from"./use-monaco-theme-rH6epJYA.js";import{a as o,i as s,r as c}from"./glide-data-grid-Dj4vrDvj.js";var l=e(t(),1),u=n();function d({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:d,onSqlChange:f,persistedSql:p}){let[m,h]=(0,l.useState)(()=>p??n),g=(0,l.useRef)(!!p),_=(0,l.useRef)(null),v=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(e);b.current=e;let x=a();(0,l.useEffect)(()=>{if(!(!v.current||!d))return y.current?.dispose(),c(),y.current=v.current.languages.registerCompletionItemProvider(`sql`,s(v.current,d)),()=>{y.current?.dispose()}},[d]);let S=(0,l.useCallback)((e,t)=>{_.current=e,v.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=o(e.getValue(),t.lineNumber);n&&b.current(n)}}),d&&(y.current?.dispose(),y.current=t.languages.registerCompletionItemProvider(`sql`,s(t,d)))},[d]);return(0,l.useEffect)(()=>{g.current||h(n)},[n]),(0,u.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,u.jsx)(r,{beforeMount:i,height:`100%`,language:`sql`,theme:x,value:m,onChange:e=>{let t=e??``;h(t),g.current=!0,f?.(t)},onMount:S,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{d as t};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{C as r,S as i}from"./index-C8nGqkKN.js";import{t as a}from"./use-monaco-theme-C88KphGx.js";import{a as o,i as s,r as c}from"./glide-data-grid-R4PcAntf.js";var l=e(t(),1),u=n();function d({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:d,onSqlChange:f,persistedSql:p}){let[m,h]=(0,l.useState)(()=>p??n),g=(0,l.useRef)(!!p),_=(0,l.useRef)(null),v=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(e);b.current=e;let x=a();(0,l.useEffect)(()=>{if(!(!v.current||!d))return y.current?.dispose(),c(),y.current=v.current.languages.registerCompletionItemProvider(`sql`,s(v.current,d)),()=>{y.current?.dispose()}},[d]);let S=(0,l.useCallback)((e,t)=>{_.current=e,v.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=o(e.getValue(),t.lineNumber);n&&b.current(n)}}),d&&(y.current?.dispose(),y.current=t.languages.registerCompletionItemProvider(`sql`,s(t,d)))},[d]);return(0,l.useEffect)(()=>{g.current||h(n)},[n]),(0,u.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,u.jsx)(r,{beforeMount:i,height:`100%`,language:`sql`,theme:x,value:m,onChange:e=>{let t=e??``;h(t),g.current=!0,f?.(t)},onMount:S,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{d as t};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Tr as r,at as i,ir as a,n as o,un as s}from"./icons-CO_II6D-.js";import{i as c,n as l,s as u}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import"./data-grid-types-CHD9-pon.js";import"./marked.esm-DDb9MclE.js";import"./use-monaco-theme-rH6epJYA.js";import{t as d}from"./glide-data-grid-Dj4vrDvj.js";import{t as f}from"./sql-query-editor-4iCGE4h2.js";var p=e(t(),1);function m(e,t,n){let[r,i]=(0,p.useState)([]),[a,o]=(0,p.useState)(null),[s,d]=(0,p.useState)(null),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(1),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),D=n?`/api/db/connections/${n}`:null,O=!n&&!e&&/^(\/|[A-Za-z]:[/\\])/.test(t),k=D??(O?`/api/fs/sqlite`:`${c(e)}/sqlite`),A=D?``:`path=${encodeURIComponent(t)}`,j=(0,p.useCallback)(async()=>{g(!0),v(null);try{let e=D?`?cached=1`:A?`?${A}`:``,t=await l.get(`${k}/tables${e}`);i(t),!D&&t.length>0&&!a&&o(t[0].name)}catch(e){v(e.message)}finally{g(!1)}},[k,A,D]);(0,p.useEffect)(()=>{j()},[j]);let M=(0,p.useCallback)(async()=>{if(a){g(!0);try{let e=A?`${A}&`:``,[t,n]=await Promise.all([l.get(`${k}/data?${e}table=${encodeURIComponent(a)}&page=${y}&limit=100`),l.get(`${k}/schema?${e}table=${encodeURIComponent(a)}`)]);d(t),m(n)}catch(e){v(e.message)}finally{g(!1)}}},[k,A,a,y]);(0,p.useEffect)(()=>{M()},[M]);let N=(0,p.useCallback)(e=>{o(e),b(1),S(null)},[]),P=(0,p.useCallback)(async e=>{E(!0),w(null);try{let n=D?{sql:e}:{path:t,sql:e},r=await l.post(`${k}/query`,n);S(r),r.changeType===`modify`&&M()}catch(e){w(e.message)}finally{E(!1)}},[k,D,t,M]),F=(0,p.useCallback)((e,t)=>{let n=t.message;v(n),u.error(`${e} failed`,{description:n})},[]);return{tables:r,selectedTable:a,selectTable:N,tableData:s,schema:f,loading:h,error:_,page:y,setPage:b,queryResult:x,queryError:C,queryLoading:T,executeQuery:P,updateCell:(0,p.useCallback)(async(e,n,r)=>{if(a)try{D?await l.put(`${k}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await l.put(`${k}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),M()}catch(e){F(`Update cell`,e)}},[k,D,t,a,M,F]),deleteRow:(0,p.useCallback)(async e=>{if(a)try{D?await l.del(`${k}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await l.del(`${k}/row`,{path:t,table:a,rowid:e}),M(),j()}catch(e){F(`Delete row`,e)}},[k,D,t,a,M,j,F]),refreshTables:j,refreshData:M}}var h=n();function g({tables:e,selectedTable:t,onSelect:n,onRefresh:i}){return(0,h.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,h.jsx)(`button`,{type:`button`,onClick:i,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,h.jsx)(a,{className:`size-3`})})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,h.jsx)(r,{className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function _({onExecute:e,loading:t}){return(0,h.jsx)(f,{onExecute:e,loading:t})}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.connectionId,a=e?.tableName,[o,s]=(0,p.useState)(!1);if(r)return(0,h.jsx)(y,{projectName:``,dbPath:``,connectionId:r,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0});let c=!!t&&!n&&/^(\/|[A-Za-z]:[/\\])/.test(t);return!t||!n&&!c?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,h.jsx)(i,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,h.jsx)(y,{projectName:n??``,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function y({projectName:e,dbPath:t,connectionId:n,connectionName:r,initialTable:a,queryPanelOpen:c,onToggleQueryPanel:l,hideTableList:u}){let f=m(e,t,n),v=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{a&&!v.current&&f.tables.length>0&&(v.current=!0,f.selectTable(a))},[a,f.tables]),f.error&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,h.jsx)(o,{className:`size-10 text-destructive`}),(0,h.jsx)(`p`,{className:`text-sm`,children:f.error})]}):f.loading&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,h.jsx)(s,{className:`size-5 animate-spin`}),(0,h.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,h.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!u&&(0,h.jsx)(g,{tables:f.tables,selectedTable:f.selectedTable,onSelect:f.selectTable,onRefresh:f.refreshTables}),(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${u?``:`border-l border-border`}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,h.jsx)(i,{className:`size-3.5 text-muted-foreground`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??t}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.selectedTable&&`/ ${f.selectedTable}`}),(0,h.jsx)(`div`,{className:`ml-auto`,children:(0,h.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${c?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden ${c?`max-h-[60%]`:``}`,children:f.tableData?(0,h.jsx)(d,{columns:f.tableData.columns,rows:f.tableData.rows,total:f.tableData.total,limit:f.tableData.limit,schema:f.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:f.loading,page:f.page,onPageChange:f.setPage,onCellUpdate:(e,t,n,r)=>f.updateCell(t,n,r),onRowDelete:(e,t)=>f.deleteRow(t)}):(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:f.loading?(0,h.jsx)(s,{className:`size-4 animate-spin`}):`Select a table`})}),c&&(0,h.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,h.jsx)(_,{onExecute:f.executeQuery,loading:f.queryLoading})})]})]})}export{v as SqliteViewer};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Tr as r,at as i,ir as a,n as o,un as s}from"./icons-CO_II6D-.js";import{i as c,n as l,s as u}from"./api-client-c8YOpTlT.js";import"./settings-store-Br5c1efC.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import"./data-grid-types-CHD9-pon.js";import"./marked.esm-DDb9MclE.js";import"./use-monaco-theme-C88KphGx.js";import{t as d}from"./glide-data-grid-R4PcAntf.js";import{t as f}from"./sql-query-editor-BjIMi9Wk.js";var p=e(t(),1);function m(e,t,n){let[r,i]=(0,p.useState)([]),[a,o]=(0,p.useState)(null),[s,d]=(0,p.useState)(null),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(1),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),D=n?`/api/db/connections/${n}`:null,O=!n&&!e&&/^(\/|[A-Za-z]:[/\\])/.test(t),k=D??(O?`/api/fs/sqlite`:`${c(e)}/sqlite`),A=D?``:`path=${encodeURIComponent(t)}`,j=(0,p.useCallback)(async()=>{g(!0),v(null);try{let e=D?`?cached=1`:A?`?${A}`:``,t=await l.get(`${k}/tables${e}`);i(t),!D&&t.length>0&&!a&&o(t[0].name)}catch(e){v(e.message)}finally{g(!1)}},[k,A,D]);(0,p.useEffect)(()=>{j()},[j]);let M=(0,p.useCallback)(async()=>{if(a){g(!0);try{let e=A?`${A}&`:``,[t,n]=await Promise.all([l.get(`${k}/data?${e}table=${encodeURIComponent(a)}&page=${y}&limit=100`),l.get(`${k}/schema?${e}table=${encodeURIComponent(a)}`)]);d(t),m(n)}catch(e){v(e.message)}finally{g(!1)}}},[k,A,a,y]);(0,p.useEffect)(()=>{M()},[M]);let N=(0,p.useCallback)(e=>{o(e),b(1),S(null)},[]),P=(0,p.useCallback)(async e=>{E(!0),w(null);try{let n=D?{sql:e}:{path:t,sql:e},r=await l.post(`${k}/query`,n);S(r),r.changeType===`modify`&&M()}catch(e){w(e.message)}finally{E(!1)}},[k,D,t,M]),F=(0,p.useCallback)((e,t)=>{let n=t.message;v(n),u.error(`${e} failed`,{description:n})},[]);return{tables:r,selectedTable:a,selectTable:N,tableData:s,schema:f,loading:h,error:_,page:y,setPage:b,queryResult:x,queryError:C,queryLoading:T,executeQuery:P,updateCell:(0,p.useCallback)(async(e,n,r)=>{if(a)try{D?await l.put(`${k}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await l.put(`${k}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),M()}catch(e){F(`Update cell`,e)}},[k,D,t,a,M,F]),deleteRow:(0,p.useCallback)(async e=>{if(a)try{D?await l.del(`${k}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await l.del(`${k}/row`,{path:t,table:a,rowid:e}),M(),j()}catch(e){F(`Delete row`,e)}},[k,D,t,a,M,j,F]),refreshTables:j,refreshData:M}}var h=n();function g({tables:e,selectedTable:t,onSelect:n,onRefresh:i}){return(0,h.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,h.jsx)(`button`,{type:`button`,onClick:i,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,h.jsx)(a,{className:`size-3`})})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,h.jsx)(r,{className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function _({onExecute:e,loading:t}){return(0,h.jsx)(f,{onExecute:e,loading:t})}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.connectionId,a=e?.tableName,[o,s]=(0,p.useState)(!1);if(r)return(0,h.jsx)(y,{projectName:``,dbPath:``,connectionId:r,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0});let c=!!t&&!n&&/^(\/|[A-Za-z]:[/\\])/.test(t);return!t||!n&&!c?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,h.jsx)(i,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,h.jsx)(y,{projectName:n??``,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function y({projectName:e,dbPath:t,connectionId:n,connectionName:r,initialTable:a,queryPanelOpen:c,onToggleQueryPanel:l,hideTableList:u}){let f=m(e,t,n),v=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{a&&!v.current&&f.tables.length>0&&(v.current=!0,f.selectTable(a))},[a,f.tables]),f.error&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,h.jsx)(o,{className:`size-10 text-destructive`}),(0,h.jsx)(`p`,{className:`text-sm`,children:f.error})]}):f.loading&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,h.jsx)(s,{className:`size-5 animate-spin`}),(0,h.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,h.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!u&&(0,h.jsx)(g,{tables:f.tables,selectedTable:f.selectedTable,onSelect:f.selectTable,onRefresh:f.refreshTables}),(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${u?``:`border-l border-border`}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,h.jsx)(i,{className:`size-3.5 text-muted-foreground`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??t}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.selectedTable&&`/ ${f.selectedTable}`}),(0,h.jsx)(`div`,{className:`ml-auto`,children:(0,h.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${c?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden ${c?`max-h-[60%]`:``}`,children:f.tableData?(0,h.jsx)(d,{columns:f.tableData.columns,rows:f.tableData.rows,total:f.tableData.total,limit:f.tableData.limit,schema:f.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:f.loading,page:f.page,onPageChange:f.setPage,onCellUpdate:(e,t,n,r)=>f.updateCell(t,n,r),onRowDelete:(e,t)=>f.deleteRow(t)}):(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:f.loading?(0,h.jsx)(s,{className:`size-4 animate-spin`}):`Select a table`})}),c&&(0,h.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,h.jsx)(_,{onExecute:f.executeQuery,loading:f.queryLoading})})]})]})}export{v as SqliteViewer};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-BZAW_nag.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-markdown-QKPNiWEd.js","assets/utils-btZ8C8-R.js","assets/format-bytes-DmSHAKFe.js","assets/process-table-BVeRguFg.js","assets/index-jG9mLs-J.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-BHh12_0v.js","assets/button-Ci9EUgqd.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-c8YOpTlT.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DMA-So69.css"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Gr as r,Kr as i}from"./icons-CO_II6D-.js";import{t as a}from"./preload-helper-BEFjQwLd.js";import{n as o}from"./utils-btZ8C8-R.js";import{R as s}from"./index-jG9mLs-J.js";var c=e(t(),1),l=n(),u=(0,c.lazy)(()=>a(()=>import(`./overview-panel-BZAW_nag.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),d=(0,c.lazy)(()=>a(()=>import(`./process-table-BVeRguFg.js`).then(e=>({default:e.ProcessTable})),__vite__mapDeps([5,1,6,7,8,2,9,3,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,4])));function f({isConnected:e,elapsed:t,tickCount:n}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,"data-testid":`sysmon-connection`,"data-tick-count":n,children:[e?(0,l.jsx)(r,{className:`size-3 text-success`}):(0,l.jsx)(i,{className:`size-3 text-error`}),(0,l.jsx)(`span`,{children:e?`Updated ${t}s ago`:`Disconnected`})]})}var p=(0,c.memo)(function({initialTab:e=`overview`,onTabChange:t,variant:n=`tab`}){let{latest:r,history:i,isConnected:a,tickCount:p}=s({processes:!0}),[m,h]=(0,c.useState)(e),g=e=>{h(e),t?.(e)},_=r?Math.round((Date.now()-r.ts)/1e3):0,v=r?.warnings??[];return(0,l.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,"data-testid":`system-monitor-window`,children:[n===`tab`&&(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,l.jsx)(f,{isConnected:a,elapsed:_,tickCount:p})]}),v.length>0&&(0,l.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0 space-y-0.5`,"data-testid":`sysmon-warnings`,children:v.map((e,t)=>(0,l.jsx)(`div`,{children:e},t))}),(0,l.jsxs)(`div`,{className:`flex items-center border-b border-border shrink-0`,role:`tablist`,children:[(0,l.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`overview`,"data-testid":`sysmon-tab-overview`,onClick:()=>g(`overview`),className:o(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`overview`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Overview`}),(0,l.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`processes`,"data-testid":`sysmon-tab-processes`,onClick:()=>g(`processes`),className:o(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`processes`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Processes`}),n===`window`&&(0,l.jsx)(`div`,{className:`ml-auto pr-3`,children:(0,l.jsx)(f,{isConnected:a,elapsed:_,tickCount:p})})]}),(0,l.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsx)(`div`,{className:`p-4 text-xs text-text-subtle`,children:`Loading…`}),children:r?m===`overview`?(0,l.jsx)(u,{system:r.system,history:i}):(0,l.jsx)(d,{snapshot:r}):(0,l.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm p-4`,children:a?`Waiting for data…`:`Connecting to resource monitor…`})})})]})});export{p as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-BZAW_nag.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-markdown-QKPNiWEd.js","assets/utils-btZ8C8-R.js","assets/format-bytes-DmSHAKFe.js","assets/process-table-D_gR2XA6.js","assets/index-C8nGqkKN.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-BHh12_0v.js","assets/button-Ci9EUgqd.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-c8YOpTlT.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DvClbTQx.css"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Gr as r,Kr as i}from"./icons-CO_II6D-.js";import{t as a}from"./preload-helper-BEFjQwLd.js";import{n as o}from"./utils-btZ8C8-R.js";import{R as s}from"./index-C8nGqkKN.js";var c=e(t(),1),l=n(),u=(0,c.lazy)(()=>a(()=>import(`./overview-panel-BZAW_nag.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),d=(0,c.lazy)(()=>a(()=>import(`./process-table-D_gR2XA6.js`).then(e=>({default:e.ProcessTable})),__vite__mapDeps([5,1,6,7,8,2,9,3,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,4])));function f({isConnected:e,elapsed:t,tickCount:n}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,"data-testid":`sysmon-connection`,"data-tick-count":n,children:[e?(0,l.jsx)(r,{className:`size-3 text-success`}):(0,l.jsx)(i,{className:`size-3 text-error`}),(0,l.jsx)(`span`,{children:e?`Updated ${t}s ago`:`Disconnected`})]})}var p=(0,c.memo)(function({initialTab:e=`overview`,onTabChange:t,variant:n=`tab`}){let{latest:r,history:i,isConnected:a,tickCount:p}=s({processes:!0}),[m,h]=(0,c.useState)(e),g=e=>{h(e),t?.(e)},_=r?Math.round((Date.now()-r.ts)/1e3):0,v=r?.warnings??[];return(0,l.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,"data-testid":`system-monitor-window`,children:[n===`tab`&&(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,l.jsx)(f,{isConnected:a,elapsed:_,tickCount:p})]}),v.length>0&&(0,l.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0 space-y-0.5`,"data-testid":`sysmon-warnings`,children:v.map((e,t)=>(0,l.jsx)(`div`,{children:e},t))}),(0,l.jsxs)(`div`,{className:`flex items-center border-b border-border shrink-0`,role:`tablist`,children:[(0,l.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`overview`,"data-testid":`sysmon-tab-overview`,onClick:()=>g(`overview`),className:o(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`overview`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Overview`}),(0,l.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`processes`,"data-testid":`sysmon-tab-processes`,onClick:()=>g(`processes`),className:o(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`processes`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Processes`}),n===`window`&&(0,l.jsx)(`div`,{className:`ml-auto pr-3`,children:(0,l.jsx)(f,{isConnected:a,elapsed:_,tickCount:p})})]}),(0,l.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsx)(`div`,{className:`p-4 text-xs text-text-subtle`,children:`Loading…`}),children:r?m===`overview`?(0,l.jsx)(u,{system:r.system,history:i}):(0,l.jsx)(d,{snapshot:r}):(0,l.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm p-4`,children:a?`Waiting for data…`:`Connecting to resource monitor…`})})})]})});export{p as t};
@@ -1 +1 @@
1
- import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{t}from"./system-monitor-body-J9JtvAWV.js";var n=e(),r=()=>(0,n.jsx)(t,{});export{r as SystemMonitorTab};
1
+ import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{t}from"./system-monitor-body-D0T3ggt2.js";var n=e(),r=()=>(0,n.jsx)(t,{});export{r as SystemMonitorTab};
@@ -1 +1 @@
1
- import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{t}from"./window-store-B4cbZ5rr.js";import{t as n}from"./system-monitor-body-J9JtvAWV.js";var r=e();function i({id:e,payload:i}){let a=t(e=>e.setPayload);return(0,r.jsx)(n,{initialTab:i?.tab===`processes`?`processes`:`overview`,onTabChange:t=>a(e,{tab:t}),variant:`window`})}export{i as default};
1
+ import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./api-client-c8YOpTlT.js";import{t}from"./window-store-B4cbZ5rr.js";import{t as n}from"./system-monitor-body-D0T3ggt2.js";var r=e();function i({id:e,payload:i}){let a=t(e=>e.setPayload);return(0,r.jsx)(n,{initialTab:i?.tab===`processes`?`processes`:`overview`,onTabChange:t=>a(e,{tab:t}),variant:`window`})}export{i as default};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./portal-container-context-NFSuymMu.js";import{m as r,t as i}from"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./use-is-mobile-BClDZJP5.js";import"./window-pip-registry-BQ6LSr6d.js";import{bn as a}from"./index-jG9mLs-J.js";var o=e(t(),1),s=n();function c({id:e,payload:t}){let n=r(e),c=(i(e=>e.panels[n])?.tabs.length??0)>0,l=(0,o.useRef)(!1);c&&(l.current=!0);let u=typeof t?.originPanelId==`string`?t.originPanelId:null,d=(0,o.useRef)(u);d.current=u;let f=(0,o.useCallback)(e=>a(n,e),[n]),p=(0,o.useRef)(null);return(0,o.useLayoutEffect)(()=>(p.current=null,()=>{let t={};p.current=t,queueMicrotask(()=>{p.current===t&&(p.current=null,i.getState().redockFromWindow(e,d.current))})}),[e]),(0,s.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,s.jsx)(`div`,{ref:f,className:`absolute inset-0`}),!c&&!l.current&&(0,s.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs text-text-2 pointer-events-none`,children:`Loading…`})]})}export{c as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import"./icons-CO_II6D-.js";import"./portal-container-context-NFSuymMu.js";import{m as r,t as i}from"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./use-is-mobile-BClDZJP5.js";import"./window-pip-registry-BQ6LSr6d.js";import{bn as a}from"./index-C8nGqkKN.js";var o=e(t(),1),s=n();function c({id:e,payload:t}){let n=r(e),c=(i(e=>e.panels[n])?.tabs.length??0)>0,l=(0,o.useRef)(!1);c&&(l.current=!0);let u=typeof t?.originPanelId==`string`?t.originPanelId:null,d=(0,o.useRef)(u);d.current=u;let f=(0,o.useCallback)(e=>a(n,e),[n]),p=(0,o.useRef)(null);return(0,o.useLayoutEffect)(()=>(p.current=null,()=>{let t={};p.current=t,queueMicrotask(()=>{p.current===t&&(p.current=null,i.getState().redockFromWindow(e,d.current))})}),[e]),(0,s.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,s.jsx)(`div`,{ref:f,className:`absolute inset-0`}),!c&&!l.current&&(0,s.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs text-text-2 pointer-events-none`,children:`Loading…`})]})}export{c as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-CwCy7ZWf.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-ui-BHh12_0v.js","assets/vendor-markdown-QKPNiWEd.js","assets/utils-btZ8C8-R.js","assets/api-client-c8YOpTlT.js","assets/tool-cards-CgOBEUnb.js","assets/index-jG9mLs-J.js","assets/preload-helper-BEFjQwLd.js","assets/button-Ci9EUgqd.js","assets/createLucideIcon-DBXq3G0e.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DMA-So69.css","assets/image-preview-geometry-DN3DZQp0.js","assets/use-blob-url-CmavyEP8.js","assets/image-gallery-DC3gRAqk.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Jr as r}from"./icons-CO_II6D-.js";import{t as i}from"./preload-helper-BEFjQwLd.js";import"./portal-container-context-NFSuymMu.js";import"./window-store-B4cbZ5rr.js";import"./use-is-mobile-BClDZJP5.js";import{t as a}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{n as o}from"./use-open-team-member-B0eUOKKj.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-CwCy7ZWf.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])));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.jsxs)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:[`Session — `,e.memberName]}),(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.memberName}`,payload:e})})})]}):null}export{u as TeamMemberSheet};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-4swiiDz7.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-ui-BHh12_0v.js","assets/vendor-markdown-QKPNiWEd.js","assets/utils-btZ8C8-R.js","assets/api-client-c8YOpTlT.js","assets/tool-cards-D0-krtA2.js","assets/index-C8nGqkKN.js","assets/preload-helper-BEFjQwLd.js","assets/button-Ci9EUgqd.js","assets/createLucideIcon-DBXq3G0e.js","assets/react-CzUPVyyG.js","assets/settings-store-Br5c1efC.js","assets/file-store-D9KE0kQC.js","assets/window-store-B4cbZ5rr.js","assets/window-pip-registry-BQ6LSr6d.js","assets/panel-store-BUQ-CPsd.js","assets/onboarding-quick-orientation-DIhWv1CN.js","assets/dialog-B8clVkyi.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-BClDZJP5.js","assets/format-file-meta-mQwA6SuY.js","assets/fs-api-DL36slbd.js","assets/context-menu-CjYTq8DI.js","assets/input-CG8PS8mS.js","assets/mobile-bottom-sheet-CuNi2FRv.js","assets/use-visual-viewport-BGpcMnIx.js","assets/scroll-area-XonvWYn_.js","assets/chat-preparation-cache-BSIQGiWx.js","assets/file-icons-gx_FBOXY.js","assets/project-framework-store-XxFXcUpb.js","assets/format-date-BMtvCeb9.js","assets/git-repo-store-DSypNj19.js","assets/project-store-C5gJXkvb.js","assets/ws-auth-kXgsX2Js.js","assets/tab-store-DqeaGhhE.js","assets/apply-theme-Cc_cmrD5.js","assets/resolve-theme-STMsK2vc.js","assets/index-DvClbTQx.css","assets/image-preview-geometry-DN3DZQp0.js","assets/use-blob-url-CmavyEP8.js","assets/image-gallery-DC3gRAqk.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{Jr as r}from"./icons-CO_II6D-.js";import{t as i}from"./preload-helper-BEFjQwLd.js";import"./portal-container-context-NFSuymMu.js";import"./window-store-B4cbZ5rr.js";import"./use-is-mobile-BClDZJP5.js";import{t as a}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{n as o}from"./use-open-team-member-B0eUOKKj.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-4swiiDz7.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])));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.jsxs)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:[`Session — `,e.memberName]}),(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.memberName}`,payload:e})})})]}):null}export{u as TeamMemberSheet};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{ir as r,un as i}from"./icons-CO_II6D-.js";import{n as a}from"./api-client-c8YOpTlT.js";import{n as o}from"./utils-btZ8C8-R.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import{t as s}from"./tool-cards-CgOBEUnb.js";import"./use-blob-url-CmavyEP8.js";var c=e(t(),1),l=3e3,u=2e3;function d(e,t){let[n,r]=(0,c.useState)([]),[i,o]=(0,c.useState)(!0),[s,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!e||!t){d(`Missing team or member`),o(!1);return}let n=!1,i=0,s=!1;r([]),o(!0),d(null);let c=async()=>{if(s)return;s=!0;let c=i===0;try{let o=await a.get(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/transcript?sinceBytes=${i}`);if(n)return;i=o?.nextBytes??i;let s=o?.events??[];c||o?.restarted?r(s.slice(-u)):s.length>0&&r(e=>[...e,...s].slice(-u)),d(null)}catch{!n&&c&&d(`Could not read this member's session`)}finally{s=!1,n||o(!1)}};c();let f=setInterval(()=>void c(),l);return()=>{n=!0,clearInterval(f)}},[e,t,f]),{events:n,loading:i,error:s,refresh:(0,c.useCallback)(()=>p(e=>e+1),[])}}var f=n();function p({payload:e}){let{teamName:t,memberName:n,projectName:a}=e??{},{events:c,loading:l,error:u,refresh:p}=d(t,n);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,f.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:c.length>0?`${c.length} steps`:``}),(0,f.jsx)(`button`,{type:`button`,onClick:p,className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,f.jsx)(r,{className:o(`size-3`,l&&`animate-spin`)})})]}),l&&c.length===0?(0,f.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,f.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):u?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:u}):c.length===0?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,f.jsx)(s,{events:c,projectName:a,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{p as default};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{ir as r,un as i}from"./icons-CO_II6D-.js";import{n as a}from"./api-client-c8YOpTlT.js";import{n as o}from"./utils-btZ8C8-R.js";import"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import"./tab-store-DqeaGhhE.js";import{t as s}from"./tool-cards-D0-krtA2.js";import"./use-blob-url-CmavyEP8.js";var c=e(t(),1),l=3e3,u=2e3;function d(e,t){let[n,r]=(0,c.useState)([]),[i,o]=(0,c.useState)(!0),[s,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!e||!t){d(`Missing team or member`),o(!1);return}let n=!1,i=0,s=!1;r([]),o(!0),d(null);let c=async()=>{if(s)return;s=!0;let c=i===0;try{let o=await a.get(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/transcript?sinceBytes=${i}`);if(n)return;i=o?.nextBytes??i;let s=o?.events??[];c||o?.restarted?r(s.slice(-u)):s.length>0&&r(e=>[...e,...s].slice(-u)),d(null)}catch{!n&&c&&d(`Could not read this member's session`)}finally{s=!1,n||o(!1)}};c();let f=setInterval(()=>void c(),l);return()=>{n=!0,clearInterval(f)}},[e,t,f]),{events:n,loading:i,error:s,refresh:(0,c.useCallback)(()=>p(e=>e+1),[])}}var f=n();function p({payload:e}){let{teamName:t,memberName:n,projectName:a}=e??{},{events:c,loading:l,error:u,refresh:p}=d(t,n);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,f.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:c.length>0?`${c.length} steps`:``}),(0,f.jsx)(`button`,{type:`button`,onClick:p,className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,f.jsx)(r,{className:o(`size-3`,l&&`animate-spin`)})})]}),l&&c.length===0?(0,f.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,f.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):u?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:u}):c.length===0?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,f.jsx)(s,{events:c,projectName:a,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{p as default};
@@ -1,3 +1,3 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{ar as r,ct as i,in as a,jr as o,nn as s,nt as c,pn as l,q as u,un as d,yn as f}from"./icons-CO_II6D-.js";import{n as p,s as m}from"./api-client-c8YOpTlT.js";import{t as h}from"./settings-store-Br5c1efC.js";import{n as g}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import{t as _}from"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import{t as v}from"./tab-store-DqeaGhhE.js";import{r as y,t as b}from"./apply-theme-Cc_cmrD5.js";import{t as x}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as S}from"./resolve-theme-STMsK2vc.js";import{t as C}from"./ws-auth-kXgsX2Js.js";import{Sn as w,Tn as T,xt as E}from"./index-jG9mLs-J.js";import{r as D}from"./editor-font-BNwo7zo5.js";import{r as O}from"./send-to-chat-CyZ37y5J.js";import{n as k,t as A}from"./run-in-terminal-HIdNgYim.js";import{i as j,n as M,r as N,t as P}from"./vendor-xterm-DLDtzLib.js";var F=e(t(),1);function I(e){let t=e.tokens;if(e.terminal){let n=e.terminal.ansi;return{background:t.bgSolid,foreground:t.text,cursor:e.terminal.cursor,cursorAccent:e.terminal.cursorAccent??t.bgSolid,selectionBackground:e.terminal.selection,black:n[0],red:n[1],green:n[2],yellow:n[3],blue:n[4],magenta:n[5],cyan:n[6],white:n[7],brightBlack:n[8],brightRed:n[9],brightGreen:n[10],brightYellow:n[11],brightBlue:n[12],brightMagenta:n[13],brightCyan:n[14],brightWhite:n[15]}}let n=e.mode===`dark`,r=n?`#1b1f2a`:`#2b2f38`,i=n?`#d7dce8`:`#e9edf5`,a=t.text3,o=n?`#f7f9ff`:`#ffffff`;return{background:t.bgSolid,foreground:t.text,cursor:t.accent,cursorAccent:t.bgSolid,selectionBackground:t.accentWash,black:r,red:t.error,green:t.success,yellow:t.warning,blue:t.accent,magenta:t.accent2,cyan:t.info,white:i,brightBlack:a,brightRed:t.error,brightGreen:t.success,brightYellow:t.warning,brightBlue:t.accent,brightMagenta:t.accent2,brightCyan:t.info,brightWhite:o}}function L(){let e=h.getState();return I(y()??S(e.themeStyle,e.themeMode,e.customThemes,e.customThemeId))}var R=/[).,;:'"\]}>]+$/,z=/\bhttps?:\/\/[^\s<>"'`]+/g,ee=5e3,te=100,B=250,V=3e3,H=`RESIZE:`,ne=`PING`,re=`PONG`,ie=15e3,ae=35e3;function U(e){let{sessionId:t,containerRef:n}=e,r=(0,F.useRef)(null),i=(0,F.useRef)(null),a=(0,F.useRef)(null),o=(0,F.useRef)(null),s=(0,F.useRef)(0),c=(0,F.useRef)(!1),l=(0,F.useRef)(Date.now()),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),v=(0,F.useRef)(null),y=(0,F.useRef)(null),x=e.tabId?`ppm:terminal-session:${e.tabId}`:null,S=(0,F.useRef)((()=>{if(x)try{return localStorage.getItem(x)??t}catch{}return t})()),w=(0,F.useRef)(0),E=(0,F.useRef)(-1),O=(0,F.useCallback)(e=>{let t=a.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),k=(0,F.useCallback)(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>_(!0),B)},[]),A=(0,F.useCallback)(()=>r.current?.getSelection()??``,[]),I=(0,F.useCallback)(()=>{let e=r.current;if(!e)return``;let t=e.buffer.active,n=w.current,i=t.baseY+t.cursorY,a=[];for(let e=n;e<=i;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-BHh12_0v.js";import{ar as r,ct as i,in as a,jr as o,nn as s,nt as c,pn as l,q as u,un as d,yn as f}from"./icons-CO_II6D-.js";import{n as p,s as m}from"./api-client-c8YOpTlT.js";import{t as h}from"./settings-store-Br5c1efC.js";import{n as g}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import{t as _}from"./panel-store-BUQ-CPsd.js";import"./window-store-B4cbZ5rr.js";import{t as v}from"./tab-store-DqeaGhhE.js";import{r as y,t as b}from"./apply-theme-Cc_cmrD5.js";import{t as x}from"./mobile-bottom-sheet-CuNi2FRv.js";import"./use-visual-viewport-BGpcMnIx.js";import{t as S}from"./resolve-theme-STMsK2vc.js";import{t as C}from"./ws-auth-kXgsX2Js.js";import{Sn as w,Tn as T,xt as E}from"./index-C8nGqkKN.js";import{r as D}from"./editor-font-BNwo7zo5.js";import{r as O}from"./send-to-chat-CyZ37y5J.js";import{n as k,t as A}from"./run-in-terminal-HIdNgYim.js";import{i as j,n as M,r as N,t as P}from"./vendor-xterm-DLDtzLib.js";var F=e(t(),1);function I(e){let t=e.tokens;if(e.terminal){let n=e.terminal.ansi;return{background:t.bgSolid,foreground:t.text,cursor:e.terminal.cursor,cursorAccent:e.terminal.cursorAccent??t.bgSolid,selectionBackground:e.terminal.selection,black:n[0],red:n[1],green:n[2],yellow:n[3],blue:n[4],magenta:n[5],cyan:n[6],white:n[7],brightBlack:n[8],brightRed:n[9],brightGreen:n[10],brightYellow:n[11],brightBlue:n[12],brightMagenta:n[13],brightCyan:n[14],brightWhite:n[15]}}let n=e.mode===`dark`,r=n?`#1b1f2a`:`#2b2f38`,i=n?`#d7dce8`:`#e9edf5`,a=t.text3,o=n?`#f7f9ff`:`#ffffff`;return{background:t.bgSolid,foreground:t.text,cursor:t.accent,cursorAccent:t.bgSolid,selectionBackground:t.accentWash,black:r,red:t.error,green:t.success,yellow:t.warning,blue:t.accent,magenta:t.accent2,cyan:t.info,white:i,brightBlack:a,brightRed:t.error,brightGreen:t.success,brightYellow:t.warning,brightBlue:t.accent,brightMagenta:t.accent2,brightCyan:t.info,brightWhite:o}}function L(){let e=h.getState();return I(y()??S(e.themeStyle,e.themeMode,e.customThemes,e.customThemeId))}var R=/[).,;:'"\]}>]+$/,z=/\bhttps?:\/\/[^\s<>"'`]+/g,ee=5e3,te=100,B=250,V=3e3,H=`RESIZE:`,ne=`PING`,re=`PONG`,ie=15e3,ae=35e3;function U(e){let{sessionId:t,containerRef:n}=e,r=(0,F.useRef)(null),i=(0,F.useRef)(null),a=(0,F.useRef)(null),o=(0,F.useRef)(null),s=(0,F.useRef)(0),c=(0,F.useRef)(!1),l=(0,F.useRef)(Date.now()),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),v=(0,F.useRef)(null),y=(0,F.useRef)(null),x=e.tabId?`ppm:terminal-session:${e.tabId}`:null,S=(0,F.useRef)((()=>{if(x)try{return localStorage.getItem(x)??t}catch{}return t})()),w=(0,F.useRef)(0),E=(0,F.useRef)(-1),O=(0,F.useCallback)(e=>{let t=a.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),k=(0,F.useCallback)(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>_(!0),B)},[]),A=(0,F.useCallback)(()=>r.current?.getSelection()??``,[]),I=(0,F.useCallback)(()=>{let e=r.current;if(!e)return``;let t=e.buffer.active,n=w.current,i=t.baseY+t.cursorY,a=[];for(let e=n;e<=i;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
2
2
  `)},[]),U=(0,F.useCallback)(()=>{let e=r.current;return!e||E.current<0?``:e.buffer.active.getLine(E.current)?.translateToString(!0).trimEnd()??``},[]),W=(0,F.useCallback)(()=>{let e=r.current;if(!e)return[];let t=e.buffer.active,n=t.baseY+t.cursorY,i=Math.max(0,n-ee),a=[],o=``;for(let e=i;e<=n;e++){let n=t.getLine(e);n&&(o+=n.translateToString(!0),!t.getLine(e+1)?.isWrapped&&(a.push(o),o=``))}o&&a.push(o);let s=new Set,c=[];for(let e of a)for(let t of e.match(z)??[]){let e=t.replace(R,``);!e||s.has(e)||(s.add(e),c.push(e))}return c.reverse()},[]),G=(0,F.useCallback)(()=>{let e=r.current,t=a.current;e&&t?.readyState===WebSocket.OPEN&&t.send(`${H}${e.cols},${e.rows}`)},[]),K=(0,F.useCallback)(()=>{if(o.current&&clearTimeout(o.current),a.current?.close(),a.current=null,S.current=`new`,x)try{localStorage.removeItem(x)}catch{}s.current=0,h(!1),_(!1),d(!1),p(!1),setTimeout(()=>q(),0)},[]),q=(0,F.useCallback)(()=>{o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.onclose=null,a.current.close(),null);let t=r.current;if(!t)return;let n=window.location.protocol===`https:`?`wss:`:`ws:`,i=e.projectName??``,u=S.current,f=u===`new`&&e.cwd?`?cwd=${encodeURIComponent(e.cwd)}`:``,m=C(`/ws/project/${encodeURIComponent(i)}/terminal/${u}${f}`),g=`${n}//${window.location.host}${m}`,v=new WebSocket(g);a.current=v,v.onopen=()=>{c.current&&r.current&&r.current.clear(),c.current=!0,l.current=Date.now(),d(!0),p(!1),s.current=0,S.current===`new`&&_(!1),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>_(!0),V),G()},v.onmessage=e=>{if(l.current=Date.now(),typeof e.data==`string`){if(e.data===re)return;if(e.data.startsWith(`{`))try{let n=JSON.parse(e.data);if(n.type){if(n.type===`session`&&n.id&&(S.current=n.id,x))try{localStorage.setItem(x,n.id)}catch{}n.type===`error`&&t.write(`\r\n\x1b[31mError: ${n.message}\x1b[0m\r\n`),n.type===`exited`&&h(!0);return}}catch{}k(),t.write(e.data)}},v.onclose=()=>{d(!1),Y()},v.onerror=()=>{v.close()}},[G]),J=(0,F.useCallback)(()=>{if(document.visibilityState!==`visible`)return;let e=a.current;if(!e||e.readyState!==WebSocket.OPEN){q();return}if(Date.now()-l.current>ae){q();return}try{e.send(ne)}catch{q()}},[q]);function Y(){let e=Math.min(1e3*2**s.current,3e4);s.current++,p(!0),o.current=setTimeout(()=>{q()},e)}return(0,F.useEffect)(()=>{let e=n.current;if(!e)return;let t=new j({cursorBlink:!0,fontSize:13,scrollback:5e4,fontFamily:D,theme:L(),minimumContrastRatio:4.5}),s=new N,c=new M;if(t.loadAddon(s),t.loadAddon(c),t.open(e),!(`ontouchstart`in window||navigator.maxTouchPoints>0))try{let e=new P;e.onContextLoss(()=>e.dispose()),t.loadAddon(e)}catch{}s.fit(),r.current=t,i.current=s;let l=!1;document.fonts.ready.then(()=>{if(!(l||r.current!==t)){l=!0;try{t.options.fontFamily=D,s.fit()}catch{}}}),t.onData(e=>{if(e.includes(`\r`)||e.includes(`
3
3
  `)){let e=t.buffer.active;E.current=e.baseY+e.cursorY,w.current=E.current+1}let n=a.current;n?.readyState===WebSocket.OPEN&&n.send(e)}),q();let u=setInterval(J,ie),d=e.ownerDocument,f=()=>{d.visibilityState===`visible`&&J()};d.addEventListener(`visibilitychange`,f);let p=null,m=new ResizeObserver(e=>{let t=e[0];!t||t.contentRect.width===0||t.contentRect.height===0||(p&&clearTimeout(p),p=setTimeout(()=>{try{s.fit(),G()}catch{}},te))});m.observe(e);let h=T(e,()=>{try{s.fit(),G()}catch{}}),g=()=>{t.options.theme=L()};window.addEventListener(b,g);let _=()=>window.removeEventListener(b,g),x=()=>{if(r.current===t)try{t.clearTextureAtlas(),t.refresh(0,t.rows-1)}catch{}};return document.fonts.addEventListener(`loadingdone`,x),()=>{_(),document.fonts.removeEventListener(`loadingdone`,x),h(),p&&clearTimeout(p),m.disconnect(),clearInterval(u),d.removeEventListener(`visibilitychange`,f),o.current&&clearTimeout(o.current),v.current&&clearTimeout(v.current),y.current&&clearTimeout(y.current),a.current?.close(),a.current=null,t.dispose(),r.current=null,i.current=null}},[]),{connected:u,reconnecting:f,exited:m,shellReady:g,sendData:O,getSelection:A,getLastCommandOutput:I,getLastCommand:U,getBufferUrls:W,restart:K}}function W(e,t,n){return new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:0,buttons:n,detail:1})}function G(e,t){(0,F.useEffect)(()=>{let n=e.current;if(!t||!n)return;let r=n.querySelector(`.xterm`);if(!r)return;let i=e=>{let t=e.touches[0];!t||e.touches.length>1||(e.preventDefault(),e.stopPropagation(),r.dispatchEvent(W(`mousedown`,t,1)))},a=e=>{let t=e.touches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(W(`mousemove`,t,1)))},o=e=>{let t=e.changedTouches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(W(`mouseup`,t,0)))},s={capture:!0,passive:!1};return n.addEventListener(`touchstart`,i,s),n.addEventListener(`touchmove`,a,s),n.addEventListener(`touchend`,o,s),n.addEventListener(`touchcancel`,o,s),()=>{n.removeEventListener(`touchstart`,i,s),n.removeEventListener(`touchmove`,a,s),n.removeEventListener(`touchend`,o,s),n.removeEventListener(`touchcancel`,o,s)}},[e,t])}var K=40;function q(e){if(!e||typeof e.checkVisibility==`function`&&!e.checkVisibility({visibilityProperty:!0}))return!1;let t=e.getBoundingClientRect();return t.width<K||t.height<K?!1:t.bottom>0&&t.right>0&&t.top<window.innerHeight&&t.left<window.innerWidth}function J({tabId:e,metadata:t,shellReady:n,sendData:r,focusTerminal:i,containerRef:a}){let o=(0,F.useRef)(null),[s,c]=(0,F.useState)(0),l=(0,F.useCallback)(e=>{o.current=e,c(e=>e+1)},[]),u=t?.pendingCommand;(0,F.useEffect)(()=>{if(!(typeof u!=`string`||!u)&&(l(u),e)){let n={...t??{}};delete n.pendingCommand,_.getState().updateTab(e,{metadata:n})}},[u,e,l]),(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;t?.command&&q(a.current)&&(l(t.command),window.dispatchEvent(new Event(A)))};return window.addEventListener(k,e),()=>window.removeEventListener(k,e)},[a,l]),(0,F.useEffect)(()=>{if(!n)return;let e=o.current;e&&(o.current=null,r(e),i())},[n,s,r,i])}var Y=n(),oe=[{label:`Tab`,value:` `},{label:`Esc`,value:`\x1B`},{label:`Ctrl`,value:null},{label:`↑`,value:`\x1B[A`},{label:`↓`,value:`\x1B[B`},{label:`←`,value:`\x1B[D`},{label:`→`,value:`\x1B[C`},{label:`^C`,value:``}],X=`flex items-center justify-center shrink-0 min-w-11 min-h-11 rounded text-xs bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`;function se({ctrlMode:e,onToggleCtrl:t,selectMode:n,onToggleSelect:r,onKey:i,onCopy:a,onPaste:l,onSendToChat:d,onOpenLinks:p}){return(0,Y.jsxs)(`div`,{className:`relative shrink-0 bg-surface border-t border-border`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,Y.jsx)(`button`,{onClick:r,"aria-label":`Select text`,"aria-pressed":n,className:g(X,n&&`bg-primary text-primary-foreground`),children:(0,Y.jsx)(o,{size:16})}),(0,Y.jsx)(`button`,{onClick:a,"aria-label":`Copy`,className:X,children:(0,Y.jsx)(c,{size:16})}),(0,Y.jsx)(`button`,{onClick:l,"aria-label":`Paste`,className:X,children:(0,Y.jsx)(u,{size:16})}),(0,Y.jsx)(`button`,{onClick:p,"aria-label":`Links`,className:X,children:(0,Y.jsx)(s,{size:16})}),(0,Y.jsx)(`button`,{onClick:d,"aria-label":`Send to Chat`,className:X,children:(0,Y.jsx)(f,{size:16})}),(0,Y.jsx)(`div`,{className:`w-px h-6 shrink-0 bg-border mx-0.5`}),oe.map(n=>(0,Y.jsx)(`button`,{onClick:()=>n.value===null?t():i(n.value),className:g(X,`font-mono`,n.value===null&&e&&`bg-primary text-primary-foreground`),children:n.label},n.label)),(0,Y.jsx)(`div`,{className:`w-6 shrink-0`,"aria-hidden":!0})]}),(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-surface to-transparent`,"aria-hidden":!0})]})}var ce=new Set([`localhost`,`::1`]);function Z(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();return ce.has(t)?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)}function Q(e){let t;try{t=new URL(e)}catch{return null}let n=t.searchParams.get(`redirect_uri`)??t.searchParams.get(`redirectUri`);if(!n)return null;try{let e=new URL(n);return Z(e.hostname)?e.port||(e.protocol===`https:`?`443`:`80`):null}catch{return null}}function $(e){try{let t=new URL(e.trim());return(t.protocol===`http:`||t.protocol===`https:`)&&Z(t.hostname)}catch{return!1}}function le({onDone:e}){let[t,n]=(0,F.useState)(``),[r,i]=(0,F.useState)(!1),a=t.trim(),o=!r&&$(a),s=async()=>{i(!0);try{await p.post(`/api/loopback/callback`,{url:a}),m.success(`Sent to the waiting command`,{duration:2e3}),n(``),e()}catch(e){m.error(e.message,{duration:4e3})}finally{i(!1)}};return(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-border px-3 py-3`,children:[(0,Y.jsx)(`p`,{className:`pb-2 text-[11px] leading-snug text-text-secondary`,children:`Finished signing in and landed on a page that would not load? Paste that address here — the machine will deliver it to the command still waiting.`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),inputMode:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,placeholder:`http://127.0.0.1:54132/oauth/callback?code=…`,"aria-label":`Callback address`,className:`h-11 min-w-0 flex-1 rounded-lg border border-border bg-surface px-3 font-mono text-xs text-foreground placeholder:text-text-subtle`}),(0,Y.jsx)(`button`,{onClick:()=>void s(),disabled:!o,"aria-label":`Finish login`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground disabled:opacity-40 active:opacity-80 transition-opacity`,children:r?(0,Y.jsx)(d,{className:`size-4 animate-spin`}):(0,Y.jsx)(l,{className:`size-4`})})]}),a!==``&&!$(a)&&(0,Y.jsx)(`p`,{className:`pt-1.5 text-[11px] text-error`,children:`Needs to be the http://127.0.0.1:… address the sign-in redirected to.`})]})}function ue({open:e,onClose:t,urls:n}){let r=async e=>{let n=await w(e);m[n?`success`:`error`](n?`Link copied`:`Could not copy link`,{duration:1500}),t()},o=[...new Set(n.map(Q).filter(e=>!!e))];return(0,Y.jsxs)(x,{open:e,onClose:t,zIndex:70,className:`flex flex-col max-h-[70vh]`,children:[(0,Y.jsx)(`div`,{className:`shrink-0 px-4 pb-2 text-xs font-medium text-text-secondary`,children:n.length>0?`Links in terminal (${n.length})`:`Links in terminal`}),(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2`,children:n.length===0?(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-text-secondary`,children:[(0,Y.jsx)(a,{className:`size-5 text-text-subtle`}),`No links found in the visible scrollback.`]}):n.map(e=>{let n=Q(e);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-stretch gap-1`,children:[(0,Y.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,onClick:t,className:`flex min-h-11 flex-1 min-w-0 items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground active:bg-accent transition-colors`,children:[(0,Y.jsx)(i,{className:`size-4 shrink-0 text-text-subtle`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left font-mono text-xs`,children:e})]}),(0,Y.jsx)(`button`,{onClick:()=>void r(e),"aria-label":`Copy ${e}`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg text-text-secondary active:bg-accent transition-colors`,children:(0,Y.jsx)(c,{className:`size-4`})})]}),n&&(0,Y.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] leading-snug text-text-secondary`,children:[`Signing in here sends you back to port `,n,` `,(0,Y.jsx)(`strong`,{children:`on the machine`}),`, not this device — so the terminal keeps waiting. Afterwards, paste the address bar below to finish it.`]})]},e)})}),o.length>0&&(0,Y.jsx)(le,{onDone:t})]})}var de=(0,F.memo)(function({metadata:e,tabId:t}){let n=e?.sessionId??`new`,i=e?.projectName,a=e?.cwd,o=(0,F.useRef)(null),{connected:s,reconnecting:c,exited:l,shellReady:u,sendData:d,getSelection:p,getLastCommandOutput:h,getLastCommand:_,getBufferUrls:y,restart:b}=U({sessionId:n,projectName:i,cwd:a,containerRef:o,tabId:t}),[x,S]=(0,F.useState)(!1),[C,T]=(0,F.useState)(!1),[D,k]=(0,F.useState)(!1),A=v(e=>e.activeTabId),[j,M]=(0,F.useState)(0);(0,F.useEffect)(()=>{let e=()=>M(e=>e+1);return window.addEventListener(`ppm:onboarding-refresh`,e),()=>window.removeEventListener(`ppm:onboarding-refresh`,e)},[]),(0,F.useEffect)(()=>{if(!i||!t||A!==t||!s||!u||c||l)return;let e=!!o.current?.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});e&&E({type:`terminal-ready`,projectName:i,tabId:t,visible:e})},[j,i,t,A,s,u,c,l]),G(o,C);let N=(0,F.useCallback)(()=>{(o.current?.querySelector(`.xterm-helper-textarea`))?.focus()},[]);J({tabId:t,metadata:e,shellReady:u,sendData:d,focusTerminal:N,containerRef:o}),(0,F.useEffect)(()=>{let e=o.current;if(!e||C)return;let t=()=>N();return e.addEventListener(`touchend`,t,{capture:!0}),()=>e.removeEventListener(`touchend`,t,{capture:!0})},[N,C]);let P=(0,F.useCallback)(e=>{if(N(),x&&e.length===1){let t=e.toLowerCase().charCodeAt(0)-96;t>=1&&t<=26&&d(String.fromCharCode(t)),S(!1);return}d(e)},[x,d,N]),I=(0,F.useCallback)(async()=>{let e=p(),t=e||h();if(!t.trim()){m(`Nothing to copy`,{duration:1500});return}let n=await w(t);m[n?`success`:`error`](n?e?`Selection copied`:`Last output copied`:`Could not copy`,{duration:1500})},[p,h]),L=(0,F.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&(d(e),N())}catch{m.error(`Clipboard blocked — paste with the keyboard instead`,{duration:2500})}},[d,N]),R=(0,F.useCallback)(()=>{let e=p(),t=e||h();if(!t.trim())return;let n=e?``:_();O({text:"```bash\n"+(n?`${n}\n${t}`:t)+"\n```",label:e?`Terminal selection`:`Terminal output`,projectName:i}),m.success(`Sent to chat`,{duration:1500})},[p,h,_,i]),z=typeof window<`u`&&`ontouchstart`in window;return(0,Y.jsxs)(`div`,{"data-onboarding":`terminal`,className:`flex flex-col h-full min-h-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1 bg-surface border-b border-border text-xs`,children:[(0,Y.jsx)(`span`,{className:g(`size-2 rounded-full`,l?`bg-error`:s?`bg-success`:c?`bg-warning`:`bg-error`)}),(0,Y.jsx)(`span`,{className:`text-text-secondary`,children:l?`Process exited`:s?`Connected`:c?`Reconnecting...`:`Disconnected`}),l&&(0,Y.jsxs)(`button`,{onClick:b,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors`,children:[(0,Y.jsx)(r,{size:10}),`Restart`]}),(0,Y.jsxs)(`button`,{onClick:R,title:`Send to Chat`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors ml-auto`,children:[(0,Y.jsx)(f,{size:10}),`Chat`]}),(0,Y.jsx)(`span`,{className:`text-text-subtle font-mono`,children:n})]}),(0,Y.jsx)(`div`,{ref:o,onClick:C?void 0:N,className:g(`flex-1 min-h-0 bg-background p-1`,C&&`touch-none`)}),z&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(se,{ctrlMode:x,onToggleCtrl:()=>S(!x),selectMode:C,onToggleSelect:()=>T(!C),onKey:P,onCopy:()=>void I(),onPaste:()=>void L(),onSendToChat:R,onOpenLinks:()=>k(!0)}),(0,Y.jsx)(ue,{open:D,onClose:()=>k(!1),urls:D?y():[]})]})]})});export{de as TerminalTab};