@xopcai/xopc 0.0.286 → 0.0.291

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 (445) hide show
  1. package/README.md +16 -0
  2. package/README.zh-CN.md +16 -0
  3. package/dist/browser-ext/dist/assets/{auth-BXCWrPlg.js → auth-B2CDTr_F.js} +2 -1
  4. package/dist/browser-ext/dist/background.js +1 -1
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +36 -10
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/gateway/static/root/assets/{activity-store-xOhV8FHx.js → activity-store-6lmzUBEr.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzQbYWEj.js → agent-avatar-dicebear-BCtrkF15.js} +1 -1
  11. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2eYNelh.js +1 -0
  12. package/dist/gateway/static/root/assets/agents-BedA5XwI.js +1 -0
  13. package/dist/gateway/static/root/assets/{api-CVJQLBv9.js → api-D6yepxBp.js} +1 -1
  14. package/dist/gateway/static/root/assets/api-Dnfnl1Gd.js +1 -0
  15. package/dist/gateway/static/root/assets/{app-management-settings-panel-CTyuXkNC.js → app-management-settings-panel-Md562Fo-.js} +1 -1
  16. package/dist/gateway/static/root/assets/{appearance-settings-Tk-GJtvF.js → appearance-settings-BiBFI4BM.js} +1 -1
  17. package/dist/gateway/static/root/assets/{apps-page-BA-7OrhJ.js → apps-page-Corla83b.js} +1 -1
  18. package/dist/gateway/static/root/assets/{archive-plugin-O49jeeXo.js → archive-plugin-A_Unp751.js} +1 -1
  19. package/dist/gateway/static/root/assets/{attachment-load-r9lBF2tW.js → attachment-load-D6idSUyP.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-CFFLXYgS.js → automations-page-C6j71Lgs.js} +1 -1
  21. package/dist/gateway/static/root/assets/automations-workspace-DjZdhLQ5.js +6 -0
  22. package/dist/gateway/static/root/assets/{binary-plugins-BpM43vsn.js → binary-plugins-BkKYh-8v.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-DFrfEcGw.js → block-editor-CDcMvaku.js} +3 -3
  24. package/dist/gateway/static/root/assets/{browser-automation-inputs-CyHGQwxQ.js → browser-automation-inputs-Cq4sIJt2.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-automations-page-CPkOWfM9.js → browser-automations-page-C64k4TBH.js} +2 -2
  26. package/dist/gateway/static/root/assets/{browser-settings-page-BOcseZxg.js → browser-settings-page-1k5rj_qR.js} +3 -3
  27. package/dist/gateway/static/root/assets/capabilities-settings-panel-B2NvoTYb.js +8 -0
  28. package/dist/gateway/static/root/assets/channels-settings-DExixzp4.js +1 -0
  29. package/dist/gateway/static/root/assets/{channels-status-swr-BArPeImO.js → channels-status-swr-CVzEYBpX.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-D5Aka4S8.js → chat-terminal-dock-B9eKFkbg.js} +2 -2
  31. package/dist/gateway/static/root/assets/computer-model-settings-DW6j2lsn.js +1 -0
  32. package/dist/gateway/static/root/assets/computer-settings-page-C2Qyw63Q.js +1 -0
  33. package/dist/gateway/static/root/assets/connectors-page-C3ubZz7K.js +2 -0
  34. package/dist/gateway/static/root/assets/{date-picker-DNtRu6EB.js → date-picker-BdxjXVKL.js} +1 -1
  35. package/dist/gateway/static/root/assets/{dependency-picker-Dng3dIQa.js → dependency-picker-CXOa4uh4.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-BicYycxy.js → desktop-pet-CBWiAaSv.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-settings-BEse55eX.js → desktop-pet-settings-BX1aILDK.js} +1 -1
  38. package/dist/gateway/static/root/assets/{device-pairing-wizard-be30HuFI.js → device-pairing-wizard-bqm_Yf4i.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-debug-page-YzhYyuay.js → extension-debug-page-B4MMerja.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-page-CEXVIkDl.js → extension-page-B3ZtINak.js} +1 -1
  41. package/dist/gateway/static/root/assets/{extension-settings-page-CrlbgK8g.js → extension-settings-page-8BkQVh0z.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-config-swr-BNuoHXiZ.js → gateway-config-swr-BBovMBQ1.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-settings-ZyhacQX5.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry-zMPfje0n.js → gateway-startup-retry-NXDtzZED.js} +1 -1
  45. package/dist/gateway/static/root/assets/{heartbeat-settings-BtxitqZ3.js → heartbeat-settings-Bllcxm2A.js} +1 -1
  46. package/dist/gateway/static/root/assets/home-page-Cv2e8XBR.js +1 -0
  47. package/dist/gateway/static/root/assets/{image-generation-api-B_Tyx74A.js → image-generation-api-D01ieqGC.js} +1 -1
  48. package/dist/gateway/static/root/assets/{imports-page-eZciuLw_.js → imports-page-DJG1BJzd.js} +1 -1
  49. package/dist/gateway/static/root/assets/index-B7EieIE4.js +75 -0
  50. package/dist/gateway/static/root/assets/index-BD5uNzie.css +2 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B796W039.js → keyboard-shortcuts-settings-6A6JOHTI.js} +1 -1
  52. package/dist/gateway/static/root/assets/local-app-workbench-page-Cipj52Zq.js +2 -0
  53. package/dist/gateway/static/root/assets/{local-apps-page-DXmY5jwM.js → local-apps-page-bD-m7YHJ.js} +1 -1
  54. package/dist/gateway/static/root/assets/{locale-store-D0001I7p.js → locale-store-eliqUnBr.js} +1 -1
  55. package/dist/gateway/static/root/assets/logs-page-D5feO2yw.js +2 -0
  56. package/dist/gateway/static/root/assets/{management-settings-b1MG7s-3.js → management-settings-B7mz0_44.js} +1 -1
  57. package/dist/gateway/static/root/assets/{markdown-view-2txE_Blz.js → markdown-view-BIg7cei7.js} +1 -1
  58. package/dist/gateway/static/root/assets/{media-plugins-CDEf3ksI.js → media-plugins-DQ2HfMeG.js} +1 -1
  59. package/dist/gateway/static/root/assets/messages-NYDOR8-j.js +3 -0
  60. package/dist/gateway/static/root/assets/note-detail-panel-DhYJigb3.js +5 -0
  61. package/dist/gateway/static/root/assets/notes-page-Bg5NPUdf.js +8 -0
  62. package/dist/gateway/static/root/assets/{page-tabs-Bi_-DA5J.js → page-tabs-DmG_Qjl8.js} +1 -1
  63. package/dist/gateway/static/root/assets/{preview-open-alternatives-Dhfdf14p.js → preview-open-alternatives-Y9J1kjKC.js} +1 -1
  64. package/dist/gateway/static/root/assets/{proactive-page-BNouL7Tv.js → proactive-page-Duc_NQ8l.js} +1 -1
  65. package/dist/gateway/static/root/assets/{product-open-page-BkbZBqBr.js → product-open-page-DtgWUAwT.js} +1 -1
  66. package/dist/gateway/static/root/assets/project-detail-page-DVOiucVA.js +1 -0
  67. package/dist/gateway/static/root/assets/projects-page-Dr_kDoCJ.js +1 -0
  68. package/dist/gateway/static/root/assets/{registry-api-icwoEKYB.js → registry-api-Dpm3N2h0.js} +1 -1
  69. package/dist/gateway/static/root/assets/remote-access-hub-hyJ2KKKK.js +1 -0
  70. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bmgxwWpW.js → runtime-tools-settings-panel-DB7J9opJ.js} +2 -2
  71. package/dist/gateway/static/root/assets/{schema-form-DoZeepCg.js → schema-form-CMYuPOlE.js} +1 -1
  72. package/dist/gateway/static/root/assets/sessions-page-DGsnYcoh.js +1 -0
  73. package/dist/gateway/static/root/assets/settings-advanced-gate-DuzZqQMn.js +1 -0
  74. package/dist/gateway/static/root/assets/{settings-form-section-sw2bbS2b.js → settings-form-section-BayJP08a.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-BWF8uac0.js → settings-page-CWBqZtt6.js} +1 -1
  76. package/dist/gateway/static/root/assets/setup-status-panel-C97S5g5c.js +1 -0
  77. package/dist/gateway/static/root/assets/{share-preview-page-BIHYD6-O.js → share-preview-page-Wn5bQA-5.js} +1 -1
  78. package/dist/gateway/static/root/assets/shares-settings-pfVzP8F7.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-DDJ0ZKx3.js +1 -0
  80. package/dist/gateway/static/root/assets/skills-page-DbDpLjDW.js +2 -0
  81. package/dist/gateway/static/root/assets/{skills-page.utils-dvue6Ish.js → skills-page.utils-DCHY_kou.js} +1 -1
  82. package/dist/gateway/static/root/assets/{system-settings-panel-DCyxPWCl.js → system-settings-panel-DhgITgId.js} +1 -1
  83. package/dist/gateway/static/root/assets/task-detail-page-UqwtiHYu.js +1 -0
  84. package/dist/gateway/static/root/assets/{theme-store-CZwYGpbY.js → theme-store-DUHPzKzv.js} +1 -1
  85. package/dist/gateway/static/root/assets/{tunnel-api-__auf8Ww.js → tunnel-api-DJ3gz2tM.js} +1 -1
  86. package/dist/gateway/static/root/assets/{use-autosave-Iq83UDt3.js → use-autosave-htvgT192.js} +1 -1
  87. package/dist/gateway/static/root/assets/user-model-page-xOsXY_2W.js +2 -0
  88. package/dist/gateway/static/root/assets/{voice-api-key-field-D-QssKik.js → voice-api-key-field-BviJF3Oa.js} +1 -1
  89. package/dist/gateway/static/root/assets/{voice-config-api-B0wNN_tE.js → voice-config-api-Bjy8EFqi.js} +1 -1
  90. package/dist/gateway/static/root/assets/{work-discovery-overlay-5NRYg1iI.js → work-discovery-overlay-BOBVNEYZ.js} +1 -1
  91. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ds2SZjLG.js → workflow-run-setup-panel-D1N9uUyM.js} +2 -2
  92. package/dist/gateway/static/root/assets/workflows-page-2ylzlgkG.js +6 -0
  93. package/dist/gateway/static/root/index.html +10 -10
  94. package/dist/package.js +1 -1
  95. package/dist/packages/computer-control-contract/src/index.js +178 -0
  96. package/dist/packages/realtime-protocol/src/voice-audio.js +15 -10
  97. package/dist/packages/realtime-protocol/src/voice-catalog.js +61 -0
  98. package/dist/packages/realtime-protocol/src/voice.js +257 -248
  99. package/dist/src/agent/agent-manager.d.ts +1 -0
  100. package/dist/src/agent/agent-manager.js +5 -4
  101. package/dist/src/agent/background-review/run-background-review.js +1 -1
  102. package/dist/src/agent/embedded/model-runtime.js +1 -1
  103. package/dist/src/agent/embedded/run-for-session.js +1 -1
  104. package/dist/src/agent/embedded/run-turn.js +9 -1
  105. package/dist/src/agent/external-tools/endpoint-provider.js +4 -2
  106. package/dist/src/agent/image/tool-model-config.js +1 -1
  107. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  108. package/dist/src/agent/service.js +2 -2
  109. package/dist/src/agent/session/session-inspector.js +1 -1
  110. package/dist/src/agent/skills/hub-lock.js +1 -1
  111. package/dist/src/agent/skills/index.js +25 -15
  112. package/dist/src/agent/skills/parse-skill-metadata.d.ts +5 -1
  113. package/dist/src/agent/skills/parse-skill-metadata.js +21 -1
  114. package/dist/src/agent/skills/types.d.ts +7 -0
  115. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  116. package/dist/src/agent/tool-manuals/computer.d.ts +1 -0
  117. package/dist/src/agent/tool-manuals/computer.js +19 -0
  118. package/dist/src/agent/tool-manuals/index.js +7 -0
  119. package/dist/src/agent/tools/computer-use-tool.d.ts +11 -0
  120. package/dist/src/agent/tools/computer-use-tool.js +86 -0
  121. package/dist/src/agent/tools/factory.d.ts +2 -0
  122. package/dist/src/agent/tools/factory.js +30 -0
  123. package/dist/src/agent-config/index.js +2 -2
  124. package/dist/src/agent-config/resolver.js +5 -0
  125. package/dist/src/agent-config/schema.d.ts +32 -0
  126. package/dist/src/agent-config/schema.js +5 -2
  127. package/dist/src/ai-assist/text-assist.js +1 -1
  128. package/dist/src/auth/credentials.js +2 -2
  129. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  130. package/dist/src/auth/profiles/store.js +1 -1
  131. package/dist/src/auth/sync-provider-auth.js +2 -2
  132. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  133. package/dist/src/capabilities/readiness/from-config.js +14 -2
  134. package/dist/src/capabilities/readiness/planner.js +3 -2
  135. package/dist/src/capabilities/readiness/types.d.ts +1 -1
  136. package/dist/src/chat-commands/agent-edit.js +1 -1
  137. package/dist/src/cli/commands/agent.js +1 -1
  138. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  139. package/dist/src/cli/commands/models.js +1 -1
  140. package/dist/src/computer/broker.d.ts +97 -0
  141. package/dist/src/computer/broker.js +337 -0
  142. package/dist/src/computer/config.d.ts +9 -0
  143. package/dist/src/computer/config.js +16 -0
  144. package/dist/src/computer/control-guard.d.ts +4 -0
  145. package/dist/src/computer/control-guard.js +17 -0
  146. package/dist/src/computer/errors.d.ts +7 -0
  147. package/dist/src/computer/errors.js +30 -0
  148. package/dist/src/computer/model-adapter.d.ts +44 -0
  149. package/dist/src/computer/model-adapter.js +273 -0
  150. package/dist/src/computer/model-config.d.ts +3 -0
  151. package/dist/src/computer/model-config.js +27 -0
  152. package/dist/src/computer/model-policy.d.ts +3 -0
  153. package/dist/src/computer/model-policy.js +20 -0
  154. package/dist/src/computer/runtime.d.ts +128 -0
  155. package/dist/src/computer/runtime.js +388 -0
  156. package/dist/src/config/index.js +4 -4
  157. package/dist/src/config/loader.js +2 -2
  158. package/dist/src/config/models-json.d.ts +36 -0
  159. package/dist/src/config/models-json.js +15 -1
  160. package/dist/src/config/schema.d.ts +37 -0
  161. package/dist/src/config/schema.js +11 -2
  162. package/dist/src/config/voice.js +2 -2
  163. package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
  164. package/dist/src/endpoint-tools/invocation-service.js +5 -2
  165. package/dist/src/endpoint-tools/policy.js +7 -0
  166. package/dist/src/endpoint-tools/runtime.js +1 -0
  167. package/dist/src/endpoint-tools/upload-service.d.ts +13 -1
  168. package/dist/src/endpoint-tools/upload-service.js +73 -8
  169. package/dist/src/extensions/lockfile.js +1 -1
  170. package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
  171. package/dist/src/gateway/agent-builtin-tools.js +7 -0
  172. package/dist/src/gateway/agents-admin.js +1 -1
  173. package/dist/src/gateway/file-path-classifier.js +1 -1
  174. package/dist/src/gateway/global-defaults-admin.js +16 -0
  175. package/dist/src/gateway/hono/lib/config-payload.d.ts +15 -0
  176. package/dist/src/gateway/hono/lib/config-payload.js +2 -1
  177. package/dist/src/gateway/hono/routes/config-patch/misc.js +13 -2
  178. package/dist/src/gateway/hono/routes/endpoint-tools.js +3 -2
  179. package/dist/src/gateway/hono/routes/models.js +6 -3
  180. package/dist/src/gateway/hono/routes/voice.js +55 -1
  181. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  182. package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
  183. package/dist/src/gateway/security/gateway-scopes.js +3 -0
  184. package/dist/src/gateway/service/config-coordinator.js +4 -1
  185. package/dist/src/gateway/service.js +12 -12
  186. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  187. package/dist/src/providers/index.js +2 -2
  188. package/dist/src/providers/model-catalog-persistence.js +11 -2
  189. package/dist/src/providers/model-catalog-store.js +1 -0
  190. package/dist/src/providers/model-catalog-types.d.ts +7 -2
  191. package/dist/src/providers/model-reference-auditor.js +6 -3
  192. package/dist/src/providers/model-registry.js +4 -1
  193. package/dist/src/providers/model-supplements.js +18 -2
  194. package/dist/src/providers/presentation.js +4 -2
  195. package/dist/src/providers/register-runtime-providers.js +1 -1
  196. package/dist/src/providers/xopc-cloud-model-source.js +10 -4
  197. package/dist/src/storage/sqlite/index.d.ts +1 -1
  198. package/dist/src/storage/sqlite/index.js +2 -2
  199. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +8 -0
  200. package/dist/src/storage/sqlite/migrations/conversation-backup.js +17 -7
  201. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +5 -2
  202. package/dist/src/storage/sqlite/migrations/discover.js +2 -2
  203. package/dist/src/storage/sqlite/migrations/errors.d.ts +5 -0
  204. package/dist/src/storage/sqlite/migrations/errors.js +12 -2
  205. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  206. package/dist/src/storage/sqlite/migrations/runner.js +3 -2
  207. package/dist/src/storage/sqlite/schema.js +2 -2
  208. package/dist/src/storage/sqlite/schema.sql +2641 -526
  209. package/dist/src/tui/backends/embedded-backend.js +1 -1
  210. package/dist/src/tui/tui-commands.js +1 -1
  211. package/dist/src/tui/tui-startup-resources.js +1 -1
  212. package/dist/src/tui/tui.js +2 -2
  213. package/dist/src/voice/platform-catalog.d.ts +81 -0
  214. package/dist/src/voice/platform-catalog.js +16 -0
  215. package/dist/src/voice/platform-settings.d.ts +4 -0
  216. package/dist/src/voice/platform-settings.js +120 -0
  217. package/dist/src/voice/platform-streams.d.ts +12 -0
  218. package/dist/src/voice/platform-streams.js +250 -0
  219. package/dist/src/voice/realtime/omniEngine.js +8 -5
  220. package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
  221. package/dist/src/voice/realtime/omniRoute.js +11 -1
  222. package/dist/src/voice/realtime/runtime.js +14 -6
  223. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +15 -8
  224. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +12 -19
  225. package/dist/src/work-discovery/service.js +2 -2
  226. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  227. package/package.json +7 -4
  228. package/skills/creative/algorithmic-art/SKILL.md +7 -0
  229. package/skills/creative/frontend-design/SKILL.md +8 -0
  230. package/skills/creative/hatch-pet/SKILL.md +7 -0
  231. package/skills/creative/theme-factory/SKILL.md +8 -0
  232. package/skills/documents/doc-coauthoring/SKILL.md +7 -0
  233. package/skills/documents/docx/SKILL.md +7 -0
  234. package/skills/documents/pdf/SKILL.md +7 -0
  235. package/skills/documents/pptx/SKILL.md +7 -0
  236. package/skills/documents/xlsx/SKILL.md +9 -1
  237. package/skills/engineering/build-xopc-local-app/SKILL.md +7 -0
  238. package/skills/engineering/define-task/SKILL.md +7 -0
  239. package/skills/engineering/diagnose/SKILL.md +8 -0
  240. package/skills/engineering/tdd/SKILL.md +8 -0
  241. package/skills/tools/find-skills/SKILL.md +8 -0
  242. package/skills/tools/github/SKILL.md +7 -0
  243. package/skills/tools/summarize/SKILL.md +8 -0
  244. package/skills/tools/webapp-testing/SKILL.md +8 -1
  245. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BxR5eog4.js +0 -1
  246. package/dist/gateway/static/root/assets/agents-Dx1om1eN.js +0 -1
  247. package/dist/gateway/static/root/assets/api-q1kIMCLW.js +0 -1
  248. package/dist/gateway/static/root/assets/automations-workspace-DUZE1NOH.js +0 -6
  249. package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +0 -8
  250. package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +0 -1
  251. package/dist/gateway/static/root/assets/connectors-page-BEQR0NRq.js +0 -2
  252. package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +0 -1
  253. package/dist/gateway/static/root/assets/home-page-_oqo0pNR.js +0 -1
  254. package/dist/gateway/static/root/assets/index--YC42LAz.css +0 -2
  255. package/dist/gateway/static/root/assets/index-fVtuw2o9.js +0 -75
  256. package/dist/gateway/static/root/assets/local-app-workbench-page-Z8mpau9d.js +0 -2
  257. package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +0 -2
  258. package/dist/gateway/static/root/assets/messages-BWANv-N-.js +0 -3
  259. package/dist/gateway/static/root/assets/note-detail-panel-Bm33_3xJ.js +0 -5
  260. package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +0 -8
  261. package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +0 -1
  262. package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +0 -1
  263. package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +0 -1
  264. package/dist/gateway/static/root/assets/sessions-page-BaxIfjpm.js +0 -1
  265. package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +0 -1
  266. package/dist/gateway/static/root/assets/setup-status-panel-BuYto2mT.js +0 -1
  267. package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +0 -1
  268. package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +0 -1
  269. package/dist/gateway/static/root/assets/skills-page-D-7UtJIc.js +0 -2
  270. package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +0 -1
  271. package/dist/gateway/static/root/assets/user-model-page-DByIJcQq.js +0 -2
  272. package/dist/gateway/static/root/assets/workflows-page-BJv3eoKR.js +0 -6
  273. package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +0 -3
  274. package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +0 -4
  275. package/dist/src/storage/sqlite/migrations/004_add_session_type_metadata.sql +0 -15
  276. package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +0 -10
  277. package/dist/src/storage/sqlite/migrations/006_add_goals.sql +0 -108
  278. package/dist/src/storage/sqlite/migrations/007_goal_run_judge_schema.sql +0 -4
  279. package/dist/src/storage/sqlite/migrations/008_goal_queue_workflow_runs.sql +0 -53
  280. package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +0 -24
  281. package/dist/src/storage/sqlite/migrations/010_session_id_identity.sql +0 -30
  282. package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +0 -8
  283. package/dist/src/storage/sqlite/migrations/012_memory_records.sql +0 -63
  284. package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +0 -21
  285. package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +0 -10
  286. package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +0 -4
  287. package/dist/src/storage/sqlite/migrations/016_automations.sql +0 -47
  288. package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +0 -14
  289. package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +0 -1
  290. package/dist/src/storage/sqlite/migrations/019_projects.sql +0 -40
  291. package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +0 -1
  292. package/dist/src/storage/sqlite/migrations/021_projects_fts.sql +0 -21
  293. package/dist/src/storage/sqlite/migrations/022_work_items.sql +0 -61
  294. package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +0 -15
  295. package/dist/src/storage/sqlite/migrations/024_activity_events.sql +0 -62
  296. package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +0 -5
  297. package/dist/src/storage/sqlite/migrations/026_goal_contracts.sql +0 -10
  298. package/dist/src/storage/sqlite/migrations/027_mobile_notifications.sql +0 -43
  299. package/dist/src/storage/sqlite/migrations/028_goal_evidence_requirements.sql +0 -47
  300. package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +0 -133
  301. package/dist/src/storage/sqlite/migrations/030_connectors.sql +0 -94
  302. package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +0 -24
  303. package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +0 -15
  304. package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +0 -6
  305. package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +0 -14
  306. package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +0 -7
  307. package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +0 -12
  308. package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +0 -47
  309. package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +0 -68
  310. package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +0 -19
  311. package/dist/src/storage/sqlite/migrations/040_local_apps.sql +0 -32
  312. package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +0 -17
  313. package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +0 -41
  314. package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +0 -16
  315. package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +0 -75
  316. package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +0 -13
  317. package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +0 -13
  318. package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +0 -16
  319. package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +0 -40
  320. package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +0 -52
  321. package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +0 -15
  322. package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +0 -26
  323. package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +0 -25
  324. package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +0 -45
  325. package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +0 -24
  326. package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +0 -14
  327. package/dist/src/storage/sqlite/migrations/056_task_verification.sql +0 -6
  328. package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +0 -11
  329. package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +0 -3
  330. package/dist/src/storage/sqlite/migrations/059_composer_input_history.sql +0 -8
  331. package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +0 -45
  332. package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +0 -2
  333. package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +0 -27
  334. package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +0 -14
  335. package/dist/src/storage/sqlite/migrations/064_user_claims.sql +0 -60
  336. package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +0 -116
  337. package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +0 -126
  338. package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +0 -9
  339. package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +0 -71
  340. package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +0 -69
  341. package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +0 -55
  342. package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +0 -45
  343. package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +0 -14
  344. package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +0 -13
  345. package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +0 -5
  346. package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +0 -13
  347. package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +0 -29
  348. package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +0 -4
  349. package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +0 -64
  350. package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +0 -29
  351. package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +0 -15
  352. package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +0 -10
  353. package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +0 -100
  354. package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +0 -9
  355. package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +0 -26
  356. package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +0 -19
  357. package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +0 -168
  358. package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +0 -21
  359. package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +0 -5
  360. package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +0 -8
  361. package/dist/src/storage/sqlite/migrations/090_outcome_contract_judgment.sql +0 -2
  362. package/dist/src/storage/sqlite/migrations/091_context_allocation.sql +0 -1
  363. package/dist/src/storage/sqlite/migrations/092_outcome_execution_runtime.sql +0 -88
  364. package/dist/src/storage/sqlite/migrations/093_remove_legacy_goals.sql +0 -174
  365. package/dist/src/storage/sqlite/migrations/094_outcome_judgment_and_authority.sql +0 -3
  366. package/dist/src/storage/sqlite/migrations/095_session_input_queue.sql +0 -35
  367. package/dist/src/storage/sqlite/migrations/096_drop_work_intakes.sql +0 -6
  368. package/dist/src/storage/sqlite/migrations/097_work_item_lifecycle.sql +0 -194
  369. package/dist/src/storage/sqlite/migrations/098_discussion_note_documents.sql +0 -99
  370. package/dist/src/storage/sqlite/migrations/099_task_model.sql +0 -500
  371. package/dist/src/storage/sqlite/migrations/100_project_task_taskrun.sql +0 -763
  372. package/dist/src/storage/sqlite/migrations/101_session_response_language.sql +0 -1
  373. package/dist/src/storage/sqlite/migrations/102_session_user_context_mode.sql +0 -2
  374. package/dist/src/storage/sqlite/migrations/103_finalize_structured_memory.sql +0 -3
  375. package/dist/src/storage/sqlite/migrations/104_turn_memory_feedback.sql +0 -77
  376. package/dist/src/storage/sqlite/migrations/105_dreaming_ledger.sql +0 -34
  377. package/dist/src/storage/sqlite/migrations/106_dreaming_run_reproducibility.sql +0 -2
  378. package/dist/src/storage/sqlite/migrations/107_connector_accounts.sql +0 -146
  379. package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +0 -18
  380. package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +0 -14
  381. package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +0 -43
  382. package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +0 -18
  383. package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +0 -8
  384. package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +0 -76
  385. package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +0 -193
  386. package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +0 -6
  387. package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +0 -38
  388. package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +0 -110
  389. package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +0 -6
  390. package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +0 -13
  391. package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +0 -112
  392. package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +0 -24
  393. package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +0 -18
  394. package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +0 -25
  395. package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +0 -15
  396. package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +0 -12
  397. package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +0 -72
  398. package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +0 -36
  399. package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +0 -73
  400. package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +0 -51
  401. package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +0 -18
  402. package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +0 -2
  403. package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +0 -34
  404. package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +0 -11
  405. package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +0 -18
  406. package/dist/src/storage/sqlite/migrations/135_user_people.sql +0 -59
  407. package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +0 -79
  408. package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +0 -71
  409. package/dist/src/storage/sqlite/migrations/138_device_access.sql +0 -96
  410. package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +0 -231
  411. package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +0 -8
  412. package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +0 -17
  413. package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +0 -1
  414. package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +0 -1
  415. package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +0 -59
  416. package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +0 -5
  417. package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +0 -9
  418. package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +0 -39
  419. package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +0 -554
  420. package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +0 -18
  421. package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +0 -47
  422. package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +0 -6
  423. package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +0 -140
  424. package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +0 -45
  425. package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +0 -60
  426. package/dist/src/storage/sqlite/migrations/155_browser_extension.sql +0 -120
  427. package/dist/src/storage/sqlite/migrations/156_browser_tab_bindings.sql +0 -14
  428. package/dist/src/storage/sqlite/migrations/157_browser_endpoint_principals.sql +0 -50
  429. package/dist/src/storage/sqlite/migrations/158_browser_native_enrollment.sql +0 -4
  430. package/dist/src/storage/sqlite/migrations/159_proactive_controls.sql +0 -68
  431. package/dist/src/storage/sqlite/migrations/160_proactive_web_push.sql +0 -27
  432. package/dist/src/storage/sqlite/migrations/161_proactive_delivery_and_lifecycle.sql +0 -51
  433. package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +0 -7
  434. package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +0 -29
  435. package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +0 -8
  436. package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +0 -40
  437. package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +0 -20
  438. package/dist/src/storage/sqlite/migrations/conversation-backup.ts +0 -66
  439. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +0 -50
  440. package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +0 -324
  441. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +0 -71
  442. package/dist/src/storage/sqlite/migrations/discover.ts +0 -52
  443. package/dist/src/storage/sqlite/migrations/errors.ts +0 -32
  444. package/dist/src/storage/sqlite/migrations/runner.ts +0 -204
  445. package/dist/src/storage/sqlite/migrations/types.ts +0 -15
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a,p as o,t as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,t as h,u as g}from"./popover-select-DldSX8GX.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S,t as C}from"./markdown-view-2txE_Blz.js";import{t as w}from"./git-branch-Dh9uxTot.js";import{t as T}from"./loader-circle-CifKLtgG.js";import{t as E}from"./plus-Q2yW6OE7.js";import{t as D}from"./x-B_N4OPjy.js";import{t as O}from"./cn-JdwAhgNB.js";import{a as k,c as A,f as j,n as M,r as N}from"./locale-store-D0001I7p.js";import{t as P}from"./messages-BWANv-N-.js";import{a as F,c as I,i as L,n as R,o as z,r as B,s as ee,t as te}from"./dist-BGTk37IG.js";import{t as V}from"./copy-to-clipboard-HOJ79TWv.js";import{i as H}from"./vendor-swr-BIWyz7Rc.js";import{t as U}from"./button-CGlRPNzi.js";import{t as W}from"./skeleton-BwbyijEw.js";import{Aa as ne,An as re,Ba as G,Bl as K,Br as ie,Bs as q,Bu as ae,Cs as J,Dl as oe,Dn as se,Ea as ce,Ec as le,En as Y,Fa as ue,Fc as de,Fn as fe,Ga as pe,Gi as me,Gs as he,Ha as ge,Hc as _e,Hi as ve,Hl as ye,Ia as be,Il as xe,Ji as Se,Jn as Ce,Ki as we,Kn as Te,La as Ee,Lc as De,Ll as Oe,Ls as ke,Lu as Ae,Ma as je,Ms as Me,Na as Ne,Nn as Pe,Oa as Fe,Ol as Ie,On as Le,Ou as Re,Pa as ze,Ps as Be,Pu as Ve,Qc as He,Ra as Ue,Rc as We,Ri as Ge,Ro as Ke,Rs as qe,Ru as Je,Sc as Ye,Su as Xe,Ta as Ze,Tl as Qe,Tn as $e,Ts as et,Ui as tt,Va as nt,Vc as rt,Vi as it,Vl as at,Vt as ot,Wc as st,Wi as ct,Wn as lt,Xi as ut,Xl as dt,Yi as ft,Zc as pt,Zi as mt,Zs as ht,_l as gt,_u as _t,bs as vt,bu as yt,dc as bt,di as xt,dl as St,dn as Ct,dr as wt,ea as Tt,ei as Et,er as Dt,gc as Ot,gi as kt,gl as At,gn as jt,gs as Mt,hu as Nt,ia as Pt,ic as Ft,il as It,ja as Lt,jo as Rt,js as zt,ka as Bt,kl as Vt,kn as Ht,la as Ut,mn as Wt,mo as Gt,na as Kt,nu as qt,ou as Jt,qi as Yt,qn as Xt,qs as Zt,rc as Qt,rr as $t,sa as en,sc as tn,ta as nn,ua as rn,uc as an,ur as on,uu as sn,vc as cn,vi as ln,vu as un,wa as dn,wc as fn,xc as pn,xs as mn,yc as hn,yu as gn,za as _n,zi as vn}from"./index-fVtuw2o9.js";import{i as yn,n as bn,r as xn,t as Sn}from"./note-detail-panel-Bm33_3xJ.js";import{n as Cn,t as wn}from"./use-autosave-Iq83UDt3.js";import{n as Tn,t as En}from"./api-q1kIMCLW.js";import{t as Dn}from"./page-tabs-Bi_-DA5J.js";import{t as On}from"./date-picker-DNtRu6EB.js";import{t as kn}from"./automations-workspace-DUZE1NOH.js";import{i as An,p as jn,s as Mn}from"./skills-page.utils-dvue6Ish.js";import{t as Nn}from"./dependency-picker-Dng3dIQa.js";import{c as Pn,l as Fn,n as In,o as Ln,r as Rn,t as zn}from"./style-TIDOdKy0.js";var X=e(t(),1),Bn=n(),Z=r();function Vn(e){let t=(0,Bn.c)(27),{value:n,onPick:r,disabled:i,placeholder:a,title:o,className:s,maxWidthClass:c,compact:l,"aria-label":u}=e,d=c===void 0?`max-w-[min(12rem,40vw)]`:c,f=l===void 0?!1:l,p,m;t[0]!==a||t[1]!==n?(m=n.trim(),p=m?Kt(m):a??``,t[0]=a,t[1]=n,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=p,g=o??(m||void 0),_=u??o??h,v=f?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,y=!f&&d,b=i&&`cursor-not-allowed opacity-60`,x;t[4]!==s||t[5]!==v||t[6]!==y||t[7]!==b?(x=O(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,Mt.transition,Mt.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,y,b,s),t[4]=s,t[5]=v,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S;t[9]!==i||t[10]!==r?(S=e=>{e.stopPropagation(),i||r()},t[9]=i,t[10]=r,t[11]=S):S=t[11];let C=f?`size-4`:`size-3.5`,w;t[12]===C?w=t[13]:(w=O(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,Z.jsx)(K,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=T);let E;t[16]!==f||t[17]!==h?(E=f?null:(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==S||t[21]!==T||t[22]!==E||t[23]!==g||t[24]!==_||t[25]!==x?(D=(0,Z.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[T,E]}),t[19]=i,t[20]=S,t[21]=T,t[22]=E,t[23]=g,t[24]=_,t[25]=x,t[26]=D):D=t[26],D}function Hn(e){let t=(0,Bn.c)(38),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,autoFocus:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=nn(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,h;t[5]===s?h=t[6]:(h=O(`min-w-0 flex-1`,s),t[5]=s,t[6]=h);let g=i||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=o??a.pathInputPlaceholder,y;t[9]!==c||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==n?(y=(0,Z.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoFocus:c,autoComplete:`off`,spellCheck:!1}),t[9]=c,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=n,t[15]=y):y=t[15];let b=i||d.picking,x;t[16]!==m||t[17]!==d.pick||t[18]!==b||t[19]!==n||t[20]!==a.selectWorkingDirectory?(x=(0,Z.jsx)(Vn,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":a.selectWorkingDirectory}),t[16]=m,t[17]=d.pick,t[18]=b,t[19]=n,t[20]=a.selectWorkingDirectory,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==l?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[22]=x,t[23]=l,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==y?(C=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[25]=S,t[26]=y,t[27]=C):C=t[27];let w;t[28]!==d.confirmPick||t[29]!==d.hasNativePicker||t[30]!==d.modalOpen||t[31]!==d.setModalOpen||t[32]!==p||t[33]!==a?(w=d.hasNativePicker?null:(0,Z.jsx)(mt,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:a}),t[28]=d.confirmPick,t[29]=d.hasNativePicker,t[30]=d.modalOpen,t[31]=d.setModalOpen,t[32]=p,t[33]=a,t[34]=w):w=t[34];let T;return t[35]!==C||t[36]!==w?(T=(0,Z.jsxs)(Z.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=T):T=t[37],T}function Q(e){let t=(0,Bn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,X.useState)(!1),s;t[0]!==r||t[1]!==n?(s=wt(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=O(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(oe,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Z.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=O(`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,Z.jsx)($t,{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 Un(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 Wn(e){let t=(0,Bn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=on(),f=on(Kn),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=O(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===w?E=t[13]:(E=O(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=E);let D=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,Z.jsx)(T,{className:`size-3.5 animate-spin`}):m?(0,Z.jsx)(rt,{className:`size-3.5`}):(0,Z.jsx)(de,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==b||t[18]!==S||t[19]!==E||t[20]!==D||t[21]!==k?(A=(0,Z.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:E,"aria-label":D,children:k}),t[17]=b,t[18]=S,t[19]=E,t[20]=D,t[21]=k,t[22]=A):A=t[22];let j=`${v}%`,M;t[23]===j?M=t[24]:(M=(0,Z.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Z.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=Un(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,Z.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,Z.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]!==C||t[36]!==A?(I=(0,Z.jsxs)(`div`,{className:C,onClick:Gn,children:[A,F]}),t[34]=F,t[35]=C,t[36]=A,t[37]=I):I=t[37],I}function Gn(e){return e.stopPropagation()}function Kn(e){return e.toggle}function qn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jn(e){let t=(0,Bn.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=qn(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,X.useState)(er),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=yn(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=O(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,Z.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,Z.jsx)(Q,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Z.jsx)(Wn,{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,Z.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=O(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,Z.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let k;t[28]!==w||t[29]!==D?(k=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(dt,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Z.jsx)(re,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,onClick:$n,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(Zn)},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,Z.jsx)(De,{className:`size-4`}):(0,Z.jsx)(We,{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,Z.jsxs)(Y,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect: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(Xn)},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,Z.jsx)(ae,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Z.jsxs)(Y,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect: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,Z.jsx)(Ht,{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(Yn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ht,{className:`size-4`}),t[55]=ee):ee=t[55];let te;t[56]!==c.delete||t[57]!==B?(te=(0,Z.jsxs)(Y,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[ee,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=te):te=t[58];let V;t[59]!==F||t[60]!==R||t[61]!==te?(V=(0,Z.jsx)(se,{children:(0,Z.jsxs)($e,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Qn,children:[F,R,z,te]})}),t[59]=F,t[60]=R,t[61]=te,t[62]=V):V=t[62];let H;t[63]!==j||t[64]!==V?(H=(0,Z.jsxs)(Le,{children:[j,V]}),t[63]=j,t[64]=V,t[65]=H):H=t[65];let U;t[66]!==C||t[67]!==k||t[68]!==H?(U=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,k,H]}),t[66]=C,t[67]=k,t[68]=H,t[69]=U):U=t[69];let W;t[70]===n.pinned?W=t[71]:(W=n.pinned&&(0,Z.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,Z.jsx)(We,{className:`size-3`})}),t[70]=n.pinned,t[71]=W);let ne;t[72]===n.tags?ne=t[73]:(ne=n.tags?.slice(0,2).map($),t[72]=n.tags,t[73]=ne);let G;t[74]===g?G=t[75]:(G=(0,Z.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let K;t[76]!==W||t[77]!==ne||t[78]!==G?(K=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[W,ne,G]}),t[76]=W,t[77]=ne,t[78]=G,t[79]=K):K=t[79];let ie;return t[80]!==U||t[81]!==K||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ie=(0,Z.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,U,K]}),t[80]=U,t[81]=K,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ie):ie=t[87],ie}function $(e){return(0,Z.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 Yn(){}function Xn(){}function Zn(){}function Qn(e){return e.stopPropagation()}function $n(e){return e.stopPropagation()}function er(){return Date.now()}var tr=3e4;function nr(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function rr({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,X.useState)(``),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(0),[C,w]=(0,X.useState)(!1),T=(0,X.useRef)(null),D=(0,X.useRef)(null),k=(0,X.useRef)(null),A=(0,X.useRef)([]),j=(0,X.useRef)(0),M=(0,X.useRef)(null),N=(0,X.useRef)(null),P=(0,X.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,D.current=null,A.current=[],b(!1),S(0)},[]);(0,X.useEffect)(()=>()=>P(),[P]);let F=(0,X.useCallback)(async()=>{let e=D.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||nr()||`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{w(!1)}return}w(!1)},[P,c]),I=(0,X.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=nr(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);D.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),S(0),M.current=setInterval(()=>{S(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},tr)}catch{P(),l?.()}}},[P,c,l,y,F,C]),L=(0,X.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),R=(0,X.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||C,B=!!(s||c||p);return(0,Z.jsxs)(`div`,{className:O(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":z,children:[y?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,Z.jsx)(tn,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(re,{asChild:!0,children:(0,Z.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,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0})})}),(0,Z.jsx)(se,{children:(0,Z.jsxs)($e,{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,Z.jsxs)(Y,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Z.jsx)(Qe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Z.jsxs)(Y,{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,Z.jsx)(pt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Z.jsxs)(Y,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Z.jsx)(Ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,Z.jsx)(`textarea`,{ref:T,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,Z.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:O(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Z.jsx)(pn,{className:`size-4`,"aria-hidden":!0})})]})}var ir={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},ar=240,or=320,sr=520,cr=560;function lr(e){if(globalThis.localStorage===void 0)return or;try{let t=globalThis.localStorage.getItem(e);if(!t)return or;let n=Number(t);return Number.isFinite(n)?n:or}catch{return or}}function ur(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var dr={thought:Ft,todo:an,voice:pt,media:Qe,bookmark:Re,mixed:Ft,task:an};function fr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function mr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function hr({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:u,listWidthStorageKey:d=`xopc.notes.listWidth`}){let p=M(e=>e.language),h=P(p).notes,g=!!A(e=>e.conversationId),[_,v]=(0,X.useReducer)(Tt,ir),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(0),[T,k]=(0,X.useState)(()=>lr(d)),[N,I]=(0,X.useState)(!1),[V,U]=(0,X.useState)(!1),[W,ne]=(0,X.useState)(!1),[re,G]=(0,X.useState)(null),[K,ie]=(0,X.useState)(null),q=(0,X.useRef)(null),ae=(0,X.useRef)(null),[J]=(0,X.useState)(()=>Date.now()),oe=i(),se=(0,X.useCallback)(e=>{let t=q.current?.clientWidth??window.innerWidth,n=Math.max(ar,t-cr);return Math.max(ar,Math.min(Math.min(sr,n),e))},[]),ce=(0,X.useCallback)(e=>{let t=se(e);k(t),ur(d,t)},[se,d]);(0,X.useLayoutEffect)(()=>{k(e=>se(e))},[se]);let{data:le,mutate:Y,isLoading:ue}=H((0,X.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>lt({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}),de=ue&&!le,me=le?.items??[],he=le?.total??0,ge=x.trim(),{data:_e,isLoading:ve}=H(g&&y&&ge?[`notes-search`,o,ge]:null,()=>lt({search:ge,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),ye=_e?.items??[],be=e?me.some(t=>t.id===e):!0;(0,X.useEffect)(()=>{w(0)},[ge]),(0,X.useEffect)(()=>{C>=ye.length&&w(Math.max(0,ye.length-1))},[C,ye.length]),(0,X.useEffect)(()=>{let e=()=>{Y().catch(e=>{G(`${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),we=h.noteCount.replace(`{{count}}`,String(he)),Ee=!r&&he===0&&c?c:we,De=h.searchDialogTitle,Oe=h.searchClose,ke=h.searchClear,Ae=(0,X.useMemo)(()=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:O(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Rt),"aria-label":De,children:[(0,Z.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:De})]}),[De]);(0,X.useLayoutEffect)(()=>{if(n)return g?(xe({startExtra:null,main:(0,Z.jsxs)(`div`,{className:O(`flex min-w-0 items-center gap-2`,Rt),children:[(0,Z.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),we?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:we}):null]}),end:Ae}),()=>Se()):(Se(),()=>Se())},[Se,g,Ae,s,n,h.title,we,e,xe]);let je=(0,X.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:j(p)}),[p,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Me=(0,X.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]),Ne=Me.find(e=>pr(_,e))??Me[0],Fe=s??Ne.label,Ie=(0,X.useCallback)(async e=>{G(null);try{let n=o?await Pe({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Te(e,`web`);await Y(),oe(mr(t,n.id))}catch(e){throw G(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,oe,o]),Le=(0,X.useCallback)(async()=>{if(!W){ne(!0),G(null);try{let e=await Pe({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:ir}),await Y(),ie(e.id),oe(mr(t,e.id))}catch(e){G(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{ne(!1)}}},[t,W,Y,h.createBlankFailed,h.createBlankFailedHint,oe,o]),Re=(0,X.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{G(null),await Xt(t,`web`),await Y()}catch(e){G(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),ze=(0,X.useCallback)(async(e,t)=>{try{G(null),await Ce(e,t,`web`),await Y()}catch(e){G(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Be=(0,X.useCallback)(()=>{G(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Ve=(0,X.useCallback)(async(e,t)=>{G(null);try{await Dt(e,{pinned:t}),await Y()}catch(e){G(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),He=(0,X.useCallback)(async e=>{G(null);try{await Dt(e,{status:`archived`}),await Y()}catch(e){G(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ue=(0,X.useCallback)(async e=>{G(null);try{await fe(e),await Y()}catch(e){G(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),We=(0,X.useCallback)(e=>{oe(mr(t,e))},[t,oe]),Ge=(0,X.useCallback)(e=>{oe(mr(t,e)),b(!1)},[t,oe]),Ke=(0,X.useCallback)(e=>{if(ye.length){if(e.key===`ArrowDown`)e.preventDefault(),w(e=>Math.min(ye.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),w(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=ye[C]??ye[0];t&&Ge(t.id)}}},[C,Ge,ye]),qe=(0,X.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),I(!0);let r=q.current?.clientWidth??window.innerWidth,i=Math.max(ar,r-cr),a=Math.min(sr,i),o=e=>Math.max(ar,Math.min(a,e)),s=e.clientX,c=o(T),l=e.pointerId,u=0,f=c,p=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,p=f,n&&(n.style.width=`${p}px`)},h=e=>{f=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}I(!1),q.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),k(p),ur(d,p),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[d,T]);(0,X.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Le())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Le]);let Je=(0,X.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ce(T-16)):e.key===`ArrowRight`?(e.preventDefault(),ce(T+16)):e.key===`Home`?(e.preventDefault(),ce(ar)):e.key===`End`&&(e.preventDefault(),ce(sr))},[ce,T]);return g?(0,Z.jsxs)(`div`,{ref:q,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${T}px`},children:[(0,Z.jsxs)(`section`,{ref:ae,className:O(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,V?`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":V?!0:void 0,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[re?(0,Z.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:re}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Z.jsx)(f,{value:Ne.id,onChange:e=>{let t=Me.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:Me.map(e=>(0,Z.jsx)(m,{value:e.id,children:e.label},e.id))}):(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Fe}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ee})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>U(!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,Z.jsx)(st,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Z.jsx)(`button`,{type:`button`,onClick:Le,disabled:W,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,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0})}),(0,Z.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,Z.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:de?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Z.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):me.length===0?(0,Z.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,Z.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,Z.jsx)(Ft,{className:`size-6`,"aria-hidden":!0})}),(0,Z.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!be?h.noteOutsideCurrentView:l??h.noNotes}),e&&!be?null:(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:u??h.noNotesDescription})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!be?(0,Z.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,me.map((t,n)=>{let r=n>0?bn(me[n-1].createdAt):null;return(0,Z.jsxs)(`div`,{children:[bn(t.createdAt)!==r&&(0,Z.jsx)(`div`,{className:O(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:xn(t.createdAt,J,je)}),(0,Z.jsx)(Jn,{note:t,selected:t.id===e,onPress:We,onPin:Ve,onArchive:He,onDelete:Ue,timeLabels:je,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,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Z.jsx)(rr,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Ie,onImagePick:a?Re:void 0,onVoiceCapture:a?ze:void 0,onVoiceError:Be,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>pe(o)})})]}),(0,Z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":ar,"aria-valuemax":sr,"aria-valuenow":Math.round(T),tabIndex:0,onPointerDown:qe,onDoubleClick:()=>ce(or),onKeyDown:Je,title:h.resizeNotesList,className:O(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,V?`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,Z.jsx)(`span`,{"aria-hidden":!0,className:O(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,Z.jsxs)(`section`,{className:O(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[V?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>U(!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,Z.jsx)(st,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Z.jsx)(Sn,{noteId:e,onBack:()=>oe(t),onSaved:()=>{Y().catch(e=>{G(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===K,onAutoFocusConsumed:()=>ie(null)}):(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Z.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Z.jsx)(Ft,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,Z.jsxs)(`button`,{type:`button`,onClick:Le,disabled:W,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),W?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,Z.jsx)(te,{open:y,onOpenChange:b,children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(ee,{className:`text-sm font-semibold text-fg`,children:De}),(0,Z.jsx)(L,{className:`sr-only`,children:h.searchPlaceholder}),(0,Z.jsx)(R,{asChild:!0,children:(0,Z.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":Oe,children:(0,Z.jsx)(D,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Z.jsxs)(`div`,{className:`p-4`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Ye,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:x,onChange:e=>S(e.target.value),onKeyDown:Ke,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`}),x?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>S(``),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":ke,children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Z.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:ge?ve&&!_e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Z.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):ye.length===0?(0,Z.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Z.jsx)(Ft,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchNoResultsDescription})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.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=dr[e.kind]||Ft,r=fr(e,{imageNote:h.imageNote,noText:h.noText});return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>Ge(e.id),onMouseEnter:()=>w(t),className:O(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===C?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:yn(e.updatedAt,J,je)})]}),e.title?(0,Z.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Z.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Z.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,Z.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Z.jsx)(Ye,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Z.jsx)(Ft,{className:`size-10 text-fg-muted`}),(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}function gr(e){return k(N(`/api/projects/${encodeURIComponent(e)}/skills`))}function _r(e,t){return k(N(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function vr(e,t){return k(N(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function yr(e,t){let n=new FormData;return n.set(`file`,t),k(N(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function br(e,t,n={}){return k(N(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function xr(e,t){return k(N(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Sr(e,t){return k(N(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function Cr({projectId:e,copy:t}){let[n,r]=(0,X.useState)([]),[i,a]=(0,X.useState)([]),[o,s]=(0,X.useState)([]),[c,d]=(0,X.useState)([]),[f,m]=(0,X.useState)(``),[_,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!0),[T,k]=(0,X.useState)(!1),[A,j]=(0,X.useState)(null),[M,N]=(0,X.useState)(``),[P,I]=(0,X.useState)(null),[L,V]=(0,X.useState)(null),[H,ne]=(0,X.useState)(``),[re,G]=(0,X.useState)(1),[K,ie]=(0,X.useState)(null),[q,ae]=(0,X.useState)(!1),[J,oe]=(0,X.useState)(``),[se,ce]=(0,X.useState)(``),le=(0,X.useRef)(null),Y=(0,X.useCallback)(async()=>{C(!0),N(``);try{let t=await gr(e);r(t.items),a(t.inheritedItems),s(t.sources)}catch(e){N(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e]);(0,X.useEffect)(()=>{Y()},[Y]),(0,X.useEffect)(()=>{let t=!1;return ze(e).then(e=>{t||d(e)}).catch(()=>{t||d([])}),()=>{t=!0}},[e]),(0,X.useEffect)(()=>{if(!f){v(null);return}let e=c.find(e=>e.key===f),t=!1;return v(null),N(``),x(!0),jt(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||v(e)}).catch(e=>{t||N(e instanceof Error?e.message:String(e))}).finally(()=>{t||x(!1)}),()=>{t=!0}},[f,c]),(0,X.useEffect)(()=>{if(P!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{ae(!0),oe(``),jn({q:H,page:re,pageSize:8,sort:`downloads`,signal:e.signal}).then(ie).catch(t=>{e.signal.aborted||oe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||ae(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[P,re,H]);async function ue(e,t){k(!0),j(t??null),N(``);try{await e(),I(null),ce(``),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1),j(null)}}async function de(t){N(``);try{V((await _r(e,t)).skill)}catch(e){N(e instanceof Error?e.message:String(e))}}async function fe(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){k(!0);try{await Sr(e,n.directoryId),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}}}async function pe(){k(!0),N(``);try{await vr(e,!0),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}}let me=o.find(e=>e.origin===`agents-workspace`),he=new Map(_?.skills.map(e=>[e.name,e]));return(0,Z.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.jsxs)(U,{type:`button`,children:[(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Z.jsx)(yt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Z.jsx)(l,{children:(0,Z.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Z.jsx)(Dr,{icon:Qt,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>I(`marketplace`)}),(0,Z.jsx)(Dr,{icon:w,title:t.source,hint:t.sourceHint,onClick:()=>I(`source`)}),(0,Z.jsx)(Dr,{icon:Zt,title:t.upload,hint:t.uploadHint,onClick:()=>le.current?.click()})]})})]}),(0,Z.jsx)(`input`,{ref:le,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ue(()=>yr(e,n)),t.target.value=``}})]})}),M?(0,Z.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:M}):null,me?.state===`untrusted`?(0,Z.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,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(It,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Z.jsxs)(U,{type:`button`,variant:`secondary`,disabled:T,onClick:()=>void pe(),children:[(0,Z.jsx)(Ot,{className:`size-4`,"aria-hidden":!0}),T?t.trusting:t.trustAction]})]}):null,c.length?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:b?t.sessionLoading:f?_?.agentId:t.sessionViewAll})]}),(0,Z.jsx)(h,{value:f,options:c.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:m})]}):null,S?(0,Z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Z.jsx)(W,{className:`h-36 rounded-lg`},e))}):n.length?(0,Z.jsx)(wr,{title:t.localTitle,items:n,copy:t,busy:T,availabilityByName:he,onPreview:de,onRemove:fe}):(0,Z.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!S&&i.length?(0,Z.jsx)(wr,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:T,availabilityByName:he,onPreview:de,onRemove:fe}):null,(0,Z.jsx)(te,{open:P!==null,onOpenChange:e=>{e||I(null)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{className:O(`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-panel shadow-xl`,P===`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,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:P===`marketplace`?t.marketplace:t.source}),(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Z.jsx)(D,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:P===`marketplace`?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Z.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Z.jsx)(Ye,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:H,onChange:e=>{ne(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),J?(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:J}):null,q&&!K?(0,Z.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Z.jsx)(W,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,Z.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=An(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=A===a;return(0,Z.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Z.jsx)(Mn,{name:r.name,className:`size-10`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Z.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Z.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Z.jsx)(U,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:T||o,onClick:()=>void ue(()=>br(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,Z.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||re<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,Z.jsx)(gn,{className:`size-4`}),t.marketplacePrevious]}),(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||re>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,Z.jsx)(un,{className:`size-4`})]})]})]}):null]}):(0,Z.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Z.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:se,onChange:e=>ce(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Z.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`secondary`,children:t.close})}),(0,Z.jsx)(U,{type:`button`,disabled:T||!se.trim(),onClick:()=>void ue(()=>xr(e,se.trim())),children:T?t.installing:t.install})]})]})})]})]})}),(0,Z.jsx)(te,{open:!!L,onOpenChange:e=>{e||V(null)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-xl`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:L?.name}),(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Z.jsx)(D,{className:`size-4`})})})]}),(0,Z.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:L?.bodyMarkdown})]})]})})]})}function wr(e){let t=(0,Bn.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,Z.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,Z.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,Z.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,Z.jsxs)(`article`,{className:O(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ae,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:Tr(a,e.origin)}),e.writable?null:(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Z.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,Z.jsx)(`span`,{className:O(`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:Er(a,t)}):null]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Z.jsx)(ht,{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,Z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,Z.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function Tr(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 Er(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 Dr(e){let t=(0,Bn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Z.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,Z.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,Z.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,Z.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,Z.jsx)(d,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Or={active:0,review:1,ready:2,backlog:3,closed:4},kr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Ar={critical:0,high:1,normal:2,low:3};function jr(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=kr[e.operationalState]-kr[t.operationalState];if(r!==0)return r;let i=Or[e.phase]-Or[t.phase];if(i!==0)return i;let a=Ar[e.priority]-Ar[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Mr=[`backlog`,`ready`,`active`,`review`,`closed`];function Nr(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 Pr(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 Fr(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 Ir(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 Lr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ir(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 Rr(e,t){let{incoming:n}=Ir(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 zr(e,t){let{incoming:n,outgoing:r}=Ir(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 Br={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 Vr(e){let t=(0,Bn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Br[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=O(`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,Z.jsx)(Rn,{type:`target`,position:Fn.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,Z.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,Z.jsx)(Ie,{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,Z.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,Z.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,Z.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,Z.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,Z.jsx)(Rn,{type:`source`,position:Fn.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,Z.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 Hr={taskNode:Vr};function Ur(e){let t=(0,Bn.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(),[m,h]=(0,X.useState)(),g=(0,X.useRef)(null),_;t[0]!==r||t[1]!==n?(_=Rr(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Zr),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(Xr)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,E;t[15]!==T||t[16]!==x?(E=Lr(x,T),t[15]=T,t[16]=x,t[17]=E):E=t[17];let D=E,k;t[18]!==f||t[19]!==T?(k=f?zr(f,T):void 0,t[18]=f,t[19]=T,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(Yr)),t[23]=x,t[24]=N);let P=N,F;if(t[25]!==a.phases||t[26]!==D||t[27]!==A||t[28]!==x){let e;t[30]!==a.phases||t[31]!==D||t[32]!==A?(e=e=>({id:e.id,type:`taskNode`,position:D.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]=D,t[32]=A,t[33]=e):e=t[33],F=x.map(e),t[25]=a.phases,t[26]=D,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]!==T){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:Pn.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=T.map(e),t[34]=A,t[35]=P,t[36]=T,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,X.useEffect)(z,B);let ee,te;t[45]!==R||t[46]!==m?(ee=()=>{m&&!R.some(e=>e.id===m)&&h(void 0)},te=[R,m],t[45]=R,t[46]=m,t[47]=ee,t[48]=te):(ee=t[47],te=t[48]),(0,X.useEffect)(ee,te);let V;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=V):V=t[49];let H;t[50]!==u||t[51]!==c||t[52]!==x.length?(H=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=H):H=t[53],(0,X.useEffect)(V,H);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let ne=W,re;t[56]!==r||t[57]!==o?(re=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Jr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=re):re=t[58];let G=re,K;t[59]!==r||t[60]!==o||t[61]!==m?(K=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(qr)))},t[59]=r,t[60]=o,t[61]=m,t[62]=K):K=t[62];let ie=K,q;t[63]===a.connectHint?q=t[64]:(q=(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=q);let ae=u?`secondary`:`ghost`,J;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>d(Kr),t[65]=J):J=t[65];let oe=u?a.allTasks:a.blockedChains,se;t[66]!==u||t[67]!==ae||t[68]!==oe?(se=(0,Z.jsx)(U,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:J,children:oe}),t[66]=u,t[67]=ae,t[68]=oe,t[69]=se):se=t[69];let ce;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>l(Gr),t[70]=ce):ce=t[70];let le=c?a.hideCompleted:a.showCompleted,Y;t[71]!==u||t[72]!==c||t[73]!==le?(Y=(0,Z.jsx)(U,{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]=Y):Y=t[74];let ue=M?(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,Z.jsx)(at,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,de;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==m?(de=m?(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=m,t[78]=de):de=t[78];let fe;t[79]!==se||t[80]!==Y||t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[se,Y,ue,de]}),t[79]=se,t[80]=Y,t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==q||t[85]!==fe?(pe=(0,Z.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:[q,fe]}),t[84]=q,t[85]=fe,t[86]=pe):pe=t[86];let me=x.length>0?(0,Z.jsxs)(`div`,{className:O(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,M&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Z.jsxs)(Ln,{nodes:I,edges:R,nodeTypes:Hr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:G,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Z.jsx)(zn,{color:`var(--color-edge)`,gap:22,size:1}),(0,Z.jsx)(In,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),M?(0,Z.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[M.phase]}),(0,Z.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:M.title}),M.operationalState===`blocked`&&M.blockedBy.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(M.blockedBy.length))}),(0,Z.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:M.blockedBy.map(Wr)})]}):null,(0,Z.jsxs)(s,{to:Be(i,M.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Z.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Z.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,Z.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 Wr(e){return(0,Z.jsx)(`li`,{children:e.title},e.id)}function Gr(e){return!e}function Kr(e){return!e}function qr(e){return e.dependencyTaskId}function Jr(e){return e.dependencyTaskId}function Yr(e){return[e.id,e]}function Xr(e){return e.id}function Zr(e){return e.phase!==`closed`}function Qr({policy:e,copy:t,onSave:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(e.mode),[s,c]=(0,X.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,X.useState)(!!e.quietHours),[d,p]=(0,X.useState)(e.quietHours?.startHour??22),[h,g]=(0,X.useState)(e.quietHours?.endHour??8),[_,v]=(0,X.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,X.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)();(0,X.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),b(e.allowedActions.includes(`create_project_task`))},[e]);let T=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,Z.jsxs)(te,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,Z.jsx)(I,{asChild:!0,children:(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Z.jsx)(hn,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,Z.jsx)(D,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Z.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Z.jsx)(m,{value:e,children:t},e))})]}),(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Z.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Z.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Z.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Z.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Z.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Z.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Z.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Z.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,Z.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,Z.jsx)(U,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void T(),children:x?t.saving:t.save})]})]})]})]})]})}function $r(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var ei={backlog:Nt,ready:Nt,active:St,review:he,closed:_},ti={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 ni(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 ri(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 ii(e){let t=(0,Bn.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,E;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=Fr(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:sn,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=oi,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],E=`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=Be(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=O(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19]);let D=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===D?k=t[32]:(k=O(`mt-0.5 size-4 shrink-0`,D),t[31]=D,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Z.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=O(`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,Z.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,Z.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,Z.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,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Z.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ai).join(`、`)})]}):n.attention[0]?(0,Z.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Z.jsx)(_t,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,Z.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Z.jsx)(`span`,{className:O(`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,Z.jsx)(`span`,{className:O(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ni(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Z.jsx)(`span`,{className:O(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ri(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Z.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,Z.jsx)(St,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Z.jsxs)(`span`,{className:O(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,Z.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),ie(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Z.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,Z.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),ie(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,Z.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,Z.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,Z.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,Z.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==E?(z=(0,Z.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:E,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=E,t[82]=z):z=t[82],z}function ai(e){return e.title}function oi(e){e.preventDefault(),e.stopPropagation()}function si({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let h=(0,X.useRef)(null),g=(0,X.useRef)(null),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,T]=(0,X.useState)(`board`),[E,D]=(0,X.useState)(!1),[k,A]=(0,X.useState)(()=>crypto.randomUUID()),[j,N]=(0,X.useState)(``),[I,V]=(0,X.useState)(`normal`),[H,W]=(0,X.useState)(``),[ne,re]=(0,X.useState)([]),[G,K]=(0,X.useState)(!1),[ie,q]=(0,X.useState)(null),ae=M(e=>e.language),J=Et({chat:P(ae).chat}),oe=Nr(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),le=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=oe[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Pr(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},Y=async e=>{e.preventDefault();let t=j.trim();if(!(!t||G)){K(!0),q(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:k,objective:t,priority:I,dependsOnTaskIds:ne,attachments:J.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),N(``),V(`normal`),W(``),re([]),J.clearAttachments(),A(crypto.randomUUID()),D(!1)}catch(e){q(e instanceof Error?e.message:i.createFailed)}finally{K(!1)}}},ue=()=>{A(crypto.randomUUID()),N(``),V(`normal`),W(``),re([]),J.clearAttachments(),q(null),D(!0)};(0,X.useImperativeHandle)(p,()=>({openCreate:ue})),(0,X.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,X.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,X.useCallback)(e=>{if(e.button!==0||$r(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),pe=(0,X.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Z.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,Z.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(Qr,{policy:n,copy:i.monitoring,onSave:l}),(0,Z.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>T(`board`),className:O(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Z.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>T(`graph`),className:O(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Z.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,Z.jsx)(`div`,{ref:h,className:O(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:pe,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,Z.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Mr.map(t=>{let n=ei[t],a=oe[t];return(0,Z.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||Pr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),le(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,Z.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Z.jsxs)(`div`,{className:O(`flex items-center gap-1.5 rounded-md px-2 py-1`,ti[t]),children:[(0,Z.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Z.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,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Z.jsx)(ii,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void le(t,e)},e.id))})})]},t)})})}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Ur,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Z.jsx)(te,{open:E,onOpenChange:e=>{G||D(e)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Z.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void Y(e),children:[(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Z.jsxs)(`div`,{className:O(`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,Z.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:j,onChange:e=>{N(e.target.value),q(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,Z.jsx)(xt,{attachments:J.attachments,topPadded:!1,onRemove:e=>{G||J.removeAttachment(e)}}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>J.fileInputRef.current?.click(),children:[(0,Z.jsx)(_e,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Z.jsx)(`input`,{ref:J.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{J.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Z.jsx)(f,{value:I,onChange:e=>V(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Z.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Z.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Z.jsx)(On,{className:`min-h-10 bg-surface-base`,value:H,onChange:W,disabled:G,ariaLabel:i.dueDate})]})]}),(0,Z.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Z.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Z.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Z.jsx)(Nn,{candidates:se,selectedIds:ne,disabled:G,onChange:re,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ie?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ie}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:i.cancel})}),(0,Z.jsx)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!j.trim(),children:G?i.creating:ae===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),x?(0,Z.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,Z.jsx)(`span`,{children:i.moved}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}var ci=new Set([{id:`overview`,icon:gt},{id:`tasks`,icon:qt},{id:`automations`,icon:q},{id:`files`,icon:xe},{id:`notes`,icon:ye},{id:`skills`,icon:bt},{id:`sessions`,icon:He},{id:`progress`,icon:Vt},{id:`settings`,icon:cn}].map(e=>e.id)),li=`xopc.projectFiles.panelWidthPx`,ui=320,di=220,fi=560;function pi(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 mi(e){return Math.min(fi,Math.max(di,Math.round(e)))}function hi(){try{let e=window.localStorage.getItem(li);if(e==null)return ui;let t=Number.parseInt(e,10);return Number.isFinite(t)?mi(t):ui}catch{return ui}}function gi(e){try{window.localStorage.setItem(li,String(mi(e)))}catch{}}function _i(e){return!!(e&&ci.has(e))}function vi(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function yi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):ie(n)}function bi(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function xi(e){let t=(0,Bn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.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,Z.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,Z.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 Si(e=!1){return O(`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 Ci(e){let t=(0,Bn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Z.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=O(`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,Z.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,Z.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 wi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ti(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Ei(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Di(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Oi(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 ki(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Ai(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 ji(e){let t=e.sourceChannel?.trim();return t?Mi(t):``}function Mi(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ni(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 Pi(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 Fi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Fi(e.children,t,n)}:e)}function Ii({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,X.useState)(!1),[d,f]=(0,X.useState)([e]),[m,h]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(`new`),[T,D]=(0,X.useState)(``),[k,A]=(0,X.useState)(``),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(!0),[I,V]=(0,X.useState)(null),[H,W]=(0,X.useState)(null),ne=(0,X.useCallback)(async()=>{v(!0),b(null);try{let t=await ue({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,X.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,X.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,X.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=wi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ti(t)-Ti(e))},[e.id,d,m]),G=e=>t.statuses[e.status]??e.status,K=e=>e.description||e.brief||t.common.defaultWorkspace,ie=e=>{w(e),D(``),A(``),V(null),S(!0),s(!1)},q=(0,X.useCallback)(async(e={})=>{let t=k.trim(),n=T.trim()||(C===`directory`?Ei(t):``);if(n){M(!0),V(null),W(null);try{let r=await Ze({autoUnderstand:N,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),D(``),A(``),P(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),f(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Di(e);t?(W(t),S(!1)):V(e instanceof Error?e.message:String(e))}finally{M(!1)}}},[C,T,a,k,N]),ae=(0,X.useCallback)(e=>{e.preventDefault(),q()},[q]),J=(0,X.useCallback)(()=>{q({createWorkspaceRoot:!0})},[q]),oe=(0,X.useCallback)(()=>{W(null),S(!0)},[]),se=e=>{A(e),C===`directory`&&!T.trim()&&D(Ei(e))},ce=(e,t)=>(0,Z.jsxs)(`button`,{type:`button`,className:O(`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,Z.jsx)(c,{className:O(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Z.jsx)(`span`,{className:O(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,bi(e.status)),children:G(e)})]},e.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(u,{open:o,onOpenChange:s,children:[(0,Z.jsx)(p,{asChild:!0,children:(0,Z.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,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Z.jsx)(`span`,{className:O(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,bi(e.status)),children:G(e)})]}),(0,Z.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Z.jsx)(yt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Z.jsx)(l,{children:(0,Z.jsxs)(g,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(Ye,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Z.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Z.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,Z.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,Z.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,Z.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,Z.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>ce(e,!1))]}),(0,Z.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Z.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,Z.jsx)(E,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Z.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,Z.jsx)(xe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Z.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,Z.jsx)(cn,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Z.jsx)(te,{open:x,onOpenChange:e=>!j&&S(e),children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:C===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm text-fg-muted`,children:C===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Z.jsxs)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[I?(0,Z.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:I}):null,(0,Z.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Z.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:T,onChange:e=>D(e.target.value),placeholder:`xopc`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Z.jsx)(Hn,{value:k,onChange:se,disabled:j,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,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Z.jsx)(Ut,{checked:N,onChange:P,disabled:j})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:j,children:n.cancel})}),(0,Z.jsxs)(U,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:j||!(T.trim()||C===`directory`&&Ei(k)),children:[(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Z.jsx)(te,{open:!!H,onOpenChange:e=>{e||W(null)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?vi(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,Z.jsx)(`div`,{className:`px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(xe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:j,children:n.workspaceMissingBack}),(0,Z.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:J,disabled:j,children:[(0,Z.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Li(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=M(e=>e.language),u=P(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=Gt(e=>e.setPageHeader),_=Gt(e=>e.clearPageHeader),[y,b]=(0,X.useState)(null),[T,k]=(0,X.useState)(null),[A,j]=(0,X.useState)([]),[N,I]=(0,X.useState)(``),[re,K]=(0,X.useState)([]),[ie,oe]=(0,X.useState)(0),[se,Y]=(0,X.useState)(!1),[ue,de]=(0,X.useState)(!1),[fe,pe]=(0,X.useState)(!1),[he,_e]=(0,X.useState)([]),[Ce,Te]=(0,X.useState)(null),Ae=(0,X.useRef)(new Set),[Pe,Ie]=(0,X.useState)(null),[Le,Re]=(0,X.useState)(null),[Ve,Xe]=(0,X.useState)(null),[Ze,Qe]=(0,X.useState)(hi),[$e,rt]=(0,X.useState)(!1),[at,st]=(0,X.useState)(!1),[lt,dt]=(0,X.useState)(``),[pt,mt]=(0,X.useState)([]),[yt,xt]=(0,X.useState)(!1),[St,wt]=(0,X.useState)(null),[Tt,Et]=(0,X.useState)(!1),[Dt,Ot]=(0,X.useState)(null),[At,jt]=(0,X.useState)([]),[Mt,Nt]=(0,X.useState)(``),[Ft,It]=(0,X.useState)(!0),[Rt,Ht]=(0,X.useState)(!1),[Ut,Kt]=(0,X.useState)(!1),[Xt,Zt]=(0,X.useState)(null),[Qt,$t]=(0,X.useState)(!1),[tn,nn]=(0,X.useState)(`fixed`),[an,on]=(0,X.useState)(``),[sn,un]=(0,X.useState)(null),[pn,hn]=(0,X.useState)(!1),[gn,yn]=(0,X.useState)(!1),[bn,xn]=(0,X.useState)(!1),[Sn,On]=(0,X.useState)(``),[An,jn]=(0,X.useState)(!1),[Mn,Nn]=(0,X.useState)(``),Pn=H(`/api/proactive/overview`,En),[Fn,In]=(0,X.useState)(!1),[Ln,Rn]=(0,X.useState)(null),zn=(0,X.useRef)(null),Bn=(0,X.useRef)(!1),[Vn,Q]=(0,X.useState)(null),[Un,Wn]=(0,X.useState)({title:``,reason:``}),[Gn,Kn]=(0,X.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),qn=(0,X.useRef)(Gn),Jn=`overview`,$=n?`notes`:_i(t)?t:Jn,Yn=(0,X.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Xn=(0,X.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Yn===`/projects`?n:S(n,Yn)},[Yn,e]),Zn=(0,X.useCallback)(t=>{e&&r(Xn(t))},[r,e,Xn]),Qn=(0,X.useCallback)(()=>{if($===`tasks`&&zn.current){zn.current.openCreate();return}Bn.current=!0,Zn(`tasks`)},[Zn,$]);(0,X.useEffect)(()=>{$!==`tasks`||!Bn.current||(Bn.current=!1,zn.current?.openCreate())},[$]);let $n=(0,X.useCallback)(t=>{e&&r(Xn(t),{replace:!0})},[r,e,Xn]),er=(0,X.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||$n(e)},[$n]),tr=(0,X.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,X.useEffect)(()=>{!e||!t||_i(t)||r(Xn(Jn),{replace:!0})},[Jn,r,e,Xn,t]),(0,X.useEffect)(()=>{if(!e)return;let t=!1;return It(!0),Q(null),Promise.all([Bt(e),je(e),ze(e),Wt().catch(()=>null),Ne(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;b(e),k(n),j(r),Te(a),jt(i?.agents??[]),Nt(e.defaultAgentId??``);let o={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};qn.current=o,Kn(o)}).catch(e=>{t||(Te(null),Q(e instanceof Error?e.message:String(e)))}).finally(()=>{t||It(!1)}),()=>{t=!0}},[e]);let nr=(0,X.useCallback)(async()=>{e&&k(await je(e))},[e]);(0,X.useEffect)(()=>{let t,n=n=>{let r=ke.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void nr(),120))},r=n=>{let r=qe.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void nr(),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,nr]);let rr=(0,X.useCallback)(async(e,t)=>{Rn(e.id),Q(null);try{let n=await et(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 J(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 vt(e.id,r,n.task.version),await nr(),!0}catch(e){return await nr().catch(()=>void 0),Q(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Rn(null)}},[T,p.board.actionFailed,nr]),ir=(0,X.useCallback)(async t=>{e&&(Q(null),await mn({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await nr())},[l,e,nr]),ar=(0,X.useCallback)(async(e,t)=>{Rn(e),Q(null);try{return await zt(e,t,(await et(e)).task.version),await nr(),!0}catch(e){return await nr().catch(()=>void 0),Q(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Rn(null)}},[p.board.actionFailed,nr]),or=(0,X.useCallback)(async(e,t,n)=>{Rn(e),Q(null);try{let r=await et(e);return r.task.phase!==t&&(r=await vt(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 zt(e,n,r.task.version),await nr(),!0}catch(e){return await nr().catch(()=>void 0),Q(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Rn(null)}},[p.board.actionFailed,nr]),sr=(0,X.useCallback)(async(e,t)=>{Rn(e),Q(null);try{await Me(e,t,(await et(e)).task.version),await nr()}catch(e){await nr().catch(()=>void 0),Q(e instanceof Error?e.message:p.board.actionFailed)}finally{Rn(null)}},[p.board.actionFailed,nr]),cr=(0,X.useCallback)(async t=>{if(e){Q(null);try{await ge(e,t),await nr()}catch(e){throw Q(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,nr]),lr=(0,X.useCallback)(async()=>{if(y){Y(!0),Q(null);try{let e=await ne(y.id,{includeRelated:ue,limit:100});K(e.items),oe(e.total)}catch(e){Q(e instanceof Error?e.message:String(e))}finally{Y(!1)}}},[y,ue]);(0,X.useEffect)(()=>{$===`progress`&&lr()},[lr,$]);let ur=(0,X.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){_e([]),Ae.current.clear(),Ot(null);return}Et(!0),Ot(null),Ae.current.clear();try{_e(Pi((await Lt(y.id,``)).entries)),Ae.current.add(``)}catch(e){_e([]),Ae.current.clear(),Ot(e instanceof Error?e.message:String(e))}finally{Et(!1)}},[y]),dr=(0,X.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||Ae.current.has(e))){Ae.current.add(e),Ot(null);try{let t=await Lt(y.id,e);_e(n=>Fi(n,e,Pi(t.entries)))}catch(t){Ae.current.delete(e),Ot(t instanceof Error?t.message:String(t))}}},[y]),fr=(0,X.useCallback)(async e=>{if(!y?.effectiveWorkspaceRoot?.trim())return;let t=Pi((await Lt(y.id,e)).entries);_e(e?n=>Fi(n,e,t):t),Ae.current.add(e)},[y]);(0,X.useEffect)(()=>{$===`files`&&ur()},[ur,$]);let pr=lt.trim();(0,X.useEffect)(()=>{if($!==`files`||!y||!at||!pr){mt([]),xt(!1),wt(null);return}let e=!1;xt(!0),wt(null),mt([]);let t=window.setTimeout(()=>{_n(y.id,pr,50).then(t=>{e||mt(t)}).catch(t=>{e||wt(t instanceof Error?t.message:String(t))}).finally(()=>{e||xt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[pr,y,at,$]);let mr=(0,X.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([Bt(y.id),je(y.id)]);k(t),b(e)},[y]),gr=(0,X.useCallback)(async e=>{if(e.preventDefault(),!(!y||!Un.title.trim())){yn(!0),Q(null);try{await ce(y.id,{title:Un.title.trim(),reason:Un.reason.trim()||void 0}),Wn({title:``,reason:``}),In(!1),await mr()}catch(e){Q(e instanceof Error?e.message:String(e))}finally{yn(!1)}}},[Un.reason,Un.title,y,mr]),_r=(0,X.useMemo)(()=>(0,Z.jsx)(s,{to:Yn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Yn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Z.jsx)(Je,{className:`size-4`,"aria-hidden":!0})}),[Yn,u.sidebar.back,p.backToProjects]),vr=(0,X.useMemo)(()=>y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,Z.jsx)(w,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,Z.jsxs)(U,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Qn,children:[(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Z.jsx)(U,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Z.jsxs)(s,{to:en(y.id),state:{forceNewChat:!0,agentId:y.defaultAgentId},onClick:er(`sessions`),children:[(0,Z.jsx)(He,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})})]}):null,[Qn,er,p.board.create,p.common.newChat,p.common.runWorkflow,y]);(0,X.useLayoutEffect)(()=>(g({startExtra:_r,main:y?(0,Z.jsx)(Ii,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:vr}),()=>_()),[_,vr,_r,p,y,h,g,d]);function yr(e){b(t=>t?{...t,...e}:null),Nt(e.defaultAgentId??``),Ne(e.id).then(Te).catch(()=>Te(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function br(e=qn.current){if(!(!y||!pi(e,y))){Q(null),Zt(null);try{let t=await nt(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions});yr(t);let n=qn.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};qn.current=r,Kn(r)}catch(e){let t=Di(e);throw t?Zt(t):Q(e instanceof Error?e.message:String(e)),e}}}function xr(e){e.preventDefault(),zr.flush()}function Sr(e,t=!1){let n={...qn.current,...e};qn.current=n,Kn(n),t&&zr.saveNow(n)}let wr=(0,X.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;nn(e?`fixed`:`follow`),on(e||y.effectiveWorkspaceRoot||``),$t(!0)},[y]);async function Tr(e={}){if(!y)return;let t=tn===`fixed`?an.trim():``;if(!(tn===`fixed`&&!t)){Ht(!0),Q(null),Zt(null);try{let n=await nt(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});yr(n),Sr({workspaceRoot:n.workspaceRoot??``}),$t(!1),Zt(null)}catch(e){let t=Di(e);t?(Zt(t),$t(!1)):Q(e instanceof Error?e.message:String(e))}finally{Ht(!1)}}}async function Er(){if(!(!y||sn)){un(`pin`),Q(null);try{yr(y.pinnedAt?await G(y.id):await be(y.id))}catch(e){Q(e instanceof Error?e.message:String(e))}finally{un(null)}}}async function Dr(){if(!(!y||sn)){un(`archive`),Q(null);try{let e=y.status===`archived`?await Ee(y.id):await dn(y.id);yr(e),Sr({status:e.status})}catch(e){Q(e instanceof Error?e.message:String(e))}finally{un(null)}}}async function Or(){if(y){hn(!0),Q(null);try{await Fe(y.id),Kt(!1),r(`/projects`)}catch(e){Q(e instanceof Error?e.message:String(e))}finally{hn(!1)}}}async function kr(){if(!(!y||fe)){pe(!0),Q(null);try{await Ue(y.id)}catch(e){Q(e instanceof Error?e.message:String(e))}finally{pe(!1)}}}let Ar=(0,X.useCallback)(e=>{Ie(e)},[]),Mr=(0,X.useCallback)((e,t)=>{t||Ie(e)},[]),Nr=(0,X.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||Ie(t.path);break;case`download`:if(t.isDirectory)return;try{let e=vn(t.path);if(it(Ge(e))!==`text`){let n=await me(t.path,{projectId:r}),i=Pt(e)??`application/octet-stream`;tt(e,await n.arrayBuffer(),i)}else{let{content:n}=await we(t.path,{projectId:r});ct(e,n)}}catch(e){Ke(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await V(t.path)&&Ke(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Ke(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await ln(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWith`:await ln(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await ln(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),u.workspace.openFileFailed);break;case`revealInFolder`:await ln(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),u.workspace.revealFileFailed);break;case`trash`:Re(t);break;case`delete`:t.isDirectory||Xe(t);break;default:break}},[u.clipboard.copyFailed,u.workspace.openFileFailed,u.workspace.pathCopied,u.workspace.revealFileFailed,y?.id]),Pr=(0,X.useCallback)(async()=>{let e=Le;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){Ke(`warning`,t?.error??u.workspace.trashFailed,void 0,{duration:4e3});return}Pe===e.path&&Ie(null),Re(null),await ur(),Ke(`success`,u.workspace.trashSuccess,void 0,{duration:2500})},[u.workspace.trashFailed,u.workspace.trashSuccess,Le,Pe,ur]),Fr=(0,X.useCallback)(async(e,t)=>{let n=y?.id;if(n)try{await Promise.all(e.map(e=>Yt(e,t,{projectId:n}))),await fr(t).catch(()=>void 0),Ke(`success`,u.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await fr(t).catch(()=>void 0),Ke(`warning`,`${u.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.uploadFailed,u.workspace.uploadSuccess,y?.id,fr]),Ir=(0,X.useCallback)(async()=>{let e=Ve;if(e)try{await ve(e.fileId),Pe===e.path&&Ie(null),Xe(null);let t=e.path.lastIndexOf(`/`);await fr(t<0?``:e.path.slice(0,t)).catch(()=>void 0),Ke(`success`,u.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){Ke(`warning`,`${u.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.deleteFailed,u.workspace.deleteSuccess,Ve,Pe,fr]),Lr=(0,X.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),rt(!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=mi(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}rt(!1),Qe(c),gi(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,X.useEffect)(()=>{$!==`files`&&Ie(null)},[e,$]);let Rr=!!(y&&pi(Gn,y)),zr=wn({value:y?Gn:null,dirty:Rr,onSave:br,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Ft)return(0,Z.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!y)return(0,Z.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Z.jsxs)(s,{to:Yn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Z.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),Yn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Z.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Vn||p.notFound})]});let Br=A.slice(0,3),Vr=T?.blockers??[],Hr=jr(T?.tasks??[]),Ur=T?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Wr=e=>p.statuses[e]??e,Gr=e=>vi(p.common.messages,{count:e}),Kr=N.trim().toLowerCase(),qr=Kr?A.filter(e=>{let t=yi(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Gr(e.messageCount??0),a=ji(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Kr)}):A,Jr=A.length>0&&qr.length===0,Yr=At.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Xr=At.find(e=>e.id===Gn.defaultAgentId),Zr=y.workspaceRoot?.trim()||``,Qr=y.status===`archived`,$r=!!y.pinnedAt,ei=!Zr,ti=Zr||Xr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,ni=tn===`fixed`?an.trim()||p.settings.workspacePlaceholder:Xr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,ri=(tn===`fixed`?an.trim():``)!==Zr&&(tn===`follow`||!!an.trim()),ii=y.name,ai=Pn.data?.delegations.find(t=>t.scenarioKey===`project_delivery_risk`&&t.scopeId===e&&!t.completedAt),oi=[{id:`overview`,icon:gt,label:p.tabs.overview},{id:`tasks`,icon:qt,label:p.tabs.tasks},{id:`automations`,icon:q,label:p.tabs.automations},{id:`files`,icon:xe,label:p.tabs.files},{id:`notes`,icon:ye,label:p.tabs.notes},{id:`skills`,icon:bt,label:p.tabs.skills},{id:`sessions`,icon:He,label:p.tabs.sessions},{id:`progress`,icon:Vt,label:p.tabs.progress}];async function ci(){if(!ti)return;let e=await V(ti);Ke(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function li(){On(l===`zh`?`帮我守住「${ii}」的目标和关键承诺。出现可能影响交付的变化时告诉我,并先准备好建议。`:`Protect the goal and key commitments for “${ii}”. Tell me when a change may affect delivery, and prepare a recommendation first.`),Nn(``),xn(!0)}async function ui(){if(!(!Sn.trim()||An)){jn(!0),Nn(``);try{await Tn(`/api/proactive/delegations`,`POST`,{scenarioKey:`project_delivery_risk`,projectId:e,instructions:Sn.trim()}),await Pn.mutate(),xn(!1),Ke(`success`,l===`zh`?`助理已经记住这个项目`:`Your assistant is now following this project`)}catch(e){Nn(String(e))}finally{jn(!1)}}}function di(){Zt(null),$t(!0)}return(0,Z.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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Z.jsx)(Dn,{items:oi,activeTab:$,onChange:Zn,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Z.jsxs)(U,{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:()=>Zn(`settings`),children:[(0,Z.jsx)(cn,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,Rr?(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),(0,Z.jsx)(`div`,{className:`mt-2 shrink-0`,children:(0,Z.jsx)(U,{variant:`ghost`,onClick:()=>ai?r(`/assistant-work?delegation=${encodeURIComponent(ai.id)}`):li(),children:ai?l===`zh`?`调整助理跟进`:`Adjust assistant follow-up`:l===`zh`?`让助理守住这个项目`:`Ask the assistant to protect this project`})}),(0,Z.jsx)(te,{open:bn,onOpenChange:xn,children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(30rem,calc(100dvh-1.5rem))] w-[min(34rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(ee,{className:`font-semibold text-fg`,children:l===`zh`?`让助理守住这个项目`:`Ask the assistant to protect this project`}),(0,Z.jsx)(L,{className:`mt-1 text-sm text-fg-muted`,children:l===`zh`?`助理会理解项目变化,只在需要你知道或决定时回来。`:`Your assistant will understand project changes and return only when you should know or decide.`})]}),(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{variant:`ghost`,className:`size-9 p-0`,"aria-label":l===`zh`?`关闭`:`Close`,children:(0,Z.jsx)(D,{className:`size-4`})})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:[(0,Z.jsxs)(`label`,{className:`text-sm font-medium text-fg`,children:[l===`zh`?`你希望助理帮你守住什么?`:`What should the assistant protect?`,(0,Z.jsx)(`textarea`,{rows:6,maxLength:12e3,className:`mt-2 w-full rounded-lg border border-edge bg-surface-base p-3 text-sm text-fg`,value:Sn,onChange:e=>On(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-hover p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:l===`zh`?`它会这样工作`:`How it will work`}),(0,Z.jsx)(`p`,{className:`mt-2 text-fg-muted`,children:l===`zh`?`当目标、承诺或交付风险出现有意义的变化时,助理会先判断影响、准备建议,再把完整结果放到工作台。`:`When the goal, commitments, or delivery risk meaningfully changes, the assistant will assess the impact, prepare a recommendation, and bring the complete result to the Workbench.`})]}),Mn&&(0,Z.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Mn})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{variant:`ghost`,children:l===`zh`?`取消`:`Cancel`})}),(0,Z.jsx)(U,{variant:`primary`,disabled:An||!Sn.trim(),onClick:()=>void ui(),children:An?l===`zh`?`正在记住…`:`Remembering…`:l===`zh`?`开始守住`:`Start protecting`})]})]})]})}),Vn?(0,Z.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:Vn}):null,(0,Z.jsxs)(`div`,{className:O(`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,Z.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,Z.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,Z.jsx)(rn,{projectId:y.id},y.id),(0,Z.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Z.jsx)(`div`,{className:`p-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:vi(p.overview.activitySummary,{moving:Ur,attention:Vr.length})})]}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:y.outcome||y.description||y.brief||p.overview.directionFallback}),T?.digest.recommendedAction?(0,Z.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:vi(p.overview.recommendedNext,{action:T.digest.recommendedAction})}):null]}),(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void kr(),disabled:fe,children:[(0,Z.jsx)(fn,{className:`size-3.5`,"aria-hidden":!0}),fe?p.overview.savingDigest:p.overview.saveDigest]})]})}),(0,Z.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,Z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Zn(`tasks`),children:p.common.viewAll})]}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Hr.length?Hr.map(e=>(0,Z.jsxs)(s,{to:Be(Xn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Z.jsxs)(`span`,{className:O(`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:[p.board.phases[e.phase],e.operationalState===`idle`?``:` · ${p.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Z.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),T?.recentResults.length?(0,Z.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:T.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Z.jsxs)(s,{to:Be(Xn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Z.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[p.overview.resultStatuses[n.status],` · `,p.board.verification[n.verification.status]]})]}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Z.jsx)(C,{content:n.summary,compact:!0})})]},n.runId))})]}):null,y.milestones.length||y.recentUpdates.length?(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[y.milestones.length?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:y.milestones.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:p.statuses[e.status]})]},e.id))})]}):null,y.recentUpdates.length?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:y.recentUpdates.slice(0,3).map(e=>(0,Z.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Z.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,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":Fn,onClick:()=>In(e=>!e),children:[(0,Z.jsx)(E,{className:O(`size-3.5 transition-transform`,Fn&&`rotate-45`),"aria-hidden":!0}),p.overview.addBlocker]})]}),Vr.length?(0,Z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Vr.map(e=>{let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(_t,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Z.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Wr(e.status)}`:``]})]});return e.href?(0,Z.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Z.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),Fn?(0,Z.jsxs)(`form`,{onSubmit:gr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Z.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Un.title,onChange:e=>Wn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Z.jsx)(U,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:gn||!Un.title.trim(),"aria-label":gn?p.overview.addingBlocker:p.overview.addBlocker,title:gn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Z.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Jt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Zn(`sessions`),children:p.common.viewAll})]}),(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Br.length?Br.map(e=>(0,Z.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:yi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==y.defaultAgentId?(0,Z.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Z.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Z.jsx)(si,{ref:zn,tasks:T?.tasks??[],dependencyEdges:T?.dependencyEdges??[],monitoring:T?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:Xn(`tasks`),copy:p.board,onAction:rr,onReorder:ar,onUndoMove:or,onDependenciesChange:sr,onMonitoringChange:cr,onCreate:ir,actionBusyId:Ln}):null,$===`automations`?(0,Z.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,Z.jsx)(kn,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,$===`notes`?(0,Z.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,Z.jsx)(hr,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,$===`skills`?(0,Z.jsx)(Cr,{projectId:y.id,copy:p.skills}):null,$===`files`?(0,Z.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,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,Z.jsxs)(`div`,{"data-project-files-grid":!0,className:O(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,$e&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Ze}px`},children:[(0,Z.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Z.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[Ce?(0,Z.jsx)(kt,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Z.jsx)(`button`,{type:`button`,className:O(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,at&&`bg-surface-hover text-fg`),onClick:()=>st(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":at,children:(0,Z.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0})}),(0,Z.jsx)(ft,{className:`size-7 shrink-0 rounded-md p-0`,loading:Tt,label:u.cron.refresh,onClick:()=>void ur()})]})]}),at?(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Z.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Z.jsx)(Ye,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`text`,role:`searchbox`,value:lt,onChange:e=>dt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Z.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{dt(``),st(!1)},children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Dt?(0,Z.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Dt}):null,pr?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:yt?(0,Z.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Z.jsx)(W,{className:`h-11 w-full`}),(0,Z.jsx)(W,{className:`h-11 w-full`}),(0,Z.jsx)(W,{className:`h-11 w-full`})]}):St?(0,Z.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,St]}):pt.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):pt.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:O(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Pe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Ie(e.path),title:e.path,children:[(0,Z.jsx)(ye,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Z.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Tt&&he.length===0?(0,Z.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Z.jsx)(Se,{tree:he,selectedPath:Pe,onSelectFile:Ar,onSelectEntry:Mr,onExpandDir:e=>void dr(e),onAction:Nr,onUploadFiles:(e,t)=>void Fr(e,t),uploadDropHint:u.workspace.dropToUpload,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openDirectory:u.workspace.openInFileManager,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,trash:u.workspace.moveToTrash,delete:u.workspace.deleteFile,recommendedApps:u.workspace.recommendedApps,desktopUpdateRequired:u.workspace.desktopUpdateRequired},emptyHint:p.files.emptyDirectory})]}),(0,Z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:O(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,$e&&`bg-surface-hover`),onPointerDown:Lr,children:(0,Z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Z.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Pe?(0,Z.jsx)(ot,{filePath:Pe,projectId:y.id,agentId:y.defaultAgentId||Mt||void 0,onClose:()=>Ie(null)}):(0,Z.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Z.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Z.jsx)(xe,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Z.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Z.jsx)(`p`,{children:p.files.needWorkspace}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Zn(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,Z.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[A.length?(0,Z.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,Z.jsx)(Ye,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:N,onChange:e=>I(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),N?(0,Z.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>I(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,qr.length?(0,Z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:qr.map(e=>{let t=yi(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=ji(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Gr(e.messageCount??0);return(0,Z.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.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,Z.jsx)(He,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Z.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,Z.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Z.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Jr?(0,Z.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Z.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Z.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Z.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,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:vi(p.progress.count,{count:ie})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>de(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Z.jsxs)(U,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void lr(),disabled:se,children:[(0,Z.jsx)(le,{className:O(`size-4`,se&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Z.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:se&&re.length===0?(0,Z.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):re.length?(0,Z.jsx)(`div`,{className:`divide-y divide-edge`,children:re.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ni(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,Z.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Z.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,ki(e)]})]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:yi(e.createdAt)})]}),r?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Z.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Oi(e)]}),(0,Z.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Ai(e)]})]})]},e.id)})}):(0,Z.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,$===`settings`?(0,Z.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:xr,onBlurCapture:zr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Z.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Z.jsx)(`span`,{className:O(`rounded-full px-2 py-0.5 text-xs font-medium`,bi(Gn.status)),children:p.settings.statuses[Gn.status]}),(0,Z.jsx)(Cn,{status:zr.status,error:zr.error})]})]}),(0,Z.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Z.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(xi,{label:p.settings.name,children:(0,Z.jsx)(`input`,{className:Si(),value:Gn.name,onChange:e=>Sr({name:e.target.value})})}),(0,Z.jsx)(xi,{label:p.settings.defaultAgent,children:(0,Z.jsxs)(f,{className:Si(),value:Gn.defaultAgentId,onChange:e=>Sr({defaultAgentId:e.target.value},!0),children:[(0,Z.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),At.map(e=>(0,Z.jsx)(m,{value:e.id,children:Ct(e,u.agentsSettings)},e.id))]})}),(0,Z.jsx)(xi,{label:p.settings.status,children:Qr?(0,Z.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Z.jsxs)(f,{className:Si(),value:Gn.status===`archived`?`active`:Gn.status,onChange:e=>Sr({status:e.target.value},!0),children:[(0,Z.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Z.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Z.jsx)(xi,{label:p.settings.executionMode,hint:p.settings.executionModeHint,children:(0,Z.jsxs)(f,{className:Si(),value:Gn.executionMode,onChange:e=>Sr({executionMode:e.target.value},!0),children:[(0,Z.jsx)(m,{value:`managed_worktree`,children:p.settings.executionModeWorktree}),(0,Z.jsx)(m,{value:`local_checkout`,children:p.settings.executionModeLocal})]})}),(0,Z.jsx)(xi,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Z.jsx)(`textarea`,{className:Si(!0),value:Gn.description,onChange:e=>Sr({description:e.target.value})})})]})]}),(0,Z.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Z.jsx)(xi,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Z.jsx)(`textarea`,{className:Si(!0),value:Gn.brief,onChange:e=>Sr({brief:e.target.value})})}),(0,Z.jsx)(xi,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Z.jsx)(`textarea`,{className:Si(!0),value:Gn.instructions,onChange:e=>Sr({instructions:e.target.value})})})]})]}),(0,Z.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Z.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Z.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:ei?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Z.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:ti,children:ti}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ci(),children:[(0,Z.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),Ce?(0,Z.jsx)(kt,{resourceId:Ce.fileId,displayName:Ce.name}):null,(0,Z.jsxs)(U,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:wr,children:[(0,Z.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Z.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(Ci,{label:p.settings.defaultAgent,value:Yr}),(0,Z.jsx)(Ci,{label:p.settings.pinState,value:$r?p.settings.pinned:p.settings.notPinned}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Z.jsx)(Ci,{label:p.settings.createdAt,value:yi(y.createdAt)||p.common.never}),(0,Z.jsx)(Ci,{label:p.settings.updatedAt,value:yi(y.updatedAt)||p.common.never})]})]})]}),(0,Z.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:$r?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Z.jsxs)(U,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:sn===`pin`,onClick:()=>void Er(),children:[$r?(0,Z.jsx)(De,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(We,{className:`size-4`,"aria-hidden":!0}),$r?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Qr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Qr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Z.jsxs)(U,{type:`button`,variant:Qr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:sn===`archive`,onClick:()=>void Dr(),children:[Qr?(0,Z.jsx)(le,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),Qr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Z.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Z.jsxs)(U,{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:()=>Kt(!0),children:[(0,Z.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Z.jsx)(te,{open:Ut,onOpenChange:e=>{pn||Kt(e)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel p-5 shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.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,Z.jsx)(_t,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?vi(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:pn,children:p.common.cancel})}),(0,Z.jsxs)(U,{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:pn||!y,onClick:()=>void Or(),children:[(0,Z.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Z.jsx)(ut,{open:!!Le,title:u.workspace.trashConfirmTitle,description:u.workspace.trashConfirmDescription.replace(`{{name}}`,Le?.name??``),confirmLabel:u.workspace.moveToTrash,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void Pr(),onCancel:()=>Re(null)}),(0,Z.jsx)(ut,{open:!!Ve,title:u.workspace.deleteConfirmTitle,description:u.workspace.deleteConfirmDescription.replace(`{{name}}`,Ve?.name??``),confirmLabel:u.workspace.deleteFile,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void Ir(),onCancel:()=>Xe(null)}),(0,Z.jsx)(te,{open:Qt,onOpenChange:e=>{Rt||$t(e)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Z.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:O(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,tn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Z.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:tn===`fixed`,onChange:()=>nn(`fixed`),disabled:Rt}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Z.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Z.jsxs)(`label`,{className:O(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,tn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Z.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:tn===`follow`,onChange:()=>nn(`follow`),disabled:Rt}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Z.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),tn===`fixed`?(0,Z.jsx)(Hn,{value:an,onChange:on,disabled:Rt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Si(),autoFocus:!0}):null,(0,Z.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:vi(p.settings.workspaceCurrent,{workspace:ni})})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Rt,children:p.common.cancel})}),(0,Z.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Rt||!ri,onClick:()=>void Tr(),children:[(0,Z.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Z.jsx)(te,{open:!!Xt,onOpenChange:e=>{e||Zt(null)},children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(B,{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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Z.jsx)(L,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Xt?vi(p.settings.workspaceMissingDescription,{workspace:Xt}):null})]}),Xt?(0,Z.jsx)(`div`,{className:`px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(xe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Xt})]})}):null,(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(U,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:di,disabled:Rt,children:p.settings.workspaceMissingBack}),(0,Z.jsxs)(U,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Tr({createWorkspaceRoot:!0}),disabled:Rt,children:[(0,Z.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{Li as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a,r as o}from"./popover-select-DldSX8GX.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d}from"./locale-store-D0001I7p.js";import{t as ee}from"./messages-BWANv-N-.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./skeleton-BwbyijEw.js";import{Ba as x,Bu as S,Ec as C,Fa as w,Ia as T,La as E,Lc as te,Lu as D,Rc as O,Rl as k,Sc as A,Ta as j,Zi as M,la as N,mo as P,ta as ne,wa as re,zl as ie,zr as F}from"./index-fVtuw2o9.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(b,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=d(V),c,l,u,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),d;t[20]===o?d=t[21]:(d=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=d);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsx)(D,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=_):_=t[22];let v;t[23]===d?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[d,_]}),t[23]=d,t[24]=v),g=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],l=t[10],u=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let _;t[25]!==l||t[26]!==u?(_=(0,R.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=_):_=t[27];let v;t[28]!==f||t[29]!==p||t[30]!==_?(v=(0,R.jsxs)(`div`,{className:f,children:[p,_]}),t[28]=f,t[29]=p,t[30]=_,t[31]=v):v=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==w?(T=(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:w}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,k=n.status===`archived`?c.restore:c.archive,A;t[40]===n.status?A=t[41]:(A=n.status===`archived`?(0,R.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=A);let j;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==k||t[46]!==A?(j=(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:k,children:A}),t[42]=r,t[43]=o,t[44]=E,t[45]=k,t[46]=A,t[47]=j):j=t[47];let M;t[48]!==T||t[49]!==j?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,j]}),t[48]=T,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==m||t[53]!==v?(N=(0,R.jsxs)(`div`,{className:m,children:[v,M]}),t[51]=M,t[52]=m,t[53]=v,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==h||t[57]!==g?(P=(0,R.jsxs)(`article`,{className:h,children:[g,N]}),t[55]=N,t[56]=h,t[57]=g,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=ee(d(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=P(e=>e.setPageHeader),b=P(e=>e.clearPageHeader),[S,C]=(0,L.useState)([]),[te,D]=(0,L.useState)(!0),[O,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,U]=(0,L.useState)(null),[ue,W]=(0,L.useState)(!1),[de,G]=(0,L.useState)(null),[K,fe]=(0,L.useState)(!1),[q,pe]=(0,L.useState)(!0),[J,me]=(0,L.useState)(``),[Y,he]=(0,L.useState)(``),[X,ge]=(0,L.useState)(``),Z=ne({initialPath:X,onPicked:ge}),Q=(0,L.useCallback)(async()=>{D(!0),F(null);try{C(ae((await w({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){F(e instanceof Error?e.message:String(e))}finally{D(!1)}},[]);(0,L.useEffect)(()=>{Q()},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return S.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,S,I]),_e=(0,L.useMemo)(()=>(0,R.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>W(!0),children:[(0,R.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:_e}),()=>b()),[b,_e,n.title,i]);let ve=(0,L.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||K)){fe(!0),G(null);try{let e=await j({autoUnderstand:q,name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});C(t=>[e,...t.filter(t=>t.id!==e.id)]),me(``),he(``),ge(``),pe(!0),W(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){G(e instanceof Error?e.message:String(e))}finally{fe(!1)}}},[K,Y,J,X,q]),ye=(0,L.useCallback)(async(e,t)=>{U(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await x(e.id):await T(e.id):e.status===`archived`?await E(e.id):await re(e.id),C(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{U(null)}},[]),be=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],xe=be.find(e=>e.id===H)?.label??t.all,Se=n.resultCount.replace(`{{status}}`,xe).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-6xl flex-1 flex-col gap-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,R.jsx)(v,{open:ue,onOpenChange:e=>{W(e),e||G(null)},children:(0,R.jsxs)(h,{children:[(0,R.jsx)(f,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(g,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(p,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ve,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>me(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>he(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:K||Z.picking,children:[Z.picking?(0,R.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(k,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:u(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(N,{checked:q,onChange:pe,disabled:K}),de?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:de}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(m,{asChild:!0,children:(0,R.jsx)(y,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(y,{type:`submit`,variant:`primary`,disabled:K||!J.trim()||!X.trim(),children:K?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,R.jsx)(M,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Se}),(0,R.jsxs)(`div`,{className:u(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(A,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:be.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),O?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:O}),(0,R.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void ye(e,`pin`),onToggleArchive:()=>void ye(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(ie,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a,t as o}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./cn-JdwAhgNB.js";import{c as p,n as m}from"./locale-store-D0001I7p.js";import{t as h}from"./messages-BWANv-N-.js";import{a as g,i as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./copy-to-clipboard-HOJ79TWv.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-CGlRPNzi.js";import{n as T,r as E}from"./gateway-config-swr-BNuoHXiZ.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{B as k,Co as A,Fi as j,Jc as M,Lu as N,Mc as P,Ot as F,R as I,St as L,Xi as R,Xs as z,bc as B,bu as V,ea as ee,ec as H,fc as U,mc as W,uu as G,vu as te,wt as ne,xl as re,xt as ie,z as ae}from"./index-fVtuw2o9.js";import{n as K,r as q,t as oe}from"./settings-page-layout-CsUQKRq0.js";import{n as J,r as se,t as ce}from"./settings-form-section-sw2bbS2b.js";import{S as Y,a as le,b as ue,c as de,g as fe,i as pe,n as me,o as he,r as ge,s as _e,t as X,x as ve,y as ye}from"./tunnel-api-__auf8Ww.js";import{t as be}from"./page-tabs-Bi_-DA5J.js";import{t as xe}from"./settings-advanced-gate-Cy3Ab3Vg.js";var Z=e(t(),1),Q=n(),$=r();function Se(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function Ce(e){let t=(0,Q.c)(5),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=f(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Se(r)),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function we(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=m(Ee),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!p(Te),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=C(o?`exposure-status`:null,ve,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=C(o?`tunnel-status`:null,me,l),g=E(o);if(!o)return null;let _=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=g.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.gateway?.publicUrl),w=_?`active`:`off`,T=_?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[4]=a.tailscaleCardTitle,t[5]=w,t[6]=T,t[7]=D):D=t[7];let O=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==k?(A={tab:`public`,icon:M,title:a.publicCardTitle,kind:O,statusLabel:k},t[8]=a.publicCardTitle,t[9]=O,t[10]=k,t[11]=A):A=t[11];let j=S?`active`:`off`,N=S?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==j||t[14]!==N?(P={tab:`reverse-proxy`,icon:W,title:a.reverseProxyCardTitle,kind:j,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=j,t[14]=N,t[15]=P):P=t[15];let F;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(F={tab:`ssh`,icon:H,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=F):F=t[18];let I;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(I={tab:`lan`,icon:B,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=I):I=t[21];let L;t[22]!==P||t[23]!==F||t[24]!==I||t[25]!==D||t[26]!==A?(L=[D,A,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=D,t[26]=A,t[27]=L):L=t[27];let R=L,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:f(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ce,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function Te(e){return e.conversationId}function Ee(e){return e.language}function De(e){let t=(0,Q.c)(26),{title:n,description:r,recommended:i,icon:a,onOpen:o,openLabel:s,recommendedLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(`group flex w-full flex-col rounded-2xl bg-surface-base p-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=l):l=t[0];let u;t[1]===a?u=t[2]:(u=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=u);let d;t[3]===n?d=t[4]:(d=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=d);let p;t[5]!==i||t[6]!==c?(p=i&&c?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:c}):null,t[5]=i,t[6]=c,t[7]=p):p=t[7];let m;t[8]!==d||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[d,p]}),t[8]=d,t[9]=p,t[10]=m):m=t[10];let h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==u||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[u,g,_]}),t[17]=u,t[18]=g,t[19]=v):v=t[19];let y;t[20]===s?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:s}),t[20]=s,t[21]=y);let b;return t[22]!==o||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:l,children:[v,y]}),t[22]=o,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}function Oe(e){let t=(0,Q.c)(83),{onOpenTab:n}=e,r=m(je),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!p(Ae),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=C(s?`exposure-status`:null,ve,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let f=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(we,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(ke)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.configure||t[18]!==o.recommended||t[19]!==o.tailscaleCardDesc||t[20]!==o.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(De,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,openLabel:o.configure,onOpen:y}),t[17]=o.configure,t[18]=o.recommended,t[19]=o.tailscaleCardDesc,t[20]=o.tailscaleCardTitle,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let S;t[25]!==o.configure||t[26]!==o.publicCardDesc||t[27]!==o.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(De,{icon:M,title:o.publicCardTitle,description:o.publicCardDesc,openLabel:o.configure,onOpen:x}),t[25]=o.configure,t[26]=o.publicCardDesc,t[27]=o.publicCardTitle,t[28]=x,t[29]=S):S=t[29];let w;t[30]===n?w=t[31]:(w=()=>n(`reverse-proxy`),t[30]=n,t[31]=w);let T;t[32]!==o.configure||t[33]!==o.reverseProxyCardDesc||t[34]!==o.reverseProxyCardTitle||t[35]!==w?(T=(0,$.jsx)(De,{icon:W,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,openLabel:o.configure,onOpen:w}),t[32]=o.configure,t[33]=o.reverseProxyCardDesc,t[34]=o.reverseProxyCardTitle,t[35]=w,t[36]=T):T=t[36];let E;t[37]===n?E=t[38]:(E=()=>n(`ssh`),t[37]=n,t[38]=E);let D;t[39]!==o.configure||t[40]!==o.sshCardDesc||t[41]!==o.sshCardTitle||t[42]!==E?(D=(0,$.jsx)(De,{icon:H,title:o.sshCardTitle,description:o.sshCardDesc,openLabel:o.configure,onOpen:E}),t[39]=o.configure,t[40]=o.sshCardDesc,t[41]=o.sshCardTitle,t[42]=E,t[43]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let k;t[46]!==o.configure||t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==O?(k=(0,$.jsx)(De,{icon:B,title:o.lanCardTitle,description:o.lanCardDesc,openLabel:o.configure,onOpen:O}),t[46]=o.configure,t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=O,t[50]=k):k=t[50];let A;t[51]!==S||t[52]!==T||t[53]!==D||t[54]!==k||t[55]!==b?(A=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,T,D,k]}),t[51]=S,t[52]=T,t[53]=D,t[54]=k,t[55]=b,t[56]=A):A=t[56];let j;t[57]!==A||t[58]!==v?(j=(0,$.jsxs)(`div`,{children:[v,A]}),t[57]=A,t[58]=v,t[59]=j):j=t[59];let N;t[60]===o.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[60]=o.oneAtATimeHint,t[61]=N);let P;t[62]===a.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[62]=a.advanced.proxyTitle,t[63]=P);let F;t[64]===a.advanced.proxyBody?F=t[65]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[64]=a.advanced.proxyBody,t[65]=F);let I;t[66]!==r||t[67]!==a.advanced.proxyDocs?(I=(0,$.jsx)(Y,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=a.advanced.proxyDocs,t[68]=I):I=t[68];let L;t[69]!==P||t[70]!==F||t[71]!==I?(L=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,F,I]}),t[69]=P,t[70]=F,t[71]=I,t[72]=L):L=t[72];let R;t[73]!==o.docsLink||t[74]!==r?(R=(0,$.jsx)(Y,{language:r,label:o.docsLink}),t[73]=o.docsLink,t[74]=r,t[75]=R):R=t[75];let z;return t[76]!==j||t[77]!==N||t[78]!==L||t[79]!==R||t[80]!==g||t[81]!==_?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,j,N,L,R]}),t[76]=j,t[77]=N,t[78]=L,t[79]=R,t[80]=g,t[81]=_,t[82]=z):z=t[82],z}function ke(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ae(e){return e.conversationId}function je(e){return e.language}function Me(){let e=(0,Q.c)(16),t=m(Ne),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(J,{icon:B,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ce,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Ne(e){return e.language}function Pe(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=m(Fe),a;t[0]===i?a=t[1]:(a=h(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await S(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=f):f=t[3];let p,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>void d(),g=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=p,t[5]=g):(p=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`ghost`,onClick:p,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=y):y=t[10];let b;t[11]!==v||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[f,v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(J,{icon:H,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ce,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(J,{icon:H,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let T;t[25]===x?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=T);let E;return t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(ce,{children:[C,T]}),t[27]=C,t[28]=T,t[29]=E):E=t[29],E}function Fe(e){return e.language}function Ie(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Pe,{embedded:!0}),e[0]=t):t=e[0],t}var Le=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Re(e){return e&&Le.includes(e)?e:`guide`}function ze(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,p]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=f(`rounded-2xl bg-surface-base`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>p(Be),t[2]=h):h=t[2];let g=d&&`rotate-180`,_;t[3]===g?_=t[4]:(_=f(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(V,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:h,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[v,y,x]}),t[11]=d,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=f(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(xe,{children:k}),t[30]=k,t[31]=e),e}return k}function Be(e){return!e}function Ve(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,p]=(0,Z.useState)(!1),m;t[0]===u?m=t[1]:(m=e=>{e||(p(!1),u())},t[0]=u,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[2]=h):h=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=f(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,D),t[3]=S):S=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let T;t[6]===i?T=t[7]:(T=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=T);let E;t[8]===a?E=t[9]:(E=a.map(He),t[8]=a,t[9]=E);let k;t[10]===E?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:E}),t[10]=E,t[11]=k);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>p(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(w,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(w,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==C||t[33]!==T||t[34]!==k?(R=(0,$.jsxs)(v,{children:[h,(0,$.jsxs)(y,{className:S,onOpenAutoFocus:Ue,children:[C,T,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=C,t[33]=T,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==m||t[38]!==R?(z=(0,$.jsx)(x,{open:n,onOpenChange:m,children:R}),t[36]=n,t[37]=m,t[38]=R,t[39]=z):z=t[39],z}function He(e){return(0,$.jsx)(`li`,{children:e},e)}function Ue(e){return e.preventDefault()}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ge=[`preparing_frpc`,`registering`,`starting_frpc`];function Ke(e){return e?e===`reconnecting_frpc`?Ge.indexOf(`starting_frpc`):Ge.indexOf(e):-1}function qe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ge.indexOf(e),i=Ke(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Je(e,t,n){let r=n.startProgress;return qe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ye(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Xe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ze(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Qe),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,p,m,h;if(t[6]!==n||t[7]!==r){let e=Xe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(p=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=p):p=t[19];let o=Ge.map(e=>{let t=qe(e,n),i=Je(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(G,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:f(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ye(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:f(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[We(n.frpcDownload.bytesReceived),` /`,` `,We(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=p,t[11]=m,t[12]=h}else l=t[8],u=t[9],p=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[p,m,h,g]}),t[25]=u,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){return e+1}function $e(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function et(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function tt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function nt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function rt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:p,startDisabledReason:m,stepLabel:h,onStart:g,onStop:_}=e,v=p===void 0?!1:p,y,b,x,S,C,T,E;t[0]!==r||t[1]!==o?(E=et(r),y=r.enabled||o,b=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(se(),`space-y-4`),t[9]=T):T=t[9],C=`flex flex-wrap items-start justify-between gap-3`,S=`flex items-center gap-2`,x=f(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,tt(E)),t[0]=r,t[1]=o,t[2]=y,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=T,t[8]=E):(y=t[2],b=t[3],x=t[4],S=t[5],C=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,M;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(M=f(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=M):M=t[14];let N;t[15]===M?N=t[16]:(N=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[15]=M,t[16]=N);let F;t[17]!==i||t[18]!==r||t[19]!==n?(F=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):$e(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=F):F=t[20];let I;t[21]!==N||t[22]!==F||t[23]!==x?(I=(0,$.jsxs)(`span`,{className:x,children:[N,F]}),t[21]=N,t[22]=F,t[23]=x,t[24]=I):I=t[24];let L;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(L=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,nt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=L):L=t[28];let R;t[29]!==I||t[30]!==L||t[31]!==S?(R=(0,$.jsxs)(`div`,{className:S,children:[I,L]}),t[29]=I,t[30]=L,t[31]=S,t[32]=R):R=t[32];let B;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=B):B=t[33];let V;t[34]!==R||t[35]!==C?(V=(0,$.jsxs)(`div`,{className:C,children:[R,B]}),t[34]=R,t[35]=C,t[36]=V):V=t[36];let ee;t[37]===a?ee=t[38]:(ee=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=ee);let H;t[39]!==c||t[40]!==n.consentExpiredBanner?(H=c?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=H):H=t[41];let U;t[42]!==y||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==b||t[47]!==r||t[48]!==v||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(U=y?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(j,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,b?(0,$.jsx)(Ze,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(w,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(P,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(w,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(P,{className:`size-4`}),n.start]})]}),t[42]=y,t[43]=l,t[44]=g,t[45]=_,t[46]=b,t[47]=r,t[48]=v,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=U):U=t[54];let W;return t[55]!==V||t[56]!==ee||t[57]!==H||t[58]!==U||t[59]!==T?(W=(0,$.jsxs)(`section`,{className:T,children:[V,ee,H,U]}),t[55]=V,t[56]=ee,t[57]=H,t[58]=U,t[59]=T,t[60]=W):W=t[60],W}var it={reconfiguring:!1};function at(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:p,brokerSecretNotice:m,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:y,sectionRef:b}=e,x=(0,Z.useId)(),S=r,C=!S,[T,E]=(0,Z.useReducer)(ee,it),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let k=O,j;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(j={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=j):j=t[8];let M=j,N;t[9]===o?N=t[10]:(N=o.trim().length>0&&!F(o.trim()),t[9]=o,t[10]=N);let P=N,I;t[11]===g?I=t[12]:(I=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=I);let L=I,R=C&&`ring-1 ring-amber-500/30`,z;t[13]===R?z=t[14]:(z=f(R),t[13]=R,t[14]=z);let B=S?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:C?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===B?V=t[16]:(V=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,B),t[15]=B,t[16]=V);let H;t[17]===S?H=t[18]:(H=S?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S,t[18]=H);let U;t[19]!==V||t[20]!==H?(U=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=U):U=t[21];let W=S?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,G;t[22]===W?G=t[23]:(G=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:W}),t[22]=W,t[23]=G);let te=S?n.brokerSecretReadyHint:n.brokerSecretHint,ne;t[24]===te?ne=t[25]:(ne=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:te}),t[24]=te,t[25]=ne);let ie;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(ie=C?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=C,t[27]=n.brokerSecretMissingHint,t[28]=ie):ie=t[28];let ae;t[29]!==G||t[30]!==ne||t[31]!==ie?(ae=(0,$.jsxs)(`div`,{children:[G,ne,ie]}),t[29]=G,t[30]=ne,t[31]=ie,t[32]=ae):ae=t[32];let K;t[33]!==u||t[34]!==C||t[35]!==v||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(K=C||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||u,onClick:v,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:X,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=C,t[35]=v,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=K):K=t[41];let q;t[42]!==u||t[43]!==p||t[44]!==n.brokerSecretOpenAuthorization?(q=u&&p?(0,$.jsxs)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=p,t[44]=n.brokerSecretOpenAuthorization,t[45]=q):q=t[45];let oe;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==P||t[50]!==L||t[51]!==h||t[52]!==x||t[53]!==C||t[54]!==y||t[55]!==g||t[56]!==_||t[57]!==D||t[58]!==c||t[59]!==M||t[60]!==k||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(oe=k?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(A,{id:x,value:a,labels:M,reveal:ot,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(A,{id:x,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:M,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||!P,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear}):null,D?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:L,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=P,t[50]=L,t[51]=h,t[52]=x,t[53]=C,t[54]=y,t[55]=g,t[56]=_,t[57]=D,t[58]=c,t[59]=M,t[60]=k,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=oe):oe=t[71];let J;t[72]===m?J=t[73]:(J=m?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:m}):null,t[72]=m,t[73]=J);let se;t[74]!==ae||t[75]!==K||t[76]!==q||t[77]!==oe||t[78]!==J?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ae,K,q,oe,J]}),t[74]=ae,t[75]=K,t[76]=q,t[77]=oe,t[78]=J,t[79]=se):se=t[79];let Y;t[80]!==U||t[81]!==se?(Y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=Y):Y=t[82];let le;t[83]!==Y||t[84]!==z?(le=(0,$.jsx)(ce,{className:z,children:Y}),t[83]=Y,t[84]=z,t[85]=le):le=t[85];let ue;return t[86]!==b||t[87]!==le?(ue=(0,$.jsx)(`div`,{ref:b,id:`tunnel-broker-secret-setup`,children:le}),t[86]=b,t[87]=le,t[88]=ue):ue=t[88],ue}function ot(){return he().then(st)}function st(e){return e.registrationSecret??null}var ct={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function lt({embedded:e=!1}){let t=m(e=>e.language),n=h(t).tunnelSettings,r=!!p(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ee,ct),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:v,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O}=i,A=(0,Z.useRef)(null),{data:j}=E(r),{data:M,error:N,isLoading:P,mutate:z}=C(r?`tunnel-status`:null,me,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),B=(0,Z.useMemo)(()=>{let e=j?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return M?.config?.autoStart===!0},[j,M?.config?.autoStart]),V=(0,Z.useMemo)(()=>{let e=j?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[j]),H=F(V),U=M?.registrationSecret?.configured??H;(0,Z.useEffect)(()=>{let e=()=>{z()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[z]);let W=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await _e(),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[z]),te=(0,Z.useCallback)(()=>{if(!U){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),A.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(M?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}G()},[U,M?.consentRequired,G,n.brokerSecretRequiredBeforeStart]),re=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await le(),await Promise.all([z(),G()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[z,G]),K=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await de(),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[z]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ge({autoStart:e}),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),oe=(0,Z.useCallback)(()=>{if(B){q(!1);return}if(M?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!M?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,M?.canAutoStart,M?.consentRequired,n,B]),J=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),T(),await z(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,z,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),T(),await z()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[z,n.brokerSecretCleared]),ue=(0,Z.useCallback)(async()=>{let e=k(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await ne(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await L(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await ae(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await pe(),await Promise.all([z(),T()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{I(e),t&&ie(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[z,n.brokerSecretSaved]),fe=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await de({release:!0}),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[z]),he=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=M??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:B,brokerUrl:`https://frp.xopc.ai/api`}},ve=M?.consentRequired&&(X.enabled||B||M?.consent?.acceptedAt),ye=(0,$.jsx)(at,{t:n,brokerSecretReady:U,brokerSecretConfiguredInConfig:H,brokerSecretMaskedValue:H?V:``,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void J(),onAuthorize:()=>void ue(),onClear:()=>void se(),sectionRef:A}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ve,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:W,checkboxLabel:n.consentCheckbox,confirmLabel:ve?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void re(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(R,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(R,{open:v,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void fe(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:P,statusErr:N,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:he,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:te,onStop:()=>void K()}),(0,$.jsxs)(ze,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!B&&!M?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!M?.canAutoStart,onChange:oe}),n.autoStart]}),!M?.canAutoStart&&!B?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ze,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:P,statusErr:N,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:he,startDisabled:!U,startDisabledReason:U?void 0:n.brokerSecretRequiredBeforeStart,onStart:te,onStop:()=>void K()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ce,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!B&&!M?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:B,disabled:l||!B&&!M?.canAutoStart,onChange:oe}),n.autoStart]}),!M?.canAutoStart&&!B?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ut(e,t){return e.tabs[t]}function dt(e,t){return e.tabIntro[t]}function ft(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function pt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Oe,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ue,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(lt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ye,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ie,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Me,{}),t[6]=e):e=t[6],e}}}function mt(){let e=(0,Q.c)(3),t=i(),n=m(gt),r=h(n).remoteAccess,o=!!p(ht),[s,c]=a(),l=Re(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=C(u?`device-pairing-readiness`:null,fe,d),g;e[1]===c?g=e[2]:(g=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=g);let _=g,v=dt(r,l),y=Le.map(e=>({id:e,label:ut(r,e)}));return(0,$.jsxs)(q,{children:[(0,$.jsx)(K,{title:r.pageTitle,meta:(0,$.jsx)(Y,{language:n,label:r.docsLink,section:ft(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(U,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(w,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(be,{items:y,activeTab:l,onChange:_,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(oe,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ut(r,l),hint:l===`public`?void 0:v,showHeading:!1,children:(0,$.jsx)(pt,{tab:l,onOpenTab:_})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function ht(e){return e.conversationId}function gt(e){return e.language}export{mt as RemoteAccessHub};