@xopcai/xopc 0.0.196 → 0.0.199

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 (258) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-BwmdJ5pv.js → activity-store-DYVN1hRp.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B1oxPli_.js → agent-avatar-dicebear-Bt70bZjv.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-D19uNmJf.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-BM1hNzjw.js → api-B8mzbAle.js} +1 -1
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-B4x7JfL8.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-Dwdagf-Q.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-DkTiesxe.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-BdE4Mati.js → archive-plugin-Cv0VXKLm.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CTzaQcLV.js → attachment-load-CgidKrXn.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BR6qMOVr.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-B25zTNxl.js → binary-plugins-DN3CQgIq.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Cdrf2awF.js → block-editor-BwkSl1F_.js} +46 -46
  15. package/dist/gateway/static/root/assets/browser-settings-page-CDFQWAxI.js +8 -0
  16. package/dist/gateway/static/root/assets/browser-workflow-inputs-_ndaecsf.js +1 -0
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-Wx9FrbK-.js → browser-workflows-page-C_I31wLm.js} +2 -2
  18. package/dist/gateway/static/root/assets/button-CSEbl4zT.js +1 -0
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-D41mssOq.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BoOzFotX.js → capability-presets-api-Dy1jZJKs.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BXgCyuu2.js +3 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-_8IiTxRB.js → channel-recipient-api-D-9qiuio.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-DV5BhAeu.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +1 -0
  25. package/dist/gateway/static/root/assets/connectors-api-5FEBYguL.js +1 -0
  26. package/dist/gateway/static/root/assets/connectors-page-C_qkEN0T.js +2 -0
  27. package/dist/gateway/static/root/assets/copy-Dv6d4Dvw.js +1 -0
  28. package/dist/gateway/static/root/assets/cron-expression-SEFx5rnr.js +2 -0
  29. package/dist/gateway/static/root/assets/date-picker-D4zCUQJL.js +1 -0
  30. package/dist/gateway/static/root/assets/dependency-picker-DpQAxS2k.js +1 -0
  31. package/dist/gateway/static/root/assets/{desktop-pet-BOb8sEhN.js → desktop-pet-B_5G3lQl.js} +1 -1
  32. package/dist/gateway/static/root/assets/desktop-pet-settings-ClEyoUJe.js +1 -0
  33. package/dist/gateway/static/root/assets/directory-picker-path-field-AsFWmOjG.js +1 -0
  34. package/dist/gateway/static/root/assets/dist-BPoKqzeH.js +1 -0
  35. package/dist/gateway/static/root/assets/dist-DY4Af0fY.js +1 -0
  36. package/dist/gateway/static/root/assets/{extension-debug-page-p83TmZFd.js → extension-debug-page-C22Y2o5l.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-page-DMQ3ovxA.js → extension-page-C61Ikawk.js} +1 -1
  38. package/dist/gateway/static/root/assets/extension-settings-page-WlWWcDFr.js +1 -0
  39. package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +1 -0
  40. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-config-api-ByIOMQdc.js +1 -0
  42. package/dist/gateway/static/root/assets/gateway-config-swr-jB0hAhWO.js +1 -0
  43. package/dist/gateway/static/root/assets/gateway-settings-CzzS9A17.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry--2njcDpC.js → gateway-startup-retry-C-fRlHCL.js} +1 -1
  45. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +1 -0
  46. package/dist/gateway/static/root/assets/heartbeat-settings-B4A_CXUL.js +1 -0
  47. package/dist/gateway/static/root/assets/home-page-FVGYYPWo.js +3 -0
  48. package/dist/gateway/static/root/assets/index-CGbKTCST.js +152 -0
  49. package/dist/gateway/static/root/assets/index-CR233S0Q.css +1 -0
  50. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BQb06_jl.js → keyboard-shortcuts-settings-BD_TFz0_.js} +1 -1
  52. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +1 -0
  53. package/dist/gateway/static/root/assets/local-app-workbench-page-BNpkigNb.js +2 -0
  54. package/dist/gateway/static/root/assets/local-apps-page-BwbUeLfm.js +1 -0
  55. package/dist/gateway/static/root/assets/{locale-store-Bjvw7jtg.js → locale-store-xULEcFVs.js} +1 -1
  56. package/dist/gateway/static/root/assets/logs-page-DXP9OQQt.js +2 -0
  57. package/dist/gateway/static/root/assets/management-settings-CW2VpqtT.js +1 -0
  58. package/dist/gateway/static/root/assets/{markdown-split-Db-KrpOQ.js → markdown-split-B1M9KO16.js} +1 -1
  59. package/dist/gateway/static/root/assets/{media-plugins-CHN66qs0.js → media-plugins-B_QlNdqZ.js} +1 -1
  60. package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +3 -0
  61. package/dist/gateway/static/root/assets/{notes-page-CJtKZM0P.js → notes-page-BTbD4GmH.js} +1 -1
  62. package/dist/gateway/static/root/assets/notes-workbench-JRiq7QDW.js +4 -0
  63. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
  64. package/dist/gateway/static/root/assets/popover-select-BzdnTy3h.js +1 -0
  65. package/dist/gateway/static/root/assets/preview-open-alternatives-CeqtArlZ.js +1 -0
  66. package/dist/gateway/static/root/assets/{product-open-page--RnCc9bb.js → product-open-page-DnalBZZs.js} +1 -1
  67. package/dist/gateway/static/root/assets/project-detail-page-CjWA13aE.js +1 -0
  68. package/dist/gateway/static/root/assets/projects-page-jsCkScbG.js +1 -0
  69. package/dist/gateway/static/root/assets/remote-access-hub-CGPJTEkM.js +1 -0
  70. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bg1W2__k.js → runtime-tools-settings-panel-cGkBEfg4.js} +4 -4
  71. package/dist/gateway/static/root/assets/schema-form-CmsrLlxu.js +1 -0
  72. package/dist/gateway/static/root/assets/sessions-page-BBHzziMd.js +1 -0
  73. package/dist/gateway/static/root/assets/settings-advanced-gate-2cGg8-9h.js +1 -0
  74. package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +1 -0
  75. package/dist/gateway/static/root/assets/settings-form-section-DUWCbaMJ.js +1 -0
  76. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BS36Mjzz.js → settings-loading-skeleton-Bvy5rdMY.js} +1 -1
  77. package/dist/gateway/static/root/assets/{settings-page-BDSd7F9Y.js → settings-page-cZSAwsRR.js} +1 -1
  78. package/dist/gateway/static/root/assets/settings-page-layout-BRQNel6r.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +1 -0
  80. package/dist/gateway/static/root/assets/setup-status-panel-Cf06b66-.js +1 -0
  81. package/dist/gateway/static/root/assets/share-preview-page-BzA2NCAH.js +2 -0
  82. package/dist/gateway/static/root/assets/shares-settings-xlNKydYY.js +1 -0
  83. package/dist/gateway/static/root/assets/skill-reload-api-C5Xu93c_.js +1 -0
  84. package/dist/gateway/static/root/assets/skills-page-Bvde7_i5.js +2 -0
  85. package/dist/gateway/static/root/assets/{skills-page.utils-CnbJncdL.js → skills-page.utils-vXSqHR7g.js} +1 -1
  86. package/dist/gateway/static/root/assets/system-settings-panel-9cQGOGCK.js +1 -0
  87. package/dist/gateway/static/root/assets/task-detail-page-Bkno4tTe.js +1 -0
  88. package/dist/gateway/static/root/assets/{theme-store-DtxpMC5S.js → theme-store-CHQRiuCF.js} +1 -1
  89. package/dist/gateway/static/root/assets/tool-activity-R8V9l6nk.js +1 -0
  90. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
  91. package/dist/gateway/static/root/assets/use-autosave-7XfKULPI.js +1 -0
  92. package/dist/gateway/static/root/assets/user-context-page-CZ9m9aC_.js +1 -0
  93. package/dist/gateway/static/root/assets/voice-api-key-field-DXr21v-3.js +1 -0
  94. package/dist/gateway/static/root/assets/work-discovery-overlay-CeG7g_DZ.js +1 -0
  95. package/dist/gateway/static/root/assets/work-discovery-page-CQWZD03N.js +1 -0
  96. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BEmugHfL.js → workflow-run-setup-panel-DSQQZP9T.js} +2 -2
  97. package/dist/gateway/static/root/assets/workflows-page-Cs-MXFJ1.js +5 -0
  98. package/dist/gateway/static/root/assets/working-directory-picker-modal-D-IgcHPp.js +1 -0
  99. package/dist/gateway/static/root/index.html +23 -8
  100. package/dist/package.js +1 -1
  101. package/dist/packages/gateway-contract/src/tasks.js +54 -2
  102. package/dist/src/agent/agent-manager.d.ts +1 -0
  103. package/dist/src/agent/agent-manager.js +1 -0
  104. package/dist/src/agent/embedded/execution-context.d.ts +2 -0
  105. package/dist/src/agent/embedded/execution-context.js +11 -0
  106. package/dist/src/agent/embedded/index.d.ts +3 -1
  107. package/dist/src/agent/embedded/index.js +5 -3
  108. package/dist/src/agent/embedded/run-turn.js +15 -9
  109. package/dist/src/agent/embedded/session-runner.d.ts +6 -11
  110. package/dist/src/agent/embedded/session-runner.js +25 -36
  111. package/dist/src/agent/embedded/transcript-runtime.d.ts +35 -0
  112. package/dist/src/agent/embedded/transcript-runtime.js +66 -0
  113. package/dist/src/agent/embedded/types.d.ts +3 -1
  114. package/dist/src/agent/service.d.ts +15 -0
  115. package/dist/src/agent/service.js +31 -0
  116. package/dist/src/agent/service.types.d.ts +1 -0
  117. package/dist/src/agent/tools/factory.d.ts +2 -0
  118. package/dist/src/agent/tools/factory.js +2 -1
  119. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
  120. package/dist/src/agent/tools/xopc-use-tool.js +56 -6
  121. package/dist/src/automations/domain/validation.d.ts +40 -0
  122. package/dist/src/automations/draft/automation-draft-validator.d.ts +4 -1
  123. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  124. package/dist/src/config/agent-profile.js +1 -1
  125. package/dist/src/config/rules.js +2 -2
  126. package/dist/src/gateway/agents-admin.js +1 -1
  127. package/dist/src/gateway/hono/app.d.ts +2 -0
  128. package/dist/src/gateway/hono/app.js +10 -3
  129. package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
  130. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
  131. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -1
  132. package/dist/src/gateway/hono/routes/config.js +9 -0
  133. package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
  134. package/dist/src/gateway/hono/routes/home.d.ts +1 -1
  135. package/dist/src/gateway/hono/routes/home.js +2 -2
  136. package/dist/src/gateway/hono/routes/index.js +2 -0
  137. package/dist/src/gateway/hono/routes/projects.js +67 -1
  138. package/dist/src/gateway/hono/routes/side-chats.d.ts +3 -0
  139. package/dist/src/gateway/hono/routes/side-chats.js +173 -0
  140. package/dist/src/gateway/hono/routes/tasks.js +112 -19
  141. package/dist/src/gateway/host.d.ts +9 -1
  142. package/dist/src/gateway/host.js +22 -5
  143. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  144. package/dist/src/gateway/rate-limit/buckets.js +12 -0
  145. package/dist/src/gateway/runtime-config.js +6 -5
  146. package/dist/src/gateway/security/audit.js +0 -7
  147. package/dist/src/gateway/server.js +4 -1
  148. package/dist/src/gateway/service/agent-runner.d.ts +4 -0
  149. package/dist/src/gateway/service/agent-runner.js +15 -1
  150. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  151. package/dist/src/gateway/service.d.ts +5 -0
  152. package/dist/src/gateway/service.js +38 -8
  153. package/dist/src/gateway/side-chat/context-snapshot.d.ts +11 -0
  154. package/dist/src/gateway/side-chat/context-snapshot.js +108 -0
  155. package/dist/src/gateway/side-chat/index.d.ts +5 -0
  156. package/dist/src/gateway/side-chat/index.js +4 -0
  157. package/dist/src/gateway/side-chat/manager.d.ts +45 -0
  158. package/dist/src/gateway/side-chat/manager.js +198 -0
  159. package/dist/src/gateway/side-chat/run-service.d.ts +22 -0
  160. package/dist/src/gateway/side-chat/run-service.js +110 -0
  161. package/dist/src/gateway/side-chat/types.d.ts +61 -0
  162. package/dist/src/gateway/side-chat/types.js +1 -0
  163. package/dist/src/proactive/actions/service.d.ts +2 -0
  164. package/dist/src/proactive/actions/service.js +80 -0
  165. package/dist/src/proactive/execution/insight.js +20 -0
  166. package/dist/src/proactive/execution/repository.js +8 -2
  167. package/dist/src/proactive/execution/types.d.ts +14 -0
  168. package/dist/src/proactive/inbox/repository.js +59 -9
  169. package/dist/src/proactive/inbox/service.d.ts +2 -2
  170. package/dist/src/proactive/inbox/service.js +7 -2
  171. package/dist/src/proactive/inbox/types.d.ts +14 -0
  172. package/dist/src/proactive/inbox/worker.js +2 -0
  173. package/dist/src/proactive/scenarios/prompt-composer.js +2 -2
  174. package/dist/src/routing/session-key-utils.d.ts +0 -1
  175. package/dist/src/routing/session-key-utils.js +1 -6
  176. package/dist/src/routing/session-key.js +2 -2
  177. package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +6 -0
  178. package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +13 -0
  179. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  180. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  181. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  182. package/dist/src/storage/sqlite/schema.js +1 -1
  183. package/dist/src/tasks/home-query-service.d.ts +29 -0
  184. package/dist/src/tasks/home-query-service.js +291 -7
  185. package/dist/src/tasks/index.d.ts +1 -0
  186. package/dist/src/tasks/index.js +5 -4
  187. package/dist/src/tasks/project-monitoring-service.d.ts +9 -0
  188. package/dist/src/tasks/project-monitoring-service.js +41 -3
  189. package/dist/src/tasks/project-operating-view-service.d.ts +2 -2
  190. package/dist/src/tasks/project-operating-view-service.js +47 -21
  191. package/dist/src/tasks/task-application-service.js +99 -6
  192. package/dist/src/tasks/task-change-events.d.ts +13 -0
  193. package/dist/src/tasks/task-change-events.js +29 -0
  194. package/dist/src/tasks/task-read-model-projector.js +2 -1
  195. package/dist/src/tasks/task-repository.d.ts +7 -0
  196. package/dist/src/tasks/task-repository.js +29 -6
  197. package/dist/src/tunnel/enable-lan-pairing.js +15 -26
  198. package/dist/src/tunnel/pair-context.js +1 -1
  199. package/dist/src/tunnel/pair-url.js +1 -1
  200. package/dist/src/tunnel/tunnel-qr.d.ts +0 -7
  201. package/dist/src/tunnel/tunnel-qr.js +2 -19
  202. package/package.json +4 -2
  203. package/dist/gateway/static/root/assets/agents-VoFNMGL3.js +0 -68
  204. package/dist/gateway/static/root/assets/app-management-settings-panel-vmuJ_Z6i.js +0 -1
  205. package/dist/gateway/static/root/assets/appearance-settings-BMlEoe-G.js +0 -1
  206. package/dist/gateway/static/root/assets/apps-page-CsNB6mv_.js +0 -1
  207. package/dist/gateway/static/root/assets/automations-page-CW1YWgiX.js +0 -6
  208. package/dist/gateway/static/root/assets/browser-settings-page-BMTmGMM6.js +0 -8
  209. package/dist/gateway/static/root/assets/browser-workflow-inputs-BsmHy0ks.js +0 -1
  210. package/dist/gateway/static/root/assets/capabilities-settings-panel-C5l85__e.js +0 -7
  211. package/dist/gateway/static/root/assets/capability-presets-settings-panel-9T2KXAs1.js +0 -3
  212. package/dist/gateway/static/root/assets/channels-settings-DquD4BPQ.js +0 -1
  213. package/dist/gateway/static/root/assets/channels-status-swr-DPaJSYX_.js +0 -1
  214. package/dist/gateway/static/root/assets/connectors-api-BC-4ftOM.js +0 -1
  215. package/dist/gateway/static/root/assets/connectors-page-7zUxVHQg.js +0 -2
  216. package/dist/gateway/static/root/assets/cron-expression-BycQlU8Q.js +0 -2
  217. package/dist/gateway/static/root/assets/dependency-picker-BvYqHRz0.js +0 -1
  218. package/dist/gateway/static/root/assets/desktop-pet-settings-DStgPb82.js +0 -1
  219. package/dist/gateway/static/root/assets/directory-picker-path-field-DUUr9sq0.js +0 -1
  220. package/dist/gateway/static/root/assets/extension-settings-page-BcSKEU8s.js +0 -1
  221. package/dist/gateway/static/root/assets/gateway-config-api-C-MmtCc7.js +0 -1
  222. package/dist/gateway/static/root/assets/gateway-settings-CuaRDWbg.js +0 -1
  223. package/dist/gateway/static/root/assets/heartbeat-settings-Dm8TrfGa.js +0 -1
  224. package/dist/gateway/static/root/assets/home-page-BYhDbUvI.js +0 -3
  225. package/dist/gateway/static/root/assets/index-BzPwnXho.js +0 -150
  226. package/dist/gateway/static/root/assets/index-CFFYvilx.css +0 -1
  227. package/dist/gateway/static/root/assets/local-app-workbench-page-CHk4x0kR.js +0 -2
  228. package/dist/gateway/static/root/assets/local-apps-page-DQtsxjGs.js +0 -1
  229. package/dist/gateway/static/root/assets/logs-page-CDqIY72S.js +0 -2
  230. package/dist/gateway/static/root/assets/management-settings-D7itDEHl.js +0 -1
  231. package/dist/gateway/static/root/assets/messages-DQ5X6cXp.js +0 -3
  232. package/dist/gateway/static/root/assets/notes-workbench-epHGeKd5.js +0 -4
  233. package/dist/gateway/static/root/assets/page-tabs-HXweXqYE.js +0 -1
  234. package/dist/gateway/static/root/assets/preview-open-alternatives-Dob6Oe2l.js +0 -1
  235. package/dist/gateway/static/root/assets/project-detail-page-BxOD5-zj.js +0 -1
  236. package/dist/gateway/static/root/assets/projects-page-D-9AhrH5.js +0 -1
  237. package/dist/gateway/static/root/assets/remote-access-hub-CSUNXLKM.js +0 -1
  238. package/dist/gateway/static/root/assets/schema-form-BI4rVt3u.js +0 -1
  239. package/dist/gateway/static/root/assets/sessions-page-BxOUBMca.js +0 -1
  240. package/dist/gateway/static/root/assets/settings-advanced-gate-DAvTIbgw.js +0 -1
  241. package/dist/gateway/static/root/assets/settings-form-section-C7rzhi7x.js +0 -1
  242. package/dist/gateway/static/root/assets/settings-page-layout-CTMmZcwj.js +0 -1
  243. package/dist/gateway/static/root/assets/setup-status-panel-D1v-2Ci-.js +0 -1
  244. package/dist/gateway/static/root/assets/share-preview-page-BeCxg6eb.js +0 -2
  245. package/dist/gateway/static/root/assets/shares-settings-CXL1EldF.js +0 -1
  246. package/dist/gateway/static/root/assets/skill-reload-api-BxwkKgVw.js +0 -1
  247. package/dist/gateway/static/root/assets/skills-page-CyfjEM4D.js +0 -2
  248. package/dist/gateway/static/root/assets/system-settings-panel-CAv0Yk0Y.js +0 -1
  249. package/dist/gateway/static/root/assets/task-detail-page-DGTVJs_N.js +0 -1
  250. package/dist/gateway/static/root/assets/typed-models-lib-DomX3Szl.js +0 -1
  251. package/dist/gateway/static/root/assets/use-autosave-BLc4gfG0.js +0 -1
  252. package/dist/gateway/static/root/assets/user-context-page-C2kQENTK.js +0 -1
  253. package/dist/gateway/static/root/assets/voice-api-key-field-BijmpPjb.js +0 -1
  254. package/dist/gateway/static/root/assets/work-discovery-overlay-D7w2JFFq.js +0 -1
  255. package/dist/gateway/static/root/assets/work-discovery-page-XtoPgPUS.js +0 -1
  256. package/dist/gateway/static/root/assets/workflows-page-D_K2xOWq.js +0 -5
  257. package/dist/src/gateway/ensure-network-cors.d.ts +0 -3
  258. package/dist/src/gateway/ensure-network-cors.js +0 -23
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Cdrf2awF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BzPwnXho.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Bjvw7jtg.js","assets/messages-DQ5X6cXp.js","assets/cn-JdwAhgNB.js","assets/schemas-zIBW3wiV.js","assets/product-delivery-tRr-7IxY.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry--2njcDpC.js","assets/activity-store-BwmdJ5pv.js","assets/theme-store-DtxpMC5S.js","assets/index-CFFYvilx.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-DQ5X6cXp.js";import{l as c,n as l}from"./locale-store-Bjvw7jtg.js";import{i as u}from"./theme-store-DtxpMC5S.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$r as p,$s as m,Ac as h,An as g,At as _,Bc as v,Bn as y,Bo as b,Bs as x,Dc as S,Ds as C,Ec as w,Fo as T,Fu as E,Gn as D,Hn as O,Hs as k,Ia as A,Il as j,Io as M,Jl as N,Jn as P,Js as F,Kc as ee,Kn as I,Lo as te,Mc as ne,Ml as L,Mu as re,Oc as R,Qn as z,Qo as ie,Qr as ae,Rn as B,Ro as V,Sc as H,Tu as U,Ua as oe,Un as W,Us as G,Vn as se,Vo as ce,Vs as le,Wc as ue,Wn as de,Xn as fe,Yn as pe,Zl as me,Zn as he,Zo as K,Zs as q,a as ge,bu as _e,c as ve,cu as ye,dc as be,dl as xe,ec as Se,ei as J,er as Ce,hc as we,hl as Te,ir as Y,jn as Ee,ju as De,k as Oe,kn as ke,ku as Ae,l as je,ni as Me,o as X,ol as Ne,or as Pe,pl as Fe,qn as Ie,ri as Le,rr as Re,s as ze,ti as Be,tl as Ve,tr as He,uc as Ue,ul as We,wc as Ge,ws as Ke,zl as qe,zn as Je,zo as Ye}from"./index-BzPwnXho.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ye,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=h):h=t[4];let g=a?.alt||`Image preview`,_;t[5]===g?_=t[6]:(_=(0,$.jsx)(ce,{className:`sr-only`,children:g}),t[5]=g,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(C,{className:`size-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:v})}),t[8]=i,t[9]=y);let x;t[10]===a?x=t[11]:(x=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=x);let S;t[12]!==y||t[13]!==x||t[14]!==_?(S=(0,$.jsxs)(b,{children:[m,(0,$.jsxs)(te,{className:h,"aria-describedby":void 0,children:[_,y,x]})]}),t[12]=y,t[13]=x,t[14]=_,t[15]=S):S=t[15];let w;t[16]!==S||t[17]!==f?(w=(0,$.jsx)(T,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=w):w=t[18];let E;return t[19]!==n||t[20]!==w?(E=(0,$.jsxs)(Xe.Provider,{value:d,children:[n,w]}),t[19]=n,t[20]=w,t[21]=E):E=t[21],E}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=Pe(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Fe,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(Y,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=Ee(),p=Ee(dt),m=d===n&&f===r,g=m&&s,_=m&&c,v=m?l:0,y=m&&u>0?u:i??0,b=y>0?Math.min(v/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=g?`Pause`:`Play`,k;t[14]!==_||t[15]!==g?(k=_?(0,$.jsx)(ee,{className:`size-3.5 animate-spin`}):g?(0,$.jsx)(h,{className:`size-3.5`}):(0,$.jsx)(Ge,{className:`size-3.5 ml-0.5`}),t[14]=_,t[15]=g,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==y||t[26]!==m||t[27]!==v?(N=ct(m&&v>0?v:y),t[25]=y,t[26]=m,t[27]=v,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:ut,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(83),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=ft(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let m=f,h=!n.snippet?.trim(),[g]=(0,Q.useState)(_t),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==u?(_=at(n.createdAt,g,u),t[3]=n.createdAt,t[4]=g,t[5]=u,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),b=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x=d?`bg-surface-panel hover:bg-surface-panel`:`bg-transparent hover:bg-surface-panel/70`,C;t[11]===x?C=t[12]:(C=o(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,x),t[11]=x,t[12]=C);let T=d?`true`:void 0,E;t[13]===d?E=t[14]:(E=d?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=E);let D;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=D):D=t[20];let O;t[21]===n.title?O=t[22]:(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=O);let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[23]===k?A=t[24]:(A=o(`truncate text-sm leading-5`,k),t[23]=k,t[24]=A);let j;t[25]!==m||t[26]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[25]=m,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==O||t[29]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,j]}),t[28]=O,t[29]=j,t[30]=M):M=t[30];let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Le,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(qe,{className:`size-4`})})}),t[31]=N):N=t[31];let P;t[32]!==n.id||t[33]!==n.pinned||t[34]!==a?(P=()=>a(n.id,!n.pinned),t[32]=n.id,t[33]=n.pinned,t[34]=a,t[35]=P):P=t[35];let F;t[36]===n.pinned?F=t[37]:(F=n.pinned?(0,$.jsx)(w,{className:`size-4`}):(0,$.jsx)(S,{className:`size-4`}),t[36]=n.pinned,t[37]=F);let ee=n.pinned?l.unpin:l.pin,I;t[38]!==P||t[39]!==F||t[40]!==ee?(I=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:P,children:[F,ee]}),t[38]=P,t[39]=F,t[40]=ee,t[41]=I):I=t[41];let te;t[42]!==n.id||t[43]!==s?(te=()=>s(n.id),t[42]=n.id,t[43]=s,t[44]=te):te=t[44];let ne;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(re,{className:`size-4`}),t[45]=ne):ne=t[45];let L;t[46]!==l.archive||t[47]!==te?(L=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:te,children:[ne,l.archive]}),t[46]=l.archive,t[47]=te,t[48]=L):L=t[48];let R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Me,{className:`my-1 h-px bg-edge-subtle`}),t[49]=R):R=t[49];let z;t[50]!==n.id||t[51]!==c?(z=()=>c(n.id),t[50]=n.id,t[51]=c,t[52]=z):z=t[52];let ie;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(le,{className:`size-4`}),t[53]=ie):ie=t[53];let B;t[54]!==l.delete||t[55]!==z?(B=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[ie,l.delete]}),t[54]=l.delete,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==I||t[58]!==L||t[59]!==B?(V=(0,$.jsxs)(Be,{children:[N,(0,$.jsx)(J,{children:(0,$.jsxs)(ae,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[I,L,R,B]})})]}),t[57]=I,t[58]=L,t[59]=B,t[60]=V):V=t[60];let H;t[61]!==D||t[62]!==M||t[63]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,V]}),t[61]=D,t[62]=M,t[63]=V,t[64]=H):H=t[64];let U;t[65]===n.pinned?U=t[66]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(S,{className:`size-3`})}),t[65]=n.pinned,t[66]=U);let oe;t[67]===n.tags?oe=t[68]:(oe=n.tags?.slice(0,2).map(mt),t[67]=n.tags,t[68]=oe);let W;t[69]===v?W=t[70]:(W=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[69]=v,t[70]=W);let G;t[71]!==U||t[72]!==oe||t[73]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,oe,W]}),t[71]=U,t[72]=oe,t[73]=W,t[74]=G):G=t[74];let se;return t[75]!==H||t[76]!==G||t[77]!==y||t[78]!==b||t[79]!==C||t[80]!==T||t[81]!==E?(se=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:C,"aria-current":T,children:[E,H,G]}),t[75]=H,t[76]=G,t[77]=y,t[78]=b,t[79]=C,t[80]=T,t[81]=E,t[82]=se):se=t[82],se}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:c,className:u,variant:f}=e,p=f===void 0?`card`:f,m=l(xt),h=s(m).automations.suggestions,g=s(m).automations,_=a(),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=v):v=t[0];let{data:y}=d(c?`automation-suggestion-coverage`:null,bt,v),b=c?y?.automations.find(e=>ve(e,c)):void 0,x=b?X(b,g):[];if(p===`titleAction`){if(b){let e;t[1]===u?e=t[2]:(e=o(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,u),t[1]=u,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(ye,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===_?r=t[5]:(r=()=>_(`/automations`),t[4]=_,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:h.coveredTitle}),(0,$.jsx)(Ke,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:h.manage})]})}let e;t[6]===u?e=t[7]:(e=o(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,u),t[6]=u,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Ve,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==_||t[13]!==i?(c=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=_,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Ke,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,h.create]})]})}if(b){let e;t[16]===u?e=t[17]:(e=o(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,u),t[16]=u,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===_?r=t[20]:(r=()=>_(`/automations`),t[19]=_,t[20]=r);let i;return t[21]!==h||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Ke,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:h.manage})}),t[21]=h,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:h.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:ze(h.coveredDescription,{name:b.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:g.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:x.map(yt)})]}),i]})}let S;t[24]===u?S=t[25]:(S=o(`rounded-lg bg-surface-panel p-3 shadow-surface`,u),t[24]=u,t[25]=S);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(Ve,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===n?w=t[28]:(w=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=w);let T;t[29]===r?T=t[30]:(T=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=T);let E;t[31]!==w||t[32]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[C,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]})]}),t[31]=w,t[32]=T,t[33]=E):E=t[33];let D;t[34]!==_||t[35]!==i?(D=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=_,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==h.create||t[39]!==D?(k=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Ke,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,h.create]})}),t[38]=h.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==S||t[43]!==E?(A=(0,$.jsxs)(`section`,{className:S,children:[E,k]}),t[41]=k,t[42]=S,t[43]=E,t[44]=A):A=t[44],A}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return je.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(35),{noteId:n}=e,r=l(Dt),i;t[0]===r?i=t[1]:(i=s(r),t[0]=r,t[1]=i);let a=i.notes.discussionCapture,o,c;t[2]===n?(o=t[3],c=t[4]):(o=[`note-discussion-document`,n],c=()=>B(n),t[2]=n,t[3]=o,t[4]=c);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},t[5]=u):u=t[5];let{data:f,mutate:p}=d(o,c,u),m,h;if(t[6]===p?(m=t[7],h=t[8]):(m=()=>{let e=e=>{let t=e.detail;t&&p(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Et);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void p();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},h=[p],t[6]=p,t[7]=m,t[8]=h),(0,Q.useEffect)(m,h),!f)return null;let{discussion:g,transcript:_}=f,y=f.organization?.organization,b=[`stopping`,`sealing`,`organizing`].includes(g.status),S;t[9]!==a.actionItems||t[10]!==a.decisions||t[11]!==a.openQuestions||t[12]!==a.organization||t[13]!==a.risks||t[14]!==y?(S=y?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),a.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:y.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2`,children:[y.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.decisions}),(0,$.jsx)(St,{values:y.decisions})]}):null,y.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.actionItems}),(0,$.jsx)(St,{values:y.actionItems.map(Tt)})]}):null,y.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.risks}),(0,$.jsx)(St,{values:y.risks})]}):null,y.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.openQuestions}),(0,$.jsx)(St,{values:y.openQuestions})]}):null]})]}):null,t[9]=a.actionItems,t[10]=a.decisions,t[11]=a.openQuestions,t[12]=a.organization,t[13]=a.risks,t[14]=y,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),t[16]=C):C=t[16];let w=g.status===`recording`?a.draftTranscript:a.fullTranscript,T;t[17]===w?T=t[18]:(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[C,w]}),t[17]=w,t[18]=T);let E;t[19]===g.status?E=t[20]:(E=g.status===`needs_attention`?(0,$.jsx)(x,{className:`size-3.5 text-danger`}):g.status===`completed`?(0,$.jsx)(ye,{className:`size-3.5 text-success`}):null,t[19]=g.status,t[20]=E);let D=b?a.finalizing:g.status===`needs_attention`?g.failureMessage:null,O;t[21]!==E||t[22]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[E,D]}),t[21]=E,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==T||t[25]!==O?(k=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[T,O]}),t[24]=T,t[25]=O,t[26]=k):k=t[26];let A=_.text||a.waitingTranscript,j;t[27]===A?j=t[28]:(j=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:A}),t[27]=A,t[28]=j);let M;t[29]!==k||t[30]!==j?(M=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[k,j]}),t[29]=k,t[30]=j,t[31]=M):M=t[31];let N;return t[32]!==M||t[33]!==S?(N=(0,$.jsxs)(`div`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle`,children:[S,M]}),t[32]=M,t[33]=S,t[34]=N):N=t[34],N}function Tt(e){return e.title}function Et(e,t){return e.sequence-t.sequence}function Dt(e){return e.language}var Ot={edit:R,ai_edit:Se,sync:we,restore:De};function kt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function At({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>D(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{p(!0),_(null);try{await Ce(e,t),h(null),i()}catch{_(a.restoreFailed)}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=Ot[e.trigger]??R,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:kt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,y,c)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:f,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function jt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:p,openingChat:m,onOpenChat:h,onOpenNewChat:g}=e,_=s(l(Rt)).notes,v=a(),y=r?.aiDeep?.catalysis,b=y?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>W(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await f(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=A):A=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(Ae,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(ue,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:_.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":_.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:_.catalysisSectionDescription}),w?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>z(n),{revalidate:!1}),disabled:E,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:_.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:_.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(Lt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?_.processing:b?_.recatalyze:_.catalyzeAction}),b?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(Nt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(Mt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:_.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackHelpfulAria,children:(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackNotHelpfulAria,children:(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:_.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[M,_.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:m,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:m?_.openingChat:_.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:g,disabled:m,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:_.newThread})]})]}),p.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:p.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||_.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:_.noThreads})]})]})]})}function Mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Pt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Lt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Rt(e){return e.language}var zt=()=>i(()=>import(`./block-editor-Cdrf2awF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])),Bt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([27,1,3,24,5,28])),Vt=(0,Q.lazy)(()=>zt().then(e=>({default:e.BlockEditor}))),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.MarkdownEditor})));function Ut(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Wt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:L},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:N},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:j},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},onFocus:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},className:o(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Gt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Kt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(qt,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)($e,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Kt(e){return e.language}function qt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:f,autoFocus:p=!1,onAutoFocusConsumed:m}){let h=l(e=>e.language),_=s(h).notes,v=s(h).automations.suggestions,y=a(),b=u(e=>e.resolved)===`dark`,{openImage:x}=Ze(),[S,C]=(0,Q.useState)(`wysiwyg`),[w,T]=(0,Q.useState)(null),[D,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[F,ee]=(0,Q.useState)(360),[te,ne]=(0,Q.useState)(!1),[L,re]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(null),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=oe(e=>e.setPageHeader),he=oe(e=>e.clearPageHeader),{data:K,mutate:q}=d(e?[`note-detail`,e]:null,()=>O(e)),{data:_e=[],mutate:ve}=d(e?[`note-threads`,e]:null,()=>I(e),{revalidateOnFocus:!1}),ye=D!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&q()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[q,e]),(0,Q.useEffect)(()=>{B.current=!1,N(``),k(null),T(null),V.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!K||B.current||(N(K.title??``),B.current=!0)},[K]),(0,Q.useEffect)(()=>{if(!p||!K||ye||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),m?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[p,ye,K,e,m]);let xe=K?new Date(K.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,J=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,E,i),children:(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Ce=(0,Q.useCallback)(t=>{N(t),e&&(G.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){j(!0);try{await He(e,{title:t}),await q(),n?.()}catch{}finally{j(!1)}}},600))},[e,q,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,E),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||xe||void 0,children:M||xe}),A?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,A,xe,M]),Y=(0,Q.useCallback)(async(t=!1)=>{z(!0),ae(null);try{let n=await P(e,{forceNew:t});await q(),await ve(),y(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){ae(`${_.chatOpenFailedTitle}: ${e instanceof Error?e.message:_.chatOpenFailedMessage}`)}finally{z(!1)}},[q,ve,y,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),Ee=(0,Q.useCallback)(async()=>{re(!0),ae(null);try{await Je(e),await q()}catch(e){ae(`${_.catalysisFailed}: ${e instanceof Error?e.message:_.chatOpenFailedMessage}`)}finally{re(!1)}},[q,e]),De=(0,Q.useCallback)(()=>{T(w===`breakdown`?null:`breakdown`),!K?.aiDeep?.catalysis?.report&&!L&&Ee()},[w,L,Ee,K?.aiDeep?.catalysis?.report]),je=(0,Q.useCallback)(()=>{let t=D?.markdown??W.current??K?.markdown??``,n=D?.title??M,r=ke([n,t].filter(Boolean).join(`
3
-
4
- `));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:g(r,h)}},[h,_.titlePlaceholder,K?.markdown,e,D,M]),Me=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,E),children:[f?(0,$.jsx)(`button`,{type:`button`,onClick:f,"aria-label":_.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Oe,{input:je,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:De,disabled:L,"aria-label":_.catalysisSectionTitle,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,w===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),L?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Y(!1),disabled:R,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),R?_.openingChat:_.openChatButton]}),(0,$.jsx)(Wt,{mode:S,onModeChange:C,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(w===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,w===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0})})]}),[L,De,Y,S,_.history,_.modeEdit,_.modePreview,_.modeSource,R,w,f,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,je]);(0,Q.useLayoutEffect)(()=>(me({startExtra:J,main:K?we:null,end:K?Me:null}),()=>{c&&he()}),[c,he,Me,we,J,K,me]);let X=(0,Q.useCallback)(t=>{e&&(W.current=t,H.current&&clearTimeout(H.current),H.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){j(!0),ae(null);try{await He(e,{markdown:t}),await q(),n?.()}catch(e){ae(`${_.saveFailed}: ${e instanceof Error?e.message:_.saveFailedHint}`)}finally{j(!1)}}},600))},[e,q,_.saveFailed,_.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{de(e,t.timestamp).then(e=>{e&&k(e)})},[e]),Pe=(0,Q.useCallback)(()=>{T(null),k(null)},[]),Fe=(0,Q.useCallback)(()=>{T(null),k(null),q(),n?.()},[q,n]);if((0,Q.useEffect)(()=>()=>{H.current&&clearTimeout(H.current),U.current&&clearTimeout(U.current);let t=W.current,n=G.current;W.current=null,G.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&He(e,r)},[e]),K===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(K===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:_.back})]});let Ie=ye?D.title??``:M,Le=ye?D.markdown??``:K.markdown??``,ze=new Date(K.createdAt).getTime(),Be=Number.isFinite(ze)&&Date.now()-ze<3600*1e3?(0,$.jsx)(vt,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ie?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ie}):null,(0,$.jsx)(ge,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ge,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:se,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[(0,$.jsx)(wt,{noteId:e}),ye?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ie&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ie}),Le?(0,$.jsx)(Re,{noteId:e,content:Le,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[S===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Ce(e.target.value),onCompositionStart:()=>{V.current=!0},onCompositionEnd:()=>{V.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!V.current&&!t.isComposing&&(e.preventDefault(),(se.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Be]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Vt,{initialContent:K.markdown??``,onChange:X,noteId:e},`wysiwyg-${e}`)})})]}),S===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Ce(e.target.value),placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Be]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Ht,{initialContent:K.markdown??``,onChange:X,isDark:b},`source-${e}`)})})]}),S===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&x(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),K.markdown?(0,$.jsx)(Re,{noteId:e,content:K.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})]})]}),(0,$.jsx)(`div`,{ref:ce,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!te&&`transition-[width] duration-300 ease-in-out`),style:{width:w?F:0},children:(0,$.jsxs)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,w&&ce.current?.style.setProperty(`width`,`${s}px`),le.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}ne(!1),ee(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:o(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,te&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:w===`history`?(0,$.jsx)(At,{noteId:e,activeTimestamp:D?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Fe}):w===`breakdown`?(0,$.jsx)(jt,{noteId:e,note:K??null,catalyzing:L,onCatalyze:Ee,onClose:()=>T(null),noteThreads:_e,openingChat:R,onOpenChat:()=>Y(!1),onOpenNewChat:()=>Y(!0)}):null})]})})]})}var Jt=3e4;function Yt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Xt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1,onDiscussionCapture:l,discussionCaptureLabel:u=`Record discussion`}){let[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),w=(0,Q.useRef)(null),T=(0,Q.useRef)([]),E=(0,Q.useRef)(0),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useCallback)(()=>{D.current&&=(clearInterval(D.current),null),O.current&&=(clearTimeout(O.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),y(0)},[]);(0,Q.useEffect)(()=>()=>k(),[k]);let A=(0,Q.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-E.current)/1e3)),n=e.mimeType||Yt()||`audio/webm`,r=new Blob(T.current,{type:n});if(k(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{x(!1)}return}x(!1)},[k,i]),j=(0,Q.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Yt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],E.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),y(0),D.current=setInterval(()=>{y(Math.round((Date.now()-E.current)/1e3))},250),O.current=setTimeout(()=>{A()},Jt)}catch{k()}},[k,i,h,A,b]),M=(0,Q.useCallback)(()=>{if(h){A();return}j()},[h,j,A]),N=(0,Q.useCallback)(async e=>{let t=d.trim();if(!(!t||p)){m(!0),f(``);try{await n(t,e)}catch{f(t)}finally{m(!1),S.current?.focus()}}},[d,p,n]),P=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),N({navigate:!1}))},[N]),F=p||b;return(0,$.jsxs)(`div`,{className:o(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:F||s||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(xe,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:M,disabled:F||c||p,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,$.jsx)(q,{className:`size-4 fill-current`}):(0,$.jsx)(v,{className:`size-4`})}),l&&!h?(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:F,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":u,title:u,children:(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0})}):null,h?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,$.jsx)(`textarea`,{ref:S,value:d,onChange:e=>f(e.target.value),onKeyDown:P,placeholder:e,rows:1,disabled:F,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!d.trim()||F||h,onClick:e=>void N({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,d.trim()&&!F&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(Ue,{className:`size-4`})})]})}var Zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Qt=240,$t=320,en=520,tn=560;function nn(e){if(globalThis.localStorage===void 0)return $t;try{let t=globalThis.localStorage.getItem(e);if(!t)return $t;let n=Number(t);return Number.isFinite(n)?n:$t}catch{return $t}}function rn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var an={thought:F,todo:m,voice:v,media:xe,bookmark:_e,mixed:F,task:m};function on(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function sn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function cn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ln({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:u,listTitle:f,listDescription:p,emptyText:h,emptyDescription:g,listWidthStorageKey:x=`xopc.notes.listWidth`}){let w=s(l(e=>e.language)).notes,D=!!c(e=>e.token),[O,k]=(0,Q.useReducer)(_,Zt),[j,N]=(0,Q.useState)(!1),[P,ee]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>nn(x)),[ae,B]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(!1),[G,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)(null),[q,ge]=(0,Q.useState)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(null),[Se]=(0,Q.useState)(()=>Date.now()),J=a(),Ce=(0,Q.useCallback)(e=>{let t=ve.current?.clientWidth??window.innerWidth,n=Math.max(Qt,t-tn);return Math.max(Qt,Math.min(Math.min(en,n),e))},[]),we=(0,Q.useCallback)(e=>{let t=Ce(e);z(t),rn(x,t)},[Ce,x]);(0,Q.useLayoutEffect)(()=>{z(e=>Ce(e))},[Ce]);let{data:Te,mutate:Y,isLoading:Ee}=d((0,Q.useMemo)(()=>D?[`notes-list`,u,O.statusFilter,O.kindFilter,O.pinnedOnly]:null,[D,u,O.statusFilter,O.kindFilter,O.pinnedOnly]),()=>Ie({status:O.statusFilter===`all`?void 0:O.statusFilter,kind:O.kindFilter===`all`?void 0:O.kindFilter,projectId:u,pinned:O.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),De=Ee&&!Te,Oe=Te?.items??[],ke=Te?.total??0,Ae=P.trim(),{data:je,isLoading:Me}=d(D&&j&&Ae?[`notes-search`,u,Ae]:null,()=>Ie({search:Ae,projectId:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=je?.items??[],Pe=e?Oe.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{L(0)},[Ae]),(0,Q.useEffect)(()=>{I>=X.length&&L(Math.max(0,X.length-1))},[I,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Fe=oe(e=>e.setPageHeader),Le=oe(e=>e.clearPageHeader),Re=ke>0?w.noteCount.replace(`{{count}}`,String(ke)):null,ze=w.searchDialogTitle,Be=w.searchClose,Ve=w.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:o(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,E),"aria-label":ze,children:[(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ze})]}),[ze]);(0,Q.useLayoutEffect)(()=>{if(n)return D?(Fe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,E),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:f??w.title}),Re?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Re}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,D,Ue,f,n,w.title,Re,e,Fe]);let Ge=(0,Q.useMemo)(()=>({justNow:w.justNow,minutesAgo:w.minutesAgo,today:w.today,yesterday:w.yesterday,daysAgo:w.daysAgo}),[w.justNow,w.minutesAgo,w.today,w.yesterday,w.daysAgo]),Ke=(0,Q.useMemo)(()=>[{id:`recent`,label:w.viewRecent,description:w.viewRecentDescription,icon:me,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:w.filterInbox,description:w.viewInboxDescription,icon:We,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:w.pinned,description:w.viewPinnedDescription,icon:S,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:w.viewTasks,description:w.viewTasksDescription,icon:m,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:w.kindVoice,description:w.viewVoiceDescription,icon:v,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:w.kindMedia,description:w.viewMediaDescription,icon:xe,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:w.kindBookmark,description:w.viewBookmarksDescription,icon:_e,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:w.filterProcessed,description:w.viewProcessedDescription,icon:Ne,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:w.filterArchived,description:w.viewArchiveDescription,icon:re,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[w.filterArchived,w.filterInbox,w.filterProcessed,w.kindBookmark,w.kindMedia,w.kindVoice,w.pinned,w.viewArchiveDescription,w.viewBookmarksDescription,w.viewInboxDescription,w.viewMediaDescription,w.viewPinnedDescription,w.viewProcessedDescription,w.viewRecent,w.viewRecentDescription,w.viewTasks,w.viewTasksDescription,w.viewVoiceDescription]),qe=Ke.find(e=>sn(O,e))??Ke[0],Je=f??qe.label,Z=p??qe.description,Xe=(0,Q.useCallback)(async(e,n)=>{let r=u?await y({markdown:e,kind:`thought`,projectId:u,channel:`web`}):await pe(e,`web`);await Y(),n?.navigate!==!1&&J(cn(t,r.id))},[t,Y,J,u]),Ze=(0,Q.useCallback)(async()=>{if(!G){le(!0),de(null);try{let e=await y({markdown:``,kind:`thought`,projectId:u,channel:`web`});k({type:`patch`,patch:Zt}),await Y(),ge(e.id),J(cn(t,e.id))}catch(e){de(`${w.createBlankFailed}: ${e instanceof Error?e.message:w.createBlankFailedHint}`)}finally{le(!1)}}},[t,G,Y,w.createBlankFailed,w.createBlankFailedHint,J,u]),Qe=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{de(null),await fe(t,`web`),await Y()}catch(e){de(`${w.imageUploadFailed}: ${e instanceof Error?e.message:w.imageUploadFailedHint}`)}},e.click()},[Y,w.imageUploadFailed,w.imageUploadFailedHint]),$e=(0,Q.useCallback)(async(e,t)=>{try{de(null),await he(e,t,`web`),await Y()}catch(e){de(`${w.voiceUploadFailed}: ${e instanceof Error?e.message:w.voiceUploadFailedHint}`)}},[Y,w.voiceUploadFailed,w.voiceUploadFailedHint]),et=(0,Q.useCallback)(async(e,t)=>{await He(e,{pinned:t}),await Y()},[Y]),tt=(0,Q.useCallback)(async e=>{await He(e,{status:`archived`}),await Y()},[Y]),nt=(0,Q.useCallback)(async e=>{await se(e),await Y()},[Y]),rt=(0,Q.useCallback)(e=>{J(cn(t,e))},[t,J]),it=(0,Q.useCallback)(e=>{J(cn(t,e)),N(!1)},[t,J]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),L(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),L(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[I]??X[0];t&&it(t.id)}}},[I,it,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ye.current;t.setPointerCapture(e.pointerId),B(!0);let r=ve.current?.clientWidth??window.innerWidth,i=Math.max(Qt,r-tn),a=Math.min(en,i),o=e=>Math.max(Qt,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}B(!1),ve.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(f),rn(x,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[x,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ze())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ze]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),we(R-16)):e.key===`ArrowRight`?(e.preventDefault(),we(R+16)):e.key===`Home`?(e.preventDefault(),we(Qt)):e.key===`End`&&(e.preventDefault(),we(en))},[we,R]);return D?(0,$.jsxs)(`div`,{ref:ve,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:ye,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!ae&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ue?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:ue}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(K,{value:qe.id,onChange:e=>{let t=Ke.find(t=>t.id===e.target.value);t&&k({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":w.libraryTitle,children:Ke.map(e=>(0,$.jsx)(ie,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Je}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Re??Z})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":w.collapseNotesList,title:w.collapseNotesList,children:(0,$.jsx)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ze,disabled:G,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":w.createBlankNote,title:w.createBlankShortcut,children:(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":w.searchDialogTitle,children:(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:De?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Oe.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(F,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Pe?w.noteOutsideCurrentView:h??w.noNotes}),e&&!Pe?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:g??w.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Pe?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:w.noteOutsideCurrentView}):null,Oe.map((t,n)=>{let r=n>0?st(Oe[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,Se,Ge)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:rt,onPin:et,onArchive:tt,onDelete:nt,timeLabels:Ge,labels:{pin:w.pin,unpin:w.unpin,archive:w.archive,delete:w.delete,imageNote:w.imageNote,noText:w.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Xt,{placeholder:w.quickCapturePlaceholder,sendLabel:w.send,onCapture:Xe,onImagePick:i?Qe:void 0,onVoiceCapture:i?$e:void 0,recordingLabel:w.recording,discussionCaptureLabel:w.discussionCapture.title,onDiscussionCapture:()=>A(u)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":w.resizeNotesList,"aria-valuemin":Qt,"aria-valuemax":en,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>we($t),onKeyDown:ut,title:w.resizeNotesList,className:o(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:o(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,ae&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":w.expandNotesList,title:w.expandNotesList,children:(0,$.jsx)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Gt,{noteId:e,onBack:()=>J(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>N(!0),autoFocus:e===q,onAutoFocusConsumed:()=>ge(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(F,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:w.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:w.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ze,disabled:G,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0}),G?w.creatingBlankNote:w.createBlankNote]})]})})]}),(0,$.jsx)(T,{open:j,onOpenChange:N,children:(0,$.jsxs)(b,{children:[(0,$.jsx)(Ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(te,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(ce,{className:`text-sm font-semibold text-fg`,children:ze}),(0,$.jsx)(V,{className:`sr-only`,children:w.searchPlaceholder}),(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Be,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:P,onChange:e=>ee(e.target.value),onKeyDown:ct,placeholder:w.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),P?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ve,children:(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Ae?Me&&!je?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(F,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:w.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:w.searchResultsCount.replace(`{{count}}`,String(je?.total??X.length))}),X.map((e,t)=>{let n=an[e.kind]||F,r=on(e,{imageNote:w.imageNote,noText:w.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),onMouseEnter:()=>L(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===I?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:at(e.updatedAt,Se,Ge)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(be,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:w.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(F,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:w.needToken})]})}export{Ze as n,ln as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{vs as a}from"./index-BzPwnXho.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Ho as r,Ll as i,Vl as a,vs as o}from"./index-BzPwnXho.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=r()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=r()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=n(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=n(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{n as f,r as p,s as m}from"./locale-store-Bjvw7jtg.js";import{$c as h,Aa as g,Ac as _,Ai as v,Bi as y,Bo as b,Ca as x,Dc as S,Di as C,Ds as w,Ec as T,Ei as E,Es as D,Et as O,Fi as k,Fo as A,Fs as j,Hc as M,Ii as N,Io as ee,Kl as P,Li as F,Ll as te,Lo as I,Ls as L,Mu as R,Na as z,Ni as B,Nn as ne,On as re,Pi as ie,Pt as V,Qo as H,Ri as ae,Ro as U,Sa as oe,Sc as se,Sl as W,Tl as G,Ua as ce,Vl as K,Vo as le,Vs as ue,Wl as de,Xl as fe,Zo as pe,_a as me,_r as he,ai as ge,al as _e,ba as ve,ca as ye,cs as be,cu as xe,da as Se,dc as Ce,du as we,ec as Te,fa as Ee,fc as De,fu as Oe,ga as ke,gt as Ae,ha as je,hl as Me,ht as Ne,il as Pe,jc as Fe,ji as Ie,jl as Le,kl as Re,ku as ze,l as Be,la as Ve,ls as He,ma as Ue,mc as We,ml as Ge,mu as Ke,os as qe,pa as Je,pu as Ye,qs as Xe,rt as Ze,sc as Qe,ss as $e,su as et,ua as tt,us as nt,uu as rt,va as it,wa as at,wc as ot,wl as st,wr as ct,ws as q,xa as lt,ya as ut,yt as dt,zi as ft,zo as pt}from"./index-BzPwnXho.js";import{t as mt}from"./notes-workbench-epHGeKd5.js";import{n as ht,t as gt}from"./use-autosave-BLc4gfG0.js";import{t as _t}from"./page-tabs-HXweXqYE.js";import{t as vt}from"./directory-picker-path-field-DUUr9sq0.js";import{i as yt,p as bt,s as xt}from"./skills-page.utils-CnbJncdL.js";import{t as St}from"./dependency-picker-BvYqHRz0.js";import{c as Ct,l as wt,n as Tt,o as Et,r as Dt,t as Ot}from"./style-TIDOdKy0.js";var J=e(t(),1),kt=n();function At(e){return m(p(`/api/projects/${encodeURIComponent(e)}/skills`))}function jt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Mt(e,t){let n=new FormData;return n.set(`file`,t),m(p(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Nt(e,t,n={}){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Pt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Ft(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function It({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(1),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(!1),[k,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(``),P=(0,J.useRef)(null),F=(0,J.useCallback)(async()=>{s(!0),m(``);try{let t=await At(e);r(t.items),a(t.skillsRoot)}catch(e){m(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{F()},[F]),(0,J.useEffect)(()=>{if(h!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{O(!0),j(``),bt({q:y,page:S,pageSize:8,sort:`downloads`,signal:e.signal}).then(E).catch(t=>{e.signal.aborted||j(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||O(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[h,S,y]);async function B(e,t){u(!0),f(t??null),m(``);try{await e(),g(null),N(``),await F()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1),f(null)}}async function ne(t){m(``);try{v((await jt(e,t)).skill)}catch(e){m(e instanceof Error?e.message:String(e))}}async function re(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await Ft(e,n.id),await F()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(He,{children:[(0,Y.jsx)(nt,{asChild:!0,children:(0,Y.jsxs)(q,{type:`button`,children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(be,{children:(0,Y.jsxs)($e,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Lt,{icon:Xe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>g(`marketplace`)}),(0,Y.jsx)(Lt,{icon:W,title:t.source,hint:t.sourceHint,onClick:()=>g(`source`)}),(0,Y.jsx)(Lt,{icon:L,title:t.upload,hint:t.uploadHint,onClick:()=>P.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:P,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&B(()=>Mt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),p?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:p}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(z,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(R,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ne(e.id),children:[(0,Y.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void re(e),children:[(0,Y.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(A,{open:h!==null,onOpenChange:e=>{e||g(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,h===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:h===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:h===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:y,onChange:e=>{x(e.target.value),C(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),k?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:k}):null,D&&!T?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(z,{className:`h-32 rounded-lg`},e))}):T?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:T.items.map(r=>{let i=r.providerId??T.provider,a=yt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=d===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(xt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(q,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void B(()=>Nt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):D?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),T&&T.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(T.meta.page)).replace(`{{total}}`,String(T.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:D||S<=1,onClick:()=>C(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(Oe,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:D||S>=T.meta.totalPages,onClick:()=>C(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(we,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:M,onChange:e=>N(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(q,{type:`button`,disabled:c||!M.trim(),onClick:()=>void B(()=>Pt(e,M.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(A,{open:!!_,onOpenChange:e=>{e||v(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:_?.name}),(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:_?.bodyMarkdown})]})]})})]})}function Lt(e){let t=(0,kt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(qe,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Rt=[`ready`,`moving`,`waiting`,`needs_user`,`done`];function zt(e){return{ready:e.filter(e=>e.lane===`ready`),moving:e.filter(e=>e.lane===`moving`),waiting:e.filter(e=>e.lane===`waiting`),needs_user:e.filter(e=>e.lane===`needs_user`),done:e.filter(e=>e.lane===`done`)}}function Bt(e,t){if(t===`ready`&&e.allowedCommands.includes(`add_wait`))return`pause`;if(t===`moving`&&e.allowedCommands.includes(`start`))return`run`;if(t===`moving`&&e.allowedCommands.includes(`resolve_wait`))return`resume`;if(t===`done`&&e.allowedCommands.includes(`request_review`))return`verify`}function Vt(e){if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`request_review`))return`verify`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Ht(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Ut(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ht(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Wt(e,t){let{incoming:n}=Ht(t),r=new Set(e.filter(e=>e.lane===`waiting`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Gt(e,t){let{incoming:n,outgoing:r}=Ht(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var Kt={ready:`border-edge`,moving:`border-accent ring-2 ring-accent/15`,waiting:`border-violet-400/70`,needs_user:`border-amber-400/80`,done:`border-emerald-400/60`};function qt(e){let t=(0,kt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.lane===`waiting`,o=Kt[i.lane],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,u;t[0]!==o||t[1]!==s||t[2]!==c?(u=l(`w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(Dt,{type:`target`,position:wt.Left,className:`!invisible`}),t[4]=d):d=t[4];let f;t[5]===i.title?f=t[6]:(f=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=f);let p;t[7]===a?p=t[8]:(p=a?(0,Y.jsx)(Ge,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.laneLabel?h=t[13]:(h=(0,Y.jsx)(`span`,{children:n.laneLabel}),t[12]=n.laneLabel,t[13]=h);let g;t[14]!==a||t[15]!==i.blockedBy?(g=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=g):g=t[16];let _;t[17]!==g||t[18]!==h?(_=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[h,g]}),t[17]=g,t[18]=h,t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(Dt,{type:`source`,position:wt.Right,className:`!invisible`}),t[20]=v):v=t[20];let y;return t[21]!==_||t[22]!==u||t[23]!==m?(y=(0,Y.jsxs)(`div`,{className:u,children:[d,m,_,v]}),t[21]=_,t[22]=u,t[23]=m,t[24]=y):y=t[24],y}var Jt={taskNode:qt};function Yt(e){let t=(0,kt.c)(74),{tasks:n,dependencyEdges:r,returnTo:i,copy:a}=e,[o,c]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),m=(0,J.useRef)(null),h;t[0]!==r||t[1]!==n?(h=Wt(n,r),t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==g||t[4]!==u||t[5]!==o||t[6]!==n?(_=u?n.filter(e=>g.has(e.id)):o?n:n.filter(tn),t[3]=g,t[4]=u,t[5]=o,t[6]=n,t[7]=_):_=t[7];let v=_,y;t[8]===v?y=t[9]:(y=new Set(v.map(en)),t[8]=v,t[9]=y);let b=y,x;if(t[10]!==r||t[11]!==b){let e;t[13]===b?e=t[14]:(e=e=>b.has(e.dependencyTaskId)&&b.has(e.dependentTaskId),t[13]=b,t[14]=e),x=r.filter(e),t[10]=r,t[11]=b,t[12]=x}else x=t[12];let S=x,C;t[15]!==S||t[16]!==v?(C=Ut(v,S),t[15]=S,t[16]=v,t[17]=C):C=t[17];let w=C,T;t[18]!==f||t[19]!==S?(T=f?Gt(f,S):void 0,t[18]=f,t[19]=S,t[20]=T):T=t[20];let E=T,D;t[21]===f?D=t[22]:(D=e=>e.id===f,t[21]=f,t[22]=D);let O=v.find(D),k;t[23]===v?k=t[24]:(k=new Map(v.map($t)),t[23]=v,t[24]=k);let A=k,j;if(t[25]!==a.lanes||t[26]!==w||t[27]!==E||t[28]!==v){let e;t[30]!==a.lanes||t[31]!==w||t[32]!==E?(e=e=>({id:e.id,type:`taskNode`,position:w.get(e.id)??{x:0,y:0},data:{task:e,laneLabel:a.lanes[e.lane],dimmed:!!(E&&!E.has(e.id))}}),t[30]=a.lanes,t[31]=w,t[32]=E,t[33]=e):e=t[33],j=v.map(e),t[25]=a.lanes,t[26]=w,t[27]=E,t[28]=v,t[29]=j}else j=t[29];let M=j,N;if(t[34]!==E||t[35]!==A||t[36]!==S){let e;t[38]!==E||t[39]!==A?(e=e=>{let t=A.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(E&&(!E.has(e.dependencyTaskId)||!E.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Ct.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=E,t[39]=A,t[40]=e):e=t[40],N=S.map(e),t[34]=E,t[35]=A,t[36]=S,t[37]=N}else N=t[37];let ee=N,P,F;t[41]!==f||t[42]!==b?(P=()=>{f&&!b.has(f)&&p(void 0)},F=[f,b],t[41]=f,t[42]=b,t[43]=P,t[44]=F):(P=t[43],F=t[44]),(0,J.useEffect)(P,F);let I;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=window.requestAnimationFrame(()=>{m.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[45]=I):I=t[45];let L;t[46]!==u||t[47]!==o||t[48]!==v.length?(L=[u,o,v.length],t[46]=u,t[47]=o,t[48]=v.length,t[49]=L):L=t[49],(0,J.useEffect)(I,L);let R;t[50]===f?R=t[51]:(R=()=>{f&&m.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[50]=f,t[51]=R);let z=R,B;t[52]===a.hint?B=t[53]:(B=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.hint}),t[52]=a.hint,t[53]=B);let ne=u?`secondary`:`ghost`,ie;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>d(Qt),t[54]=ie):ie=t[54];let V=u?a.allTasks:a.blockedChains,H;t[55]!==u||t[56]!==ne||t[57]!==V?(H=(0,Y.jsx)(q,{type:`button`,variant:ne,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:ie,children:V}),t[55]=u,t[56]=ne,t[57]=V,t[58]=H):H=t[58];let ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>c(Zt),t[59]=ae):ae=t[59];let U=o?a.hideCompleted:a.showCompleted,oe;t[60]!==u||t[61]!==o||t[62]!==U?(oe=(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":o,onClick:ae,disabled:u,children:U}),t[60]=u,t[61]=o,t[62]=U,t[63]=oe):oe=t[63];let se=O?(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:z,children:[(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,W;t[64]!==H||t[65]!==oe||t[66]!==se?(W=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[H,oe,se]}),t[64]=H,t[65]=oe,t[66]=se,t[67]=W):W=t[67];let G;t[68]!==B||t[69]!==W?(G=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[B,W]}),t[68]=B,t[69]=W,t[70]=G):G=t[70];let ce=v.length>0?(0,Y.jsxs)(`div`,{className:l(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,O&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Et,{nodes:M,edges:ee,nodeTypes:Jt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onPaneClick:()=>p(void 0),onInit:e=>{m.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ot,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Tt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),O?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.lanes[O.lane]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:O.title}),O.lane===`waiting`&&O.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(O.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:O.blockedBy.map(Xt)})]}):null,(0,Y.jsxs)(s,{to:re(i,O.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),K;return t[71]!==G||t[72]!==ce?(K=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[G,ce]}),t[71]=G,t[72]=ce,t[73]=K):K=t[73],K}function Xt(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function Zt(e){return!e}function Qt(e){return!e}function $t(e){return[e.id,e]}function en(e){return e.id}function tn(e){return e.phase!==`closed`}var nn={ready:et,moving:h,waiting:Ge,needs_user:j,done:xe},rn={ready:`text-fg-muted`,moving:`text-accent-fg`,waiting:`text-violet-700 dark:text-violet-300`,needs_user:`text-amber-700 dark:text-amber-300`,done:`text-emerald-700 dark:text-emerald-300`};function an(e){let t=(0,kt.c)(57),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c}=e,u;t[0]===n?u=t[1]:(u=Vt(n),t[0]=n,t[1]=u);let d=u,f=!!d,p;t[2]!==c||t[3]!==n.id?(p=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=p):p=t[4];let m;t[5]===c?m=t[6]:(m=()=>c(``),t[5]=c,t[6]=m);let h;t[7]!==r||t[8]!==n.id?(h=re(r,n.id),t[7]=r,t[8]=n.id,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,Y.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==i||t[13]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[12]=i,t[13]=n.priority,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.attention[0]?y=t[19]:(y=n.attention[0]?(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[18]=n.attention[0],t[19]=y);let b;t[20]!==i||t[21]!==n.blockedBy||t[22]!==n.lane?(b=n.lane===`waiting`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(Ge,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(X).join(`、`)})]}):null,t[20]=i,t[21]=n.blockedBy,t[22]=n.lane,t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==n.latestVerification?(x=n.latestVerification?(0,Y.jsx)(`span`,{className:l(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[24]=i,t[25]=n.latestVerification,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.acceptanceCriteriaCount?(S=n.acceptanceCriteriaCount>0?(0,Y.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[27]=i,t[28]=n.acceptanceCriteriaCount,t[29]=S):S=t[29];let C;t[30]===n.dueAt?C=t[31]:(C=n.dueAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(Ke,{className:`size-3`,"aria-hidden":!0}),Ze(new Date(n.dueAt))]}):null,t[30]=n.dueAt,t[31]=C);let w;t[32]===n.nextCheckAt?w=t[33]:(w=n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,Y.jsx)(Ke,{className:`size-3`,"aria-hidden":!0}),Ze(new Date(n.nextCheckAt))]}):null,t[32]=n.nextCheckAt,t[33]=w);let T;t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[x,S,C,w]}),t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;t[39]!==b||t[40]!==T||t[41]!==h||t[42]!==v||t[43]!==y?(E=(0,Y.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[v,y,b,T]}),t[39]=b,t[40]=T,t[41]=h,t[42]=v,t[43]=y,t[44]=E):E=t[44];let D;t[45]!==a||t[46]!==i||t[47]!==o||t[48]!==d||t[49]!==n?(D=d?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`verify`&&n.allowedCommands.includes(`request_review`)?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`verify`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.verify}):null]}):null,t[45]=a,t[46]=i,t[47]=o,t[48]=d,t[49]=n,t[50]=D):D=t[50];let O;return t[51]!==E||t[52]!==D||t[53]!==f||t[54]!==p||t[55]!==m?(O=(0,Y.jsxs)(`article`,{draggable:f,onDragStart:p,onDragEnd:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[E,D]}),t[51]=E,t[52]=D,t[53]=f,t[54]=p,t[55]=m,t[56]=O):O=t[56],O}function X(e){return e.title}function on({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onCreate:a,actionBusyId:o,ref:s}){let[c,u]=(0,J.useState)(null),[p,m]=(0,J.useState)(`board`),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(()=>crypto.randomUUID()),[y,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`normal`),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)([]),[k,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),P=O({chat:d(f(e=>e.language)).chat}),F=zt(e),te=e.filter(e=>e.phase!==`closed`),L=(e,t)=>{i(e,t)},R=async e=>{e.preventDefault();let t=y.trim();if(!(!t||k)){j(!0),N(null);try{let e=w?new Date(`${w}T23:59:59.999`).getTime():void 0;await a({requestId:_,objective:t,priority:S,dependsOnTaskIds:E,attachments:P.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),x(``),C(`normal`),T(``),D([]),P.clearAttachments(),v(crypto.randomUUID()),g(!1)}catch(e){N(e instanceof Error?e.message:r.createFailed)}finally{j(!1)}}},z=()=>{v(crypto.randomUUID()),x(``),C(`normal`),T(``),D([]),P.clearAttachments(),N(null),g(!0)};return(0,J.useImperativeHandle)(s,()=>({openCreate:z})),(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":p===`board`,onClick:()=>m(`board`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":p===`graph`,onClick:()=>m(`graph`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})]}),p===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rt.map(t=>{let i=nn[t],a=F[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===c);r&&Bt(r,t)&&n.preventDefault()},onDrop:n=>{n.preventDefault();let r=e.find(e=>e.id===c),i=r?Bt(r,t):void 0;u(null),r&&i&&L(r,i)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,Y.jsxs)(`div`,{className:l(`flex items-center gap-2`,rn[t]),children:[(0,Y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.lanes[t]})]}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,Y.jsx)(an,{task:e,returnTo:n,copy:r,busy:o===e.id,onAction:L,onDragStart:u},e.id)):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:r.empty})})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Yt,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,lanes:r.lanes}})}),(0,Y.jsx)(A,{open:h,onOpenChange:e=>{k||g(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void R(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Y.jsxs)(`div`,{className:l(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,P.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),k||P.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||P.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),P.setIsDragging(!1),k||P.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:y,onChange:e=>{x(e.target.value),N(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:k}),(0,Y.jsx)(V,{attachments:P.attachments,topPadded:!1,onRemove:e=>{k||P.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:k,onClick:()=>P.fileInputRef.current?.click(),children:[(0,Y.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:P.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{P.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Y.jsx)(pe,{value:S,onChange:e=>C(e.target.value),disabled:k,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(H,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Y.jsx)(`input`,{type:`date`,className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:e=>T(e.target.value),disabled:k})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Y.jsx)(St,{candidates:te,selectedIds:E,disabled:k,onChange:D,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),M?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:M}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:k,children:r.cancel})}),(0,Y.jsx)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:k||!y.trim(),children:k?r.creating:r.create})]})]})]})]})})]})}var sn=new Set([{id:`overview`,icon:_e},{id:`tasks`,icon:P},{id:`automations`,icon:D},{id:`files`,icon:st},{id:`notes`,icon:Le},{id:`skills`,icon:Te},{id:`sessions`,icon:M},{id:`progress`,icon:Me},{id:`settings`,icon:Qe}].map(e=>e.id)),cn=`xopc.projectFiles.panelWidthPx`,ln=320,un=220,dn=560;function fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function pn(e){return Math.min(dn,Math.max(un,Math.round(e)))}function mn(){try{let e=window.localStorage.getItem(cn);if(e==null)return ln;let t=Number.parseInt(e,10);return Number.isFinite(t)?pn(t):ln}catch{return ln}}function hn(e){try{window.localStorage.setItem(cn,String(pn(e)))}catch{}}function gn(e){return!!(e&&sn.has(e))}function _n(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ze(n)}function yn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function bn(e){let t=(0,kt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function xn(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Sn(e){let t=(0,kt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Cn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function wn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Tn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function En(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Dn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function On(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function kn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function An(e){let t=e.sourceChannel?.trim();if(t)return jn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return jn(r||``)}function jn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Mn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Nn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Pn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Pn(e.children,t,n)}:e)}function Fn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,J.useState)(!1),[u,d]=(0,J.useState)([e]),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[x,S]=(0,J.useState)(`new`),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(!1),[k,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),P=(0,J.useCallback)(async()=>{h(!0),_(null);try{let t=await it({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,J.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{a&&P()},[P,a]);let F=(0,J.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Cn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>wn(t)-wn(e))},[e.id,u,f]),te=e=>t.statuses[e.status]??e.status,L=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,R=e=>{S(e),w(``),E(``),j(null),y(!0),s(!1)},z=(0,J.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?Tn(t):``);if(n){O(!0),j(null),N(null);try{let r=await Ve({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),E(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=En(e);t?(N(t),y(!1)):j(e instanceof Error?e.message:String(e))}finally{O(!1)}}},[x,C,i,T]),B=(0,J.useCallback)(e=>{e.preventDefault(),z()},[z]),ne=(0,J.useCallback)(()=>{z({createWorkspaceRoot:!0})},[z]),re=(0,J.useCallback)(()=>{N(null),y(!0)},[]),ie=e=>{E(e),x===`directory`&&!C.trim()&&w(Tn(e))},V=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:L(e)})]}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:te(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(He,{open:a,onOpenChange:s,children:[(0,Y.jsx)(nt,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:te(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:L(e)})]}),(0,Y.jsx)(Ye,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(be,{children:(0,Y.jsxs)($e,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),V(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&F.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&F.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,F.map(e=>V(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>R(`new`),children:[(0,Y.jsx)(se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>R(`directory`),children:[(0,Y.jsx)(st,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(Qe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(A,{open:v,onOpenChange:e=>!D&&y(e),children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:B,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[k?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(vt,{value:T,onChange:ie,disabled:D,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:D,children:n.cancel})}),(0,Y.jsxs)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:D||!(C.trim()||x===`directory`&&Tn(T)),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(A,{open:!!M,onOpenChange:e=>{e||N(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?_n(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:D,children:n.workspaceMissingBack}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:D,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function In(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),p=f(e=>e.language),m=d(p),h=m.chat.workingDirectory,O=m.projectDetailPage,j=m.projectsPage,te=ce(e=>e.setPageHeader),L=ce(e=>e.clearPageHeader),[V,W]=(0,J.useState)(null),[K,be]=(0,J.useState)(null),[xe,we]=(0,J.useState)([]),[Oe,Pe]=(0,J.useState)(``),[Fe,Re]=(0,J.useState)([]),[Ve,He]=(0,J.useState)(!1),[Ge,Ke]=(0,J.useState)(null),[qe,Ye]=(0,J.useState)([]),[Xe,Ze]=(0,J.useState)(0),[$e,et]=(0,J.useState)(!1),[nt,it]=(0,J.useState)(!1),[yt,bt]=(0,J.useState)(!1),[xt,St]=(0,J.useState)([]),Ct=(0,J.useRef)(new Set),[wt,Tt]=(0,J.useState)(null),[Et,Dt]=(0,J.useState)(mn),[Ot,kt]=(0,J.useState)(!1),[At,jt]=(0,J.useState)(!1),[Mt,Nt]=(0,J.useState)(``),[Pt,Ft]=(0,J.useState)([]),[Lt,Rt]=(0,J.useState)(!1),[zt,Bt]=(0,J.useState)(null),[Vt,Ht]=(0,J.useState)(!1),[Ut,Wt]=(0,J.useState)(null),[Gt,Kt]=(0,J.useState)([]),[qt,Jt]=(0,J.useState)(``),[Yt,Xt]=(0,J.useState)(!0),[Zt,Qt]=(0,J.useState)(!1),[$t,en]=(0,J.useState)(!1),[tn,nn]=(0,J.useState)(null),[rn,an]=(0,J.useState)(!1),[X,sn]=(0,J.useState)(`fixed`),[cn,ln]=(0,J.useState)(``),[un,dn]=(0,J.useState)(null),[Cn,wn]=(0,J.useState)(!1),[Tn,jn]=(0,J.useState)(!1),[In,Ln]=(0,J.useState)(!1),[Rn,zn]=(0,J.useState)(null),Bn=(0,J.useRef)(null),Vn=(0,J.useRef)(!1),[Hn,Z]=(0,J.useState)(null),[Un,Wn]=(0,J.useState)({title:``,reason:``}),[Q,Gn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Kn=(0,J.useRef)(Q),qn=`overview`,$=n?`notes`:gn(t)?t:qn,Jn=(0,J.useMemo)(()=>E(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Yn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Jn===`/projects`?n:C(n,Jn)},[Jn,e]),Xn=(0,J.useCallback)(t=>{e&&r(Yn(t))},[r,e,Yn]),Zn=(0,J.useCallback)(()=>{if($===`tasks`&&Bn.current){Bn.current.openCreate();return}Vn.current=!0,Xn(`tasks`)},[Xn,$]);(0,J.useEffect)(()=>{$!==`tasks`||!Vn.current||(Vn.current=!1,Bn.current?.openCreate())},[$]);let Qn=(0,J.useCallback)(t=>{e&&r(Yn(t),{replace:!0})},[r,e,Yn]),$n=(0,J.useCallback)((e,t)=>{Qn(e),r(t)},[r,Qn]),er=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Qn(e)},[Qn]),tr=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,J.useEffect)(()=>{!e||!t||gn(t)||r(Yn(qn),{replace:!0})},[qn,r,e,Yn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return Xt(!0),Z(null),Promise.all([Je(e),ke(e),me(e),ct().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;W(e),be(n),we(r),Kt(i?.agents??[]),Jt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Kn.current=a,Gn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Xt(!1)}),()=>{t=!0}},[e]);let nr=(0,J.useCallback)(async()=>{e&&be(await ke(e))},[e]);(0,J.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&nr()};return window.addEventListener(`task-created-v2`,t),window.addEventListener(`task-commanded-v2`,t),window.addEventListener(`task-phase-changed-v2`,t),()=>{window.removeEventListener(`task-created-v2`,t),window.removeEventListener(`task-commanded-v2`,t),window.removeEventListener(`task-phase-changed-v2`,t)}},[e,nr]);let rr=(0,J.useCallback)(async(e,t)=>{zn(e.id),Z(null);try{let n=await dt(e.id),r=t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??`main`}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`verify`?{type:`request_review`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);await Ne(e.id,r,n.task.version),await nr()}catch(e){Z(e instanceof Error?e.message:O.board.actionFailed)}finally{zn(null)}},[K,O.board.actionFailed,nr]),ir=(0,J.useCallback)(async t=>{e&&(Z(null),await Ae({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:p,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await nr())},[p,e,nr]),ar=(0,J.useCallback)(async()=>{if(V){He(!0),Z(null);try{Re((await Be.list({projectId:V.id})).automations)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{He(!1)}}},[V]);(0,J.useEffect)(()=>{$===`automations`&&ar()},[ar,$]);let or=(0,J.useCallback)(async()=>{if(V){et(!0),Z(null);try{let e=await Ue(V.id,{includeRelated:nt,limit:100});Ye(e.items),Ze(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{et(!1)}}},[V,nt]);(0,J.useEffect)(()=>{$===`progress`&&or()},[or,$]);let sr=(0,J.useCallback)(async e=>{Ke(`toggle:${e.id}`),Z(null);try{e.enabled?await Be.pause(e.id):await Be.resume(e.id),await ar()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ke(null)}},[ar]),cr=(0,J.useCallback)(async()=>{if(!V?.effectiveWorkspaceRoot?.trim()){St([]),Ct.current.clear(),Wt(null);return}Ht(!0),Wt(null),Ct.current.clear();try{St(Nn((await je(V.id,``)).entries)),Ct.current.add(``)}catch(e){St([]),Ct.current.clear(),Wt(e instanceof Error?e.message:String(e))}finally{Ht(!1)}},[V]),lr=(0,J.useCallback)(async e=>{if(!(!V?.effectiveWorkspaceRoot?.trim()||Ct.current.has(e))){Ct.current.add(e),Wt(null);try{let t=await je(V.id,e);St(n=>Pn(n,e,Nn(t.entries)))}catch(t){Ct.current.delete(e),Wt(t instanceof Error?t.message:String(t))}}},[V]);(0,J.useEffect)(()=>{$===`files`&&cr()},[cr,$]);let ur=Mt.trim();(0,J.useEffect)(()=>{if($!==`files`||!V||!At||!ur){Ft([]),Rt(!1),Bt(null);return}let e=!1;Rt(!0),Bt(null),Ft([]);let t=window.setTimeout(()=>{oe(V.id,ur,50).then(t=>{e||Ft(t)}).catch(t=>{e||Bt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Rt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[ur,V,At,$]);let dr=(0,J.useCallback)(async()=>{if(V){jn(!0),Z(null);try{let e=await Se(V.id);$n(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{jn(!1)}}},[$n,V]),fr=(0,J.useCallback)(async()=>{if(!V)return;let[e,t]=await Promise.all([Je(V.id),ke(V.id)]);be(t),W(e)},[V]),pr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!V||!Un.title.trim())){Ln(!0),Z(null);try{await tt(V.id,{title:Un.title.trim(),reason:Un.reason.trim()||void 0}),Wn({title:``,reason:``}),await fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ln(!1)}}},[Un.reason,Un.title,V,fr]),mr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:Jn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Jn===`/projects`?O.backToProjects:m.sidebar.back,children:(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}),[Jn,m.sidebar.back,O.backToProjects]),hr=(0,J.useMemo)(()=>V?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(q,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Zn,children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),O.board.create]}),(0,Y.jsxs)(q,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void dr(),disabled:Tn,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),O.common.newChat]})]}):null,[Zn,O.board.create,O.common.newChat,V,dr,Tn]);(0,J.useLayoutEffect)(()=>(te({startExtra:mr,main:V?(0,Y.jsx)(Fn,{currentProject:V,pm:O,projectsText:j,wd:h}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:O.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:O.fallbackContext})]}),end:hr}),()=>L()),[L,hr,mr,O,V,j,te,h]);function gr(e){W(t=>t?{...t,...e}:null),Jt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function _r(e=Kn.current){if(!(!V||!fn(e,V))){Z(null),nn(null);try{let t=await at(V.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});gr(t);let n=Kn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Kn.current=r,Gn(r)}catch(e){let t=En(e);throw t?nn(t):Z(e instanceof Error?e.message:String(e)),e}}}function vr(e){e.preventDefault(),jr.flush()}function yr(e,t=!1){let n={...Kn.current,...e};Kn.current=n,Gn(n),t&&jr.saveNow(n)}let br=(0,J.useCallback)(()=>{if(!V)return;let e=V.workspaceRoot?.trim()??``;sn(e?`fixed`:`follow`),ln(e||V.effectiveWorkspaceRoot||``),an(!0)},[V]);async function xr(e={}){if(!V)return;let t=X===`fixed`?cn.trim():``;if(!(X===`fixed`&&!t)){Qt(!0),Z(null),nn(null);try{let n=await at(V.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});gr(n),yr({workspaceRoot:n.workspaceRoot??``}),an(!1),nn(null)}catch(e){let t=En(e);t?(nn(t),an(!1)):Z(e instanceof Error?e.message:String(e))}finally{Qt(!1)}}}async function Sr(){if(!(!V||un)){dn(`pin`),Z(null);try{gr(V.pinnedAt?await x(V.id):await ut(V.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function Cr(){if(!(!V||un)){dn(`archive`),Z(null);try{let e=V.status===`archived`?await ve(V.id):await ye(V.id);gr(e),yr({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function wr(){if(V){wn(!0),Z(null);try{await Ee(V.id),en(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{wn(!1)}}}async function Tr(){if(!(!V||yt)){bt(!0),Z(null);try{await lt(V.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{bt(!1)}}}let Er=(0,J.useCallback)(e=>{Tt(e)},[]),Dr=(0,J.useCallback)((e,t)=>{t||Tt(e)},[]),Or=(0,J.useCallback)(async(e,t,n)=>{let r=V?.id;if(r)switch(e){case`preview`:t.isDirectory||Tt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Ie(t.path);if(B(v(e))!==`text`){let n=await N(t.path,{projectId:r}),i=g(e)??`application/octet-stream`;ie(e,await n.arrayBuffer(),i)}else{let{content:n}=await F(t.path,{projectId:r});k(e,n)}}catch(e){y(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&y(`success`,m.workspace.pathCopied,void 0,{duration:2500})}catch{y(`warning`,m.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[m.clipboard.copyFailed,m.workspace.pathCopied,V?.id]),kr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),kt(!0);let r=e.clientX,i=Et,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=pn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}kt(!1),Dt(c),hn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Et]);(0,J.useEffect)(()=>{$!==`files`&&Tt(null)},[e,$]);let Ar=!!(V&&fn(Q,V)),jr=gt({value:V?Q:null,dirty:Ar,onSave:_r,validate:e=>e.name.trim()?null:O.settings.nameRequired});if(Yt)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:O.loading});if(!V)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:Jn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),Jn===`/projects`?O.backToProjects:m.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Hn||O.notFound})]});let Mr=xe.slice(0,6),Nr=K?.blockers??[],Pr=K?.tasks.filter(e=>e.lane!==`done`)??[],Fr=e=>O.statuses[e]??e,Ir=e=>_n(O.common.messages,{count:e}),Lr=Oe.trim().toLowerCase(),Rr=Lr?xe.filter(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||O.common.agent,r=e.name?.trim()||O.sessions.fallbackTitle,i=Ir(e.messageCount??0),a=An(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Lr)}):xe,zr=xe.length>0&&Rr.length===0,Br=Gt.find(e=>e.id===V.defaultAgentId)?.name||V.defaultAgentId||O.settings.globalDefaultAgent,Vr=Gt.find(e=>e.id===Q.defaultAgentId),Hr=V.workspaceRoot?.trim()||``,Ur=V.status===`archived`,Wr=!!V.pinnedAt,Gr=!Hr,Kr=Hr||Vr?.workspace||V.effectiveWorkspaceRoot||O.common.defaultWorkspace,qr=X===`fixed`?cn.trim()||O.settings.workspacePlaceholder:Vr?.workspace||V.effectiveWorkspaceRoot||O.common.defaultWorkspace,Jr=(X===`fixed`?cn.trim():``)!==Hr&&(X===`follow`||!!cn.trim()),Yr=[{id:`overview`,icon:_e,label:O.tabs.overview},{id:`tasks`,icon:P,label:O.tabs.tasks},{id:`automations`,icon:D,label:O.tabs.automations},{id:`files`,icon:st,label:O.tabs.files},{id:`notes`,icon:Le,label:O.tabs.notes},{id:`skills`,icon:Te,label:O.tabs.skills},{id:`sessions`,icon:M,label:O.tabs.sessions},{id:`progress`,icon:Me,label:O.tabs.progress}];async function Xr(){if(!Kr)return;let e=await u(Kr);y(e?`success`:`warning`,e?m.workspace.pathCopied:m.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Zr(){nn(null),an(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(_t,{items:Yr,activeTab:$,onChange:Xn,ariaLabel:O.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(q,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Xn(`settings`),children:[(0,Y.jsx)(Qe,{className:`size-4`,"aria-hidden":!0}),O.tabs.settings,Ar?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":O.settings.unsavedChanges}):null]})]}),Hn?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Hn}):null,(0,Y.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:V.outcome||K?.digest.summary||V.description||V.brief||O.overview.directionFallback}),K?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:_n(O.overview.recommendedNext,{action:K.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,onClick:()=>void Tr(),disabled:yt,children:[(0,Y.jsx)(De,{className:`size-4`,"aria-hidden":!0}),yt?O.overview.savingDigest:O.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Pr.length?Pr.map(e=>(0,Y.jsxs)(s,{to:re(Yn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.overview.noNextActions})})]}),K?.recentReceipts.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:K.recentReceipts.slice(0,5).map(e=>(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.summary}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]})},e.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:V.milestones.length?V.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:O.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:V.recentUpdates.length?V.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:O.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.attention}),Nr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Nr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(rt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[O.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Fr(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:O.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:pr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Un.title,onChange:e=>Wn(t=>({...t,title:e.target.value})),placeholder:O.overview.blockerTitlePlaceholder}),(0,Y.jsx)(q,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:In||!Un.title.trim(),"aria-label":In?O.overview.addingBlocker:O.overview.addBlocker,title:In?O.overview.addingBlocker:O.overview.addBlocker,children:(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(fe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:O.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Xn(`sessions`),children:O.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Mr.length?Mr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:vn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||O.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Y.jsx)(on,{ref:Bn,tasks:K?.tasks??[],dependencyEdges:K?.dependencyEdges??[],returnTo:Yn(`tasks`),copy:O.board,onAction:rr,onCreate:ir,actionBusyId:Rn}):null,$===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(D,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.automations.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.automations.hint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ar(),disabled:Ve,children:[(0,Y.jsx)(We,{className:l(`size-4`,Ve&&`animate-spin`),"aria-hidden":!0}),O.common.refresh]}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>$n(`automations`,`/automations?projectId=${encodeURIComponent(V.id)}&action=create`),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),O.automations.create]})]})]}),Ve&&Fe.length===0?(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,Y.jsx)(z,{className:`h-24 rounded-lg`}),(0,Y.jsx)(z,{className:`h-24 rounded-lg`})]}):Fe.length?(0,Y.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Fe.map(e=>(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?O.automations.enabled:O.automations.paused})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:O.common.open}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Ge===`toggle:${e.id}`,onClick:()=>void sr(e),children:[e.enabled?(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?O.automations.pause:O.automations.resume]})]})]},e.id))}):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:O.automations.empty})]})}):null,$===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(mt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(V.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:V.id,listTitle:O.notes.title,listDescription:O.notes.hint,emptyText:O.notes.emptyTitle,emptyDescription:O.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${V.id}`})}):null,$===`skills`?(0,Y.jsx)(It,{projectId:V.id,copy:O.skills}):null,$===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:V.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ot&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Et}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(ge,{workspacePath:Kr}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,At&&`bg-surface-hover text-fg`),onClick:()=>jt(!0),"aria-label":O.files.search,title:O.files.search,"aria-pressed":At,children:(0,Y.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(ft,{className:`size-7 shrink-0 rounded-md p-0`,loading:Vt,label:m.cron.refresh,onClick:()=>void cr()})]})]}),At?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(Ce,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Mt,onChange:e=>Nt(e.target.value),placeholder:O.files.searchPlaceholder,"aria-label":O.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":O.files.clearSearch,title:O.files.clearSearch,onClick:()=>{Nt(``),jt(!1)},children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Ut?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Ut}):null,ur?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Lt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(z,{className:`h-11 w-full`}),(0,Y.jsx)(z,{className:`h-11 w-full`}),(0,Y.jsx)(z,{className:`h-11 w-full`})]}):zt?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[m.workspace.loadError,`: `,zt]}):Pt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:O.files.noSearchResults}):Pt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,wt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Tt(e.path),title:e.path,children:[(0,Y.jsx)(Le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Vt&&xt.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.files.loading}):(0,Y.jsx)(ae,{tree:xt,selectedPath:wt,onSelectFile:Er,onSelectEntry:Dr,onExpandDir:e=>void lr(e),onAction:Or,actionLabels:{preview:m.workspace.preview,download:m.workspace.download,copyPath:m.workspace.copyPath,openDefault:m.workspace.openSystemApp,openWith:m.workspace.openWith,revealInFolder:m.workspace.revealInFolder,recommendedApps:m.workspace.recommendedApps},emptyHint:O.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":O.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ot&&`bg-surface-hover`),onPointerDown:kr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:wt?(0,Y.jsx)(ne,{filePath:wt,projectId:V.id,agentId:V.defaultAgentId||qt||void 0,onClose:()=>Tt(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(st,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:O.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:O.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Xn(`settings`),children:O.files.openSettings})})]})})}):null,$===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[xe.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:Oe,onChange:e=>Pe(e.currentTarget.value),placeholder:O.sessions.searchPlaceholder,"aria-label":O.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),Oe?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":O.sessions.clearSearch,onClick:()=>Pe(``),children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Rr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Rr.map(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||O.common.agent,r=An(e),i=e.name?.trim()||O.sessions.fallbackTitle,a=Ir(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[O.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[O.sessions.updated,`: `,t]}):null]})]},e.key)})}):zr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:O.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_n(O.progress.count,{count:Xe})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:nt,onChange:e=>it(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),O.progress.includeRelated]}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void or(),disabled:$e,children:[(0,Y.jsx)(We,{className:l(`size-4`,$e&&`animate-spin`),"aria-hidden":!0}),O.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:$e&&qe.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:O.progress.loading}):qe.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:qe.map(e=>{let t=O.progress.types[e.type]??e.type,n=O.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Mn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===V.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:O.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,On(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:vn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[O.progress.actor,`: `,Dn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[O.progress.source,`: `,kn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:O.progress.empty})})]}):null,$===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:vr,onBlurCapture:jr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:O.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs font-medium`,yn(Q.status)),children:O.settings.statuses[Q.status]}),(0,Y.jsx)(ht,{status:jr.status,error:jr.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(bn,{label:O.settings.name,children:(0,Y.jsx)(`input`,{className:xn(),value:Q.name,onChange:e=>yr({name:e.target.value})})}),(0,Y.jsx)(bn,{label:O.settings.defaultAgent,children:(0,Y.jsxs)(pe,{className:xn(),value:Q.defaultAgentId,onChange:e=>yr({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(H,{value:``,children:O.settings.globalDefaultAgent}),Gt.map(e=>(0,Y.jsx)(H,{value:e.id,children:he(e,m.agentsSettings)},e.id))]})}),(0,Y.jsx)(bn,{label:O.settings.status,children:Ur?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:O.settings.statuses.archived}):(0,Y.jsxs)(pe,{className:xn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>yr({status:e.target.value},!0),children:[(0,Y.jsx)(H,{value:`active`,children:O.settings.statuses.active}),(0,Y.jsx)(H,{value:`paused`,children:O.settings.statuses.paused})]})}),(0,Y.jsx)(bn,{label:O.settings.description,hint:O.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.description,onChange:e=>yr({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.projectGuidanceHint})]}),(0,Y.jsx)(bn,{label:O.settings.brief,hint:O.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.brief,onChange:e=>yr({brief:e.target.value})})}),(0,Y.jsx)(bn,{label:O.settings.instructions,hint:O.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.instructions,onChange:e=>yr({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Gr?O.settings.workspaceModeFollow:O.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Kr,children:Kr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Xr(),children:[(0,Y.jsx)(de,{className:`size-4`,"aria-hidden":!0}),O.settings.copyWorkspacePath]}),(0,Y.jsx)(ge,{workspacePath:Kr}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:br,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(Sn,{label:O.settings.defaultAgent,value:Br}),(0,Y.jsx)(Sn,{label:O.settings.pinState,value:Wr?O.settings.pinned:O.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(Sn,{label:O.settings.createdAt,value:vn(V.createdAt)||O.common.never}),(0,Y.jsx)(Sn,{label:O.settings.updatedAt,value:vn(V.updatedAt)||O.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?O.settings.pinnedTitle:O.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.pinHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:un===`pin`,onClick:()=>void Sr(),children:[Wr?(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),Wr?O.settings.unpinProject:O.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?O.settings.restoreTitle:O.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Ur?O.settings.restoreHint:O.settings.archiveHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:Ur?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:un===`archive`,onClick:()=>void Cr(),children:[Ur?(0,Y.jsx)(We,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(R,{className:`size-4`,"aria-hidden":!0}),Ur?O.settings.restoreProject:O.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:O.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:O.settings.dangerHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>en(!0),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),O.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(A,{open:$t,onOpenChange:e=>{Cn||en(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(rt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.deleteConfirmTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?_n(O.settings.deleteConfirm,{name:V.name}):O.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Cn,children:O.common.cancel})}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Cn||!V,onClick:()=>void wr(),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),O.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(A,{open:rn,onOpenChange:e=>{Zt||an(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.workspaceMigrationTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:O.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>sn(`fixed`),disabled:Zt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:O.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>sn(`follow`),disabled:Zt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:O.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,Y.jsx)(vt,{value:cn,onChange:ln,disabled:Zt,wd:h,placeholder:O.settings.workspacePlaceholder,inputClassName:xn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:O.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:_n(O.settings.workspaceCurrent,{workspace:qr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Zt,children:O.common.cancel})}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Zt||!Jr,onClick:()=>void xr(),children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(A,{open:!!tn,onOpenChange:e=>{e||nn(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.workspaceMissingTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:tn?_n(O.settings.workspaceMissingDescription,{workspace:tn}):null})]}),tn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:tn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Zr,disabled:Zt,children:O.settings.workspaceMissingBack}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void xr({createWorkspaceRoot:!0}),disabled:Zt,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.workspaceMissingCreate]})]})]})]})})]})}export{In as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-DQ5X6cXp.js";import{n as s}from"./locale-store-Bjvw7jtg.js";import{Bo as c,Ca as l,Dc as u,Dl as d,Dt as f,Ec as p,El as m,Fo as h,Io as g,Kc as _,Lo as v,Mu as y,Na as b,Ou as x,Ro as S,Sc as C,Ua as w,Vo as T,ba as E,ca as D,dc as O,jt as k,la as A,mc as j,nt as M,va as N,ws as P,ya as F,zo as I}from"./index-BzPwnXho.js";var L=n(),R=e(t(),1),z=r();function B(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:M(n)}function ee(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function te(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},V)}),e[0]=t):t=e[0],t}function V(e,t){return(0,z.jsx)(b,{className:`h-40 rounded-xl`},t)}function ne(e){let t=(0,L.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:c}=e,l=s(re),f,m,h,g,_,v,b,S;if(t[0]!==l||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=o(l).projectsPage;f=e.management,b=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let s=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),c;t[20]===s?c=t[21]:(c=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,s]}),t[20]=s,t[21]=c);let u;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,z.jsx)(x,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=u):u=t[22];let p;t[23]===c?p=t[24]:(p=(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,u]}),t[23]=c,t[24]=p),S=(0,z.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p,(0,z.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),v=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,g=`min-w-0 text-[11px] text-fg-subtle`,_=(0,z.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),m=`mt-1`,h=B(n.lastActiveAt??n.updatedAt,e.never),t[0]=l,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=f,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=b,t[16]=S}else f=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],b=t[15],S=t[16];let C;t[25]!==m||t[26]!==h?(C=(0,z.jsx)(`p`,{className:m,children:h}),t[25]=m,t[26]=h,t[27]=C):C=t[27];let w;t[28]!==g||t[29]!==_||t[30]!==C?(w=(0,z.jsxs)(`div`,{className:g,children:[_,C]}),t[28]=g,t[29]=_,t[30]=C,t[31]=w):w=t[31];let T=n.pinnedAt?f.unpin:f.pin,E=n.pinnedAt?f.unpin:f.pin,D;t[32]===n.pinnedAt?D=t[33]:(D=n.pinnedAt?(0,z.jsx)(p,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=D);let O;t[34]!==r||t[35]!==a||t[36]!==T||t[37]!==E||t[38]!==D?(O=(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":T,title:E,children:D}),t[34]=r,t[35]=a,t[36]=T,t[37]=E,t[38]=D,t[39]=O):O=t[39];let k=n.status===`archived`?f.restore:f.archive,A=n.status===`archived`?f.restore:f.archive,M;t[40]===n.status?M=t[41]:(M=n.status===`archived`?(0,z.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=M);let N;t[42]!==r||t[43]!==c||t[44]!==k||t[45]!==A||t[46]!==M?(N=(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:c,"aria-label":k,title:A,children:M}),t[42]=r,t[43]=c,t[44]=k,t[45]=A,t[46]=M,t[47]=N):N=t[47];let F;t[48]!==O||t[49]!==N?(F=(0,z.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[O,N]}),t[48]=O,t[49]=N,t[50]=F):F=t[50];let I;t[51]!==F||t[52]!==v||t[53]!==w?(I=(0,z.jsxs)(`div`,{className:v,children:[w,F]}),t[51]=F,t[52]=v,t[53]=w,t[54]=I):I=t[54];let R;return t[55]!==I||t[56]!==b||t[57]!==S?(R=(0,z.jsxs)(`article`,{className:b,children:[S,I]}),t[55]=I,t[56]=b,t[57]=S,t[58]=R):R=t[58],R}function re(e){return e.language}function ie(){let e=o(s(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=w(e=>e.setPageHeader),u=w(e=>e.clearPageHeader),[p,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!0),[j,M]=(0,R.useState)(null),[L,B]=(0,R.useState)(``),[V,re]=(0,R.useState)(`active`),[ie,ae]=(0,R.useState)(null),[oe,H]=(0,R.useState)(!1),[U,W]=(0,R.useState)(null),[G,K]=(0,R.useState)(!1),[q,J]=(0,R.useState)(``),[Y,X]=(0,R.useState)(``),[Z,se]=(0,R.useState)(``),Q=k({initialPath:Z,onPicked:se}),$=(0,R.useCallback)(async()=>{x(!0),M(null);try{y(ee((await N({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){M(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,R.useEffect)(()=>{$()},[$]);let ce=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase();return p.filter(e=>V===`all`||e.status===V).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[V,p,L]),le=(0,R.useMemo)(()=>(0,z.jsxs)(P,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,z.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,R.useLayoutEffect)(()=>(i({startExtra:null,main:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:le}),()=>u()),[u,le,n.subtitle,n.title,i]);let ue=(0,R.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Z.trim();if(!(!t||!n||G)){K(!0),W(null);try{let e=await A({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});y(t=>[e,...t.filter(t=>t.id!==e.id)]),J(``),X(``),se(``),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[G,Y,q,Z]),de=(0,R.useCallback)(async(e,t)=>{ae(e.id),M(null);try{let n;n=t===`pin`?e.pinnedAt?await l(e.id):await F(e.id):e.status===`archived`?await E(e.id):await D(e.id),y(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){M(e instanceof Error?e.message:String(e))}finally{ae(null)}},[]),fe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}];return(0,z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,z.jsx)(h,{open:oe,onOpenChange:e=>{H(e),e||W(null)},children:(0,z.jsxs)(c,{children:[(0,z.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,z.jsx)(T,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,z.jsx)(S,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,z.jsxs)(`form`,{onSubmit:ue,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,z.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>J(e.target.value),maxLength:160})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,z.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>X(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Q.pick,disabled:G||Q.picking,children:[Q.picking?(0,z.jsx)(_,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,z.jsx)(m,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Z?r.chooseFolder:r.selectWorkingDirectory}),(0,z.jsx)(`span`,{className:a(`mt-0.5 block truncate font-mono text-xs font-normal`,Z?`text-fg-muted`:`text-fg-subtle`),title:Z||void 0,children:Z||t.workspaceSelectionPlaceholder})]})]}),(0,z.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),U?(0,z.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:U}):null]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(P,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,z.jsx)(P,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Z.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),Q.hasNativePicker?null:(0,z.jsx)(f,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:Z||void 0,onConfirm:Q.confirmPick,wd:r}),(0,z.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n.filterLabel,children:fe.map(e=>(0,z.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,V===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>re(e.id),children:e.label},e.id))}),(0,z.jsxs)(`label`,{className:`relative block min-w-0 sm:w-64`,children:[(0,z.jsx)(O,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`input`,{className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>B(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder})]})]}),j?(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,z.jsx)(`span`,{children:j}),(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:t.home.retry})]}):null,b?(0,z.jsx)(te,{}):ce.length?(0,z.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ce.map(e=>(0,z.jsx)(ne,{project:e,busy:ie===e.id,onTogglePin:()=>void de(e,`pin`),onToggleArchive:()=>void de(e,`archive`)},e.id))}):(0,z.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,z.jsx)(d,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{ie as ProjectsPage};