@xopcai/xopc 0.0.231 → 0.0.232

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 (339) hide show
  1. package/README.md +1 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
  5. package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
  8. package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
  9. package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
  11. package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
  12. package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
  15. package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
  17. package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
  19. package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
  20. package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
  21. package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
  22. package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
  23. package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
  24. package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
  26. package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
  27. package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
  29. package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
  30. package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
  31. package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
  32. package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
  33. package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
  34. package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
  36. package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
  37. package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
  39. package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
  41. package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
  42. package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
  43. package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
  44. package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
  45. package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
  46. package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
  47. package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
  48. package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
  49. package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
  50. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
  51. package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
  52. package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
  53. package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
  54. package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
  55. package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
  56. package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
  57. package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
  58. package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
  59. package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
  60. package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
  61. package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
  62. package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
  63. package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
  64. package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
  65. package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
  66. package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
  67. package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
  68. package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
  69. package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
  70. package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
  71. package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
  72. package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
  74. package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
  75. package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
  76. package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
  77. package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
  78. package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
  80. package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
  81. package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
  82. package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
  83. package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
  84. package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
  85. package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
  86. package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
  87. package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
  88. package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
  89. package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
  90. package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
  91. package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
  92. package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
  93. package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
  94. package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
  95. package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
  96. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
  97. package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
  98. package/dist/gateway/static/root/index.html +16 -16
  99. package/dist/package.js +1 -1
  100. package/dist/src/agent/agent-manager.d.ts +1 -2
  101. package/dist/src/agent/agent-manager.js +29 -44
  102. package/dist/src/agent/background-review/run-background-review.js +10 -15
  103. package/dist/src/agent/embedded/run-for-session.js +1 -1
  104. package/dist/src/agent/external-tools/mcp-provider.js +3 -13
  105. package/dist/src/agent/image/generation/runtime.js +1 -1
  106. package/dist/src/agent/image/tool-model-config.js +13 -14
  107. package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
  108. package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
  109. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  110. package/dist/src/agent/mcp/index.js +2 -2
  111. package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
  112. package/dist/src/agent/media-generation/runtime-shared.js +1 -1
  113. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  114. package/dist/src/agent/memory/manager.d.ts +1 -1
  115. package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
  116. package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
  117. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
  118. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
  119. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
  120. package/dist/src/agent/service.js +0 -1
  121. package/dist/src/agent/starter-agents.js +1 -8
  122. package/dist/src/agent/tools/executor.d.ts +1 -1
  123. package/dist/src/agent/tools/workflow-tool.js +1 -5
  124. package/dist/src/agent-config/index.d.ts +2 -0
  125. package/dist/src/agent-config/index.js +11 -0
  126. package/dist/src/agent-config/resolver.d.ts +11 -0
  127. package/dist/src/agent-config/resolver.js +113 -0
  128. package/dist/src/agent-config/schema.d.ts +491 -0
  129. package/dist/src/agent-config/schema.js +172 -0
  130. package/dist/src/chat-commands/builtins/config.js +2 -2
  131. package/dist/src/chat-commands/builtins/review.js +1 -1
  132. package/dist/src/chat-commands/config-paths.js +1 -1
  133. package/dist/src/cli/commands/agents.js +2 -1
  134. package/dist/src/cli/commands/config.js +1 -1
  135. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  136. package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
  137. package/dist/src/cli/commands/image.js +3 -4
  138. package/dist/src/cli/commands/models.js +9 -3
  139. package/dist/src/cli/commands/onboard/model.js +12 -11
  140. package/dist/src/cli/commands/onboard.js +1 -1
  141. package/dist/src/cli/commands/tunnel.js +3 -18
  142. package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
  143. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  144. package/dist/src/commands/agents.config.d.ts +1 -3
  145. package/dist/src/commands/agents.config.js +9 -26
  146. package/dist/src/config/agent-model-intents.d.ts +10 -0
  147. package/dist/src/config/agent-model-intents.js +39 -0
  148. package/dist/src/config/agent-profile.d.ts +7 -9
  149. package/dist/src/config/agent-profile.js +30 -28
  150. package/dist/src/config/default-model.d.ts +1 -11
  151. package/dist/src/config/default-model.js +3 -11
  152. package/dist/src/config/index.js +3 -3
  153. package/dist/src/config/integration.d.ts +1 -1
  154. package/dist/src/config/reload.js +1 -1
  155. package/dist/src/config/rules.js +3 -3
  156. package/dist/src/config/schema.d.ts +187 -452
  157. package/dist/src/config/schema.js +53 -131
  158. package/dist/src/extensions/activation-context.js +7 -11
  159. package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
  160. package/dist/src/gateway/agent-builtin-tools.js +284 -46
  161. package/dist/src/gateway/agents-admin.d.ts +20 -62
  162. package/dist/src/gateway/agents-admin.js +36 -228
  163. package/dist/src/gateway/device-routes.d.ts +3 -0
  164. package/dist/src/gateway/device-routes.js +47 -0
  165. package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
  166. package/dist/src/gateway/global-defaults-admin.js +20 -120
  167. package/dist/src/gateway/hono/app.js +4 -2
  168. package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
  169. package/dist/src/gateway/hono/lib/config-payload.js +2 -4
  170. package/dist/src/gateway/hono/middleware/auth.js +33 -1
  171. package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
  172. package/dist/src/gateway/hono/middleware/scopes.js +9 -18
  173. package/dist/src/gateway/hono/routes/agents.js +64 -100
  174. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  175. package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
  176. package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
  177. package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
  178. package/dist/src/gateway/hono/routes/devices.js +214 -0
  179. package/dist/src/gateway/hono/routes/files.js +5 -1
  180. package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
  181. package/dist/src/gateway/hono/routes/index.js +4 -2
  182. package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
  183. package/dist/src/gateway/hono/routes/models.js +2 -2
  184. package/dist/src/gateway/hono/routes/realtime.js +8 -1
  185. package/dist/src/gateway/hono/routes/status.js +9 -16
  186. package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
  187. package/dist/src/gateway/hono/routes/tunnel.js +10 -199
  188. package/dist/src/gateway/image-generation-setup.d.ts +2 -2
  189. package/dist/src/gateway/image-generation-setup.js +8 -7
  190. package/dist/src/gateway/public-url.d.ts +1 -1
  191. package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
  192. package/dist/src/gateway/security/gateway-principal.js +12 -0
  193. package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
  194. package/dist/src/gateway/security/gateway-scopes.js +66 -0
  195. package/dist/src/gateway/security/index.d.ts +2 -1
  196. package/dist/src/gateway/security/index.js +3 -2
  197. package/dist/src/gateway/service.js +7 -7
  198. package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
  199. package/dist/src/migrations/index.d.ts +0 -1
  200. package/dist/src/migrations/index.js +1 -2
  201. package/dist/src/migrations/runner.js +1 -2
  202. package/dist/src/notifications/device-store.d.ts +1 -1
  203. package/dist/src/notifications/device-store.js +11 -11
  204. package/dist/src/notifications/store.js +3 -3
  205. package/dist/src/providers/index.js +1 -1
  206. package/dist/src/providers/model-reference-auditor.js +14 -9
  207. package/dist/src/realtime/runtime.d.ts +2 -0
  208. package/dist/src/realtime/runtime.js +27 -3
  209. package/dist/src/realtime/tickets.d.ts +6 -1
  210. package/dist/src/realtime/tickets.js +2 -1
  211. package/dist/src/remote-access/exposure-manager.js +3 -3
  212. package/dist/src/share/share-url.js +2 -2
  213. package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
  214. package/dist/src/storage/sqlite/device-access-repository.js +194 -0
  215. package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
  216. package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
  217. package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
  218. package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
  219. package/dist/src/storage/sqlite/index.d.ts +3 -0
  220. package/dist/src/storage/sqlite/index.js +4 -1
  221. package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
  222. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  223. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  224. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  225. package/dist/src/storage/sqlite/schema.js +1 -1
  226. package/dist/src/tunnel/consent.d.ts +1 -1
  227. package/dist/src/tunnel/consent.js +1 -1
  228. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  229. package/dist/src/tunnel/index.d.ts +1 -4
  230. package/dist/src/tunnel/index.js +3 -5
  231. package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
  232. package/dist/src/tunnel/tunnel-config.js +1 -1
  233. package/dist/src/tunnel/tunnel-service.d.ts +2 -3
  234. package/dist/src/tunnel/tunnel-service.js +1 -20
  235. package/dist/src/tunnel/tunnel-types.d.ts +0 -6
  236. package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
  237. package/dist/src/workflows/service/workflow-run-service.js +3 -3
  238. package/package.json +3 -3
  239. package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
  240. package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
  241. package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
  242. package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
  243. package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
  244. package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
  245. package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
  246. package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
  247. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
  248. package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
  249. package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
  250. package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
  251. package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
  252. package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
  253. package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
  254. package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
  255. package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
  256. package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
  257. package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
  258. package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
  259. package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
  260. package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
  261. package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
  262. package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
  263. package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
  264. package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
  265. package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
  266. package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
  267. package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
  268. package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
  269. package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
  270. package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
  271. package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
  272. package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
  273. package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
  274. package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
  275. package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
  276. package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
  277. package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
  278. package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
  279. package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
  280. package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
  281. package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
  282. package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
  283. package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
  284. package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
  285. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
  286. package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
  287. package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
  288. package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
  289. package/dist/src/agent-manifest/index.d.ts +0 -5
  290. package/dist/src/agent-manifest/index.js +0 -10
  291. package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
  292. package/dist/src/agent-manifest/preset-chain.js +0 -30
  293. package/dist/src/agent-manifest/prompt.d.ts +0 -2
  294. package/dist/src/agent-manifest/prompt.js +0 -49
  295. package/dist/src/agent-manifest/resolver.d.ts +0 -32
  296. package/dist/src/agent-manifest/resolver.js +0 -114
  297. package/dist/src/agent-manifest/schema.d.ts +0 -695
  298. package/dist/src/agent-manifest/schema.js +0 -226
  299. package/dist/src/agent-manifest/validator.d.ts +0 -25
  300. package/dist/src/agent-manifest/validator.js +0 -74
  301. package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
  302. package/dist/src/agent-runtime/boundary-guard.js +0 -21
  303. package/dist/src/agent-runtime/index.d.ts +0 -7
  304. package/dist/src/agent-runtime/index.js +0 -8
  305. package/dist/src/agent-runtime/model-router.d.ts +0 -11
  306. package/dist/src/agent-runtime/model-router.js +0 -14
  307. package/dist/src/agent-runtime/run-trace.d.ts +0 -27
  308. package/dist/src/agent-runtime/run-trace.js +0 -51
  309. package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
  310. package/dist/src/agent-runtime/runtime-profile.js +0 -42
  311. package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
  312. package/dist/src/agent-runtime/tool-registry.js +0 -50
  313. package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
  314. package/dist/src/agent-runtime/workflow-runtime.js +0 -32
  315. package/dist/src/config/agent-typed-models.d.ts +0 -13
  316. package/dist/src/config/agent-typed-models.js +0 -48
  317. package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
  318. package/dist/src/gateway/capability-presets-admin.js +0 -303
  319. package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
  320. package/dist/src/gateway/hono/lib/agent-model.js +0 -97
  321. package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
  322. package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
  323. package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
  324. package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
  325. package/dist/src/gateway/security/operator-scopes.js +0 -147
  326. package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
  327. package/dist/src/migrations/config/default-capability-preset.js +0 -133
  328. package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
  329. package/dist/src/tunnel/enable-lan-pairing.js +0 -41
  330. package/dist/src/tunnel/pair-context.d.ts +0 -36
  331. package/dist/src/tunnel/pair-context.js +0 -77
  332. package/dist/src/tunnel/pair-url.d.ts +0 -43
  333. package/dist/src/tunnel/pair-url.js +0 -117
  334. package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
  335. package/dist/src/tunnel/pairing-rate-limit.js +0 -28
  336. package/dist/src/tunnel/pairing.d.ts +0 -21
  337. package/dist/src/tunnel/pairing.js +0 -103
  338. package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
  339. package/dist/src/tunnel/tunnel-qr.js +0 -29
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CE14CVOy.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-0xQO5B_Q.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DaxPZj9e.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-RxNHwlNo.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-CXhjfe4q.js","assets/messages-BMdD0LWk.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-B1bGSQqt.css","assets/dist-J_ySZvz0.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-CccGri5Y.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/file-code-corner-byQA1VfD.js","assets/globe-DSSGFWFn.js","assets/notes-api-EpgG-OQc.js","assets/loader-circle-CifKLtgG.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/files-Dp8_uGTO.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-BFZrVYfy.js","assets/gateway-startup-retry-B_zrtccP.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BWGjnmDl.js","assets/models-hub-cache-0RjEwafI.js","assets/oauth-api-BwNLwbI8.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-M0nAY5XB.js","assets/theme-store-Qgvo0Ga7.js","assets/index-CCyIdGuQ.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-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-CccGri5Y.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{D as p,O as m,S as h,T as g,_,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,p as j,r as M,s as N,u as P,v as F,w as ee,x as I,y as te}from"./notes-api-EpgG-OQc.js";import{t as L}from"./loader-circle-CifKLtgG.js";import{t as ne}from"./plus-Q2yW6OE7.js";import{t as re}from"./search-DA7gz22f.js";import{t as R}from"./x-B_N4OPjy.js";import{t as z}from"./cn-JdwAhgNB.js";import{t as B}from"./button-CSEbl4zT.js";import{t as V}from"./messages-BMdD0LWk.js";import{l as ie,n as H}from"./locale-store-CXhjfe4q.js";import{i as ae}from"./theme-store-Qgvo0Ga7.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./dist-BPoKqzeH.js";import{i as pe}from"./vendor-swr-BIWyz7Rc.js";import{$s as U,As as W,Br as me,Ds as he,Ga as G,Gr as ge,Gs as _e,Hl as ve,Hs as K,Ir as ye,Ja as q,Jl as J,Kr as be,Li as xe,Lr as Y,Ql as Se,Ra as Ce,Rn as we,Rr as X,Rs as Te,Ur as Ee,Vc as De,Vr as Oe,Wc as ke,Wr as Ae,_s as je,ac as Me,c as Ne,d as Pe,eu as Fe,gl as Ie,gs as Le,hc as Re,iu as ze,jc as Be,js as Ve,l as He,ll as Ue,nc as We,ol as Ge,oo as Ke,rc as qe,s as Je,sc as Ye,tc as Xe,tu as Ze,u as Qe,vs as $e,ws as et,yc as tt,ys as nt,zi as rt,zr as it}from"./index-0xQO5B_Q.js";var Z=n(),Q=e(t(),1),$=r(),at=(0,Q.createContext)(null);function ot(){let e=(0,Z.c)(1),t=(0,Q.useContext)(at);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:st},e[0]=t):t=e[0],t}return t}function st(){}function ct(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(oe,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=z(`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]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(de,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(R,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(ce,{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:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=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]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(le,{children:[p,(0,$.jsxs)(ue,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(fe,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(at.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function lt(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=E(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=z(`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)(T,{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 l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=z(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(g,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var ut=6e4,dt=36e5,ft=864e5;function pt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function mt(e,t,n){let r=t-e;if(r<ut)return n.justNow;if(r<dt){let e=Math.floor(r/ut);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=pt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ft)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*ft){let e=Math.floor(r/ft);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ht(e,t,n){let r=pt(t);if(e>=r)return n.today;if(e>=r-ft)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 gt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function _t(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 vt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=be(),f=be(bt),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=z(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=z(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Me,{className:`size-3.5`}):(0,$.jsx)(U,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=_t(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let M;t[29]===j?M=t[30]:(M=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=M);let N;t[31]!==A||t[32]!==M?(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,M]}),t[31]=A,t[32]=M,t[33]=N):N=t[33];let P;return t[34]!==N||t[35]!==C||t[36]!==O?(P=(0,$.jsxs)(`div`,{className:C,onClick:yt,children:[O,N]}),t[34]=N,t[35]=C,t[36]=O,t[37]=P):P=t[37],P}function yt(e){return e.stopPropagation()}function bt(e){return e.toggle}function xt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function St(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=xt(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(Et),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=mt(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=z(`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`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(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]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(vt,{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]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=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]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=z(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Ue,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(Oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Tt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(Xe,{className:`size-4`}):(0,$.jsx)(We,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(Y,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Ze,{className:`size-4`}),t[47]=ee):ee=t[47];let I;t[48]!==c.archive||t[49]!==F?(I=(0,$.jsxs)(Y,{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:F,children:[ee,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=I):I=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(me,{className:`my-1 h-px bg-edge-subtle`}),t[51]=te):te=t[51];let L;t[52]!==n.id||t[53]!==s?(L=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=L):L=t[54];let ne;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(je,{className:`size-4`}),t[55]=ne):ne=t[55];let re;t[56]!==c.delete||t[57]!==L?(re=(0,$.jsxs)(Y,{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:L,children:[ne,c.delete]}),t[56]=c.delete,t[57]=L,t[58]=re):re=t[58];let R;t[59]!==P||t[60]!==I||t[61]!==re?(R=(0,$.jsx)(X,{children:(0,$.jsxs)(ye,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:wt,children:[P,I,te,re]})}),t[59]=P,t[60]=I,t[61]=re,t[62]=R):R=t[62];let B;t[63]!==A||t[64]!==R?(B=(0,$.jsxs)(it,{children:[A,R]}),t[63]=A,t[64]=R,t[65]=B):B=t[65];let V;t[66]!==C||t[67]!==O||t[68]!==B?(V=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,B]}),t[66]=C,t[67]=O,t[68]=B,t[69]=V):V=t[69];let ie;t[70]===n.pinned?ie=t[71]:(ie=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)(We,{className:`size-3`})}),t[70]=n.pinned,t[71]=ie);let H;t[72]===n.tags?H=t[73]:(H=n.tags?.slice(0,2).map(Ct),t[72]=n.tags,t[73]=H);let ae;t[74]===g?ae=t[75]:(ae=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=ae);let oe;t[76]!==ie||t[77]!==H||t[78]!==ae?(oe=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ie,H,ae]}),t[76]=ie,t[77]=H,t[78]=ae,t[79]=oe):oe=t[79];let se;return t[80]!==V||t[81]!==oe||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(se=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,V,oe]}),t[80]=V,t[81]=oe,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=se):se=t[87],se}function Ct(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 wt(e){return e.stopPropagation()}function Tt(e){return e.stopPropagation()}function Et(){return Date.now()}function Dt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,u=c===void 0?`card`:c,d=H(At),f=V(d).automations.suggestions,p=V(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=pe(o?`automation-suggestion-coverage`:null,kt,h),_=o?g?.automations.find(e=>Qe(e,o)):void 0,v=_?Ne(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=z(`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`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{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]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,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:f.coveredTitle}),(0,$.jsx)(B,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=z(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Be,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(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]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Ve,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(B,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=z(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{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]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(B,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,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:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:He(f.coveredDescription,{name:_.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:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Ot)})]}),i]})}let y;t[24]===s?y=t[25]:(y=z(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Be,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ve,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(B,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function Ot(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 kt(){return Pe.list()}function At(e){return e.language}function jt(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(Mt),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 Mt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function Nt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),p(n,r).then(i=>{if(e=!0,t){m(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&m(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(G,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function Pt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=V(H(Lt)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>we(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=pe(i,a,o),u,d;if(t[4]===c?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&c(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(It);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 c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[c],t[4]=c,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==m?(v=m?(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)(Ve,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(jt,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(jt,{values:m.actionItems.map(Ft)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(jt,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(jt,{values:m.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Re,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(Nt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Re,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(Le,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(l,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Ft(e){return e.title}function It(e,t){return e.sequence-t.sequence}function Lt(e){return e.language}var Rt={edit:qe,ai_edit:Ve,sync:_e,restore:Fe};function zt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=V(H(e=>e.language)).notes,o=a,{data:s}=pe(e?[`note-history`,e]:null,()=>P(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await I(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=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)(ke,{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)(R,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Rt[e.trigger]??qe,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:z(`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:zt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:mt(e.timestamp,h,o)})]}),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(),m(e.timestamp)},disabled:c,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:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(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(),d(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 Vt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=V(H(Jt)).notes,p=a(),m=r?.aiDeep?.catalysis,h=m?.report??null,g;t[0]===n?g=t[1]:(g=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=g);let _;t[2]===n?_=t[3]:(_=()=>y(n),t[2]=n,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[4]=v):v=t[4];let{data:b,mutate:x,isLoading:S}=pe(g,_,v),C;t[5]===n?C=t[6]:(C=async e=>{try{await te(n,e)}catch{}},t[5]=n,t[6]=C);let w=C,T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Ve,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=T):T=t[7];let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Se,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=E):E=t[8];let D;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(tt,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=D):D=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:[T,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:E})]}),(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:f.catalysisSectionDescription}),b?(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:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(()=>F(n),{revalidate:!1}),disabled:S,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:f.contextRebuild}),(0,$.jsx)(`span`,{className:z(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.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:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(qt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,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?f.processing:h?f.recatalyze:f.catalyzeAction}),h?(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:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(Kt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(Gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map(Wt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(Ut)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(Ht)})]}),(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:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:z(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)($e,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:z(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(nt,{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:f.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:[D,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,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:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,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:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(`/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||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.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:f.noThreads})]})]})]})}function Ht(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 Ut(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 Wt(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 Gt(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 Kt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function qt(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 Jt(e){return e.language}var Yt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Xt({open:e,onOpenChange:t,note:n}){let r=H(e=>e.language)===`zh`,i=r?$t:en,{data:a,mutate:l}=pe(e?[`note-shares`,n.id]:null,()=>b(n.id)),[f,p]=(0,Q.useState)(new Set),[m,h]=(0,Q.useState)(`86400000`),[g,_]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(p(new Set(N.map(e=>e.id))),O(null),A(!1),M(null))},[e,N]);let P=async()=>{C(!0),M(null);try{O((await w(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f],ttlMs:Number(m),maxViews:g.trim()?Number(g):null,description:y.trim()||void 0})).payload.shareUrl),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{C(!1)}},F=async(e,t)=>{E(e.id),M(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f]}):t===`extend`?await xe(e.id,864e5):await rt(e.id),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(null)}},ee=async e=>{await navigator.clipboard.writeText(e),A(!0),window.setTimeout(()=>A(!1),1500)};return(0,$.jsx)(fe,{open:e,onOpenChange:t,children:(0,$.jsxs)(le,{children:[(0,$.jsx)(oe,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ue,{className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-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-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(de,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Te,{className:`size-4`}),i.title]}),(0,$.jsx)(se,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(R,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),N.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:N.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:()=>p(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Qt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(s,{value:m,onChange:e=>h(e.target.value),children:Yt.map(e=>(0,$.jsx)(c,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:g,onChange:e=>_(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:y,onChange:e=>x(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),D?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:D,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(B,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ee(D),children:[k?(0,$.jsx)(o,{className:`size-4`}):(0,$.jsx)(u,{className:`size-4`}),k?i.copied:i.copy]}),(0,$.jsxs)(B,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(D,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(d,{className:`size-4`}),i.open]})]})}):null,j?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:j}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Zt,{share:e,busy:T===e.id,t:i,onCopy:ee,onAction:F},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(B,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(B,{type:`button`,onClick:()=>void P(),disabled:S,children:[S?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(Te,{className:`size-4`}),S?i.creating:i.create]})]})]})]})})}function Zt(e){let t=(0,Z.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=z(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let f=n.stale&&!s?i.stale:s?i.inactive:i.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,$.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==p||t[16]!==g?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,y]}),t[14]=y,t[15]=p,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,$.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(u,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,$.jsxs)(B,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(d,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,$.jsxs)(B,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,$.jsxs)(B,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(_e,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,$.jsx)(B,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,$.jsxs)(B,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(je,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,$.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var $t={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},en={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},tn=()=>i(()=>import(`./block-editor-CE14CVOy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60])),nn=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([61,1,3,58,5,62])),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.BlockEditor}))),an=(0,Q.lazy)(()=>nn().then(e=>({default:e.MarkdownEditor})));function on(){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 sn(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:Ge},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Ie},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:f},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},onFocus:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},className:z(`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]=l,t[12]=r,t[13]=u):u=t[13],u}function cn(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=H(ln),h;t[0]===m?h=t[1]:(h=V(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(ct,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=H(e=>e.language),d=V(u).notes,f=V(u).automations.suggestions,p=a(),m=ae(e=>e.resolved)===`dark`,{openImage:g}=ot(),[_,v]=(0,Q.useState)(`wysiwyg`),[y,b]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[I,te]=(0,Q.useState)(!1),[L,ne]=(0,Q.useState)(!1),[R,B]=(0,Q.useState)(null),[ie,oe]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(null),le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(null),G=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),K=Ke(e=>e.setPageHeader),ye=Ke(e=>e.clearPageHeader),{data:q,mutate:J}=pe(e?[`note-detail`,e]:null,()=>N(e)),{data:be=[],mutate:xe}=pe(e?[`note-threads`,e]:null,()=>x(e),{revalidateOnFocus:!1}),Y=S!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{le.current=!1,A(``),C(null),b(null),ue.current=!1,ve.current=null},[e]),(0,Q.useEffect)(()=>{!q||le.current||(A(q.title??``),le.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||Y||ve.current===e)return;let t=window.requestAnimationFrame(()=>{_e.current?.focus(),l?.()});return ve.current=e,()=>window.cancelAnimationFrame(t)},[c,Y,q,e,l]);let Ce=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,we=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:z(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ze,i),children:(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),X=(0,Q.useCallback)(t=>{A(t),e&&(W.current=t,fe.current&&clearTimeout(fe.current),fe.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){T(!0);try{await h(e,{title:t}),await J(),n?.()}catch{}finally{T(!1)}}},600))},[e,J,n]),De=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:z(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:E||Ce||void 0,children:E||Ce}),w?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,w,Ce,E]),Oe=(0,Q.useCallback)(async(t=!1)=>{ne(!0),B(null);try{let n=await O(e,{forceNew:t});await J(),await xe(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){B(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[J,xe,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),je=(0,Q.useCallback)(async()=>{te(!0),B(null);try{await k(e),await J()}catch(e){B(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{te(!1)}},[J,e]),Me=(0,Q.useCallback)(()=>{b(y===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!I&&je()},[y,I,je,q?.aiDeep?.catalysis?.report]),Ne=(0,Q.useCallback)(()=>{let t=S?.markdown??U.current??q?.markdown??``,n=S?.title??E,r=Ae([n,t].filter(Boolean).join(`
3
-
4
- `));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:ge(r,u)}},[u,d.titlePlaceholder,q?.markdown,e,S,E]),Pe=(0,Q.useCallback)(async()=>{de.current&&clearTimeout(de.current),fe.current&&clearTimeout(fe.current),de.current=null,fe.current=null;let t=U.current,r=W.current;U.current=null,W.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return q??null;T(!0);try{let t=await h(e,i);return await J(t,{revalidate:!1}),n?.(),t}catch(e){return B(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`),null}finally{T(!1)}},[J,d.saveFailed,d.saveFailedHint,q,e,n]),Fe=(0,Q.useCallback)(async()=>{B(null);let e=await Pe();e&&(ce(e),oe(!0))},[Pe]),Ie=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:z(`flex items-center gap-2`,ze),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.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)(re,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Ee,{input:Ne,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Fe(),className:`inline-flex items-center gap-1.5 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`,children:[(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),u===`zh`?`分享`:`Share`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:Me,disabled:I,"aria-label":d.catalysisSectionTitle,className:z(`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`,y===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Ve,{className:`size-3.5`,"aria-hidden":!0}),I?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Oe(!1),disabled:L,className:z(`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)(tt,{className:`size-3.5`,"aria-hidden":!0}),L?d.openingChat:d.openChatButton]}),(0,$.jsx)(sn,{mode:_,onModeChange:v,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(y===`history`?null:`history`),"aria-label":d.history,className:z(`rounded-lg p-1.5 transition-colors`,y===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(ke,{className:`size-4`,"aria-hidden":!0})})]}),[I,Me,Oe,_,d.history,d.modeEdit,d.modePreview,d.modeSource,L,y,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,Ne,Fe,u]);(0,Q.useLayoutEffect)(()=>(K({startExtra:we,main:q?De:null,end:q?Ie:null}),()=>{o&&ye()}),[o,ye,Ie,De,we,q,K]);let Le=(0,Q.useCallback)(t=>{e&&(U.current=t,de.current&&clearTimeout(de.current),de.current=setTimeout(async()=>{let t=U.current;if(U.current=null,t!==null){T(!0),B(null);try{await h(e,{markdown:t}),await J(),n?.()}catch(e){B(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{T(!1)}}},600))},[e,J,d.saveFailed,d.saveFailedHint,n]),Re=(0,Q.useCallback)(t=>{D(e,t.timestamp).then(e=>{e&&C(e)})},[e]),Be=(0,Q.useCallback)(()=>{b(null),C(null)},[]),He=(0,Q.useCallback)(()=>{b(null),C(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{de.current&&clearTimeout(de.current),fe.current&&clearTimeout(fe.current);let t=U.current,n=W.current;U.current=null,W.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&h(e,r)},[e]),q===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(q===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:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.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:d.back})]});let Ue=Y?S.title??``:E,We=Y?S.markdown??``:q.markdown??``,Ge=new Date(q.createdAt).getTime(),qe=Number.isFinite(Ge)&&Date.now()-Ge<3600*1e3?(0,$.jsx)(Dt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.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)($.Fragment,{children:[(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:[R?(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:R}):null,(0,$.jsx)(Je,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Je,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:me,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(Pt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:Y?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ue&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ue}),We?(0,$.jsx)(ee,{noteId:e,content:We,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[_===`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:_e,type:`text`,value:E,onChange:e=>X(e.target.value),onCompositionStart:()=>{ue.current=!0},onCompositionEnd:()=>{ue.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ue.current&&!t.isComposing&&(e.preventDefault(),(me.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.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`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(rn,{initialContent:q.markdown??``,onChange:Le,noteId:e},`wysiwyg-${e}`)})})]}),_===`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:_e,type:`text`,value:E,onChange:e=>X(e.target.value),placeholder:d.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`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(an,{initialContent:q.markdown??``,onChange:Le,isDark:m},`source-${e}`)})})]}),_===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&g(t.currentSrc||t.src,t.alt)},children:[E&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:E}),q.markdown?(0,$.jsx)(ee,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:he,className:z(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!P&&`transition-[width] duration-300 ease-in-out`),style:{width:y?j:0},children:(0,$.jsxs)(`div`,{ref:G,className:`flex min-h-0 flex-1 flex-col`,style:{width:j},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),F(!0);let n=e.clientX,r=j,i=e.pointerId,a=0,o=j,s=j,c=()=>{a=0,s=o,y&&he.current?.style.setProperty(`width`,`${s}px`),G.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{}F(!1),M(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:z(`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`,P&&`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:y===`history`?(0,$.jsx)(Bt,{noteId:e,activeTimestamp:S?.timestamp??null,onSelect:Re,onClose:Be,onRestored:He}):y===`breakdown`?(0,$.jsx)(Vt,{noteId:e,note:q??null,catalyzing:I,onCatalyze:je,onClose:()=>b(null),noteThreads:be,openingChat:L,onOpenChat:()=>Oe(!1),onOpenNewChat:()=>Oe(!0)}):null})]})})]}),se?(0,$.jsx)(Xt,{open:ie,onOpenChange:oe,note:se}):null]})}var dn=3e4;function fn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function pn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let N=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||fn()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[M,c]),P=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=fn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{N()},dn)}catch{M(),l?.()}}},[M,c,l,y,N,C]),F=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),ee=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),F())},[F]),I=_||C,te=!!(s||c||p);return(0,$.jsxs)(`div`,{className:z(`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`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":I,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(he,{className:`size-4 fill-current`,"aria-hidden":!0})}):te?(0,$.jsxs)(it,{children:[(0,$.jsx)(Oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:I,className:`shrink-0 rounded-lg p-2 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":n,title:n,children:(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(X,{children:(0,$.jsxs)(ye,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(Y,{disabled:d,onSelect:s,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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(De,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(Y,{disabled:f,onSelect:()=>void 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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(Y,{onSelect: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`,children:[(0,$.jsx)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:ee,placeholder:e,"aria-label":e,rows:1,disabled:I,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto 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:!h.trim()||I||y,onClick:()=>void F(),"aria-label":t,title:t,className:z(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!I&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0})})]})}var mn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},hn=240,gn=320,_n=520,vn=560;function yn(e){if(globalThis.localStorage===void 0)return gn;try{let t=globalThis.localStorage.getItem(e);if(!t)return gn;let n=Number(t);return Number.isFinite(n)?n:gn}catch{return gn}}function bn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var xn={thought:et,todo:W,voice:Re,media:De,bookmark:ve,mixed:et,task:W};function Sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function wn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Tn({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:o,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=V(H(e=>e.language)).notes,g=!!ie(e=>e.token),[v,y]=(0,Q.useReducer)(Ce,mn),[b,x]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)(()=>yn(p)),[N,P]=(0,Q.useState)(!1),[F,ee]=(0,Q.useState)(!1),[I,te]=(0,Q.useState)(!1),[L,B]=(0,Q.useState)(null),[ae,U]=(0,Q.useState)(null),W=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[he]=(0,Q.useState)(()=>Date.now()),G=a(),ge=(0,Q.useCallback)(e=>{let t=W.current?.clientWidth??window.innerWidth,n=Math.max(hn,t-vn);return Math.max(hn,Math.min(Math.min(_n,n),e))},[]),_e=(0,Q.useCallback)(e=>{let t=ge(e);k(t),bn(p,t)},[ge,p]);(0,Q.useLayoutEffect)(()=>{k(e=>ge(e))},[ge]);let{data:ve,mutate:K,isLoading:ye}=pe((0,Q.useMemo)(()=>g?[`notes-list`,o,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[g,o,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>j({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:o,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),J=ye&&!ve,be=ve?.items??[],xe=ve?.total??0,Y=w.trim(),{data:Se,isLoading:we}=pe(g&&b&&Y?[`notes-search`,o,Y]:null,()=>j({search:Y,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Se?.items??[],Te=e?be.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{D(0)},[Y]),(0,Q.useEffect)(()=>{E>=X.length&&D(Math.max(0,X.length-1))},[E,X.length]),(0,Q.useEffect)(()=>{let e=()=>{K()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[K]);let Ee=Ke(e=>e.setPageHeader),De=Ke(e=>e.clearPageHeader),Oe=m.noteCount.replace(`{{count}}`,String(xe)),ke=!r&&xe===0&&u?u:Oe,Ae=m.searchDialogTitle,je=m.searchClose,Me=m.searchClear,Ne=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),className:z(`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`,ze),"aria-label":Ae,children:[(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ae})]}),[Ae]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:z(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??m.title}),Oe?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Oe}):null]}),end:Ne}),()=>De()):(De(),()=>De())},[De,g,Ne,l,n,m.title,Oe,e,Ee]);let Pe=(0,Q.useMemo)(()=>({justNow:m.justNow,minutesAgo:m.minutesAgo,today:m.today,yesterday:m.yesterday,daysAgo:m.daysAgo}),[m.justNow,m.minutesAgo,m.today,m.yesterday,m.daysAgo]),Fe=(0,Q.useMemo)(()=>[{id:`recent`,label:m.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:m.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:m.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:m.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:m.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:m.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:m.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:m.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:m.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[m.filterArchived,m.filterInbox,m.filterProcessed,m.kindBookmark,m.kindMedia,m.kindVoice,m.pinned,m.viewRecent,m.viewTasks]),Ie=Fe.find(e=>Cn(v,e))??Fe[0],Le=l??Ie.label,Re=(0,Q.useCallback)(async e=>{B(null);try{let n=o?await M({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await C(e,`web`);await K(),G(wn(t,n.id))}catch(e){throw B(`${m.quickCaptureFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`),e}},[t,K,m.quickCaptureFailed,m.quickCaptureFailedHint,G,o]),Be=(0,Q.useCallback)(async()=>{if(!I){te(!0),B(null);try{let e=await M({markdown:``,kind:`thought`,projectId:o,channel:`web`});y({type:`patch`,patch:mn}),await K(),U(e.id),G(wn(t,e.id))}catch(e){B(`${m.createBlankFailed}: ${e instanceof Error?e.message:m.createBlankFailedHint}`)}finally{te(!1)}}},[t,I,K,m.createBlankFailed,m.createBlankFailedHint,G,o]),Ve=(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{B(null),await S(t,`web`),await K()}catch(e){B(`${m.imageUploadFailed}: ${e instanceof Error?e.message:m.imageUploadFailedHint}`)}},e.click()},[K,m.imageUploadFailed,m.imageUploadFailedHint]),He=(0,Q.useCallback)(async(e,t)=>{try{B(null),await _(e,t,`web`),await K()}catch(e){B(`${m.voiceUploadFailed}: ${e instanceof Error?e.message:m.voiceUploadFailedHint}`)}},[K,m.voiceUploadFailed,m.voiceUploadFailedHint]),Ue=(0,Q.useCallback)(()=>{B(`${m.voiceCaptureFailed}: ${m.voiceCaptureFailedHint}`)},[m.voiceCaptureFailed,m.voiceCaptureFailedHint]),We=(0,Q.useCallback)(async(e,t)=>{await h(e,{pinned:t}),await K()},[K]),Ge=(0,Q.useCallback)(async e=>{await h(e,{status:`archived`}),await K()},[K]),qe=(0,Q.useCallback)(async e=>{await A(e),await K()},[K]),Je=(0,Q.useCallback)(e=>{G(wn(t,e))},[t,G]),Xe=(0,Q.useCallback)(e=>{G(wn(t,e)),x(!1)},[t,G]),Ze=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),D(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),D(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[E]??X[0];t&&Xe(t.id)}}},[E,Xe,X]),Qe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=me.current;t.setPointerCapture(e.pointerId),P(!0);let r=W.current?.clientWidth??window.innerWidth,i=Math.max(hn,r-vn),a=Math.min(_n,i),o=e=>Math.max(hn,Math.min(a,e)),s=e.clientX,c=o(O),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}P(!1),W.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),k(f),bn(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,O]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Be())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Be]);let $e=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),_e(O-16)):e.key===`ArrowRight`?(e.preventDefault(),_e(O+16)):e.key===`Home`?(e.preventDefault(),_e(hn)):e.key===`End`&&(e.preventDefault(),_e(_n))},[_e,O]);return g?(0,$.jsxs)(`div`,{ref:W,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${O}px`},children:[(0,$.jsxs)(`section`,{ref:me,className:z(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,F?`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":F?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[L?(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:L}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(s,{value:Ie.id,onChange:e=>{let t=Fe.find(t=>t.id===e.target.value);t&&y({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 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":m.libraryTitle,children:Fe.map(e=>(0,$.jsx)(c,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Le}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ke})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(!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":m.collapseNotesList,title:m.collapseNotesList,children:(0,$.jsx)(Ye,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Be,disabled:I,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":m.createBlankNote,title:m.createBlankShortcut,children:(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(!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":m.searchDialogTitle,title:m.searchDialogTitle,children:(0,$.jsx)(re,{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:J?(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))}):be.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(et,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Te?m.noteOutsideCurrentView:d??m.noNotes}),e&&!Te?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??m.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Te?(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:m.noteOutsideCurrentView}):null,be.map((t,n)=>{let r=n>0?gt(be[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[gt(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:z(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ht(t.createdAt,he,Pe)}),(0,$.jsx)(St,{note:t,selected:t.id===e,onPress:Je,onPin:We,onArchive:Ge,onDelete:qe,timeLabels:Pe,labels:{pin:m.pin,unpin:m.unpin,archive:m.archive,delete:m.delete,actions:m.noteActions,imageNote:m.imageNote,noText:m.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(pn,{placeholder:m.quickCapturePlaceholder,submitLabel:m.quickCaptureSubmit,actionsLabel:m.quickCaptureActions,imageLabel:m.quickCaptureImage,voiceLabel:m.quickCaptureVoice,stopRecordingLabel:m.stopRecording,onCapture:Re,onImagePick:i?Ve:void 0,onVoiceCapture:i?He:void 0,onVoiceError:Ue,recordingLabel:m.recording,discussionCaptureLabel:m.discussionCapture.title,onDiscussionCapture:()=>q(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.resizeNotesList,"aria-valuemin":hn,"aria-valuemax":_n,"aria-valuenow":Math.round(O),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>_e(gn),onKeyDown:$e,title:m.resizeNotesList,className:z(`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`,F?`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:z(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:z(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[F?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(!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":m.expandNotesList,title:m.expandNotesList,children:(0,$.jsx)(Ye,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(cn,{noteId:e,onBack:()=>G(t),onSaved:()=>void K(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>x(!0),autoFocus:e===ae,onAutoFocusConsumed:()=>U(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)(et,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:m.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Be,disabled:I,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)(ne,{className:`size-4`,"aria-hidden":!0}),I?m.creatingBlankNote:m.createBlankNote]})]})})]}),(0,$.jsx)(fe,{open:b,onOpenChange:x,children:(0,$.jsxs)(le,{children:[(0,$.jsx)(oe,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ue,{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)(de,{className:`text-sm font-semibold text-fg`,children:Ae}),(0,$.jsx)(se,{className:`sr-only`,children:m.searchPlaceholder}),(0,$.jsx)(ce,{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":je,children:(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(re,{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:w,onChange:e=>T(e.target.value),onKeyDown:Ze,placeholder:m.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`}),w?(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(``),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":Me,children:(0,$.jsx)(R,{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:Y?we&&!Se?(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)(et,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.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:m.searchResultsCount.replace(`{{count}}`,String(Se?.total??X.length))}),X.map((e,t)=>{let n=xn[e.kind]||et,r=Sn(e,{imageNote:m.imageNote,noText:m.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>D(t),className:z(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===E?`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:mt(e.updatedAt,he,Pe)})]}),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)(re,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(et,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.needToken})]})}export{ot as n,Tn as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./createLucideIcon-DPHK1VkS.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{i as c,n as l}from"./dist-CxGUk8J-.js";import{a as u,c as d,g as f,h as p,i as m,l as h,n as g,o as _,p as v,r as y,t as b,u as x}from"./Combination-14nmIgxH.js";import{a as S,i as C,n as w,r as T,t as E}from"./dist-DaxPZj9e.js";import{a as D,s as O,t as k}from"./settings-shell-dialog-layer-BU3UuiJr.js";var A=a(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ee=r(),te=t({Anchor:()=>pe,Arrow:()=>he,Close:()=>me,Content:()=>Z,Popover:()=>z,PopoverAnchor:()=>B,PopoverArrow:()=>q,PopoverClose:()=>K,PopoverContent:()=>G,PopoverPortal:()=>U,PopoverTrigger:()=>V,Portal:()=>X,Root:()=>J,Trigger:()=>Y,createPopoverScope:()=>F}),j=e(n(),1),M=i(),N=`Popover`,[P,F]=p(N,[S]),I=S(),[L,R]=P(N),z=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=I(t),c=j.useRef(null),[l,u]=j.useState(!1),[d,f]=y({prop:r,defaultProp:i??!1,onChange:a,caller:N});return(0,M.jsx)(C,{...s,children:(0,M.jsx)(L,{scope:t,contentId:_(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:j.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:j.useCallback(()=>u(!0),[]),onCustomAnchorRemove:j.useCallback(()=>u(!1),[]),modal:o,children:n})})};z.displayName=N;var ne=`PopoverAnchor`,B=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ne,n),a=I(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return j.useEffect(()=>(o(),()=>s()),[o,s]),(0,M.jsx)(E,{...a,...r,ref:t})});B.displayName=ne;var re=`PopoverTrigger`,V=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(re,n),a=I(n),o=c(t,i.triggerRef),s=(0,M.jsx)(v.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fe(i.open),...r,ref:o,onClick:f(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,M.jsx)(E,{asChild:!0,...a,children:s})});V.displayName=re;var H=`PopoverPortal`,[ie,ae]=P(H,{forceMount:void 0}),U=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=R(H,t);return(0,M.jsx)(ie,{scope:t,forceMount:n,children:(0,M.jsx)(m,{present:n||a.open,children:(0,M.jsx)(u,{asChild:!0,container:i,children:r})})})};U.displayName=H;var W=`PopoverContent`,G=j.forwardRef((e,t)=>{let n=ae(W,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=R(W,e.__scopePopover);return(0,M.jsx)(m,{present:r||a.open,children:a.modal?(0,M.jsx)(se,{...i,ref:t}):(0,M.jsx)(ce,{...i,ref:t})})});G.displayName=W;var oe=l(`PopoverContent.RemoveScroll`),se=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(null),i=c(t,r),a=j.useRef(!1);return j.useEffect(()=>{let e=r.current;if(e)return g(e)},[]),(0,M.jsx)(b,{as:oe,allowPinchZoom:!0,children:(0,M.jsx)(le,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:f(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:f(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ce=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(!1),i=j.useRef(!1);return(0,M.jsx)(le,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),le=j.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=R(W,n),m=I(n);return h(),(0,M.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(x,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,M.jsx)(T,{"data-state":fe(p.open),role:`dialog`,id:p.contentId,...m,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ue=`PopoverClose`,K=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ue,n);return(0,M.jsx)(v.button,{type:`button`,...r,ref:t,onClick:f(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=ue;var de=`PopoverArrow`,q=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=I(n);return(0,M.jsx)(w,{...i,...r,ref:t})});q.displayName=de;function fe(e){return e?`open`:`closed`}var J=z,pe=B,Y=V,X=U,Z=G,me=K,he=q;function ge(e,t=!1){if(!t)return k;switch(e){case`modal`:return D;case`page`:return O;default:return`z-50`}}var Q=(0,j.createContext)({layer:`default`,portalContainer:null});function _e(e,t){return e===`modal`||t===`modal`?`modal`:e===`page`||t===`page`?`page`:`default`}function ve(e){let t=(0,ee.c)(9),{layer:n,portalContainer:r,children:i}=e,a=(0,j.useContext)(Q),o;t[0]!==n||t[1]!==a.layer?(o=_e(a.layer,n),t[0]=n,t[1]=a.layer,t[2]=o):o=t[2];let s=o,c=r??a.portalContainer,l;t[3]!==s||t[4]!==c?(l={layer:s,portalContainer:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==l?(u=(0,M.jsx)(Q.Provider,{value:l,children:i}),t[6]=i,t[7]=l,t[8]=u):u=t[8],u}function ye(){return(0,j.useContext)(Q).layer}function be(){return(0,j.useContext)(Q).portalContainer}function xe({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:a=!1,disabledValues:c,disabled:l,id:u,ariaLabel:d,ariaLabelledBy:f,title:p,triggerClassName:m,contentClassName:h,side:g=`bottom`,align:_=`start`,onChange:v}){let[y,b]=(0,j.useState)(!1),x=ye(),S=be(),C=ge(x,S!==null),w=t.find(t=>t.value===e)?.label??(e?`${e} · unavailable`:n),T;return(0,M.jsxs)(J,{open:y,onOpenChange:b,children:[(0,M.jsx)(Y,{asChild:!0,children:(0,M.jsxs)(`button`,{id:u,type:`button`,"aria-label":d,"aria-labelledby":f,title:p,disabled:l,className:s(`box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-subtle px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:border-edge-strong`,l&&`cursor-not-allowed opacity-50 hover:border-edge`,m),children:[(0,M.jsx)(`span`,{className:s(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:w}),(0,M.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,M.jsx)(X,{container:S??void 0,children:(0,M.jsx)(Z,{side:g,align:_,sideOffset:4,className:s(C,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] overflow-hidden rounded-lg border border-edge bg-surface-panel p-1 shadow-popover outline-none`,h),children:(0,M.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[r?(0,M.jsxs)(`button`,{type:`button`,disabled:a,className:s(`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,a&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{a||(v(``),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,t.map(t=>{let n=t.disabled===!0||c?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==T;return T=t.group,(0,M.jsxs)(j.Fragment,{children:[r?(0,M.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,M.jsxs)(`button`,{type:`button`,disabled:n,className:s(`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(v(t.value),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]})]},`${t.group??``}:${t.value}`)})]})})})]})}function $(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map($).join(``):(0,j.isValidElement)(e)?$(e.props.children):``}function Se(e,t){let n=[];return j.Children.forEach(e,e=>{if(!(0,j.isValidElement)(e))return;if(e.type===j.Fragment){n.push(...Se(e.props.children,t));return}if(e.type===we){let t=e.props;n.push(...Se(t.children,$(t.label)));return}if(e.type!==Ce)return;let r=e.props,i=$(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function Ce(e){return null}function we(e){return null}function Te(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function Ee(e){let t=(0,ee.c)(66),n,r,i,a,o,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:o,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,j.useId)(),g=m==null?``:String(m),_,v,y,b,x,S,C,w,T,E;if(t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==g){let e=Se(r);b=e.find(Oe),v=b!==void 0,y=b?.label||u||``,w=o||void 0,t[31]===i?T=t[32]:(T=Te(i),t[31]=i,t[32]=T),E=d.name,_=xe,x=c??h,S=g,C=e.filter(De),t[13]=r,t[14]=i,t[15]=o,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else _=t[21],v=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D=u??y,O=b?.disabled===!0,k=d[`aria-label`],A=d[`aria-labelledby`],te=d.title,N;t[33]!==i||t[34]!==p?(N=s(i,p),t[33]=i,t[34]=p,t[35]=N):N=t[35];let P;t[36]===l?P=t[37]:(P=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=P);let F;t[38]!==_||t[39]!==n||t[40]!==v||t[41]!==a||t[42]!==o||t[43]!==y||t[44]!==d.title||t[45]!==f||t[46]!==x||t[47]!==A||t[48]!==N||t[49]!==P||t[50]!==S||t[51]!==C||t[52]!==D||t[53]!==O||t[54]!==k?(F=(0,M.jsx)(_,{id:x,value:S,options:C,placeholder:D,allowEmpty:v,emptyLabel:y,emptyDisabled:O,disabled:o,ariaLabel:k,ariaLabelledBy:A,title:te,side:f,align:n,triggerClassName:N,contentClassName:a,onChange:P}),t[38]=_,t[39]=n,t[40]=v,t[41]=a,t[42]=o,t[43]=y,t[44]=d.title,t[45]=f,t[46]=x,t[47]=A,t[48]=N,t[49]=P,t[50]=S,t[51]=C,t[52]=D,t[53]=O,t[54]=k,t[55]=F):F=t[55];let I;t[56]!==o||t[57]!==d.name||t[58]!==g?(I=(0,M.jsx)(`input`,{name:d.name,value:g,readOnly:!0,hidden:!0,disabled:o}),t[56]=o,t[57]=d.name,t[58]=g,t[59]=I):I=t[59];let L;return t[60]!==F||t[61]!==I||t[62]!==w||t[63]!==T||t[64]!==E?(L=(0,M.jsxs)(`div`,{"aria-disabled":w,className:T,"data-select-name":E,children:[F,I]}),t[60]=F,t[61]=I,t[62]=w,t[63]=T,t[64]=E,t[65]=L):L=t[65],L}function De(e){return e.value!==``}function Oe(e){return e.value===``}export{ye as a,he as c,X as d,J as f,A as h,ve as i,me as l,te as m,Ee as n,be as o,Y as p,Ce as r,ge as s,xe as t,Z as u};
@@ -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,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,t as h,u as g}from"./popover-select-CccGri5Y.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S}from"./markdown-view-RxNHwlNo.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-CSEbl4zT.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-BMdD0LWk.js";import{n as A,r as j,s as M}from"./locale-store-CXhjfe4q.js";import{t as N}from"./electron-env-DH5wF8X8.js";import{a as P,c as F,i as I,n as L,o as R,r as z,s as ee,t as te}from"./dist-BPoKqzeH.js";import{$a as B,$c as V,$i as H,$n as U,Aa as W,Al as ne,Bs as G,Ca as re,Cs as ie,Da as ae,Ea as K,Fc as oe,Ga as se,Ha as ce,Il as q,Is as le,L as ue,Ma as de,Ml as fe,Na as pe,Nl as me,Nn as he,Oa as ge,Ol as _e,Pc as ve,Pl as ye,Q as be,Qc as xe,Qi as Se,Ql as Ce,R as we,Sa as Te,Sc as Ee,Ta as De,U as Oe,Uc as ke,Us as Ae,V as je,Wc as Me,Ws as Ne,Xc as Pe,Xi as Fe,Yi as Ie,Z as Le,Zl as Re,_a as ze,_c as Be,_l as Ve,_s as He,aa as Ue,al as We,ba as Ge,bi as Ke,ea as qe,el as Je,eo as Ye,fc as Xe,fs as Ze,ga as Qe,gt as $e,ia as et,il as tt,it as nt,ja as rt,jn as it,js as at,ka as ot,kc as st,ls as ct,ml as lt,mr as ut,na as dt,nc as ft,oc as pt,oo as mt,or as ht,ra as gt,ta as _t,tc as vt,ts as yt,tu as bt,va as xt,wa as St,xa as Ct,xl as wt,ya as Tt,zs as Et}from"./index-0xQO5B_Q.js";import{t as Dt}from"./notes-workbench-9cgh77VH.js";import{n as Ot,t as kt}from"./use-autosave-C4YcEiP9.js";import{t as At}from"./page-tabs-BaEQMYm_.js";import{t as jt}from"./directory-picker-path-field-B9qoxDcn.js";import{t as Mt}from"./date-picker-DGCfX4tK.js";import{t as Nt}from"./automations-workspace-BpvD54D6.js";import{i as Pt,p as Ft,s as It}from"./skills-page.utils-kBGr8opZ.js";import{t as Lt}from"./dependency-picker-DHDa4ht1.js";import{c as Rt,l as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./style-TIDOdKy0.js";var J=e(t(),1),Wt=n();function Gt(e){return M(j(`/api/projects/${encodeURIComponent(e)}/skills`))}function Kt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function qt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Jt(e,t){let n=new FormData;return n.set(`file`,t),M(j(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Yt(e,t,n={}){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Xt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Zt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function Qt({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)([]),[o,s]=(0,J.useState)([]),[c,d]=(0,J.useState)([]),[f,m]=(0,J.useState)([]),[_,v]=(0,J.useState)(``),[b,x]=(0,J.useState)(null),[S,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!0),[j,M]=(0,J.useState)(!1),[N,F]=(0,J.useState)(null),[I,B]=(0,J.useState)(``),[V,H]=(0,J.useState)(null),[U,W]=(0,J.useState)(null),[ne,G]=(0,J.useState)(``),[re,ae]=(0,J.useState)(1),[K,oe]=(0,J.useState)(null),[ce,q]=(0,J.useState)(!1),[ue,de]=(0,J.useState)(``),[pe,he]=(0,J.useState)(``),ge=(0,J.useRef)(null),_e=(0,J.useCallback)(async()=>{A(!0),B(``);try{let t=await Gt(e);r(t.items),a(t.inheritedItems),s(t.sources),d(t.diagnostics)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,J.useEffect)(()=>{_e()},[_e]),(0,J.useEffect)(()=>{let t=!1;return De(e).then(e=>{t||m(e)}).catch(()=>{t||m([])}),()=>{t=!0}},[e]),(0,J.useEffect)(()=>{if(!_){x(null);return}let e=f.find(e=>e.key===_),t=!1;return x(null),B(``),O(!0),ut(e?.agentId??e?.routing?.agentId,_,!0).then(e=>{t||x(e)}).catch(e=>{t||B(e instanceof Error?e.message:String(e))}).finally(()=>{t||O(!1)}),()=>{t=!0}},[_,f]),(0,J.useEffect)(()=>{if(V!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{q(!0),de(``),Ft({q:ne,page:re,pageSize:8,sort:`downloads`,signal:e.signal}).then(oe).catch(t=>{e.signal.aborted||de(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||q(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[V,re,ne]);async function ve(e,t){M(!0),F(t??null),B(``);try{await e(),H(null),he(``),await _e()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1),F(null)}}async function be(t){B(``);try{W((await Kt(e,t)).skill)}catch(e){B(e instanceof Error?e.message:String(e))}}async function xe(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){M(!0);try{await Zt(e,n.directoryId),await _e()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function Se(){M(!0),B(``);try{await qt(e,!0),await _e()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}let Ce=o.find(e=>e.origin===`agents-workspace`),we=new Map(b?.skills.map(e=>[e.name,e]));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)(u,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(D,{type:`button`,children:[(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(g,{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)(nn,{icon:ie,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>H(`marketplace`)}),(0,Y.jsx)(nn,{icon:Pe,title:t.source,hint:t.sourceHint,onClick:()=>H(`source`)}),(0,Y.jsx)(nn,{icon:Ze,title:t.upload,hint:t.uploadHint,onClick:()=>ge.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:ge,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ve(()=>Jt(e,n)),t.target.value=``}})]}),o.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,Y.jsx)(`span`,{className:`text-fg-subtle`,children:rn(t,e.state)}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),I?(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:I}):null,Ce?.state===`untrusted`?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(Ee,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Y.jsxs)(D,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void Se(),children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),j?t.trusting:t.trustAction]})]}):null,c.some(e=>e.type!==`skipped`)?(0,Y.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,Y.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:c.filter(e=>e.type!==`skipped`).map((e,t)=>(0,Y.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,f.length?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S?t.sessionLoading:_?b?.agentId:t.sessionViewAll})]}),(0,Y.jsx)(h,{value:_,options:f.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:v})]}):null,k?(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)(se,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)($t,{title:t.localTitle,items:n,copy:t,busy:j,availabilityByName:we,onPreview:be,onRemove:xe}):(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})]}),!k&&i.length?(0,Y.jsx)($t,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:j,availabilityByName:we,onPreview:be,onRemove:xe}):null,(0,Y.jsx)(te,{open:V!==null,onOpenChange:e=>{e||H(null)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(z,{className:E(`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`,V===`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)(ee,{className:`text-base font-semibold text-fg`,children:V===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(T,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:V===`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)(w,{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:ne,onChange:e=>{G(e.target.value),ae(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),ue?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:ue}):null,ce&&!K?(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)(se,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=Pt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=N===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)(It,{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)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(D,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:j||o,onClick:()=>void ve(()=>Yt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):ce?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.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(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ce||re<=1,onClick:()=>ae(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(me,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ce||re>=K.meta.totalPages,onClick:()=>ae(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(fe,{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:pe,onChange:e=>he(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)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(D,{type:`button`,disabled:j||!pe.trim(),onClick:()=>void ve(()=>Xt(e,pe.trim())),children:j?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(te,{open:!!U,onOpenChange:e=>{e||W(null)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:U?.name}),(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(T,{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:U?.bodyMarkdown})]})]})})]})}function $t(e){let t=(0,Wt.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,Y.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,Y.jsxs)(`article`,{className:E(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(bt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h4`,{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.directoryId}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:en(a,e.origin)}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Y.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,Y.jsx)(`span`,{className:E(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:tn(a,t)}):null]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Y.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Y.jsx)(He,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,Y.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function en(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function tn(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function nn(e){let t=(0,Wt.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)(d,{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}function rn(e,t){switch(t){case`active`:return e.sourceStateActive;case`missing`:return e.sourceStateMissing;case`disabled`:return e.sourceStateDisabled;case`untrusted`:return e.sourceStateUntrusted;case`invalid`:return e.sourceStateInvalid}}var an=[`backlog`,`ready`,`active`,`review`,`closed`];function on(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function sn(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function cn(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function ln(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 un(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=ln(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 dn(e,t){let{incoming:n}=ln(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).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 fn(e,t){let{incoming:n,outgoing:r}=ln(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 pn={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function mn(e){let t=(0,Wt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=pn[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=E(`group 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]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Ht,{type:`target`,position:zt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(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]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(ke,{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]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Ht,{type:`source`,position:zt.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,Y.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var hn={taskNode:mn};function gn(e){let t=(0,Wt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),_;t[0]!==r||t[1]!==n?(_=dn(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Z),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(Sn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,O;t[15]!==T||t[16]!==x?(O=un(x,T),t[15]=T,t[16]=x,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==T?(A=f?fn(f,T):void 0,t[18]=f,t[19]=T,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=x.find(M),P;t[23]===x?P=t[24]:(P=new Map(x.map(xn)),t[23]=x,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==x){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=x.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=x,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==T){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Rt.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]=j,t[39]=F,t[40]=e):e=t[40],R=T.map(e),t[34]=j,t[35]=F,t[36]=T,t[37]=R}else R=t[37];let z=R,ee,te;t[41]!==f||t[42]!==C?(ee=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=ee,t[44]=te):(ee=t[43],te=t[44]),(0,J.useEffect)(ee,te);let B,V;t[45]!==z||t[46]!==m?(B=()=>{m&&!z.some(e=>e.id===m)&&h(void 0)},V=[z,m],t[45]=z,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,J.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==x.length?(U=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=U):U=t[53],(0,J.useEffect)(H,U);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let ne=W,G;t[56]!==r||t[57]!==o?(G=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(X);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let re=G,ie;t[59]!==r||t[60]!==o||t[61]!==m?(ie=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(bn)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ie):ie=t[62];let ae=ie,K;t[63]===a.connectHint?K=t[64]:(K=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=K);let oe=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(yn),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,q;t[66]!==u||t[67]!==oe||t[68]!==ce?(q=(0,Y.jsx)(D,{type:`button`,variant:oe,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=oe,t[68]=ce,t[69]=q):q=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(vn),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,Y.jsx)(tt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==ae||t[77]!==m?(pe=m?(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ae,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ae,t[77]=m,t[78]=pe):pe=t[78];let me;t[79]!==q||t[80]!==de||t[81]!==fe||t[82]!==pe?(me=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[q,de,fe,pe]}),t[79]=q,t[80]=de,t[81]=fe,t[82]=pe,t[83]=me):me=t[83];let he;t[84]!==K||t[85]!==me?(he=(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:[K,me]}),t[84]=K,t[85]=me,t[86]=he):he=t[86];let ge=x.length>0?(0,Y.jsxs)(`div`,{className:E(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Vt,{nodes:L,edges:z,nodeTypes:hn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:re,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ut,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Bt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(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.phases[N.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.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(N.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(_n)})]}):null,(0,Y.jsxs)(s,{to:it(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(b,{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}),_e;return t[87]!==he||t[88]!==ge?(_e=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[he,ge]}),t[87]=he,t[88]=ge,t[89]=_e):_e=t[89],_e}function _n(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function vn(e){return!e}function yn(e){return!e}function bn(e){return e.dependencyTaskId}function X(e){return e.dependencyTaskId}function xn(e){return[e.id,e]}function Sn(e){return e.id}function Z(e){return e.phase!==`closed`}function Cn({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,c]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,J.useState)(!!e.quietHours),[d,p]=(0,J.useState)(e.quietHours?.startHour??22),[h,g]=(0,J.useState)(e.quietHours?.endHour??8),[_,v]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),b(e.allowedActions.includes(`create_project_task`))},[e]);let E=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,Y.jsxs)(te,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,Y.jsx)(F,{asChild:!0,children:(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,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:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(ee,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(m,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,Y.jsx)(D,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void E(),children:x?t.saving:t.save})]})]})]})]})]})}function wn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Tn={backlog:_e,ready:_e,active:st,review:ct,closed:_},Q={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function En(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Dn(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function On(e){let t=(0,Wt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=cn(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:wt,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=An,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=it(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=E(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=E(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Y.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=E(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,Y.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg 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)(ke,{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(kn).join(`、`)})]}):n.attention[0]?(0,Y.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Y.jsx)(ne,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,Y.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Y.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,Y.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,En(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Y.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Dn(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Y.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,Y.jsx)(st,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Y.jsxs)(`span`,{className:E(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,Y.jsx)(q,{className:`size-3`,"aria-hidden":!0}),Ke(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,Y.jsx)(q,{className:`size-3`,"aria-hidden":!0}),Ke(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,Y.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,Y.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,Y.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==D?(z=(0,Y.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=D,t[82]=z):z=t[82],z}function kn(e){return e.title}function An(e){e.preventDefault(),e.stopPropagation()}function jn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let h=(0,J.useRef)(null),g=(0,J.useRef)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(`board`),[T,O]=(0,J.useState)(!1),[j,M]=(0,J.useState)(()=>crypto.randomUUID()),[N,F]=(0,J.useState)(``),[B,V]=(0,J.useState)(`normal`),[H,U]=(0,J.useState)(``),[W,ne]=(0,J.useState)([]),[G,re]=(0,J.useState)(!1),[ie,ae]=(0,J.useState)(null),K=nt({chat:k(A(e=>e.language)).chat}),oe=on(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=oe[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=sn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},le=async e=>{e.preventDefault();let t=N.trim();if(!(!t||G)){re(!0),ae(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:j,objective:t,priority:B,dependsOnTaskIds:W,attachments:K.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),F(``),V(`normal`),U(``),ne([]),K.clearAttachments(),M(crypto.randomUUID()),O(!1)}catch(e){ae(e instanceof Error?e.message:i.createFailed)}finally{re(!1)}}},ue=()=>{M(crypto.randomUUID()),F(``),V(`normal`),U(``),ne([]),K.clearAttachments(),ae(null),O(!0)};(0,J.useImperativeHandle)(p,()=>({openCreate:ue})),(0,J.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,J.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,J.useCallback)(e=>{if(e.button!==0||wn(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),pe=(0,J.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(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:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(Cn,{policy:n,copy:i.monitoring,onSave:l}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:E(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,Y.jsx)(`div`,{ref:h,className:E(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:pe,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:an.map(t=>{let n=Tn[t],a=oe[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||sn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Y.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-md px-2 py-1`,Q[t]),children:[(0,Y.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`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.map(e=>(0,Y.jsx)(On,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(gn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Y.jsx)(te,{open:T,onOpenChange:e=>{G||O(e)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void le(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:i.objective}),(0,Y.jsxs)(`div`,{className:E(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,K.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||K.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||K.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),K.setIsDragging(!1),G||K.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:N,onChange:e=>{F(e.target.value),ae(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,Y.jsx)($e,{attachments:K.attachments,topPadded:!1,onRemove:e=>{G||K.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)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>K.fileInputRef.current?.click(),children:[(0,Y.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:K.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{K.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:i.priority}),(0,Y.jsx)(f,{value:B,onChange:e=>V(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(m,{value:e,children:i.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:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Mt,{className:`min-h-10 bg-surface-base`,value:H,onChange:U,disabled:G,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(Lt,{candidates:se,selectedIds:W,disabled:G,onChange:ne,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ie?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ie}):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)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:i.cancel})}),(0,Y.jsx)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!N.trim(),children:G?i.creating:i.create})]})]})]})]})}),x?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}function Mn({workspacePath:e,className:t}){let n=k(A(e=>e.language)).workspace,[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)([]),[s,c]=(0,J.useState)([]),[d,f]=(0,J.useState)(!1),m=N()&&!!e.trim()&&!!window.electronAPI?.shell?.openPath,h=(0,J.useCallback)(async()=>{let t=window.electronAPI?.shell;if(!t?.getOpenWithAppsForPath||!e.trim()){o([]),c([]);return}try{let n=await t.getOpenWithAppsForPath(e);o(n.recommended.map(e=>({name:e.name,path:e.path}))),c(n.recent.map(e=>({name:e.name,path:e.path})))}catch{o([]),c([])}},[e]);(0,J.useEffect)(()=>{h()},[h]);let _=(0,J.useCallback)(e=>{Ue(`warning`,e||n.openLocationFailed,void 0,{duration:4e3})},[n.openLocationFailed]),y=(0,J.useCallback)(async()=>{let t=window.electronAPI?.shell;if(!(!t?.openPath||!e)){f(!0);try{let n=await t.openPath(e);n.ok===!1&&_(n.error)}finally{f(!1),i(!1)}}},[_,e]),b=(0,J.useCallback)(async t=>{let n=window.electronAPI?.shell;if(!(!n?.openPathWithApp||!e)){f(!0);try{let r=await n.openPathWithApp(e,t);r.ok===!1?_(r.error):h()}finally{f(!1),i(!1)}}},[h,_,e]),x=(0,J.useCallback)(async()=>{let t=window.electronAPI?.shell;if(!(!t?.chooseAppAndOpenPath||!e)){f(!0);try{let n=await t.chooseAppAndOpenPath(e);n.ok===!1&&n.code!==`CANCELED`&&_(n.error),n.ok&&h()}finally{f(!1),i(!1)}}},[h,_,e]),S=(0,J.useCallback)(async()=>{let t=await O(e);Ue(t?`success`:`warning`,t?n.pathCopied:n.copyPathFailed,void 0,{duration:t?2500:4e3}),i(!1)},[n.copyPathFailed,n.pathCopied,e]);if(!m)return null;let C=`flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm text-fg hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50`,w=a[0]??s[0],T=w?a.filter(e=>e.path!==w.path):a,j=w?s.filter(e=>e.path!==w.path):s;return(0,Y.jsxs)(u,{open:r,onOpenChange:e=>{i(e),e&&h()},children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(D,{variant:`ghost`,className:E(`min-w-0 max-w-40 shrink rounded-md px-2 py-1.5 text-xs`,t),"aria-label":n.openLocation,title:n.openLocation,children:[(0,Y.jsx)(Xe,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`truncate`,children:w?.name??n.openLocation}),(0,Y.jsx)(ye,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(g,{align:`end`,side:`bottom`,sideOffset:6,className:`z-50 w-60 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover outline-none`,children:[w?(0,Y.jsxs)(`button`,{type:`button`,disabled:d,className:C,title:w.path,onClick:()=>void b(w.path),children:[(0,Y.jsx)(Xe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`truncate`,children:w.name})]}):null,(0,Y.jsx)(`div`,{className:E(w&&`border-t border-edge pt-1`),children:(0,Y.jsxs)(`button`,{type:`button`,disabled:d,className:C,onClick:()=>void y(),children:[(0,Y.jsx)(Je,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),n.openInFileManager]})}),T.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`border-t border-edge px-2.5 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.recommendedApps}),T.map(e=>(0,Y.jsxs)(`button`,{type:`button`,disabled:d,className:C,title:e.path,onClick:()=>void b(e.path),children:[(0,Y.jsx)(Xe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))]}):null,j.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`border-t border-edge px-2.5 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.recentApps}),j.map(e=>(0,Y.jsxs)(`button`,{type:`button`,disabled:d,className:C,title:e.path,onClick:()=>void b(e.path),children:[(0,Y.jsx)(Xe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))]}):null,(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:d,className:C,onClick:()=>void x(),children:[(0,Y.jsx)(Xe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),n.chooseApp]}),(0,Y.jsxs)(`button`,{type:`button`,className:C,onClick:()=>void S(),children:[(0,Y.jsx)(v,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),n.copyPath]})]})]})})]})}var Nn=new Set([{id:`overview`,icon:oe},{id:`tasks`,icon:lt},{id:`automations`,icon:yt},{id:`files`,icon:xe},{id:`notes`,icon:We},{id:`skills`,icon:at},{id:`sessions`,icon:Be},{id:`progress`,icon:Me},{id:`settings`,icon:Et}].map(e=>e.id)),Pn=`xopc.projectFiles.panelWidthPx`,Fn=320,$=220,In=560;function Ln(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 Rn(e){return Math.min(In,Math.max($,Math.round(e)))}function zn(){try{let e=window.localStorage.getItem(Pn);if(e==null)return Fn;let t=Number.parseInt(e,10);return Number.isFinite(t)?Rn(t):Fn}catch{return Fn}}function Bn(e){try{window.localStorage.setItem(Pn,String(Rn(e)))}catch{}}function Vn(e){return!!(e&&Nn.has(e))}function Hn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Un(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ke(n)}function Wn(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 Gn(e){let t=(0,Wt.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 Kn(e=!1){return E(`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 qn(e){let t=(0,Wt.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=E(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Jn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Yn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Xn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Zn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Qn(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 $n(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function er(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 tr(e){let t=e.sourceChannel?.trim();if(t)return nr(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 nr(r||``)}function nr(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function rr(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 ir(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 ar(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:ar(e.children,t,n)}:e)}function or({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,J.useState)(!1),[d,f]=(0,J.useState)([e]),[m,h]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(!1),[T,O]=(0,J.useState)(`new`),[k,A]=(0,J.useState)(``),[j,M]=(0,J.useState)(``),[N,F]=(0,J.useState)(!1),[B,H]=(0,J.useState)(null),[U,W]=(0,J.useState)(null),ne=(0,J.useCallback)(async()=>{v(!0),b(null);try{let t=await K({limit:100});f(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){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,J.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{o&&ne()},[ne,o]);let G=(0,J.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Jn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Yn(t)-Yn(e))},[e.id,d,m]),re=e=>t.statuses[e.status]??e.status,ie=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ae=e=>{O(e),A(``),M(``),H(null),S(!0),s(!1)},oe=(0,J.useCallback)(async(e={})=>{let t=j.trim(),n=k.trim()||(T===`directory`?Xn(t):``);if(n){F(!0),H(null),W(null);try{let r=await ze({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),A(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Zn(e);t?(W(t),S(!1)):H(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[T,k,i,j]),se=(0,J.useCallback)(e=>{e.preventDefault(),oe()},[oe]),ce=(0,J.useCallback)(()=>{oe({createWorkspaceRoot:!0})},[oe]),q=(0,J.useCallback)(()=>{W(null),S(!0)},[]),le=e=>{M(e),T===`directory`&&!k.trim()&&A(Xn(e))},ue=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:E(`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:E(`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:ie(e)})]}),(0,Y.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Wn(e.status)),children:re(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(u,{open:o,onOpenChange:s,children:[(0,Y.jsx)(p,{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:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Wn(e.status)),children:re(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(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)(l,{children:(0,Y.jsxs)(g,{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)(w,{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:m,onChange:e=>h(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}),ue(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}),y?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,G.map(e=>ue(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:()=>ae(`new`),children:[(0,Y.jsx)(C,{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:()=>ae(`directory`),children:[(0,Y.jsx)(xe,{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)(Et,{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)(te,{open:x,onOpenChange:e=>!N&&S(e),children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:T===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm text-fg-muted`,children:T===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:se,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:[B?(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:B}):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:k,onChange:e=>A(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)(jt,{value:j,onChange:le,disabled:N,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)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:N,children:n.cancel})}),(0,Y.jsxs)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:N||!(k.trim()||T===`directory`&&Xn(j)),children:[(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(te,{open:!!U,onOpenChange:e=>{e||W(null)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:U?Hn(n.workspaceMissingDescription,{workspace:U}):null})]}),U?(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)(xe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:U})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:q,disabled:N,children:n.workspaceMissingBack}),(0,Y.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ce,disabled:N,children:[(0,Y.jsx)(V,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function sr(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=A(e=>e.language),u=k(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=mt(e=>e.setPageHeader),_=mt(e=>e.clearPageHeader),[y,b]=(0,J.useState)(null),[j,M]=(0,J.useState)(null),[N,F]=(0,J.useState)([]),[G,ie]=(0,J.useState)(``),[K,q]=(0,J.useState)([]),[le,fe]=(0,J.useState)(0),[me,_e]=(0,J.useState)(!1),[ve,ye]=(0,J.useState)(!1),[Ee,ke]=(0,J.useState)(!1),[Re,ze]=(0,J.useState)([]),Ke=(0,J.useRef)(new Set),[Je,Xe]=(0,J.useState)(null),[Ze,$e]=(0,J.useState)(zn),[tt,nt]=(0,J.useState)(!1),[st,ct]=(0,J.useState)(!1),[ut,pt]=(0,J.useState)(``),[wt,Mt]=(0,J.useState)([]),[Pt,Ft]=(0,J.useState)(!1),[It,Lt]=(0,J.useState)(null),[Rt,zt]=(0,J.useState)(!1),[Bt,Vt]=(0,J.useState)(null),[Ht,Ut]=(0,J.useState)([]),[Wt,Gt]=(0,J.useState)(``),[Kt,qt]=(0,J.useState)(!0),[Jt,Yt]=(0,J.useState)(!1),[Xt,Zt]=(0,J.useState)(!1),[$t,en]=(0,J.useState)(null),[tn,nn]=(0,J.useState)(!1),[rn,an]=(0,J.useState)(`fixed`),[on,sn]=(0,J.useState)(``),[cn,ln]=(0,J.useState)(null),[un,dn]=(0,J.useState)(!1),[fn,pn]=(0,J.useState)(!1),[mn,hn]=(0,J.useState)(!1),[gn,_n]=(0,J.useState)(null),vn=(0,J.useRef)(null),yn=(0,J.useRef)(!1),[bn,X]=(0,J.useState)(null),[xn,Sn]=(0,J.useState)({title:``,reason:``}),[Z,Cn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),wn=(0,J.useRef)(Z),Tn=`overview`,Q=n?`notes`:Vn(t)?t:Tn,En=(0,J.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Dn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return En===`/projects`?n:S(n,En)},[En,e]),On=(0,J.useCallback)(t=>{e&&r(Dn(t))},[r,e,Dn]),kn=(0,J.useCallback)(()=>{if(Q===`tasks`&&vn.current){vn.current.openCreate();return}yn.current=!0,On(`tasks`)},[On,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!yn.current||(yn.current=!1,vn.current?.openCreate())},[Q]);let An=(0,J.useCallback)(t=>{e&&r(Dn(t),{replace:!0})},[r,e,Dn]),Nn=(0,J.useCallback)((e,t)=>{An(e),r(t)},[r,An]),Pn=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||An(e)},[An]),Fn=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||Vn(t)||r(Dn(Tn),{replace:!0})},[Tn,r,e,Dn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return qt(!0),X(null),Promise.all([Ct(e),St(e),De(e),ht().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;b(e),M(n),F(r),Ut(i?.agents??[]),Gt(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??``};wn.current=a,Cn(a)}).catch(e=>{t||X(e instanceof Error?e.message:String(e))}).finally(()=>{t||qt(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&M(await St(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=B.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Ye.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let In=(0,J.useCallback)(async(e,t)=>{_n(e.id),X(null);try{let n=await Oe(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await je(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await ue(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[j,p.board.actionFailed,$]),Jn=(0,J.useCallback)(async t=>{e&&(X(null),await we({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,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 $())},[l,e,$]),Yn=(0,J.useCallback)(async(e,t)=>{_n(e),X(null);try{return await Le(e,t,(await Oe(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),Xn=(0,J.useCallback)(async(e,t,n)=>{_n(e),X(null);try{let r=await Oe(e);return r.task.phase!==t&&(r=await ue(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await Le(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),nr=(0,J.useCallback)(async(e,t)=>{_n(e),X(null);try{await be(e,t,(await Oe(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{_n(null)}},[p.board.actionFailed,$]),sr=(0,J.useCallback)(async t=>{if(e){X(null);try{await pe(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,J.useCallback)(async()=>{if(y){_e(!0),X(null);try{let e=await Te(y.id,{includeRelated:ve,limit:100});q(e.items),fe(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_e(!1)}}},[y,ve]);(0,J.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,J.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){ze([]),Ke.current.clear(),Vt(null);return}zt(!0),Vt(null),Ke.current.clear();try{ze(ir((await re(y.id,``)).entries)),Ke.current.add(``)}catch(e){ze([]),Ke.current.clear(),Vt(e instanceof Error?e.message:String(e))}finally{zt(!1)}},[y]),ur=(0,J.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||Ke.current.has(e))){Ke.current.add(e),Vt(null);try{let t=await re(y.id,e);ze(n=>ar(n,e,ir(t.entries)))}catch(t){Ke.current.delete(e),Vt(t instanceof Error?t.message:String(t))}}},[y]);(0,J.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=ut.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!y||!st||!dr){Mt([]),Ft(!1),Lt(null);return}let e=!1;Ft(!0),Lt(null),Mt([]);let t=window.setTimeout(()=>{W(y.id,dr,50).then(t=>{e||Mt(t)}).catch(t=>{e||Lt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,st,Q]);let fr=(0,J.useCallback)(async()=>{if(y){pn(!0),X(null);try{let e=await Tt(y.id);Nn(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{pn(!1)}}},[Nn,y]),pr=(0,J.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([Ct(y.id),St(y.id)]);M(t),b(e)},[y]),mr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!y||!xn.title.trim())){hn(!0),X(null);try{await xt(y.id,{title:xn.title.trim(),reason:xn.reason.trim()||void 0}),Sn({title:``,reason:``}),await pr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{hn(!1)}}},[xn.reason,xn.title,y,pr]),hr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:En,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":En===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Y.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),[En,u.sidebar.back,p.backToProjects]),gr=(0,J.useMemo)(()=>y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,Y.jsxs)(D,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:kn,children:[(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Y.jsxs)(D,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:fn,children:[(0,Y.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[kn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,fn]);(0,J.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,Y.jsx)(or,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>_()),[_,gr,hr,p,y,h,g,d]);function _r(e){b(t=>t?{...t,...e}:null),Gt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=wn.current){if(!(!y||!Ln(e,y))){X(null),en(null);try{let t=await de(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=wn.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};wn.current=r,Cn(r)}catch(e){let t=Zn(e);throw t?en(t):X(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...wn.current,...e};wn.current=n,Cn(n),t&&Mr.saveNow(n)}let xr=(0,J.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;an(e?`fixed`:`follow`),sn(e||y.effectiveWorkspaceRoot||``),nn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=rn===`fixed`?on.trim():``;if(!(rn===`fixed`&&!t)){Yt(!0),X(null),en(null);try{let n=await de(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),nn(!1),en(null)}catch(e){let t=Zn(e);t?(en(t),nn(!1)):X(e instanceof Error?e.message:String(e))}finally{Yt(!1)}}}async function Cr(){if(!(!y||cn)){ln(`pin`),X(null);try{_r(y.pinnedAt?await rt(y.id):await ae(y.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function wr(){if(!(!y||cn)){ln(`archive`),X(null);try{let e=y.status===`archived`?await ge(y.id):await Qe(y.id);_r(e),br({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function Tr(){if(y){dn(!0),X(null);try{await Ge(y.id),Zt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function Er(){if(!(!y||Ee)){ke(!0),X(null);try{await ot(y.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{ke(!1)}}}let Dr=(0,J.useCallback)(e=>{Xe(e)},[]),Or=(0,J.useCallback)((e,t)=>{t||Xe(e)},[]),kr=(0,J.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||Xe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Fe(t.path);if(Se(Ie(e))!==`text`){let n=await _t(t.path,{projectId:r}),i=ce(e)??`application/octet-stream`;H(e,await n.arrayBuffer(),i)}else{let{content:n}=await dt(t.path,{projectId:r});qe(e,n)}}catch(e){Ue(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await O(t.absolutePath??t.path)&&Ue(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Ue(`warning`,u.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}},[u.clipboard.copyFailed,u.workspace.pathCopied,y?.id]),Ar=(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),nt(!0);let r=e.clientX,i=Ze,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=Rn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}nt(!1),$e(c),Bn(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)},[Ze]);(0,J.useEffect)(()=>{Q!==`files`&&Xe(null)},[e,Q]);let jr=!!(y&&Ln(Z,y)),Mr=kt({value:y?Z:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Kt)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:p.loading});if(!y)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:En,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),En===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:bn||p.notFound})]});let Nr=N.slice(0,6),Pr=j?.blockers??[],Fr=j?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>Hn(p.common.messages,{count:e}),Rr=G.trim().toLowerCase(),zr=Rr?N.filter(e=>{let t=Un(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=tr(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):N,Br=N.length>0&&zr.length===0,Vr=Ht.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ht.find(e=>e.id===Z.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=rn===`fixed`?on.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(rn===`fixed`?on.trim():``)!==Ur&&(rn===`follow`||!!on.trim()),Xr=[{id:`overview`,icon:oe,label:p.tabs.overview},{id:`tasks`,icon:lt,label:p.tabs.tasks},{id:`automations`,icon:yt,label:p.tabs.automations},{id:`files`,icon:xe,label:p.tabs.files},{id:`notes`,icon:We,label:p.tabs.notes},{id:`skills`,icon:at,label:p.tabs.skills},{id:`sessions`,icon:Be,label:p.tabs.sessions},{id:`progress`,icon:Me,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await O(qr);Ue(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){en(null),nn(!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)(At,{items:Xr,activeTab:Q,onChange:On,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(D,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>On(`settings`),children:[(0,Y.jsx)(Et,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),bn?(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:bn}):null,(0,Y.jsxs)(`div`,{className:E(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`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:p.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||j?.digest.summary||y.description||y.brief||p.overview.directionFallback}),j?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Hn(p.overview.recommendedNext,{action:j.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:Ee,children:[(0,Y.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),Ee?p.overview.savingDigest:p.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:p.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,Y.jsxs)(s,{to:it(Dn(`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:p.overview.noNextActions})})]}),j?.recentResults.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:p.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:j.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:it(Dn(`overview`),e),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:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.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:p.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.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:p.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:p.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.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:p.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:p.overview.attention}),Pr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.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)(ne,{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:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ir(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:Pn(Fn(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:p.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:mr,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:xn.title,onChange:e=>Sn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Y.jsx)(D,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!xn.title.trim(),"aria-label":mn?p.overview.addingBlocker:p.overview.addBlocker,title:mn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Y.jsx)(C,{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)(Ve,{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:p.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>On(`sessions`),children:p.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`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:Un(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(jn,{ref:vn,tasks:j?.tasks??[],dependencyEdges:j?.dependencyEdges??[],monitoring:j?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:Dn(`tasks`),copy:p.board,onAction:In,onReorder:Yn,onUndoMove:Xn,onDependenciesChange:nr,onMonitoringChange:sr,onCreate:Jn,actionBusyId:gn}):null,Q===`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.jsx)(Nt,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`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)(Dt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,Y.jsx)(Qt,{projectId:y.id,copy:p.skills}):null,Q===`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:y.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:E(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,tt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Ze}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)(Mn,{workspacePath:qr}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:E(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,st&&`bg-surface-hover text-fg`),onClick:()=>ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":st,children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(et,{className:`size-7 shrink-0 rounded-md p-0`,loading:Rt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),st?(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)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:ut,onChange:e=>pt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.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":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{pt(``),ct(!1)},children:(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Bt?(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:Bt}):null,dr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Pt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(se,{className:`h-11 w-full`}),(0,Y.jsx)(se,{className:`h-11 w-full`}),(0,Y.jsx)(se,{className:`h-11 w-full`})]}):It?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,It]}):wt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):wt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:E(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Je===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Xe(e.path),title:e.path,children:[(0,Y.jsx)(We,{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))}):Rt&&Re.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Y.jsx)(gt,{tree:Re,selectedPath:Je,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:E(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,tt&&`bg-surface-hover`),onPointerDown:Ar,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:Je?(0,Y.jsx)(he,{filePath:Je,projectId:y.id,agentId:y.defaultAgentId||Wt||void 0,onClose:()=>Xe(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)(xe,{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:p.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.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:p.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>On(`settings`),children:p.files.openSettings})})]})})}):null,Q===`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:[N.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)(w,{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:G,onChange:e=>ie(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.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`}),G?(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":p.sessions.clearSearch,onClick:()=>ie(``),children:(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Un(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=tr(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`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)(Be,{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:[p.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:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(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:p.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:p.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`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:p.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Hn(p.progress.count,{count:le})})]}),(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:ve,onChange:e=>ye(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Y.jsxs)(D,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:me,children:[(0,Y.jsx)(Ne,{className:E(`size-4`,me&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:me&&K.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):K.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=rr(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.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:p.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,$n(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Un(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:[p.progress.actor,`: `,Qn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,er(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.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:p.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:E(`rounded-full px-2 py-0.5 text-xs font-medium`,Wn(Z.status)),children:p.settings.statuses[Z.status]}),(0,Y.jsx)(Ot,{status:Mr.status,error:Mr.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:p.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Gn,{label:p.settings.name,children:(0,Y.jsx)(`input`,{className:Kn(),value:Z.name,onChange:e=>br({name:e.target.value})})}),(0,Y.jsx)(Gn,{label:p.settings.defaultAgent,children:(0,Y.jsxs)(f,{className:Kn(),value:Z.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ht.map(e=>(0,Y.jsx)(m,{value:e.id,children:U(e,u.agentsSettings)},e.id))]})}),(0,Y.jsx)(Gn,{label:p.settings.status,children:Wr?(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:p.settings.statuses.archived}):(0,Y.jsxs)(f,{className:Kn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>br({status:e.target.value},!0),children:[(0,Y.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Y.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Y.jsx)(Gn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Kn(!0),value:Z.description,onChange:e=>br({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:p.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Y.jsx)(Gn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Kn(!0),value:Z.brief,onChange:e=>br({brief:e.target.value})})}),(0,Y.jsx)(Gn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Kn(!0),value:Z.instructions,onChange:e=>br({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:p.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.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:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,Y.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,Y.jsx)(Mn,{workspacePath:qr}),(0,Y.jsxs)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,Y.jsx)(V,{className:`size-4`,"aria-hidden":!0}),p.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:p.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(qn,{label:p.settings.defaultAgent,value:Vr}),(0,Y.jsx)(qn,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(qn,{label:p.settings.createdAt,value:Un(y.createdAt)||p.common.never}),(0,Y.jsx)(qn,{label:p.settings.updatedAt,value:Un(y.updatedAt)||p.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:p.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.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:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Y.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void Cr(),children:[Gr?(0,Y.jsx)(vt,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.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:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Y.jsxs)(D,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void wr(),children:[Wr?(0,Y.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(bt,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.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:p.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Y.jsxs)(D,{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:()=>Zt(!0),children:[(0,Y.jsx)(He,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(te,{open:Xt,onOpenChange:e=>{un||Zt(e)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ne,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?Hn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:p.common.cancel})}),(0,Y.jsxs)(D,{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:un||!y,onClick:()=>void Tr(),children:[(0,Y.jsx)(He,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(te,{open:tn,onOpenChange:e=>{Jt||nn(e)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.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:p.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`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:rn===`fixed`,onChange:()=>an(`fixed`),disabled:Jt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`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:rn===`follow`,onChange:()=>an(`follow`),disabled:Jt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),rn===`fixed`?(0,Y.jsx)(jt,{value:on,onChange:sn,disabled:Jt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Kn(),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:p.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Hn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Jt,children:p.common.cancel})}),(0,Y.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Jt||!Yr,onClick:()=>void Sr(),children:[(0,Y.jsx)(V,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(te,{open:!!$t,onOpenChange:e=>{e||en(null)},children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(z,{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)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Y.jsx)(I,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:$t?Hn(p.settings.workspaceMissingDescription,{workspace:$t}):null})]}),$t?(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)(xe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:$t})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Jt,children:p.settings.workspaceMissingBack}),(0,Y.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Jt,children:[(0,Y.jsx)(V,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{sr 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-BaASWQor.js";import{n as a,r as o}from"./popover-select-CccGri5Y.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as ee}from"./messages-BMdD0LWk.js";import{n as p}from"./locale-store-CXhjfe4q.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{Da as x,Ea as S,Fa as C,Ga as w,Oa as T,Ws as E,Zl as D,_a as O,el as k,ga as A,ja as j,nc as te,oo as M,tc as N,tl as ne,tu as P,yi as F,za as re}from"./index-0xQO5B_Q.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ie(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 ae(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(w,{className:`h-40 rounded-xl`},t)}function oe(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=p(V),c,l,u,d,m,h,g,_;if(t[0]!==s||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=ee(s).projectsPage;c=e.management,g=`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,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),f;t[20]===o?f=t[21]:(f=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=f);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(D,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=p):p=t[22];let v;t[23]===f?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[23]=f,t[24]=v),_=(0,R.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:[v,(0,R.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})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,d=`min-w-0 text-[11px] text-fg-subtle`,m=(0,R.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,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]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],u=t[11],d=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==u?(v=(0,R.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==d||t[29]!==m||t[30]!==v?(y=(0,R.jsxs)(`div`,{className:d,children:[m,v]}),t[28]=d,t[29]=m,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,S;t[32]===n.pinnedAt?S=t[33]:(S=n.pinnedAt?(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=S);let C;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==S?(C=(0,R.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:S}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=S,t[39]=C):C=t[39];let w=n.status===`archived`?c.restore:c.archive,T=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==w||t[45]!==T||t[46]!==O?(k=(0,R.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":w,title:T,children:O}),t[42]=r,t[43]=o,t[44]=w,t[45]=T,t[46]=O,t[47]=k):k=t[47];let A;t[48]!==C||t[49]!==k?(A=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[C,k]}),t[48]=C,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==A||t[52]!==h||t[53]!==y?(j=(0,R.jsxs)(`div`,{className:h,children:[y,A]}),t[51]=A,t[52]=h,t[53]=y,t[54]=j):j=t[54];let M;return t[55]!==j||t[56]!==g||t[57]!==_?(M=(0,R.jsxs)(`article`,{className:g,children:[_,j]}),t[55]=j,t[56]=g,t[57]=_,t[58]=M):M=t[58],M}function V(e){return e.language}function H(){let e=ee(p(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=M(e=>e.setPageHeader),w=M(e=>e.clearPageHeader),[E,D]=(0,L.useState)([]),[te,N]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,se]=(0,L.useState)(`active`),[ce,U]=(0,L.useState)(null),[le,W]=(0,L.useState)(!1),[G,K]=(0,L.useState)(null),[q,ue]=(0,L.useState)(!1),[J,de]=(0,L.useState)(``),[Y,fe]=(0,L.useState)(``),[X,pe]=(0,L.useState)(``),Z=re({initialPath:X,onPicked:pe}),Q=(0,L.useCallback)(async()=>{N(!0),F(null);try{D(ie((await S({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){F(e instanceof Error?e.message:String(e))}finally{N(!1)}},[]);(0,L.useEffect)(()=>{Q()},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return E.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,E,I]),me=(0,L.useMemo)(()=>(0,R.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>W(!0),children:[(0,R.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,R.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>w()),[w,me,n.subtitle,n.title,i]);let he=(0,L.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||q)){ue(!0),K(null);try{let e=await O({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});D(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),W(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[q,Y,J,X]),ge=(0,L.useCallback)(async(e,t)=>{U(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await j(e.id):await x(e.id):e.status===`archived`?await T(e.id):await A(e.id),D(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{U(null)}},[]),_e=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],ve=_e.find(e=>e.id===H)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,R.jsx)(b,{open:le,onOpenChange:e=>{W(e),e||K(null)},children:(0,R.jsxs)(_,{children:[(0,R.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.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,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(y,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(h,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.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:J,onChange:e=>de(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.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=>fe(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.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:Z.pick,disabled:q||Z.picking,children:[Z.picking?(0,R.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(k,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:d(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),G?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:G}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(g,{asChild:!0,children:(0,R.jsx)(f,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(f,{type:`submit`,variant:`primary`,disabled:q||!J.trim()||!X.trim(),children:q?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,R.jsx)(C,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,R.jsxs)(`div`,{className:d(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-9 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>se(e.target.value),children:_e.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),P?(0,R.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,R.jsx)(`span`,{children:P}),(0,R.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(ae,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(oe,{project:e,busy:ce===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,R.jsx)(ne,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};