@xopcai/xopc 0.0.337 → 0.0.339

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 (367) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CSHghJkF.js → agent-avatar-dicebear-Cc_FeKSx.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DcDz1HJb.js → agent-defaults-settings-panel-s5yXNGQE.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-plugin-dialog-C7A9k86o.js → agent-plugin-dialog-DoC_yH9K.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agents-wih5cVy1.js → agents-HRZFsjeH.js} +3 -3
  16. package/dist/gateway/static/root/assets/{app-management-settings-panel-LQ_zVJ9C.js → app-management-settings-panel-BquxFv-S.js} +1 -1
  17. package/dist/gateway/static/root/assets/{appearance-settings-C2gaax8U.js → appearance-settings-CZYqmnu6.js} +1 -1
  18. package/dist/gateway/static/root/assets/{apps-page-CobrkzwB.js → apps-page-jIVrH3te.js} +1 -1
  19. package/dist/gateway/static/root/assets/{archive-plugin-CK_qS4Ex.js → archive-plugin-B0vUM0zp.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-DtuUM9W8.js → automations-page-B0Y5BNRb.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-workspace-BNcU6ReT.js → automations-workspace-8OSlJ6lL.js} +1 -1
  22. package/dist/gateway/static/root/assets/{binary-plugins-BN0iLzVY.js → binary-plugins-NBJu1CLg.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-CpLJmCV2.js → block-editor-TXHouZOO.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automations-page-DqKKZQNI.js → browser-automations-page-BqMknmu3.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-settings-page-B0Vxlns8.js → browser-settings-page-GRFXQqKe.js} +1 -1
  26. package/dist/gateway/static/root/assets/{capabilities-page-Bn72DIFn.js → capabilities-page-DmJDCbYN.js} +2 -2
  27. package/dist/gateway/static/root/assets/{capabilities-settings-panel-n4g4t5LK.js → capabilities-settings-panel-D8kedO-n.js} +1 -1
  28. package/dist/gateway/static/root/assets/{capability-header-actions-CIxZrN4w.js → capability-header-actions-BF9_u3xd.js} +1 -1
  29. package/dist/gateway/static/root/assets/{channels-D8P0Sbu1.js → channels-BG-1mvQi.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-BJzZ5vkP.js → chat-terminal-dock-DYysZFAt.js} +1 -1
  31. package/dist/gateway/static/root/assets/{computer-settings-page-WT8yMsKu.js → computer-settings-page-DI3Ek853.js} +1 -1
  32. package/dist/gateway/static/root/assets/{connector-service-page-71NVbenX.js → connector-service-page-BWkcwg_D.js} +1 -1
  33. package/dist/gateway/static/root/assets/{connectors-page-DdBdSoYi.js → connectors-page-DBTyibaI.js} +1 -1
  34. package/dist/gateway/static/root/assets/{date-picker-WyLSk4_J.js → date-picker-Di84qsYg.js} +1 -1
  35. package/dist/gateway/static/root/assets/{dependency-picker-BTdAiaBP.js → dependency-picker-BfxDCpmT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-f0MgT5Um.js → desktop-pet-BRTL_oOb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-settings-DKVITn3D.js → desktop-pet-settings-BNVH1m1M.js} +1 -1
  38. package/dist/gateway/static/root/assets/{device-pairing-wizard-1Buarqmz.js → device-pairing-wizard-C3S9vWJ1.js} +1 -1
  39. package/dist/gateway/static/root/assets/{directory-picker-path-field-BoGtoYn0.js → directory-picker-path-field-BpuRd-vD.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-debug-page-DPwnz1-y.js → extension-debug-page-mQPbBDJQ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{extension-page-CzioOhli.js → extension-page-BHSB_YFM.js} +1 -1
  42. package/dist/gateway/static/root/assets/{extension-settings-page-Cqq5bdYp.js → extension-settings-page-IoBTZ9jq.js} +1 -1
  43. package/dist/gateway/static/root/assets/{gateway-settings-CoXYbhk4.js → gateway-settings-9HNthvnR.js} +1 -1
  44. package/dist/gateway/static/root/assets/{home-page-z3Jiv5fF.js → home-page-B_NubC1h.js} +1 -1
  45. package/dist/gateway/static/root/assets/{imports-page-DHiUg7PR.js → imports-page-DLJp26Cn.js} +1 -1
  46. package/dist/gateway/static/root/assets/{index-D3OtdgCs.js → index-CdvabjRm.js} +23 -23
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CbcZK4S6.js → keyboard-shortcuts-settings-YnkILLU1.js} +1 -1
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-3HC00KSx.js → local-app-workbench-page-C4d2T20s.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-apps-page-etrJtvmm.js → local-apps-page-DfOhJ8iP.js} +1 -1
  50. package/dist/gateway/static/root/assets/{logs-page-BsSdbCw2.js → logs-page-Ds6pm2I7.js} +1 -1
  51. package/dist/gateway/static/root/assets/{management-settings-DODrHfBO.js → management-settings-D0kBRnl2.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-C0JdlHpy.js → media-plugins-vBKV9GvC.js} +1 -1
  53. package/dist/gateway/static/root/assets/{note-detail-panel-fPUNv1PI.js → note-detail-panel-CSdLXt8V.js} +3 -3
  54. package/dist/gateway/static/root/assets/{notes-page-I9h6l38z.js → notes-page-CIQEybLR.js} +1 -1
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-BlcjlzGF.js → page-context-capture-button-DvMerCk-.js} +1 -1
  56. package/dist/gateway/static/root/assets/{page-tabs-_eLR6cpb.js → page-tabs-Bp0yPTYw.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-BfJBJ4NU.js → preview-open-alternatives-CQO4X4dH.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-RdYBwQ_V.js → product-open-page-BQ4vLqay.js} +1 -1
  59. package/dist/gateway/static/root/assets/{project-detail-page-DyAKlm_h.js → project-detail-page-DGRQilZq.js} +1 -1
  60. package/dist/gateway/static/root/assets/{projects-page-Bk51sbKy.js → projects-page-EvaT-KoY.js} +1 -1
  61. package/dist/gateway/static/root/assets/{remote-access-hub-BbMbnizV.js → remote-access-hub-D6EmYuZ9.js} +1 -1
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-yqbX-cYN.js → runtime-tools-settings-panel-POD_UkI6.js} +1 -1
  63. package/dist/gateway/static/root/assets/{scenes-page-L69Imde_.js → scenes-page-gpgblOWJ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{schema-form-BWlMiaNv.js → schema-form-DDjuoH6S.js} +1 -1
  65. package/dist/gateway/static/root/assets/{sessions-page-S-UqCz6P.js → sessions-page-D7QQpt4W.js} +1 -1
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-CPyqCG90.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-DqUsAh0K.js → settings-form-section-DziWi7ar.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-4eoaA_Hs.js → settings-page-DieZ7WKk.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-6BuwbANT.js → setup-status-panel-aGTS3JX2.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-B-w3pIG5.js → share-preview-page-CKuGdvQ1.js} +1 -1
  71. package/dist/gateway/static/root/assets/{shares-settings-Bn03bnYk.js → shares-settings-B2oqZsDF.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skill-api-BN7zgPjv.js → skill-api-CEaxaT32.js} +1 -1
  73. package/dist/gateway/static/root/assets/{skill-reload-api-BsBfMvch.js → skill-reload-api-BAzfIHkQ.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skills-page-CcYeAh5v.js → skills-page-C4z5rpJp.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-BV2zesop.js → system-settings-panel-DqFk7NdF.js} +1 -1
  76. package/dist/gateway/static/root/assets/{task-detail-page-BqN3GUm7.js → task-detail-page-BIA_56uP.js} +1 -1
  77. package/dist/gateway/static/root/assets/{tunnel-api-Dk3SmnSL.js → tunnel-api-mpYTR5df.js} +1 -1
  78. package/dist/gateway/static/root/assets/{usage-page-DStU1Zyn.js → usage-page-CBew7QUj.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-D3oLuZ7h.js → use-autosave-CujxcROb.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-model-page-BXMZoqpb.js → user-model-page-DhMojGHW.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CzvudzG6.js → voice-api-key-field-BAewnwoh.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-D6oUEOYn.js → work-discovery-overlay-Bgtzc3ng.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CXxr4wmO.js → workflow-run-setup-panel-ONIY4un8.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflows-page-D9uPt_T2.js → workflows-page-DcVuZjq_.js} +1 -1
  85. package/dist/gateway/static/root/index.html +1 -1
  86. package/dist/package.js +1 -1
  87. package/dist/packages/gateway-contract/src/index.js +2 -0
  88. package/dist/packages/gateway-contract/src/mobile-user-understanding.js +140 -0
  89. package/dist/src/agent/agent-manager.js +15 -15
  90. package/dist/src/agent/agent-scope.js +2 -2
  91. package/dist/src/agent/background-review/prompts.js +1 -1
  92. package/dist/src/agent/background-review/run-background-review.js +4 -4
  93. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  94. package/dist/src/agent/coding/repository-instructions.js +1 -1
  95. package/dist/src/agent/context/coordinator.js +2 -2
  96. package/dist/src/agent/context/execution-context.js +4 -4
  97. package/dist/src/agent/context/execution-scope.js +2 -2
  98. package/dist/src/agent/context/project-context.js +3 -3
  99. package/dist/src/agent/data-acquisition/service.js +1 -1
  100. package/dist/src/agent/embedded/index.js +2 -2
  101. package/dist/src/agent/embedded/model-runtime.js +1 -1
  102. package/dist/src/agent/embedded/run-for-session.js +4 -4
  103. package/dist/src/agent/embedded/run-turn.js +4 -4
  104. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  105. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  106. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  107. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  108. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  109. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  110. package/dist/src/agent/external-tools/mcp-provider.js +3 -3
  111. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  112. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  113. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  114. package/dist/src/agent/image/generation/providers/google.js +1 -1
  115. package/dist/src/agent/image/generation/runtime.js +1 -1
  116. package/dist/src/agent/image/index.js +1 -1
  117. package/dist/src/agent/image/load-image-media.js +1 -1
  118. package/dist/src/agent/image/tool-model-config.js +2 -2
  119. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  120. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  121. package/dist/src/agent/index.js +1 -1
  122. package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
  123. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  124. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  125. package/dist/src/agent/mcp/index.js +2 -2
  126. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  127. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  128. package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
  129. package/dist/src/agent/memory/context-recovery.js +1 -1
  130. package/dist/src/agent/memory/index.js +1 -1
  131. package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
  132. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  133. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  134. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  135. package/dist/src/agent/service/direct-turn-helpers.js +4 -4
  136. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  137. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  138. package/dist/src/agent/service/webchat-tts.js +2 -2
  139. package/dist/src/agent/service.js +21 -21
  140. package/dist/src/agent/session/session-inspector.js +1 -1
  141. package/dist/src/agent/source-context/index.d.ts +1 -0
  142. package/dist/src/agent/source-context/index.js +4 -3
  143. package/dist/src/agent/source-context/types.d.ts +2 -2
  144. package/dist/src/agent/source-context/types.js +1 -1
  145. package/dist/src/agent/source-context/user-assertion-context.d.ts +2 -0
  146. package/dist/src/agent/source-context/user-assertion-context.js +30 -0
  147. package/dist/src/agent/tasks/task-judge-service.js +4 -4
  148. package/dist/src/agent/tools/create-share-tool.js +3 -3
  149. package/dist/src/agent/tools/dataBatch.js +1 -1
  150. package/dist/src/agent/tools/delegate-tool.js +3 -3
  151. package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
  152. package/dist/src/agent/tools/executor.js +1 -1
  153. package/dist/src/agent/tools/factory.js +16 -16
  154. package/dist/src/agent/tools/fetch-text.js +1 -1
  155. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  156. package/dist/src/agent/tools/index.js +6 -6
  157. package/dist/src/agent/tools/list-dir.js +1 -1
  158. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  159. package/dist/src/agent/tools/read.js +2 -2
  160. package/dist/src/agent/tools/review-workspace.js +1 -1
  161. package/dist/src/agent/tools/send-media.js +2 -2
  162. package/dist/src/agent/tools/skills-tools.js +1 -1
  163. package/dist/src/agent/tools/tts-tool.js +1 -1
  164. package/dist/src/agent/tools/user-context-tool.js +1 -1
  165. package/dist/src/agent/tools/write.js +2 -2
  166. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  167. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  168. package/dist/src/agent-catalog/capabilities.js +2 -2
  169. package/dist/src/ai-assist/text-assist.js +1 -1
  170. package/dist/src/auth/credentials.js +1 -1
  171. package/dist/src/auth/oauth-provider-lock.js +1 -1
  172. package/dist/src/auth/sync-provider-auth.js +1 -1
  173. package/dist/src/automations/capabilities/drafts.js +1 -1
  174. package/dist/src/automations/domain/index.js +2 -2
  175. package/dist/src/automations/index.js +4 -4
  176. package/dist/src/automations/service/automation-service.js +2 -2
  177. package/dist/src/bootstrap/application-state.js +1 -1
  178. package/dist/src/browser/native-messaging-host.js +1 -1
  179. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  180. package/dist/src/capabilities/runtime/product.js +1 -1
  181. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  182. package/dist/src/channels/index.js +2 -2
  183. package/dist/src/channels/outbound-sender.js +1 -1
  184. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  185. package/dist/src/channels/pairing/pairing-store.js +6 -6
  186. package/dist/src/chat-commands/agent-edit.js +1 -1
  187. package/dist/src/chat-commands/builtins/config.js +4 -4
  188. package/dist/src/chat-commands/builtins/review.js +1 -1
  189. package/dist/src/chat-commands/builtins/session.js +1 -1
  190. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  191. package/dist/src/chat-commands/builtins/tts.js +1 -1
  192. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  193. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  194. package/dist/src/chat-commands/context.js +3 -3
  195. package/dist/src/chat-commands/index.js +3 -3
  196. package/dist/src/cli/commands/agent.js +7 -7
  197. package/dist/src/cli/commands/agents.js +1 -1
  198. package/dist/src/cli/commands/config.js +1 -1
  199. package/dist/src/cli/commands/connectors.js +1 -1
  200. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  201. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  202. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  203. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  204. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  205. package/dist/src/cli/commands/extension-dev.js +1 -1
  206. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  207. package/dist/src/cli/commands/extension.js +4 -4
  208. package/dist/src/cli/commands/gateway/shared.js +1 -1
  209. package/dist/src/cli/commands/gateway/token.js +1 -1
  210. package/dist/src/cli/commands/image.js +1 -1
  211. package/dist/src/cli/commands/init.js +1 -1
  212. package/dist/src/cli/commands/models.js +1 -1
  213. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  214. package/dist/src/cli/commands/onboard/model.js +2 -2
  215. package/dist/src/cli/commands/onboard.js +1 -1
  216. package/dist/src/cli/commands/project.js +2 -2
  217. package/dist/src/cli/commands/runtime.js +1 -1
  218. package/dist/src/cli/commands/skills.js +2 -2
  219. package/dist/src/cli/commands/tunnel.js +4 -4
  220. package/dist/src/cli/extension-cli-register.js +4 -4
  221. package/dist/src/cli/utils/gateway-client.js +1 -1
  222. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  223. package/dist/src/cli/utils/session.js +1 -1
  224. package/dist/src/computer/runtime.js +2 -2
  225. package/dist/src/config/index.js +7 -7
  226. package/dist/src/config/loader.js +3 -3
  227. package/dist/src/config/models-json.js +1 -1
  228. package/dist/src/config/schema.js +1 -1
  229. package/dist/src/connectors/cli/authorization.js +1 -1
  230. package/dist/src/connectors/cli/runtime.js +1 -1
  231. package/dist/src/connectors/composio-sessions.js +1 -1
  232. package/dist/src/connectors/composio.js +1 -1
  233. package/dist/src/connectors/connected-source-understanding.js +3 -3
  234. package/dist/src/connectors/connection-recovery-service.js +5 -5
  235. package/dist/src/connectors/health.js +1 -1
  236. package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
  237. package/dist/src/discussions/live-worker.js +1 -1
  238. package/dist/src/discussions/recording.js +1 -1
  239. package/dist/src/discussions/sealer.js +1 -1
  240. package/dist/src/extensions/activation-context.js +3 -3
  241. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  242. package/dist/src/extensions/api.js +4 -4
  243. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  244. package/dist/src/extensions/index.js +3 -3
  245. package/dist/src/extensions/install.js +1 -1
  246. package/dist/src/extensions/loader.js +2 -2
  247. package/dist/src/extensions/sdk/index.js +1 -1
  248. package/dist/src/extensions/sdk/media.js +1 -1
  249. package/dist/src/extensions/update.js +1 -1
  250. package/dist/src/gateway/agents-admin.js +2 -2
  251. package/dist/src/gateway/device-routes.js +2 -2
  252. package/dist/src/gateway/file-path-classifier.js +2 -2
  253. package/dist/src/gateway/global-defaults-admin.js +1 -1
  254. package/dist/src/gateway/hono/app.js +3 -3
  255. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  256. package/dist/src/gateway/hono/routes/agents.js +1 -1
  257. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  258. package/dist/src/gateway/hono/routes/browser.js +1 -1
  259. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  260. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  261. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  262. package/dist/src/gateway/hono/routes/home.js +1 -1
  263. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  264. package/dist/src/gateway/hono/routes/media.js +1 -1
  265. package/dist/src/gateway/hono/routes/models.js +5 -5
  266. package/dist/src/gateway/hono/routes/notes.js +3 -3
  267. package/dist/src/gateway/hono/routes/projects.js +4 -4
  268. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  269. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  270. package/dist/src/gateway/hono/routes/session-input-handler.js +3 -3
  271. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  272. package/dist/src/gateway/hono/routes/shares.js +3 -3
  273. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  274. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  275. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  276. package/dist/src/gateway/hono/routes/user-model.js +207 -5
  277. package/dist/src/gateway/hono/routes/voice.js +6 -6
  278. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  279. package/dist/src/gateway/image-generation-setup.js +3 -3
  280. package/dist/src/gateway/index.js +1 -1
  281. package/dist/src/gateway/lock.js +11 -11
  282. package/dist/src/gateway/media-access.js +1 -1
  283. package/dist/src/gateway/mobile-privacy.js +2 -2
  284. package/dist/src/gateway/ports.js +6 -6
  285. package/dist/src/gateway/run-loop.js +1 -1
  286. package/dist/src/gateway/scenes/mailContext.js +1 -1
  287. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  288. package/dist/src/gateway/security/gateway-scopes.js +3 -0
  289. package/dist/src/gateway/server.js +1 -1
  290. package/dist/src/gateway/service/config-coordinator.js +3 -3
  291. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  292. package/dist/src/gateway/service/session-input-coordinator.js +1 -1
  293. package/dist/src/gateway/service/sessions-api.js +1 -1
  294. package/dist/src/gateway/service.js +42 -37
  295. package/dist/src/gateway/session-context-summary.js +1 -1
  296. package/dist/src/gateway/workspace-editor-path.js +2 -2
  297. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  298. package/dist/src/home-intelligence/generator.js +1 -1
  299. package/dist/src/infra/gateway-processes.js +2 -2
  300. package/dist/src/infra/path-env.js +3 -3
  301. package/dist/src/infra/update-global.js +10 -10
  302. package/dist/src/local-apps/service.js +2 -2
  303. package/dist/src/mcp/gateway-http-client.js +1 -1
  304. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  305. package/dist/src/notes/agent-context.js +4 -4
  306. package/dist/src/notes/index.js +1 -1
  307. package/dist/src/notes/service.js +1 -1
  308. package/dist/src/notes/store.js +1 -1
  309. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  310. package/dist/src/providers/index.js +2 -2
  311. package/dist/src/providers/model-catalog-persistence.js +1 -1
  312. package/dist/src/providers/model-reference-auditor.js +1 -1
  313. package/dist/src/providers/register-runtime-providers.js +1 -1
  314. package/dist/src/remote-access/exposure-manager.js +1 -1
  315. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  316. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  317. package/dist/src/scenes/taskFollowUp/service.js +4 -4
  318. package/dist/src/session/index.js +2 -2
  319. package/dist/src/session/session-title.js +1 -1
  320. package/dist/src/session/store.js +4 -4
  321. package/dist/src/session/thinking-resolve.js +1 -1
  322. package/dist/src/share/share-store.js +1 -1
  323. package/dist/src/share/share-thumbnail.js +1 -1
  324. package/dist/src/share/site-proxy.js +1 -1
  325. package/dist/src/share/site-share-store.js +1 -1
  326. package/dist/src/storage/sqlite/connection.js +9 -9
  327. package/dist/src/tasks/capabilities/read.js +2 -2
  328. package/dist/src/tasks/capabilities/write.js +1 -1
  329. package/dist/src/tasks/execution-context.js +1 -1
  330. package/dist/src/tasks/home-query-service.js +3 -3
  331. package/dist/src/tasks/index.js +4 -4
  332. package/dist/src/tasks/task-application-service.js +1 -1
  333. package/dist/src/tasks/task-context-assembler.js +1 -1
  334. package/dist/src/tasks/task-handoff-service.js +1 -1
  335. package/dist/src/tui/backends/embedded-backend.js +12 -12
  336. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  337. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  338. package/dist/src/tui/tui-command-formatters.js +1 -1
  339. package/dist/src/tui/tui-commands.js +6 -6
  340. package/dist/src/tui/tui-picker-overlay.js +1 -1
  341. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  342. package/dist/src/tui/tui-startup-resources.js +4 -4
  343. package/dist/src/tui/tui.js +7 -7
  344. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  345. package/dist/src/user-model/goals.d.ts +1 -1
  346. package/dist/src/user-model/goals.js +2 -1
  347. package/dist/src/voice/realtime/memory-context.js +3 -3
  348. package/dist/src/voice/realtime/persona-context.js +1 -1
  349. package/dist/src/voice/realtime/runtime.js +3 -3
  350. package/dist/src/voice/stt/index.js +2 -2
  351. package/dist/src/voice/stt/preflight.js +1 -1
  352. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  353. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  354. package/dist/src/voice/stt/transcribe-core.js +1 -1
  355. package/dist/src/voice/tts/index.js +3 -3
  356. package/dist/src/voice/tts/merge-config.js +1 -1
  357. package/dist/src/voice/tts/payload.js +1 -1
  358. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  359. package/dist/src/voice/tts/speak-core.js +1 -1
  360. package/dist/src/work-discovery/incremental-repository.js +1 -1
  361. package/dist/src/work-discovery/index.js +1 -1
  362. package/dist/src/work-discovery/service.js +5 -5
  363. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  364. package/dist/src/workflows/service/workflow-run-service.js +8 -8
  365. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  366. package/package.json +4 -4
  367. package/dist/gateway/static/root/assets/settings-advanced-gate-Q52AAHh_.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-0p9PIHRy.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./copy-Dv6d4Dvw.js";import{t as m}from"./download-Dk-ZjtO6.js";import{t as h}from"./external-link-DjqjBmc3.js";import{f as g,m as _,t as v}from"./markdown-view-bxpOryax.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./message-square-plus-XP0tGdlV.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./search-DA7gz22f.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-DsUnS7rn.js";import{t as T}from"./cn-JdwAhgNB.js";import{a as E,c as D,f as O,n as k,r as A}from"./locale-store-7F4l6DRV.js";import{a as j,i as M,n as N,o as P,r as F,s as I,t as L}from"./dist-BGTk37IG.js";import{i as R,t as z}from"./tasks-QQJXsiER.js";import{t as B}from"./copy-to-clipboard-HOJ79TWv.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-CS04eWY9.js";import{a as U}from"./attachment-utils-core-BIOUBrpT.js";import{o as ee}from"./agents-admin-api-C82B1W9Z.js";import{a as W,i as G,n as K,o as te,r as ne}from"./dist-io9jFpN72.js";import{t as q}from"./skeleton-BwbyijEw.js";import{$c as J,$l as re,$u as ie,Ai as ae,Ba as oe,Bc as se,Bl as ce,Bn as le,Dc as ue,Dl as Y,Eu as de,Fc as fe,Fn as pe,Fu as me,Ga as he,Gn as ge,Gu as _e,Ha as ve,Hl as ye,Ho as be,Ia as xe,Ii as Se,In as Ce,Is as we,Iu as Te,Ja as Ee,Js as De,Ka as Oe,La as ke,Ln as Ae,Lu as je,Ma as Me,Ml as Ne,Nc as Pe,Ni as Fe,Nr as Ie,Ns as Le,Oc as Re,Pn as ze,Po as Be,Pr as Ve,Ps as He,Pu as Ue,Qa as We,Qc as Ge,Ql as Ke,Qs as qe,Ra as Je,Rc as Ye,Rn as Xe,Ta as Ze,Ua as Qe,Ui as $e,Ul as et,Un as tt,Va as nt,Vc as rt,Vi as it,Wa as at,Wl as ot,Xa as st,Xc as ct,Xl as lt,Xt as ut,Xu as dt,Ya as ft,Ys as pt,Za as mt,_a as ht,_o as gt,ba as _t,bc as vt,bl as yt,bn as bt,ed as xt,er as St,fa as Ct,ga as wt,gu as Tt,ha as Et,il as Dt,ir as Ot,ja as kt,jl as At,ju as jt,ka as Mt,la as Nt,lc as Pt,li as Ft,ma as It,nc as Lt,nd as Rt,nl as zt,nr as Bt,nu as Vt,pa as Ht,pc as Ut,pl as Wt,pr as Gt,qa as Kt,rr as qt,ru as Jt,sc as Yt,tl as Xt,ua as Zt,ur as Qt,uu as $t,va as en,wc as tn,xa as nn,xc as rn,xu as an,ya as on,yi as sn,za as cn,zn as ln,zs as un,zu as dn}from"./index-D3OtdgCs.js";import{t as fn}from"./page-tabs-_eLR6cpb.js";import{n as pn,t as mn}from"./use-autosave-D3oLuZ7h.js";import{t as hn}from"./page-context-capture-button-BlcjlzGF.js";import{t as gn}from"./directory-picker-path-field-BoGtoYn0.js";import{d as _n,h as vn,o as yn}from"./skill-api-BN7zgPjv.js";import{t as bn}from"./date-picker-WyLSk4_J.js";import{t as xn}from"./automations-workspace-BNcU6ReT.js";import{i as Sn,n as Cn,r as wn,t as Tn}from"./note-detail-panel-fPUNv1PI.js";import{t as En}from"./dependency-picker-BTdAiaBP.js";import{c as Dn,l as On,n as kn,o as An,r as jn,t as X}from"./style-TIDOdKy0.js";var Mn=n(),Z=e(t(),1),Q=r();function Nn(e){let t=(0,Mn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ve(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=T(`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,Q.jsx)(ye,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.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=T(`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,Q.jsx)(Gt,{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}function Pn(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 Fn(e){let t=(0,Mn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ie(),f=Ie(Ln),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,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=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]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=T(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let E=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=T(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,Q.jsx)(y,{className:`size-3.5 animate-spin`}):m?(0,Q.jsx)(Xt,{className:`size-3.5`}):(0,Q.jsx)(ct,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,Q.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=Pn(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==A?(I=(0,Q.jsxs)(`div`,{className:w,onClick:In,children:[A,F]}),t[34]=F,t[35]=w,t[36]=A,t[37]=I):I=t[37],I}function In(e){return e.stopPropagation()}function Ln(e){return e.toggle}function $(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Rn(e){let t=(0,Mn.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=$(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Z.useState)(Gn),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=Sn(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=T(`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,Q.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,Q.jsx)(Nn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(Fn,{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,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let E=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=T(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==f||t[26]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:f}),t[25]=f,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==w||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,O]}),t[28]=w,t[29]=O,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)($t,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:Wn,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:A})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Hn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,Q.jsx)(Ge,{className:`size-4`}):(0,Q.jsx)(J,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,Q.jsxs)(Ce,{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:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Vn)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Rt,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Q.jsxs)(Ce,{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:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(ln,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Bn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let V;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(Ut,{className:`size-4`}),t[55]=V):V=t[55];let H;t[56]!==c.delete||t[57]!==B?(H=(0,Q.jsxs)(Ce,{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:B,children:[V,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==F||t[60]!==R||t[61]!==H?(U=(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Un,children:[F,R,z,H]})}),t[59]=F,t[60]=R,t[61]=H,t[62]=U):U=t[62];let ee;t[63]!==j||t[64]!==U?(ee=(0,Q.jsxs)(Xe,{children:[j,U]}),t[63]=j,t[64]=U,t[65]=ee):ee=t[65];let W;t[66]!==C||t[67]!==k||t[68]!==ee?(W=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,k,ee]}),t[66]=C,t[67]=k,t[68]=ee,t[69]=W):W=t[69];let G;t[70]===n.pinned?G=t[71]:(G=n.pinned&&(0,Q.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,Q.jsx)(J,{className:`size-3`})}),t[70]=n.pinned,t[71]=G);let K;t[72]===n.tags?K=t[73]:(K=n.tags?.slice(0,2).map(zn),t[72]=n.tags,t[73]=K);let te;t[74]===g?te=t[75]:(te=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=te);let ne;t[76]!==G||t[77]!==K||t[78]!==te?(ne=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[G,K,te]}),t[76]=G,t[77]=K,t[78]=te,t[79]=ne):ne=t[79];let q;return t[80]!==W||t[81]!==ne||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(q=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,W,ne]}),t[80]=W,t[81]=ne,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=q):q=t[87],q}function zn(e){return(0,Q.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 Bn(){}function Vn(){}function Hn(){}function Un(e){return e.stopPropagation()}function Wn(e){return e.stopPropagation()}function Gn(){return Date.now()}var Kn=3e4;function qn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Jn({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,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(0),[w,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)([]),j=(0,Z.useRef)(0),M=(0,Z.useRef)(null),N=(0,Z.useRef)(null),P=(0,Z.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],b(!1),C(0)},[]);(0,Z.useEffect)(()=>()=>P(),[P]);let F=(0,Z.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||qn()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),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{E(!1)}return}E(!1)},[P,c]),I=(0,Z.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=qn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},Kn)}catch{P(),l?.()}}},[P,c,l,y,F,w]),L=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),D.current?.focus()}}},[h,_,o]),R=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||w,B=!!(s||c||p);return(0,Q.jsxs)(`div`,{className:T(`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":z,children:[y?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:w,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,Q.jsx)(tn,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Q.jsxs)(Xe,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,disabled:z,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,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{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,Q.jsxs)(Ce,{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,Q.jsx)(ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Q.jsxs)(Ce,{disabled:f,onSelect:()=>void I(),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,Q.jsx)(Wt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Q.jsxs)(Ce,{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,Q.jsx)(dt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(S))}):(0,Q.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,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,Q.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:T(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Q.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]})}var Yn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Xn=240,Zn=320,Qn=520,$n=560;function er(e){if(globalThis.localStorage===void 0)return Zn;try{let t=globalThis.localStorage.getItem(e);if(!t)return Zn;let n=Number(t);return Number.isFinite(n)?n:Zn}catch{return Zn}}function tr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var nr={thought:rn,todo:ue,voice:Wt,media:ce,bookmark:_e,mixed:rn,task:ue};function rr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function ir(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ar(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function or({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=k(e=>e.language),h=w(m).notes,g=!!D(e=>e.conversationId),[_,v]=(0,Z.useReducer)(Ze,Yn),[y,b]=(0,Z.useState)(!1),[E,A]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(0),[B,H]=(0,Z.useState)(()=>er(p)),[U,ee]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[K,te]=(0,Z.useState)(!1),[ne,q]=(0,Z.useState)(null),[J,re]=(0,Z.useState)(null),ie=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),[oe]=(0,Z.useState)(()=>Date.now()),se=i(),ce=(0,Z.useCallback)(e=>{let t=ie.current?.clientWidth??window.innerWidth,n=Math.max(Xn,t-$n);return Math.max(Xn,Math.min(Math.min(Qn,n),e))},[]),le=(0,Z.useCallback)(e=>{let t=ce(e);H(t),tr(p,t)},[ce,p]);(0,Z.useLayoutEffect)(()=>{H(e=>ce(e))},[ce]);let{data:ue,mutate:Y,isLoading:de}=V((0,Z.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>St({status:_.statusFilter===`all`?void 0:_.statusFilter,kind:_.kindFilter===`all`?void 0:_.kindFilter,projectId:o,pinned:_.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),fe=de&&!ue,pe=ue?.items??[],me=ue?.total??0,he=E.trim(),{data:_e,isLoading:ve}=V(g&&y&&he?[`notes-search`,o,he]:null,()=>St({search:he,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),ye=_e?.items??[],be=e?pe.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{z(0)},[he]),(0,Z.useEffect)(()=>{R>=ye.length&&z(Math.max(0,ye.length-1))},[R,ye.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,h.quickCaptureFailedHint,h.refreshFailed]);let xe=gt(e=>e.setPageHeader),Se=gt(e=>e.clearPageHeader),Ce=h.noteCount.replace(`{{count}}`,String(me)),we=!r&&me===0&&c?c:Ce,Te=h.searchDialogTitle,Ee=h.searchClose,De=h.searchClear,Oe=(0,Z.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:T(`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`,Be),"aria-label":Te,children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:Te})]}),[Te]);(0,Z.useLayoutEffect)(()=>{if(n)return g?(xe({startExtra:null,main:(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,Be),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),Ce?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ce}):null]}),end:Oe}),()=>Se()):(Se(),()=>Se())},[Se,g,Oe,s,n,h.title,Ce,e,xe]);let ke=(0,Z.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:O(m)}),[m,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Ae=(0,Z.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),je=Ae.find(e=>ir(_,e))??Ae[0],Me=s??je.label,Ne=(0,Z.useCallback)(async e=>{q(null);try{let n=o?await tt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Bt(e,`web`);await Y(),se(ar(t,n.id))}catch(e){throw q(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,se,o]),Pe=(0,Z.useCallback)(async()=>{if(!K){te(!0),q(null);try{let e=await tt({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:Yn}),await Y(),re(e.id),se(ar(t,e.id))}catch(e){q(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{te(!1)}}},[t,K,Y,h.createBlankFailed,h.createBlankFailedHint,se,o]),Fe=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{q(null),await qt(t,`web`),await Y()}catch(e){q(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),Ie=(0,Z.useCallback)(async(e,t)=>{try{q(null),await Ot(e,t,`web`),await Y()}catch(e){q(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Le=(0,Z.useCallback)(()=>{q(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Re=(0,Z.useCallback)(async(e,t)=>{q(null);try{await Qt(e,{pinned:t}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ve=(0,Z.useCallback)(async e=>{q(null);try{await Qt(e,{status:`archived`}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),He=(0,Z.useCallback)(async e=>{q(null);try{await ge(e),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ue=(0,Z.useCallback)(e=>{se(ar(t,e))},[t,se]),We=(0,Z.useCallback)(e=>{se(ar(t,e)),b(!1)},[t,se]),Ge=(0,Z.useCallback)(e=>{if(ye.length){if(e.key===`ArrowDown`)e.preventDefault(),z(e=>Math.min(ye.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),z(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=ye[R]??ye[0];t&&We(t.id)}}},[R,We,ye]),Ke=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),ee(!0);let r=ie.current?.clientWidth??window.innerWidth,i=Math.max(Xn,r-$n),a=Math.min(Qn,i),o=e=>Math.max(Xn,Math.min(a,e)),s=e.clientX,c=o(B),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{}ee(!1),ie.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),H(f),tr(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,B]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Pe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pe]);let qe=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),le(B-16)):e.key===`ArrowRight`?(e.preventDefault(),le(B+16)):e.key===`Home`?(e.preventDefault(),le(Xn)):e.key===`End`&&(e.preventDefault(),le(Qn))},[le,B]);return g?(0,Q.jsxs)(`div`,{ref:ie,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${B}px`},children:[(0,Q.jsxs)(`section`,{ref:ae,className:T(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!U&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`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":W?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ne?(0,Q.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:ne}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(l,{value:je.id,onChange:e=>{let t=Ae.find(t=>t.id===e.target.value);t&&v({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":h.libraryTitle,children:Ae.map(e=>(0,Q.jsx)(u,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Me}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:we})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!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":h.collapseNotesList,title:h.collapseNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Pe,disabled:K,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":h.createBlankNote,title:h.createBlankShortcut,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(!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":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:fe?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):pe.length===0?(0,Q.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,Q.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,Q.jsx)(rn,{className:`size-6`,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!be?h.noteOutsideCurrentView:d??h.noNotes}),e&&!be?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??h.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!be?(0,Q.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:h.noteOutsideCurrentView}):null,pe.map((t,n)=>{let r=n>0?Cn(pe[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[Cn(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:T(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:wn(t.createdAt,oe,ke)}),(0,Q.jsx)(Rn,{note:t,selected:t.id===e,onPress:Ue,onPin:Re,onArchive:Ve,onDelete:He,timeLabels:ke,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Q.jsx)(Jn,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Ne,onImagePick:a?Fe:void 0,onVoiceCapture:a?Ie:void 0,onVoiceError:Le,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>ze(o)})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":Xn,"aria-valuemax":Qn,"aria-valuenow":Math.round(B),tabIndex:0,onPointerDown:Ke,onDoubleClick:()=>le(Zn),onKeyDown:qe,title:h.resizeNotesList,className:T(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`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,Q.jsx)(`span`,{"aria-hidden":!0,className:T(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,U&&`bg-accent scale-x-[2]`)})}),(0,Q.jsxs)(`section`,{className:T(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[W?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!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":h.expandNotesList,title:h.expandNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(Tn,{noteId:e,onBack:()=>se(t),onSaved:()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===J,onAutoFocusConsumed:()=>re(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(rn,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Pe,disabled:K,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent 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,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),K?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,Q.jsx)(L,{open:y,onOpenChange:b,children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(I,{className:`text-sm font-semibold text-fg`,children:Te}),(0,Q.jsx)(M,{className:`sr-only`,children:h.searchPlaceholder}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.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":Ee,children:(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:E,onChange:e=>A(e.target.value),onKeyDown:Ge,placeholder:h.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`}),E?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>A(``),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":De,children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:he?ve&&!_e?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):ye.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(rn,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:h.searchResultsCount.replace(`{{count}}`,String(_e?.total??ye.length))}),ye.map((e,t)=>{let n=nr[e.kind]||rn,r=rr(e,{imageNote:h.imageNote,noText:h.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>We(e.id),onMouseEnter:()=>z(t),className:T(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===R?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Sn(e.updatedAt,oe,ke)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(S,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(rn,{className:`size-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}function sr(e){return E(A(`/api/projects/${encodeURIComponent(e)}/skills`))}function cr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function lr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function ur(e,t){let n=new FormData;return n.set(`file`,t),E(A(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function dr(e,t,n={}){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function fr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function pr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function mr({projectId:e,copy:t}){let n=k(e=>e.language),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[f,p]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!0),[w,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(null),[A,M]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),[U,ee]=(0,Z.useState)(``),[K,J]=(0,Z.useState)(1),[re,ie]=(0,Z.useState)(null),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(``),[le,ue]=(0,Z.useState)(``),Y=(0,Z.useRef)(null),de=(0,Z.useCallback)(async()=>{b(!0),M(``);try{let t=await sr(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){M(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,Z.useEffect)(()=>{de()},[de]),(0,Z.useEffect)(()=>{let t=!1;return he(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!f){g(null);return}let e=l.find(e=>e.key===f),t=!1;return g(null),M(``),v(!0),Fe(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||g(e)}).catch(e=>{t||M(e instanceof Error?e.message:String(e))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[f,l]),(0,Z.useEffect)(()=>{if(R!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{oe(!0),ce(``),yn({q:U,page:K,pageSize:8,sort:`downloads`,signal:e.signal}).then(ie).catch(t=>{e.signal.aborted||ce(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||oe(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[R,K,U]);async function fe(e,t){E(!0),O(t??null),M(``);try{await e(),z(null),ue(``),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1),O(null)}}async function pe(t){M(``);try{V((await cr(e,t)).skill)}catch(e){M(e instanceof Error?e.message:String(e))}}async function ge(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){E(!0);try{await pr(e,n.directoryId),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}}async function _e(){E(!0),M(``);try{await lr(e,!0),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}let ve=s.find(e=>e.origin===`agents-workspace`),ye=new Map(h?.skills.map(e=>[e.name,e]));return(0,Q.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(H,{type:`button`,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Q.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Q.jsx)(vr,{icon:vt,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>z(`marketplace`)}),(0,Q.jsx)(vr,{icon:lt,title:t.source,hint:t.sourceHint,onClick:()=>z(`source`)}),(0,Q.jsx)(vr,{icon:Pt,title:t.upload,hint:t.uploadHint,onClick:()=>Y.current?.click()})]})})]}),(0,Q.jsx)(`input`,{ref:Y,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&fe(()=>ur(e,n)),t.target.value=``}})]})}),A?(0,Q.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:A}):null,ve?.state===`untrusted`?(0,Q.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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(yt,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,disabled:w,onClick:()=>void _e(),children:[(0,Q.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),w?t.trusting:t.trustAction]})]}):null,l.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_?t.sessionLoading:f?h?.agentId:t.sessionViewAll})]}),(0,Q.jsx)(d,{value:f,options:l.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:p})]}):null,y?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Q.jsx)(q,{className:`h-36 rounded-lg`},e))}):r.length?(0,Q.jsx)(hr,{title:t.localTitle,items:r,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!y&&a.length?(0,Q.jsx)(hr,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):null,(0,Q.jsx)(L,{open:R!==null,onOpenChange:e=>{e||z(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:T(`xopc-dialog-content 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-overlay shadow-xl`,R===`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,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:R===`marketplace`?t.marketplace:t.source}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:R===`marketplace`?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Q.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.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:U,onChange:e=>{ee(e.target.value),J(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),se?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:se}):null,ae&&!re?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Q.jsx)(q,{className:`h-32 rounded-lg`},e))}):re?.items.length?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:re.items.map(i=>{let a=Se(i,n),o=i.providerId??re.provider,s=vn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=D===s;return(0,Q.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(_n,{name:i.name,className:`size-10`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,Q.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:w||c,onClick:()=>void fe(()=>dr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ae?null:(0,Q.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),re&&re.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(re.meta.page)).replace(`{{total}}`,String(re.meta.totalPages))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K<=1,onClick:()=>J(e=>Math.max(1,e-1)),children:[(0,Q.jsx)(Te,{className:`size-4`}),t.marketplacePrevious]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K>=re.meta.totalPages,onClick:()=>J(e=>e+1),children:[t.marketplaceNext,(0,Q.jsx)(me,{className:`size-4`})]})]})]}):null]}):(0,Q.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Q.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:le,onChange:e=>ue(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,Q.jsx)(H,{type:`button`,disabled:w||!le.trim(),onClick:()=>void fe(()=>fr(e,le.trim())),children:w?t.installing:t.install})]})]})})]})]})}),(0,Q.jsx)(L,{open:!!B,onOpenChange:e=>{e||V(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-xl`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:B?.name}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:B?.bodyMarkdown})]})]})})]})}function hr(e){let t=(0,Mn.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,Q.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,Q.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,Q.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,Q.jsxs)(`article`,{className:T(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Rt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:gr(a,e.origin)}),e.writable?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Q.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,Q.jsx)(`span`,{className:T(`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:_r(a,t)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Q.jsx)(Ut,{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,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let g;return t[22]!==f||t[23]!==m?(g=(0,Q.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=g):g=t[24],g}function gr(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 _r(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 vr(e){let t=(0,Mn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(K,{asChild:!0,children:(0,Q.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 yr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function br(e,t,n){let r=yr(t),i=yr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var xr={active:0,review:1,ready:2,backlog:3,closed:4},Sr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Cr={critical:0,high:1,normal:2,low:3};function wr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Sr[e.operationalState]-Sr[t.operationalState];if(r!==0)return r;let i=xr[e.phase]-xr[t.phase];if(i!==0)return i;let a=Cr[e.priority]-Cr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Tr=[`backlog`,`ready`,`active`,`review`,`closed`];function Er(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 Dr(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 Or(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 kr(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 Ar(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=kr(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 jr(e,t){let{incoming:n}=kr(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 Mr(e,t){let{incoming:n,outgoing:r}=kr(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 Nr={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 Pr(e){let t=(0,Mn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Nr[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=T(`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,Q.jsx)(jn,{type:`target`,position:On.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,Q.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,Q.jsx)(et,{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,Q.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,Q.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,Q.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,Q.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,Q.jsx)(jn,{type:`source`,position:On.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,Q.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 Fr={taskNode:Pr};function Ir(e){let t=(0,Mn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,g]=(0,Z.useState)(),_=(0,Z.useRef)(null),v;t[0]!==r||t[1]!==n?(v=jr(n,r),t[0]=r,t[1]=n,t[2]=v):v=t[2];let y=v,b;t[3]!==y||t[4]!==u||t[5]!==c||t[6]!==n?(b=u?n.filter(e=>y.has(e.id)):c?n:n.filter(Wr),t[3]=y,t[4]=u,t[5]=c,t[6]=n,t[7]=b):b=t[7];let x=b,S;t[8]===x?S=t[9]:(S=new Set(x.map(Ur)),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 E=w,D;t[15]!==E||t[16]!==x?(D=Ar(x,E),t[15]=E,t[16]=x,t[17]=D):D=t[17];let O=D,k;t[18]!==f||t[19]!==E?(k=f?Mr(f,E):void 0,t[18]=f,t[19]=E,t[20]=k):k=t[20];let A=k,j;t[21]===f?j=t[22]:(j=e=>e.id===f,t[21]=f,t[22]=j);let M=x.find(j),N;t[23]===x?N=t[24]:(N=new Map(x.map(Hr)),t[23]=x,t[24]=N);let P=N,F;if(t[25]!==a.phases||t[26]!==O||t[27]!==A||t[28]!==x){let e;t[30]!==a.phases||t[31]!==O||t[32]!==A?(e=e=>({id:e.id,type:`taskNode`,position:O.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(A&&!A.has(e.id))}}),t[30]=a.phases,t[31]=O,t[32]=A,t[33]=e):e=t[33],F=x.map(e),t[25]=a.phases,t[26]=O,t[27]=A,t[28]=x,t[29]=F}else F=t[29];let I=F,L;if(t[34]!==A||t[35]!==P||t[36]!==E){let e;t[38]!==A||t[39]!==P?(e=e=>{let t=P.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(A&&(!A.has(e.dependencyTaskId)||!A.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Dn.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]=A,t[39]=P,t[40]=e):e=t[40],L=E.map(e),t[34]=A,t[35]=P,t[36]=E,t[37]=L}else L=t[37];let R=L,z,B;t[41]!==f||t[42]!==C?(z=()=>{f&&!C.has(f)&&p(void 0)},B=[f,C],t[41]=f,t[42]=C,t[43]=z,t[44]=B):(z=t[43],B=t[44]),(0,Z.useEffect)(z,B);let V,U;t[45]!==R||t[46]!==m?(V=()=>{m&&!R.some(e=>e.id===m)&&g(void 0)},U=[R,m],t[45]=R,t[46]=m,t[47]=V,t[48]=U):(V=t[47],U=t[48]),(0,Z.useEffect)(V,U);let ee;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=window.requestAnimationFrame(()=>{_.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=ee):ee=t[49];let W;t[50]!==u||t[51]!==c||t[52]!==x.length?(W=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=W):W=t[53],(0,Z.useEffect)(ee,W);let G;t[54]===f?G=t[55]:(G=()=>{f&&_.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=G);let K=G,te;t[56]!==r||t[57]!==o?(te=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Vr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=te):te=t[58];let ne=te,q;t[59]!==r||t[60]!==o||t[61]!==m?(q=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(g(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(Br)))},t[59]=r,t[60]=o,t[61]=m,t[62]=q):q=t[62];let J=q,re;t[63]===a.connectHint?re=t[64]:(re=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=re);let ie=u?`secondary`:`ghost`,ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>d(zr),t[65]=ae):ae=t[65];let oe=u?a.allTasks:a.blockedChains,se;t[66]!==u||t[67]!==ie||t[68]!==oe?(se=(0,Q.jsx)(H,{type:`button`,variant:ie,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:ae,children:oe}),t[66]=u,t[67]=ie,t[68]=oe,t[69]=se):se=t[69];let ce;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>l(Rr),t[70]=ce):ce=t[70];let le=c?a.hideCompleted:a.showCompleted,ue;t[71]!==u||t[72]!==c||t[73]!==le?(ue=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ce,disabled:u,children:le}),t[71]=u,t[72]=c,t[73]=le,t[74]=ue):ue=t[74];let Y=M?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:K,children:[(0,Q.jsx)(Vt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,de;t[75]!==a.removeDependency||t[76]!==J||t[77]!==m?(de=m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:J,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=J,t[77]=m,t[78]=de):de=t[78];let fe;t[79]!==se||t[80]!==ue||t[81]!==Y||t[82]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[se,ue,Y,de]}),t[79]=se,t[80]=ue,t[81]=Y,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==re||t[85]!==fe?(pe=(0,Q.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:[re,fe]}),t[84]=re,t[85]=fe,t[86]=pe):pe=t[86];let me=x.length>0?(0,Q.jsxs)(`div`,{className:T(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,M&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Q.jsxs)(An,{nodes:I,edges:R,nodeTypes:Fr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>g(t.id),onConnect:ne,onPaneClick:()=>{p(void 0),g(void 0)},onInit:e=>{_.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Q.jsx)(X,{color:`var(--color-edge)`,gap:22,size:1}),(0,Q.jsx)(kn,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),M?(0,Q.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[M.phase]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:M.title}),M.operationalState===`blocked`&&M.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(M.blockedBy.length))}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:M.blockedBy.map(Lr)})]}):null,(0,Q.jsxs)(s,{to:qe(i,M.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Q.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),he;return t[87]!==pe||t[88]!==me?(he=(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[pe,me]}),t[87]=pe,t[88]=me,t[89]=he):he=t[89],he}function Lr(e){return(0,Q.jsx)(`li`,{children:e.title},e.id)}function Rr(e){return!e}function zr(e){return!e}function Br(e){return e.dependencyTaskId}function Vr(e){return e.dependencyTaskId}function Hr(e){return[e.id,e]}function Ur(e){return e.id}function Wr(e){return e.phase!==`closed`}function Gr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Kr={backlog:jt,ready:jt,active:Y,review:Yt,closed:f},qr={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 Jr(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 Yr(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 Xr(e){let t=(0,Mn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,p,m,h,g,_,v,y,b,x,S,C,w,E,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(h=Or(n),g=h!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,p=n.phase===`closed`,m=!!(n.dueAt&&n.dueAt<Date.now()&&!p),d=p?f:de,v=n.priority!==`normal`,_=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=Qr,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=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=qe(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=T(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,g?`pr-19`:h&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E,t[19]=D):(u=t[4],d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],E=t[18],D=t[19]);let O=p?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=T(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Q.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=p?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=T(`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,Q.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,Q.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,Q.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,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Zr).join(`、`)})]}):n.attention[0]?(0,Q.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(Ue,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Q.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]!==m||t[51]!==_||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=_?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Q.jsx)(`span`,{className:T(`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,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Jr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Yr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Q.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,Q.jsx)(Y,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Q.jsxs)(`span`,{className:T(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,m?`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,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Q.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,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=m,t[51]=_,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,Q.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]!==h||t[71]!==g||t[72]!==n?(R=h?(0,Q.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:[g?(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),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[g],title:i.actions[g],children:(0,Q.jsx)(Yt,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),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[h],title:i.actions[h],children:(0,Q.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=h,t[71]=g,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]!==E||t[81]!==D?(z=(0,Q.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:E,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]=E,t[81]=D,t[82]=z):z=t[82],z}function Zr(e){return e.title}function Qr(e){e.preventDefault(),e.stopPropagation()}function $r({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:d,ref:f}){let p=(0,Z.useRef)(null),m=(0,Z.useRef)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(`board`),[C,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(()=>crypto.randomUUID()),[A,R]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(`normal`),[V,U]=(0,Z.useState)(``),[ee,W]=(0,Z.useState)([]),[G,K]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),q=k(e=>e.language),J=sn({chat:w(q).chat}),re=Er(e),ie=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void i(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let o=re[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Dr(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=A.trim();if(!(!t||G)){K(!0),ne(null);try{let e=V?new Date(`${V}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:z,dependsOnTaskIds:ee,attachments:J.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),O(crypto.randomUUID()),E(!1)}catch(e){ne(e instanceof Error?e.message:r.createFailed)}finally{K(!1)}}},le=()=>{O(crypto.randomUUID()),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),ne(null),E(!0)};(0,Z.useImperativeHandle)(f,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let ue=(0,Z.useCallback)(e=>{let t=m.current;!t||t.pointerId!==e.pointerId||(m.current=null,v(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Z.useCallback)(e=>{if(e.button!==0||Gr(e.target))return;let t=p.current;t&&(m.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Z.useCallback)(e=>{let t=m.current,n=p.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,v(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Q.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,Q.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,Q.jsx)(`div`,{ref:p,className:T(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,_?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:de,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{m.current?.pointerId===e.pointerId&&(m.current=null,v(!1))},children:(0,Q.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Tr.map(t=>{let i=Kr[t],a=re[t];return(0,Q.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Dr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,Q.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-md px-2 py-1`,qr[t]),children:[(0,Q.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Q.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,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Q.jsx)(Xr,{task:e,returnTo:n,copy:r,busy:d===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ir,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,Q.jsx)(L,{open:C,onOpenChange:e=>{G||E(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Q.jsxs)(`div`,{className:T(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,J.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||J.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||J.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),J.setIsDragging(!1),G||J.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Q.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:A,onChange:e=>{R(e.target.value),ne(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,Q.jsx)(ae,{attachments:J.attachments,topPadded:!1,onRemove:e=>{G||J.removeAttachment(e)}}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>J.fileInputRef.current?.click(),children:[(0,Q.jsx)(zt,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Q.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{J.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Q.jsx)(l,{value:z,onChange:e=>B(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Q.jsx)(u,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(bn,{className:`min-h-10 bg-surface-base`,value:V,onChange:U,disabled:G,ariaLabel:r.dueDate})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Q.jsx)(En,{candidates:ie,selectedIds:ee,disabled:G,onChange:W,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),te?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:te}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:r.cancel})}),(0,Q.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!A.trim(),children:G?r.creating:q===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,Q.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,Q.jsx)(`span`,{children:r.moved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var ei=new Set([{id:`overview`,icon:Ne},{id:`tasks`,icon:Tt},{id:`automations`,icon:Lt},{id:`files`,icon:Ke},{id:`notes`,icon:Jt},{id:`skills`,icon:Re},{id:`sessions`,icon:b},{id:`progress`,icon:ot},{id:`settings`,icon:fe}].map(e=>e.id)),ti=`xopc.projectFiles.panelWidthPx`,ni=320,ri=220,ii=560;function ai(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function oi(e){return Math.min(ii,Math.max(ri,Math.round(e)))}function si(){try{let e=window.localStorage.getItem(ti);if(e==null)return ni;let t=Number.parseInt(e,10);return Number.isFinite(t)?oi(t):ni}catch{return ni}}function ci(e){try{window.localStorage.setItem(ti,String(oi(e)))}catch{}}function li(e){return!!(e&&ei.has(e))}function ui(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function di(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ft(n)}function fi(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-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function pi(e){let t=(0,Mn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.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,Q.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,Q.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 mi(e=!1){return T(`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 hi(e){let t=(0,Mn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Q.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=T(`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,Q.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,Q.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 gi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _i(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bi(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function xi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Si(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 Ci(e){let t=e.sourceChannel?.trim();return t?wi(t):``}function wi(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ti(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 Ei(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Di(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Di(e.children,t,n)}:e)}function Oi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([e]),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(`new`),[C,w]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(!1),[A,R]=(0,Z.useState)(!0),[z,B]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(null),ee=(0,Z.useCallback)(async()=>{m(!0),g(null);try{let t=await Oe({limit:100});u(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){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,Z.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&ee()},[ee,o]);let K=(0,Z.useMemo)(()=>{let t=d.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=gi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_i(t)-_i(e))},[e.id,l,d]),q=e=>t.statuses[e.status]??e.status,J=e=>e.description||e.brief||t.common.defaultWorkspace,ie=e=>{b(e),w(``),D(``),B(null),v(!0),s(!1)},ae=(0,Z.useCallback)(async(e={})=>{let t=E.trim(),n=C.trim()||(y===`directory`?vi(t):``);if(n){k(!0),B(null),U(null);try{let r=await ke({autoUnderstand:A,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),w(``),D(``),R(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),u(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yi(e);t?(U(t),v(!1)):B(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[y,C,a,E,A]),oe=(0,Z.useCallback)(e=>{e.preventDefault(),ae()},[ae]),se=(0,Z.useCallback)(()=>{ae({createWorkspaceRoot:!0})},[ae]),ce=(0,Z.useCallback)(()=>{U(null),v(!0)},[]),le=e=>{D(e),y===`directory`&&!C.trim()&&w(vi(e))},ue=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Q.jsx)(c,{className:T(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]},e.id);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(W,{open:o,onOpenChange:s,children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.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,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{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,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.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:d,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Q.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Q.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,Q.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,Q.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,K.map(e=>ue(e,!1))]}),(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Q.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:()=>ie(`new`),children:[(0,Q.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Q.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:()=>ie(`directory`),children:[(0,Q.jsx)(Ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Q.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),a(`/projects`)},children:[(0,Q.jsx)(fe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Q.jsx)(L,{open:_,onOpenChange:e=>!O&&v(e),children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:y===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm text-fg-muted`,children:y===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Q.jsxs)(`form`,{onSubmit:oe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,Q.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:z}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Q.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Q.jsx)(gn,{value:E,onChange:le,disabled:O,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,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Q.jsx)(kt,{checked:A,onChange:R,disabled:O})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:O,children:n.cancel})}),(0,Q.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:O||!(C.trim()||y===`directory`&&vi(E)),children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Q.jsx)(L,{open:!!V,onOpenChange:e=>{e||U(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?ui(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:O,children:n.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:O,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ki(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),d=k(e=>e.language),f=w(d),m=f.chat.workingDirectory,h=f.projectDetailPage,y=f.projectsPage,E=gt(e=>e.setPageHeader),D=gt(e=>e.clearPageHeader),[O,A]=(0,Z.useState)(null),V=(0,Z.useRef)(O);(0,Z.useLayoutEffect)(()=>{V.current=O},[O]);let[W,G]=(0,Z.useState)(null),[K,te]=(0,Z.useState)([]),[ne,ie]=(0,Z.useState)(``),[ae,ce]=(0,Z.useState)([]),[le,ue]=(0,Z.useState)(0),[Y,de]=(0,Z.useState)(!1),[pe,me]=(0,Z.useState)(!1),[ge,_e]=(0,Z.useState)(!1),[ye,Se]=(0,Z.useState)([]),[Ce,Te]=(0,Z.useState)(null),Oe=(0,Z.useRef)(new Set),[ke,Ae]=(0,Z.useState)(null),[je,Pe]=(0,Z.useState)(null),[Fe,Ie]=(0,Z.useState)(null),[ze,Be]=(0,Z.useState)(si),[Ve,Ye]=(0,Z.useState)(!1),[Xe,Ze]=(0,Z.useState)(!1),[et,tt]=(0,Z.useState)(``),[ct,dt]=(0,Z.useState)([]),[vt,yt]=(0,Z.useState)(!1),[St,Dt]=(0,Z.useState)(null),[Ot,kt]=(0,Z.useState)(!1),[At,jt]=(0,Z.useState)(null),[Pt,Ft]=(0,Z.useState)([]),[zt,Bt]=(0,Z.useState)(``),[Vt,Wt]=(0,Z.useState)(!0),[Gt,qt]=(0,Z.useState)(!1),[Yt,Xt]=(0,Z.useState)(!1),[Qt,$t]=(0,Z.useState)(null),[tn,rn]=(0,Z.useState)(!1),[sn,ln]=(0,Z.useState)(`fixed`),[dn,_n]=(0,Z.useState)(``),[vn,yn]=(0,Z.useState)(null),[bn,Sn]=(0,Z.useState)(!1),[Cn,wn]=(0,Z.useState)(!1),[Tn,En]=(0,Z.useState)(!1),[Dn,On]=(0,Z.useState)(null),kn=(0,Z.useRef)(null),An=(0,Z.useRef)(!1),[jn,X]=(0,Z.useState)(null),[Mn,Nn]=(0,Z.useState)({title:``,reason:``}),[Pn,Fn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),In=(0,Z.useRef)(Pn),Ln=`overview`,$=n?`notes`:li(t)?t:Ln,Rn=(0,Z.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),zn=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Rn===`/projects`?n:_(n,Rn)},[Rn,e]),Bn=(0,Z.useCallback)(t=>{e&&r(zn(t))},[r,e,zn]),Vn=(0,Z.useCallback)(()=>{if($===`tasks`&&kn.current){kn.current.openCreate();return}An.current=!0,Bn(`tasks`)},[Bn,$]);(0,Z.useEffect)(()=>{$!==`tasks`||!An.current||(An.current=!1,kn.current?.openCreate())},[$]);let Hn=(0,Z.useCallback)(t=>{e&&r(zn(t),{replace:!0})},[r,e,zn]),Un=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Hn(e)},[Hn]),Wn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,Z.useEffect)(()=>{!e||!t||li(t)||r(zn(Ln),{replace:!0})},[Ln,r,e,zn,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Wt(!0),X(null),Promise.all([oe(e),Qe(e),he(e),ee().catch(()=>null),at(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;A(e),G(n),te(r),Te(a),Ft(i?.agents??[]),Bt(e.defaultAgentId??``);let o=yr(e);In.current=o,Fn(o)}).catch(e=>{t||(Te(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Wt(!1)}),()=>{t=!0}},[e]);let Gn=(0,Z.useCallback)(async()=>{e&&G(await Qe(e))},[e]);(0,Z.useEffect)(()=>{if(Vt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([oe(e),Qe(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=V.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=br(In.current,i,e);In.current=t,Fn(t)}V.current=e,A(e),G(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(A(null),G(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Vt]),(0,Z.useEffect)(()=>{let t,n=n=>{let r=z.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))},r=n=>{let r=R.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),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,Gn]);let Kn=(0,Z.useCallback)(async(e,t)=>{On(e.id),X(null);try{let n=await un(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 we(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 Le(e.id,r,n.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[W,h.board.actionFailed,Gn]),qn=(0,Z.useCallback)(async t=>{e&&(X(null),await He({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:d,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 Gn())},[d,e,Gn]),Jn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{return await De(e,t,(await un(e)).task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Yn=(0,Z.useCallback)(async(e,t,n)=>{On(e),X(null);try{let r=await un(e);return r.task.phase!==t&&(r=await Le(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 De(e,n,r.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Xn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{await pt(e,t,(await un(e)).task.version),await Gn()}catch(e){await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed)}finally{On(null)}},[h.board.actionFailed,Gn]),Zn=(0,Z.useCallback)(async()=>{if(O){de(!0),X(null);try{let e=await nt(O.id,{includeRelated:pe,limit:100});ce(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{de(!1)}}},[O,pe]);(0,Z.useEffect)(()=>{$===`progress`&&Zn()},[Zn,$]);let Qn=(0,Z.useCallback)(async()=>{if(!O?.effectiveWorkspaceRoot?.trim()){Se([]),Oe.current.clear(),jt(null);return}kt(!0),jt(null),Oe.current.clear();try{Se(Ei((await ve(O.id,``)).entries)),Oe.current.add(``)}catch(e){Se([]),Oe.current.clear(),jt(e instanceof Error?e.message:String(e))}finally{kt(!1)}},[O]),$n=(0,Z.useCallback)(async e=>{if(!(!O?.effectiveWorkspaceRoot?.trim()||Oe.current.has(e))){Oe.current.add(e),jt(null);try{let t=await ve(O.id,e);Se(n=>Di(n,e,Ei(t.entries)))}catch(t){Oe.current.delete(e),jt(t instanceof Error?t.message:String(t))}}},[O]),er=(0,Z.useCallback)(async e=>{if(!O?.effectiveWorkspaceRoot?.trim())return;let t=Ei((await ve(O.id,e)).entries);Se(e?n=>Di(n,e,t):t),Oe.current.add(e)},[O]);(0,Z.useEffect)(()=>{$===`files`&&Qn()},[Qn,$]);let tr=et.trim();(0,Z.useEffect)(()=>{if($!==`files`||!O||!Xe||!tr){dt([]),yt(!1),Dt(null);return}let e=!1;yt(!0),Dt(null),dt([]);let t=window.setTimeout(()=>{st(O.id,tr,50).then(t=>{e||dt(t)}).catch(t=>{e||Dt(t instanceof Error?t.message:String(t))}).finally(()=>{e||yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[tr,O,Xe,$]);let nr=(0,Z.useCallback)(async()=>{if(!O)return;let[e,t]=await Promise.all([oe(O.id),Qe(O.id)]);G(t),A(e)},[O]),rr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!O||!Mn.title.trim())){wn(!0),X(null);try{await Je(O.id,{title:Mn.title.trim(),reason:Mn.reason.trim()||void 0}),Nn({title:``,reason:``}),En(!1),await nr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{wn(!1)}}},[Mn.reason,Mn.title,O,nr]),ir=(0,Z.useMemo)(()=>(0,Q.jsx)(s,{to:Rn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Rn===`/projects`?h.backToProjects:f.sidebar.back,children:(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),[Rn,f.sidebar.back,h.backToProjects]),ar=(0,Z.useMemo)(()=>O?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hn,{resource:{kind:`project`,id:O.id,revision:String(O.version)},disabled:Gt||ai(Pn,O)}),(0,Q.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(O.id)}`,children:[(0,Q.jsx)(lt,{className:`size-4`,"aria-hidden":!0}),h.common.runWorkflow]})}),(0,Q.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Vn,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),h.board.create]}),(0,Q.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:Mt(O.id),state:{forceNewChat:!0,agentId:O.defaultAgentId},onClick:Un(`sessions`),children:[(0,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0}),h.common.newChat]})})]}):null,[Vn,Un,h.board.create,h.common.newChat,h.common.runWorkflow,O,Gt,Pn]);(0,Z.useLayoutEffect)(()=>(E({startExtra:ir,main:O?(0,Q.jsx)(Oi,{currentProject:O,pm:h,projectsText:y,wd:m}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.fallbackTitle}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:h.fallbackContext})]}),end:ar}),()=>D()),[D,ar,ir,h,O,y,E,m]);function sr(e){A(t=>t?{...t,...e}:null),Bt(e.defaultAgentId??``),at(e.id).then(Te).catch(()=>Te(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function cr(e=In.current){if(!(!O||!ai(e,O))){X(null),$t(null);try{let t=await We(O.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},O.version);sr(t);let n=In.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};In.current=r,Fn(r)}catch(e){let t=yi(e);throw t?$t(t):X(e instanceof Error?e.message:String(e)),e}}}function lr(e){e.preventDefault(),kr.flush()}function ur(e,t=!1){let n={...In.current,...e};In.current=n,Fn(n),t&&kr.saveNow(n)}let dr=(0,Z.useCallback)(()=>{if(!O)return;let e=O.workspaceRoot?.trim()??``;ln(e?`fixed`:`follow`),_n(e||O.effectiveWorkspaceRoot||``),rn(!0)},[O]);async function fr(e={}){if(!O)return;let t=sn===`fixed`?dn.trim():``;if(!(sn===`fixed`&&!t)){qt(!0),X(null),$t(null);try{let n=await We(O.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},O.version);sr(n),ur({workspaceRoot:n.workspaceRoot??``}),rn(!1),$t(null)}catch(e){let t=yi(e);t?($t(t),rn(!1)):X(e instanceof Error?e.message:String(e))}finally{qt(!1)}}}async function pr(){if(!(!O||vn)){yn(`pin`),X(null);try{sr(O.pinnedAt?await mt(O.id,O.version):await Kt(O.id,O.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function hr(){if(!(!O||vn)){yn(`archive`),X(null);try{let e=O.status===`archived`?await Ee(O.id,O.version):await xe(O.id,O.version);sr(e),ur({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function gr(){if(O){Sn(!0),X(null);try{await cn(O.id,O.version),Xt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Sn(!1)}}}async function _r(){if(!(!O||ge)){_e(!0),X(null);try{await ft(O.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_e(!1)}}}let vr=(0,Z.useCallback)(e=>{Ae(e)},[]),xr=(0,Z.useCallback)((e,t)=>{t||Ae(e)},[]),Sr=(0,Z.useCallback)(async(e,t,n)=>{let r=O?.id;if(r)switch(e){case`preview`:t.isDirectory||Ae(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Zt(t.path);if(Ct(Nt(e))!==`text`){let n=await wt(t.path,{projectId:r}),i=U(e)??`application/octet-stream`;It(e,await n.arrayBuffer(),i)}else{let{content:n}=await ht(t.path,{projectId:r});Et(e,n)}}catch(e){be(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await B(t.path)&&be(`success`,f.workspace.pathCopied,void 0,{duration:2500})}catch{be(`warning`,f.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await $e(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWith`:await $e(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await $e(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),f.workspace.openFileFailed);break;case`revealInFolder`:await $e(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),f.workspace.revealFileFailed);break;case`trash`:Pe(t);break;case`delete`:t.isDirectory||Ie(t);break;default:break}},[f.clipboard.copyFailed,f.workspace.openFileFailed,f.workspace.pathCopied,f.workspace.revealFileFailed,O?.id]),Cr=(0,Z.useCallback)(async()=>{let e=je;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){be(`warning`,t?.error??f.workspace.trashFailed,void 0,{duration:4e3});return}ke===e.path&&Ae(null),Pe(null),await Qn(),be(`success`,f.workspace.trashSuccess,void 0,{duration:2500})},[f.workspace.trashFailed,f.workspace.trashSuccess,je,ke,Qn]),Tr=(0,Z.useCallback)(async(e,t)=>{let n=O?.id;if(n)try{await Promise.all(e.map(e=>en(e,t,{projectId:n}))),await er(t).catch(()=>void 0),be(`success`,f.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await er(t).catch(()=>void 0),be(`warning`,`${f.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.uploadFailed,f.workspace.uploadSuccess,O?.id,er]),Er=(0,Z.useCallback)(async()=>{let e=Fe;if(e)try{await Ht(e.fileId),ke===e.path&&Ae(null),Ie(null);let t=e.path.lastIndexOf(`/`);await er(t<0?``:e.path.slice(0,t)).catch(()=>void 0),be(`success`,f.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){be(`warning`,`${f.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.deleteFailed,f.workspace.deleteSuccess,Fe,ke,er]),Dr=(0,Z.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),Ye(!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=oi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ye(!1),Be(c),ci(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,Z.useEffect)(()=>{$!==`files`&&Ae(null)},[e,$]);let Or=!!(O&&ai(Pn,O)),kr=mn({value:O?Pn:null,dirty:Or,onSave:cr,validate:e=>e.name.trim()?null:h.settings.nameRequired});if(Vt)return(0,Q.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:h.loading});if(!O)return(0,Q.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(s,{to:Rn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),Rn===`/projects`?h.backToProjects:f.sidebar.back]}),(0,Q.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:jn||h.notFound})]});let Ar=K.slice(0,3),jr=W?.blockers??[],Mr=wr(W?.tasks??[]),Nr=W?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Pr=e=>h.statuses[e]??e,Fr=e=>ui(h.common.messages,{count:e}),Ir=ne.trim().toLowerCase(),Lr=Ir?K.filter(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=e.name?.trim()||h.sessions.fallbackTitle,i=Fr(e.messageCount??0),a=Ci(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Ir)}):K,Rr=K.length>0&&Lr.length===0,zr=Pt.find(e=>e.id===O.defaultAgentId)?.name||O.defaultAgentId||h.settings.globalDefaultAgent,Br=Pt.find(e=>e.id===Pn.defaultAgentId),Vr=O.workspaceRoot?.trim()||``,Hr=O.status===`archived`,Ur=!!O.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,Kr=sn===`fixed`?dn.trim()||h.settings.workspacePlaceholder:Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,qr=(sn===`fixed`?dn.trim():``)!==Vr&&(sn===`follow`||!!dn.trim()),Jr=[{id:`overview`,icon:Ne,label:h.tabs.overview},{id:`tasks`,icon:Tt,label:h.tabs.tasks},{id:`automations`,icon:Lt,label:h.tabs.automations},{id:`files`,icon:Ke,label:h.tabs.files},{id:`notes`,icon:Jt,label:h.tabs.notes},{id:`skills`,icon:Re,label:h.tabs.skills},{id:`sessions`,icon:b,label:h.tabs.sessions},{id:`progress`,icon:ot,label:h.tabs.progress}];async function Yr(){if(!Gr)return;let e=await B(Gr);be(e?`success`:`warning`,e?f.workspace.pathCopied:f.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){$t(null),rn(!0)}return(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(fn,{items:Jr,activeTab:$,onChange:Bn,ariaLabel:h.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Q.jsxs)(H,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Bn(`settings`),children:[(0,Q.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),h.tabs.settings,Or?(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":h.settings.unsavedChanges}):null]})]}),jn?(0,Q.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:jn}):null,(0,Q.jsxs)(`div`,{className:T(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Q.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,Q.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,Q.jsx)(Me,{projectId:O.id},O.id),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`p-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.directionTitle}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ui(h.overview.activitySummary,{moving:Nr,attention:jr.length})})]}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:O.outcome||O.description||O.brief||h.overview.directionFallback}),W?.digest.recommendedAction?(0,Q.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:ui(h.overview.recommendedNext,{action:W.digest.recommendedAction})}):null]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void _r(),disabled:ge,children:[(0,Q.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),ge?h.overview.savingDigest:h.overview.saveDigest]})]})}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.nextActions}),(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Bn(`tasks`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Mr.length?Mr.map(e=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsxs)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[h.board.phases[e.phase],e.operationalState===`idle`?``:` · ${h.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noNextActions})})]})]}),W?.recentResults.length?(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.recentResults})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:W.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[h.overview.resultStatuses[n.status],` · `,h.board.verification[n.verification.status]]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Q.jsx)(v,{content:n.summary,compact:!0})})]},n.runId))})]}):null,O.milestones.length||O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[O.milestones.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.milestones})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.milestones.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:h.statuses[e.status]})]},e.id))})]}):null,O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.projectUpdates})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentUpdates.slice(0,3).map(e=>(0,Q.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Q.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,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.attention}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Tn,onClick:()=>En(e=>!e),children:[(0,Q.jsx)(x,{className:T(`size-3.5 transition-transform`,Tn&&`rotate-45`),"aria-hidden":!0}),h.overview.addBlocker]})]}),jr.length?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jr.map(e=>{let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ue,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Q.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[h.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Pr(e.status)}`:``]})]});return e.href?(0,Q.jsx)(s,{to:e.href,onClick:Un(Wn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Q.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.overview.noBlockedTasks}),Tn?(0,Q.jsxs)(`form`,{onSubmit:rr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Q.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:Mn.title,onChange:e=>Nn(t=>({...t,title:e.target.value})),placeholder:h.overview.blockerTitlePlaceholder}),(0,Q.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:Cn||!Mn.title.trim(),"aria-label":Cn?h.overview.addingBlocker:h.overview.addBlocker,title:Cn?h.overview.addingBlocker:h.overview.addBlocker,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(an,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:h.overview.recentSessions})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Bn(`sessions`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Ar.length?Ar.map(e=>(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:di(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==O.defaultAgentId?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Q.jsx)($r,{ref:kn,tasks:W?.tasks??[],dependencyEdges:W?.dependencyEdges??[],returnTo:zn(`tasks`),copy:h.board,onAction:Kn,onReorder:Jn,onUndoMove:Yn,onDependenciesChange:Xn,onCreate:qn,actionBusyId:Dn}):null,$===`automations`?(0,Q.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,Q.jsx)(xn,{projectId:O.id,embedded:!0,title:h.automations.title,subtitle:h.automations.hint})}):null,$===`notes`?(0,Q.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,Q.jsx)(or,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(O.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:O.id,listTitle:h.notes.title,listDescription:h.notes.hint,emptyText:h.notes.emptyTitle,emptyDescription:h.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${O.id}`})}):null,$===`skills`?(0,Q.jsx)(mr,{projectId:O.id,copy:h.skills}):null,$===`files`?(0,Q.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,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:O.effectiveWorkspaceRoot?(0,Q.jsxs)(`div`,{"data-project-files-grid":!0,className:T(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Ve&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${ze}px`},children:[(0,Q.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:T(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Xe&&`bg-surface-hover text-fg`),onClick:()=>Ze(!0),"aria-label":h.files.search,title:h.files.search,"aria-pressed":Xe,children:(0,Q.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(_t,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ot,label:f.cron.refresh,onClick:()=>void Qn()})]})]}),Xe?(0,Q.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,Q.jsx)(S,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`text`,role:`searchbox`,value:et,onChange:e=>tt(e.target.value),placeholder:h.files.searchPlaceholder,"aria-label":h.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Q.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":h.files.clearSearch,title:h.files.clearSearch,onClick:()=>{tt(``),Ze(!1)},children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,At?(0,Q.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:At}):null,tr?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:vt?(0,Q.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`})]}):St?(0,Q.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[f.workspace.loadError,`: `,St]}):ct.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:h.files.noSearchResults}):ct.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,ke===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Ae(e.path),title:e.path,children:[(0,Q.jsx)(Jt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ot&&ye.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.files.loading}):(0,Q.jsx)(on,{tree:ye,selectedPath:ke,onSelectFile:vr,onSelectEntry:xr,onExpandDir:e=>void $n(e),onAction:Sr,onUploadFiles:(e,t)=>void Tr(e,t),uploadDropHint:f.workspace.dropToUpload,actionLabels:{preview:f.workspace.preview,download:f.workspace.download,copyPath:f.workspace.copyPath,openDefault:f.workspace.openSystemApp,openDirectory:f.workspace.openInFileManager,openWith:f.workspace.openWith,revealInFolder:f.workspace.revealInFolder,trash:f.workspace.moveToTrash,delete:f.workspace.deleteFile,recommendedApps:f.workspace.recommendedApps,desktopUpdateRequired:f.workspace.desktopUpdateRequired},emptyHint:h.files.emptyDirectory})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.files.resizeHandle,className:T(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Ve&&`bg-surface-hover/70`),onPointerDown:Dr,children:(0,Q.jsx)(`div`,{className:T(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Ve&&`bg-accent/60`)})}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:ke?(0,Q.jsx)(ut,{filePath:ke,projectId:O.id,agentId:O.defaultAgentId||zt||void 0,onClose:()=>Ae(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(Ke,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h.files.previewEmptyTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.files.previewEmptyDescription})]})})})]}):(0,Q.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:h.files.needWorkspace}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Bn(`settings`),children:h.files.openSettings})})]})})}):null,$===`sessions`?(0,Q.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[K.length?(0,Q.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,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:ne,onChange:e=>ie(e.currentTarget.value),placeholder:h.sessions.searchPlaceholder,"aria-label":h.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`}),ne?(0,Q.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":h.sessions.clearSearch,onClick:()=>ie(``),children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=Ci(e),i=e.name?.trim()||h.sessions.fallbackTitle,a=Fr(e.messageCount??0);return(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.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,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Q.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,Q.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.agent,`: `,n]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Q.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.noMatches})}):(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.emptyTitle}),(0,Q.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:h.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.progress.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ui(h.progress.count,{count:le})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:pe,onChange:e=>me(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),h.progress.includeRelated]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Zn(),disabled:Y,children:[(0,Q.jsx)(rt,{className:T(`size-4`,Y&&`animate-spin`),"aria-hidden":!0}),h.common.refresh]})]})]}),(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Y&&ae.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.loading}):ae.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:ae.map(e=>{let t=h.progress.types[e.type]??e.type,n=h.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ti(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===O.id);return(0,Q.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:h.progress.related}):null]}),(0,Q.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xi(e)]})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:di(e.createdAt)})]}),r?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[h.progress.actor,`: `,bi(e)]}),(0,Q.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.progress.source,`: `,Si(e)]})]})]},e.id)})}):(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.empty})})]}):null,$===`settings`?(0,Q.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:lr,onBlurCapture:kr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Q.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.summaryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:h.settings.summaryHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,fi(Pn.status)),children:h.settings.statuses[Pn.status]}),(0,Q.jsx)(pn,{status:kr.status,error:kr.error})]})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.detailsTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.detailsHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(pi,{label:h.settings.name,children:(0,Q.jsx)(`input`,{className:mi(),value:Pn.name,onChange:e=>ur({name:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.defaultAgent,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.defaultAgentId,onChange:e=>ur({defaultAgentId:e.target.value},!0),children:[(0,Q.jsx)(u,{value:``,children:h.settings.globalDefaultAgent}),Pt.map(e=>(0,Q.jsx)(u,{value:e.id,children:bt(e,f.agentsSettings)},e.id))]})}),(0,Q.jsx)(pi,{label:h.settings.status,children:Hr?(0,Q.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:h.settings.statuses.archived}):(0,Q.jsxs)(l,{className:mi(),value:Pn.status===`archived`?`active`:Pn.status,onChange:e=>ur({status:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`active`,children:h.settings.statuses.active}),(0,Q.jsx)(u,{value:`paused`,children:h.settings.statuses.paused})]})}),(0,Q.jsx)(pi,{label:h.settings.executionMode,hint:h.settings.executionModeHint,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.executionMode,onChange:e=>ur({executionMode:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`managed_worktree`,children:h.settings.executionModeWorktree}),(0,Q.jsx)(u,{value:`local_checkout`,children:h.settings.executionModeLocal})]})}),(0,Q.jsx)(pi,{label:h.settings.description,hint:h.settings.descriptionHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.description,onChange:e=>ur({description:e.target.value})})})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.projectGuidanceTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.projectGuidanceHint})]}),(0,Q.jsx)(pi,{label:h.settings.brief,hint:h.settings.briefHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.brief,onChange:e=>ur({brief:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.instructions,hint:h.settings.instructionsHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.instructions,onChange:e=>ur({instructions:e.target.value})})})]})]}),(0,Q.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.workspaceRoot}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceIndependentHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?h.settings.workspaceModeFollow:h.settings.workspaceModeFixed}),(0,Q.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),h.settings.copyWorkspacePath]}),Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:dr,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.migrateWorkspace]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.currentProjectTitle}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.defaultAgent,value:zr}),(0,Q.jsx)(hi,{label:h.settings.pinState,value:Ur?h.settings.pinned:h.settings.notPinned}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.createdAt,value:di(O.createdAt)||h.common.never}),(0,Q.jsx)(hi,{label:h.settings.updatedAt,value:di(O.updatedAt)||h.common.never})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.managementTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.managementHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?h.settings.pinnedTitle:h.settings.pinTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.pinHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`pin`,onClick:()=>void pr(),children:[Ur?(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(J,{className:`size-4`,"aria-hidden":!0}),Ur?h.settings.unpinProject:h.settings.pinProject]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?h.settings.restoreTitle:h.settings.archiveTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?h.settings.restoreHint:h.settings.archiveHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`archive`,onClick:()=>void hr(),children:[Hr?(0,Q.jsx)(rt,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Rt,{className:`size-4`,"aria-hidden":!0}),Hr?h.settings.restoreProject:h.settings.archiveProject]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:h.settings.dangerTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:h.settings.dangerHint})]}),(0,Q.jsxs)(H,{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:()=>Xt(!0),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Q.jsx)(L,{open:Yt,onOpenChange:e=>{bn||Xt(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay p-5 shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.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,Q.jsx)(Ue,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.deleteConfirmTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O?ui(h.settings.deleteConfirm,{name:O.name}):h.settings.deleteConfirmFallback})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:bn,children:h.common.cancel})}),(0,Q.jsxs)(H,{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:bn||!O,onClick:()=>void gr(),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})}),(0,Q.jsx)(nn,{open:!!je,title:f.workspace.trashConfirmTitle,description:f.workspace.trashConfirmDescription.replace(`{{name}}`,je?.name??``),confirmLabel:f.workspace.moveToTrash,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Cr(),onCancel:()=>Pe(null)}),(0,Q.jsx)(nn,{open:!!Fe,title:f.workspace.deleteConfirmTitle,description:f.workspace.deleteConfirmDescription.replace(`{{name}}`,Fe?.name??``),confirmLabel:f.workspace.deleteFile,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Er(),onCancel:()=>Ie(null)}),(0,Q.jsx)(L,{open:tn,onOpenChange:e=>{Gt||rn(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMigrationTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.workspaceMigrationDescription})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:h.settings.workspaceMode}),(0,Q.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`fixed`,onChange:()=>ln(`fixed`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFixed}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceMigrationFixedHint})]})]}),(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`follow`,onChange:()=>ln(`follow`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFollow}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceHint})]})]})]})]}),sn===`fixed`?(0,Q.jsx)(gn,{value:dn,onChange:_n,disabled:Gt,wd:m,placeholder:h.settings.workspacePlaceholder,inputClassName:mi(),autoFocus:!0}):null,(0,Q.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:h.settings.workspaceMigrationImpact}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:ui(h.settings.workspaceCurrent,{workspace:Kr})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Gt,children:h.common.cancel})}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Gt||!qr,onClick:()=>void fr(),children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Q.jsx)(L,{open:!!Qt,onOpenChange:e=>{e||$t(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Qt?ui(h.settings.workspaceMissingDescription,{workspace:Qt}):null})]}),Qt?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:Qt})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:Gt,children:h.settings.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void fr({createWorkspaceRoot:!0}),disabled:Gt,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMissingCreate]})]})]})]})})]})}export{ki as ProjectDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u,t as d}from"./popover-select-0p9PIHRy.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./copy-Dv6d4Dvw.js";import{t as m}from"./download-Dk-ZjtO6.js";import{t as h}from"./external-link-DjqjBmc3.js";import{f as g,m as _,t as v}from"./markdown-view-bxpOryax.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./message-square-plus-XP0tGdlV.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./search-DA7gz22f.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-DsUnS7rn.js";import{t as T}from"./cn-JdwAhgNB.js";import{a as E,c as D,f as O,n as k,r as A}from"./locale-store-7F4l6DRV.js";import{a as j,i as M,n as N,o as P,r as F,s as I,t as L}from"./dist-BGTk37IG.js";import{i as R,t as z}from"./tasks-QQJXsiER.js";import{t as B}from"./copy-to-clipboard-HOJ79TWv.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-CS04eWY9.js";import{a as U}from"./attachment-utils-core-BIOUBrpT.js";import{o as ee}from"./agents-admin-api-C82B1W9Z.js";import{a as W,i as G,n as K,o as te,r as ne}from"./dist-io9jFpN72.js";import{t as q}from"./skeleton-BwbyijEw.js";import{$c as J,$l as re,$u as ie,Ai as ae,Ba as oe,Bc as se,Bl as ce,Bn as le,Dc as ue,Dl as Y,Eu as de,Fc as fe,Fn as pe,Fu as me,Ga as he,Gn as ge,Gu as _e,Ha as ve,Hl as ye,Ho as be,Ia as xe,Ii as Se,In as Ce,Is as we,Iu as Te,Ja as Ee,Js as De,Ka as Oe,La as ke,Ln as Ae,Lu as je,Ma as Me,Ml as Ne,Nc as Pe,Ni as Fe,Nr as Ie,Ns as Le,Oc as Re,Pn as ze,Po as Be,Pr as Ve,Ps as He,Pu as Ue,Qa as We,Qc as Ge,Ql as Ke,Qs as qe,Ra as Je,Rc as Ye,Rn as Xe,Ta as Ze,Ua as Qe,Ui as $e,Ul as et,Un as tt,Va as nt,Vc as rt,Vi as it,Wa as at,Wl as ot,Xa as st,Xc as ct,Xl as lt,Xt as ut,Xu as dt,Ya as ft,Ys as pt,Za as mt,_a as ht,_o as gt,ba as _t,bc as vt,bl as yt,bn as bt,ed as xt,er as St,fa as Ct,ga as wt,gu as Tt,ha as Et,il as Dt,ir as Ot,ja as kt,jl as At,ju as jt,ka as Mt,la as Nt,lc as Pt,li as Ft,ma as It,nc as Lt,nd as Rt,nl as zt,nr as Bt,nu as Vt,pa as Ht,pc as Ut,pl as Wt,pr as Gt,qa as Kt,rr as qt,ru as Jt,sc as Yt,tl as Xt,ua as Zt,ur as Qt,uu as $t,va as en,wc as tn,xa as nn,xc as rn,xu as an,ya as on,yi as sn,za as cn,zn as ln,zs as un,zu as dn}from"./index-CdvabjRm.js";import{t as fn}from"./page-tabs-Bp0yPTYw.js";import{n as pn,t as mn}from"./use-autosave-CujxcROb.js";import{t as hn}from"./page-context-capture-button-DvMerCk-.js";import{t as gn}from"./directory-picker-path-field-BpuRd-vD.js";import{d as _n,h as vn,o as yn}from"./skill-api-CEaxaT32.js";import{t as bn}from"./date-picker-Di84qsYg.js";import{t as xn}from"./automations-workspace-8OSlJ6lL.js";import{i as Sn,n as Cn,r as wn,t as Tn}from"./note-detail-panel-CSdLXt8V.js";import{t as En}from"./dependency-picker-BfxDCpmT.js";import{c as Dn,l as On,n as kn,o as An,r as jn,t as X}from"./style-TIDOdKy0.js";var Mn=n(),Z=e(t(),1),Q=r();function Nn(e){let t=(0,Mn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ve(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=T(`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,Q.jsx)(ye,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.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=T(`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,Q.jsx)(Gt,{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}function Pn(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 Fn(e){let t=(0,Mn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ie(),f=Ie(Ln),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,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=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]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=T(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let E=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=T(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,Q.jsx)(y,{className:`size-3.5 animate-spin`}):m?(0,Q.jsx)(Xt,{className:`size-3.5`}):(0,Q.jsx)(ct,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,Q.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=Pn(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==A?(I=(0,Q.jsxs)(`div`,{className:w,onClick:In,children:[A,F]}),t[34]=F,t[35]=w,t[36]=A,t[37]=I):I=t[37],I}function In(e){return e.stopPropagation()}function Ln(e){return e.toggle}function $(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Rn(e){let t=(0,Mn.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=$(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Z.useState)(Gn),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=Sn(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=T(`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,Q.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,Q.jsx)(Nn,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(Fn,{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,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let E=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=T(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==f||t[26]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:f}),t[25]=f,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==w||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,O]}),t[28]=w,t[29]=O,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)($t,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:Wn,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:A})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(Hn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,Q.jsx)(Ge,{className:`size-4`}):(0,Q.jsx)(J,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,Q.jsxs)(Ce,{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:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Vn)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Rt,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Q.jsxs)(Ce,{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:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(ln,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Bn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let V;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(Ut,{className:`size-4`}),t[55]=V):V=t[55];let H;t[56]!==c.delete||t[57]!==B?(H=(0,Q.jsxs)(Ce,{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:B,children:[V,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==F||t[60]!==R||t[61]!==H?(U=(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Un,children:[F,R,z,H]})}),t[59]=F,t[60]=R,t[61]=H,t[62]=U):U=t[62];let ee;t[63]!==j||t[64]!==U?(ee=(0,Q.jsxs)(Xe,{children:[j,U]}),t[63]=j,t[64]=U,t[65]=ee):ee=t[65];let W;t[66]!==C||t[67]!==k||t[68]!==ee?(W=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,k,ee]}),t[66]=C,t[67]=k,t[68]=ee,t[69]=W):W=t[69];let G;t[70]===n.pinned?G=t[71]:(G=n.pinned&&(0,Q.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,Q.jsx)(J,{className:`size-3`})}),t[70]=n.pinned,t[71]=G);let K;t[72]===n.tags?K=t[73]:(K=n.tags?.slice(0,2).map(zn),t[72]=n.tags,t[73]=K);let te;t[74]===g?te=t[75]:(te=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=te);let ne;t[76]!==G||t[77]!==K||t[78]!==te?(ne=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[G,K,te]}),t[76]=G,t[77]=K,t[78]=te,t[79]=ne):ne=t[79];let q;return t[80]!==W||t[81]!==ne||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(q=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,W,ne]}),t[80]=W,t[81]=ne,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=q):q=t[87],q}function zn(e){return(0,Q.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 Bn(){}function Vn(){}function Hn(){}function Un(e){return e.stopPropagation()}function Wn(e){return e.stopPropagation()}function Gn(){return Date.now()}var Kn=3e4;function qn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Jn({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,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(0),[w,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)([]),j=(0,Z.useRef)(0),M=(0,Z.useRef)(null),N=(0,Z.useRef)(null),P=(0,Z.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],b(!1),C(0)},[]);(0,Z.useEffect)(()=>()=>P(),[P]);let F=(0,Z.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||qn()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),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{E(!1)}return}E(!1)},[P,c]),I=(0,Z.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=qn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},Kn)}catch{P(),l?.()}}},[P,c,l,y,F,w]),L=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),D.current?.focus()}}},[h,_,o]),R=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||w,B=!!(s||c||p);return(0,Q.jsxs)(`div`,{className:T(`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":z,children:[y?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:w,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,Q.jsx)(tn,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Q.jsxs)(Xe,{children:[(0,Q.jsx)(le,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,disabled:z,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,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(pe,{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,Q.jsxs)(Ce,{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,Q.jsx)(ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Q.jsxs)(Ce,{disabled:f,onSelect:()=>void I(),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,Q.jsx)(Wt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Q.jsxs)(Ce,{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,Q.jsx)(dt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(S))}):(0,Q.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,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,Q.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:T(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Q.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]})}var Yn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Xn=240,Zn=320,Qn=520,$n=560;function er(e){if(globalThis.localStorage===void 0)return Zn;try{let t=globalThis.localStorage.getItem(e);if(!t)return Zn;let n=Number(t);return Number.isFinite(n)?n:Zn}catch{return Zn}}function tr(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var nr={thought:rn,todo:ue,voice:Wt,media:ce,bookmark:_e,mixed:rn,task:ue};function rr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function ir(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ar(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function or({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=k(e=>e.language),h=w(m).notes,g=!!D(e=>e.conversationId),[_,v]=(0,Z.useReducer)(Ze,Yn),[y,b]=(0,Z.useState)(!1),[E,A]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(0),[B,H]=(0,Z.useState)(()=>er(p)),[U,ee]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[K,te]=(0,Z.useState)(!1),[ne,q]=(0,Z.useState)(null),[J,re]=(0,Z.useState)(null),ie=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),[oe]=(0,Z.useState)(()=>Date.now()),se=i(),ce=(0,Z.useCallback)(e=>{let t=ie.current?.clientWidth??window.innerWidth,n=Math.max(Xn,t-$n);return Math.max(Xn,Math.min(Math.min(Qn,n),e))},[]),le=(0,Z.useCallback)(e=>{let t=ce(e);H(t),tr(p,t)},[ce,p]);(0,Z.useLayoutEffect)(()=>{H(e=>ce(e))},[ce]);let{data:ue,mutate:Y,isLoading:de}=V((0,Z.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>St({status:_.statusFilter===`all`?void 0:_.statusFilter,kind:_.kindFilter===`all`?void 0:_.kindFilter,projectId:o,pinned:_.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),fe=de&&!ue,pe=ue?.items??[],me=ue?.total??0,he=E.trim(),{data:_e,isLoading:ve}=V(g&&y&&he?[`notes-search`,o,he]:null,()=>St({search:he,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),ye=_e?.items??[],be=e?pe.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{z(0)},[he]),(0,Z.useEffect)(()=>{R>=ye.length&&z(Math.max(0,ye.length-1))},[R,ye.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,h.quickCaptureFailedHint,h.refreshFailed]);let xe=gt(e=>e.setPageHeader),Se=gt(e=>e.clearPageHeader),Ce=h.noteCount.replace(`{{count}}`,String(me)),we=!r&&me===0&&c?c:Ce,Te=h.searchDialogTitle,Ee=h.searchClose,De=h.searchClear,Oe=(0,Z.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:T(`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`,Be),"aria-label":Te,children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:Te})]}),[Te]);(0,Z.useLayoutEffect)(()=>{if(n)return g?(xe({startExtra:null,main:(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,Be),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),Ce?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ce}):null]}),end:Oe}),()=>Se()):(Se(),()=>Se())},[Se,g,Oe,s,n,h.title,Ce,e,xe]);let ke=(0,Z.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:O(m)}),[m,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Ae=(0,Z.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),je=Ae.find(e=>ir(_,e))??Ae[0],Me=s??je.label,Ne=(0,Z.useCallback)(async e=>{q(null);try{let n=o?await tt({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Bt(e,`web`);await Y(),se(ar(t,n.id))}catch(e){throw q(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,se,o]),Pe=(0,Z.useCallback)(async()=>{if(!K){te(!0),q(null);try{let e=await tt({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:Yn}),await Y(),re(e.id),se(ar(t,e.id))}catch(e){q(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{te(!1)}}},[t,K,Y,h.createBlankFailed,h.createBlankFailedHint,se,o]),Fe=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{q(null),await qt(t,`web`),await Y()}catch(e){q(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),Ie=(0,Z.useCallback)(async(e,t)=>{try{q(null),await Ot(e,t,`web`),await Y()}catch(e){q(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Le=(0,Z.useCallback)(()=>{q(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Re=(0,Z.useCallback)(async(e,t)=>{q(null);try{await Qt(e,{pinned:t}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ve=(0,Z.useCallback)(async e=>{q(null);try{await Qt(e,{status:`archived`}),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),He=(0,Z.useCallback)(async e=>{q(null);try{await ge(e),await Y()}catch(e){q(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ue=(0,Z.useCallback)(e=>{se(ar(t,e))},[t,se]),We=(0,Z.useCallback)(e=>{se(ar(t,e)),b(!1)},[t,se]),Ge=(0,Z.useCallback)(e=>{if(ye.length){if(e.key===`ArrowDown`)e.preventDefault(),z(e=>Math.min(ye.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),z(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=ye[R]??ye[0];t&&We(t.id)}}},[R,We,ye]),Ke=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),ee(!0);let r=ie.current?.clientWidth??window.innerWidth,i=Math.max(Xn,r-$n),a=Math.min(Qn,i),o=e=>Math.max(Xn,Math.min(a,e)),s=e.clientX,c=o(B),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{}ee(!1),ie.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),H(f),tr(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,B]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Pe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pe]);let qe=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),le(B-16)):e.key===`ArrowRight`?(e.preventDefault(),le(B+16)):e.key===`Home`?(e.preventDefault(),le(Xn)):e.key===`End`&&(e.preventDefault(),le(Qn))},[le,B]);return g?(0,Q.jsxs)(`div`,{ref:ie,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${B}px`},children:[(0,Q.jsxs)(`section`,{ref:ae,className:T(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!U&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`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":W?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ne?(0,Q.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:ne}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(l,{value:je.id,onChange:e=>{let t=Ae.find(t=>t.id===e.target.value);t&&v({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":h.libraryTitle,children:Ae.map(e=>(0,Q.jsx)(u,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Me}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:we})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!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":h.collapseNotesList,title:h.collapseNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Pe,disabled:K,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":h.createBlankNote,title:h.createBlankShortcut,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(!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":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:fe?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):pe.length===0?(0,Q.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,Q.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,Q.jsx)(rn,{className:`size-6`,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!be?h.noteOutsideCurrentView:d??h.noNotes}),e&&!be?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??h.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!be?(0,Q.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:h.noteOutsideCurrentView}):null,pe.map((t,n)=>{let r=n>0?Cn(pe[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[Cn(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:T(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:wn(t.createdAt,oe,ke)}),(0,Q.jsx)(Rn,{note:t,selected:t.id===e,onPress:Ue,onPin:Re,onArchive:Ve,onDelete:He,timeLabels:ke,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Q.jsx)(Jn,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Ne,onImagePick:a?Fe:void 0,onVoiceCapture:a?Ie:void 0,onVoiceError:Le,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>ze(o)})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":Xn,"aria-valuemax":Qn,"aria-valuenow":Math.round(B),tabIndex:0,onPointerDown:Ke,onDoubleClick:()=>le(Zn),onKeyDown:qe,title:h.resizeNotesList,className:T(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`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,Q.jsx)(`span`,{"aria-hidden":!0,className:T(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,U&&`bg-accent scale-x-[2]`)})}),(0,Q.jsxs)(`section`,{className:T(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[W?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>G(!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":h.expandNotesList,title:h.expandNotesList,children:(0,Q.jsx)(Dt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(Tn,{noteId:e,onBack:()=>se(t),onSaved:()=>{Y().catch(e=>{q(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===J,onAutoFocusConsumed:()=>re(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(rn,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Pe,disabled:K,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent 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,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),K?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,Q.jsx)(L,{open:y,onOpenChange:b,children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(I,{className:`text-sm font-semibold text-fg`,children:Te}),(0,Q.jsx)(M,{className:`sr-only`,children:h.searchPlaceholder}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.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":Ee,children:(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:E,onChange:e=>A(e.target.value),onKeyDown:Ge,placeholder:h.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`}),E?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>A(``),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":De,children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:he?ve&&!_e?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):ye.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(rn,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:h.searchResultsCount.replace(`{{count}}`,String(_e?.total??ye.length))}),ye.map((e,t)=>{let n=nr[e.kind]||rn,r=rr(e,{imageNote:h.imageNote,noText:h.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>We(e.id),onMouseEnter:()=>z(t),className:T(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===R?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Sn(e.updatedAt,oe,ke)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(S,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(rn,{className:`size-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}function sr(e){return E(A(`/api/projects/${encodeURIComponent(e)}/skills`))}function cr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function lr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function ur(e,t){let n=new FormData;return n.set(`file`,t),E(A(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function dr(e,t,n={}){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function fr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function pr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function mr({projectId:e,copy:t}){let n=k(e=>e.language),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[f,p]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!0),[w,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(null),[A,M]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),[U,ee]=(0,Z.useState)(``),[K,J]=(0,Z.useState)(1),[re,ie]=(0,Z.useState)(null),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(``),[le,ue]=(0,Z.useState)(``),Y=(0,Z.useRef)(null),de=(0,Z.useCallback)(async()=>{b(!0),M(``);try{let t=await sr(e);i(t.items),o(t.inheritedItems),c(t.sources)}catch(e){M(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,Z.useEffect)(()=>{de()},[de]),(0,Z.useEffect)(()=>{let t=!1;return he(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!f){g(null);return}let e=l.find(e=>e.key===f),t=!1;return g(null),M(``),v(!0),Fe(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||g(e)}).catch(e=>{t||M(e instanceof Error?e.message:String(e))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[f,l]),(0,Z.useEffect)(()=>{if(R!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{oe(!0),ce(``),yn({q:U,page:K,pageSize:8,sort:`downloads`,signal:e.signal}).then(ie).catch(t=>{e.signal.aborted||ce(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||oe(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[R,K,U]);async function fe(e,t){E(!0),O(t??null),M(``);try{await e(),z(null),ue(``),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1),O(null)}}async function pe(t){M(``);try{V((await cr(e,t)).skill)}catch(e){M(e instanceof Error?e.message:String(e))}}async function ge(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){E(!0);try{await pr(e,n.directoryId),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}}async function _e(){E(!0),M(``);try{await lr(e,!0),await de()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(!1)}}let ve=s.find(e=>e.origin===`agents-workspace`),ye=new Map(h?.skills.map(e=>[e.name,e]));return(0,Q.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(H,{type:`button`,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Q.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Q.jsx)(vr,{icon:vt,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>z(`marketplace`)}),(0,Q.jsx)(vr,{icon:lt,title:t.source,hint:t.sourceHint,onClick:()=>z(`source`)}),(0,Q.jsx)(vr,{icon:Pt,title:t.upload,hint:t.uploadHint,onClick:()=>Y.current?.click()})]})})]}),(0,Q.jsx)(`input`,{ref:Y,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&fe(()=>ur(e,n)),t.target.value=``}})]})}),A?(0,Q.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:A}):null,ve?.state===`untrusted`?(0,Q.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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(yt,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,disabled:w,onClick:()=>void _e(),children:[(0,Q.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),w?t.trusting:t.trustAction]})]}):null,l.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_?t.sessionLoading:f?h?.agentId:t.sessionViewAll})]}),(0,Q.jsx)(d,{value:f,options:l.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:p})]}):null,y?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Q.jsx)(q,{className:`h-36 rounded-lg`},e))}):r.length?(0,Q.jsx)(hr,{title:t.localTitle,items:r,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!y&&a.length?(0,Q.jsx)(hr,{title:t.inheritedTitle,hint:t.inheritedHint,items:a,copy:t,busy:w,availabilityByName:ye,onPreview:pe,onRemove:ge}):null,(0,Q.jsx)(L,{open:R!==null,onOpenChange:e=>{e||z(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:T(`xopc-dialog-content 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-overlay shadow-xl`,R===`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,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:R===`marketplace`?t.marketplace:t.source}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:R===`marketplace`?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Q.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.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:U,onChange:e=>{ee(e.target.value),J(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),se?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:se}):null,ae&&!re?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Q.jsx)(q,{className:`h-32 rounded-lg`},e))}):re?.items.length?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:re.items.map(i=>{let a=Se(i,n),o=i.providerId??re.provider,s=vn(i,o),c=r.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===i.id||e.directoryId===s||e.name===i.name)),l=D===s;return(0,Q.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(_n,{name:i.name,className:`size-10`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:a.displayName}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:a.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,i.downloads]}),(0,Q.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:c?`secondary`:`primary`,disabled:w||c,onClick:()=>void fe(()=>dr(e,s,{provider:o}),s),children:c?t.marketplaceInstalled:l?t.installing:t.install})]})]})]},`${o??`default`}:${i.id}`)})}):ae?null:(0,Q.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),re&&re.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(re.meta.page)).replace(`{{total}}`,String(re.meta.totalPages))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K<=1,onClick:()=>J(e=>Math.max(1,e-1)),children:[(0,Q.jsx)(Te,{className:`size-4`}),t.marketplacePrevious]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ae||K>=re.meta.totalPages,onClick:()=>J(e=>e+1),children:[t.marketplaceNext,(0,Q.jsx)(me,{className:`size-4`})]})]})]}):null]}):(0,Q.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Q.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:le,onChange:e=>ue(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,Q.jsx)(H,{type:`button`,disabled:w||!le.trim(),onClick:()=>void fe(()=>fr(e,le.trim())),children:w?t.installing:t.install})]})]})})]})]})}),(0,Q.jsx)(L,{open:!!B,onOpenChange:e=>{e||V(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-xl`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:B?.name}),(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(C,{className:`size-4`})})})]}),(0,Q.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:B?.bodyMarkdown})]})]})})]})}function hr(e){let t=(0,Mn.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,Q.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,Q.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,Q.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,Q.jsxs)(`article`,{className:T(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Rt,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:gr(a,e.origin)}),e.writable?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Q.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,Q.jsx)(`span`,{className:T(`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:_r(a,t)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Q.jsx)(Ut,{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,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let g;return t[22]!==f||t[23]!==m?(g=(0,Q.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=g):g=t[24],g}function gr(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 _r(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 vr(e){let t=(0,Mn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(K,{asChild:!0,children:(0,Q.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 yr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function br(e,t,n){let r=yr(t),i=yr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var xr={active:0,review:1,ready:2,backlog:3,closed:4},Sr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Cr={critical:0,high:1,normal:2,low:3};function wr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Sr[e.operationalState]-Sr[t.operationalState];if(r!==0)return r;let i=xr[e.phase]-xr[t.phase];if(i!==0)return i;let a=Cr[e.priority]-Cr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Tr=[`backlog`,`ready`,`active`,`review`,`closed`];function Er(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 Dr(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 Or(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 kr(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 Ar(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=kr(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 jr(e,t){let{incoming:n}=kr(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 Mr(e,t){let{incoming:n,outgoing:r}=kr(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 Nr={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 Pr(e){let t=(0,Mn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Nr[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=T(`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,Q.jsx)(jn,{type:`target`,position:On.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,Q.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,Q.jsx)(et,{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,Q.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,Q.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,Q.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,Q.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,Q.jsx)(jn,{type:`source`,position:On.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,Q.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 Fr={taskNode:Pr};function Ir(e){let t=(0,Mn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,g]=(0,Z.useState)(),_=(0,Z.useRef)(null),v;t[0]!==r||t[1]!==n?(v=jr(n,r),t[0]=r,t[1]=n,t[2]=v):v=t[2];let y=v,b;t[3]!==y||t[4]!==u||t[5]!==c||t[6]!==n?(b=u?n.filter(e=>y.has(e.id)):c?n:n.filter(Wr),t[3]=y,t[4]=u,t[5]=c,t[6]=n,t[7]=b):b=t[7];let x=b,S;t[8]===x?S=t[9]:(S=new Set(x.map(Ur)),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 E=w,D;t[15]!==E||t[16]!==x?(D=Ar(x,E),t[15]=E,t[16]=x,t[17]=D):D=t[17];let O=D,k;t[18]!==f||t[19]!==E?(k=f?Mr(f,E):void 0,t[18]=f,t[19]=E,t[20]=k):k=t[20];let A=k,j;t[21]===f?j=t[22]:(j=e=>e.id===f,t[21]=f,t[22]=j);let M=x.find(j),N;t[23]===x?N=t[24]:(N=new Map(x.map(Hr)),t[23]=x,t[24]=N);let P=N,F;if(t[25]!==a.phases||t[26]!==O||t[27]!==A||t[28]!==x){let e;t[30]!==a.phases||t[31]!==O||t[32]!==A?(e=e=>({id:e.id,type:`taskNode`,position:O.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(A&&!A.has(e.id))}}),t[30]=a.phases,t[31]=O,t[32]=A,t[33]=e):e=t[33],F=x.map(e),t[25]=a.phases,t[26]=O,t[27]=A,t[28]=x,t[29]=F}else F=t[29];let I=F,L;if(t[34]!==A||t[35]!==P||t[36]!==E){let e;t[38]!==A||t[39]!==P?(e=e=>{let t=P.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(A&&(!A.has(e.dependencyTaskId)||!A.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Dn.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]=A,t[39]=P,t[40]=e):e=t[40],L=E.map(e),t[34]=A,t[35]=P,t[36]=E,t[37]=L}else L=t[37];let R=L,z,B;t[41]!==f||t[42]!==C?(z=()=>{f&&!C.has(f)&&p(void 0)},B=[f,C],t[41]=f,t[42]=C,t[43]=z,t[44]=B):(z=t[43],B=t[44]),(0,Z.useEffect)(z,B);let V,U;t[45]!==R||t[46]!==m?(V=()=>{m&&!R.some(e=>e.id===m)&&g(void 0)},U=[R,m],t[45]=R,t[46]=m,t[47]=V,t[48]=U):(V=t[47],U=t[48]),(0,Z.useEffect)(V,U);let ee;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=window.requestAnimationFrame(()=>{_.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=ee):ee=t[49];let W;t[50]!==u||t[51]!==c||t[52]!==x.length?(W=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=W):W=t[53],(0,Z.useEffect)(ee,W);let G;t[54]===f?G=t[55]:(G=()=>{f&&_.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=G);let K=G,te;t[56]!==r||t[57]!==o?(te=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Vr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=te):te=t[58];let ne=te,q;t[59]!==r||t[60]!==o||t[61]!==m?(q=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(g(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(Br)))},t[59]=r,t[60]=o,t[61]=m,t[62]=q):q=t[62];let J=q,re;t[63]===a.connectHint?re=t[64]:(re=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=re);let ie=u?`secondary`:`ghost`,ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>d(zr),t[65]=ae):ae=t[65];let oe=u?a.allTasks:a.blockedChains,se;t[66]!==u||t[67]!==ie||t[68]!==oe?(se=(0,Q.jsx)(H,{type:`button`,variant:ie,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:ae,children:oe}),t[66]=u,t[67]=ie,t[68]=oe,t[69]=se):se=t[69];let ce;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>l(Rr),t[70]=ce):ce=t[70];let le=c?a.hideCompleted:a.showCompleted,ue;t[71]!==u||t[72]!==c||t[73]!==le?(ue=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ce,disabled:u,children:le}),t[71]=u,t[72]=c,t[73]=le,t[74]=ue):ue=t[74];let Y=M?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:K,children:[(0,Q.jsx)(Vt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,de;t[75]!==a.removeDependency||t[76]!==J||t[77]!==m?(de=m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:J,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=J,t[77]=m,t[78]=de):de=t[78];let fe;t[79]!==se||t[80]!==ue||t[81]!==Y||t[82]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[se,ue,Y,de]}),t[79]=se,t[80]=ue,t[81]=Y,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==re||t[85]!==fe?(pe=(0,Q.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:[re,fe]}),t[84]=re,t[85]=fe,t[86]=pe):pe=t[86];let me=x.length>0?(0,Q.jsxs)(`div`,{className:T(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,M&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Q.jsxs)(An,{nodes:I,edges:R,nodeTypes:Fr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>g(t.id),onConnect:ne,onPaneClick:()=>{p(void 0),g(void 0)},onInit:e=>{_.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Q.jsx)(X,{color:`var(--color-edge)`,gap:22,size:1}),(0,Q.jsx)(kn,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),M?(0,Q.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[M.phase]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:M.title}),M.operationalState===`blocked`&&M.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(M.blockedBy.length))}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:M.blockedBy.map(Lr)})]}):null,(0,Q.jsxs)(s,{to:qe(i,M.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Q.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),he;return t[87]!==pe||t[88]!==me?(he=(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[pe,me]}),t[87]=pe,t[88]=me,t[89]=he):he=t[89],he}function Lr(e){return(0,Q.jsx)(`li`,{children:e.title},e.id)}function Rr(e){return!e}function zr(e){return!e}function Br(e){return e.dependencyTaskId}function Vr(e){return e.dependencyTaskId}function Hr(e){return[e.id,e]}function Ur(e){return e.id}function Wr(e){return e.phase!==`closed`}function Gr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Kr={backlog:jt,ready:jt,active:Y,review:Yt,closed:f},qr={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 Jr(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 Yr(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 Xr(e){let t=(0,Mn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,p,m,h,g,_,v,y,b,x,S,C,w,E,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(h=Or(n),g=h!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,p=n.phase===`closed`,m=!!(n.dueAt&&n.dueAt<Date.now()&&!p),d=p?f:de,v=n.priority!==`normal`,_=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=Qr,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=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=qe(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=T(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,g?`pr-19`:h&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E,t[19]=D):(u=t[4],d=t[5],p=t[6],m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],E=t[18],D=t[19]);let O=p?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=T(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Q.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=p?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=T(`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,Q.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,Q.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,Q.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,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Zr).join(`、`)})]}):n.attention[0]?(0,Q.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(Ue,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Q.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]!==m||t[51]!==_||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=_?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Q.jsx)(`span`,{className:T(`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,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Jr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Yr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Q.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,Q.jsx)(Y,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Q.jsxs)(`span`,{className:T(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,m?`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,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Q.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,Q.jsx)(dn,{className:`size-3`,"aria-hidden":!0}),Ft(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=m,t[51]=_,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,Q.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]!==h||t[71]!==g||t[72]!==n?(R=h?(0,Q.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:[g?(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,g),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[g],title:i.actions[g],children:(0,Q.jsx)(Yt,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),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[h],title:i.actions[h],children:(0,Q.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=h,t[71]=g,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]!==E||t[81]!==D?(z=(0,Q.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:E,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]=E,t[81]=D,t[82]=z):z=t[82],z}function Zr(e){return e.title}function Qr(e){e.preventDefault(),e.stopPropagation()}function $r({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:d,ref:f}){let p=(0,Z.useRef)(null),m=(0,Z.useRef)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(`board`),[C,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(()=>crypto.randomUUID()),[A,R]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(`normal`),[V,U]=(0,Z.useState)(``),[ee,W]=(0,Z.useState)([]),[G,K]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),q=k(e=>e.language),J=sn({chat:w(q).chat}),re=Er(e),ie=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void i(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let o=re[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Dr(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=A.trim();if(!(!t||G)){K(!0),ne(null);try{let e=V?new Date(`${V}T23:59:59.999`).getTime():void 0;await c({requestId:D,objective:t,priority:z,dependsOnTaskIds:ee,attachments:J.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),O(crypto.randomUUID()),E(!1)}catch(e){ne(e instanceof Error?e.message:r.createFailed)}finally{K(!1)}}},le=()=>{O(crypto.randomUUID()),R(``),B(`normal`),U(``),W([]),J.clearAttachments(),ne(null),E(!0)};(0,Z.useImperativeHandle)(f,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let ue=(0,Z.useCallback)(e=>{let t=m.current;!t||t.pointerId!==e.pointerId||(m.current=null,v(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Z.useCallback)(e=>{if(e.button!==0||Gr(e.target))return;let t=p.current;t&&(m.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Z.useCallback)(e=>{let t=m.current,n=p.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,v(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Q.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,Q.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(lt,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,Q.jsx)(`div`,{ref:p,className:T(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,_?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:de,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{m.current?.pointerId===e.pointerId&&(m.current=null,v(!1))},children:(0,Q.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Tr.map(t=>{let i=Kr[t],a=re[t];return(0,Q.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Dr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-inset/70 p-2.5`,children:[(0,Q.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-md px-2 py-1`,qr[t]),children:[(0,Q.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Q.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,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Q.jsx)(Xr,{task:e,returnTo:n,copy:r,busy:d===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ir,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,Q.jsx)(L,{open:C,onOpenChange:e=>{G||E(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Q.jsxs)(`div`,{className:T(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,J.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||J.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||J.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),J.setIsDragging(!1),G||J.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Q.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:A,onChange:e=>{R(e.target.value),ne(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,Q.jsx)(ae,{attachments:J.attachments,topPadded:!1,onRemove:e=>{G||J.removeAttachment(e)}}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>J.fileInputRef.current?.click(),children:[(0,Q.jsx)(zt,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Q.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{J.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Q.jsx)(l,{value:z,onChange:e=>B(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Q.jsx)(u,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(bn,{className:`min-h-10 bg-surface-base`,value:V,onChange:U,disabled:G,ariaLabel:r.dueDate})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Q.jsx)(En,{candidates:ie,selectedIds:ee,disabled:G,onChange:W,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),te?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:te}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:r.cancel})}),(0,Q.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!A.trim(),children:G?r.creating:q===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,Q.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,Q.jsx)(`span`,{children:r.moved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var ei=new Set([{id:`overview`,icon:Ne},{id:`tasks`,icon:Tt},{id:`automations`,icon:Lt},{id:`files`,icon:Ke},{id:`notes`,icon:Jt},{id:`skills`,icon:Re},{id:`sessions`,icon:b},{id:`progress`,icon:ot},{id:`settings`,icon:fe}].map(e=>e.id)),ti=`xopc.projectFiles.panelWidthPx`,ni=320,ri=220,ii=560;function ai(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function oi(e){return Math.min(ii,Math.max(ri,Math.round(e)))}function si(){try{let e=window.localStorage.getItem(ti);if(e==null)return ni;let t=Number.parseInt(e,10);return Number.isFinite(t)?oi(t):ni}catch{return ni}}function ci(e){try{window.localStorage.setItem(ti,String(oi(e)))}catch{}}function li(e){return!!(e&&ei.has(e))}function ui(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function di(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ft(n)}function fi(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-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function pi(e){let t=(0,Mn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.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,Q.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,Q.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 mi(e=!1){return T(`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 hi(e){let t=(0,Mn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Q.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=T(`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,Q.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,Q.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 gi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _i(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bi(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function xi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Si(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 Ci(e){let t=e.sourceChannel?.trim();return t?wi(t):``}function wi(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ti(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 Ei(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Di(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Di(e.children,t,n)}:e)}function Oi({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([e]),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(`new`),[C,w]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(!1),[A,R]=(0,Z.useState)(!0),[z,B]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(null),ee=(0,Z.useCallback)(async()=>{m(!0),g(null);try{let t=await Oe({limit:100});u(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){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,Z.useEffect)(()=>{u(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&ee()},[ee,o]);let K=(0,Z.useMemo)(()=>{let t=d.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=gi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_i(t)-_i(e))},[e.id,l,d]),q=e=>t.statuses[e.status]??e.status,J=e=>e.description||e.brief||t.common.defaultWorkspace,ie=e=>{b(e),w(``),D(``),B(null),v(!0),s(!1)},ae=(0,Z.useCallback)(async(e={})=>{let t=E.trim(),n=C.trim()||(y===`directory`?vi(t):``);if(n){k(!0),B(null),U(null);try{let r=await ke({autoUnderstand:A,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),w(``),D(``),R(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),u(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yi(e);t?(U(t),v(!1)):B(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[y,C,a,E,A]),oe=(0,Z.useCallback)(e=>{e.preventDefault(),ae()},[ae]),se=(0,Z.useCallback)(()=>{ae({createWorkspaceRoot:!0})},[ae]),ce=(0,Z.useCallback)(()=>{U(null),v(!0)},[]),le=e=>{D(e),y===`directory`&&!C.trim()&&w(vi(e))},ue=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Q.jsx)(c,{className:T(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]},e.id);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(W,{open:o,onOpenChange:s,children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.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,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fi(e.status)),children:q(e)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:J(e)})]}),(0,Q.jsx)(je,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Q.jsx)(G,{children:(0,Q.jsxs)(ne,{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,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.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:d,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Q.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Q.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,Q.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,Q.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&K.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,K.map(e=>ue(e,!1))]}),(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Q.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:()=>ie(`new`),children:[(0,Q.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Q.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:()=>ie(`directory`),children:[(0,Q.jsx)(Ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Q.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),a(`/projects`)},children:[(0,Q.jsx)(fe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Q.jsx)(L,{open:_,onOpenChange:e=>!O&&v(e),children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:y===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm text-fg-muted`,children:y===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Q.jsxs)(`form`,{onSubmit:oe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,Q.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:z}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Q.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Q.jsx)(gn,{value:E,onChange:le,disabled:O,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,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Q.jsx)(kt,{checked:A,onChange:R,disabled:O})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:O,children:n.cancel})}),(0,Q.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:O||!(C.trim()||y===`directory`&&vi(E)),children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Q.jsx)(L,{open:!!V,onOpenChange:e=>{e||U(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?ui(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:O,children:n.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:O,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ki(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),d=k(e=>e.language),f=w(d),m=f.chat.workingDirectory,h=f.projectDetailPage,y=f.projectsPage,E=gt(e=>e.setPageHeader),D=gt(e=>e.clearPageHeader),[O,A]=(0,Z.useState)(null),V=(0,Z.useRef)(O);(0,Z.useLayoutEffect)(()=>{V.current=O},[O]);let[W,G]=(0,Z.useState)(null),[K,te]=(0,Z.useState)([]),[ne,ie]=(0,Z.useState)(``),[ae,ce]=(0,Z.useState)([]),[le,ue]=(0,Z.useState)(0),[Y,de]=(0,Z.useState)(!1),[pe,me]=(0,Z.useState)(!1),[ge,_e]=(0,Z.useState)(!1),[ye,Se]=(0,Z.useState)([]),[Ce,Te]=(0,Z.useState)(null),Oe=(0,Z.useRef)(new Set),[ke,Ae]=(0,Z.useState)(null),[je,Pe]=(0,Z.useState)(null),[Fe,Ie]=(0,Z.useState)(null),[ze,Be]=(0,Z.useState)(si),[Ve,Ye]=(0,Z.useState)(!1),[Xe,Ze]=(0,Z.useState)(!1),[et,tt]=(0,Z.useState)(``),[ct,dt]=(0,Z.useState)([]),[vt,yt]=(0,Z.useState)(!1),[St,Dt]=(0,Z.useState)(null),[Ot,kt]=(0,Z.useState)(!1),[At,jt]=(0,Z.useState)(null),[Pt,Ft]=(0,Z.useState)([]),[zt,Bt]=(0,Z.useState)(``),[Vt,Wt]=(0,Z.useState)(!0),[Gt,qt]=(0,Z.useState)(!1),[Yt,Xt]=(0,Z.useState)(!1),[Qt,$t]=(0,Z.useState)(null),[tn,rn]=(0,Z.useState)(!1),[sn,ln]=(0,Z.useState)(`fixed`),[dn,_n]=(0,Z.useState)(``),[vn,yn]=(0,Z.useState)(null),[bn,Sn]=(0,Z.useState)(!1),[Cn,wn]=(0,Z.useState)(!1),[Tn,En]=(0,Z.useState)(!1),[Dn,On]=(0,Z.useState)(null),kn=(0,Z.useRef)(null),An=(0,Z.useRef)(!1),[jn,X]=(0,Z.useState)(null),[Mn,Nn]=(0,Z.useState)({title:``,reason:``}),[Pn,Fn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),In=(0,Z.useRef)(Pn),Ln=`overview`,$=n?`notes`:li(t)?t:Ln,Rn=(0,Z.useMemo)(()=>g(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),zn=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Rn===`/projects`?n:_(n,Rn)},[Rn,e]),Bn=(0,Z.useCallback)(t=>{e&&r(zn(t))},[r,e,zn]),Vn=(0,Z.useCallback)(()=>{if($===`tasks`&&kn.current){kn.current.openCreate();return}An.current=!0,Bn(`tasks`)},[Bn,$]);(0,Z.useEffect)(()=>{$!==`tasks`||!An.current||(An.current=!1,kn.current?.openCreate())},[$]);let Hn=(0,Z.useCallback)(t=>{e&&r(zn(t),{replace:!0})},[r,e,zn]),Un=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Hn(e)},[Hn]),Wn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,Z.useEffect)(()=>{!e||!t||li(t)||r(zn(Ln),{replace:!0})},[Ln,r,e,zn,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Wt(!0),X(null),Promise.all([oe(e),Qe(e),he(e),ee().catch(()=>null),at(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;A(e),G(n),te(r),Te(a),Ft(i?.agents??[]),Bt(e.defaultAgentId??``);let o=yr(e);In.current=o,Fn(o)}).catch(e=>{t||(Te(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Wt(!1)}),()=>{t=!0}},[e]);let Gn=(0,Z.useCallback)(async()=>{e&&G(await Qe(e))},[e]);(0,Z.useEffect)(()=>{if(Vt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([oe(e),Qe(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=V.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=br(In.current,i,e);In.current=t,Fn(t)}V.current=e,A(e),G(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(A(null),G(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Vt]),(0,Z.useEffect)(()=>{let t,n=n=>{let r=z.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))},r=n=>{let r=R.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),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,Gn]);let Kn=(0,Z.useCallback)(async(e,t)=>{On(e.id),X(null);try{let n=await un(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 we(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 Le(e.id,r,n.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[W,h.board.actionFailed,Gn]),qn=(0,Z.useCallback)(async t=>{e&&(X(null),await He({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:d,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 Gn())},[d,e,Gn]),Jn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{return await De(e,t,(await un(e)).task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Yn=(0,Z.useCallback)(async(e,t,n)=>{On(e),X(null);try{let r=await un(e);return r.task.phase!==t&&(r=await Le(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 De(e,n,r.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed),!1}finally{On(null)}},[h.board.actionFailed,Gn]),Xn=(0,Z.useCallback)(async(e,t)=>{On(e),X(null);try{await pt(e,t,(await un(e)).task.version),await Gn()}catch(e){await Gn().catch(()=>void 0),X(e instanceof Error?e.message:h.board.actionFailed)}finally{On(null)}},[h.board.actionFailed,Gn]),Zn=(0,Z.useCallback)(async()=>{if(O){de(!0),X(null);try{let e=await nt(O.id,{includeRelated:pe,limit:100});ce(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{de(!1)}}},[O,pe]);(0,Z.useEffect)(()=>{$===`progress`&&Zn()},[Zn,$]);let Qn=(0,Z.useCallback)(async()=>{if(!O?.effectiveWorkspaceRoot?.trim()){Se([]),Oe.current.clear(),jt(null);return}kt(!0),jt(null),Oe.current.clear();try{Se(Ei((await ve(O.id,``)).entries)),Oe.current.add(``)}catch(e){Se([]),Oe.current.clear(),jt(e instanceof Error?e.message:String(e))}finally{kt(!1)}},[O]),$n=(0,Z.useCallback)(async e=>{if(!(!O?.effectiveWorkspaceRoot?.trim()||Oe.current.has(e))){Oe.current.add(e),jt(null);try{let t=await ve(O.id,e);Se(n=>Di(n,e,Ei(t.entries)))}catch(t){Oe.current.delete(e),jt(t instanceof Error?t.message:String(t))}}},[O]),er=(0,Z.useCallback)(async e=>{if(!O?.effectiveWorkspaceRoot?.trim())return;let t=Ei((await ve(O.id,e)).entries);Se(e?n=>Di(n,e,t):t),Oe.current.add(e)},[O]);(0,Z.useEffect)(()=>{$===`files`&&Qn()},[Qn,$]);let tr=et.trim();(0,Z.useEffect)(()=>{if($!==`files`||!O||!Xe||!tr){dt([]),yt(!1),Dt(null);return}let e=!1;yt(!0),Dt(null),dt([]);let t=window.setTimeout(()=>{st(O.id,tr,50).then(t=>{e||dt(t)}).catch(t=>{e||Dt(t instanceof Error?t.message:String(t))}).finally(()=>{e||yt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[tr,O,Xe,$]);let nr=(0,Z.useCallback)(async()=>{if(!O)return;let[e,t]=await Promise.all([oe(O.id),Qe(O.id)]);G(t),A(e)},[O]),rr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!O||!Mn.title.trim())){wn(!0),X(null);try{await Je(O.id,{title:Mn.title.trim(),reason:Mn.reason.trim()||void 0}),Nn({title:``,reason:``}),En(!1),await nr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{wn(!1)}}},[Mn.reason,Mn.title,O,nr]),ir=(0,Z.useMemo)(()=>(0,Q.jsx)(s,{to:Rn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Rn===`/projects`?h.backToProjects:f.sidebar.back,children:(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),[Rn,f.sidebar.back,h.backToProjects]),ar=(0,Z.useMemo)(()=>O?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hn,{resource:{kind:`project`,id:O.id,revision:String(O.version)},disabled:Gt||ai(Pn,O)}),(0,Q.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(O.id)}`,children:[(0,Q.jsx)(lt,{className:`size-4`,"aria-hidden":!0}),h.common.runWorkflow]})}),(0,Q.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Vn,children:[(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}),h.board.create]}),(0,Q.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:Mt(O.id),state:{forceNewChat:!0,agentId:O.defaultAgentId},onClick:Un(`sessions`),children:[(0,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0}),h.common.newChat]})})]}):null,[Vn,Un,h.board.create,h.common.newChat,h.common.runWorkflow,O,Gt,Pn]);(0,Z.useLayoutEffect)(()=>(E({startExtra:ir,main:O?(0,Q.jsx)(Oi,{currentProject:O,pm:h,projectsText:y,wd:m}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.fallbackTitle}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:h.fallbackContext})]}),end:ar}),()=>D()),[D,ar,ir,h,O,y,E,m]);function sr(e){A(t=>t?{...t,...e}:null),Bt(e.defaultAgentId??``),at(e.id).then(Te).catch(()=>Te(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function cr(e=In.current){if(!(!O||!ai(e,O))){X(null),$t(null);try{let t=await We(O.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},O.version);sr(t);let n=In.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};In.current=r,Fn(r)}catch(e){let t=yi(e);throw t?$t(t):X(e instanceof Error?e.message:String(e)),e}}}function lr(e){e.preventDefault(),kr.flush()}function ur(e,t=!1){let n={...In.current,...e};In.current=n,Fn(n),t&&kr.saveNow(n)}let dr=(0,Z.useCallback)(()=>{if(!O)return;let e=O.workspaceRoot?.trim()??``;ln(e?`fixed`:`follow`),_n(e||O.effectiveWorkspaceRoot||``),rn(!0)},[O]);async function fr(e={}){if(!O)return;let t=sn===`fixed`?dn.trim():``;if(!(sn===`fixed`&&!t)){qt(!0),X(null),$t(null);try{let n=await We(O.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},O.version);sr(n),ur({workspaceRoot:n.workspaceRoot??``}),rn(!1),$t(null)}catch(e){let t=yi(e);t?($t(t),rn(!1)):X(e instanceof Error?e.message:String(e))}finally{qt(!1)}}}async function pr(){if(!(!O||vn)){yn(`pin`),X(null);try{sr(O.pinnedAt?await mt(O.id,O.version):await Kt(O.id,O.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function hr(){if(!(!O||vn)){yn(`archive`),X(null);try{let e=O.status===`archived`?await Ee(O.id,O.version):await xe(O.id,O.version);sr(e),ur({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(null)}}}async function gr(){if(O){Sn(!0),X(null);try{await cn(O.id,O.version),Xt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Sn(!1)}}}async function _r(){if(!(!O||ge)){_e(!0),X(null);try{await ft(O.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_e(!1)}}}let vr=(0,Z.useCallback)(e=>{Ae(e)},[]),xr=(0,Z.useCallback)((e,t)=>{t||Ae(e)},[]),Sr=(0,Z.useCallback)(async(e,t,n)=>{let r=O?.id;if(r)switch(e){case`preview`:t.isDirectory||Ae(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Zt(t.path);if(Ct(Nt(e))!==`text`){let n=await wt(t.path,{projectId:r}),i=U(e)??`application/octet-stream`;It(e,await n.arrayBuffer(),i)}else{let{content:n}=await ht(t.path,{projectId:r});Et(e,n)}}catch(e){be(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await B(t.path)&&be(`success`,f.workspace.pathCopied,void 0,{duration:2500})}catch{be(`warning`,f.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await $e(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWith`:await $e(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),f.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await $e(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),f.workspace.openFileFailed);break;case`revealInFolder`:await $e(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),f.workspace.revealFileFailed);break;case`trash`:Pe(t);break;case`delete`:t.isDirectory||Ie(t);break;default:break}},[f.clipboard.copyFailed,f.workspace.openFileFailed,f.workspace.pathCopied,f.workspace.revealFileFailed,O?.id]),Cr=(0,Z.useCallback)(async()=>{let e=je;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){be(`warning`,t?.error??f.workspace.trashFailed,void 0,{duration:4e3});return}ke===e.path&&Ae(null),Pe(null),await Qn(),be(`success`,f.workspace.trashSuccess,void 0,{duration:2500})},[f.workspace.trashFailed,f.workspace.trashSuccess,je,ke,Qn]),Tr=(0,Z.useCallback)(async(e,t)=>{let n=O?.id;if(n)try{await Promise.all(e.map(e=>en(e,t,{projectId:n}))),await er(t).catch(()=>void 0),be(`success`,f.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await er(t).catch(()=>void 0),be(`warning`,`${f.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.uploadFailed,f.workspace.uploadSuccess,O?.id,er]),Er=(0,Z.useCallback)(async()=>{let e=Fe;if(e)try{await Ht(e.fileId),ke===e.path&&Ae(null),Ie(null);let t=e.path.lastIndexOf(`/`);await er(t<0?``:e.path.slice(0,t)).catch(()=>void 0),be(`success`,f.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){be(`warning`,`${f.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[f.workspace.deleteFailed,f.workspace.deleteSuccess,Fe,ke,er]),Dr=(0,Z.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),Ye(!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=oi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ye(!1),Be(c),ci(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,Z.useEffect)(()=>{$!==`files`&&Ae(null)},[e,$]);let Or=!!(O&&ai(Pn,O)),kr=mn({value:O?Pn:null,dirty:Or,onSave:cr,validate:e=>e.name.trim()?null:h.settings.nameRequired});if(Vt)return(0,Q.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:h.loading});if(!O)return(0,Q.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(s,{to:Rn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Q.jsx)(xt,{className:`size-4`,"aria-hidden":!0}),Rn===`/projects`?h.backToProjects:f.sidebar.back]}),(0,Q.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:jn||h.notFound})]});let Ar=K.slice(0,3),jr=W?.blockers??[],Mr=wr(W?.tasks??[]),Nr=W?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Pr=e=>h.statuses[e]??e,Fr=e=>ui(h.common.messages,{count:e}),Ir=ne.trim().toLowerCase(),Lr=Ir?K.filter(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=e.name?.trim()||h.sessions.fallbackTitle,i=Fr(e.messageCount??0),a=Ci(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Ir)}):K,Rr=K.length>0&&Lr.length===0,zr=Pt.find(e=>e.id===O.defaultAgentId)?.name||O.defaultAgentId||h.settings.globalDefaultAgent,Br=Pt.find(e=>e.id===Pn.defaultAgentId),Vr=O.workspaceRoot?.trim()||``,Hr=O.status===`archived`,Ur=!!O.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,Kr=sn===`fixed`?dn.trim()||h.settings.workspacePlaceholder:Br?.workspace||O.effectiveWorkspaceRoot||h.common.defaultWorkspace,qr=(sn===`fixed`?dn.trim():``)!==Vr&&(sn===`follow`||!!dn.trim()),Jr=[{id:`overview`,icon:Ne,label:h.tabs.overview},{id:`tasks`,icon:Tt,label:h.tabs.tasks},{id:`automations`,icon:Lt,label:h.tabs.automations},{id:`files`,icon:Ke,label:h.tabs.files},{id:`notes`,icon:Jt,label:h.tabs.notes},{id:`skills`,icon:Re,label:h.tabs.skills},{id:`sessions`,icon:b,label:h.tabs.sessions},{id:`progress`,icon:ot,label:h.tabs.progress}];async function Yr(){if(!Gr)return;let e=await B(Gr);be(e?`success`:`warning`,e?f.workspace.pathCopied:f.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){$t(null),rn(!0)}return(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(fn,{items:Jr,activeTab:$,onChange:Bn,ariaLabel:h.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Q.jsxs)(H,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Bn(`settings`),children:[(0,Q.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),h.tabs.settings,Or?(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":h.settings.unsavedChanges}):null]})]}),jn?(0,Q.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:jn}):null,(0,Q.jsxs)(`div`,{className:T(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Q.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,Q.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,Q.jsx)(Me,{projectId:O.id},O.id),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`p-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.directionTitle}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ui(h.overview.activitySummary,{moving:Nr,attention:jr.length})})]}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:O.outcome||O.description||O.brief||h.overview.directionFallback}),W?.digest.recommendedAction?(0,Q.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:ui(h.overview.recommendedNext,{action:W.digest.recommendedAction})}):null]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void _r(),disabled:ge,children:[(0,Q.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),ge?h.overview.savingDigest:h.overview.saveDigest]})]})}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.nextActions}),(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Bn(`tasks`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Mr.length?Mr.map(e=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsxs)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[h.board.phases[e.phase],e.operationalState===`idle`?``:` · ${h.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noNextActions})})]})]}),W?.recentResults.length?(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.recentResults})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:W.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Q.jsxs)(s,{to:qe(zn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[h.overview.resultStatuses[n.status],` · `,h.board.verification[n.verification.status]]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Q.jsx)(v,{content:n.summary,compact:!0})})]},n.runId))})]}):null,O.milestones.length||O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[O.milestones.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.milestones})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.milestones.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:h.statuses[e.status]})]},e.id))})]}):null,O.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.projectUpdates})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentUpdates.slice(0,3).map(e=>(0,Q.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Q.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,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.overview.attention}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Tn,onClick:()=>En(e=>!e),children:[(0,Q.jsx)(x,{className:T(`size-3.5 transition-transform`,Tn&&`rotate-45`),"aria-hidden":!0}),h.overview.addBlocker]})]}),jr.length?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jr.map(e=>{let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ue,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Q.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[h.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Pr(e.status)}`:``]})]});return e.href?(0,Q.jsx)(s,{to:e.href,onClick:Un(Wn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Q.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.overview.noBlockedTasks}),Tn?(0,Q.jsxs)(`form`,{onSubmit:rr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Q.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:Mn.title,onChange:e=>Nn(t=>({...t,title:e.target.value})),placeholder:h.overview.blockerTitlePlaceholder}),(0,Q.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:Cn||!Mn.title.trim(),"aria-label":Cn?h.overview.addingBlocker:h.overview.addBlocker,title:Cn?h.overview.addingBlocker:h.overview.addBlocker,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(an,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:h.overview.recentSessions})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Bn(`sessions`),children:h.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Ar.length?Ar.map(e=>(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:di(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==O.defaultAgentId?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Q.jsx)($r,{ref:kn,tasks:W?.tasks??[],dependencyEdges:W?.dependencyEdges??[],returnTo:zn(`tasks`),copy:h.board,onAction:Kn,onReorder:Jn,onUndoMove:Yn,onDependenciesChange:Xn,onCreate:qn,actionBusyId:Dn}):null,$===`automations`?(0,Q.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,Q.jsx)(xn,{projectId:O.id,embedded:!0,title:h.automations.title,subtitle:h.automations.hint})}):null,$===`notes`?(0,Q.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,Q.jsx)(or,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(O.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:O.id,listTitle:h.notes.title,listDescription:h.notes.hint,emptyText:h.notes.emptyTitle,emptyDescription:h.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${O.id}`})}):null,$===`skills`?(0,Q.jsx)(mr,{projectId:O.id,copy:h.skills}):null,$===`files`?(0,Q.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,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:O.effectiveWorkspaceRoot?(0,Q.jsxs)(`div`,{"data-project-files-grid":!0,className:T(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,Ve&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${ze}px`},children:[(0,Q.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:T(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Xe&&`bg-surface-hover text-fg`),onClick:()=>Ze(!0),"aria-label":h.files.search,title:h.files.search,"aria-pressed":Xe,children:(0,Q.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(_t,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ot,label:f.cron.refresh,onClick:()=>void Qn()})]})]}),Xe?(0,Q.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,Q.jsx)(S,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`text`,role:`searchbox`,value:et,onChange:e=>tt(e.target.value),placeholder:h.files.searchPlaceholder,"aria-label":h.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Q.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":h.files.clearSearch,title:h.files.clearSearch,onClick:()=>{tt(``),Ze(!1)},children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,At?(0,Q.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:At}):null,tr?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:vt?(0,Q.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`}),(0,Q.jsx)(q,{className:`h-11 w-full`})]}):St?(0,Q.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[f.workspace.loadError,`: `,St]}):ct.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:h.files.noSearchResults}):ct.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,ke===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Ae(e.path),title:e.path,children:[(0,Q.jsx)(Jt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ot&&ye.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:h.files.loading}):(0,Q.jsx)(on,{tree:ye,selectedPath:ke,onSelectFile:vr,onSelectEntry:xr,onExpandDir:e=>void $n(e),onAction:Sr,onUploadFiles:(e,t)=>void Tr(e,t),uploadDropHint:f.workspace.dropToUpload,actionLabels:{preview:f.workspace.preview,download:f.workspace.download,copyPath:f.workspace.copyPath,openDefault:f.workspace.openSystemApp,openDirectory:f.workspace.openInFileManager,openWith:f.workspace.openWith,revealInFolder:f.workspace.revealInFolder,trash:f.workspace.moveToTrash,delete:f.workspace.deleteFile,recommendedApps:f.workspace.recommendedApps,desktopUpdateRequired:f.workspace.desktopUpdateRequired},emptyHint:h.files.emptyDirectory})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.files.resizeHandle,className:T(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,Ve&&`bg-surface-hover/70`),onPointerDown:Dr,children:(0,Q.jsx)(`div`,{className:T(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,Ve&&`bg-accent/60`)})}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:ke?(0,Q.jsx)(ut,{filePath:ke,projectId:O.id,agentId:O.defaultAgentId||zt||void 0,onClose:()=>Ae(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(Ke,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h.files.previewEmptyTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.files.previewEmptyDescription})]})})})]}):(0,Q.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:h.files.needWorkspace}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Bn(`settings`),children:h.files.openSettings})})]})})}):null,$===`sessions`?(0,Q.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[K.length?(0,Q.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,Q.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:ne,onChange:e=>ie(e.currentTarget.value),placeholder:h.sessions.searchPlaceholder,"aria-label":h.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`}),ne?(0,Q.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":h.sessions.clearSearch,onClick:()=>ie(``),children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=di(e.updatedAt),n=e.routing?.agentId||e.agentId||h.common.agent,r=Ci(e),i=e.name?.trim()||h.sessions.fallbackTitle,a=Fr(e.messageCount??0);return(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.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,Q.jsx)(b,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Q.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,Q.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.agent,`: `,n]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Q.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[h.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.noMatches})}):(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:h.sessions.emptyTitle}),(0,Q.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:h.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.progress.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ui(h.progress.count,{count:le})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:pe,onChange:e=>me(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),h.progress.includeRelated]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Zn(),disabled:Y,children:[(0,Q.jsx)(rt,{className:T(`size-4`,Y&&`animate-spin`),"aria-hidden":!0}),h.common.refresh]})]})]}),(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Y&&ae.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.loading}):ae.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:ae.map(e=>{let t=h.progress.types[e.type]??e.type,n=h.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ti(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===O.id);return(0,Q.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:h.progress.related}):null]}),(0,Q.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xi(e)]})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:di(e.createdAt)})]}),r?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[h.progress.actor,`: `,bi(e)]}),(0,Q.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[h.progress.source,`: `,Si(e)]})]})]},e.id)})}):(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:h.progress.empty})})]}):null,$===`settings`?(0,Q.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:lr,onBlurCapture:kr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Q.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.summaryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:h.settings.summaryHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,fi(Pn.status)),children:h.settings.statuses[Pn.status]}),(0,Q.jsx)(pn,{status:kr.status,error:kr.error})]})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.detailsTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.detailsHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(pi,{label:h.settings.name,children:(0,Q.jsx)(`input`,{className:mi(),value:Pn.name,onChange:e=>ur({name:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.defaultAgent,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.defaultAgentId,onChange:e=>ur({defaultAgentId:e.target.value},!0),children:[(0,Q.jsx)(u,{value:``,children:h.settings.globalDefaultAgent}),Pt.map(e=>(0,Q.jsx)(u,{value:e.id,children:bt(e,f.agentsSettings)},e.id))]})}),(0,Q.jsx)(pi,{label:h.settings.status,children:Hr?(0,Q.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:h.settings.statuses.archived}):(0,Q.jsxs)(l,{className:mi(),value:Pn.status===`archived`?`active`:Pn.status,onChange:e=>ur({status:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`active`,children:h.settings.statuses.active}),(0,Q.jsx)(u,{value:`paused`,children:h.settings.statuses.paused})]})}),(0,Q.jsx)(pi,{label:h.settings.executionMode,hint:h.settings.executionModeHint,children:(0,Q.jsxs)(l,{className:mi(),value:Pn.executionMode,onChange:e=>ur({executionMode:e.target.value},!0),children:[(0,Q.jsx)(u,{value:`managed_worktree`,children:h.settings.executionModeWorktree}),(0,Q.jsx)(u,{value:`local_checkout`,children:h.settings.executionModeLocal})]})}),(0,Q.jsx)(pi,{label:h.settings.description,hint:h.settings.descriptionHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.description,onChange:e=>ur({description:e.target.value})})})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.projectGuidanceTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.projectGuidanceHint})]}),(0,Q.jsx)(pi,{label:h.settings.brief,hint:h.settings.briefHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.brief,onChange:e=>ur({brief:e.target.value})})}),(0,Q.jsx)(pi,{label:h.settings.instructions,hint:h.settings.instructionsHint,children:(0,Q.jsx)(`textarea`,{className:mi(!0),value:Pn.instructions,onChange:e=>ur({instructions:e.target.value})})})]})]}),(0,Q.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.workspaceRoot}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceIndependentHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?h.settings.workspaceModeFollow:h.settings.workspaceModeFixed}),(0,Q.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0}),h.settings.copyWorkspacePath]}),Ce?(0,Q.jsx)(it,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:dr,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.migrateWorkspace]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.currentProjectTitle}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.defaultAgent,value:zr}),(0,Q.jsx)(hi,{label:h.settings.pinState,value:Ur?h.settings.pinned:h.settings.notPinned}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(hi,{label:h.settings.createdAt,value:di(O.createdAt)||h.common.never}),(0,Q.jsx)(hi,{label:h.settings.updatedAt,value:di(O.updatedAt)||h.common.never})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h.settings.managementTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.managementHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?h.settings.pinnedTitle:h.settings.pinTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:h.settings.pinHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`pin`,onClick:()=>void pr(),children:[Ur?(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(J,{className:`size-4`,"aria-hidden":!0}),Ur?h.settings.unpinProject:h.settings.pinProject]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?h.settings.restoreTitle:h.settings.archiveTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?h.settings.restoreHint:h.settings.archiveHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:vn===`archive`,onClick:()=>void hr(),children:[Hr?(0,Q.jsx)(rt,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Rt,{className:`size-4`,"aria-hidden":!0}),Hr?h.settings.restoreProject:h.settings.archiveProject]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:h.settings.dangerTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:h.settings.dangerHint})]}),(0,Q.jsxs)(H,{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:()=>Xt(!0),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Q.jsx)(L,{open:Yt,onOpenChange:e=>{bn||Xt(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay p-5 shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.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,Q.jsx)(Ue,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.deleteConfirmTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O?ui(h.settings.deleteConfirm,{name:O.name}):h.settings.deleteConfirmFallback})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:bn,children:h.common.cancel})}),(0,Q.jsxs)(H,{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:bn||!O,onClick:()=>void gr(),children:[(0,Q.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),h.settings.deleteConfirmAction]})]})]})]})}),(0,Q.jsx)(nn,{open:!!je,title:f.workspace.trashConfirmTitle,description:f.workspace.trashConfirmDescription.replace(`{{name}}`,je?.name??``),confirmLabel:f.workspace.moveToTrash,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Cr(),onCancel:()=>Pe(null)}),(0,Q.jsx)(nn,{open:!!Fe,title:f.workspace.deleteConfirmTitle,description:f.workspace.deleteConfirmDescription.replace(`{{name}}`,Fe?.name??``),confirmLabel:f.workspace.deleteFile,cancelLabel:f.workspace.cancel,destructive:!0,onConfirm:()=>void Er(),onCancel:()=>Ie(null)}),(0,Q.jsx)(L,{open:tn,onOpenChange:e=>{Gt||rn(e)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMigrationTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:h.settings.workspaceMigrationDescription})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:h.settings.workspaceMode}),(0,Q.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`fixed`,onChange:()=>ln(`fixed`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFixed}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceMigrationFixedHint})]})]}),(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`follow`,onChange:()=>ln(`follow`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:h.settings.workspaceModeFollow}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:h.settings.workspaceHint})]})]})]})]}),sn===`fixed`?(0,Q.jsx)(gn,{value:dn,onChange:_n,disabled:Gt,wd:m,placeholder:h.settings.workspacePlaceholder,inputClassName:mi(),autoFocus:!0}):null,(0,Q.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:h.settings.workspaceMigrationImpact}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:ui(h.settings.workspaceCurrent,{workspace:Kr})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Gt,children:h.common.cancel})}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Gt||!qr,onClick:()=>void fr(),children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Q.jsx)(L,{open:!!Qt,onOpenChange:e=>{e||$t(null)},children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(j,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(F,{className:`xopc-dialog-content 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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(I,{className:`text-base font-semibold text-fg`,children:h.settings.workspaceMissingTitle}),(0,Q.jsx)(M,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Qt?ui(h.settings.workspaceMissingDescription,{workspace:Qt}):null})]}),Qt?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ke,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:Qt})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:Gt,children:h.settings.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void fr({createWorkspaceRoot:!0}),disabled:Gt,children:[(0,Q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),h.settings.workspaceMissingCreate]})]})]})]})})]})}export{ki as ProjectDetailPage};