@hienlh/ppm 0.23.26 → 0.23.27

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 (586) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/accounts-settings-section-CZglHifc.js +1 -0
  5. package/dist/web/assets/accounts-settings-section-CZglHifc.js.br +0 -0
  6. package/dist/web/assets/accounts-settings-section-CZglHifc.js.gz +0 -0
  7. package/dist/web/assets/{agent-session-sheet-DmbSfFGz.js → agent-session-sheet-B3VLD2H6.js} +2 -2
  8. package/dist/web/assets/agent-session-sheet-B3VLD2H6.js.br +0 -0
  9. package/dist/web/assets/agent-session-sheet-B3VLD2H6.js.gz +0 -0
  10. package/dist/web/assets/{agent-session-window-content-Dk8x3ozF.js → agent-session-window-content-HEdIT_LQ.js} +1 -1
  11. package/dist/web/assets/agent-session-window-content-HEdIT_LQ.js.br +0 -0
  12. package/dist/web/assets/agent-session-window-content-HEdIT_LQ.js.gz +0 -0
  13. package/dist/web/assets/{ai-resource-editor-MKwjYcDh.js → ai-resource-editor-CFbXgGMo.js} +1 -1
  14. package/dist/web/assets/ai-resource-editor-CFbXgGMo.js.br +0 -0
  15. package/dist/web/assets/ai-resource-editor-CFbXgGMo.js.gz +0 -0
  16. package/dist/web/assets/ai-settings-section-BNiVD9D3.js +1 -0
  17. package/dist/web/assets/ai-settings-section-BNiVD9D3.js.br +0 -0
  18. package/dist/web/assets/ai-settings-section-BNiVD9D3.js.gz +0 -0
  19. package/dist/web/assets/{ai-settings-section-OZOaLw5z.js → ai-settings-section-W0kfADRB.js} +1 -1
  20. package/dist/web/assets/{android-tab-CUkjbfyi.js → android-tab-CY3aa_vU.js} +1 -1
  21. package/dist/web/assets/android-tab-CY3aa_vU.js.br +0 -0
  22. package/dist/web/assets/android-tab-CY3aa_vU.js.gz +0 -0
  23. package/dist/web/assets/{appearance-settings-section-BZsM8HpZ.js → appearance-settings-section-lbtuzecW.js} +1 -1
  24. package/dist/web/assets/appearance-settings-section-lbtuzecW.js.br +0 -0
  25. package/dist/web/assets/appearance-settings-section-lbtuzecW.js.gz +0 -0
  26. package/dist/web/assets/{apps-panel-Cs3utBlp.js → apps-panel-CF2mbvVq.js} +1 -1
  27. package/dist/web/assets/apps-panel-CF2mbvVq.js.br +0 -0
  28. package/dist/web/assets/apps-panel-CF2mbvVq.js.gz +0 -0
  29. package/dist/web/assets/branch-review-tab-CR7JnS5x.js +1 -0
  30. package/dist/web/assets/branch-review-tab-CR7JnS5x.js.br +0 -0
  31. package/dist/web/assets/branch-review-tab-CR7JnS5x.js.gz +0 -0
  32. package/dist/web/assets/chat-tab-BCELq4nK.js +1 -0
  33. package/dist/web/assets/chat-tab-BCELq4nK.js.br +0 -0
  34. package/dist/web/assets/chat-tab-BCELq4nK.js.gz +0 -0
  35. package/dist/web/assets/{chat-tab-DtSHSfMU.js → chat-tab-C4aOYSea.js} +10 -10
  36. package/dist/web/assets/chat-tab-C4aOYSea.js.br +0 -0
  37. package/dist/web/assets/chat-tab-C4aOYSea.js.gz +0 -0
  38. package/dist/web/assets/{code-editor-DjDyhff1.js → code-editor-_axJbYkP.js} +5 -5
  39. package/dist/web/assets/code-editor-_axJbYkP.js.br +0 -0
  40. package/dist/web/assets/code-editor-_axJbYkP.js.gz +0 -0
  41. package/dist/web/assets/{codex-reset-credit-button-BKgiUi8E.js → codex-reset-credit-button-DJQD6NUF.js} +1 -1
  42. package/dist/web/assets/codex-reset-credit-button-DJQD6NUF.js.br +0 -0
  43. package/dist/web/assets/codex-reset-credit-button-DJQD6NUF.js.gz +0 -0
  44. package/dist/web/assets/{conflict-editor-DgTv-8pb.js → conflict-editor-D0AYuLKI.js} +3 -3
  45. package/dist/web/assets/conflict-editor-D0AYuLKI.js.br +0 -0
  46. package/dist/web/assets/conflict-editor-D0AYuLKI.js.gz +0 -0
  47. package/dist/web/assets/connection-form-tab-C3QyUWnE.js +4 -0
  48. package/dist/web/assets/connection-form-tab-C3QyUWnE.js.br +0 -0
  49. package/dist/web/assets/connection-form-tab-C3QyUWnE.js.gz +0 -0
  50. package/dist/web/assets/{csv-preview-BTGpYs4p.js → csv-preview-CmKkcz4M.js} +1 -1
  51. package/dist/web/assets/csv-preview-CmKkcz4M.js.br +0 -0
  52. package/dist/web/assets/csv-preview-CmKkcz4M.js.gz +0 -0
  53. package/dist/web/assets/{db-explorer-store-DDePT3UI.js → db-explorer-store-DJNNIfN5.js} +1 -1
  54. package/dist/web/assets/db-explorer-store-DJNNIfN5.js.br +0 -0
  55. package/dist/web/assets/db-explorer-store-DJNNIfN5.js.gz +0 -0
  56. package/dist/web/assets/{db-sidebar-reveal-BeT8cp6P.js → db-sidebar-reveal-CGqWBYay.js} +1 -1
  57. package/dist/web/assets/db-sidebar-reveal-CGqWBYay.js.br +0 -0
  58. package/dist/web/assets/db-sidebar-reveal-CGqWBYay.js.gz +0 -0
  59. package/dist/web/assets/{db-tab-parts-BYzd4_sR.js → db-tab-parts-BXL34wrZ.js} +1 -1
  60. package/dist/web/assets/db-tab-parts-BXL34wrZ.js.br +0 -0
  61. package/dist/web/assets/db-tab-parts-BXL34wrZ.js.gz +0 -0
  62. package/dist/web/assets/{design-settings-section-B3KQBggK.js → design-settings-section-DukfVtwP.js} +2 -2
  63. package/dist/web/assets/design-settings-section-DukfVtwP.js.br +0 -0
  64. package/dist/web/assets/design-settings-section-DukfVtwP.js.gz +0 -0
  65. package/dist/web/assets/{design-tab-CPyj_nFg.js → design-tab-BoPiL2ge.js} +5 -5
  66. package/dist/web/assets/design-tab-BoPiL2ge.js.br +0 -0
  67. package/dist/web/assets/design-tab-BoPiL2ge.js.gz +0 -0
  68. package/dist/web/assets/{designs-sidebar-panel-DIGPFo2l.js → designs-sidebar-panel-BVTqPPzG.js} +1 -1
  69. package/dist/web/assets/designs-sidebar-panel-BVTqPPzG.js.br +0 -0
  70. package/dist/web/assets/designs-sidebar-panel-BVTqPPzG.js.gz +0 -0
  71. package/dist/web/assets/diff-viewer-C86mR7vD.js +4 -0
  72. package/dist/web/assets/diff-viewer-C86mR7vD.js.br +0 -0
  73. package/dist/web/assets/diff-viewer-C86mR7vD.js.gz +0 -0
  74. package/dist/web/assets/{docx-preview-CowHGqML.js → docx-preview-B9EhDCMi.js} +1 -1
  75. package/dist/web/assets/docx-preview-B9EhDCMi.js.br +0 -0
  76. package/dist/web/assets/docx-preview-B9EhDCMi.js.gz +0 -0
  77. package/dist/web/assets/{editor-dialog-xPoehDYp.js → editor-dialog-DTDsbJd6.js} +1 -1
  78. package/dist/web/assets/editor-dialog-DTDsbJd6.js.br +0 -0
  79. package/dist/web/assets/editor-dialog-DTDsbJd6.js.gz +0 -0
  80. package/dist/web/assets/{editor-language-service-DdYqCDBU.js → editor-language-service-BtrrQAS2.js} +1 -1
  81. package/dist/web/assets/editor-language-service-BtrrQAS2.js.br +0 -0
  82. package/dist/web/assets/editor-language-service-BtrrQAS2.js.gz +0 -0
  83. package/dist/web/assets/explorer-body-DLaWmxri.js +2 -0
  84. package/dist/web/assets/explorer-body-DLaWmxri.js.br +0 -0
  85. package/dist/web/assets/explorer-body-DLaWmxri.js.gz +0 -0
  86. package/dist/web/assets/{explorer-model-tGyFETP_.js → explorer-model-f5q-50DN.js} +1 -1
  87. package/dist/web/assets/explorer-model-f5q-50DN.js.br +0 -0
  88. package/dist/web/assets/explorer-model-f5q-50DN.js.gz +0 -0
  89. package/dist/web/assets/{explorer-window-content-B1c4QTVL.js → explorer-window-content-CbUIbrzL.js} +1 -1
  90. package/dist/web/assets/explorer-window-content-CbUIbrzL.js.br +0 -0
  91. package/dist/web/assets/explorer-window-content-CbUIbrzL.js.gz +0 -0
  92. package/dist/web/assets/{extension-manager-section-BgL0Uyl3.js → extension-manager-section-BpKMyLwI.js} +1 -1
  93. package/dist/web/assets/extension-manager-section-BpKMyLwI.js.br +0 -0
  94. package/dist/web/assets/extension-manager-section-BpKMyLwI.js.gz +0 -0
  95. package/dist/web/assets/{extension-webview-BWB1Yd-t.js → extension-webview-BGfyaXMI.js} +1 -1
  96. package/dist/web/assets/extension-webview-BGfyaXMI.js.br +0 -0
  97. package/dist/web/assets/extension-webview-BGfyaXMI.js.gz +0 -0
  98. package/dist/web/assets/{files-settings-section-TmoewoO2.js → files-settings-section-CQT9_rX2.js} +1 -1
  99. package/dist/web/assets/files-settings-section-CQT9_rX2.js.br +0 -0
  100. package/dist/web/assets/files-settings-section-CQT9_rX2.js.gz +0 -0
  101. package/dist/web/assets/{general-settings-section-Bu7o8uUn.js → general-settings-section-BoQGeqBi.js} +1 -1
  102. package/dist/web/assets/general-settings-section-BoQGeqBi.js.br +0 -0
  103. package/dist/web/assets/general-settings-section-BoQGeqBi.js.gz +0 -0
  104. package/dist/web/assets/{git-log-panel-RjMZIaCk.js → git-log-panel-T8Fzn8-5.js} +1 -1
  105. package/dist/web/assets/git-log-panel-T8Fzn8-5.js.br +0 -0
  106. package/dist/web/assets/git-log-panel-T8Fzn8-5.js.gz +0 -0
  107. package/dist/web/assets/git-review-tab-WzuX4Ml9.js +3 -0
  108. package/dist/web/assets/git-review-tab-WzuX4Ml9.js.br +0 -0
  109. package/dist/web/assets/git-review-tab-WzuX4Ml9.js.gz +0 -0
  110. package/dist/web/assets/{glide-data-grid-DqlTFhhf.js → glide-data-grid-BBzGDYvj.js} +8 -8
  111. package/dist/web/assets/glide-data-grid-BBzGDYvj.js.br +0 -0
  112. package/dist/web/assets/glide-data-grid-BBzGDYvj.js.gz +0 -0
  113. package/dist/web/assets/{grid-save-dialog-BmF2Gy_E.js → grid-save-dialog-HiqlnSky.js} +1 -1
  114. package/dist/web/assets/grid-save-dialog-HiqlnSky.js.br +0 -0
  115. package/dist/web/assets/grid-save-dialog-HiqlnSky.js.gz +0 -0
  116. package/dist/web/assets/group-chat-tab-URU3FCLs.js +1 -0
  117. package/dist/web/assets/group-chat-tab-URU3FCLs.js.br +0 -0
  118. package/dist/web/assets/group-chat-tab-URU3FCLs.js.gz +0 -0
  119. package/dist/web/assets/{impexp-tab-B8d4oBOB.js → impexp-tab-B0m1Q8ia.js} +1 -1
  120. package/dist/web/assets/impexp-tab-B0m1Q8ia.js.br +0 -0
  121. package/dist/web/assets/impexp-tab-B0m1Q8ia.js.gz +0 -0
  122. package/dist/web/assets/index-Cb3Z6wNy.css +1 -0
  123. package/dist/web/assets/index-Cb3Z6wNy.css.br +0 -0
  124. package/dist/web/assets/{index-2_Pz5MiI.css.gz → index-Cb3Z6wNy.css.gz} +0 -0
  125. package/dist/web/assets/{index-Cx9ZRibz.js → index-Vd9Xr54k.js} +19 -19
  126. package/dist/web/assets/index-Vd9Xr54k.js.br +0 -0
  127. package/dist/web/assets/index-Vd9Xr54k.js.gz +0 -0
  128. package/dist/web/assets/{jira-watcher-section-LGTWVN87.js → jira-watcher-section-CnSTbAF6.js} +1 -1
  129. package/dist/web/assets/keybindings-store-D_U8jECl.js +1 -0
  130. package/dist/web/assets/{keyboard-shortcuts-section-BSMgmbOR.js → keyboard-shortcuts-section-CU7JjDsU.js} +1 -1
  131. package/dist/web/assets/keyboard-shortcuts-section-CU7JjDsU.js.br +0 -0
  132. package/dist/web/assets/keyboard-shortcuts-section-CU7JjDsU.js.gz +0 -0
  133. package/dist/web/assets/{language-servers-section-DO9wnwnG.js → language-servers-section-CzUG9H69.js} +2 -2
  134. package/dist/web/assets/language-servers-section-CzUG9H69.js.br +0 -0
  135. package/dist/web/assets/language-servers-section-CzUG9H69.js.gz +0 -0
  136. package/dist/web/assets/logs-app-CDSvyY1H.js +13 -0
  137. package/dist/web/assets/logs-app-CDSvyY1H.js.br +0 -0
  138. package/dist/web/assets/logs-app-CDSvyY1H.js.gz +0 -0
  139. package/dist/web/assets/logs-tab-CQw9vrNw.js +1 -0
  140. package/dist/web/assets/{logs-window-content-Cejko0VD.js → logs-window-content-CGvPnPrr.js} +1 -1
  141. package/dist/web/assets/{lsp-client-IsC8Ol0U.js → lsp-client-CpjPUUYJ.js} +1 -1
  142. package/dist/web/assets/lsp-client-CpjPUUYJ.js.br +0 -0
  143. package/dist/web/assets/lsp-client-CpjPUUYJ.js.gz +0 -0
  144. package/dist/web/assets/{markdown-renderer-D5vxN2fO.js → markdown-renderer-3ZR2x0CC.js} +1 -1
  145. package/dist/web/assets/{markdown-renderer-BfZiHaNy.js → markdown-renderer-DZNMRg6p.js} +2 -2
  146. package/dist/web/assets/markdown-renderer-DZNMRg6p.js.br +0 -0
  147. package/dist/web/assets/markdown-renderer-DZNMRg6p.js.gz +0 -0
  148. package/dist/web/assets/{mobile-explorer-sheet-Dz3eJdBl.js → mobile-explorer-sheet-D7e-MM6m.js} +1 -1
  149. package/dist/web/assets/mobile-explorer-sheet-D7e-MM6m.js.br +0 -0
  150. package/dist/web/assets/mobile-explorer-sheet-D7e-MM6m.js.gz +0 -0
  151. package/dist/web/assets/{new-design-dialog-B8zeJoJQ.js → new-design-dialog-BthM423i.js} +1 -1
  152. package/dist/web/assets/new-design-dialog-BthM423i.js.br +0 -0
  153. package/dist/web/assets/new-design-dialog-BthM423i.js.gz +0 -0
  154. package/dist/web/assets/notification-store-GKweleCQ.js +1 -0
  155. package/dist/web/assets/{notifications-settings-section-CMZXQw72.js → notifications-settings-section-TS3gNFcc.js} +1 -1
  156. package/dist/web/assets/notifications-settings-section-TS3gNFcc.js.br +0 -0
  157. package/dist/web/assets/notifications-settings-section-TS3gNFcc.js.gz +0 -0
  158. package/dist/web/assets/{open-db-tabs-DYTZbguT.js → open-db-tabs-DBgV2hbA.js} +1 -1
  159. package/dist/web/assets/open-db-tabs-DBgV2hbA.js.br +0 -0
  160. package/dist/web/assets/open-db-tabs-DBgV2hbA.js.gz +0 -0
  161. package/dist/web/assets/{open-settings-BGtoVEAU.js → open-settings-DWbF5YsE.js} +1 -1
  162. package/dist/web/assets/{overview-panel-7_8b6pwr.js → overview-panel-C5EmTk1R.js} +1 -1
  163. package/dist/web/assets/overview-panel-C5EmTk1R.js.br +0 -0
  164. package/dist/web/assets/overview-panel-C5EmTk1R.js.gz +0 -0
  165. package/dist/web/assets/{panel-store-Dx2ziBLp.js → panel-store-H7e9XHZF.js} +1 -1
  166. package/dist/web/assets/panel-store-H7e9XHZF.js.br +0 -0
  167. package/dist/web/assets/panel-store-H7e9XHZF.js.gz +0 -0
  168. package/dist/web/assets/{patch-tab-metadata-DTbCkVvx.js → patch-tab-metadata-DqvfqUI4.js} +1 -1
  169. package/dist/web/assets/{performance-panel-COQNCyEU.js → performance-panel-Jwab-_Z2.js} +1 -1
  170. package/dist/web/assets/performance-panel-Jwab-_Z2.js.br +0 -0
  171. package/dist/web/assets/performance-panel-Jwab-_Z2.js.gz +0 -0
  172. package/dist/web/assets/{ppmbot-settings-section-CmhbbZVI.js → ppmbot-settings-section-D8jIlmp8.js} +1 -1
  173. package/dist/web/assets/ppmbot-settings-section-D8jIlmp8.js.br +0 -0
  174. package/dist/web/assets/ppmbot-settings-section-D8jIlmp8.js.gz +0 -0
  175. package/dist/web/assets/{pptx-export-COeBmnFJ.js → pptx-export-gXOWUZXL.js} +3 -3
  176. package/dist/web/assets/pptx-export-gXOWUZXL.js.br +0 -0
  177. package/dist/web/assets/pptx-export-gXOWUZXL.js.gz +0 -0
  178. package/dist/web/assets/{problems-panel-I0EYfa1S.js → problems-panel-DjCHA1r5.js} +1 -1
  179. package/dist/web/assets/problems-panel-DjCHA1r5.js.br +0 -0
  180. package/dist/web/assets/problems-panel-DjCHA1r5.js.gz +0 -0
  181. package/dist/web/assets/{process-table-or-X8Lwh.js → process-table-BxXEh4tN.js} +1 -1
  182. package/dist/web/assets/process-table-BxXEh4tN.js.br +0 -0
  183. package/dist/web/assets/process-table-BxXEh4tN.js.gz +0 -0
  184. package/dist/web/assets/{proxy-settings-section-DpJ6ok4C.js → proxy-settings-section-B8igco2L.js} +1 -1
  185. package/dist/web/assets/proxy-settings-section-B8igco2L.js.br +0 -0
  186. package/dist/web/assets/proxy-settings-section-B8igco2L.js.gz +0 -0
  187. package/dist/web/assets/{query-tab-DeNZMZHX.js → query-tab-DHU3ANHN.js} +3 -3
  188. package/dist/web/assets/query-tab-DHU3ANHN.js.br +0 -0
  189. package/dist/web/assets/query-tab-DHU3ANHN.js.gz +0 -0
  190. package/dist/web/assets/release-notes-window-content-B33RDfFY.js +1 -0
  191. package/dist/web/assets/remote-access-settings-section-CoYQTFKd.js +1 -0
  192. package/dist/web/assets/remote-access-settings-section-CoYQTFKd.js.br +0 -0
  193. package/dist/web/assets/remote-access-settings-section-CoYQTFKd.js.gz +0 -0
  194. package/dist/web/assets/{remote-desktop-clipboard-notice-CGDBpXMf.js → remote-desktop-clipboard-notice-Dwn-iV4g.js} +1 -1
  195. package/dist/web/assets/remote-desktop-clipboard-notice-Dwn-iV4g.js.br +0 -0
  196. package/dist/web/assets/remote-desktop-clipboard-notice-Dwn-iV4g.js.gz +0 -0
  197. package/dist/web/assets/{remote-desktop-mobile-sheet-6nXirdqZ.js → remote-desktop-mobile-sheet-bfKiSG0C.js} +2 -2
  198. package/dist/web/assets/remote-desktop-mobile-sheet-bfKiSG0C.js.br +0 -0
  199. package/dist/web/assets/remote-desktop-mobile-sheet-bfKiSG0C.js.gz +0 -0
  200. package/dist/web/assets/{remote-desktop-mobile-view-BTaj9Flo.js → remote-desktop-mobile-view-CV8eHh4A.js} +1 -1
  201. package/dist/web/assets/remote-desktop-mobile-view-CV8eHh4A.js.br +0 -0
  202. package/dist/web/assets/remote-desktop-mobile-view-CV8eHh4A.js.gz +0 -0
  203. package/dist/web/assets/{remote-desktop-readiness-gate--gtmfqZh.js → remote-desktop-readiness-gate-DrSYb_9z.js} +1 -1
  204. package/dist/web/assets/remote-desktop-readiness-gate-DrSYb_9z.js.br +0 -0
  205. package/dist/web/assets/remote-desktop-readiness-gate-DrSYb_9z.js.gz +0 -0
  206. package/dist/web/assets/{remote-desktop-settings-section-Bs5avYaS.js → remote-desktop-settings-section-DRO8n8t7.js} +1 -1
  207. package/dist/web/assets/remote-desktop-settings-section-DRO8n8t7.js.br +0 -0
  208. package/dist/web/assets/remote-desktop-settings-section-DRO8n8t7.js.gz +0 -0
  209. package/dist/web/assets/{remote-desktop-window-content-D4CM-28B.js → remote-desktop-window-content-CAuxeGbK.js} +1 -1
  210. package/dist/web/assets/remote-desktop-window-content-CAuxeGbK.js.br +0 -0
  211. package/dist/web/assets/remote-desktop-window-content-CAuxeGbK.js.gz +0 -0
  212. package/dist/web/assets/{rename-object-dialog-Dv4iLwnf.js → rename-object-dialog-BPuh3dAH.js} +1 -1
  213. package/dist/web/assets/rename-object-dialog-BPuh3dAH.js.br +0 -0
  214. package/dist/web/assets/rename-object-dialog-BPuh3dAH.js.gz +0 -0
  215. package/dist/web/assets/review-address-setup-CoI2BGdx.js +1 -0
  216. package/dist/web/assets/review-address-setup-CoI2BGdx.js.br +0 -0
  217. package/dist/web/assets/review-address-setup-CoI2BGdx.js.gz +0 -0
  218. package/dist/web/assets/{review-code-Bet53hHb.js → review-code-Dy8y4_17.js} +1 -1
  219. package/dist/web/assets/review-code-Dy8y4_17.js.br +0 -0
  220. package/dist/web/assets/review-code-Dy8y4_17.js.gz +0 -0
  221. package/dist/web/assets/{run-in-terminal-EVMb5TjW.js → run-in-terminal-DAdjH24K.js} +1 -1
  222. package/dist/web/assets/{run-in-terminal-button-CsYq6Xqo.js → run-in-terminal-button-Bu165IH-.js} +1 -1
  223. package/dist/web/assets/{save-as-dialog-DHkBsS-6.js → save-as-dialog-C9OpJz2x.js} +1 -1
  224. package/dist/web/assets/save-as-dialog-C9OpJz2x.js.br +0 -0
  225. package/dist/web/assets/save-as-dialog-C9OpJz2x.js.gz +0 -0
  226. package/dist/web/assets/{schedule-script-editor-CKUl2qxf.js → schedule-script-editor--roOsFbc.js} +1 -1
  227. package/dist/web/assets/schedule-script-editor--roOsFbc.js.br +0 -0
  228. package/dist/web/assets/schedule-script-editor--roOsFbc.js.gz +0 -0
  229. package/dist/web/assets/{schedules-settings-section-EoOXzqF3.js → schedules-settings-section-BTn_NSzU.js} +3 -3
  230. package/dist/web/assets/schedules-settings-section-BTn_NSzU.js.br +0 -0
  231. package/dist/web/assets/schedules-settings-section-BTn_NSzU.js.gz +0 -0
  232. package/dist/web/assets/{send-to-chat-B7oUVcgh.js → send-to-chat-BUxj21hD.js} +1 -1
  233. package/dist/web/assets/send-to-chat-BUxj21hD.js.br +0 -0
  234. package/dist/web/assets/send-to-chat-BUxj21hD.js.gz +0 -0
  235. package/dist/web/assets/{services-panel-BceuL_SU.js → services-panel-BynENSs6.js} +1 -1
  236. package/dist/web/assets/services-panel-BynENSs6.js.br +0 -0
  237. package/dist/web/assets/services-panel-BynENSs6.js.gz +0 -0
  238. package/dist/web/assets/{session-changes-bar-CjSxBYOF.js → session-changes-bar-Dz3QitdJ.js} +1 -1
  239. package/dist/web/assets/session-changes-bar-Dz3QitdJ.js.br +0 -0
  240. package/dist/web/assets/session-changes-bar-Dz3QitdJ.js.gz +0 -0
  241. package/dist/web/assets/{session-review-tab-yIQFGJbG.js → session-review-tab-fRzyogNH.js} +1 -1
  242. package/dist/web/assets/session-review-tab-fRzyogNH.js.br +0 -0
  243. package/dist/web/assets/session-review-tab-fRzyogNH.js.gz +0 -0
  244. package/dist/web/assets/{settings-body-DXNcpoqY.js → settings-body-D5pmlFft.js} +1 -1
  245. package/dist/web/assets/settings-body-D5pmlFft.js.br +0 -0
  246. package/dist/web/assets/settings-body-D5pmlFft.js.gz +0 -0
  247. package/dist/web/assets/{settings-rows-DgL7oTg8.js → settings-rows-VtjChFlm.js} +1 -1
  248. package/dist/web/assets/settings-rows-VtjChFlm.js.br +0 -0
  249. package/dist/web/assets/settings-rows-VtjChFlm.js.gz +0 -0
  250. package/dist/web/assets/{settings-section-content-DFLjO2le.js → settings-section-content-BOwSlBkZ.js} +2 -2
  251. package/dist/web/assets/settings-section-content-BOwSlBkZ.js.br +0 -0
  252. package/dist/web/assets/settings-section-content-BOwSlBkZ.js.gz +0 -0
  253. package/dist/web/assets/{settings-section-content-B1eU_yR4.js → settings-section-content-Ck39TJA7.js} +1 -1
  254. package/dist/web/assets/{settings-store-CBJCnE5L.js → settings-store-CMpVMq3Y.js} +2 -2
  255. package/dist/web/assets/settings-store-CMpVMq3Y.js.br +0 -0
  256. package/dist/web/assets/settings-store-CMpVMq3Y.js.gz +0 -0
  257. package/dist/web/assets/settings-tab-A81xb81d.js +1 -0
  258. package/dist/web/assets/settings-window-content-BCDRi6xS.js +1 -0
  259. package/dist/web/assets/{slash-command-picker-qb3fZ7RP.js → slash-command-picker-BKeEykkF.js} +1 -1
  260. package/dist/web/assets/slash-command-picker-BKeEykkF.js.br +0 -0
  261. package/dist/web/assets/slash-command-picker-BKeEykkF.js.gz +0 -0
  262. package/dist/web/assets/{sql-object-tab-B6JtYu9P.js → sql-object-tab-I5bl3DVf.js} +1 -1
  263. package/dist/web/assets/sql-object-tab-I5bl3DVf.js.br +0 -0
  264. package/dist/web/assets/sql-object-tab-I5bl3DVf.js.gz +0 -0
  265. package/dist/web/assets/{sqlite-viewer-bdNkUymy.js → sqlite-viewer-ECCCjxdn.js} +1 -1
  266. package/dist/web/assets/sqlite-viewer-ECCCjxdn.js.br +0 -0
  267. package/dist/web/assets/sqlite-viewer-ECCCjxdn.js.gz +0 -0
  268. package/dist/web/assets/{structure-save-dialog-5SfYdbAB.js → structure-save-dialog-DcQdamD3.js} +1 -1
  269. package/dist/web/assets/structure-save-dialog-DcQdamD3.js.br +0 -0
  270. package/dist/web/assets/structure-save-dialog-DcQdamD3.js.gz +0 -0
  271. package/dist/web/assets/{structure-tab-DYjjcLIU.js → structure-tab-DyQGhf9t.js} +2 -2
  272. package/dist/web/assets/structure-tab-DyQGhf9t.js.br +0 -0
  273. package/dist/web/assets/structure-tab-DyQGhf9t.js.gz +0 -0
  274. package/dist/web/assets/{system-monitor-body-DouL7ajt.js → system-monitor-body-B5AvRT5J.js} +2 -2
  275. package/dist/web/assets/system-monitor-body-B5AvRT5J.js.br +0 -0
  276. package/dist/web/assets/system-monitor-body-B5AvRT5J.js.gz +0 -0
  277. package/dist/web/assets/system-monitor-tab-CfwHKQ5k.js +1 -0
  278. package/dist/web/assets/{system-monitor-window-content-DUCaJME1.js → system-monitor-window-content-Cvx1V8Mf.js} +1 -1
  279. package/dist/web/assets/{tab-host-window-content-CQ5NiV6Y.js → tab-host-window-content-DqOUHxEL.js} +1 -1
  280. package/dist/web/assets/tab-host-window-content-DqOUHxEL.js.br +0 -0
  281. package/dist/web/assets/tab-host-window-content-DqOUHxEL.js.gz +0 -0
  282. package/dist/web/assets/{tab-store-B4v2kAEY.js → tab-store-NUmgzMPf.js} +1 -1
  283. package/dist/web/assets/table-tab-dI8rBbCS.js +2 -0
  284. package/dist/web/assets/table-tab-dI8rBbCS.js.br +0 -0
  285. package/dist/web/assets/table-tab-dI8rBbCS.js.gz +0 -0
  286. package/dist/web/assets/{telegram-bot-token-field-CqVIuWP1.js → telegram-bot-token-field-DSLtG8vw.js} +1 -1
  287. package/dist/web/assets/telegram-bot-token-field-DSLtG8vw.js.br +0 -0
  288. package/dist/web/assets/telegram-bot-token-field-DSLtG8vw.js.gz +0 -0
  289. package/dist/web/assets/{terminal-tab-DT0MN_Qn.js → terminal-tab-CDg0AHBK.js} +2 -2
  290. package/dist/web/assets/terminal-tab-CDg0AHBK.js.br +0 -0
  291. package/dist/web/assets/terminal-tab-CDg0AHBK.js.gz +0 -0
  292. package/dist/web/assets/{tool-cards-C2YGSKRm.js → tool-cards-7E0jtwP0.js} +5 -5
  293. package/dist/web/assets/tool-cards-7E0jtwP0.js.br +0 -0
  294. package/dist/web/assets/tool-cards-7E0jtwP0.js.gz +0 -0
  295. package/dist/web/assets/{tools-settings-section-DQXIdF8O.js → tools-settings-section-AChVQJyU.js} +1 -1
  296. package/dist/web/assets/tools-settings-section-AChVQJyU.js.br +0 -0
  297. package/dist/web/assets/tools-settings-section-AChVQJyU.js.gz +0 -0
  298. package/dist/web/assets/{use-db-read-BByB906L.js → use-db-read-DgNa66Yo.js} +1 -1
  299. package/dist/web/assets/use-db-read-DgNa66Yo.js.br +0 -0
  300. package/dist/web/assets/use-db-read-DgNa66Yo.js.gz +0 -0
  301. package/dist/web/assets/{use-db-tab-Dc0QSFyM.js → use-db-tab-OGLoicCd.js} +1 -1
  302. package/dist/web/assets/use-db-tab-OGLoicCd.js.br +0 -0
  303. package/dist/web/assets/use-db-tab-OGLoicCd.js.gz +0 -0
  304. package/dist/web/assets/{use-inline-blame-B9M-hADX.js → use-inline-blame-BvlcOQd9.js} +3 -3
  305. package/dist/web/assets/use-inline-blame-BvlcOQd9.js.br +0 -0
  306. package/dist/web/assets/use-inline-blame-BvlcOQd9.js.gz +0 -0
  307. package/dist/web/assets/{use-lsp-DcGiCpl9.js → use-lsp-fLNwD0BI.js} +1 -1
  308. package/dist/web/assets/use-lsp-fLNwD0BI.js.br +0 -0
  309. package/dist/web/assets/use-lsp-fLNwD0BI.js.gz +0 -0
  310. package/dist/web/assets/{use-monaco-theme-CyoMsYaI.js → use-monaco-theme-CbNQ4HnC.js} +1 -1
  311. package/dist/web/assets/{use-process-kill-DsHyrg0-.js → use-process-kill-B4Srjl2m.js} +1 -1
  312. package/dist/web/assets/use-process-kill-B4Srjl2m.js.br +0 -0
  313. package/dist/web/assets/use-process-kill-B4Srjl2m.js.gz +0 -0
  314. package/dist/web/assets/{use-sql-schema-info-BqGN5N4O.js → use-sql-schema-info-CqISFaAW.js} +1 -1
  315. package/dist/web/assets/use-sql-schema-info-CqISFaAW.js.br +0 -0
  316. package/dist/web/assets/use-sql-schema-info-CqISFaAW.js.gz +0 -0
  317. package/dist/web/assets/{use-websocket-DqomrzN8.js → use-websocket-DVJuWhlA.js} +1 -1
  318. package/dist/web/assets/{voice-settings-section-D9KsOm8A.js → voice-settings-section-C1aEYF94.js} +1 -1
  319. package/dist/web/assets/voice-settings-section-C1aEYF94.js.br +0 -0
  320. package/dist/web/assets/voice-settings-section-C1aEYF94.js.gz +0 -0
  321. package/dist/web/assets/{web-preview-tab-CUp1n2jz.js → web-preview-tab-CZJAVoVU.js} +1 -1
  322. package/dist/web/assets/web-preview-tab-CZJAVoVU.js.br +0 -0
  323. package/dist/web/assets/web-preview-tab-CZJAVoVU.js.gz +0 -0
  324. package/dist/web/assets/{window-store-UcSFgNCI.js → window-store-D6EgLSfT.js} +1 -1
  325. package/dist/web/assets/window-store-D6EgLSfT.js.br +0 -0
  326. package/dist/web/assets/window-store-D6EgLSfT.js.gz +0 -0
  327. package/dist/web/index.html +12 -12
  328. package/dist/web/index.html.br +0 -0
  329. package/dist/web/index.html.gz +0 -0
  330. package/dist/web/sw.js +1 -1
  331. package/dist/web/sw.js.br +0 -0
  332. package/dist/web/sw.js.gz +0 -0
  333. package/package.json +1 -1
  334. package/src/web/components/floating-window/use-window-meta.ts +2 -1
  335. package/src/web/components/floating-window/window-content-registry.ts +2 -0
  336. package/src/web/components/floating-window/window-store-types.ts +1 -1
  337. package/src/web/components/layout/upgrade-button.tsx +27 -46
  338. package/src/web/components/release-notes/open-release-notes.ts +22 -0
  339. package/src/web/components/release-notes/release-notes-entry.tsx +73 -0
  340. package/src/web/components/release-notes/release-notes-view.tsx +72 -0
  341. package/src/web/components/release-notes/release-notes-window-content.tsx +6 -0
  342. package/dist/web/assets/accounts-settings-section-Ctu-w8kt.js +0 -1
  343. package/dist/web/assets/accounts-settings-section-Ctu-w8kt.js.br +0 -0
  344. package/dist/web/assets/accounts-settings-section-Ctu-w8kt.js.gz +0 -0
  345. package/dist/web/assets/agent-session-sheet-DmbSfFGz.js.br +0 -0
  346. package/dist/web/assets/agent-session-sheet-DmbSfFGz.js.gz +0 -0
  347. package/dist/web/assets/agent-session-window-content-Dk8x3ozF.js.br +0 -0
  348. package/dist/web/assets/agent-session-window-content-Dk8x3ozF.js.gz +0 -0
  349. package/dist/web/assets/ai-resource-editor-MKwjYcDh.js.br +0 -0
  350. package/dist/web/assets/ai-resource-editor-MKwjYcDh.js.gz +0 -0
  351. package/dist/web/assets/ai-settings-section-CODZY71V.js +0 -1
  352. package/dist/web/assets/ai-settings-section-CODZY71V.js.br +0 -0
  353. package/dist/web/assets/ai-settings-section-CODZY71V.js.gz +0 -0
  354. package/dist/web/assets/android-tab-CUkjbfyi.js.br +0 -0
  355. package/dist/web/assets/android-tab-CUkjbfyi.js.gz +0 -0
  356. package/dist/web/assets/appearance-settings-section-BZsM8HpZ.js.br +0 -0
  357. package/dist/web/assets/appearance-settings-section-BZsM8HpZ.js.gz +0 -0
  358. package/dist/web/assets/apps-panel-Cs3utBlp.js.br +0 -0
  359. package/dist/web/assets/apps-panel-Cs3utBlp.js.gz +0 -0
  360. package/dist/web/assets/branch-review-tab-C-aPuhXZ.js +0 -1
  361. package/dist/web/assets/branch-review-tab-C-aPuhXZ.js.br +0 -0
  362. package/dist/web/assets/branch-review-tab-C-aPuhXZ.js.gz +0 -0
  363. package/dist/web/assets/chat-tab-CGQu4uLR.js +0 -1
  364. package/dist/web/assets/chat-tab-CGQu4uLR.js.br +0 -0
  365. package/dist/web/assets/chat-tab-CGQu4uLR.js.gz +0 -0
  366. package/dist/web/assets/chat-tab-DtSHSfMU.js.br +0 -0
  367. package/dist/web/assets/chat-tab-DtSHSfMU.js.gz +0 -0
  368. package/dist/web/assets/code-editor-DjDyhff1.js.br +0 -0
  369. package/dist/web/assets/code-editor-DjDyhff1.js.gz +0 -0
  370. package/dist/web/assets/codex-reset-credit-button-BKgiUi8E.js.br +0 -0
  371. package/dist/web/assets/codex-reset-credit-button-BKgiUi8E.js.gz +0 -0
  372. package/dist/web/assets/conflict-editor-DgTv-8pb.js.br +0 -0
  373. package/dist/web/assets/conflict-editor-DgTv-8pb.js.gz +0 -0
  374. package/dist/web/assets/connection-form-tab-CJ-6gH9g.js +0 -4
  375. package/dist/web/assets/connection-form-tab-CJ-6gH9g.js.br +0 -0
  376. package/dist/web/assets/connection-form-tab-CJ-6gH9g.js.gz +0 -0
  377. package/dist/web/assets/csv-preview-BTGpYs4p.js.br +0 -0
  378. package/dist/web/assets/csv-preview-BTGpYs4p.js.gz +0 -0
  379. package/dist/web/assets/db-explorer-store-DDePT3UI.js.br +0 -0
  380. package/dist/web/assets/db-explorer-store-DDePT3UI.js.gz +0 -0
  381. package/dist/web/assets/db-sidebar-reveal-BeT8cp6P.js.br +0 -0
  382. package/dist/web/assets/db-sidebar-reveal-BeT8cp6P.js.gz +0 -0
  383. package/dist/web/assets/db-tab-parts-BYzd4_sR.js.br +0 -0
  384. package/dist/web/assets/db-tab-parts-BYzd4_sR.js.gz +0 -0
  385. package/dist/web/assets/design-settings-section-B3KQBggK.js.br +0 -0
  386. package/dist/web/assets/design-settings-section-B3KQBggK.js.gz +0 -0
  387. package/dist/web/assets/design-tab-CPyj_nFg.js.br +0 -0
  388. package/dist/web/assets/design-tab-CPyj_nFg.js.gz +0 -0
  389. package/dist/web/assets/designs-sidebar-panel-DIGPFo2l.js.br +0 -0
  390. package/dist/web/assets/designs-sidebar-panel-DIGPFo2l.js.gz +0 -0
  391. package/dist/web/assets/diff-viewer-nYz43A94.js +0 -4
  392. package/dist/web/assets/diff-viewer-nYz43A94.js.br +0 -0
  393. package/dist/web/assets/diff-viewer-nYz43A94.js.gz +0 -0
  394. package/dist/web/assets/docx-preview-CowHGqML.js.br +0 -0
  395. package/dist/web/assets/docx-preview-CowHGqML.js.gz +0 -0
  396. package/dist/web/assets/editor-dialog-xPoehDYp.js.br +0 -0
  397. package/dist/web/assets/editor-dialog-xPoehDYp.js.gz +0 -0
  398. package/dist/web/assets/editor-language-service-DdYqCDBU.js.br +0 -0
  399. package/dist/web/assets/editor-language-service-DdYqCDBU.js.gz +0 -0
  400. package/dist/web/assets/explorer-body-BHh5Qpvi.js +0 -2
  401. package/dist/web/assets/explorer-body-BHh5Qpvi.js.br +0 -0
  402. package/dist/web/assets/explorer-body-BHh5Qpvi.js.gz +0 -0
  403. package/dist/web/assets/explorer-model-tGyFETP_.js.br +0 -0
  404. package/dist/web/assets/explorer-model-tGyFETP_.js.gz +0 -0
  405. package/dist/web/assets/explorer-window-content-B1c4QTVL.js.br +0 -0
  406. package/dist/web/assets/explorer-window-content-B1c4QTVL.js.gz +0 -0
  407. package/dist/web/assets/extension-manager-section-BgL0Uyl3.js.br +0 -0
  408. package/dist/web/assets/extension-manager-section-BgL0Uyl3.js.gz +0 -0
  409. package/dist/web/assets/extension-webview-BWB1Yd-t.js.br +0 -0
  410. package/dist/web/assets/extension-webview-BWB1Yd-t.js.gz +0 -0
  411. package/dist/web/assets/files-settings-section-TmoewoO2.js.br +0 -0
  412. package/dist/web/assets/files-settings-section-TmoewoO2.js.gz +0 -0
  413. package/dist/web/assets/general-settings-section-Bu7o8uUn.js.br +0 -0
  414. package/dist/web/assets/general-settings-section-Bu7o8uUn.js.gz +0 -0
  415. package/dist/web/assets/git-log-panel-RjMZIaCk.js.br +0 -0
  416. package/dist/web/assets/git-log-panel-RjMZIaCk.js.gz +0 -0
  417. package/dist/web/assets/git-review-tab-BUW5LZk4.js +0 -3
  418. package/dist/web/assets/git-review-tab-BUW5LZk4.js.br +0 -0
  419. package/dist/web/assets/git-review-tab-BUW5LZk4.js.gz +0 -0
  420. package/dist/web/assets/glide-data-grid-DqlTFhhf.js.br +0 -0
  421. package/dist/web/assets/glide-data-grid-DqlTFhhf.js.gz +0 -0
  422. package/dist/web/assets/grid-save-dialog-BmF2Gy_E.js.br +0 -0
  423. package/dist/web/assets/grid-save-dialog-BmF2Gy_E.js.gz +0 -0
  424. package/dist/web/assets/group-chat-tab-nk3n5wE0.js +0 -1
  425. package/dist/web/assets/group-chat-tab-nk3n5wE0.js.br +0 -0
  426. package/dist/web/assets/group-chat-tab-nk3n5wE0.js.gz +0 -0
  427. package/dist/web/assets/impexp-tab-B8d4oBOB.js.br +0 -0
  428. package/dist/web/assets/impexp-tab-B8d4oBOB.js.gz +0 -0
  429. package/dist/web/assets/index-2_Pz5MiI.css +0 -1
  430. package/dist/web/assets/index-2_Pz5MiI.css.br +0 -0
  431. package/dist/web/assets/index-Cx9ZRibz.js.br +0 -0
  432. package/dist/web/assets/index-Cx9ZRibz.js.gz +0 -0
  433. package/dist/web/assets/keybindings-store-B2AkKQl7.js +0 -1
  434. package/dist/web/assets/keyboard-shortcuts-section-BSMgmbOR.js.br +0 -0
  435. package/dist/web/assets/keyboard-shortcuts-section-BSMgmbOR.js.gz +0 -0
  436. package/dist/web/assets/language-servers-section-DO9wnwnG.js.br +0 -0
  437. package/dist/web/assets/language-servers-section-DO9wnwnG.js.gz +0 -0
  438. package/dist/web/assets/logs-app-xQ2UsN4G.js +0 -13
  439. package/dist/web/assets/logs-app-xQ2UsN4G.js.br +0 -0
  440. package/dist/web/assets/logs-app-xQ2UsN4G.js.gz +0 -0
  441. package/dist/web/assets/logs-tab-H3SmYGRX.js +0 -1
  442. package/dist/web/assets/lsp-client-IsC8Ol0U.js.br +0 -0
  443. package/dist/web/assets/lsp-client-IsC8Ol0U.js.gz +0 -0
  444. package/dist/web/assets/markdown-renderer-BfZiHaNy.js.br +0 -0
  445. package/dist/web/assets/markdown-renderer-BfZiHaNy.js.gz +0 -0
  446. package/dist/web/assets/mobile-explorer-sheet-Dz3eJdBl.js.br +0 -0
  447. package/dist/web/assets/mobile-explorer-sheet-Dz3eJdBl.js.gz +0 -0
  448. package/dist/web/assets/new-design-dialog-B8zeJoJQ.js.br +0 -0
  449. package/dist/web/assets/new-design-dialog-B8zeJoJQ.js.gz +0 -0
  450. package/dist/web/assets/notification-store-BkkcJE2G.js +0 -1
  451. package/dist/web/assets/notifications-settings-section-CMZXQw72.js.br +0 -0
  452. package/dist/web/assets/notifications-settings-section-CMZXQw72.js.gz +0 -0
  453. package/dist/web/assets/open-db-tabs-DYTZbguT.js.br +0 -0
  454. package/dist/web/assets/open-db-tabs-DYTZbguT.js.gz +0 -0
  455. package/dist/web/assets/overview-panel-7_8b6pwr.js.br +0 -0
  456. package/dist/web/assets/overview-panel-7_8b6pwr.js.gz +0 -0
  457. package/dist/web/assets/panel-store-Dx2ziBLp.js.br +0 -0
  458. package/dist/web/assets/panel-store-Dx2ziBLp.js.gz +0 -0
  459. package/dist/web/assets/performance-panel-COQNCyEU.js.br +0 -0
  460. package/dist/web/assets/performance-panel-COQNCyEU.js.gz +0 -0
  461. package/dist/web/assets/ppmbot-settings-section-CmhbbZVI.js.br +0 -0
  462. package/dist/web/assets/ppmbot-settings-section-CmhbbZVI.js.gz +0 -0
  463. package/dist/web/assets/pptx-export-COeBmnFJ.js.br +0 -0
  464. package/dist/web/assets/pptx-export-COeBmnFJ.js.gz +0 -0
  465. package/dist/web/assets/problems-panel-I0EYfa1S.js.br +0 -0
  466. package/dist/web/assets/problems-panel-I0EYfa1S.js.gz +0 -0
  467. package/dist/web/assets/process-table-or-X8Lwh.js.br +0 -0
  468. package/dist/web/assets/process-table-or-X8Lwh.js.gz +0 -0
  469. package/dist/web/assets/proxy-settings-section-DpJ6ok4C.js.br +0 -0
  470. package/dist/web/assets/proxy-settings-section-DpJ6ok4C.js.gz +0 -0
  471. package/dist/web/assets/query-tab-DeNZMZHX.js.br +0 -0
  472. package/dist/web/assets/query-tab-DeNZMZHX.js.gz +0 -0
  473. package/dist/web/assets/remote-access-settings-section-QRP4Yh46.js +0 -1
  474. package/dist/web/assets/remote-access-settings-section-QRP4Yh46.js.br +0 -0
  475. package/dist/web/assets/remote-access-settings-section-QRP4Yh46.js.gz +0 -0
  476. package/dist/web/assets/remote-desktop-clipboard-notice-CGDBpXMf.js.br +0 -0
  477. package/dist/web/assets/remote-desktop-clipboard-notice-CGDBpXMf.js.gz +0 -0
  478. package/dist/web/assets/remote-desktop-mobile-sheet-6nXirdqZ.js.br +0 -0
  479. package/dist/web/assets/remote-desktop-mobile-sheet-6nXirdqZ.js.gz +0 -0
  480. package/dist/web/assets/remote-desktop-mobile-view-BTaj9Flo.js.br +0 -0
  481. package/dist/web/assets/remote-desktop-mobile-view-BTaj9Flo.js.gz +0 -0
  482. package/dist/web/assets/remote-desktop-readiness-gate--gtmfqZh.js.br +0 -0
  483. package/dist/web/assets/remote-desktop-readiness-gate--gtmfqZh.js.gz +0 -0
  484. package/dist/web/assets/remote-desktop-settings-section-Bs5avYaS.js.br +0 -0
  485. package/dist/web/assets/remote-desktop-settings-section-Bs5avYaS.js.gz +0 -0
  486. package/dist/web/assets/remote-desktop-window-content-D4CM-28B.js.br +0 -0
  487. package/dist/web/assets/remote-desktop-window-content-D4CM-28B.js.gz +0 -0
  488. package/dist/web/assets/rename-object-dialog-Dv4iLwnf.js.br +0 -0
  489. package/dist/web/assets/rename-object-dialog-Dv4iLwnf.js.gz +0 -0
  490. package/dist/web/assets/review-address-setup-CU1A_NfZ.js +0 -1
  491. package/dist/web/assets/review-address-setup-CU1A_NfZ.js.br +0 -0
  492. package/dist/web/assets/review-address-setup-CU1A_NfZ.js.gz +0 -0
  493. package/dist/web/assets/review-code-Bet53hHb.js.br +0 -0
  494. package/dist/web/assets/review-code-Bet53hHb.js.gz +0 -0
  495. package/dist/web/assets/save-as-dialog-DHkBsS-6.js.br +0 -0
  496. package/dist/web/assets/save-as-dialog-DHkBsS-6.js.gz +0 -0
  497. package/dist/web/assets/schedule-script-editor-CKUl2qxf.js.br +0 -0
  498. package/dist/web/assets/schedule-script-editor-CKUl2qxf.js.gz +0 -0
  499. package/dist/web/assets/schedules-settings-section-EoOXzqF3.js.br +0 -0
  500. package/dist/web/assets/schedules-settings-section-EoOXzqF3.js.gz +0 -0
  501. package/dist/web/assets/send-to-chat-B7oUVcgh.js.br +0 -0
  502. package/dist/web/assets/send-to-chat-B7oUVcgh.js.gz +0 -0
  503. package/dist/web/assets/services-panel-BceuL_SU.js.br +0 -0
  504. package/dist/web/assets/services-panel-BceuL_SU.js.gz +0 -0
  505. package/dist/web/assets/session-changes-bar-CjSxBYOF.js.br +0 -0
  506. package/dist/web/assets/session-changes-bar-CjSxBYOF.js.gz +0 -0
  507. package/dist/web/assets/session-review-tab-yIQFGJbG.js.br +0 -0
  508. package/dist/web/assets/session-review-tab-yIQFGJbG.js.gz +0 -0
  509. package/dist/web/assets/settings-body-DXNcpoqY.js.br +0 -0
  510. package/dist/web/assets/settings-body-DXNcpoqY.js.gz +0 -0
  511. package/dist/web/assets/settings-rows-DgL7oTg8.js.br +0 -0
  512. package/dist/web/assets/settings-rows-DgL7oTg8.js.gz +0 -0
  513. package/dist/web/assets/settings-section-content-DFLjO2le.js.br +0 -0
  514. package/dist/web/assets/settings-section-content-DFLjO2le.js.gz +0 -0
  515. package/dist/web/assets/settings-store-CBJCnE5L.js.br +0 -0
  516. package/dist/web/assets/settings-store-CBJCnE5L.js.gz +0 -0
  517. package/dist/web/assets/settings-tab-CrGoLKQT.js +0 -1
  518. package/dist/web/assets/settings-window-content-5opW9Wra.js +0 -1
  519. package/dist/web/assets/slash-command-picker-qb3fZ7RP.js.br +0 -0
  520. package/dist/web/assets/slash-command-picker-qb3fZ7RP.js.gz +0 -0
  521. package/dist/web/assets/sql-object-tab-B6JtYu9P.js.br +0 -0
  522. package/dist/web/assets/sql-object-tab-B6JtYu9P.js.gz +0 -0
  523. package/dist/web/assets/sqlite-viewer-bdNkUymy.js.br +0 -0
  524. package/dist/web/assets/sqlite-viewer-bdNkUymy.js.gz +0 -0
  525. package/dist/web/assets/structure-save-dialog-5SfYdbAB.js.br +0 -0
  526. package/dist/web/assets/structure-save-dialog-5SfYdbAB.js.gz +0 -0
  527. package/dist/web/assets/structure-tab-DYjjcLIU.js.br +0 -0
  528. package/dist/web/assets/structure-tab-DYjjcLIU.js.gz +0 -0
  529. package/dist/web/assets/system-monitor-body-DouL7ajt.js.br +0 -0
  530. package/dist/web/assets/system-monitor-body-DouL7ajt.js.gz +0 -0
  531. package/dist/web/assets/system-monitor-tab-qpa36tWB.js +0 -1
  532. package/dist/web/assets/tab-host-window-content-CQ5NiV6Y.js.br +0 -0
  533. package/dist/web/assets/tab-host-window-content-CQ5NiV6Y.js.gz +0 -0
  534. package/dist/web/assets/table-tab-M850PntZ.js +0 -2
  535. package/dist/web/assets/table-tab-M850PntZ.js.br +0 -0
  536. package/dist/web/assets/table-tab-M850PntZ.js.gz +0 -0
  537. package/dist/web/assets/telegram-bot-token-field-CqVIuWP1.js.br +0 -0
  538. package/dist/web/assets/telegram-bot-token-field-CqVIuWP1.js.gz +0 -0
  539. package/dist/web/assets/terminal-tab-DT0MN_Qn.js.br +0 -0
  540. package/dist/web/assets/terminal-tab-DT0MN_Qn.js.gz +0 -0
  541. package/dist/web/assets/tool-cards-C2YGSKRm.js.br +0 -0
  542. package/dist/web/assets/tool-cards-C2YGSKRm.js.gz +0 -0
  543. package/dist/web/assets/tools-settings-section-DQXIdF8O.js.br +0 -0
  544. package/dist/web/assets/tools-settings-section-DQXIdF8O.js.gz +0 -0
  545. package/dist/web/assets/use-db-read-BByB906L.js.br +0 -0
  546. package/dist/web/assets/use-db-read-BByB906L.js.gz +0 -0
  547. package/dist/web/assets/use-db-tab-Dc0QSFyM.js.br +0 -0
  548. package/dist/web/assets/use-db-tab-Dc0QSFyM.js.gz +0 -0
  549. package/dist/web/assets/use-inline-blame-B9M-hADX.js.br +0 -0
  550. package/dist/web/assets/use-inline-blame-B9M-hADX.js.gz +0 -0
  551. package/dist/web/assets/use-lsp-DcGiCpl9.js.br +0 -0
  552. package/dist/web/assets/use-lsp-DcGiCpl9.js.gz +0 -0
  553. package/dist/web/assets/use-process-kill-DsHyrg0-.js.br +0 -0
  554. package/dist/web/assets/use-process-kill-DsHyrg0-.js.gz +0 -0
  555. package/dist/web/assets/use-sql-schema-info-BqGN5N4O.js.br +0 -0
  556. package/dist/web/assets/use-sql-schema-info-BqGN5N4O.js.gz +0 -0
  557. package/dist/web/assets/voice-settings-section-D9KsOm8A.js.br +0 -0
  558. package/dist/web/assets/voice-settings-section-D9KsOm8A.js.gz +0 -0
  559. package/dist/web/assets/web-preview-tab-CUp1n2jz.js.br +0 -0
  560. package/dist/web/assets/web-preview-tab-CUp1n2jz.js.gz +0 -0
  561. package/dist/web/assets/window-store-UcSFgNCI.js.br +0 -0
  562. package/dist/web/assets/window-store-UcSFgNCI.js.gz +0 -0
  563. /package/dist/web/assets/{__vite-browser-external-DLaiEgUM.js → __vite-browser-external-LVpeGV-g.js} +0 -0
  564. /package/dist/web/assets/{api-themes-B3-6zR6Q.js → api-themes-DUOEO3_X.js} +0 -0
  565. /package/dist/web/assets/{claude-models-yFre4eSK.js → claude-models-C9iHl8VB.js} +0 -0
  566. /package/dist/web/assets/{database-drivers-section-c2SuNQPB.js → database-drivers-section-BPXoNrWi.js} +0 -0
  567. /package/dist/web/assets/{database-drivers-section-c2SuNQPB.js.br → database-drivers-section-BPXoNrWi.js.br} +0 -0
  568. /package/dist/web/assets/{database-drivers-section-c2SuNQPB.js.gz → database-drivers-section-BPXoNrWi.js.gz} +0 -0
  569. /package/dist/web/assets/{metric-chart-canvas-Dnm9OOXU.js → metric-chart-canvas-HG8rPTMq.js} +0 -0
  570. /package/dist/web/assets/{metric-chart-canvas-Dnm9OOXU.js.br → metric-chart-canvas-HG8rPTMq.js.br} +0 -0
  571. /package/dist/web/assets/{metric-chart-canvas-Dnm9OOXU.js.gz → metric-chart-canvas-HG8rPTMq.js.gz} +0 -0
  572. /package/dist/web/assets/{notification-settings-CvplVsIo.js → notification-settings--li9wGTJ.js} +0 -0
  573. /package/dist/web/assets/{notification-settings-CvplVsIo.js.br → notification-settings--li9wGTJ.js.br} +0 -0
  574. /package/dist/web/assets/{notification-settings-CvplVsIo.js.gz → notification-settings--li9wGTJ.js.gz} +0 -0
  575. /package/dist/web/assets/{process-row-format-CM1XaqkS.js → process-row-format-CJg8VV-6.js} +0 -0
  576. /package/dist/web/assets/{query-audit-section-C-fT07Zz.js → query-audit-section-BiCUBamA.js} +0 -0
  577. /package/dist/web/assets/{query-audit-section-C-fT07Zz.js.br → query-audit-section-BiCUBamA.js.br} +0 -0
  578. /package/dist/web/assets/{query-audit-section-C-fT07Zz.js.gz → query-audit-section-BiCUBamA.js.gz} +0 -0
  579. /package/dist/web/assets/{remote-desktop-recording-D_fwMC2z.js → remote-desktop-recording-BcDx5c_k.js} +0 -0
  580. /package/dist/web/assets/{separator-CYw7bF1W.js → separator-DUdRLaL0.js} +0 -0
  581. /package/dist/web/assets/{sortable-header-CchrA_dg.js → sortable-header-Ds6nTnqB.js} +0 -0
  582. /package/dist/web/assets/{sortable-header-CchrA_dg.js.br → sortable-header-Ds6nTnqB.js.br} +0 -0
  583. /package/dist/web/assets/{sortable-header-CchrA_dg.js.gz → sortable-header-Ds6nTnqB.js.gz} +0 -0
  584. /package/dist/web/assets/{vendor-xterm-lhGdimFj.js → vendor-xterm-BxbwWHG_.js} +0 -0
  585. /package/dist/web/assets/{vendor-xterm-lhGdimFj.js.br → vendor-xterm-BxbwWHG_.js.br} +0 -0
  586. /package/dist/web/assets/{vendor-xterm-lhGdimFj.js.gz → vendor-xterm-BxbwWHG_.js.gz} +0 -0
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/schedule-script-editor-CKUl2qxf.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-Cx9ZRibz.js","assets/preload-helper-Bf_JiD2A.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-BHGVTbam.js","assets/utils-D3xTlJyU.js","assets/createLucideIcon-B2pji242.js","assets/file-diff-CScJM-VZ.js","assets/git-commit-horizontal-ZMFP54eB.js","assets/api-client-BnYFnEfK.js","assets/react-B9hau9ra.js","assets/open-db-tabs-DYTZbguT.js","assets/window-store-UcSFgNCI.js","assets/minimal-mode-rLZOjciW.js","assets/panel-store-Dx2ziBLp.js","assets/settings-store-CBJCnE5L.js","assets/session-list-sync-triggers-D9i1FxWd.js","assets/project-store-Bs-kiU8m.js","assets/project-framework-store-nuePqBBa.js","assets/explorer-model-tGyFETP_.js","assets/db-sidebar-reveal-BeT8cp6P.js","assets/use-is-mobile-CL2I7hLf.js","assets/db-types-cHkNH-mN.js","assets/tab-store-B4v2kAEY.js","assets/use-db-driver-installed-BL1XW_bI.js","assets/impexp-state-Cx2Az9iZ.js","assets/file-store-Bn0vbkCx.js","assets/sql-identifiers-7jHNEORb.js","assets/db-explorer-store-DDePT3UI.js","assets/onboarding-quick-orientation-DTMrcMf0.js","assets/dialog-DnE192fh.js","assets/portal-container-context-Gepuvxdg.js","assets/icons-C1wDt09O.js","assets/format-file-meta-BOAh9mam.js","assets/fs-api-BVIVh_De.js","assets/open-settings-BGtoVEAU.js","assets/settings-categories-BY9n3BRr.js","assets/adaptive-context-menu-CxHkI7dL.js","assets/context-menu-DhKbkI1X.js","assets/mobile-bottom-sheet-M9pZptfh.js","assets/use-visual-viewport-B_GFo6k2.js","assets/dropdown-menu-CxZR_vuV.js","assets/input-CReAuQTF.js","assets/scroll-area-CSmNLlfl.js","assets/start-ellipsis-DfU-W_6j.js","assets/chat-preparation-cache-Bzb-T1pm.js","assets/clipboard-D3XnL7CB.js","assets/file-icons-CB0RsVdl.js","assets/format-date-SZ6qU2sD.js","assets/git-repo-store-CESIqItW.js","assets/patch-tab-metadata-DTbCkVvx.js","assets/ws-auth-k7DWnL9T.js","assets/apply-theme-Kiqxd1NZ.js","assets/resolve-theme-DGQXDIbF.js","assets/index-2_Pz5MiI.css","assets/use-monaco-theme-CyoMsYaI.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{An as r,Kr as i,L as a,O as o,P as s,Zr as c,_r as l,br as u,cr as d,ht as f,lr as p,or as m,tr as h,xt as g}from"./icons-C1wDt09O.js";import{k as _,n as v,r as y}from"./api-client-BnYFnEfK.js";import{t as b}from"./preload-helper-Bf_JiD2A.js";import{n as x}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./context-menu-DhKbkI1X.js";import{n as S}from"./use-is-mobile-CL2I7hLf.js";import{t as C}from"./button-BHGVTbam.js";import{a as w,n as T,o as E,t as D}from"./dialog-DnE192fh.js";import{t as O}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{n as ee,o as te,r as k,t as ne,u as re}from"./adaptive-context-menu-CxHkI7dL.js";import{t as A}from"./input-CReAuQTF.js";import{t as ie}from"./scroll-area-CSmNLlfl.js";import{Jn as ae,Kn as oe,Xn as se,Yn as ce,Zn as j,qn as le}from"./index-Cx9ZRibz.js";import{t as ue}from"./remote-desktop-recording-D_fwMC2z.js";import{t as de}from"./notification-settings-CvplVsIo.js";import"./claude-models-yFre4eSK.js";var M=e(t(),1),fe=1e4;function pe(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await y.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},fe);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function me(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 y.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 he=[`default`,`acceptEdits`,`plan`,`bypassPermissions`];structuredClone(de);function N(e,t,n,r,i,a,o,s){return N.fromTZ(N.tp(e,t,n,r,i,a,o),s)}N.fromTZISO=(e,t,n)=>N.fromTZ(ge(e,t),n),N.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=P(e.tz,n),i=new Date(n.getTime()-r),a=P(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=P(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},N.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}},N.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function P(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 ge(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(`+`)?N.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):N.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}N.minitz=N;var F=32,I=31|F,_e=[1,2,4,8,16],ve=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 R(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,I),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]|F;else if(t===I)this.dayOfWeek[e]=I;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|_e[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},ye=[31,28,31,30,31,30,31,31,30,31,30,31],L=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],R=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&I&&_e[a-1]&r)return!0;if(r&F){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=N.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>ye[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=N.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(N.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():ye[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&I)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,L[n][0],e,L[n][2]);if(r>1){let i=n+1;for(;i<L.length;)this[L[i][0]]=-L[i][2],i++;if(r===3)return this[L[n][1]]++,this[L[n][0]]=-L[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=L.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)):N.fromTZ(N.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function be(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 R(e.startAt,e.timezone),e.stopAt&&=new R(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 z(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function xe(e){return z(e)}function Se(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Ce=30*1e3,B=[],we=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(z(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(z(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=be(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 ve(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new R(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new ve(e,this.options.timezone),this.name){if(B.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);B.push(this)}return i!==void 0&&xe(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 R||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new R(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=B.indexOf(this);e>=0&&B.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>Ce&&(t=Ce),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&Se(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new R(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){z(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new R(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&&z(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 R(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 R(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 R(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 R(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]}},Te=5e3,Ee=20;function De(e){return e.trim().split(/\s+/).filter(Boolean).length}function Oe(e,t){let n=De(e);if(t===`prompt`&&n!==5)return`A prompt schedule takes 5 cron fields: minute hour day month weekday`;if(t===`script`&&n!==5&&n!==6)return`A script schedule takes 5 cron fields, or 6 with seconds first`;let r;try{r=new we(e).nextRuns(Ee)}catch(e){return`Invalid cron expression: ${e.message}`}if(r.length===0)return`This cron expression never fires`;for(let e=1;e<r.length;e++)if(r[e].getTime()-r[e-1].getTime()<5e3)return`A schedule may fire at most every ${Te/1e3} seconds`;return null}function V(e,t,n){try{return new we(e).nextRuns(t,n)}catch{return[]}}var H={name:100,description:2e3,prompt:1e5,scriptBytes:1e6,inputs:50,inputLabel:100,inputDescription:500,minTimeoutMs:1e4,maxTimeoutMs:360*6e4},U={prompt:18e5,script:3e5},ke=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,Ae=[`text`,`number`,`boolean`,`secret`],je=new Set([`key`,`label`,`type`,`required`,`default`,`description`]),W=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Me=e=>new TextEncoder().encode(e).length;function Ne(e,t){return e.type===`number`?typeof t==`number`&&Number.isFinite(t):e.type===`boolean`?typeof t==`boolean`:typeof t==`string`}function Pe(e){if(!Array.isArray(e))return[`inputs must be a list`];let t=[];e.length>H.inputs&&t.push(`At most ${H.inputs} inputs`);let n=new Set;return e.forEach((e,r)=>{let i=`inputs[${r}]`;if(!W(e)){t.push(`${i} must be an object`);return}for(let n of Object.keys(e))je.has(n)||t.push(`${i}: unknown field "${n}"`);let{key:a,label:o,type:s,required:c,description:l}=e;typeof a!=`string`||!ke.test(a)?t.push(`${i}: key must be a letter or _ followed by letters, digits or _ (64 at most)`):n.has(a)?t.push(`${i}: key "${a}" is declared twice`):n.add(a);let u=typeof a==`string`?`input "${a}"`:i;(typeof o!=`string`||!o.trim()||o.length>H.inputLabel)&&t.push(`${u}: label must be 1-${H.inputLabel} characters`),(typeof s!=`string`||!Ae.includes(s))&&t.push(`${u}: type must be text, number, boolean or secret`),c!==void 0&&typeof c!=`boolean`&&t.push(`${u}: required must be true or false`),l!==void 0&&(typeof l!=`string`||l.length>H.inputDescription)&&t.push(`${u}: description must be text of at most ${H.inputDescription} characters`),`default`in e&&(s===`secret`?t.push(`${u}: a secret cannot have a default, or the file would be sharing it`):typeof s==`string`&&Ae.includes(s)&&!Ne({type:s},e.default)&&t.push(`${u}: default must be a ${s===`text`?`string`:s}`))}),t}function Fe(e){let{kind:t,mode:n,cron:r,prompt:i,script:a,inputs:o,timeoutMs:s,maxTurns:c,permissionMode:l}=e;if(t!==`prompt`&&t!==`script`)return[`kind must be "prompt" or "script"`];let u=[];if(n!==`tick`&&n!==`always-on`?u.push(`mode must be "tick" or "always-on"`):t===`prompt`&&n!==`tick`&&u.push(`A prompt schedule runs on a cron; it cannot be always on`),n===`tick`)if(typeof r!=`string`||!r.trim())u.push(`A tick schedule needs a cron expression`);else{let e=Oe(r,t);e&&u.push(e)}else n===`always-on`&&r!==void 0&&r!==``&&u.push(`An always-on schedule has no cron expression`);return t===`prompt`?(typeof i!=`string`||!i.trim()?u.push(`A prompt schedule needs a prompt`):i.length>H.prompt&&u.push(`The prompt is longer than ${H.prompt} characters`),a!=null&&a!==``&&u.push(`A prompt schedule has no script`),(Array.isArray(o)?o.length>0:o!==void 0)&&u.push(`Only a script schedule has inputs`)):(typeof a!=`string`||!a.trim()?u.push(`A script schedule needs a script`):Me(a)>H.scriptBytes&&u.push(`The script is larger than 1 MB`),i!==void 0&&i!==``&&u.push(`A script schedule has no prompt`),o!==void 0&&u.push(...Pe(o))),s!==void 0&&(n===`always-on`?u.push(`An always-on schedule has no run timeout`):(!Number.isInteger(s)||s<H.minTimeoutMs||s>H.maxTimeoutMs)&&u.push(`timeoutMs must be a whole number of milliseconds between 10 seconds and 6 hours`)),c!==void 0&&t===`script`?u.push(`Only a prompt schedule has maxTurns`):c!==void 0&&(!Number.isInteger(c)||c<1)&&u.push(`maxTurns must be a whole number of at least 1`),l!==void 0&&!he.includes(l)&&u.push(`permissionMode must be one of ${he.join(`, `)}`),u}var Ie=[`ppmScheduleTemplate`,`name`,`description`,`kind`,`mode`,`cron`,`prompt`,`script`,`inputs`,`timeoutMs`,`maxTurns`,`permissionMode`],Le=[`key`,`label`,`type`,`required`,`default`,`description`];function Re(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return{ok:!1,errors:[`This file is not JSON`]}}if(!W(t)||!(`ppmScheduleTemplate`in t))return{ok:!1,errors:[`This is not a PPM schedule template (it has no ppmScheduleTemplate field)`]};let n=t.ppmScheduleTemplate;if(n!==1)return{ok:!1,errors:[typeof n==`number`&&n>1?`This template was made by a newer PPM (format ${n}); update PPM to import it`:`Unknown template format: ${JSON.stringify(n)}`]};let r=[];for(let e of Object.keys(t))Ie.includes(e)||r.push(`Unknown field "${e}"`);let{name:i,description:a}=t;return(typeof i!=`string`||!i.trim()||i.length>H.name)&&r.push(`name must be 1-${H.name} characters`),a!==void 0&&(typeof a!=`string`||a.length>H.description)&&r.push(`description must be text of at most ${H.description} characters`),r.push(...Fe(t)),r.length?{ok:!1,errors:r}:{ok:!0,template:Be(t)}}function ze(e){return`${JSON.stringify(Be(e),null,2)}\n`}function Be(e){let t={};for(let n of Ie)e[n]!==void 0&&(t[n]=n===`inputs`&&Array.isArray(e.inputs)?e.inputs.map(e=>Ve(e,Le)):e[n]);return t}function Ve(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}var G=n(),He={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 Ue({scheduleId:e}){let{runs:t,loading:n}=me(e);return n&&t.length===0?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsx)(We,{run:e},e.id))})}function K(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function We({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((K(e.ended_at).getTime()-K(e.started_at).getTime())/1e3)}s`:`…`;return(0,G.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:x(`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,G.jsx)(`span`,{className:x(`rounded px-1.5 py-0.5 font-medium shrink-0`,He[e.status]),children:e.status}),(0,G.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[K(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,G.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,G.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,G.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}var Ge={ok:`bg-success/10 text-success`,wait:`bg-warning/10 text-warning`,bad:`bg-error/10 text-error`,off:`bg-muted text-muted-foreground`};function Ke(e,t){let{state:n,restartAt:r}=e.status;switch(n){case`running`:return{text:`Running`,tone:`ok`};case`restarting`:return r?{text:`Restarting in ${Math.max(0,Math.ceil((Date.parse(r)-t)/1e3))} s`,tone:`wait`}:{text:`Restarting`,tone:`wait`};case`starting`:return{text:`Starting`,tone:`wait`};case`stopping`:return{text:`Stopping`,tone:`wait`};case`failed`:return{text:`Failed`,tone:`bad`};case`blocked`:return{text:`Blocked`,tone:`bad`};case`stopped`:return{text:`Stopped`,tone:`off`};default:return e.enabled?{text:`Enabled`,tone:`ok`}:{text:`Disabled`,tone:`off`}}}function qe({schedule:e,className:t}){let n=e.status.state===`restarting`,[r,i]=(0,M.useState)(()=>Date.now());(0,M.useEffect)(()=>{if(!n)return;i(Date.now());let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[n,e.status.restartAt]);let{text:a,tone:o}=Ke(e,r);return(0,G.jsx)(`span`,{className:x(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0 whitespace-nowrap`,Ge[o],t),children:a})}function Je({schedule:e,onEdit:t,onLogs:n,onChanged:o}){let[c,d]=(0,M.useState)(!1),[v,b]=(0,M.useState)(0),x=e.kind===`script`,S=e.mode===`always-on`,C=x?g:r,w=async()=>{try{let t=await y.post(`/api/schedules/${e.id}/run-now`);t.runId===null?_.success(S?`Restarting`:`Tick started`):_.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),d(!0),b(e=>e+1),o()}catch(e){_.error(e instanceof Error?e.message:`Run failed`)}},T=async()=>{try{await y.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),o()}catch(e){_.error(e instanceof Error?e.message:`Update failed`)}},E=async()=>{try{let t=await y.get(`/api/schedules/${e.id}/export`);ue(new Blob([ze(t.template)],{type:`application/json`}),t.fileName);let n=`Non-secret input values were included as defaults. Secrets were left out.`;t.warnings.length?_.warning(`Template exported — check it before sharing`,{description:[n,...t.warnings].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/schedule-script-editor--roOsFbc.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-Vd9Xr54k.js","assets/preload-helper-Bf_JiD2A.js","assets/vendor-ui-BTSIXzhZ.js","assets/vendor-markdown-C-P1aR4p.js","assets/button-BHGVTbam.js","assets/utils-D3xTlJyU.js","assets/createLucideIcon-B2pji242.js","assets/file-diff-CScJM-VZ.js","assets/git-commit-horizontal-ZMFP54eB.js","assets/api-client-BnYFnEfK.js","assets/react-B9hau9ra.js","assets/open-db-tabs-DBgV2hbA.js","assets/window-store-D6EgLSfT.js","assets/minimal-mode-rLZOjciW.js","assets/panel-store-H7e9XHZF.js","assets/settings-store-CMpVMq3Y.js","assets/session-list-sync-triggers-D9i1FxWd.js","assets/project-store-Bs-kiU8m.js","assets/project-framework-store-nuePqBBa.js","assets/explorer-model-f5q-50DN.js","assets/db-sidebar-reveal-CGqWBYay.js","assets/use-is-mobile-CL2I7hLf.js","assets/db-types-cHkNH-mN.js","assets/tab-store-NUmgzMPf.js","assets/use-db-driver-installed-BL1XW_bI.js","assets/impexp-state-Cx2Az9iZ.js","assets/file-store-Bn0vbkCx.js","assets/sql-identifiers-7jHNEORb.js","assets/db-explorer-store-DJNNIfN5.js","assets/onboarding-quick-orientation-DTMrcMf0.js","assets/dialog-DnE192fh.js","assets/portal-container-context-Gepuvxdg.js","assets/icons-C1wDt09O.js","assets/format-file-meta-BOAh9mam.js","assets/fs-api-BVIVh_De.js","assets/open-settings-DWbF5YsE.js","assets/settings-categories-BY9n3BRr.js","assets/adaptive-context-menu-CxHkI7dL.js","assets/context-menu-DhKbkI1X.js","assets/mobile-bottom-sheet-M9pZptfh.js","assets/use-visual-viewport-B_GFo6k2.js","assets/dropdown-menu-CxZR_vuV.js","assets/input-CReAuQTF.js","assets/scroll-area-CSmNLlfl.js","assets/start-ellipsis-DfU-W_6j.js","assets/chat-preparation-cache-Bzb-T1pm.js","assets/clipboard-D3XnL7CB.js","assets/file-icons-CB0RsVdl.js","assets/format-date-SZ6qU2sD.js","assets/git-repo-store-CESIqItW.js","assets/patch-tab-metadata-DqvfqUI4.js","assets/ws-auth-k7DWnL9T.js","assets/apply-theme-Kiqxd1NZ.js","assets/resolve-theme-DGQXDIbF.js","assets/index-Cb3Z6wNy.css","assets/use-monaco-theme-CbNQ4HnC.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{An as r,Kr as i,L as a,O as o,P as s,Zr as c,_r as l,br as u,cr as d,ht as f,lr as p,or as m,tr as h,xt as g}from"./icons-C1wDt09O.js";import{k as _,n as v,r as y}from"./api-client-BnYFnEfK.js";import{t as b}from"./preload-helper-Bf_JiD2A.js";import{n as x}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./context-menu-DhKbkI1X.js";import{n as S}from"./use-is-mobile-CL2I7hLf.js";import{t as C}from"./button-BHGVTbam.js";import{a as w,n as T,o as E,t as D}from"./dialog-DnE192fh.js";import{t as O}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{n as ee,o as te,r as k,t as ne,u as re}from"./adaptive-context-menu-CxHkI7dL.js";import{t as A}from"./input-CReAuQTF.js";import{t as ie}from"./scroll-area-CSmNLlfl.js";import{Jn as ae,Qn as j,Xn as oe,Yn as se,Zn as ce,qn as le}from"./index-Vd9Xr54k.js";import{t as ue}from"./remote-desktop-recording-BcDx5c_k.js";import{t as de}from"./notification-settings--li9wGTJ.js";import"./claude-models-C9iHl8VB.js";var M=e(t(),1),fe=1e4;function pe(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await y.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},fe);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function me(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 y.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 he=[`default`,`acceptEdits`,`plan`,`bypassPermissions`];structuredClone(de);function N(e,t,n,r,i,a,o,s){return N.fromTZ(N.tp(e,t,n,r,i,a,o),s)}N.fromTZISO=(e,t,n)=>N.fromTZ(ge(e,t),n),N.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=P(e.tz,n),i=new Date(n.getTime()-r),a=P(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=P(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},N.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}},N.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function P(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 ge(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(`+`)?N.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):N.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}N.minitz=N;var F=32,I=31|F,_e=[1,2,4,8,16],ve=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 R(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,I),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]|F;else if(t===I)this.dayOfWeek[e]=I;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|_e[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},ye=[31,28,31,30,31,30,31,31,30,31,30,31],L=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],R=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&I&&_e[a-1]&r)return!0;if(r&F){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=N.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>ye[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=N.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(N.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():ye[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&I)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,L[n][0],e,L[n][2]);if(r>1){let i=n+1;for(;i<L.length;)this[L[i][0]]=-L[i][2],i++;if(r===3)return this[L[n][1]]++,this[L[n][0]]=-L[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=L.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)):N.fromTZ(N.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function be(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 R(e.startAt,e.timezone),e.stopAt&&=new R(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 z(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function xe(e){return z(e)}function Se(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Ce=30*1e3,B=[],we=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(z(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(z(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=be(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 ve(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new R(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new ve(e,this.options.timezone),this.name){if(B.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);B.push(this)}return i!==void 0&&xe(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 R||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new R(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=B.indexOf(this);e>=0&&B.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>Ce&&(t=Ce),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&Se(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new R(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){z(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new R(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&&z(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 R(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 R(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 R(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 R(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]}},Te=5e3,Ee=20;function De(e){return e.trim().split(/\s+/).filter(Boolean).length}function Oe(e,t){let n=De(e);if(t===`prompt`&&n!==5)return`A prompt schedule takes 5 cron fields: minute hour day month weekday`;if(t===`script`&&n!==5&&n!==6)return`A script schedule takes 5 cron fields, or 6 with seconds first`;let r;try{r=new we(e).nextRuns(Ee)}catch(e){return`Invalid cron expression: ${e.message}`}if(r.length===0)return`This cron expression never fires`;for(let e=1;e<r.length;e++)if(r[e].getTime()-r[e-1].getTime()<5e3)return`A schedule may fire at most every ${Te/1e3} seconds`;return null}function V(e,t,n){try{return new we(e).nextRuns(t,n)}catch{return[]}}var H={name:100,description:2e3,prompt:1e5,scriptBytes:1e6,inputs:50,inputLabel:100,inputDescription:500,minTimeoutMs:1e4,maxTimeoutMs:360*6e4},U={prompt:18e5,script:3e5},ke=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,Ae=[`text`,`number`,`boolean`,`secret`],je=new Set([`key`,`label`,`type`,`required`,`default`,`description`]),W=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Me=e=>new TextEncoder().encode(e).length;function Ne(e,t){return e.type===`number`?typeof t==`number`&&Number.isFinite(t):e.type===`boolean`?typeof t==`boolean`:typeof t==`string`}function Pe(e){if(!Array.isArray(e))return[`inputs must be a list`];let t=[];e.length>H.inputs&&t.push(`At most ${H.inputs} inputs`);let n=new Set;return e.forEach((e,r)=>{let i=`inputs[${r}]`;if(!W(e)){t.push(`${i} must be an object`);return}for(let n of Object.keys(e))je.has(n)||t.push(`${i}: unknown field "${n}"`);let{key:a,label:o,type:s,required:c,description:l}=e;typeof a!=`string`||!ke.test(a)?t.push(`${i}: key must be a letter or _ followed by letters, digits or _ (64 at most)`):n.has(a)?t.push(`${i}: key "${a}" is declared twice`):n.add(a);let u=typeof a==`string`?`input "${a}"`:i;(typeof o!=`string`||!o.trim()||o.length>H.inputLabel)&&t.push(`${u}: label must be 1-${H.inputLabel} characters`),(typeof s!=`string`||!Ae.includes(s))&&t.push(`${u}: type must be text, number, boolean or secret`),c!==void 0&&typeof c!=`boolean`&&t.push(`${u}: required must be true or false`),l!==void 0&&(typeof l!=`string`||l.length>H.inputDescription)&&t.push(`${u}: description must be text of at most ${H.inputDescription} characters`),`default`in e&&(s===`secret`?t.push(`${u}: a secret cannot have a default, or the file would be sharing it`):typeof s==`string`&&Ae.includes(s)&&!Ne({type:s},e.default)&&t.push(`${u}: default must be a ${s===`text`?`string`:s}`))}),t}function Fe(e){let{kind:t,mode:n,cron:r,prompt:i,script:a,inputs:o,timeoutMs:s,maxTurns:c,permissionMode:l}=e;if(t!==`prompt`&&t!==`script`)return[`kind must be "prompt" or "script"`];let u=[];if(n!==`tick`&&n!==`always-on`?u.push(`mode must be "tick" or "always-on"`):t===`prompt`&&n!==`tick`&&u.push(`A prompt schedule runs on a cron; it cannot be always on`),n===`tick`)if(typeof r!=`string`||!r.trim())u.push(`A tick schedule needs a cron expression`);else{let e=Oe(r,t);e&&u.push(e)}else n===`always-on`&&r!==void 0&&r!==``&&u.push(`An always-on schedule has no cron expression`);return t===`prompt`?(typeof i!=`string`||!i.trim()?u.push(`A prompt schedule needs a prompt`):i.length>H.prompt&&u.push(`The prompt is longer than ${H.prompt} characters`),a!=null&&a!==``&&u.push(`A prompt schedule has no script`),(Array.isArray(o)?o.length>0:o!==void 0)&&u.push(`Only a script schedule has inputs`)):(typeof a!=`string`||!a.trim()?u.push(`A script schedule needs a script`):Me(a)>H.scriptBytes&&u.push(`The script is larger than 1 MB`),i!==void 0&&i!==``&&u.push(`A script schedule has no prompt`),o!==void 0&&u.push(...Pe(o))),s!==void 0&&(n===`always-on`?u.push(`An always-on schedule has no run timeout`):(!Number.isInteger(s)||s<H.minTimeoutMs||s>H.maxTimeoutMs)&&u.push(`timeoutMs must be a whole number of milliseconds between 10 seconds and 6 hours`)),c!==void 0&&t===`script`?u.push(`Only a prompt schedule has maxTurns`):c!==void 0&&(!Number.isInteger(c)||c<1)&&u.push(`maxTurns must be a whole number of at least 1`),l!==void 0&&!he.includes(l)&&u.push(`permissionMode must be one of ${he.join(`, `)}`),u}var Ie=[`ppmScheduleTemplate`,`name`,`description`,`kind`,`mode`,`cron`,`prompt`,`script`,`inputs`,`timeoutMs`,`maxTurns`,`permissionMode`],Le=[`key`,`label`,`type`,`required`,`default`,`description`];function Re(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return{ok:!1,errors:[`This file is not JSON`]}}if(!W(t)||!(`ppmScheduleTemplate`in t))return{ok:!1,errors:[`This is not a PPM schedule template (it has no ppmScheduleTemplate field)`]};let n=t.ppmScheduleTemplate;if(n!==1)return{ok:!1,errors:[typeof n==`number`&&n>1?`This template was made by a newer PPM (format ${n}); update PPM to import it`:`Unknown template format: ${JSON.stringify(n)}`]};let r=[];for(let e of Object.keys(t))Ie.includes(e)||r.push(`Unknown field "${e}"`);let{name:i,description:a}=t;return(typeof i!=`string`||!i.trim()||i.length>H.name)&&r.push(`name must be 1-${H.name} characters`),a!==void 0&&(typeof a!=`string`||a.length>H.description)&&r.push(`description must be text of at most ${H.description} characters`),r.push(...Fe(t)),r.length?{ok:!1,errors:r}:{ok:!0,template:Be(t)}}function ze(e){return`${JSON.stringify(Be(e),null,2)}\n`}function Be(e){let t={};for(let n of Ie)e[n]!==void 0&&(t[n]=n===`inputs`&&Array.isArray(e.inputs)?e.inputs.map(e=>Ve(e,Le)):e[n]);return t}function Ve(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}var G=n(),He={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 Ue({scheduleId:e}){let{runs:t,loading:n}=me(e);return n&&t.length===0?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsx)(We,{run:e},e.id))})}function K(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function We({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((K(e.ended_at).getTime()-K(e.started_at).getTime())/1e3)}s`:`…`;return(0,G.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:x(`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,G.jsx)(`span`,{className:x(`rounded px-1.5 py-0.5 font-medium shrink-0`,He[e.status]),children:e.status}),(0,G.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[K(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,G.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,G.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,G.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}var Ge={ok:`bg-success/10 text-success`,wait:`bg-warning/10 text-warning`,bad:`bg-error/10 text-error`,off:`bg-muted text-muted-foreground`};function Ke(e,t){let{state:n,restartAt:r}=e.status;switch(n){case`running`:return{text:`Running`,tone:`ok`};case`restarting`:return r?{text:`Restarting in ${Math.max(0,Math.ceil((Date.parse(r)-t)/1e3))} s`,tone:`wait`}:{text:`Restarting`,tone:`wait`};case`starting`:return{text:`Starting`,tone:`wait`};case`stopping`:return{text:`Stopping`,tone:`wait`};case`failed`:return{text:`Failed`,tone:`bad`};case`blocked`:return{text:`Blocked`,tone:`bad`};case`stopped`:return{text:`Stopped`,tone:`off`};default:return e.enabled?{text:`Enabled`,tone:`ok`}:{text:`Disabled`,tone:`off`}}}function qe({schedule:e,className:t}){let n=e.status.state===`restarting`,[r,i]=(0,M.useState)(()=>Date.now());(0,M.useEffect)(()=>{if(!n)return;i(Date.now());let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[n,e.status.restartAt]);let{text:a,tone:o}=Ke(e,r);return(0,G.jsx)(`span`,{className:x(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0 whitespace-nowrap`,Ge[o],t),children:a})}function Je({schedule:e,onEdit:t,onLogs:n,onChanged:o}){let[c,d]=(0,M.useState)(!1),[v,b]=(0,M.useState)(0),x=e.kind===`script`,S=e.mode===`always-on`,C=x?g:r,w=async()=>{try{let t=await y.post(`/api/schedules/${e.id}/run-now`);t.runId===null?_.success(S?`Restarting`:`Tick started`):_.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),d(!0),b(e=>e+1),o()}catch(e){_.error(e instanceof Error?e.message:`Run failed`)}},T=async()=>{try{await y.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),o()}catch(e){_.error(e instanceof Error?e.message:`Update failed`)}},E=async()=>{try{let t=await y.get(`/api/schedules/${e.id}/export`);ue(new Blob([ze(t.template)],{type:`application/json`}),t.fileName);let n=`Non-secret input values were included as defaults. Secrets were left out.`;t.warnings.length?_.warning(`Template exported — check it before sharing`,{description:[n,...t.warnings].join(`
3
3
  `)}):_.success(`Template exported`,{description:n})}catch(e){_.error(e instanceof Error?e.message:`Export failed`)}},D=async()=>{try{await y.del(`/api/schedules/${e.id}`),_.success(`Schedule deleted`),o()}catch(e){_.error(e instanceof Error?e.message:`Delete failed`)}},O=S?`Always on`:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]});return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,G.jsxs)(ne,{children:[(0,G.jsx)(re,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>d(!c),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:[c?(0,G.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,G.jsx)(a,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(C,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:O})]}),(0,G.jsx)(qe,{schedule:e})]})}),(0,G.jsxs)(ee,{children:[(0,G.jsx)(k,{onClick:w,children:S?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(l,{className:`size-3.5`}),` Restart`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m,{className:`size-3.5`}),` Run now`]})}),(0,G.jsxs)(k,{onClick:T,children:[(0,G.jsx)(p,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,G.jsxs)(k,{onClick:t,children:[(0,G.jsx)(h,{className:`size-3.5`}),` Edit`]}),x&&(0,G.jsxs)(k,{onClick:n,children:[(0,G.jsx)(u,{className:`size-3.5`}),` Logs`]}),(0,G.jsxs)(k,{onClick:E,children:[(0,G.jsx)(f,{className:`size-3.5`}),` Export template`]}),(0,G.jsx)(te,{}),(0,G.jsxs)(k,{variant:`destructive`,onClick:D,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Delete`]})]})]}),c&&(0,G.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:x?e.description||`Script schedule`:e.prompt}),e.status.lastError&&(0,G.jsx)(`p`,{className:`text-[11px] text-error break-all line-clamp-3`,children:e.status.lastError}),(0,G.jsx)(Ue,{scheduleId:e.id},v)]})]})}function Ye(e,t,n){return e.filter(e=>e.required).filter(e=>e.type===`secret`?!n.includes(e.key):t[e.key]===void 0&&e.default===void 0).map(e=>e.key)}var Xe=`export default async (ctx) => {
4
4
  ctx.log("Hello from", ctx.schedule.name);
5
5
  };
6
- `;function Ze(e){return{kind:e?.kind??`prompt`,mode:e?.mode??`tick`,name:e?.name??``,description:e?.description??``,projectPath:e?.project_path??``,cron:e?e.cron_expr:`0 7 * * *`,prompt:e?.prompt??``,script:e?.script??Xe,permissionMode:e?.permission_mode??`bypassPermissions`,maxTurns:e?.max_turns==null?``:String(e.max_turns),timeoutMs:String(e?.timeout_ms??U.prompt),enabled:e?!!e.enabled:!0,inputs:(e?.inputs??[]).map($e),values:Object.fromEntries(Object.entries(e?.inputValues??{}).map(([e,t])=>[e,String(t)])),secrets:{}}}function Qe(e,t){let n=e.timeoutMs!==String(U[e.kind]);return{...e,kind:t,mode:t===`prompt`?`tick`:e.mode,timeoutMs:n?e.timeoutMs:String(U[t])}}function $e(e){return{key:e.key,label:e.label,type:e.type,required:!!e.required,default:e.default===void 0?``:String(e.default),description:e.description??``}}function q(e,t){return e===`number`?t.trim()!==``&&Number.isFinite(Number(t))?Number(t):t:e===`boolean`?t===`true`?!0:t===`false`?!1:t:t}function J(e){return e.map(e=>({key:e.key.trim(),label:e.label.trim(),type:e.type,...e.required&&{required:!0},...e.default!==``&&e.type!==`secret`&&{default:q(e.type,e.default)},...e.description.trim()&&{description:e.description.trim()}}))}function Y(e,t){return Object.fromEntries(e.filter(e=>e.type!==`secret`).map(e=>{let n=t[e.key]??``;return[e.key,n===``?null:q(e.type,n)]}))}function X(e,t){return Object.fromEntries(e.filter(e=>e.type===`secret`&&t[e.key]).map(e=>[e.key,t[e.key]]))}function et(e,t){let n={name:e.name.trim(),description:e.description,project_path:e.projectPath,permission_mode:e.permissionMode,enabled:e.enabled,mode:e.mode,...!t&&{kind:e.kind}};if(e.mode===`tick`&&Object.assign(n,{cron_expr:e.cron.trim(),timeout_ms:Number(e.timeoutMs)}),e.kind===`prompt`)return{...n,prompt:e.prompt,max_turns:e.maxTurns===``?null:Number(e.maxTurns)};let r=J(e.inputs),i=X(r,e.secrets);return{...n,script:e.script,inputs:r,inputValues:Y(r,e.values),...Object.keys(i).length>0&&{secrets:i}}}function tt(e,t=[]){let n=[];e.name.trim()||n.push(`Give the schedule a name`),e.projectPath||n.push(`Pick a project`);let r=J(e.inputs);return n.push(...Fe({kind:e.kind,mode:e.mode,cron:e.mode===`tick`?e.cron.trim():void 0,prompt:e.kind===`prompt`?e.prompt:void 0,script:e.kind===`script`?e.script:void 0,inputs:e.kind===`script`?r:void 0,timeoutMs:e.mode===`tick`?Number(e.timeoutMs):void 0,maxTurns:e.kind===`prompt`&&e.maxTurns!==``?Number(e.maxTurns):void 0,permissionMode:e.permissionMode})),e.kind!==`script`||n.length?n:(n.push(...nt(r,e.values)),e.enabled&&n.push(...rt(r,e.values,[...t,...Object.keys(X(r,e.secrets))])),n)}function nt(e,t){return e.filter(e=>e.type===`number`&&(t[e.key]??``)!==``&&typeof q(`number`,t[e.key])!=`number`).map(e=>`${e.label} must be a number`)}function rt(e,t,n){let r=Ye(e,Object.fromEntries(Object.entries(Y(e,t)).filter(e=>e[1]!==null)),n);return r.length?[`Fill in ${r.join(`, `)} before turning it on`]:[]}var it=[`text`,`number`,`boolean`,`secret`],Z=`h-11 md:h-9 text-xs`,at=`h-11 md:h-9 w-full rounded-md border border-input bg-transparent px-2 text-xs`;function ot({inputs:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r,...r.type===`secret`&&{default:``}}:e));return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[e.length===0&&(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`No inputs. A script reads its inputs as ctx.inputs.`}),e.map((r,a)=>(0,G.jsxs)(`div`,{className:`rounded-md border border-border p-2 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(A,{"aria-label":`Key`,value:r.key,onChange:e=>n(a,{key:e.target.value}),placeholder:`key`,className:`${Z} font-mono`}),(0,G.jsx)(A,{"aria-label":`Label`,value:r.label,onChange:e=>n(a,{label:e.target.value}),placeholder:`Label`,className:Z})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(`select`,{"aria-label":`Type`,value:r.type,onChange:e=>n(a,{type:e.target.value}),className:at,children:it.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(st,{draft:r,onChange:e=>n(a,{default:e})})]}),(0,G.jsx)(A,{"aria-label":`Description`,value:r.description,onChange:e=>n(a,{description:e.target.value}),placeholder:`Description (optional)`,className:Z}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between min-h-11 md:min-h-9`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(j,{checked:r.required,onCheckedChange:e=>n(a,{required:e})}),` Required`]}),(0,G.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t(e.filter((e,t)=>t!==a)),className:`min-h-11 md:min-h-8 text-xs gap-1 text-error cursor-pointer`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Remove`]})]})]},a)),(0,G.jsxs)(C,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>t([...e,{key:``,label:``,type:`text`,required:!1,default:``,description:``}]),className:`w-full min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add input`]})]})}function st({draft:e,onChange:t}){return e.type===`secret`?(0,G.jsx)(`p`,{className:`flex items-center text-[11px] text-muted-foreground`,children:`A secret has no default`}):e.type===`boolean`?(0,G.jsxs)(`select`,{"aria-label":`Default`,value:e.default,onChange:e=>t(e.target.value),className:at,children:[(0,G.jsx)(`option`,{value:``,children:`No default`}),(0,G.jsx)(`option`,{value:`true`,children:`Default: on`}),(0,G.jsx)(`option`,{value:`false`,children:`Default: off`})]}):(0,G.jsx)(A,{"aria-label":`Default`,value:e.default,onChange:e=>t(e.target.value),placeholder:`Default (optional)`,inputMode:e.type===`number`?`decimal`:void 0,className:Z})}function ct({decls:e,values:t,secrets:n,secretsSet:r=[],onValue:i,onSecret:a}){return e.length===0?null:(0,G.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[e.label||e.key,e.required&&(0,G.jsx)(`span`,{className:`text-error`,children:` *`})]}),e.type===`boolean`?(0,G.jsx)(`div`,{className:`flex items-center min-h-11 md:min-h-9`,children:(0,G.jsx)(j,{"aria-label":e.label||e.key,checked:(t[e.key]??String(e.default??!1))===`true`,onCheckedChange:t=>i(e.key,String(t))})}):e.type===`secret`?(0,G.jsx)(A,{type:`password`,autoComplete:`new-password`,"aria-label":e.label||e.key,value:n[e.key]??``,onChange:t=>a(e.key,t.target.value),placeholder:r.includes(e.key)?`Saved — leave blank to keep`:`Not set`,className:`h-11 md:h-9 text-xs`}):(0,G.jsx)(A,{"aria-label":e.label||e.key,value:t[e.key]??``,onChange:t=>i(e.key,t.target.value),placeholder:e.default===void 0?``:`Default: ${String(e.default)}`,inputMode:e.type===`number`?`decimal`:void 0,className:`h-11 md:h-9 text-xs`}),e.description&&(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description})]},e.key))})}var lt=(0,M.lazy)(()=>b(()=>import(`./schedule-script-editor-CKUl2qxf.js`).then(e=>({default:e.ScheduleScriptEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57])));function ut({form:e,set:t,secretsSet:n}){let r=(0,M.useMemo)(()=>J(e.inputs),[e.inputs]);return(0,G.jsxs)(G.Fragment,{children:[e.kind===`script`&&(0,G.jsxs)(Q,{label:`Mode`,children:[(0,G.jsx)(ft,{value:e.mode,options:[[`tick`,`Tick`],[`always-on`,`Always on`]],onChange:e=>t(`mode`,e)}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.mode===`tick`?`Runs once on each cron fire, to the end.`:`Kept running; started again if it stops.`})]}),e.mode===`tick`&&(0,G.jsx)(dt,{kind:e.kind,value:e.cron,onChange:e=>t(`cron`,e)}),e.kind===`prompt`?(0,G.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,G.jsx)(`textarea`,{value:e.prompt,onChange:e=>t(`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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{label:`Script`,children:(0,G.jsx)(M.Suspense,{fallback:(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-2`,children:`Loading editor…`}),children:(0,G.jsx)(lt,{value:e.script,onChange:e=>t(`script`,e)})})}),(0,G.jsx)(Q,{label:`Inputs`,children:(0,G.jsx)(ot,{inputs:e.inputs,onChange:e=>t(`inputs`,e)})}),r.length>0&&(0,G.jsx)(Q,{label:`Values`,children:(0,G.jsx)(ct,{decls:r.filter(e=>e.key),values:e.values,secrets:e.secrets,secretsSet:n,onValue:(n,r)=>t(`values`,{...e.values,[n]:r}),onSecret:(n,r)=>t(`secrets`,{...e.secrets,[n]:r})})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[e.kind===`prompt`&&(0,G.jsx)(Q,{label:`Max turns (optional)`,children:(0,G.jsx)(A,{type:`number`,min:1,value:e.maxTurns,onChange:e=>t(`maxTurns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),e.mode===`tick`&&(0,G.jsx)(Q,{label:`Timeout (ms)`,children:(0,G.jsx)(A,{type:`number`,min:1e4,value:e.timeoutMs,onChange:e=>t(`timeoutMs`,e.target.value),className:`h-11 md:h-9 text-xs`})})]})]})}function dt({kind:e,value:t,onChange:n}){let r=(0,M.useMemo)(()=>t.trim()?Oe(t,e)||`Next: ${V(t,3).map(e=>e.toLocaleString()).join(` · `)}`:`—`,[t,e]);return(0,G.jsxs)(Q,{label:e===`script`?`Cron (local timezone; seconds first is allowed)`:`Cron expression (local timezone)`,children:[(0,G.jsx)(A,{value:t,onChange:e=>n(e.target.value),placeholder:e===`script`?`*/30 * * * * *`:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:r})]})}function ft({value:e,options:t,onChange:n,disabled:r}){return(0,G.jsx)(`div`,{className:`grid grid-flow-col auto-cols-fr gap-1 rounded-md border border-border p-1`,children:t.map(([t,i])=>(0,G.jsx)(`button`,{type:`button`,disabled:r,"aria-pressed":e===t,onClick:()=>n(t),className:x(`min-h-11 md:min-h-8 rounded text-xs font-medium cursor-pointer disabled:cursor-not-allowed disabled:opacity-60`,e===t?`bg-primary text-primary-foreground`:`text-muted-foreground active:bg-accent/40`),children:i},t))})}function Q({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $({open:e,onClose:t,title:n,wide:r,children:i}){return S()?(0,G.jsxs)(O,{open:e,onClose:t,className:`max-h-[85vh] flex flex-col`,children:[(0,G.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2 px-3 truncate`,children:n}),(0,G.jsx)(ie,{className:`flex-1 min-h-0 px-3 pb-3`,children:i})]}):(0,G.jsx)(D,{open:e,onOpenChange:e=>!e&&t(),children:(0,G.jsxs)(T,{className:x(r?`max-w-2xl`:`max-w-md`,`max-h-[85vh] overflow-y-auto`),children:[(0,G.jsx)(w,{children:(0,G.jsx)(E,{className:`text-sm truncate`,children:n})}),i]})})}var pt=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function mt(e){let t=e instanceof v?e.body?.problems:void 0;return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[e instanceof Error?e.message:String(e)]}function ht({open:e,schedule:t,onClose:n,onSaved:r}){let[i,a]=(0,M.useState)(()=>Ze(t)),[o,s]=(0,M.useState)([]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)([]);(0,M.useEffect)(()=>{e&&(a(Ze(t)),d([]),y.get(`/api/projects`).then(s).catch(()=>s([])))},[e,t]);let f=(e,t)=>a(n=>({...n,[e]:t}));return(0,G.jsx)($,{open:e,onClose:n,title:t?`Edit: ${t.name}`:`New schedule`,wide:i.kind===`script`,children:(0,G.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,G.jsx)(Q,{label:`Kind`,children:(0,G.jsx)(ft,{value:i.kind,options:[[`prompt`,`Prompt`],[`script`,`Script`]],onChange:e=>a(t=>Qe(t,e)),disabled:!!t})}),(0,G.jsx)(Q,{label:`Name`,children:(0,G.jsx)(A,{value:i.name,onChange:e=>f(`name`,e.target.value),placeholder:i.kind===`script`?`Support inbox watcher`:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),i.kind===`script`&&(0,G.jsx)(Q,{label:`Description (optional)`,children:(0,G.jsx)(A,{value:i.description,onChange:e=>f(`description`,e.target.value),className:`h-11 md:h-9 text-xs`})}),(0,G.jsx)(Q,{label:`Project`,children:(0,G.jsxs)(oe,{value:i.projectPath,onValueChange:e=>f(`projectPath`,e),children:[(0,G.jsx)(ce,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,G.jsx)(se,{placeholder:`Select project`})}),(0,G.jsx)(le,{children:o.map(e=>(0,G.jsx)(ae,{value:e.path,children:e.name},e.path))})]})}),(0,G.jsx)(ut,{form:i,set:f,secretsSet:t?.secretsSet??[]}),(0,G.jsxs)(Q,{label:i.kind===`script`?`Permission mode (for ctx.ai.chat)`:`Permission mode`,children:[(0,G.jsxs)(oe,{value:i.permissionMode,onValueChange:e=>f(`permissionMode`,e),children:[(0,G.jsx)(ce,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,G.jsx)(se,{})}),(0,G.jsx)(le,{children:pt.map(e=>(0,G.jsx)(ae,{value:e,children:e},e))})]}),i.permissionMode===`bypassPermissions`&&(0,G.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,G.jsx)(j,{checked:i.enabled,onCheckedChange:e=>f(`enabled`,e)})]}),u.length>0&&(0,G.jsx)(`ul`,{className:`space-y-0.5 text-[11px] text-error`,children:u.map(e=>(0,G.jsx)(`li`,{children:e},e))}),(0,G.jsx)(C,{onClick:async()=>{let e=tt(i,t?.secretsSet);if(e.length){d(e);return}l(!0),d([]);try{let e=et(i,!!t);t?await y.patch(`/api/schedules/${t.id}`,e):await y.post(`/api/schedules`,e),r(),n()}catch(e){d(mt(e))}finally{l(!1)}},disabled:c,className:`w-full min-h-11 cursor-pointer`,children:c?`Saving…`:t?`Save changes`:`Create schedule`})]})})}var gt=(0,M.lazy)(()=>b(()=>import(`./schedule-script-editor-CKUl2qxf.js`).then(e=>({default:e.ScheduleScriptEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),_t=2*1024*1024,vt=`h-11 md:h-9 w-full rounded-md border border-input bg-transparent px-2 text-xs`;function yt({open:e,onClose:t,onImported:n}){let r=(0,M.useRef)(null),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)([]),[l,u]=(0,M.useState)([]),[d,f]=(0,M.useState)(``),[p,m]=(0,M.useState)({}),[h,g]=(0,M.useState)({}),[v,b]=(0,M.useState)(!1),[x,S]=(0,M.useState)(!1);(0,M.useEffect)(()=>{e&&(a(null),s([]),m({}),g({}),b(!1),y.get(`/api/projects`).then(e=>{u(e),f(e[0]?.name??``)}).catch(()=>u([])))},[e]);let w=i?.inputs??[],T=(0,M.useMemo)(()=>i?.cron?V(i.cron,3):[],[i]),E=async e=>{if(!e)return;if(e.size>_t){s([`${e.name} is ${(e.size/1024/1024).toFixed(1)} MB; a template is far smaller`]);return}let t=Re(await e.text());a(t.ok?t.template:null),s(t.ok?[]:t.errors)},D=async()=>{if(i){S(!0),s([]);try{let e=Object.fromEntries(Object.entries(Y(w,p)).filter(([,e])=>e!==null));await y.post(`/api/schedules/import`,{template:i,projectName:d,inputValues:e,secrets:X(w,h),trust:v}),_.success(`Imported "${i.name}"`,{description:`It is turned off. Turn it on when you are ready.`}),n(),t()}catch(e){s(mt(e))}finally{S(!1)}}};return(0,G.jsx)($,{open:e,onClose:t,title:i?`Import: ${i.name}`:`Import template`,wide:!!i,children:(0,G.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`.json,application/json`,className:`hidden`,onChange:e=>{E(e.target.files?.[0]),e.target.value=``}}),!i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pick a `,(0,G.jsx)(`span`,{className:`font-mono`,children:`.ppm-schedule.json`}),` file. You will see all of its code before anything is created.`]}),(0,G.jsxs)(C,{type:`button`,variant:`outline`,onClick:()=>r.current?.click(),className:`w-full min-h-11 gap-1 cursor-pointer`,children:[(0,G.jsx)(c,{className:`size-4`}),` `,o.length?`Choose another file`:`Choose a template file`]})]}),i&&(0,G.jsxs)(G.Fragment,{children:[i.description&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap`,children:i.description}),(0,G.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[i.kind===`script`?`Script · ${i.mode===`always-on`?`always on`:`tick`}`:`Prompt`,i.cron&&(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`font-mono`,children:i.cron})]}),T.length>0&&` · next ${T.map(e=>e.toLocaleString()).join(` · `)}`]}),(0,G.jsx)(Q,{label:i.kind===`script`?`Code (read it all before you trust it)`:`Prompt`,children:i.kind===`script`?(0,G.jsx)(M.Suspense,{fallback:(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-2`,children:`Loading code…`}),children:(0,G.jsx)(gt,{value:i.script??``,readOnly:!0,title:i.name})}):(0,G.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md border border-border p-2 text-[11px] whitespace-pre-wrap break-all`,children:i.prompt})}),w.length>0&&(0,G.jsx)(Q,{label:`Inputs`,children:(0,G.jsx)(ct,{decls:w,values:p,secrets:h,onValue:(e,t)=>m(n=>({...n,[e]:t})),onSecret:(e,t)=>g(n=>({...n,[e]:t}))})}),(0,G.jsx)(Q,{label:`Project`,children:(0,G.jsx)(`select`,{"aria-label":`Project`,value:d,onChange:e=>f(e.target.value),className:vt,children:l.map(e=>(0,G.jsx)(`option`,{value:e.name,children:e.name},e.path))})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-3 min-h-11 py-2 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>b(e.target.checked),className:`mt-0.5 size-5 shrink-0 accent-primary`}),(0,G.jsx)(`span`,{children:`I have read this code and trust it to run on this machine`})]})]}),o.length>0&&(0,G.jsx)(`ul`,{className:`space-y-0.5 text-[11px] text-error`,children:o.map(e=>(0,G.jsx)(`li`,{children:e},e))}),i&&(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(C,{type:`button`,variant:`outline`,onClick:()=>r.current?.click(),className:`min-h-11 cursor-pointer`,children:`Other file`}),(0,G.jsx)(C,{type:`button`,onClick:D,disabled:!v||!d||x,className:`min-h-11 cursor-pointer`,children:x?`Importing…`:`Import (disabled)`})]})]})})}var bt=2e3,xt=1e3;function St({schedule:e,onClose:t,onChanged:n}){let[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)(null),s=(0,M.useRef)(0),c=(0,M.useRef)(null),u=(0,M.useRef)(!0),d=e?.id;if((0,M.useEffect)(()=>{if(d===void 0)return;let e=!1,t=!1;s.current=0,u.current=!0,i([]),o(null);let n=async()=>{if(!t){t=!0;try{let t=await y.get(`/api/schedules/${d}/logs?after=${s.current}`);if(e)return;o(t.status);let n=t.last<s.current,r=n?(await y.get(`/api/schedules/${d}/logs`)).lines:t.lines;if(e)return;n&&i([]),r.length?(s.current=r[r.length-1].seq,i(e=>[...e,...r].slice(-xt))):n&&(s.current=0)}catch{}finally{t=!1}}};n();let r=setInterval(()=>{document.visibilityState===`visible`&&n()},bt);return()=>{e=!0,clearInterval(r)}},[d]),(0,M.useLayoutEffect)(()=>{let e=c.current;e&&u.current&&(e.scrollTop=e.scrollHeight)},[r]),!e)return null;let f=e.mode===`always-on`,p={...e,status:a??e.status};return(0,G.jsx)($,{open:!0,onClose:t,title:`Logs: ${e.name}`,wide:!0,children:(0,G.jsxs)(`div`,{className:`space-y-2 px-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground min-w-0`,children:[(0,G.jsx)(qe,{schedule:p}),p.status.pid!==null&&(0,G.jsxs)(`span`,{children:[`pid `,p.status.pid]}),p.status.since&&(0,G.jsxs)(`span`,{className:`truncate`,children:[`since `,new Date(p.status.since).toLocaleString()]}),p.status.restarts>0&&(0,G.jsxs)(`span`,{children:[p.status.restarts,` restarts`]})]}),p.status.lastError&&(0,G.jsx)(`p`,{className:`text-[11px] text-error break-all whitespace-pre-wrap line-clamp-6`,children:p.status.lastError}),(0,G.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:`h-[50vh] overflow-y-auto rounded-md border border-border bg-muted/30 p-2 font-mono text-[11px] leading-relaxed`,children:r.length===0?(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:`Nothing printed yet. Lines from ctx.log and console appear here as they are printed.`}):r.map(e=>(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap break-all`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[new Date(e.at).toLocaleTimeString(),` `]}),e.text]},e.seq))}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(C,{type:`button`,variant:`outline`,onClick:t,className:`min-h-11 cursor-pointer`,children:`Close`}),(0,G.jsx)(C,{type:`button`,onClick:async()=>{try{await y.post(`/api/schedules/${e.id}/run-now`),_.success(f?`Restarting`:`Tick started`),n()}catch(e){_.error(e instanceof Error?e.message:`Run failed`)}},disabled:f&&!e.enabled,className:`min-h-11 gap-1 cursor-pointer`,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(l,{className:`size-4`}),` Restart`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m,{className:`size-4`}),` Run now`]})})]})]})})}function Ct(){let{schedules:e,loading:t,refetch:n}=pe(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),[l,u]=(0,M.useState)(!1),[f,p]=(0,M.useState)(null),m=()=>{s(null),i(!0)},h=e=>{s(e),i(!0)},g=e.find(e=>e.id===f)??null;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended, or run a script on a cron or always on.`}),(0,G.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,G.jsxs)(C,{size:`sm`,variant:`outline`,onClick:()=>u(!0),className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(c,{className:`size-3.5`}),` Import`]}),(0,G.jsxs)(C,{size:`sm`,onClick:m,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add`]})]})]}),t&&e.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude or a script periodically, or import a template.`}),(0,G.jsxs)(C,{size:`sm`,onClick:m,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add schedule`]})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,G.jsx)(Je,{schedule:e,onEdit:()=>h(e),onLogs:()=>p(e.id),onChanged:n},e.id))}),(0,G.jsx)(ht,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n}),(0,G.jsx)(yt,{open:l,onClose:()=>u(!1),onImported:n}),(0,G.jsx)(St,{schedule:g,onClose:()=>p(null),onChanged:n})]})}export{Ct as SchedulesSettingsSection};
6
+ `;function Ze(e){return{kind:e?.kind??`prompt`,mode:e?.mode??`tick`,name:e?.name??``,description:e?.description??``,projectPath:e?.project_path??``,cron:e?e.cron_expr:`0 7 * * *`,prompt:e?.prompt??``,script:e?.script??Xe,permissionMode:e?.permission_mode??`bypassPermissions`,maxTurns:e?.max_turns==null?``:String(e.max_turns),timeoutMs:String(e?.timeout_ms??U.prompt),enabled:e?!!e.enabled:!0,inputs:(e?.inputs??[]).map($e),values:Object.fromEntries(Object.entries(e?.inputValues??{}).map(([e,t])=>[e,String(t)])),secrets:{}}}function Qe(e,t){let n=e.timeoutMs!==String(U[e.kind]);return{...e,kind:t,mode:t===`prompt`?`tick`:e.mode,timeoutMs:n?e.timeoutMs:String(U[t])}}function $e(e){return{key:e.key,label:e.label,type:e.type,required:!!e.required,default:e.default===void 0?``:String(e.default),description:e.description??``}}function q(e,t){return e===`number`?t.trim()!==``&&Number.isFinite(Number(t))?Number(t):t:e===`boolean`?t===`true`?!0:t===`false`?!1:t:t}function J(e){return e.map(e=>({key:e.key.trim(),label:e.label.trim(),type:e.type,...e.required&&{required:!0},...e.default!==``&&e.type!==`secret`&&{default:q(e.type,e.default)},...e.description.trim()&&{description:e.description.trim()}}))}function Y(e,t){return Object.fromEntries(e.filter(e=>e.type!==`secret`).map(e=>{let n=t[e.key]??``;return[e.key,n===``?null:q(e.type,n)]}))}function X(e,t){return Object.fromEntries(e.filter(e=>e.type===`secret`&&t[e.key]).map(e=>[e.key,t[e.key]]))}function et(e,t){let n={name:e.name.trim(),description:e.description,project_path:e.projectPath,permission_mode:e.permissionMode,enabled:e.enabled,mode:e.mode,...!t&&{kind:e.kind}};if(e.mode===`tick`&&Object.assign(n,{cron_expr:e.cron.trim(),timeout_ms:Number(e.timeoutMs)}),e.kind===`prompt`)return{...n,prompt:e.prompt,max_turns:e.maxTurns===``?null:Number(e.maxTurns)};let r=J(e.inputs),i=X(r,e.secrets);return{...n,script:e.script,inputs:r,inputValues:Y(r,e.values),...Object.keys(i).length>0&&{secrets:i}}}function tt(e,t=[]){let n=[];e.name.trim()||n.push(`Give the schedule a name`),e.projectPath||n.push(`Pick a project`);let r=J(e.inputs);return n.push(...Fe({kind:e.kind,mode:e.mode,cron:e.mode===`tick`?e.cron.trim():void 0,prompt:e.kind===`prompt`?e.prompt:void 0,script:e.kind===`script`?e.script:void 0,inputs:e.kind===`script`?r:void 0,timeoutMs:e.mode===`tick`?Number(e.timeoutMs):void 0,maxTurns:e.kind===`prompt`&&e.maxTurns!==``?Number(e.maxTurns):void 0,permissionMode:e.permissionMode})),e.kind!==`script`||n.length?n:(n.push(...nt(r,e.values)),e.enabled&&n.push(...rt(r,e.values,[...t,...Object.keys(X(r,e.secrets))])),n)}function nt(e,t){return e.filter(e=>e.type===`number`&&(t[e.key]??``)!==``&&typeof q(`number`,t[e.key])!=`number`).map(e=>`${e.label} must be a number`)}function rt(e,t,n){let r=Ye(e,Object.fromEntries(Object.entries(Y(e,t)).filter(e=>e[1]!==null)),n);return r.length?[`Fill in ${r.join(`, `)} before turning it on`]:[]}var it=[`text`,`number`,`boolean`,`secret`],Z=`h-11 md:h-9 text-xs`,at=`h-11 md:h-9 w-full rounded-md border border-input bg-transparent px-2 text-xs`;function ot({inputs:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?{...e,...r,...r.type===`secret`&&{default:``}}:e));return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[e.length===0&&(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`No inputs. A script reads its inputs as ctx.inputs.`}),e.map((r,a)=>(0,G.jsxs)(`div`,{className:`rounded-md border border-border p-2 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(A,{"aria-label":`Key`,value:r.key,onChange:e=>n(a,{key:e.target.value}),placeholder:`key`,className:`${Z} font-mono`}),(0,G.jsx)(A,{"aria-label":`Label`,value:r.label,onChange:e=>n(a,{label:e.target.value}),placeholder:`Label`,className:Z})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(`select`,{"aria-label":`Type`,value:r.type,onChange:e=>n(a,{type:e.target.value}),className:at,children:it.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(st,{draft:r,onChange:e=>n(a,{default:e})})]}),(0,G.jsx)(A,{"aria-label":`Description`,value:r.description,onChange:e=>n(a,{description:e.target.value}),placeholder:`Description (optional)`,className:Z}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between min-h-11 md:min-h-9`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(j,{checked:r.required,onCheckedChange:e=>n(a,{required:e})}),` Required`]}),(0,G.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t(e.filter((e,t)=>t!==a)),className:`min-h-11 md:min-h-8 text-xs gap-1 text-error cursor-pointer`,children:[(0,G.jsx)(i,{className:`size-3.5`}),` Remove`]})]})]},a)),(0,G.jsxs)(C,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>t([...e,{key:``,label:``,type:`text`,required:!1,default:``,description:``}]),className:`w-full min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add input`]})]})}function st({draft:e,onChange:t}){return e.type===`secret`?(0,G.jsx)(`p`,{className:`flex items-center text-[11px] text-muted-foreground`,children:`A secret has no default`}):e.type===`boolean`?(0,G.jsxs)(`select`,{"aria-label":`Default`,value:e.default,onChange:e=>t(e.target.value),className:at,children:[(0,G.jsx)(`option`,{value:``,children:`No default`}),(0,G.jsx)(`option`,{value:`true`,children:`Default: on`}),(0,G.jsx)(`option`,{value:`false`,children:`Default: off`})]}):(0,G.jsx)(A,{"aria-label":`Default`,value:e.default,onChange:e=>t(e.target.value),placeholder:`Default (optional)`,inputMode:e.type===`number`?`decimal`:void 0,className:Z})}function ct({decls:e,values:t,secrets:n,secretsSet:r=[],onValue:i,onSecret:a}){return e.length===0?null:(0,G.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[e.label||e.key,e.required&&(0,G.jsx)(`span`,{className:`text-error`,children:` *`})]}),e.type===`boolean`?(0,G.jsx)(`div`,{className:`flex items-center min-h-11 md:min-h-9`,children:(0,G.jsx)(j,{"aria-label":e.label||e.key,checked:(t[e.key]??String(e.default??!1))===`true`,onCheckedChange:t=>i(e.key,String(t))})}):e.type===`secret`?(0,G.jsx)(A,{type:`password`,autoComplete:`new-password`,"aria-label":e.label||e.key,value:n[e.key]??``,onChange:t=>a(e.key,t.target.value),placeholder:r.includes(e.key)?`Saved — leave blank to keep`:`Not set`,className:`h-11 md:h-9 text-xs`}):(0,G.jsx)(A,{"aria-label":e.label||e.key,value:t[e.key]??``,onChange:t=>i(e.key,t.target.value),placeholder:e.default===void 0?``:`Default: ${String(e.default)}`,inputMode:e.type===`number`?`decimal`:void 0,className:`h-11 md:h-9 text-xs`}),e.description&&(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description})]},e.key))})}var lt=(0,M.lazy)(()=>b(()=>import(`./schedule-script-editor--roOsFbc.js`).then(e=>({default:e.ScheduleScriptEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57])));function ut({form:e,set:t,secretsSet:n}){let r=(0,M.useMemo)(()=>J(e.inputs),[e.inputs]);return(0,G.jsxs)(G.Fragment,{children:[e.kind===`script`&&(0,G.jsxs)(Q,{label:`Mode`,children:[(0,G.jsx)(ft,{value:e.mode,options:[[`tick`,`Tick`],[`always-on`,`Always on`]],onChange:e=>t(`mode`,e)}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.mode===`tick`?`Runs once on each cron fire, to the end.`:`Kept running; started again if it stops.`})]}),e.mode===`tick`&&(0,G.jsx)(dt,{kind:e.kind,value:e.cron,onChange:e=>t(`cron`,e)}),e.kind===`prompt`?(0,G.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,G.jsx)(`textarea`,{value:e.prompt,onChange:e=>t(`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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{label:`Script`,children:(0,G.jsx)(M.Suspense,{fallback:(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-2`,children:`Loading editor…`}),children:(0,G.jsx)(lt,{value:e.script,onChange:e=>t(`script`,e)})})}),(0,G.jsx)(Q,{label:`Inputs`,children:(0,G.jsx)(ot,{inputs:e.inputs,onChange:e=>t(`inputs`,e)})}),r.length>0&&(0,G.jsx)(Q,{label:`Values`,children:(0,G.jsx)(ct,{decls:r.filter(e=>e.key),values:e.values,secrets:e.secrets,secretsSet:n,onValue:(n,r)=>t(`values`,{...e.values,[n]:r}),onSecret:(n,r)=>t(`secrets`,{...e.secrets,[n]:r})})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[e.kind===`prompt`&&(0,G.jsx)(Q,{label:`Max turns (optional)`,children:(0,G.jsx)(A,{type:`number`,min:1,value:e.maxTurns,onChange:e=>t(`maxTurns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),e.mode===`tick`&&(0,G.jsx)(Q,{label:`Timeout (ms)`,children:(0,G.jsx)(A,{type:`number`,min:1e4,value:e.timeoutMs,onChange:e=>t(`timeoutMs`,e.target.value),className:`h-11 md:h-9 text-xs`})})]})]})}function dt({kind:e,value:t,onChange:n}){let r=(0,M.useMemo)(()=>t.trim()?Oe(t,e)||`Next: ${V(t,3).map(e=>e.toLocaleString()).join(` · `)}`:`—`,[t,e]);return(0,G.jsxs)(Q,{label:e===`script`?`Cron (local timezone; seconds first is allowed)`:`Cron expression (local timezone)`,children:[(0,G.jsx)(A,{value:t,onChange:e=>n(e.target.value),placeholder:e===`script`?`*/30 * * * * *`:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:r})]})}function ft({value:e,options:t,onChange:n,disabled:r}){return(0,G.jsx)(`div`,{className:`grid grid-flow-col auto-cols-fr gap-1 rounded-md border border-border p-1`,children:t.map(([t,i])=>(0,G.jsx)(`button`,{type:`button`,disabled:r,"aria-pressed":e===t,onClick:()=>n(t),className:x(`min-h-11 md:min-h-8 rounded text-xs font-medium cursor-pointer disabled:cursor-not-allowed disabled:opacity-60`,e===t?`bg-primary text-primary-foreground`:`text-muted-foreground active:bg-accent/40`),children:i},t))})}function Q({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $({open:e,onClose:t,title:n,wide:r,children:i}){return S()?(0,G.jsxs)(O,{open:e,onClose:t,className:`max-h-[85vh] flex flex-col`,children:[(0,G.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2 px-3 truncate`,children:n}),(0,G.jsx)(ie,{className:`flex-1 min-h-0 px-3 pb-3`,children:i})]}):(0,G.jsx)(D,{open:e,onOpenChange:e=>!e&&t(),children:(0,G.jsxs)(T,{className:x(r?`max-w-2xl`:`max-w-md`,`max-h-[85vh] overflow-y-auto`),children:[(0,G.jsx)(w,{children:(0,G.jsx)(E,{className:`text-sm truncate`,children:n})}),i]})})}var pt=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function mt(e){let t=e instanceof v?e.body?.problems:void 0;return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:[e instanceof Error?e.message:String(e)]}function ht({open:e,schedule:t,onClose:n,onSaved:r}){let[i,a]=(0,M.useState)(()=>Ze(t)),[o,s]=(0,M.useState)([]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)([]);(0,M.useEffect)(()=>{e&&(a(Ze(t)),d([]),y.get(`/api/projects`).then(s).catch(()=>s([])))},[e,t]);let f=(e,t)=>a(n=>({...n,[e]:t}));return(0,G.jsx)($,{open:e,onClose:n,title:t?`Edit: ${t.name}`:`New schedule`,wide:i.kind===`script`,children:(0,G.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,G.jsx)(Q,{label:`Kind`,children:(0,G.jsx)(ft,{value:i.kind,options:[[`prompt`,`Prompt`],[`script`,`Script`]],onChange:e=>a(t=>Qe(t,e)),disabled:!!t})}),(0,G.jsx)(Q,{label:`Name`,children:(0,G.jsx)(A,{value:i.name,onChange:e=>f(`name`,e.target.value),placeholder:i.kind===`script`?`Support inbox watcher`:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),i.kind===`script`&&(0,G.jsx)(Q,{label:`Description (optional)`,children:(0,G.jsx)(A,{value:i.description,onChange:e=>f(`description`,e.target.value),className:`h-11 md:h-9 text-xs`})}),(0,G.jsx)(Q,{label:`Project`,children:(0,G.jsxs)(le,{value:i.projectPath,onValueChange:e=>f(`projectPath`,e),children:[(0,G.jsx)(oe,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,G.jsx)(ce,{placeholder:`Select project`})}),(0,G.jsx)(ae,{children:o.map(e=>(0,G.jsx)(se,{value:e.path,children:e.name},e.path))})]})}),(0,G.jsx)(ut,{form:i,set:f,secretsSet:t?.secretsSet??[]}),(0,G.jsxs)(Q,{label:i.kind===`script`?`Permission mode (for ctx.ai.chat)`:`Permission mode`,children:[(0,G.jsxs)(le,{value:i.permissionMode,onValueChange:e=>f(`permissionMode`,e),children:[(0,G.jsx)(oe,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,G.jsx)(ce,{})}),(0,G.jsx)(ae,{children:pt.map(e=>(0,G.jsx)(se,{value:e,children:e},e))})]}),i.permissionMode===`bypassPermissions`&&(0,G.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,G.jsx)(j,{checked:i.enabled,onCheckedChange:e=>f(`enabled`,e)})]}),u.length>0&&(0,G.jsx)(`ul`,{className:`space-y-0.5 text-[11px] text-error`,children:u.map(e=>(0,G.jsx)(`li`,{children:e},e))}),(0,G.jsx)(C,{onClick:async()=>{let e=tt(i,t?.secretsSet);if(e.length){d(e);return}l(!0),d([]);try{let e=et(i,!!t);t?await y.patch(`/api/schedules/${t.id}`,e):await y.post(`/api/schedules`,e),r(),n()}catch(e){d(mt(e))}finally{l(!1)}},disabled:c,className:`w-full min-h-11 cursor-pointer`,children:c?`Saving…`:t?`Save changes`:`Create schedule`})]})})}var gt=(0,M.lazy)(()=>b(()=>import(`./schedule-script-editor--roOsFbc.js`).then(e=>({default:e.ScheduleScriptEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),_t=2*1024*1024,vt=`h-11 md:h-9 w-full rounded-md border border-input bg-transparent px-2 text-xs`;function yt({open:e,onClose:t,onImported:n}){let r=(0,M.useRef)(null),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)([]),[l,u]=(0,M.useState)([]),[d,f]=(0,M.useState)(``),[p,m]=(0,M.useState)({}),[h,g]=(0,M.useState)({}),[v,b]=(0,M.useState)(!1),[x,S]=(0,M.useState)(!1);(0,M.useEffect)(()=>{e&&(a(null),s([]),m({}),g({}),b(!1),y.get(`/api/projects`).then(e=>{u(e),f(e[0]?.name??``)}).catch(()=>u([])))},[e]);let w=i?.inputs??[],T=(0,M.useMemo)(()=>i?.cron?V(i.cron,3):[],[i]),E=async e=>{if(!e)return;if(e.size>_t){s([`${e.name} is ${(e.size/1024/1024).toFixed(1)} MB; a template is far smaller`]);return}let t=Re(await e.text());a(t.ok?t.template:null),s(t.ok?[]:t.errors)},D=async()=>{if(i){S(!0),s([]);try{let e=Object.fromEntries(Object.entries(Y(w,p)).filter(([,e])=>e!==null));await y.post(`/api/schedules/import`,{template:i,projectName:d,inputValues:e,secrets:X(w,h),trust:v}),_.success(`Imported "${i.name}"`,{description:`It is turned off. Turn it on when you are ready.`}),n(),t()}catch(e){s(mt(e))}finally{S(!1)}}};return(0,G.jsx)($,{open:e,onClose:t,title:i?`Import: ${i.name}`:`Import template`,wide:!!i,children:(0,G.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`.json,application/json`,className:`hidden`,onChange:e=>{E(e.target.files?.[0]),e.target.value=``}}),!i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pick a `,(0,G.jsx)(`span`,{className:`font-mono`,children:`.ppm-schedule.json`}),` file. You will see all of its code before anything is created.`]}),(0,G.jsxs)(C,{type:`button`,variant:`outline`,onClick:()=>r.current?.click(),className:`w-full min-h-11 gap-1 cursor-pointer`,children:[(0,G.jsx)(c,{className:`size-4`}),` `,o.length?`Choose another file`:`Choose a template file`]})]}),i&&(0,G.jsxs)(G.Fragment,{children:[i.description&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap`,children:i.description}),(0,G.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[i.kind===`script`?`Script · ${i.mode===`always-on`?`always on`:`tick`}`:`Prompt`,i.cron&&(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`font-mono`,children:i.cron})]}),T.length>0&&` · next ${T.map(e=>e.toLocaleString()).join(` · `)}`]}),(0,G.jsx)(Q,{label:i.kind===`script`?`Code (read it all before you trust it)`:`Prompt`,children:i.kind===`script`?(0,G.jsx)(M.Suspense,{fallback:(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-2`,children:`Loading code…`}),children:(0,G.jsx)(gt,{value:i.script??``,readOnly:!0,title:i.name})}):(0,G.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md border border-border p-2 text-[11px] whitespace-pre-wrap break-all`,children:i.prompt})}),w.length>0&&(0,G.jsx)(Q,{label:`Inputs`,children:(0,G.jsx)(ct,{decls:w,values:p,secrets:h,onValue:(e,t)=>m(n=>({...n,[e]:t})),onSecret:(e,t)=>g(n=>({...n,[e]:t}))})}),(0,G.jsx)(Q,{label:`Project`,children:(0,G.jsx)(`select`,{"aria-label":`Project`,value:d,onChange:e=>f(e.target.value),className:vt,children:l.map(e=>(0,G.jsx)(`option`,{value:e.name,children:e.name},e.path))})}),(0,G.jsxs)(`label`,{className:`flex items-start gap-3 min-h-11 py-2 text-xs cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>b(e.target.checked),className:`mt-0.5 size-5 shrink-0 accent-primary`}),(0,G.jsx)(`span`,{children:`I have read this code and trust it to run on this machine`})]})]}),o.length>0&&(0,G.jsx)(`ul`,{className:`space-y-0.5 text-[11px] text-error`,children:o.map(e=>(0,G.jsx)(`li`,{children:e},e))}),i&&(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(C,{type:`button`,variant:`outline`,onClick:()=>r.current?.click(),className:`min-h-11 cursor-pointer`,children:`Other file`}),(0,G.jsx)(C,{type:`button`,onClick:D,disabled:!v||!d||x,className:`min-h-11 cursor-pointer`,children:x?`Importing…`:`Import (disabled)`})]})]})})}var bt=2e3,xt=1e3;function St({schedule:e,onClose:t,onChanged:n}){let[r,i]=(0,M.useState)([]),[a,o]=(0,M.useState)(null),s=(0,M.useRef)(0),c=(0,M.useRef)(null),u=(0,M.useRef)(!0),d=e?.id;if((0,M.useEffect)(()=>{if(d===void 0)return;let e=!1,t=!1;s.current=0,u.current=!0,i([]),o(null);let n=async()=>{if(!t){t=!0;try{let t=await y.get(`/api/schedules/${d}/logs?after=${s.current}`);if(e)return;o(t.status);let n=t.last<s.current,r=n?(await y.get(`/api/schedules/${d}/logs`)).lines:t.lines;if(e)return;n&&i([]),r.length?(s.current=r[r.length-1].seq,i(e=>[...e,...r].slice(-xt))):n&&(s.current=0)}catch{}finally{t=!1}}};n();let r=setInterval(()=>{document.visibilityState===`visible`&&n()},bt);return()=>{e=!0,clearInterval(r)}},[d]),(0,M.useLayoutEffect)(()=>{let e=c.current;e&&u.current&&(e.scrollTop=e.scrollHeight)},[r]),!e)return null;let f=e.mode===`always-on`,p={...e,status:a??e.status};return(0,G.jsx)($,{open:!0,onClose:t,title:`Logs: ${e.name}`,wide:!0,children:(0,G.jsxs)(`div`,{className:`space-y-2 px-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground min-w-0`,children:[(0,G.jsx)(qe,{schedule:p}),p.status.pid!==null&&(0,G.jsxs)(`span`,{children:[`pid `,p.status.pid]}),p.status.since&&(0,G.jsxs)(`span`,{className:`truncate`,children:[`since `,new Date(p.status.since).toLocaleString()]}),p.status.restarts>0&&(0,G.jsxs)(`span`,{children:[p.status.restarts,` restarts`]})]}),p.status.lastError&&(0,G.jsx)(`p`,{className:`text-[11px] text-error break-all whitespace-pre-wrap line-clamp-6`,children:p.status.lastError}),(0,G.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:`h-[50vh] overflow-y-auto rounded-md border border-border bg-muted/30 p-2 font-mono text-[11px] leading-relaxed`,children:r.length===0?(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:`Nothing printed yet. Lines from ctx.log and console appear here as they are printed.`}):r.map(e=>(0,G.jsxs)(`p`,{className:`whitespace-pre-wrap break-all`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[new Date(e.at).toLocaleTimeString(),` `]}),e.text]},e.seq))}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,G.jsx)(C,{type:`button`,variant:`outline`,onClick:t,className:`min-h-11 cursor-pointer`,children:`Close`}),(0,G.jsx)(C,{type:`button`,onClick:async()=>{try{await y.post(`/api/schedules/${e.id}/run-now`),_.success(f?`Restarting`:`Tick started`),n()}catch(e){_.error(e instanceof Error?e.message:`Run failed`)}},disabled:f&&!e.enabled,className:`min-h-11 gap-1 cursor-pointer`,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(l,{className:`size-4`}),` Restart`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m,{className:`size-4`}),` Run now`]})})]})]})})}function Ct(){let{schedules:e,loading:t,refetch:n}=pe(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),[l,u]=(0,M.useState)(!1),[f,p]=(0,M.useState)(null),m=()=>{s(null),i(!0)},h=e=>{s(e),i(!0)},g=e.find(e=>e.id===f)??null;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended, or run a script on a cron or always on.`}),(0,G.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[(0,G.jsxs)(C,{size:`sm`,variant:`outline`,onClick:()=>u(!0),className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(c,{className:`size-3.5`}),` Import`]}),(0,G.jsxs)(C,{size:`sm`,onClick:m,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add`]})]})]}),t&&e.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,G.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude or a script periodically, or import a template.`}),(0,G.jsxs)(C,{size:`sm`,onClick:m,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,G.jsx)(d,{className:`size-3.5`}),` Add schedule`]})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,G.jsx)(Je,{schedule:e,onEdit:()=>h(e),onLogs:()=>p(e.id),onChanged:n},e.id))}),(0,G.jsx)(ht,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n}),(0,G.jsx)(yt,{open:l,onClose:()=>u(!1),onImported:n}),(0,G.jsx)(St,{schedule:g,onClose:()=>p(null),onChanged:n})]})}export{Ct as SchedulesSettingsSection};
@@ -1 +1 @@
1
- import{t as e}from"./panel-store-Dx2ziBLp.js";var t=`ppm:send-to-chat`,n=`ppm:send-to-chat:ack`;function r(e){return typeof e.metadata?.lastActiveAt==`number`?e.metadata.lastActiveAt:-1}function i(t){let{panels:n,focusedPanelId:i}=e.getState(),a=Object.values(n).flatMap(e=>e.tabs.filter(e=>e.type===`chat`).map(t=>({tab:t,selected:e.activeTabId===t.id,focusedPanel:e.id===i}))),o=t?a.filter(e=>e.tab.projectId===t||e.tab.metadata?.projectName===t):a;if(o.length===0)return null;let s=e=>[e.selected?e.focusedPanel?2:1:0,r(e.tab)];return o.reduce((e,t)=>{let[n,r]=[s(e),s(t)];for(let i=0;i<n.length;i++)if(n[i]!==r[i])return n[i]>r[i]?e:t;return e}).tab.id}function a(r){let{text:a,label:o,projectName:s}=r;if(!a.trim())return;let l=r.newTab?null:i(s),u=e.getState();if(l){u.setActiveTab(l);let e=!1,i=()=>{e=!0};if(window.addEventListener(n,i),window.dispatchEvent(new CustomEvent(t,{detail:{text:a,label:o,projectName:s,targetTabId:l}})),window.removeEventListener(n,i),e)return;let c=Object.values(u.panels).flatMap(e=>e.tabs).find(e=>e.id===l);u.updateTab(l,{metadata:{...c?.metadata,...r.asContext?{pendingContexts:[...c?.metadata?.pendingContexts??[],{text:a,label:o}]}:{pendingMessage:a}}});return}if(r.newTab&&r.autoSend){c(u.openTab({type:`chat`,title:`Chat`,projectId:null,metadata:s?{projectName:s}:{},closable:!0}),a,o);return}u.openTab({type:`chat`,title:`Chat`,projectId:null,metadata:{...s?{projectName:s}:{},...r.asContext?{pendingContexts:[{text:a,label:o}]}:{pendingMessage:a},...r.imageDataUrl?{pendingAttachmentDataUrl:r.imageDataUrl,pendingAttachmentName:r.imageName}:{}},closable:!0})}var o=1e4,s=50;async function c(r,i,a){let c=Date.now()+o;do{let e=!1,o=()=>{e=!0};if(window.addEventListener(n,o),window.dispatchEvent(new CustomEvent(t,{detail:{text:i,label:a,targetTabId:r,autoSend:!0}})),window.removeEventListener(n,o),e)return;await new Promise(e=>setTimeout(e,s))}while(Date.now()<c);let l=e.getState(),u=Object.values(l.panels).flatMap(e=>e.tabs).find(e=>e.id===r);u&&l.updateTab(r,{metadata:{...u.metadata,pendingMessage:i}})}export{a as i,t as n,i as r,n as t};
1
+ import{t as e}from"./panel-store-H7e9XHZF.js";var t=`ppm:send-to-chat`,n=`ppm:send-to-chat:ack`;function r(e){return typeof e.metadata?.lastActiveAt==`number`?e.metadata.lastActiveAt:-1}function i(t){let{panels:n,focusedPanelId:i}=e.getState(),a=Object.values(n).flatMap(e=>e.tabs.filter(e=>e.type===`chat`).map(t=>({tab:t,selected:e.activeTabId===t.id,focusedPanel:e.id===i}))),o=t?a.filter(e=>e.tab.projectId===t||e.tab.metadata?.projectName===t):a;if(o.length===0)return null;let s=e=>[e.selected?e.focusedPanel?2:1:0,r(e.tab)];return o.reduce((e,t)=>{let[n,r]=[s(e),s(t)];for(let i=0;i<n.length;i++)if(n[i]!==r[i])return n[i]>r[i]?e:t;return e}).tab.id}function a(r){let{text:a,label:o,projectName:s}=r;if(!a.trim())return;let l=r.newTab?null:i(s),u=e.getState();if(l){u.setActiveTab(l);let e=!1,i=()=>{e=!0};if(window.addEventListener(n,i),window.dispatchEvent(new CustomEvent(t,{detail:{text:a,label:o,projectName:s,targetTabId:l}})),window.removeEventListener(n,i),e)return;let c=Object.values(u.panels).flatMap(e=>e.tabs).find(e=>e.id===l);u.updateTab(l,{metadata:{...c?.metadata,...r.asContext?{pendingContexts:[...c?.metadata?.pendingContexts??[],{text:a,label:o}]}:{pendingMessage:a}}});return}if(r.newTab&&r.autoSend){c(u.openTab({type:`chat`,title:`Chat`,projectId:null,metadata:s?{projectName:s}:{},closable:!0}),a,o);return}u.openTab({type:`chat`,title:`Chat`,projectId:null,metadata:{...s?{projectName:s}:{},...r.asContext?{pendingContexts:[{text:a,label:o}]}:{pendingMessage:a},...r.imageDataUrl?{pendingAttachmentDataUrl:r.imageDataUrl,pendingAttachmentName:r.imageName}:{}},closable:!0})}var o=1e4,s=50;async function c(r,i,a){let c=Date.now()+o;do{let e=!1,o=()=>{e=!0};if(window.addEventListener(n,o),window.dispatchEvent(new CustomEvent(t,{detail:{text:i,label:a,targetTabId:r,autoSend:!0}})),window.removeEventListener(n,o),e)return;await new Promise(e=>setTimeout(e,s))}while(Date.now()<c);let l=e.getState(),u=Object.values(l.panels).flatMap(e=>e.tabs).find(e=>e.id===r);u&&l.updateTab(r,{metadata:{...u.metadata,pendingMessage:i}})}export{a as i,t as n,i as r,n as t};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{xr as r}from"./icons-C1wDt09O.js";import{a as i,k as a,r as o}from"./api-client-BnYFnEfK.js";import{n as s}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./context-menu-DhKbkI1X.js";import{n as c}from"./use-is-mobile-CL2I7hLf.js";import{t as l}from"./button-BHGVTbam.js";import{a as u,n as d,o as f,t as p}from"./dialog-DnE192fh.js";import{t as m}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{n as h,o as g,r as _,t as v,u as y}from"./adaptive-context-menu-CxHkI7dL.js";import{r as b}from"./format-bytes-Xp9emfaR.js";import{r as x}from"./process-row-format-CM1XaqkS.js";import{r as ee,t as S}from"./sortable-header-CchrA_dg.js";var C=e(t(),1),w=[`start`,`stop`,`restart`,`enable`,`disable`],T=3e3;async function te(e,t,n){let r=i(),a={"Content-Type":`application/json`,"X-PPM-Request":`1`};r&&(a.Authorization=`Bearer ${r}`);let o=await fetch(`/api/system/services/${e}/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:a,body:`{}`}),s;try{s=await o.json()}catch{throw Error(o.ok?`Empty response from server`:`Server error (HTTP ${o.status})`)}if(s.ok===!1)throw Error(s.error??`HTTP ${o.status}`);return s.data}function E(e,t){return o.get(`/api/system/services/${e}/${encodeURIComponent(t)}`)}function ne(e){let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(!1),s=(0,C.useRef)(!0),c=(0,C.useCallback)(async()=>{if(!a.current){a.current=!0;try{let e=await o.get(`/api/system/services`);if(!s.current)return;n(e),i(null)}catch(e){s.current&&i(e instanceof Error?e.message:`Could not list services`)}finally{a.current=!1}}},[]);return(0,C.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,C.useEffect)(()=>{if(!e)return;c();let t=setInterval(()=>void c(),T);return()=>clearInterval(t)},[e,c]),{snapshot:t,error:r,loading:t===null&&r===null,refresh:c}}var re=[`all`,`running`,`failed`,`enabled`];function D(e,t){switch(t){case`running`:return e.running;case`failed`:return e.failed;case`enabled`:return e.enabled;default:return!0}}function O(e,t){let n=t.trim().toLowerCase();return n?e.unit.toLowerCase().includes(n)||e.description.toLowerCase().includes(n):!0}function k(e,t){let n=e=>e.failed?0:e.running?1:2,r=n(e)-n(t);return r===0?e.unit.localeCompare(t.unit):r}function ie(e,t,n,r){return e.filter(e=>e.scope===t&&D(e,n)&&O(e,r)).sort(k)}function A(e,t){let n=t?e.filter(e=>e.scope===t):e;return{total:n.length,running:n.filter(e=>e.running).length,failed:n.filter(e=>e.failed).length}}function j(e){return e.failed?`failed`:e.running?`running`:e.activeState===`activating`||e.activeState===`deactivating`||e.activeState===`reloading`?`busy`:`idle`}function M(e){let t=e.subState?`${e.activeState} (${e.subState})`:e.activeState;return e.unitFileState?`${t} · ${e.unitFileState}`:t}function N(e,t){return t===`launchd`?e.enabled?null:`disabled`:e.enabled?`enabled`:null}var P=[{key:`name`,label:`Name`,width:null,from:`base`,align:`left`},{key:`pid`,label:`PID`,width:56,from:`@3xl`,align:`right`},{key:`cpu`,label:`CPU`,width:56,from:`@2xl`,align:`right`},{key:`ram`,label:`Memory`,width:72,from:`@2xl`,align:`right`},{key:`swap`,label:`Swap`,width:72,from:`@3xl`,align:`right`},{key:`disk`,label:`Drive`,width:112,from:`@4xl`,align:`right`},{key:`gpu`,label:`GPU`,width:56,from:`@4xl`,align:`right`},{key:`gpuMem`,label:`GPU Memory`,width:80,from:`@4xl`,align:`right`}],F=[`base`,`@2xl`,`@3xl`,`@4xl`],I={base:``,"@2xl":`hidden @2xl:block`,"@3xl":`hidden @3xl:block`,"@4xl":`hidden @4xl:block`};function L(e){return I[e.from]}function ae(e){let t=F.indexOf(e);return P.filter(e=>F.indexOf(e.from)<=t)}function R(e){return ae(e).map(e=>e.width===null?`minmax(0,1fr)`:`${e.width}px`).join(` `)}var z=[`grid gap-2 grid-cols-[var(--svc-cols-base)]`,`@2xl:grid-cols-[var(--svc-cols-2xl)]`,`@3xl:grid-cols-[var(--svc-cols-3xl)]`,`@4xl:grid-cols-[var(--svc-cols-4xl)]`].join(` `);function oe(){return{"--svc-cols-base":R(`base`),"--svc-cols-2xl":R(`@2xl`),"--svc-cols-3xl":R(`@3xl`),"--svc-cols-4xl":R(`@4xl`)}}var B=n(),se={failed:`bg-error`,running:`bg-success`,busy:`bg-warning animate-pulse`,idle:`bg-text-subtle/40`},V={start:`Start`,stop:`Stop`,restart:`Restart`,enable:`Enable at boot`,disable:`Disable at boot`};function H(e,t,n){let r=V[e];return n===`launchd`&&t.scope===`user`?r.replace(` at boot`,` at login`):r}var U=[`stop`,`disable`],W=Object.fromEntries(P.map(e=>[e.key,L(e)])),G=e=>e===void 0?`—`:b(e),K=(e,t)=>e===void 0?`—`:`${e.toFixed(t)}%`;function q({column:e,children:t}){return(0,B.jsx)(`span`,{className:s(`text-right text-[11px] tabular-nums text-text-subtle truncate`,W[e]),children:t})}function ce({service:e,manager:t,resources:n,onOpen:r,onAction:i}){let a=j(e),o=N(e,t),c=w.filter(t=>e.refused?.[t]===void 0),l=w.map(t=>e.refused?.[t]).find(Boolean);return(0,B.jsxs)(v,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(`div`,{className:`select-none`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"data-testid":`sysmon-service-row`,"data-unit":e.unit,"data-tone":a,"data-cpu":n?.cpu,"data-ram-mb":n?.ramMB,className:s(`w-full min-h-11 px-3 py-2 items-center text-left hover:bg-surface-hover transition-colors`,z),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:s(`size-2 rounded-full shrink-0`,se[a]),"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-sm truncate`,children:e.unit}),o&&(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] px-1 py-px rounded bg-surface-hover text-text-subtle`,children:o})]}),(0,B.jsx)(`span`,{className:`block text-[11px] text-text-subtle truncate`,children:e.description||M(e)})]})]}),(0,B.jsx)(q,{column:`pid`,children:e.mainPid??`—`}),(0,B.jsx)(q,{column:`cpu`,children:K(n?.cpu,1)}),(0,B.jsx)(q,{column:`ram`,children:G(n?.ramMB)}),(0,B.jsx)(q,{column:`swap`,children:G(n?.swapMB)}),(0,B.jsx)(q,{column:`disk`,children:x(n?.diskReadBps,n?.diskWriteBps)}),(0,B.jsx)(q,{column:`gpu`,children:K(n?.gpuPct,0)}),(0,B.jsx)(q,{column:`gpuMem`,children:G(n?.gpuMemMB)})]})})}),(0,B.jsxs)(h,{children:[c.map(n=>(0,B.jsx)(_,{variant:U.includes(n)?`destructive`:void 0,onSelect:()=>i(e,n),children:H(n,e,t)},n)),c.length>0&&(0,B.jsx)(g,{}),(0,B.jsx)(_,{onSelect:()=>r(e),children:`Details and log`}),l&&(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-text-subtle max-w-64`,children:l})]})]})}function le({sortKey:e,sortDir:t,onSort:n}){return(0,B.jsx)(`div`,{role:`row`,"data-testid":`sysmon-services-header`,className:s(`sticky top-0 z-10 px-3 bg-background border-b border-border text-[11px] text-text-subtle`,z),children:P.map(r=>(0,B.jsx)(S,{label:r.label,field:r.key,activeKey:e,activeDir:t,onClick:n,align:r.align,testId:`sysmon-services-sort-${r.key}`,className:s(`px-0`,L(r))},r.key))})}function ue(e,t){if(!(e===void 0&&t===void 0))return(e??0)+(t??0)}function J(e,t){let n=e.resources;switch(t){case`pid`:return e.service.mainPid??void 0;case`cpu`:return n?.cpu;case`ram`:return n?.ramMB;case`swap`:return n?.swapMB;case`disk`:return ue(n?.diskReadBps,n?.diskWriteBps);case`gpu`:return n?.gpuPct;case`gpuMem`:return n?.gpuMemMB}}function de(e,t,n){return t===null?[...e].sort((e,t)=>k(e.service,t.service)):t===`name`?[...e].sort((e,t)=>{let r=e.service.unit.localeCompare(t.service.unit);return n===`asc`?r:-r}):[...e].sort((e,r)=>{let i=J(e,t),a=J(r,t);return i===void 0&&a===void 0?e.service.unit.localeCompare(r.service.unit):i===void 0?1:a===void 0?-1:i===a?e.service.unit.localeCompare(r.service.unit):n===`asc`?i-a:a-i})}function Y(e,t){return t===void 0?e:(e??0)+t}function fe(e){let t=new Map;for(let n of e){if(!n.unitKey)continue;let e=t.get(n.unitKey)??{count:0,cpu:0,ramMB:0};e.count+=1,e.cpu+=n.cpu,e.ramMB+=n.ramMB,e.swapMB=Y(e.swapMB,n.swapMB),e.diskReadBps=Y(e.diskReadBps,n.diskReadBps),e.diskWriteBps=Y(e.diskWriteBps,n.diskWriteBps),e.gpuPct=Y(e.gpuPct,n.gpuPct),e.gpuMemMB=Y(e.gpuMemMB,n.gpuMemMB),t.set(n.unitKey,e)}for(let e of t.values())e.cpu=Math.round(e.cpu*10)/10,e.ramMB=Math.round(e.ramMB*10)/10,e.gpuPct!==void 0&&(e.gpuPct=Math.min(100,Math.round(e.gpuPct*10)/10));return t}function pe(e){return`${e.scope}:${e.unit}`}var me=Object.freeze({count:0,cpu:0,ramMB:0,swapMB:0,diskReadBps:0,diskWriteBps:0,gpuPct:0,gpuMemMB:0}),he=[`.service`,`.scope`];function ge(e,t,n=`systemd`){return t?t.get(pe(e))||((n===`launchd`?e.running:e.subState===`running`&&he.some(t=>e.unit.endsWith(t)))?void 0:me):void 0}var _e=e=>e.slice(e.lastIndexOf(`/`)+1)||e;function ve(e,t){return e===`systemd`?`Log (this boot)`:e===`scm`?`Event log (this boot)`:t?t.kind===`files`?`Log (${t.paths.map(_e).join(`, `)})`:`since`in t?t.since===`boot`?`Log (this boot)`:`Log (since the job started)`:`Log (last ${t.minutes} minutes)`:`Log`}function ye(e){return e===`scm`?`Reading the event log…`:e===`systemd`?`Reading the journal…`:`Reading the log…`}function be(e,t){return e===`scm`?`No events this boot.`:e===`systemd`||!t?`No entries this boot.`:t.kind===`files`?t.paths.length>1?`The log files are empty.`:`The log file is empty.`:`since`in t?t.since===`boot`?`No entries this boot.`:`No entries since the job started.`:`No entries in the last ${t.minutes} minutes.`}function xe(e){let t=(e??[]).slice(1).map(e=>e===``||/\s/.test(e)?JSON.stringify(e):e);return t.length>0?t.join(` `):`—`}function Se(e){let t=e?.stdoutPath??null,n=e?.stderrPath??null;return!t&&!n?`—`:t===n?t:[t&&`stdout ${t}`,n&&`stderr ${n}`].filter(Boolean).join(` · `)}function X({target:e,manager:t,onClose:n}){let r=c(),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null);if((0,C.useEffect)(()=>{if(!e){a(null),s(null);return}let t=!0;return a(null),s(null),E(e.scope,e.unit).then(e=>{t&&a(e)}).catch(e=>{t&&s(e instanceof Error?e.message:`Could not read the unit`)}),()=>{t=!1}},[e]),!e)return null;let l=t===`launchd`,h=t===`scm`,g=i?.logSource,_=(0,B.jsxs)(`div`,{className:`space-y-3`,"data-testid":`sysmon-service-details`,"data-unit":e.unit,children:[(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:i?.description||e.description||M(e)}),(0,B.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,B.jsx)(Z,{label:`State`,value:M(i??e)}),(0,B.jsx)(Z,{label:`Main PID`,value:(i??e).mainPid??`—`}),(0,B.jsx)(Z,{label:h?`Log on as`:`User`,value:i?.user??`—`}),h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Startup type`,value:(i??e).unitFileState??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Command`,value:i?.fragmentPath??`—`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Group`,value:i?.group??`—`}),(0,B.jsx)(Z,{label:`Scope`,value:e.scope})]}),!l&&!h&&(0,B.jsx)(Z,{label:`Unit file`,value:i?.fragmentPath??`—`}),l&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Last exit`,value:i?.lastExit??`—`}),(0,B.jsx)(Z,{label:`Keep alive`,value:i?.keepAlive===void 0?`—`:i.keepAlive?`yes`:`no`}),(0,B.jsx)(Z,{wide:!0,label:`Property list`,value:i?.fragmentPath??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Program`,value:i?.program??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Arguments`,value:xe(i?.arguments)}),(0,B.jsx)(Z,{wide:!0,label:`Output`,value:Se(i)})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-text-secondary`,children:ve(t,g)}),(0,B.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-hover/40 max-h-64 overflow-y-auto p-2`,children:[o&&(0,B.jsx)(`p`,{className:`text-xs text-error`,children:o}),!o&&i===null&&(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:ye(t)}),i?.logs.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:be(t,g)}),i?.logs.map((e,t)=>(0,B.jsxs)(`p`,{className:`text-[11px] font-mono whitespace-pre-wrap break-words`,children:[e.ts!==null&&(0,B.jsxs)(`span`,{className:`text-text-subtle`,children:[new Date(e.ts).toLocaleTimeString(),` `]}),e.message]},`${e.ts}-${t}`))]})]})]});return r?(0,B.jsx)(m,{open:!0,onClose:n,children:(0,B.jsxs)(`div`,{className:`px-4 pb-4 space-y-3`,children:[(0,B.jsx)(`h2`,{className:`text-base font-semibold break-all`,children:e.unit}),_]})}):(0,B.jsx)(p,{open:!0,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(d,{className:`sm:max-w-2xl`,children:[(0,B.jsx)(u,{children:(0,B.jsx)(f,{className:`break-all`,children:e.unit})}),_]})})}function Z({label:e,value:t,wide:n=!1}){return(0,B.jsxs)(`div`,{className:s(`min-w-0`,n&&`col-span-2`),children:[(0,B.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,B.jsx)(`dd`,{className:n?`font-mono text-[11px] break-all`:`truncate`,title:String(t),children:t})]})}var Ce=[`stop`,`restart`,`disable`];function we(e){return Ce.includes(e)}var Q={stop:{title:`Stop service`,body:e=>`Stop ${e}? Anything depending on it stops too.`,cta:`Stop`},restart:{title:`Restart service`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start at boot. It keeps running now.`,cta:`Disable`}},$={...Q,stop:{title:`Stop job`,body:e=>`Stop ${e}? launchd starts it again when something needs it, or by itself if it keeps it alive.`,cta:`Stop`},restart:{title:`Restart job`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at login`,body:e=>`${e} will no longer load at login. It keeps running now.`,cta:`Disable`}},Te={...Q,stop:{title:`Stop service`,body:e=>`Stop ${e}? Windows refuses if other running services depend on it.`,cta:`Stop`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start automatically (startup type Manual). It keeps running now.`,cta:`Disable`}};function Ee(e,t){return e===`scm`?Te:e===`launchd`?t.scope===`user`?$:{...$,disable:Q.disable}:Q}function De({pending:e,manager:t,onConfirm:n,onCancel:r}){let i=c();if(!e)return null;let a=t===`launchd`,o=Ee(t,e.service)[e.action];if(!o)return null;let s=(0,B.jsxs)(`div`,{className:`space-y-4`,"data-testid":`sysmon-service-confirm`,"data-action":e.action,children:[(0,B.jsx)(`p`,{className:`text-sm break-words`,children:o.body(e.service.unit)}),(0,B.jsxs)(`p`,{className:`text-xs text-text-subtle`,children:[t===`scm`?`Windows`:e.service.scope===`system`?`System`:`User`,` `,a?`job`:`service`,e.service.mainPid!==null&&` · pid ${e.service.mainPid}`]}),(0,B.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,B.jsx)(l,{variant:`outline`,onClick:r,className:`min-h-11`,children:`Cancel`}),(0,B.jsx)(l,{variant:`destructive`,autoFocus:!1,onClick:()=>n(e),"data-testid":`sysmon-service-confirm-ok`,className:`min-h-11`,children:o.cta})]})]});return i?(0,B.jsx)(m,{open:!0,onClose:r,children:(0,B.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,B.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:o.title}),s]})}):(0,B.jsx)(p,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(d,{children:[(0,B.jsx)(u,{children:(0,B.jsx)(f,{children:o.title})}),s]})})}var Oe=[`system`,`user`],ke={system:`System`,user:`User`},Ae={all:`All`,running:`Running`,failed:`Failed`,enabled:`Enabled`};function je({active:e,metrics:t}){let{snapshot:n,error:i,loading:o,refresh:c}=ne(e),l=n?.manager??(t?.platform===`darwin`?`launchd`:t?.platform===`win32`?`scm`:`systemd`),u=l===`launchd`?`jobs`:l===`scm`?`services`:`units`,[d,f]=(0,C.useState)(`system`),[p,m]=(0,C.useState)(`all`),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(`desc`),[x,S]=(0,C.useState)(null),[w,T]=(0,C.useState)(null),E=n?.services??[],D=(0,C.useMemo)(()=>ie(E,d,p,h),[E,d,p,h]),O=(0,C.useMemo)(()=>A(E,d),[E,d]),k=(0,C.useMemo)(()=>t?.processes.length?fe(t.processes):null,[t]),j=(0,C.useMemo)(()=>de(D.map(e=>({service:e,resources:ge(e,k,l)})),_,y),[D,k,l,_,y]),M=(0,C.useCallback)(e=>{let[t,n]=ee(_,y,e);v(t),b(n)},[_,y]),N=(0,C.useCallback)(async({service:e,action:t})=>{T(null);try{let n=await te(e.scope,e.unit,t);a.success(`${e.unit}: ${t} done`,n.note?{description:n.note}:void 0),await c()}catch(n){a.error(n instanceof Error?n.message:`Could not ${t} ${e.unit}`)}},[c]),P=(0,C.useCallback)((e,t)=>{we(t)?T({service:e,action:t}):N({service:e,action:t})},[N]);return n&&!n.supported?(0,B.jsxs)(`div`,{className:`p-4 text-sm text-text-subtle`,"data-testid":`sysmon-services`,children:[`This host has no service manager PPM can read.`,n.warnings.map((e,t)=>(0,B.jsx)(`p`,{className:`mt-1 text-xs`,children:e},t))]}):(0,B.jsxs)(`div`,{className:`h-full flex flex-col min-h-0 @container`,style:oe(),"data-testid":`sysmon-services`,"data-row-count":j.length,"data-sort-key":_??`default`,"data-sort-dir":y,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[l!==`scm`&&(0,B.jsx)(`div`,{className:`flex items-center`,role:`tablist`,children:Oe.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":d===e,onClick:()=>f(e),"data-testid":`sysmon-services-scope-${e}`,className:s(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,d===e?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:ke[e]},e))}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-2`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[140px]`,children:[(0,B.jsx)(r,{className:`absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-text-subtle`}),(0,B.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search services`,"aria-label":`Search services`,"data-testid":`sysmon-service-search`,className:`w-full min-h-11 md:min-h-8 pl-7 pr-2 text-sm rounded-md border border-border bg-transparent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})]}),re.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>m(e),"aria-pressed":p===e,"data-testid":`sysmon-service-filter-${e}`,className:s(`min-h-11 md:min-h-8 px-3 text-xs rounded-md border transition-colors`,p===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-surface-hover`),children:Ae[e]},e))]}),(0,B.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] text-text-subtle`,children:[O.total,` `,u,` · `,O.running,` running`,O.failed>0&&(0,B.jsxs)(`span`,{className:`text-error`,children:[` · `,O.failed,` failed`]})]})]}),n&&n.warnings.length>0&&(0,B.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0`,children:n.warnings.map((e,t)=>(0,B.jsx)(`div`,{children:e},t))}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[(0,B.jsx)(le,{sortKey:_,sortDir:y,onSort:M}),(0,B.jsxs)(`div`,{className:`divide-y divide-border`,children:[o&&(0,B.jsxs)(`p`,{className:`p-4 text-sm text-text-subtle`,children:[`Listing `,u,`…`]}),i&&(0,B.jsx)(`p`,{className:`p-4 text-sm text-error`,children:i}),!o&&!i&&j.length===0&&(0,B.jsxs)(`p`,{className:`p-4 text-sm text-text-subtle`,children:[`No `,u,` match.`]}),j.map(({service:e,resources:t})=>(0,B.jsx)(ce,{service:e,manager:l,resources:t,onOpen:S,onAction:P},`${e.scope}:${e.unit}`))]})]}),(0,B.jsx)(X,{target:x,manager:l,onClose:()=>S(null)}),(0,B.jsx)(De,{pending:w,manager:l,onConfirm:e=>void N(e),onCancel:()=>T(null)})]})}export{je as ServicesPanel};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{xr as r}from"./icons-C1wDt09O.js";import{a as i,k as a,r as o}from"./api-client-BnYFnEfK.js";import{n as s}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./context-menu-DhKbkI1X.js";import{n as c}from"./use-is-mobile-CL2I7hLf.js";import{t as l}from"./button-BHGVTbam.js";import{a as u,n as d,o as f,t as p}from"./dialog-DnE192fh.js";import{t as m}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import{n as h,o as g,r as _,t as v,u as y}from"./adaptive-context-menu-CxHkI7dL.js";import{r as b}from"./format-bytes-Xp9emfaR.js";import{r as x}from"./process-row-format-CJg8VV-6.js";import{r as ee,t as S}from"./sortable-header-Ds6nTnqB.js";var C=e(t(),1),w=[`start`,`stop`,`restart`,`enable`,`disable`],T=3e3;async function te(e,t,n){let r=i(),a={"Content-Type":`application/json`,"X-PPM-Request":`1`};r&&(a.Authorization=`Bearer ${r}`);let o=await fetch(`/api/system/services/${e}/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:a,body:`{}`}),s;try{s=await o.json()}catch{throw Error(o.ok?`Empty response from server`:`Server error (HTTP ${o.status})`)}if(s.ok===!1)throw Error(s.error??`HTTP ${o.status}`);return s.data}function E(e,t){return o.get(`/api/system/services/${e}/${encodeURIComponent(t)}`)}function ne(e){let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(!1),s=(0,C.useRef)(!0),c=(0,C.useCallback)(async()=>{if(!a.current){a.current=!0;try{let e=await o.get(`/api/system/services`);if(!s.current)return;n(e),i(null)}catch(e){s.current&&i(e instanceof Error?e.message:`Could not list services`)}finally{a.current=!1}}},[]);return(0,C.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,C.useEffect)(()=>{if(!e)return;c();let t=setInterval(()=>void c(),T);return()=>clearInterval(t)},[e,c]),{snapshot:t,error:r,loading:t===null&&r===null,refresh:c}}var re=[`all`,`running`,`failed`,`enabled`];function D(e,t){switch(t){case`running`:return e.running;case`failed`:return e.failed;case`enabled`:return e.enabled;default:return!0}}function O(e,t){let n=t.trim().toLowerCase();return n?e.unit.toLowerCase().includes(n)||e.description.toLowerCase().includes(n):!0}function k(e,t){let n=e=>e.failed?0:e.running?1:2,r=n(e)-n(t);return r===0?e.unit.localeCompare(t.unit):r}function ie(e,t,n,r){return e.filter(e=>e.scope===t&&D(e,n)&&O(e,r)).sort(k)}function A(e,t){let n=t?e.filter(e=>e.scope===t):e;return{total:n.length,running:n.filter(e=>e.running).length,failed:n.filter(e=>e.failed).length}}function j(e){return e.failed?`failed`:e.running?`running`:e.activeState===`activating`||e.activeState===`deactivating`||e.activeState===`reloading`?`busy`:`idle`}function M(e){let t=e.subState?`${e.activeState} (${e.subState})`:e.activeState;return e.unitFileState?`${t} · ${e.unitFileState}`:t}function N(e,t){return t===`launchd`?e.enabled?null:`disabled`:e.enabled?`enabled`:null}var P=[{key:`name`,label:`Name`,width:null,from:`base`,align:`left`},{key:`pid`,label:`PID`,width:56,from:`@3xl`,align:`right`},{key:`cpu`,label:`CPU`,width:56,from:`@2xl`,align:`right`},{key:`ram`,label:`Memory`,width:72,from:`@2xl`,align:`right`},{key:`swap`,label:`Swap`,width:72,from:`@3xl`,align:`right`},{key:`disk`,label:`Drive`,width:112,from:`@4xl`,align:`right`},{key:`gpu`,label:`GPU`,width:56,from:`@4xl`,align:`right`},{key:`gpuMem`,label:`GPU Memory`,width:80,from:`@4xl`,align:`right`}],F=[`base`,`@2xl`,`@3xl`,`@4xl`],I={base:``,"@2xl":`hidden @2xl:block`,"@3xl":`hidden @3xl:block`,"@4xl":`hidden @4xl:block`};function L(e){return I[e.from]}function ae(e){let t=F.indexOf(e);return P.filter(e=>F.indexOf(e.from)<=t)}function R(e){return ae(e).map(e=>e.width===null?`minmax(0,1fr)`:`${e.width}px`).join(` `)}var z=[`grid gap-2 grid-cols-[var(--svc-cols-base)]`,`@2xl:grid-cols-[var(--svc-cols-2xl)]`,`@3xl:grid-cols-[var(--svc-cols-3xl)]`,`@4xl:grid-cols-[var(--svc-cols-4xl)]`].join(` `);function oe(){return{"--svc-cols-base":R(`base`),"--svc-cols-2xl":R(`@2xl`),"--svc-cols-3xl":R(`@3xl`),"--svc-cols-4xl":R(`@4xl`)}}var B=n(),se={failed:`bg-error`,running:`bg-success`,busy:`bg-warning animate-pulse`,idle:`bg-text-subtle/40`},V={start:`Start`,stop:`Stop`,restart:`Restart`,enable:`Enable at boot`,disable:`Disable at boot`};function H(e,t,n){let r=V[e];return n===`launchd`&&t.scope===`user`?r.replace(` at boot`,` at login`):r}var U=[`stop`,`disable`],W=Object.fromEntries(P.map(e=>[e.key,L(e)])),G=e=>e===void 0?`—`:b(e),K=(e,t)=>e===void 0?`—`:`${e.toFixed(t)}%`;function q({column:e,children:t}){return(0,B.jsx)(`span`,{className:s(`text-right text-[11px] tabular-nums text-text-subtle truncate`,W[e]),children:t})}function ce({service:e,manager:t,resources:n,onOpen:r,onAction:i}){let a=j(e),o=N(e,t),c=w.filter(t=>e.refused?.[t]===void 0),l=w.map(t=>e.refused?.[t]).find(Boolean);return(0,B.jsxs)(v,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(`div`,{className:`select-none`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"data-testid":`sysmon-service-row`,"data-unit":e.unit,"data-tone":a,"data-cpu":n?.cpu,"data-ram-mb":n?.ramMB,className:s(`w-full min-h-11 px-3 py-2 items-center text-left hover:bg-surface-hover transition-colors`,z),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:s(`size-2 rounded-full shrink-0`,se[a]),"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-sm truncate`,children:e.unit}),o&&(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] px-1 py-px rounded bg-surface-hover text-text-subtle`,children:o})]}),(0,B.jsx)(`span`,{className:`block text-[11px] text-text-subtle truncate`,children:e.description||M(e)})]})]}),(0,B.jsx)(q,{column:`pid`,children:e.mainPid??`—`}),(0,B.jsx)(q,{column:`cpu`,children:K(n?.cpu,1)}),(0,B.jsx)(q,{column:`ram`,children:G(n?.ramMB)}),(0,B.jsx)(q,{column:`swap`,children:G(n?.swapMB)}),(0,B.jsx)(q,{column:`disk`,children:x(n?.diskReadBps,n?.diskWriteBps)}),(0,B.jsx)(q,{column:`gpu`,children:K(n?.gpuPct,0)}),(0,B.jsx)(q,{column:`gpuMem`,children:G(n?.gpuMemMB)})]})})}),(0,B.jsxs)(h,{children:[c.map(n=>(0,B.jsx)(_,{variant:U.includes(n)?`destructive`:void 0,onSelect:()=>i(e,n),children:H(n,e,t)},n)),c.length>0&&(0,B.jsx)(g,{}),(0,B.jsx)(_,{onSelect:()=>r(e),children:`Details and log`}),l&&(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-text-subtle max-w-64`,children:l})]})]})}function le({sortKey:e,sortDir:t,onSort:n}){return(0,B.jsx)(`div`,{role:`row`,"data-testid":`sysmon-services-header`,className:s(`sticky top-0 z-10 px-3 bg-background border-b border-border text-[11px] text-text-subtle`,z),children:P.map(r=>(0,B.jsx)(S,{label:r.label,field:r.key,activeKey:e,activeDir:t,onClick:n,align:r.align,testId:`sysmon-services-sort-${r.key}`,className:s(`px-0`,L(r))},r.key))})}function ue(e,t){if(!(e===void 0&&t===void 0))return(e??0)+(t??0)}function J(e,t){let n=e.resources;switch(t){case`pid`:return e.service.mainPid??void 0;case`cpu`:return n?.cpu;case`ram`:return n?.ramMB;case`swap`:return n?.swapMB;case`disk`:return ue(n?.diskReadBps,n?.diskWriteBps);case`gpu`:return n?.gpuPct;case`gpuMem`:return n?.gpuMemMB}}function de(e,t,n){return t===null?[...e].sort((e,t)=>k(e.service,t.service)):t===`name`?[...e].sort((e,t)=>{let r=e.service.unit.localeCompare(t.service.unit);return n===`asc`?r:-r}):[...e].sort((e,r)=>{let i=J(e,t),a=J(r,t);return i===void 0&&a===void 0?e.service.unit.localeCompare(r.service.unit):i===void 0?1:a===void 0?-1:i===a?e.service.unit.localeCompare(r.service.unit):n===`asc`?i-a:a-i})}function Y(e,t){return t===void 0?e:(e??0)+t}function fe(e){let t=new Map;for(let n of e){if(!n.unitKey)continue;let e=t.get(n.unitKey)??{count:0,cpu:0,ramMB:0};e.count+=1,e.cpu+=n.cpu,e.ramMB+=n.ramMB,e.swapMB=Y(e.swapMB,n.swapMB),e.diskReadBps=Y(e.diskReadBps,n.diskReadBps),e.diskWriteBps=Y(e.diskWriteBps,n.diskWriteBps),e.gpuPct=Y(e.gpuPct,n.gpuPct),e.gpuMemMB=Y(e.gpuMemMB,n.gpuMemMB),t.set(n.unitKey,e)}for(let e of t.values())e.cpu=Math.round(e.cpu*10)/10,e.ramMB=Math.round(e.ramMB*10)/10,e.gpuPct!==void 0&&(e.gpuPct=Math.min(100,Math.round(e.gpuPct*10)/10));return t}function pe(e){return`${e.scope}:${e.unit}`}var me=Object.freeze({count:0,cpu:0,ramMB:0,swapMB:0,diskReadBps:0,diskWriteBps:0,gpuPct:0,gpuMemMB:0}),he=[`.service`,`.scope`];function ge(e,t,n=`systemd`){return t?t.get(pe(e))||((n===`launchd`?e.running:e.subState===`running`&&he.some(t=>e.unit.endsWith(t)))?void 0:me):void 0}var _e=e=>e.slice(e.lastIndexOf(`/`)+1)||e;function ve(e,t){return e===`systemd`?`Log (this boot)`:e===`scm`?`Event log (this boot)`:t?t.kind===`files`?`Log (${t.paths.map(_e).join(`, `)})`:`since`in t?t.since===`boot`?`Log (this boot)`:`Log (since the job started)`:`Log (last ${t.minutes} minutes)`:`Log`}function ye(e){return e===`scm`?`Reading the event log…`:e===`systemd`?`Reading the journal…`:`Reading the log…`}function be(e,t){return e===`scm`?`No events this boot.`:e===`systemd`||!t?`No entries this boot.`:t.kind===`files`?t.paths.length>1?`The log files are empty.`:`The log file is empty.`:`since`in t?t.since===`boot`?`No entries this boot.`:`No entries since the job started.`:`No entries in the last ${t.minutes} minutes.`}function xe(e){let t=(e??[]).slice(1).map(e=>e===``||/\s/.test(e)?JSON.stringify(e):e);return t.length>0?t.join(` `):`—`}function Se(e){let t=e?.stdoutPath??null,n=e?.stderrPath??null;return!t&&!n?`—`:t===n?t:[t&&`stdout ${t}`,n&&`stderr ${n}`].filter(Boolean).join(` · `)}function X({target:e,manager:t,onClose:n}){let r=c(),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null);if((0,C.useEffect)(()=>{if(!e){a(null),s(null);return}let t=!0;return a(null),s(null),E(e.scope,e.unit).then(e=>{t&&a(e)}).catch(e=>{t&&s(e instanceof Error?e.message:`Could not read the unit`)}),()=>{t=!1}},[e]),!e)return null;let l=t===`launchd`,h=t===`scm`,g=i?.logSource,_=(0,B.jsxs)(`div`,{className:`space-y-3`,"data-testid":`sysmon-service-details`,"data-unit":e.unit,children:[(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:i?.description||e.description||M(e)}),(0,B.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,B.jsx)(Z,{label:`State`,value:M(i??e)}),(0,B.jsx)(Z,{label:`Main PID`,value:(i??e).mainPid??`—`}),(0,B.jsx)(Z,{label:h?`Log on as`:`User`,value:i?.user??`—`}),h?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Startup type`,value:(i??e).unitFileState??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Command`,value:i?.fragmentPath??`—`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Group`,value:i?.group??`—`}),(0,B.jsx)(Z,{label:`Scope`,value:e.scope})]}),!l&&!h&&(0,B.jsx)(Z,{label:`Unit file`,value:i?.fragmentPath??`—`}),l&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{label:`Last exit`,value:i?.lastExit??`—`}),(0,B.jsx)(Z,{label:`Keep alive`,value:i?.keepAlive===void 0?`—`:i.keepAlive?`yes`:`no`}),(0,B.jsx)(Z,{wide:!0,label:`Property list`,value:i?.fragmentPath??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Program`,value:i?.program??`—`}),(0,B.jsx)(Z,{wide:!0,label:`Arguments`,value:xe(i?.arguments)}),(0,B.jsx)(Z,{wide:!0,label:`Output`,value:Se(i)})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-medium text-text-secondary`,children:ve(t,g)}),(0,B.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-hover/40 max-h-64 overflow-y-auto p-2`,children:[o&&(0,B.jsx)(`p`,{className:`text-xs text-error`,children:o}),!o&&i===null&&(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:ye(t)}),i?.logs.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-text-subtle`,children:be(t,g)}),i?.logs.map((e,t)=>(0,B.jsxs)(`p`,{className:`text-[11px] font-mono whitespace-pre-wrap break-words`,children:[e.ts!==null&&(0,B.jsxs)(`span`,{className:`text-text-subtle`,children:[new Date(e.ts).toLocaleTimeString(),` `]}),e.message]},`${e.ts}-${t}`))]})]})]});return r?(0,B.jsx)(m,{open:!0,onClose:n,children:(0,B.jsxs)(`div`,{className:`px-4 pb-4 space-y-3`,children:[(0,B.jsx)(`h2`,{className:`text-base font-semibold break-all`,children:e.unit}),_]})}):(0,B.jsx)(p,{open:!0,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(d,{className:`sm:max-w-2xl`,children:[(0,B.jsx)(u,{children:(0,B.jsx)(f,{className:`break-all`,children:e.unit})}),_]})})}function Z({label:e,value:t,wide:n=!1}){return(0,B.jsxs)(`div`,{className:s(`min-w-0`,n&&`col-span-2`),children:[(0,B.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,B.jsx)(`dd`,{className:n?`font-mono text-[11px] break-all`:`truncate`,title:String(t),children:t})]})}var Ce=[`stop`,`restart`,`disable`];function we(e){return Ce.includes(e)}var Q={stop:{title:`Stop service`,body:e=>`Stop ${e}? Anything depending on it stops too.`,cta:`Stop`},restart:{title:`Restart service`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start at boot. It keeps running now.`,cta:`Disable`}},$={...Q,stop:{title:`Stop job`,body:e=>`Stop ${e}? launchd starts it again when something needs it, or by itself if it keeps it alive.`,cta:`Stop`},restart:{title:`Restart job`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at login`,body:e=>`${e} will no longer load at login. It keeps running now.`,cta:`Disable`}},Te={...Q,stop:{title:`Stop service`,body:e=>`Stop ${e}? Windows refuses if other running services depend on it.`,cta:`Stop`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start automatically (startup type Manual). It keeps running now.`,cta:`Disable`}};function Ee(e,t){return e===`scm`?Te:e===`launchd`?t.scope===`user`?$:{...$,disable:Q.disable}:Q}function De({pending:e,manager:t,onConfirm:n,onCancel:r}){let i=c();if(!e)return null;let a=t===`launchd`,o=Ee(t,e.service)[e.action];if(!o)return null;let s=(0,B.jsxs)(`div`,{className:`space-y-4`,"data-testid":`sysmon-service-confirm`,"data-action":e.action,children:[(0,B.jsx)(`p`,{className:`text-sm break-words`,children:o.body(e.service.unit)}),(0,B.jsxs)(`p`,{className:`text-xs text-text-subtle`,children:[t===`scm`?`Windows`:e.service.scope===`system`?`System`:`User`,` `,a?`job`:`service`,e.service.mainPid!==null&&` · pid ${e.service.mainPid}`]}),(0,B.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,B.jsx)(l,{variant:`outline`,onClick:r,className:`min-h-11`,children:`Cancel`}),(0,B.jsx)(l,{variant:`destructive`,autoFocus:!1,onClick:()=>n(e),"data-testid":`sysmon-service-confirm-ok`,className:`min-h-11`,children:o.cta})]})]});return i?(0,B.jsx)(m,{open:!0,onClose:r,children:(0,B.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,B.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:o.title}),s]})}):(0,B.jsx)(p,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(d,{children:[(0,B.jsx)(u,{children:(0,B.jsx)(f,{children:o.title})}),s]})})}var Oe=[`system`,`user`],ke={system:`System`,user:`User`},Ae={all:`All`,running:`Running`,failed:`Failed`,enabled:`Enabled`};function je({active:e,metrics:t}){let{snapshot:n,error:i,loading:o,refresh:c}=ne(e),l=n?.manager??(t?.platform===`darwin`?`launchd`:t?.platform===`win32`?`scm`:`systemd`),u=l===`launchd`?`jobs`:l===`scm`?`services`:`units`,[d,f]=(0,C.useState)(`system`),[p,m]=(0,C.useState)(`all`),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(`desc`),[x,S]=(0,C.useState)(null),[w,T]=(0,C.useState)(null),E=n?.services??[],D=(0,C.useMemo)(()=>ie(E,d,p,h),[E,d,p,h]),O=(0,C.useMemo)(()=>A(E,d),[E,d]),k=(0,C.useMemo)(()=>t?.processes.length?fe(t.processes):null,[t]),j=(0,C.useMemo)(()=>de(D.map(e=>({service:e,resources:ge(e,k,l)})),_,y),[D,k,l,_,y]),M=(0,C.useCallback)(e=>{let[t,n]=ee(_,y,e);v(t),b(n)},[_,y]),N=(0,C.useCallback)(async({service:e,action:t})=>{T(null);try{let n=await te(e.scope,e.unit,t);a.success(`${e.unit}: ${t} done`,n.note?{description:n.note}:void 0),await c()}catch(n){a.error(n instanceof Error?n.message:`Could not ${t} ${e.unit}`)}},[c]),P=(0,C.useCallback)((e,t)=>{we(t)?T({service:e,action:t}):N({service:e,action:t})},[N]);return n&&!n.supported?(0,B.jsxs)(`div`,{className:`p-4 text-sm text-text-subtle`,"data-testid":`sysmon-services`,children:[`This host has no service manager PPM can read.`,n.warnings.map((e,t)=>(0,B.jsx)(`p`,{className:`mt-1 text-xs`,children:e},t))]}):(0,B.jsxs)(`div`,{className:`h-full flex flex-col min-h-0 @container`,style:oe(),"data-testid":`sysmon-services`,"data-row-count":j.length,"data-sort-key":_??`default`,"data-sort-dir":y,children:[(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[l!==`scm`&&(0,B.jsx)(`div`,{className:`flex items-center`,role:`tablist`,children:Oe.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":d===e,onClick:()=>f(e),"data-testid":`sysmon-services-scope-${e}`,className:s(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,d===e?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:ke[e]},e))}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-2`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[140px]`,children:[(0,B.jsx)(r,{className:`absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-text-subtle`}),(0,B.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search services`,"aria-label":`Search services`,"data-testid":`sysmon-service-search`,className:`w-full min-h-11 md:min-h-8 pl-7 pr-2 text-sm rounded-md border border-border bg-transparent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})]}),re.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>m(e),"aria-pressed":p===e,"data-testid":`sysmon-service-filter-${e}`,className:s(`min-h-11 md:min-h-8 px-3 text-xs rounded-md border transition-colors`,p===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-surface-hover`),children:Ae[e]},e))]}),(0,B.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] text-text-subtle`,children:[O.total,` `,u,` · `,O.running,` running`,O.failed>0&&(0,B.jsxs)(`span`,{className:`text-error`,children:[` · `,O.failed,` failed`]})]})]}),n&&n.warnings.length>0&&(0,B.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0`,children:n.warnings.map((e,t)=>(0,B.jsx)(`div`,{children:e},t))}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[(0,B.jsx)(le,{sortKey:_,sortDir:y,onSort:M}),(0,B.jsxs)(`div`,{className:`divide-y divide-border`,children:[o&&(0,B.jsxs)(`p`,{className:`p-4 text-sm text-text-subtle`,children:[`Listing `,u,`…`]}),i&&(0,B.jsx)(`p`,{className:`p-4 text-sm text-error`,children:i}),!o&&!i&&j.length===0&&(0,B.jsxs)(`p`,{className:`p-4 text-sm text-text-subtle`,children:[`No `,u,` match.`]}),j.map(({service:e,resources:t})=>(0,B.jsx)(ce,{service:e,manager:l,resources:t,onOpen:S,onAction:P},`${e.scope}:${e.unit}`))]})]}),(0,B.jsx)(X,{target:x,manager:l,onClose:()=>S(null)}),(0,B.jsx)(De,{pending:w,manager:l,onConfirm:e=>void N(e),onCancel:()=>T(null)})]})}export{je as ServicesPanel};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{A as r,L as i,M as a,_n as o,_t as s,hr as c,li as l,vt as u}from"./icons-C1wDt09O.js";import{t as d}from"./file-diff-CScJM-VZ.js";import{o as f,r as p}from"./api-client-BnYFnEfK.js";import{t as m}from"./react-B9hau9ra.js";import{n as h}from"./utils-D3xTlJyU.js";import{i as g}from"./project-store-Bs-kiU8m.js";import{t as _}from"./tab-store-B4v2kAEY.js";import{n as v}from"./use-is-mobile-CL2I7hLf.js";import{n as y}from"./file-icons-CB0RsVdl.js";import{n as b}from"./patch-tab-metadata-DTbCkVvx.js";import{t as ee}from"./mobile-bottom-sheet-M9pZptfh.js";import{t as x}from"./start-ellipsis-DfU-W_6j.js";import{i as S}from"./session-turns-DxIzWBNj.js";var C=e=>e.map(e=>`${e.n}:${e.messageId}:${e.calls.length}:${e.calls[e.calls.length-1]??``}:${e.prompt.length}`).join(`|`),w=m((e,t)=>({bySession:{},publish:(n,r,i)=>{let a=t().bySession[n];a&&a.live===i&&C(a.turns)===C(r)||e(e=>({bySession:{...e.bySession,[n]:{turns:r,byCall:S(r),live:i}}}))},release:n=>{let r=t().bySession[n];r?.live&&e(e=>({bySession:{...e.bySession,[n]:{...r,live:!1}}}))}})),T=m((e,t)=>({request:null,jump:t=>e({request:{...t,at:Date.now()}}),done:n=>{t().request===n&&e({request:null})}}));function E(e,t){return`${f(e)}/chat/sessions/${encodeURIComponent(t)}/file-changes`}async function D(e,t,n,r){let i=await p.post(E(e,t),{paths:n},{signal:r});return Array.isArray(i?.files)?i.files:[]}async function O(e,t,n){let r=await p.get(`${E(e,t)}/count`,{signal:n});return typeof r?.count==`number`?r.count:0}function k(e,t,n,r){return p.get(`${E(e,t)}/diff?path=${encodeURIComponent(n)}`,{signal:r})}function A(e,t,n,r){return p.post(`${E(e,t)}/reviewed`,{files:n.map(e=>({path:e.path,version:e.version})),reviewed:r})}function j(e,t,n,r){return p.post(`${E(e,t)}/answer`,{answer:n,files:r})}function M(e,t,n,r){return p.post(`${E(e,t)}/revert-turn`,{calls:n,...r?{apply:r}:{}})}function N(e,t,n){return p.post(`${E(e,t)}/undo`,{undoId:n})}var P=`ppm:session-review-marks`;function F(e){window.dispatchEvent(new CustomEvent(P,{detail:e}))}var I=`ppm:session-file-changes`;function L(e){window.dispatchEvent(new CustomEvent(I,{detail:e}))}function R(e){let t={paths:e.paths,...e.title?{chatTitle:e.title}:{},select:e.selectPath?{path:e.selectPath,at:Date.now()}:void 0},n=_.getState().openTab({type:`session-review`,title:e.title?`Changes: ${e.title}`:`Session changes`,projectId:e.projectName,closable:!0,metadata:{projectName:e.projectName,sessionId:e.sessionId,providerId:e.providerId,...t}});n&&b(n,t)}var z=n();function B({added:e,removed:t,editCount:n,className:r}){return(0,z.jsxs)(`span`,{className:h(`flex items-center gap-[5px] tabular-nums`,r),children:[(0,z.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),(0,z.jsxs)(`span`,{className:`text-error`,children:[`−`,t]}),n!=null&&n>1&&(0,z.jsxs)(`span`,{className:`text-text-subtle`,children:[`×`,n]})]})}function V(e){let t=0,n=0;for(let r of e)t+=r.additions??0,n+=r.deletions??0;return{added:t,removed:n}}function H(e,t){if(!t)return e;let n=t.replace(/[\\/]+$/,``);return e.length>n.length&&e.startsWith(n)&&/[\\/]/.test(e[n.length])?e.slice(n.length+1):e}function U(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t)}}function W(e){return`${e} file${e===1?``:`s`}`}function G(e){let t=[],n=[];for(let r of e)(r.reviewed?n:t).push(r);return{pending:t,reviewed:n}}function K(e,t,n){return e.map(e=>{if(!t.has(e.path))return e;let{reviewed:r,sinceReview:i,...a}=e;return n?{...a,reviewed:!0}:a})}function q(e,t,n){let r=new Map(t.map(e=>[e.path,e])),i=new Set(n),a=e.filter(e=>!i.has(e.path)).map(e=>r.get(e.path)??e),o=new Set(e.map(e=>e.path));for(let e of t)o.has(e.path)||a.push(e);return a}function J(e){let t=e.reviewed?`reviewed`:e.sinceReview?`since`:``;return`${e.path}\0${e.status}\0${e.baseline}\0${e.version}\0${t}`}var Y={added:{glyph:`A`,cls:`text-success`,label:`Added`},modified:{glyph:`M`,cls:`text-warning`,label:`Modified`},deleted:{glyph:`D`,cls:`text-error`,label:`Deleted`}};function X({file:e,className:t}){return e.additions==null||e.deletions==null?(0,z.jsx)(`span`,{className:h(`text-text-subtle`,t),children:e.binary?`binary`:e.tooLarge?`too large`:``}):(0,z.jsx)(B,{added:e.additions,removed:e.deletions,className:t})}function Z({checked:e,className:t}){return(0,z.jsx)(`span`,{"aria-hidden":!0,className:h(`flex size-4 shrink-0 items-center justify-center rounded border transition-colors`,e?`border-primary bg-primary text-primary-foreground`:`border-text-subtle`,t),children:e&&(0,z.jsx)(r,{className:`size-3`})})}function te({file:e,projectPath:t,dense:n,selected:r,onClick:i,onToggleReviewed:a}){let o=Y[e.status],{base:s,dir:c}=U(H(e.path,t)),l=!!e.reviewed;return(0,z.jsxs)(`div`,{className:`flex border-b border-border-soft`,"data-testid":`session-change-item`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:i,title:e.path,"aria-current":r?`true`:void 0,"data-testid":`session-change-row`,className:h(`grid min-w-0 flex-1 grid-cols-[16px_minmax(0,1fr)_auto_12px] items-center gap-2.5 text-left`,`transition-colors hover:bg-surface`,n?`min-h-9 px-2.5 py-1 text-xs`:`min-h-[52px] px-3 py-1.5 text-[13px]`,r&&`bg-surface shadow-[inset_2px_0_0_var(--accent)]`),children:[(0,z.jsx)(y,{name:s,className:`size-4`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:h(`truncate`,e.status===`deleted`&&`line-through`,e.status===`deleted`||l?`text-text-secondary`:`text-text-primary`),children:s}),c&&(0,z.jsx)(`span`,{className:`flex min-w-0 text-[11px] text-text-subtle`,children:(0,z.jsx)(x,{children:c})})]}),(0,z.jsx)(X,{file:e,className:`font-mono text-[11px]`}),(0,z.jsx)(`span`,{"aria-label":o.label,title:o.label,className:h(`text-center font-mono text-[11px] font-semibold`,o.cls),children:o.glyph})]}),a&&(0,z.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":l,"aria-label":`Mark ${s} reviewed`,title:l?`Reviewed — click to bring it back to the list`:`Mark reviewed`,onClick:a,className:h(`flex shrink-0 items-center justify-center transition-colors hover:bg-surface`,n?`w-8`:`w-11`),children:(0,z.jsx)(Z,{checked:l})})]})}var Q=e(t(),1);function $(e){return e===`claude`?`Shell commands are followed through git: a file outside a repository, or one git ignores, is not listed. Source Control shows everything on disk.`:`Files changed by shell commands are not listed — Source Control shows everything on disk.`}function ne({count:e,shown:t,dense:n,onToggle:r}){let i=t?u:s;return(0,z.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":t,className:h(`flex w-full items-center gap-2 border-b border-border-soft text-left text-text-secondary transition-colors hover:bg-surface`,n?`min-h-8 px-2.5 text-[11px]`:`min-h-11 px-3 text-xs`),children:[(0,z.jsx)(i,{className:`size-3.5 shrink-0`}),(0,z.jsxs)(`span`,{className:`flex-1`,children:[e,` reviewed`]}),(0,z.jsx)(`span`,{className:`text-text-subtle`,children:t?`Hide`:`Show`})]})}function re({files:e,loaded:t=!0,loading:n=!1,unloadedCount:r=0,projectName:s,providerId:u,onReview:f,onOpen:p,onRefresh:m,onSetReviewed:_}){let[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=v(),w=(0,Q.useId)(),T=g(e=>e.projects.find(e=>e.name===s)?.path);if(t?e.length===0&&!(n&&y):r===0)return null;let{pending:E,reviewed:D}=G(e),O=t&&e.length>0&&E.length===0,k=x||O,A=V(E),j=t?O?`All ${W(D.length)} reviewed`:`${W(E.length)} changed`:`${W(r)} changed`,M=()=>{y||p?.(),b(!y)},N=e=>{b(!1),t||p?.(),f(e)},P=()=>{b(!1),_?.(E,!0)},F=(e,t)=>(0,z.jsx)(te,{file:e,projectPath:T,dense:t,onClick:()=>N(e.path),onToggleReviewed:_?()=>_([e],!e.reviewed):void 0},e.path),I=t=>(0,z.jsxs)(z.Fragment,{children:[n&&e.length===0&&(0,z.jsx)(`p`,{className:h(`text-text-subtle`,t?`px-2.5 py-1.5 text-[11px]`:`px-4 py-3 text-xs`),children:`Working out what changed…`}),E.map(e=>F(e,t)),D.length>0&&!O&&(0,z.jsx)(ne,{count:D.length,shown:x,dense:t,onToggle:()=>S(!x)}),k&&D.map(e=>F(e,t))]});return(0,z.jsxs)(`div`,{className:`shrink-0 border-t border-border bg-surface-elevated/60`,"data-testid":`session-changes-bar`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:M,"aria-expanded":y,"aria-controls":C?void 0:w,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded px-1 text-left text-xs transition-colors hover:bg-surface md:min-h-8`,children:[(0,z.jsx)(i,{className:h(`size-3.5 shrink-0 text-text-subtle transition-transform`,y&&!C&&`rotate-90`)}),O&&(0,z.jsx)(a,{className:`size-3.5 shrink-0 text-success`}),(0,z.jsx)(`span`,{className:h(`truncate font-medium`,O?`text-text-secondary`:`text-text-primary`),children:j}),t&&!O&&(0,z.jsx)(B,{added:A.added,removed:A.removed,className:`shrink-0 font-mono text-[11px]`}),!O&&D.length>0&&(0,z.jsxs)(`span`,{className:`shrink-0 text-[11px] text-text-subtle @max-[420px]/chat:hidden`,children:[`· `,D.length,` reviewed`]})]}),m&&(0,z.jsx)(`button`,{type:`button`,onClick:m,disabled:n,"aria-label":`Refresh changes`,title:`Refresh changes`,"data-testid":`session-changes-refresh`,className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-text-secondary transition-colors hover:bg-surface hover:text-text-primary disabled:opacity-60 md:min-h-8 md:min-w-8`,children:(0,z.jsx)(c,{className:h(`size-3.5`,n&&`animate-spin`)})}),!C&&t&&!O&&_&&(0,z.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`Mark all reviewed`,title:`Mark all reviewed`,className:`inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded px-2 text-xs text-text-secondary transition-colors hover:bg-surface hover:text-text-primary @max-[420px]/chat:px-1.5`,children:[(0,z.jsx)(o,{className:`size-3.5`}),(0,z.jsx)(`span`,{className:`@max-[420px]/chat:hidden`,children:`Mark all reviewed`})]}),!O&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>N(),className:`inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded px-3 text-xs font-medium text-primary transition-colors hover:bg-surface md:min-h-8 md:px-2`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Review`]})]}),!C&&y&&(0,z.jsxs)(`div`,{id:w,className:`max-h-56 overflow-y-auto border-t border-border-soft`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),b(!1))},children:[I(!0),(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-[11px] text-text-subtle`,children:$(u)})]}),C&&(0,z.jsxs)(ee,{open:y,onClose:()=>b(!1),className:`flex max-h-[85%] flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border-soft pb-1 pl-4 pr-1`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-text-primary`,children:`Changed in this chat`}),t&&!O&&(0,z.jsx)(B,{added:A.added,removed:A.removed,className:`shrink-0 font-mono text-xs`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>b(!1),"aria-label":`Close`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg text-text-subtle transition-colors hover:bg-surface hover:text-text-primary`,children:(0,z.jsx)(l,{className:`size-4`})})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:I(!1)}),(0,z.jsxs)(`div`,{className:`shrink-0 space-y-2 border-t border-border-soft px-3 pt-2`,children:[(0,z.jsx)(`p`,{className:`text-xs leading-relaxed text-text-subtle`,children:$(u)}),!O&&(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[t&&_&&(0,z.jsxs)(`button`,{type:`button`,onClick:P,className:`flex min-h-11 flex-1 items-center justify-center gap-2 rounded-lg border border-border bg-background text-sm font-medium text-text-primary transition-colors hover:bg-surface`,children:[(0,z.jsx)(o,{className:`size-4`}),`Mark all reviewed`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>N(),className:`flex min-h-11 flex-1 items-center justify-center gap-2 rounded-lg bg-primary text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:[(0,z.jsx)(d,{className:`size-4`}),`Review all `,W(t?E.length:r)]})]})]})]})]})}export{w as C,T as S,k as _,H as a,A as b,K as c,P as d,F as f,D as g,O as h,J as i,B as l,j as m,$ as n,U as o,L as p,X as r,q as s,re as t,I as u,R as v,N as x,M as y};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{A as r,L as i,M as a,_n as o,_t as s,hr as c,li as l,vt as u}from"./icons-C1wDt09O.js";import{t as d}from"./file-diff-CScJM-VZ.js";import{o as f,r as p}from"./api-client-BnYFnEfK.js";import{t as m}from"./react-B9hau9ra.js";import{n as h}from"./utils-D3xTlJyU.js";import{i as g}from"./project-store-Bs-kiU8m.js";import{t as _}from"./tab-store-NUmgzMPf.js";import{n as v}from"./use-is-mobile-CL2I7hLf.js";import{n as y}from"./file-icons-CB0RsVdl.js";import{n as b}from"./patch-tab-metadata-DqvfqUI4.js";import{t as ee}from"./mobile-bottom-sheet-M9pZptfh.js";import{t as x}from"./start-ellipsis-DfU-W_6j.js";import{i as S}from"./session-turns-DxIzWBNj.js";var C=e=>e.map(e=>`${e.n}:${e.messageId}:${e.calls.length}:${e.calls[e.calls.length-1]??``}:${e.prompt.length}`).join(`|`),w=m((e,t)=>({bySession:{},publish:(n,r,i)=>{let a=t().bySession[n];a&&a.live===i&&C(a.turns)===C(r)||e(e=>({bySession:{...e.bySession,[n]:{turns:r,byCall:S(r),live:i}}}))},release:n=>{let r=t().bySession[n];r?.live&&e(e=>({bySession:{...e.bySession,[n]:{...r,live:!1}}}))}})),T=m((e,t)=>({request:null,jump:t=>e({request:{...t,at:Date.now()}}),done:n=>{t().request===n&&e({request:null})}}));function E(e,t){return`${f(e)}/chat/sessions/${encodeURIComponent(t)}/file-changes`}async function D(e,t,n,r){let i=await p.post(E(e,t),{paths:n},{signal:r});return Array.isArray(i?.files)?i.files:[]}async function O(e,t,n){let r=await p.get(`${E(e,t)}/count`,{signal:n});return typeof r?.count==`number`?r.count:0}function k(e,t,n,r){return p.get(`${E(e,t)}/diff?path=${encodeURIComponent(n)}`,{signal:r})}function A(e,t,n,r){return p.post(`${E(e,t)}/reviewed`,{files:n.map(e=>({path:e.path,version:e.version})),reviewed:r})}function j(e,t,n,r){return p.post(`${E(e,t)}/answer`,{answer:n,files:r})}function M(e,t,n,r){return p.post(`${E(e,t)}/revert-turn`,{calls:n,...r?{apply:r}:{}})}function N(e,t,n){return p.post(`${E(e,t)}/undo`,{undoId:n})}var P=`ppm:session-review-marks`;function F(e){window.dispatchEvent(new CustomEvent(P,{detail:e}))}var I=`ppm:session-file-changes`;function L(e){window.dispatchEvent(new CustomEvent(I,{detail:e}))}function R(e){let t={paths:e.paths,...e.title?{chatTitle:e.title}:{},select:e.selectPath?{path:e.selectPath,at:Date.now()}:void 0},n=_.getState().openTab({type:`session-review`,title:e.title?`Changes: ${e.title}`:`Session changes`,projectId:e.projectName,closable:!0,metadata:{projectName:e.projectName,sessionId:e.sessionId,providerId:e.providerId,...t}});n&&b(n,t)}var z=n();function B({added:e,removed:t,editCount:n,className:r}){return(0,z.jsxs)(`span`,{className:h(`flex items-center gap-[5px] tabular-nums`,r),children:[(0,z.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),(0,z.jsxs)(`span`,{className:`text-error`,children:[`−`,t]}),n!=null&&n>1&&(0,z.jsxs)(`span`,{className:`text-text-subtle`,children:[`×`,n]})]})}function V(e){let t=0,n=0;for(let r of e)t+=r.additions??0,n+=r.deletions??0;return{added:t,removed:n}}function H(e,t){if(!t)return e;let n=t.replace(/[\\/]+$/,``);return e.length>n.length&&e.startsWith(n)&&/[\\/]/.test(e[n.length])?e.slice(n.length+1):e}function U(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t)}}function W(e){return`${e} file${e===1?``:`s`}`}function G(e){let t=[],n=[];for(let r of e)(r.reviewed?n:t).push(r);return{pending:t,reviewed:n}}function K(e,t,n){return e.map(e=>{if(!t.has(e.path))return e;let{reviewed:r,sinceReview:i,...a}=e;return n?{...a,reviewed:!0}:a})}function q(e,t,n){let r=new Map(t.map(e=>[e.path,e])),i=new Set(n),a=e.filter(e=>!i.has(e.path)).map(e=>r.get(e.path)??e),o=new Set(e.map(e=>e.path));for(let e of t)o.has(e.path)||a.push(e);return a}function J(e){let t=e.reviewed?`reviewed`:e.sinceReview?`since`:``;return`${e.path}\0${e.status}\0${e.baseline}\0${e.version}\0${t}`}var Y={added:{glyph:`A`,cls:`text-success`,label:`Added`},modified:{glyph:`M`,cls:`text-warning`,label:`Modified`},deleted:{glyph:`D`,cls:`text-error`,label:`Deleted`}};function X({file:e,className:t}){return e.additions==null||e.deletions==null?(0,z.jsx)(`span`,{className:h(`text-text-subtle`,t),children:e.binary?`binary`:e.tooLarge?`too large`:``}):(0,z.jsx)(B,{added:e.additions,removed:e.deletions,className:t})}function Z({checked:e,className:t}){return(0,z.jsx)(`span`,{"aria-hidden":!0,className:h(`flex size-4 shrink-0 items-center justify-center rounded border transition-colors`,e?`border-primary bg-primary text-primary-foreground`:`border-text-subtle`,t),children:e&&(0,z.jsx)(r,{className:`size-3`})})}function te({file:e,projectPath:t,dense:n,selected:r,onClick:i,onToggleReviewed:a}){let o=Y[e.status],{base:s,dir:c}=U(H(e.path,t)),l=!!e.reviewed;return(0,z.jsxs)(`div`,{className:`flex border-b border-border-soft`,"data-testid":`session-change-item`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:i,title:e.path,"aria-current":r?`true`:void 0,"data-testid":`session-change-row`,className:h(`grid min-w-0 flex-1 grid-cols-[16px_minmax(0,1fr)_auto_12px] items-center gap-2.5 text-left`,`transition-colors hover:bg-surface`,n?`min-h-9 px-2.5 py-1 text-xs`:`min-h-[52px] px-3 py-1.5 text-[13px]`,r&&`bg-surface shadow-[inset_2px_0_0_var(--accent)]`),children:[(0,z.jsx)(y,{name:s,className:`size-4`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:h(`truncate`,e.status===`deleted`&&`line-through`,e.status===`deleted`||l?`text-text-secondary`:`text-text-primary`),children:s}),c&&(0,z.jsx)(`span`,{className:`flex min-w-0 text-[11px] text-text-subtle`,children:(0,z.jsx)(x,{children:c})})]}),(0,z.jsx)(X,{file:e,className:`font-mono text-[11px]`}),(0,z.jsx)(`span`,{"aria-label":o.label,title:o.label,className:h(`text-center font-mono text-[11px] font-semibold`,o.cls),children:o.glyph})]}),a&&(0,z.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":l,"aria-label":`Mark ${s} reviewed`,title:l?`Reviewed — click to bring it back to the list`:`Mark reviewed`,onClick:a,className:h(`flex shrink-0 items-center justify-center transition-colors hover:bg-surface`,n?`w-8`:`w-11`),children:(0,z.jsx)(Z,{checked:l})})]})}var Q=e(t(),1);function $(e){return e===`claude`?`Shell commands are followed through git: a file outside a repository, or one git ignores, is not listed. Source Control shows everything on disk.`:`Files changed by shell commands are not listed — Source Control shows everything on disk.`}function ne({count:e,shown:t,dense:n,onToggle:r}){let i=t?u:s;return(0,z.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":t,className:h(`flex w-full items-center gap-2 border-b border-border-soft text-left text-text-secondary transition-colors hover:bg-surface`,n?`min-h-8 px-2.5 text-[11px]`:`min-h-11 px-3 text-xs`),children:[(0,z.jsx)(i,{className:`size-3.5 shrink-0`}),(0,z.jsxs)(`span`,{className:`flex-1`,children:[e,` reviewed`]}),(0,z.jsx)(`span`,{className:`text-text-subtle`,children:t?`Hide`:`Show`})]})}function re({files:e,loaded:t=!0,loading:n=!1,unloadedCount:r=0,projectName:s,providerId:u,onReview:f,onOpen:p,onRefresh:m,onSetReviewed:_}){let[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=v(),w=(0,Q.useId)(),T=g(e=>e.projects.find(e=>e.name===s)?.path);if(t?e.length===0&&!(n&&y):r===0)return null;let{pending:E,reviewed:D}=G(e),O=t&&e.length>0&&E.length===0,k=x||O,A=V(E),j=t?O?`All ${W(D.length)} reviewed`:`${W(E.length)} changed`:`${W(r)} changed`,M=()=>{y||p?.(),b(!y)},N=e=>{b(!1),t||p?.(),f(e)},P=()=>{b(!1),_?.(E,!0)},F=(e,t)=>(0,z.jsx)(te,{file:e,projectPath:T,dense:t,onClick:()=>N(e.path),onToggleReviewed:_?()=>_([e],!e.reviewed):void 0},e.path),I=t=>(0,z.jsxs)(z.Fragment,{children:[n&&e.length===0&&(0,z.jsx)(`p`,{className:h(`text-text-subtle`,t?`px-2.5 py-1.5 text-[11px]`:`px-4 py-3 text-xs`),children:`Working out what changed…`}),E.map(e=>F(e,t)),D.length>0&&!O&&(0,z.jsx)(ne,{count:D.length,shown:x,dense:t,onToggle:()=>S(!x)}),k&&D.map(e=>F(e,t))]});return(0,z.jsxs)(`div`,{className:`shrink-0 border-t border-border bg-surface-elevated/60`,"data-testid":`session-changes-bar`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:M,"aria-expanded":y,"aria-controls":C?void 0:w,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded px-1 text-left text-xs transition-colors hover:bg-surface md:min-h-8`,children:[(0,z.jsx)(i,{className:h(`size-3.5 shrink-0 text-text-subtle transition-transform`,y&&!C&&`rotate-90`)}),O&&(0,z.jsx)(a,{className:`size-3.5 shrink-0 text-success`}),(0,z.jsx)(`span`,{className:h(`truncate font-medium`,O?`text-text-secondary`:`text-text-primary`),children:j}),t&&!O&&(0,z.jsx)(B,{added:A.added,removed:A.removed,className:`shrink-0 font-mono text-[11px]`}),!O&&D.length>0&&(0,z.jsxs)(`span`,{className:`shrink-0 text-[11px] text-text-subtle @max-[420px]/chat:hidden`,children:[`· `,D.length,` reviewed`]})]}),m&&(0,z.jsx)(`button`,{type:`button`,onClick:m,disabled:n,"aria-label":`Refresh changes`,title:`Refresh changes`,"data-testid":`session-changes-refresh`,className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-text-secondary transition-colors hover:bg-surface hover:text-text-primary disabled:opacity-60 md:min-h-8 md:min-w-8`,children:(0,z.jsx)(c,{className:h(`size-3.5`,n&&`animate-spin`)})}),!C&&t&&!O&&_&&(0,z.jsxs)(`button`,{type:`button`,onClick:P,"aria-label":`Mark all reviewed`,title:`Mark all reviewed`,className:`inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded px-2 text-xs text-text-secondary transition-colors hover:bg-surface hover:text-text-primary @max-[420px]/chat:px-1.5`,children:[(0,z.jsx)(o,{className:`size-3.5`}),(0,z.jsx)(`span`,{className:`@max-[420px]/chat:hidden`,children:`Mark all reviewed`})]}),!O&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>N(),className:`inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded px-3 text-xs font-medium text-primary transition-colors hover:bg-surface md:min-h-8 md:px-2`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Review`]})]}),!C&&y&&(0,z.jsxs)(`div`,{id:w,className:`max-h-56 overflow-y-auto border-t border-border-soft`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),b(!1))},children:[I(!0),(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-[11px] text-text-subtle`,children:$(u)})]}),C&&(0,z.jsxs)(ee,{open:y,onClose:()=>b(!1),className:`flex max-h-[85%] flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border-soft pb-1 pl-4 pr-1`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-text-primary`,children:`Changed in this chat`}),t&&!O&&(0,z.jsx)(B,{added:A.added,removed:A.removed,className:`shrink-0 font-mono text-xs`}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>b(!1),"aria-label":`Close`,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg text-text-subtle transition-colors hover:bg-surface hover:text-text-primary`,children:(0,z.jsx)(l,{className:`size-4`})})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:I(!1)}),(0,z.jsxs)(`div`,{className:`shrink-0 space-y-2 border-t border-border-soft px-3 pt-2`,children:[(0,z.jsx)(`p`,{className:`text-xs leading-relaxed text-text-subtle`,children:$(u)}),!O&&(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[t&&_&&(0,z.jsxs)(`button`,{type:`button`,onClick:P,className:`flex min-h-11 flex-1 items-center justify-center gap-2 rounded-lg border border-border bg-background text-sm font-medium text-text-primary transition-colors hover:bg-surface`,children:[(0,z.jsx)(o,{className:`size-4`}),`Mark all reviewed`]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>N(),className:`flex min-h-11 flex-1 items-center justify-center gap-2 rounded-lg bg-primary text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:[(0,z.jsx)(d,{className:`size-4`}),`Review all `,W(t?E.length:r)]})]})]})]})]})}export{w as C,T as S,k as _,H as a,A as b,K as c,P as d,F as f,D as g,O as h,J as i,B as l,j as m,$ as n,U as o,L as p,X as r,q as s,re as t,I as u,R as v,N as x,M as y};
@@ -1,4 +1,4 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{A as r,Bt as i,Hn as a,Hr as o,I as s,L as c,M as l,Yr as u,_n as d,gr as f,gt as p,hr as m,kn as h,li as g,m as _,xn as v}from"./icons-C1wDt09O.js";import{o as ee,r as te}from"./api-client-BnYFnEfK.js";import"./settings-store-CBJCnE5L.js";import{n as y}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-UcSFgNCI.js";import"./panel-store-Dx2ziBLp.js";import{i as b}from"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import{t as ne}from"./tab-store-B4v2kAEY.js";import{n as x}from"./use-is-mobile-CL2I7hLf.js";import{t as S}from"./button-BHGVTbam.js";import{n as C}from"./file-icons-CB0RsVdl.js";import"./patch-tab-metadata-DTbCkVvx.js";import{t as w}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import"./start-ellipsis-DfU-W_6j.js";import"./libesm-C9iw2_pm.js";import{i as T,t as re}from"./session-turns-DxIzWBNj.js";import{C as E,S as D,_ as ie,a as O,f as ae,g as oe,i as se,m as ce,n as k,o as A,r as le,u as ue,x as de}from"./session-changes-bar-CjSxBYOF.js";import{a as j,c as M,d as fe,f as pe,l as me,m as he,n as N,o as ge,r as P,s as F,t as I,u as L}from"./review-code-Bet53hHb.js";var R=e(t(),1),_e=5e3,z=e=>e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1);function ve(e,t){return{key:e.key,rows:e.rows,oldFrom:e.oldFrom,oldTo:e.oldTo,added:e.added,removed:e.removed,base:t.base,drawnVersion:t.version,...e.calls?{calls:e.calls}:{}}}function B(e){let{projectName:t,sessionId:n}=e,[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)(new Map),[l,u]=(0,R.useState)(new Map),[d,f]=(0,R.useState)(new Map),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(null),[ee,te]=(0,R.useState)(!1),[y,b]=(0,R.useState)(null),[ne,x]=(0,R.useState)(null),S=(0,R.useRef)(0),C=(0,R.useRef)(-1),w=(0,R.useRef)(Promise.resolve()),T=(0,R.useRef)(new Map),re=(0,R.useRef)([]),E=(0,R.useRef)([]);E.current=[...new Set([...e.paths,...re.current])];let D=(0,R.useCallback)((e,t)=>{S.current>0||t<C.current||(i(e),o(t=>{let n=new Set(t),r=e.map(e=>e.path).filter(e=>!n.has(e));return r.length?[...t,...r]:t}))},[]),O=(0,R.useRef)(null),k=(0,R.useCallback)(async()=>{if(!t||!n)return;O.current?.abort();let e=new AbortController;O.current=e;let r=performance.now();te(!0),b(null);try{let i=await oe(t,n,E.current,e.signal);e.signal.aborted||D(i,r)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:`Could not list this chat's changes`)}finally{e.signal.aborted||te(!1)}},[t,n,D]);(0,R.useEffect)(()=>(k(),()=>O.current?.abort()),[k]),(0,R.useEffect)(()=>{let e=e=>{let r=e.detail;r.projectName!==t||r.sessionId!==n||(re.current=r.paths,D(r.files,r.askedAt))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},[t,n,D]);let A=(0,R.useMemo)(()=>ge({order:a,files:r??[],reverted:s,gone:l,pending:d}),[a,r,s,l,d]),le=(0,R.useMemo)(()=>fe(A),[A]),j=p?A.find(e=>e.path===p.path)??null:null,he=(0,R.useRef)(void 0);(0,R.useEffect)(()=>{if(!r)return;let t=e.select?.path&&e.select.at!==he.current?e.select:null;if(t){he.current=t.at;let e=A.find(e=>e.path===t.path);if(e){m(F(e));return}}m(e=>{if(!e)return S.current>0?null:M(A,null);let t=A.find(t=>t.path===e.path);return t?t.blocks.some(t=>t.key===e.key)?e:F(t):M(A,null)})},[r,A,e.select?.path,e.select?.at]);let N=j&&!j.gone&&j.file.blocks?j.file:null,I=N?se(N):``;(0,R.useEffect)(()=>{if(!t||!n||!N)return;let e=new AbortController,r=I;return ie(t,n,N.path,e.signal).then(t=>{e.signal.aborted||g(t)}).catch(t=>{e.signal.aborted||v({key:r,message:t instanceof Error?t.message:`Could not load this file's diff`})}),()=>e.abort()},[t,n,I]);let L=(0,R.useMemo)(()=>{if(!j)return{kind:`none`};let e=s.get(j.path)??[],t=new Map;for(let e of j.blocks){let n=d.get(P(j.path,e.key));n&&t.set(e.key,n)}let n=null;if(j.gone){let e=l.get(j.path);e&&e.text!==null&&(n={original:e.text,modified:e.text,version:``,base:e.file.base??``,kept:new Set})}else if(j.file.blocks){if(h?.path!==j.path)return _?.key===I?{kind:`error`,message:_.message}:{kind:`loading`};let e=new Set((j.file.blocks??[]).filter(e=>e.kept).map(e=>e.key)),t=new Map((j.file.blocks??[]).flatMap(e=>e.calls?.length?[[e.key,e.calls]]:[]));n={original:h.original,modified:h.modified,version:h.version,base:h.base??``,kept:e,calls:t}}let r=n&&me({...n,reverted:e,pending:t});return!n||!r?{kind:`whole`,review:j,undoId:j.gone?l.get(j.path)?.undoId:void 0}:{kind:`blocks`,review:j,model:r,version:n.version,original:n.original,base:n.base}},[j,s,l,d,h,_,I]),B=L.kind===`blocks`?L.model.stale.join(`
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import"./vendor-ui-BTSIXzhZ.js";import{A as r,Bt as i,Hn as a,Hr as o,I as s,L as c,M as l,Yr as u,_n as d,gr as f,gt as p,hr as m,kn as h,li as g,m as _,xn as v}from"./icons-C1wDt09O.js";import{o as ee,r as te}from"./api-client-BnYFnEfK.js";import"./settings-store-CMpVMq3Y.js";import{n as y}from"./utils-D3xTlJyU.js";import"./portal-container-context-Gepuvxdg.js";import"./window-store-D6EgLSfT.js";import"./panel-store-H7e9XHZF.js";import{i as b}from"./project-store-Bs-kiU8m.js";import"./project-framework-store-nuePqBBa.js";import"./session-list-sync-triggers-D9i1FxWd.js";import{t as ne}from"./tab-store-NUmgzMPf.js";import{n as x}from"./use-is-mobile-CL2I7hLf.js";import{t as S}from"./button-BHGVTbam.js";import{n as C}from"./file-icons-CB0RsVdl.js";import"./patch-tab-metadata-DqvfqUI4.js";import{t as w}from"./mobile-bottom-sheet-M9pZptfh.js";import"./use-visual-viewport-B_GFo6k2.js";import"./start-ellipsis-DfU-W_6j.js";import"./libesm-C9iw2_pm.js";import{i as T,t as re}from"./session-turns-DxIzWBNj.js";import{C as E,S as D,_ as ie,a as O,f as ae,g as oe,i as se,m as ce,n as k,o as A,r as le,u as ue,x as de}from"./session-changes-bar-Dz3QitdJ.js";import{a as j,c as M,d as fe,f as pe,l as me,m as he,n as N,o as ge,r as P,s as F,t as I,u as L}from"./review-code-Dy8y4_17.js";var R=e(t(),1),_e=5e3,z=e=>e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1);function ve(e,t){return{key:e.key,rows:e.rows,oldFrom:e.oldFrom,oldTo:e.oldTo,added:e.added,removed:e.removed,base:t.base,drawnVersion:t.version,...e.calls?{calls:e.calls}:{}}}function B(e){let{projectName:t,sessionId:n}=e,[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)(new Map),[l,u]=(0,R.useState)(new Map),[d,f]=(0,R.useState)(new Map),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(null),[ee,te]=(0,R.useState)(!1),[y,b]=(0,R.useState)(null),[ne,x]=(0,R.useState)(null),S=(0,R.useRef)(0),C=(0,R.useRef)(-1),w=(0,R.useRef)(Promise.resolve()),T=(0,R.useRef)(new Map),re=(0,R.useRef)([]),E=(0,R.useRef)([]);E.current=[...new Set([...e.paths,...re.current])];let D=(0,R.useCallback)((e,t)=>{S.current>0||t<C.current||(i(e),o(t=>{let n=new Set(t),r=e.map(e=>e.path).filter(e=>!n.has(e));return r.length?[...t,...r]:t}))},[]),O=(0,R.useRef)(null),k=(0,R.useCallback)(async()=>{if(!t||!n)return;O.current?.abort();let e=new AbortController;O.current=e;let r=performance.now();te(!0),b(null);try{let i=await oe(t,n,E.current,e.signal);e.signal.aborted||D(i,r)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:`Could not list this chat's changes`)}finally{e.signal.aborted||te(!1)}},[t,n,D]);(0,R.useEffect)(()=>(k(),()=>O.current?.abort()),[k]),(0,R.useEffect)(()=>{let e=e=>{let r=e.detail;r.projectName!==t||r.sessionId!==n||(re.current=r.paths,D(r.files,r.askedAt))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},[t,n,D]);let A=(0,R.useMemo)(()=>ge({order:a,files:r??[],reverted:s,gone:l,pending:d}),[a,r,s,l,d]),le=(0,R.useMemo)(()=>fe(A),[A]),j=p?A.find(e=>e.path===p.path)??null:null,he=(0,R.useRef)(void 0);(0,R.useEffect)(()=>{if(!r)return;let t=e.select?.path&&e.select.at!==he.current?e.select:null;if(t){he.current=t.at;let e=A.find(e=>e.path===t.path);if(e){m(F(e));return}}m(e=>{if(!e)return S.current>0?null:M(A,null);let t=A.find(t=>t.path===e.path);return t?t.blocks.some(t=>t.key===e.key)?e:F(t):M(A,null)})},[r,A,e.select?.path,e.select?.at]);let N=j&&!j.gone&&j.file.blocks?j.file:null,I=N?se(N):``;(0,R.useEffect)(()=>{if(!t||!n||!N)return;let e=new AbortController,r=I;return ie(t,n,N.path,e.signal).then(t=>{e.signal.aborted||g(t)}).catch(t=>{e.signal.aborted||v({key:r,message:t instanceof Error?t.message:`Could not load this file's diff`})}),()=>e.abort()},[t,n,I]);let L=(0,R.useMemo)(()=>{if(!j)return{kind:`none`};let e=s.get(j.path)??[],t=new Map;for(let e of j.blocks){let n=d.get(P(j.path,e.key));n&&t.set(e.key,n)}let n=null;if(j.gone){let e=l.get(j.path);e&&e.text!==null&&(n={original:e.text,modified:e.text,version:``,base:e.file.base??``,kept:new Set})}else if(j.file.blocks){if(h?.path!==j.path)return _?.key===I?{kind:`error`,message:_.message}:{kind:`loading`};let e=new Set((j.file.blocks??[]).filter(e=>e.kept).map(e=>e.key)),t=new Map((j.file.blocks??[]).flatMap(e=>e.calls?.length?[[e.key,e.calls]]:[]));n={original:h.original,modified:h.modified,version:h.version,base:h.base??``,kept:e,calls:t}}let r=n&&me({...n,reverted:e,pending:t});return!n||!r?{kind:`whole`,review:j,undoId:j.gone?l.get(j.path)?.undoId:void 0}:{kind:`blocks`,review:j,model:r,version:n.version,original:n.original,base:n.base}},[j,s,l,d,h,_,I]),B=L.kind===`blocks`?L.model.stale.join(`
2
2
  `):``;(0,R.useEffect)(()=>{if(!B||L.kind!==`blocks`)return;let e=L.review.path,t=new Set(B.split(`
3
3
  `));c(n=>new Map(n).set(e,(n.get(e)??[]).filter(e=>!t.has(e.key))))},[B]);let V=(0,R.useRef)(null),ye=(0,R.useRef)(0),H=(0,R.useCallback)(e=>{V.current&&clearTimeout(V.current);let t=++ye.current;x({...e,id:t}),V.current=setTimeout(()=>x(e=>e?.id===t?null:e),_e)},[]),be=(0,R.useCallback)(()=>{V.current&&clearTimeout(V.current),x(null)},[]);(0,R.useEffect)(()=>()=>{V.current&&clearTimeout(V.current)},[]);let U=(e,t)=>{let n=T.current.get(e),r=t;for(let e=0;n?.has(r)&&e<64;e++)r=n.get(r);return r},W=(e,t,n)=>{if(t===n)return;let r=T.current.get(e)??new Map;T.current.set(e,r.set(t,n))},G=e=>{let t=new Map(e.map(e=>[e.path,e.file]));i(n=>{if(!n)return n;let r=n.flatMap(e=>t.has(e.path)?t.get(e.path)?[t.get(e.path)]:[]:[e]);for(let t of e)t.file&&!n.some(e=>e.path===t.path)&&r.push(t.file);return r}),o(t=>{let n=e.filter(e=>e.file&&!t.includes(e.path)).map(e=>e.path);return n.length?[...t,...n]:t}),u(t=>{if(!e.some(e=>e.file&&t.has(e.path)))return t;let n=new Map(t);for(let t of e)t.file&&n.delete(t.path);return n})},K=e=>{let t=e.find(e=>e.stale||e.error);return t?(H(t.error?{lead:t.error}:{lead:``,name:z(t.path),tail:` changed before the answer reached it, so it is shown again as it is now.`}),!0):!1},xe=e=>{S.current++;let r=async()=>{try{return await e()}finally{S.current--,C.current=performance.now(),t&&n&&ae({projectName:t,sessionId:n})}},i=w.current.then(r,r);return w.current=i,i},q=(e,r,i)=>{if(!t||!n||r.length===0)return Promise.resolve(null);let a=i.states??new Map,o=i.ghosts??new Map;a.size&&f(e=>new Map([...e,...a])),o.size&&c(e=>{let t=new Map(e);for(let[n,r]of o)t.set(n,[...(e.get(n)??[]).filter(e=>!r.some(t=>t.key===e.key)),...r]);return t});let s=e=>{c(t=>{let n=new Map(t);for(let[r,i]of o)n.set(r,(t.get(r)??[]).flatMap(t=>i.includes(t)?[e(t,r)].filter(e=>!!e):[t]));return n})};return xe(async()=>{let i=r.map(e=>({path:e.review.path,version:U(e.review.path,e.drawn),...e.keys?{keys:e.keys}:{}}));try{let a=await ce(t,n,e,i),o=new Set(a.files.filter(e=>e.stale||e.error).map(e=>e.path));if(s((e,t)=>o.has(t)?null:{...e,undoId:a.undoId}),a.files.forEach((e,t)=>{o.has(e.path)||W(e.path,i[t]?.version??``,e.file?.version??``)}),e===`revert`){let e=r.filter(e=>a.files.some(t=>t.path===e.review.path&&!o.has(t.path)&&!t.file));e.length&&u(t=>{let n=new Map(t);for(let t of e)n.set(t.review.path,{file:t.review.file,text:t.text??null,undoId:a.undoId});return n})}return G(a.files),a}catch(e){return s(()=>null),H({lead:e instanceof Error?e.message:`Could not save the answer`}),null}finally{a.size&&f(e=>{let t=new Map(e);for(let e of a.keys())t.delete(e);return t})}})},J=e=>L.kind===`blocks`&&L.review.path===e.path?L.version:e.file.version,Se=e=>L.kind===`blocks`?L.model.items.find(t=>t.kind===`block`&&t.key===e):void 0,Y=e=>ge({order:a,files:r??[],reverted:s,gone:l,pending:new Map([...d,...e])}),X=async(e,t)=>{if(!j||j.gone)return;let n=j,r=Se(e),i=new Map([[P(n.path,e),t===`keep`?`kept`:`reverted`]]),a=Y(i);m(M(a,{path:n.path,key:e}));let o=t===`revert`&&r&&L.kind===`blocks`?new Map([[n.path,[ve(r,L)]]]):void 0,s=L.kind===`blocks`?L.original:null,c=await q(t,[{review:n,drawn:J(n),keys:e===`*`?void 0:[e],text:s}],{states:i,ghosts:o});if(!c||K(c.files))return;let l=a.find(e=>e.path===n.path)?.open===0;H({lead:`${t===`keep`?`Kept`:`Reverted`} ${r?`block ${r.index+1} of `:``}`,name:z(n.path),tail:l?` — file done`:``,undoId:c.undoId,focus:{path:n.path,key:e}})};return{files:r,reviews:A,progress:le,focus:p,setFocus:m,focused:j,pane:L,loading:ee,error:y,toast:ne,dismissToast:be,reload:k,step:(0,R.useCallback)(e=>m(t=>pe(A,t,e)),[A]),focusFile:(0,R.useCallback)(e=>{let t=A.find(t=>t.path===e);t&&m(F(t))},[A]),keepBlock:e=>X(e,`keep`),revertBlock:e=>X(e,`revert`),reopenBlock:async e=>{if(!j||j.gone)return;let t=j,n=Se(e);m({path:t.path,key:e});let r=await q(`open`,[{review:t,drawn:J(t),keys:e===`*`?void 0:[e]}],{states:new Map([[P(t.path,e),`open`]])});!r||K(r.files)||H({lead:n?`Block ${n.index+1} of `:``,name:z(t.path),tail:` is open again`,undoId:r.undoId,focus:{path:t.path,key:e}})},undo:(e,i)=>!t||!n?Promise.resolve():(be(),xe(async()=>{try{let a=await de(t,n,e);if(a.stale){H({lead:`Could not undo: the file changed since.`});return}for(let e of a.files){let t=r?.find(t=>t.path===e.path)?.version;t!==void 0&&e.file&&W(e.path,t,e.file.version)}c(t=>{let n=new Map;for(let[r,i]of t)n.set(r,i.filter(t=>t.undoId!==e));return n}),G(a.files),i&&m(i)}catch(e){H({lead:e instanceof Error?e.message:`Could not undo`})}})),keepFile:async()=>{if(!j||j.gone||j.open===0)return;let e=j,t=e.blocks.filter(e=>e.state===`open`).map(e=>e.key),n=new Map(t.map(t=>[P(e.path,t),`kept`]));m(M(Y(n),{path:e.path,key:e.blocks[e.blocks.length-1].key}));let r=await q(`keep`,[{review:e,drawn:J(e),keys:t.includes(`*`)?void 0:t}],{states:n});!r||K(r.files)||H({lead:`Kept `,name:z(e.path),undoId:r.undoId,focus:F(e)})},revertFile:async()=>{if(!j||j.gone)return;let e=j,t=new Map(e.blocks.filter(e=>e.state!==`reverted`).map(t=>[P(e.path,t.key),`reverted`]));m(M(Y(t),{path:e.path,key:e.blocks[e.blocks.length-1].key}));let n=L.kind===`blocks`&&L.review.path===e.path?new Map([[e.path,L.model.items.filter(e=>e.kind===`block`&&e.state!==`reverted`).map(e=>ve(e,L))]]):void 0,r=L.kind===`blocks`?L.original:null,i=await q(`revert`,[{review:e,drawn:J(e),text:r}],{states:t,ghosts:n});!i||K(i.files)||H({lead:`Reverted `,name:z(e.path),undoId:i.undoId,focus:F(e)})},keepAll:async()=>{let e=A.filter(e=>e.open>0&&!e.gone);if(e.length===0)return;let t=new Map(e.flatMap(e=>e.blocks.filter(e=>e.state===`open`).map(t=>[P(e.path,t.key),`kept`]))),n=p;m(null);let r=await q(`keep`,e.map(e=>{let t=e.blocks.filter(e=>e.state===`open`).map(e=>e.key);return{review:e,drawn:J(e),keys:t.includes(`*`)?void 0:t}}),{states:t});!r||K(r.files)||H({lead:`Kept ${t.size} block${t.size===1?``:`s`}`,undoId:r.undoId,focus:n})}}}var V=8e3,ye=new Map,H=new Map;function be(e){let{projectName:t,sessionId:n,providerId:r}=e,i=E(e=>n?e.bySession[n]:void 0),a=i?.byCall??ye,o=e.calls.filter(e=>!a.has(e)).sort().join(`
4
4
  `),s=i?.live??!1;return(0,R.useEffect)(()=>{if(!t||!n||!r||s||i&&!o)return;let e=H.get(n);if(i&&e?.unplaced===o)return;let a=new AbortController,c=setTimeout(()=>{H.set(n,{at:Date.now(),unplaced:e?.unplaced??null}),te.get(`${ee(t)}/chat/sessions/${n}/messages?providerId=${r}`,{signal:a.signal}).then(e=>{let t=Array.isArray(e)?e:e?.messages;if(a.signal.aborted||!Array.isArray(t))return;let r=re(t),i=T(r);H.set(n,{at:Date.now(),unplaced:o.split(`
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{L as r,u as i}from"./icons-C1wDt09O.js";import{t as a}from"./settings-store-CBJCnE5L.js";import{n as o}from"./utils-D3xTlJyU.js";import{a as s,i as c,n as l,o as u,r as d,s as f}from"./settings-categories-BY9n3BRr.js";import{t as p}from"./button-BHGVTbam.js";import{t as m}from"./scroll-area-CSmNLlfl.js";import{t as h}from"./separator-CYw7bF1W.js";import{n as g}from"./settings-section-content-DFLjO2le.js";var _=n();function v({active:e,onSelect:t}){let n=a(e=>e.minimalMode);return(0,_.jsx)(m,{className:`h-full`,children:(0,_.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:l.map(r=>{let i=u(r.id,n);return i.length===0?null:(0,_.jsxs)(`div`,{className:`space-y-1`,children:[r.label&&(0,_.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:r.label}),i.map(n=>{let r=n.icon,i=n.id===e;return(0,_.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:o(`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,_.jsx)(r,{className:o(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,_.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},r.id)})})})}function y({onSelect:e}){let t=a(e=>e.minimalMode);return(0,_.jsx)(m,{className:`h-full`,children:(0,_.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:l.map(n=>{let i=u(n.id,t);return i.length===0?null:(0,_.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,_.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),i.map(t=>{let n=t.icon;return(0,_.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,_.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,_.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,_.jsx)(r,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},n.id)})})})}var b=e(t(),1);function x({initialCategory:e,onCategoryChange:t}){let n=a(e=>e.minimalMode),[r,o]=(0,b.useState)(e??`general`),[l,u]=(0,b.useState)(e===void 0),x=s(r,n),S=f(x),C=S.icon;function w(e){e=s(e,n),o(e),u(!1),t?.(e)}let T=(0,b.useRef)(w);return T.current=w,(0,b.useEffect)(()=>{let e=e=>{let t=e.detail;c(t)&&T.current(t)};return window.addEventListener(d,e),()=>window.removeEventListener(d,e)},[]),(0,_.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":x,children:(0,_.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,_.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,_.jsx)(v,{active:x,onSelect:w})}),(0,_.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,_.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,_.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,_.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>u(!0),children:(0,_.jsx)(i,{className:`size-4`})}),(0,_.jsx)(C,{className:`size-4 text-muted-foreground shrink-0`}),(0,_.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:S.label})]}),(0,_.jsx)(h,{}),(0,_.jsx)(m,{className:`flex-1 min-h-0`,children:(0,_.jsx)(`div`,{className:`p-4 pb-8`,children:(0,_.jsx)(g,{category:x})})})]}),l&&(0,_.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,_.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,_.jsx)(h,{}),(0,_.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,_.jsx)(y,{onSelect:w})})]})]})]})})}export{x as t};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{L as r,u as i}from"./icons-C1wDt09O.js";import{t as a}from"./settings-store-CMpVMq3Y.js";import{n as o}from"./utils-D3xTlJyU.js";import{a as s,i as c,n as l,o as u,r as d,s as f}from"./settings-categories-BY9n3BRr.js";import{t as p}from"./button-BHGVTbam.js";import{t as m}from"./scroll-area-CSmNLlfl.js";import{t as h}from"./separator-DUdRLaL0.js";import{n as g}from"./settings-section-content-BOwSlBkZ.js";var _=n();function v({active:e,onSelect:t}){let n=a(e=>e.minimalMode);return(0,_.jsx)(m,{className:`h-full`,children:(0,_.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:l.map(r=>{let i=u(r.id,n);return i.length===0?null:(0,_.jsxs)(`div`,{className:`space-y-1`,children:[r.label&&(0,_.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:r.label}),i.map(n=>{let r=n.icon,i=n.id===e;return(0,_.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:o(`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,_.jsx)(r,{className:o(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,_.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},r.id)})})})}function y({onSelect:e}){let t=a(e=>e.minimalMode);return(0,_.jsx)(m,{className:`h-full`,children:(0,_.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:l.map(n=>{let i=u(n.id,t);return i.length===0?null:(0,_.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,_.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),i.map(t=>{let n=t.icon;return(0,_.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,_.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,_.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,_.jsx)(r,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},n.id)})})})}var b=e(t(),1);function x({initialCategory:e,onCategoryChange:t}){let n=a(e=>e.minimalMode),[r,o]=(0,b.useState)(e??`general`),[l,u]=(0,b.useState)(e===void 0),x=s(r,n),S=f(x),C=S.icon;function w(e){e=s(e,n),o(e),u(!1),t?.(e)}let T=(0,b.useRef)(w);return T.current=w,(0,b.useEffect)(()=>{let e=e=>{let t=e.detail;c(t)&&T.current(t)};return window.addEventListener(d,e),()=>window.removeEventListener(d,e)},[]),(0,_.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":x,children:(0,_.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,_.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,_.jsx)(v,{active:x,onSelect:w})}),(0,_.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,_.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,_.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,_.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>u(!0),children:(0,_.jsx)(i,{className:`size-4`})}),(0,_.jsx)(C,{className:`size-4 text-muted-foreground shrink-0`}),(0,_.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:S.label})]}),(0,_.jsx)(h,{}),(0,_.jsx)(m,{className:`flex-1 min-h-0`,children:(0,_.jsx)(`div`,{className:`p-4 pb-8`,children:(0,_.jsx)(g,{category:x})})})]}),l&&(0,_.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,_.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,_.jsx)(h,{}),(0,_.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,_.jsx)(y,{onSelect:w})})]})]})]})})}export{x as t};
@@ -1 +1 @@
1
- import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{n as r}from"./utils-D3xTlJyU.js";import{t as i}from"./button-BHGVTbam.js";import{Zn as a}from"./index-Cx9ZRibz.js";var o=e(t(),1),s=n();function c({title:e,children:t}){return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h3`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t})]})}function l({label:e,note:t,checked:n,disabled:i,onChange:c}){let l=(0,o.useId)();return(0,s.jsxs)(`div`,{className:`flex min-h-11 items-center justify-between gap-3 px-4`,children:[(0,s.jsxs)(`label`,{htmlFor:l,className:r(`min-w-0 flex-1 py-3`,i?`cursor-default`:`cursor-pointer`),children:[(0,s.jsx)(`span`,{className:`block text-sm`,children:e}),t&&(0,s.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t})]}),(0,s.jsx)(a,{id:l,checked:n,disabled:i,onCheckedChange:c})]})}function u({label:e,onClick:t,disabled:n,danger:a,children:o}){return(0,s.jsx)(i,{variant:`ghost`,size:`icon`,"aria-label":e,title:e,disabled:n,onClick:t,className:r(`size-11 shrink-0 cursor-pointer md:size-9`,a&&`text-error hover:text-error`),children:o})}export{c as n,l as r,u as t};
1
+ import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-C-P1aR4p.js";import{n as r}from"./utils-D3xTlJyU.js";import{t as i}from"./button-BHGVTbam.js";import{Qn as a}from"./index-Vd9Xr54k.js";var o=e(t(),1),s=n();function c({title:e,children:t}){return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h3`,{className:`text-sm font-medium`,children:e}),(0,s.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t})]})}function l({label:e,note:t,checked:n,disabled:i,onChange:c}){let l=(0,o.useId)();return(0,s.jsxs)(`div`,{className:`flex min-h-11 items-center justify-between gap-3 px-4`,children:[(0,s.jsxs)(`label`,{htmlFor:l,className:r(`min-w-0 flex-1 py-3`,i?`cursor-default`:`cursor-pointer`),children:[(0,s.jsx)(`span`,{className:`block text-sm`,children:e}),t&&(0,s.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t})]}),(0,s.jsx)(a,{id:l,checked:n,disabled:i,onCheckedChange:c})]})}function u({label:e,onClick:t,disabled:n,danger:a,children:o}){return(0,s.jsx)(i,{variant:`ghost`,size:`icon`,"aria-label":e,title:e,disabled:n,onClick:t,className:r(`size-11 shrink-0 cursor-pointer md:size-9`,a&&`text-error hover:text-error`),children:o})}export{c as n,l as r,u as t};