@xopcai/xopc 0.0.393 → 0.0.394

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 (293) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/plugin.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1AF2KGju.js → agent-avatar-dicebear-CIpp0ZG6.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DzkKx0Dv.js +1 -0
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-cjJXJj_3.js → agent-plugin-dialog-dWqozfQm.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-CXG8SYr5.js +77 -0
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-B_MFhXXU.js → app-management-settings-panel-SmT1HDDg.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-TYGidVnd.js → appearance-settings-Da9jf0ZC.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DYaxWrTI.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-BrFfEp0u.js → archive-plugin-D6bFXdsA.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-B7OofUPF.js → automations-page-CM3wI2Nr.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-BSMdKgxD.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-BfAWnYG8.js → binary-plugins-CYKGdQnF.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-_Y-QwZ-3.js → block-editor-Fx38xFF4.js} +40 -40
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-DH9QHI9m.js → browser-automation-inputs-CQMc-Gol.js} +1 -1
  17. package/dist/gateway/static/root/assets/browser-automations-page-C4VhFvyu.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-8WZOkfL7.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-dreSJEes.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-9DviVNpG.js +8 -0
  21. package/dist/gateway/static/root/assets/{capability-header-actions-CFVx3iaZ.js → capability-header-actions-AbVbg7kZ.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-DqGCiVmr.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-D3GuiG3N.js → chat-terminal-dock-djkqphez.js} +16 -16
  24. package/dist/gateway/static/root/assets/{computer-settings-page-CIbHDlp8.js → computer-settings-page-DE9zl7bK.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-CDyCHkpK.js → connector-service-page--gB9vL3C.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-Bcr2NNoX.js +1 -0
  27. package/dist/gateway/static/root/assets/{date-picker-C424c_g9.js → date-picker-D9q-5a8a.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-BVJh9sYc.js → dependency-picker-Ci0dApIr.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-Q52A8vjp.js → desktop-pet-CjaVVJDQ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CZr1CXxu.js → desktop-pet-settings-C7TFazyr.js} +1 -1
  31. package/dist/gateway/static/root/assets/device-pairing-wizard-B6S-RpNJ.js +1 -0
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-C6cUgrvg.js → directory-picker-path-field-BpymM_E_.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-DyyfC4gA.js → extension-debug-page-CABAv66K.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-Dho9o3ZZ.js → extension-page-B3dACpKA.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CdnIGyCH.js → extension-settings-page-B3bwBvgp.js} +1 -1
  36. package/dist/gateway/static/root/assets/gateway-settings-CzA1bTXZ.js +1 -0
  37. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BNpj_mIM.js → highlighted-body-KQOG7T2V-53FJXO9w.js} +1 -1
  38. package/dist/gateway/static/root/assets/home-page-KRPp-I4O.js +2 -0
  39. package/dist/gateway/static/root/assets/{image-generation-api-DwkO2y46.js → image-generation-api-DWRmAkoe.js} +1 -1
  40. package/dist/gateway/static/root/assets/{imports-page-BrYvomnU.js → imports-page-B0Y8iy6G.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-BvAvfZ5R.js +260 -0
  42. package/dist/gateway/static/root/assets/index-CMRCop32.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BveDYfYk.js → keyboard-shortcuts-settings-CjkACa5H.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-CcIi1BhT.js → local-app-workbench-page-DROP52YA.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-B1a69mlV.js → local-apps-page-BELUF7Pg.js} +1 -1
  46. package/dist/gateway/static/root/assets/logs-page-DBm3g8Mu.js +2 -0
  47. package/dist/gateway/static/root/assets/management-settings-CcsW4Z-r.js +1 -0
  48. package/dist/gateway/static/root/assets/{media-plugins-CR1fp6IL.js → media-plugins-UU3qSAhq.js} +1 -1
  49. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CG664NRI.js +1 -0
  50. package/dist/gateway/static/root/assets/note-detail-panel-BS9XnQ8a.js +5 -0
  51. package/dist/gateway/static/root/assets/notes-page-Cfy_WnU-.js +8 -0
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-Cn_WK68Y.js → page-context-capture-button-BD7T7uqR.js} +1 -1
  53. package/dist/gateway/static/root/assets/personal-page-DZEh3dXq.js +1 -0
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-3NbiWGRG.js → preview-open-alternatives--3aGeYJ5.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-KKE5-V8k.js → product-open-page-B0ZxsnFO.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-preview-content-BM0oqNxi.js → product-preview-content-CheSHKJq.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-Bm7bVHVo.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-DPA6QL_Z.js +1 -0
  59. package/dist/gateway/static/root/assets/remote-access-hub-Pxf4EiKh.js +1 -0
  60. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-W0X_Fy7b.js → runtime-tools-settings-panel-2BnqCeNt.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-DNM2Zdyr.js → schema-form-KmnpEBtP.js} +1 -1
  62. package/dist/gateway/static/root/assets/sessions-page-d0anT7iK.js +1 -0
  63. package/dist/gateway/static/root/assets/settings-advanced-gate-DfDaPyh5.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-form-section-DCSHPFAN.js → settings-form-section-Db5XOKMH.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-B18UbbaJ.js → settings-page-aRM6ax6B.js} +1 -1
  66. package/dist/gateway/static/root/assets/setup-status-panel-DCNAcalA.js +1 -0
  67. package/dist/gateway/static/root/assets/{share-preview-page-BLnS3hoH.js → share-preview-page-DR3Esqa_.js} +1 -1
  68. package/dist/gateway/static/root/assets/shares-settings-CvEwnQch.js +1 -0
  69. package/dist/gateway/static/root/assets/{skill-api-CcYGkRPL.js → skill-api-BJBU8YgD.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-reload-api-PnUZjoPK.js → skill-reload-api-DEQ1bdN9.js} +1 -1
  71. package/dist/gateway/static/root/assets/skills-page-BXNFSIIy.js +2 -0
  72. package/dist/gateway/static/root/assets/sliding-indicator-hwz0sx3h.js +1 -0
  73. package/dist/gateway/static/root/assets/{style-BQqU-1pP.js → style-Df_wL13k.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-C974myUM.js → system-settings-panel-DWnyafB7.js} +1 -1
  75. package/dist/gateway/static/root/assets/task-detail-page-DyHDW8A5.js +2 -0
  76. package/dist/gateway/static/root/assets/tracing-settings-page-vvREqbQ3.js +1 -0
  77. package/dist/gateway/static/root/assets/{tunnel-api-DWyI3uA3.js → tunnel-api-BEzsymVO.js} +1 -1
  78. package/dist/gateway/static/root/assets/usage-page-ByYOqsHo.js +1 -0
  79. package/dist/gateway/static/root/assets/{use-autosave-CY0YuljR.js → use-autosave-Cp4kZ3E-.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-model-page-D0qeCXwD.js +2 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-BNG4ixJE.js → voice-api-key-field-DH3OdR-w.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CohIoAre.js → work-discovery-overlay-CICdfBBR.js} +1 -1
  83. package/dist/gateway/static/root/assets/workflow-run-setup-panel-VIJQCUY5.js +3 -0
  84. package/dist/gateway/static/root/assets/workflows-page-DDYp2Jbo.js +6 -0
  85. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-C_COnY_B.js → xopc-cloud-account-card-BTMfgVTk.js} +1 -1
  86. package/dist/gateway/static/root/index.html +3 -2
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/agent-manager.js +10 -10
  89. package/dist/src/agent/background-review/run-background-review.js +5 -5
  90. package/dist/src/agent/coding/run-verification.js +4 -4
  91. package/dist/src/agent/context/execution-context.js +3 -3
  92. package/dist/src/agent/context/project-context.js +3 -3
  93. package/dist/src/agent/embedded/agent-profile-context.js +10 -4
  94. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  95. package/dist/src/agent/embedded/run-for-session.js +2 -2
  96. package/dist/src/agent/embedded/run-turn.js +1 -1
  97. package/dist/src/agent/external-tools/cliProvider.js +1 -1
  98. package/dist/src/agent/external-tools/composio-provider.js +1 -1
  99. package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
  100. package/dist/src/agent/prompt/response-language.js +1 -1
  101. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  102. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  103. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  104. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  105. package/dist/src/agent/service.js +9 -9
  106. package/dist/src/agent/session/session-config-service.js +2 -2
  107. package/dist/src/agent/session/session-inspector.js +1 -1
  108. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  109. package/dist/src/agent/skills/hub-pull.js +2 -2
  110. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  111. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  112. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  113. package/dist/src/agent/tools/exec-command.d.ts +2 -0
  114. package/dist/src/agent/tools/exec-command.js +45 -1
  115. package/dist/src/agent/tools/factory.js +4 -4
  116. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  117. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  118. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  119. package/dist/src/agent/tools/personal-task-tool.js +6 -6
  120. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  121. package/dist/src/agent/tools/review-workspace.js +1 -1
  122. package/dist/src/agent/tools/skills-tools.js +1 -1
  123. package/dist/src/agent/tools/task-collaboration-tool.js +3 -3
  124. package/dist/src/agent/tools/write.js +1 -1
  125. package/dist/src/agent/tools/xopc-use-tool.js +4 -4
  126. package/dist/src/agent-matching/delegation-service.js +1 -1
  127. package/dist/src/ai-assist/text-assist.js +1 -1
  128. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  129. package/dist/src/auth/sync-provider-auth.js +1 -1
  130. package/dist/src/automations/domain/index.js +1 -1
  131. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  132. package/dist/src/automations/index.js +2 -2
  133. package/dist/src/capabilities/store-connector.js +2 -2
  134. package/dist/src/channels/index.js +1 -1
  135. package/dist/src/channels/manager.js +1 -1
  136. package/dist/src/chat-commands/builtins/config.js +1 -1
  137. package/dist/src/chat-commands/context.js +1 -1
  138. package/dist/src/cli/commands/channels.js +1 -1
  139. package/dist/src/cli/commands/connectors.js +1 -1
  140. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  141. package/dist/src/cli/commands/models.js +1 -1
  142. package/dist/src/cli/commands/onboard/model.js +1 -1
  143. package/dist/src/cli/commands/onboard.js +1 -1
  144. package/dist/src/cli/commands/skills.js +1 -1
  145. package/dist/src/computer/flows.js +1 -1
  146. package/dist/src/config/agent-model-intents.js +1 -1
  147. package/dist/src/config/index.js +1 -1
  148. package/dist/src/config/loader.js +1 -1
  149. package/dist/src/config/models-json.d.ts +16 -16
  150. package/dist/src/config/models-json.js +1 -1
  151. package/dist/src/config/schema.js +6 -6
  152. package/dist/src/connectors/composio-sessions.js +1 -1
  153. package/dist/src/connectors/composio.js +1 -1
  154. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  155. package/dist/src/connectors/connected-source-understanding.js +2 -2
  156. package/dist/src/connectors/health.js +1 -1
  157. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  158. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  159. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  160. package/dist/src/extensions/api.js +1 -1
  161. package/dist/src/extensions/install.js +1 -1
  162. package/dist/src/extensions/sdk/index.js +1 -1
  163. package/dist/src/extensions/update.js +1 -1
  164. package/dist/src/gateway/file-path-classifier.js +1 -1
  165. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  166. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  167. package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
  168. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  169. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  170. package/dist/src/gateway/hono/routes/models.js +2 -2
  171. package/dist/src/gateway/hono/routes/projects.js +3 -3
  172. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  173. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  174. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  175. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  176. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  177. package/dist/src/gateway/hono/routes/user-model.js +6 -6
  178. package/dist/src/gateway/hono/routes/voice.js +1 -1
  179. package/dist/src/gateway/media-access.js +1 -1
  180. package/dist/src/gateway/service/agent-runner.js +3 -3
  181. package/dist/src/gateway/service/marketplace-service.js +2 -2
  182. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  183. package/dist/src/gateway/service/session-command-service.js +2 -2
  184. package/dist/src/gateway/service.js +31 -31
  185. package/dist/src/gateway/session-context-summary.js +4 -4
  186. package/dist/src/home-intelligence/generator.js +2 -2
  187. package/dist/src/home-intelligence/host.js +2 -2
  188. package/dist/src/imports/compatibility.js +1 -1
  189. package/dist/src/imports/inventory.js +3 -3
  190. package/dist/src/imports/productImport.js +2 -2
  191. package/dist/src/imports/runtime.js +1 -1
  192. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  193. package/dist/src/knowledge-memory/repository.js +1 -1
  194. package/dist/src/local-apps/service.js +2 -2
  195. package/dist/src/memory-learning/source-learning.js +2 -2
  196. package/dist/src/notes/index.js +1 -1
  197. package/dist/src/notes/service.js +3 -3
  198. package/dist/src/personal-agent/capability-service.js +2 -2
  199. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  200. package/dist/src/personal-agent/proactivity/service.js +5 -5
  201. package/dist/src/personal-agent/prompt-context.js +7 -7
  202. package/dist/src/personal-agent/reply-composer.js +7 -7
  203. package/dist/src/personal-agent/request-delivery.js +2 -2
  204. package/dist/src/personal-agent/request-service.js +6 -6
  205. package/dist/src/personal-agent/result-reader.js +1 -1
  206. package/dist/src/personal-agent/service.js +1 -1
  207. package/dist/src/personal-agent/task-cancel.js +1 -1
  208. package/dist/src/platform/index.js +1 -1
  209. package/dist/src/projects/index.js +1 -1
  210. package/dist/src/projects/project-agent-suggestion.js +1 -1
  211. package/dist/src/projects/project-service.js +1 -1
  212. package/dist/src/projects/project-skill-service.js +2 -2
  213. package/dist/src/projects/workspace.js +1 -1
  214. package/dist/src/providers/cloud-thinking.d.ts +3 -0
  215. package/dist/src/providers/cloud-thinking.js +13 -0
  216. package/dist/src/providers/model-registry.js +4 -1
  217. package/dist/src/providers/register-runtime-providers.js +3 -0
  218. package/dist/src/routing/agent-session-key.js +1 -1
  219. package/dist/src/session/index.js +1 -1
  220. package/dist/src/session/init-session-turn.js +1 -1
  221. package/dist/src/session/resolve-session.js +1 -1
  222. package/dist/src/session/store.js +2 -2
  223. package/dist/src/share/hosted-session-share.js +2 -2
  224. package/dist/src/share/session-share-service.js +1 -1
  225. package/dist/src/tasks/capabilities/read.js +2 -2
  226. package/dist/src/tasks/capabilities/write.js +1 -1
  227. package/dist/src/tasks/home-query-service.js +1 -1
  228. package/dist/src/tasks/index.js +3 -3
  229. package/dist/src/tasks/task-allocation-service.js +5 -5
  230. package/dist/src/tasks/task-application-service.js +6 -6
  231. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  232. package/dist/src/tasks/task-context-assembler.js +2 -2
  233. package/dist/src/tasks/task-contract-planner.js +1 -1
  234. package/dist/src/tasks/task-handoff-service.js +1 -1
  235. package/dist/src/tasks/task-handoff.js +5 -5
  236. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  237. package/dist/src/tasks/task-model-call.js +1 -1
  238. package/dist/src/tasks/task-research-result.js +4 -4
  239. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  240. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  241. package/dist/src/tasks/task-run-coordinator.js +4 -4
  242. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  243. package/dist/src/tui/backends/embedded-backend.js +5 -5
  244. package/dist/src/tui/tui-commands.js +2 -2
  245. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  246. package/dist/src/tui/tui-startup-resources.js +3 -3
  247. package/dist/src/tui/tui.js +1 -1
  248. package/dist/src/user-context/access-policy.js +2 -2
  249. package/dist/src/user-model/bootstrap.js +1 -1
  250. package/dist/src/user-model/capture/executor.js +1 -1
  251. package/dist/src/user-model/index.js +2 -2
  252. package/dist/src/voice/realtime/memory-context.js +5 -5
  253. package/dist/src/voice/realtime/runtime.js +1 -1
  254. package/dist/src/work-discovery/incremental-repository.js +1 -1
  255. package/dist/src/work-discovery/service.js +7 -7
  256. package/dist/src/workflows/context/workflow-context.js +1 -1
  257. package/dist/src/workflows/service/workflow-run-service.js +5 -5
  258. package/package.json +3 -3
  259. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +0 -1
  260. package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +0 -77
  261. package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +0 -1
  262. package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +0 -6
  263. package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +0 -3
  264. package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +0 -3
  265. package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +0 -2
  266. package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +0 -8
  267. package/dist/gateway/static/root/assets/channels-BXA55GY2.js +0 -1
  268. package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +0 -1
  269. package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +0 -1
  270. package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +0 -1
  271. package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +0 -2
  272. package/dist/gateway/static/root/assets/index-CKdOZoVu.js +0 -260
  273. package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +0 -1
  274. package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +0 -2
  275. package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +0 -1
  276. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +0 -1
  277. package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +0 -5
  278. package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +0 -8
  279. package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +0 -1
  280. package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +0 -1
  281. package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +0 -1
  282. package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +0 -1
  283. package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +0 -1
  284. package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +0 -1
  285. package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +0 -1
  286. package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +0 -1
  287. package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +0 -2
  288. package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +0 -2
  289. package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +0 -1
  290. package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +0 -1
  291. package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +0 -2
  292. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BXI8eyYh.js +0 -3
  293. package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +0 -6
@@ -1,2 +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{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./messages-CaeL_miw.js";import{t as c}from"./cn-0WouolD0.js";import{a as l,c as u,n as d,r as f}from"./locale-store-CE7L6MlS.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{u as y}from"./session-api-CaAUJvu1.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{a as x}from"./gateway-realtime-Dng_VOvI.js";import{$t as S,Cs as C,Fs as w,Hc as T,Ic as E,Ml as D,Ns as O,Od as k,Sd as A,Ss as j,Ts as M,Ya as N,Yd as P,_s as F,au as I,eu as L,gs as R,ls as z,qu as B,sf as ee,us as te,vs as V,ws as H,xd as U}from"./index-CKdOZoVu.js";import{r as W}from"./settings-page-layout-Dx5S-Msc.js";var G=e(t(),1),K=n();function q(e){let t=new URLSearchParams;if(!e)return``;e.level?.length&&t.set(`level`,e.level.join(`,`)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.q&&t.set(`q`,e.q),e.module&&t.set(`module`,e.module),e.requestId&&t.set(`requestId`,e.requestId),e.conversationId&&t.set(`conversationId`,e.conversationId),e.transcriptId&&t.set(`transcriptId`,e.transcriptId),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}async function J(e){return l(f(`/api/logs${q(e)}`))}async function Y(){return(await l(f(`/api/logs/files`))).files??[]}async function X(){return(await l(f(`/api/logs/modules`))).modules??[]}async function Z(){let e=await l(f(`/api/logs/stats`));return{byLevel:e.byLevel??{},runtime:e.runtime}}async function Q(){return(await l(f(`/api/logs/dir`))).dir??``}async function ne(){return(await l(f(`/api/logs/level`))).level??`info`}async function re(e,t){return l(f(`/api/logs/level`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({level:e,...t==null?{}:{duration:String(t)}})})}async function ie(e){let t=new URLSearchParams;e?.from&&t.set(`from`,e.from),e?.to&&t.set(`to`,e.to),e?.limit!=null&&t.set(`limit`,String(e.limit));let n=t.toString();return(await l(f(`/api/logs/errors/summary${n?`?${n}`:``}`))).items??[]}var ae=500,oe=class{_callbacks;_cleanup;constructor(e){this._callbacks=e}connect(e,t){this.disconnect();let n=new Set(e?.length?e:[`trace`,`debug`,`info`,`warn`,`error`,`fatal`]);this._cleanup=x(`logs`,{onEvent:e=>{if(e.event!==`log.entry`||!e.data||typeof e.data!=`object`)return;let r=e.data;!n.has(r.level)||t&&r.module!==t||this._callbacks.onEntry(r)},onGap:()=>this._callbacks.onError(`Live log replay gap; refresh the log query`)}),this._callbacks.onConnected()}disconnect(){this._cleanup?.(),this._cleanup=void 0}};function se(e,t){let n=`${t.timestamp}-${t.requestId??``}-${t.message}`;return[t,...e.filter(e=>`${e.timestamp}-${e.requestId??``}-${e.message}`!==n)].slice(0,ae)}var ce=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function le(e){let t=new Date(String(e.timestamp)).getTime();return Number.isFinite(t)?t:0}function ue(e){return e.toSorted((e,t)=>le(t)-le(e))}var de=new Set(ce),fe=[`error`,`fatal`],pe=[`warn`,`error`,`fatal`],me=[`info`,`warn`,`error`,`fatal`];function he(e){if(!e)return new Set;let t=new Set;for(let n of e.split(`,`)){let e=n.trim();de.has(e)&&t.add(e)}return t}function ge(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function _e(e,t){return e.size===t.length?t.every(t=>e.has(t)):!1}function ve(e){return e.size===0?`all`:_e(e,fe)?`errors`:_e(e,pe)?`warnPlus`:_e(e,me)?`infoPlus`:e.size===ce.length&&ce.every(t=>e.has(t))?`verbose`:`custom`}function ye(e){let t=ve(e);return t===`custom`?`other`:t}function be(e){switch(e){case`all`:return new Set;case`errors`:return new Set(fe);case`warnPlus`:return new Set(pe);case`infoPlus`:return new Set(me);case`verbose`:return new Set(ce)}}function xe(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Se(e){return String(e.module||e.service||e.extension||`—`)}function Ce(e){if(typeof e.message==`string`&&e.message)return e.message;try{return JSON.stringify(e)}catch{return``}}function we(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{return e}}function Te(e){try{return new Date(e).toLocaleString()}catch{return e}}function Ee(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function De(e){let t=e.trim();return t.length<=10?t:`${t.slice(0,8)}…`}function Oe(e){return String(e).toLowerCase()}function ke(e){let t=e.phase??e.meta?.phase;return typeof t==`string`&&t.trim()?t:`—`}function Ae(e){return`${e.timestamp}-${e.requestId??``}-${e.message}`}function je(e){let t=e.err??e.meta?.err;if(!t||typeof t!=`object`)return null;let n=t;return{name:typeof n.name==`string`?n.name:void 0,message:typeof n.message==`string`?n.message:void 0,stack:typeof n.stack==`string`?n.stack:void 0}}function Me(e,t){if(t.selectedLevels.size>0&&!t.selectedLevels.has(e.level)||t.moduleFilter&&Se(e)!==t.moduleFilter||t.requestIdFilter&&e.requestId!==t.requestIdFilter||t.transcriptIdFilter&&e.transcriptId!==t.transcriptIdFilter&&e.conversationId!==t.transcriptIdFilter)return!1;if(t.dateFrom){let n=new Date(t.dateFrom).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r<n)return!1}if(t.dateTo){let n=new Date(t.dateTo).getTime(),r=new Date(String(e.timestamp)).getTime();if(Number.isFinite(n)&&Number.isFinite(r)&&r>n)return!1}if(t.debouncedSearch){let n=t.debouncedSearch.toLowerCase();if(![e.message,Se(e),ke(e),e.requestId,e.conversationId,e.transcriptId,je(e)?.message,je(e)?.stack].filter(Boolean).map(String).join(` `).toLowerCase().includes(n))return!1}return!0}function Ne(e,t){let n=[];for(let r of ce){let i=e[r]??0;i>0&&n.push(`${t[r]} ${i}`)}return n.join(` · `)}function Pe(e,t){switch(t.type){case`setSearchInput`:return e.searchInput===t.value?e:{...e,searchInput:t.value};case`setDebouncedSearch`:return e.debouncedSearch===t.value?e:{...e,debouncedSearch:t.value};case`setLevels`:return ge(e.selectedLevels,t.value)?e:{...e,selectedLevels:t.value};case`toggleLevel`:{let n=new Set(e.selectedLevels);return n.has(t.level)?n.delete(t.level):n.add(t.level),{...e,selectedLevels:n}}case`setModule`:return e.moduleFilter===t.value?e:{...e,moduleFilter:t.value};case`setRequestIdFilter`:return e.requestIdFilter===t.value?e:{...e,requestIdFilter:t.value};case`setTranscriptIdFilter`:return e.transcriptIdFilter===t.value?e:{...e,transcriptIdFilter:t.value};case`setDateFrom`:return e.dateFrom===t.value?e:{...e,dateFrom:t.value};case`setDateTo`:return e.dateTo===t.value?e:{...e,dateTo:t.value};case`setAutoRefresh`:return e.autoRefresh===t.value?e:{...e,autoRefresh:t.value};case`syncFromUrl`:{let n=t.payload;return e.searchInput===n.searchInput&&e.debouncedSearch===n.debouncedSearch&&ge(e.selectedLevels,n.selectedLevels)&&e.moduleFilter===n.moduleFilter&&e.requestIdFilter===n.requestIdFilter&&e.transcriptIdFilter===n.transcriptIdFilter&&e.dateFrom===n.dateFrom&&e.dateTo===n.dateTo&&e.autoRefresh===n.autoRefresh?e:{...e,...n}}case`clearAll`:return{searchInput:``,debouncedSearch:``,selectedLevels:new Set,moduleFilter:``,requestIdFilter:``,transcriptIdFilter:``,dateFrom:``,dateTo:``,autoRefresh:e.autoRefresh}}}var Fe={logs:[],loading:!1,error:null,hasMore:!1,modules:[],files:[],stats:null,logDir:null};function Ie(e,t){switch(t.type){case`queryStart`:return{...e,loading:!0,error:null,logs:[]};case`querySuccess`:return{...e,loading:!1,logs:ue(t.logs),hasMore:t.hasMore};case`queryError`:return t.resetLogs?{...e,loading:!1,error:t.message,logs:[],hasMore:!1}:{...e,loading:!1,error:t.message};case`appendSuccess`:return{...e,loading:!1,logs:ue([...e.logs,...t.logs]),hasMore:t.hasMore};case`metaSuccess`:return{...e,modules:t.modules,stats:t.stats,files:t.files};case`filesSuccess`:return{...e,files:t.files,logDir:t.logDir};case`filesClear`:return{...e,files:[]};case`liveTick`:return{...e,logs:ue(t.logs),hasMore:t.hasMore,stats:t.stats};case`appendLiveEntry`:return{...e,logs:ue(se(e.logs,t.entry))};case`updateStats`:return{...e,stats:t.stats};case`refreshAllSuccess`:return{...e,loading:!1,logs:ue(t.logs),hasMore:t.hasMore,stats:t.stats,files:t.files}}}function Le(e){let t=s(e).logs,n=u(e=>e.conversationId),r=!!n,[a,o]=i(),c=(0,G.useRef)(a),[l,d]=(0,G.useReducer)(Pe,void 0,()=>{let e=c.current,t=e.get(`q`)??``;return{searchInput:t,debouncedSearch:t.trim(),selectedLevels:he(e.get(`level`)),moduleFilter:e.get(`module`)??``,requestIdFilter:e.get(`requestId`)??``,transcriptIdFilter:e.get(`transcriptId`)??``,dateFrom:e.get(`from`)??``,dateTo:e.get(`to`)??``,autoRefresh:e.get(`live`)===`1`}}),[f,p]=(0,G.useReducer)(Ie,Fe),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)([]),[T,E]=(0,G.useState)(!1),{searchInput:D,debouncedSearch:O,selectedLevels:k,moduleFilter:A,requestIdFilter:j,transcriptIdFilter:M,dateFrom:N,dateTo:P,autoRefresh:F}=l,{logs:I,loading:L,error:R,hasMore:z,modules:B,files:ee,stats:te,logDir:V}=f,H=(0,G.useCallback)(e=>d({type:`setSearchInput`,value:e}),[]),U=(0,G.useCallback)(e=>d({type:`setLevels`,value:e}),[]),W=(0,G.useCallback)(e=>d({type:`setModule`,value:e}),[]),K=(0,G.useCallback)(e=>d({type:`setRequestIdFilter`,value:e}),[]),q=(0,G.useCallback)(e=>d({type:`setTranscriptIdFilter`,value:e}),[]),ne=(0,G.useCallback)(e=>d({type:`setDateFrom`,value:e}),[]),re=(0,G.useCallback)(e=>d({type:`setDateTo`,value:e}),[]),ae=(0,G.useCallback)(e=>d({type:`setAutoRefresh`,value:e}),[]),se=(0,G.useMemo)(()=>ye(k),[k]),ce=e=>{if(e===`other`){b(!0);return}d({type:`setLevels`,value:be(e)})},le=O.length>0||k.size>0||!!A||!!j||!!M||!!N||!!P,ue=+(O.length>0)+ +(k.size>0)+ +!!A+ +!!j+ +!!M+(N||P?1:0);(0,G.useEffect)(()=>{let e=setTimeout(()=>d({type:`setDebouncedSearch`,value:D.trim()}),300);return()=>clearTimeout(e)},[D]),(0,G.useEffect)(()=>{let e=a.get(`q`)??``;d({type:`syncFromUrl`,payload:{searchInput:e,debouncedSearch:e.trim(),selectedLevels:he(a.get(`level`)),moduleFilter:a.get(`module`)??``,requestIdFilter:a.get(`requestId`)??``,transcriptIdFilter:a.get(`transcriptId`)??``,dateFrom:a.get(`from`)??``,dateTo:a.get(`to`)??``,autoRefresh:a.get(`live`)===`1`}})},[a]),(0,G.useEffect)(()=>{let e=new URLSearchParams(a),t=O.trim();t?e.set(`q`,t):e.delete(`q`),k.size>0?e.set(`level`,Array.from(k).sort().join(`,`)):e.delete(`level`),A?e.set(`module`,A):e.delete(`module`),j?e.set(`requestId`,j):e.delete(`requestId`),M?e.set(`transcriptId`,M):e.delete(`transcriptId`),N?e.set(`from`,N):e.delete(`from`),P?e.set(`to`,P):e.delete(`to`),F?e.set(`live`,`1`):e.delete(`live`),e.toString()!==a.toString()&&o(e,{replace:!0})},[F,N,P,O,A,j,M,a,k,o]);let de=(0,G.useMemo)(()=>({q:O||void 0,level:k.size>0?Array.from(k):void 0,module:A||void 0,requestId:j||void 0,transcriptId:M||void 0,from:N||void 0,to:P||void 0,limit:50}),[O,k,A,j,M,N,P]),fe=(0,G.useMemo)(()=>({debouncedSearch:O,selectedLevels:k,moduleFilter:A,requestIdFilter:j,transcriptIdFilter:M,dateFrom:N,dateTo:P}),[O,k,A,j,M,N,P]),pe=(0,G.useRef)(fe);return pe.current=fe,(0,G.useEffect)(()=>{if(!r)return;let e=!1;return E(!0),ie({from:N||void 0,to:P||void 0,limit:12}).then(t=>{e||w(t)}).catch(()=>{e||w([])}).finally(()=>{e||E(!1)}),()=>{e=!0}},[r,N,P]),(0,G.useEffect)(()=>{if(!r)return;let e=!1;return p({type:`queryStart`}),(async()=>{try{let t=await J({...de,offset:0});if(e)return;p({type:`querySuccess`,logs:t.logs,hasMore:t.logs.length===50})}catch(n){e||p({type:`queryError`,message:n instanceof Error?n.message:t.loadError,resetLogs:!0})}})(),()=>{e=!0}},[r,de,t.loadError]),(0,G.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let[t,n,r]=await Promise.all([X(),Z(),Y()]);e||p({type:`metaSuccess`,modules:t,stats:n,files:r})}catch{}})(),()=>{e=!0}},[r]),(0,G.useEffect)(()=>{if(!r||!g)return;let e=!1;return(async()=>{try{let[t,n]=await Promise.all([Y(),Q()]);e||p({type:`filesSuccess`,files:t,logDir:n})}catch{e||p({type:`filesClear`})}})(),()=>{e=!0}},[r,g]),(0,G.useEffect)(()=>{if(!F||!r)return;let e=new oe({onConnected:()=>{},onEntry:e=>{Me(e,pe.current)&&p({type:`appendLiveEntry`,entry:e})},onError:()=>{}});e.connect(k.size>0?Array.from(k):void 0,A||void 0);let t=window.setInterval(()=>{Z().then(e=>{p({type:`updateStats`,stats:e})}).catch(()=>{})},3e4);return()=>{e.disconnect(),clearInterval(t)}},[F,r,n,k,A]),(0,G.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),2e3);return()=>clearTimeout(e)},[x]),{L:t,hasToken:r,logs:I,loading:L,error:R,hasMore:z,searchInput:D,setSearchInput:H,selectedLevels:k,setSelectedLevels:U,moduleFilter:A,setModuleFilter:W,requestIdFilter:j,transcriptIdFilter:M,dateFrom:N,setDateFrom:ne,dateTo:P,setDateTo:re,modules:B,files:ee,stats:te,selectedLog:m,setSelectedLog:h,filesOpen:g,setFilesOpen:_,filtersOpen:v,setFiltersOpen:b,logDir:V,autoRefresh:F,setAutoRefresh:ae,copiedDetail:x,setCopiedDetail:S,hasActiveFilters:le,activeFilterCount:ue,clearFilters:()=>d({type:`clearAll`}),toggleDialogLevel:e=>d({type:`toggleLevel`,level:e}),handleLoadMore:()=>{L||!z||(async()=>{p({type:`queryStart`});try{let e=await J({...de,offset:I.length});p({type:`appendSuccess`,logs:e.logs,hasMore:e.logs.length===50})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},refreshAll:()=>{(async()=>{p({type:`queryStart`});try{let e=await J({...de,offset:0}),[t,n]=await Promise.all([Z(),Y()]);p({type:`refreshAllSuccess`,logs:e.logs,hasMore:e.logs.length===50,stats:t,files:n})}catch(e){p({type:`queryError`,message:e instanceof Error?e.message:t.loadError})}})()},levelSegment:se,handleLevelSegment:ce,filterByRequestId:(0,G.useCallback)(e=>{h(null),K(e)},[K]),filterByTranscriptId:(0,G.useCallback)(e=>{h(null),q(e)},[q]),filterByErrorSummary:(0,G.useCallback)(e=>{d({type:`setSearchInput`,value:e.errName}),d({type:`setDebouncedSearch`,value:e.errName}),e.module&&d({type:`setModule`,value:e.module}),d({type:`setLevels`,value:be(`errors`)})},[]),openChatForSession:(0,G.useCallback)(e=>{let t=e.conversationId?.trim();if(t){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:t}}));return}let n=e.transcriptId?.trim();n&&y({transcriptId:n}).then(e=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e.conversationId}}))}).catch(()=>{})},[]),errorSummary:C,errorSummaryLoading:T}}var $=r();function Re(e){let t=(0,K.c)(36),{L:n,items:r,loading:i,onSelectItem:a}=e,[o,s]=(0,G.useState)(!1);if(!i&&r.length===0)return null;let l;t[0]===r?l=t[1]:(l=r.reduce(Be,0),t[0]=r,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>s(ze),t[2]=d):d=t[2];let f;t[3]===n.errorSummaryTitle?f=t[4]:(f=(0,$.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-fg`,children:n.errorSummaryTitle}),t[3]=n.errorSummaryTitle,t[4]=f);let p;t[5]===n.errorSummaryHint?p=t[6]:(p=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:n.errorSummaryHint}),t[5]=n.errorSummaryHint,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==r.length||t[11]!==i||t[12]!==u?(h=i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{className:`h-5 w-8 rounded-md`}),(0,$.jsx)(E,{className:`h-5 w-10 rounded-md`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:r.length}),(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-hover px-2 py-0.5 text-xs tabular-nums text-fg-muted`,children:[`×`,u]})]}),t[10]=r.length,t[11]=i,t[12]=u,t[13]=h):h=t[13];let g=o&&`rotate-180`,_;t[14]===g?_=t[15]:(_=c(`size-4 text-fg-muted transition-transform duration-150 ease-out motion-reduce:transition-none`,g),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,$.jsx)(ee,{className:_,strokeWidth:1.75,"aria-hidden":!0}),t[16]=_,t[17]=v);let y;t[18]!==h||t[19]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-0.5`,children:[h,v]}),t[18]=h,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==y||t[23]!==m?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:d,"aria-expanded":o,className:`flex w-full items-start justify-between gap-3 px-4 py-4 text-left transition-colors hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset sm:px-5`,children:[m,y]}),t[21]=o,t[22]=y,t[23]=m,t[24]=b):b=t[24];let x;t[25]!==n.module||t[26]!==n.phase||t[27]!==n.time||t[28]!==o||t[29]!==r||t[30]!==i||t[31]!==a?(x=o&&!i&&r.length>0?(0,$.jsx)(`ul`,{className:`mx-1 mb-1 flex flex-col gap-1 rounded-lg bg-surface-base/45 p-1 [&>li]:rounded-lg`,children:r.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a?.(e),className:c(`flex w-full flex-col gap-1 px-4 py-2.5 text-left transition-colors hover:bg-surface-hover`,a&&`cursor-pointer`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.errName}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-md bg-red-500/10 px-2 py-0.5 text-xs tabular-nums text-red-600 dark:text-red-400`,children:[`×`,e.count]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[e.phase?(0,$.jsxs)(`span`,{children:[n.phase,`: `,e.phase]}):null,e.module?(0,$.jsxs)(`span`,{children:[n.module,`: `,e.module]}):null,(0,$.jsxs)(`span`,{children:[n.time,`: `,we(e.lastSeen)]})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.sampleMessage})]})},e.key))}):null,t[25]=n.module,t[26]=n.phase,t[27]=n.time,t[28]=o,t[29]=r,t[30]=i,t[31]=a,t[32]=x):x=t[32];let S;return t[33]!==b||t[34]!==x?(S=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,children:[b,x]}),t[33]=b,t[34]=x,t[35]=S):S=t[35],S}function ze(e){return!e}function Be(e,t){return e+t.count}function Ve(e){let t=(0,K.c)(75),{log:n,labels:r,onFilterByRequestId:i,onFilterByTranscriptId:a,onOpenChat:o}=e,s=n.level??`info`,l=typeof n.requestId==`string`?n.requestId:``,u=typeof n.conversationId==`string`?n.conversationId:``,d=typeof n.transcriptId==`string`?n.transcriptId:``,f;t[0]===n?f=t[1]:(f=ke(n),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=je(n),t[2]=n,t[3]=m);let h=m,g=s===`error`||s===`fatal`,_;t[4]===r.message?_=t[5]:(_=(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.message}),t[4]=r.message,t[5]=_);let v=g&&`border-red-500/40`,y;t[6]===v?y=t[7]:(y=c(`mt-2 whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,v),t[6]=v,t[7]=y);let b=n.message||`—`,x;t[8]!==y||t[9]!==b?(x=(0,$.jsx)(`pre`,{className:y,children:b}),t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]!==_||t[12]!==x?(S=(0,$.jsxs)(`div`,{children:[_,x]}),t[11]=_,t[12]=x,t[13]=S):S=t[13];let C;t[14]!==h||t[15]!==r.stackTrace?(C=h?.stack?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.stackTrace}),h.name?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-400`,children:h.name}):null,(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-red-500/30 bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-red-500/30`,children:h.stack})]}):null,t[14]=h,t[15]=r.stackTrace,t[16]=C):C=t[16];let w;t[17]===r.time?w=t[18]:(w=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.time}),t[17]=r.time,t[18]=w);let E;t[19]===n.timestamp?E=t[20]:(E=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:n.timestamp}),t[19]=n.timestamp,t[20]=E);let D;t[21]===r.level?D=t[22]:(D=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.level}),t[21]=r.level,t[22]=D);let O=g&&`font-medium text-red-600 dark:text-red-400`,k;t[23]===O?k=t[24]:(k=c(`text-fg`,O),t[23]=O,t[24]=k);let A;t[25]===s?A=t[26]:(A=Oe(s),t[25]=s,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,$.jsx)(`span`,{className:k,children:A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]===r.module?M=t[31]:(M=(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.module}),t[30]=r.module,t[31]=M);let N;t[32]===n?N=t[33]:(N=Se(n),t[32]=n,t[33]=N);let P;t[34]===N?P=t[35]:(P=(0,$.jsx)(`code`,{className:`break-all text-fg`,children:N}),t[34]=N,t[35]=P);let F;t[36]!==r.phase||t[37]!==p?(F=p===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.phase}),(0,$.jsx)(`code`,{className:`break-all text-fg`,children:p})]}),t[36]=r.phase,t[37]=p,t[38]=F):F=t[38];let I;t[39]!==r.filterByRequestId||t[40]!==r.requestId||t[41]!==i||t[42]!==l?(I=l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.requestId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:l}),i?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>i(l),children:r.filterByRequestId}):null]})]}):null,t[39]=r.filterByRequestId,t[40]=r.requestId,t[41]=i,t[42]=l,t[43]=I):I=t[43];let L;t[44]!==r.conversationId||t[45]!==r.openChat||t[46]!==o||t[47]!==u?(L=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.conversationId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:u}),o?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({conversationId:u}),children:r.openChat}):null]})]}):null,t[44]=r.conversationId,t[45]=r.openChat,t[46]=o,t[47]=u,t[48]=L):L=t[48];let R;t[49]!==r.filterByTranscriptId||t[50]!==r.openChat||t[51]!==r.transcriptId||t[52]!==a||t[53]!==o||t[54]!==d?(R=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`font-sans text-fg-muted`,children:r.transcriptId}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`break-all text-fg`,children:d}),a?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>a(d),children:r.filterByTranscriptId}):null,o?(0,$.jsx)(T,{type:`button`,variant:`secondary`,className:`h-7 px-2 text-[11px]`,onClick:()=>o({transcriptId:d}),children:r.openChat}):null]})]}):null,t[49]=r.filterByTranscriptId,t[50]=r.openChat,t[51]=r.transcriptId,t[52]=a,t[53]=o,t[54]=d,t[55]=R):R=t[55];let z;t[56]!==w||t[57]!==E||t[58]!==D||t[59]!==j||t[60]!==M||t[61]!==P||t[62]!==F||t[63]!==I||t[64]!==L||t[65]!==R?(z=(0,$.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_1fr] gap-x-3 gap-y-2 text-xs`,children:[w,E,D,j,M,P,F,I,L,R]}),t[56]=w,t[57]=E,t[58]=D,t[59]=j,t[60]=M,t[61]=P,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==r.metadata||t[68]!==n.meta?(B=n.meta&&Object.keys(n.meta).length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-sans font-medium text-fg-muted`,children:r.metadata}),(0,$.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap break-words border border-edge bg-surface-base p-3 text-xs leading-relaxed text-fg dark:border-edge`,children:JSON.stringify(n.meta,null,2)})]}):null,t[67]=r.metadata,t[68]=n.meta,t[69]=B):B=t[69];let ee;return t[70]!==z||t[71]!==B||t[72]!==S||t[73]!==C?(ee=(0,$.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[S,C,z,B]}),t[70]=z,t[71]=B,t[72]=S,t[73]=C,t[74]=ee):ee=t[74],ee}function He(e){let t=(0,K.c)(50),{L:n,log:r,onClose:i,copiedDetail:a,onCopiedMessage:s,onCopiedJson:l,onFilterByRequestId:u,onFilterByTranscriptId:d,onOpenChat:f}=e,y=r!==null,x;t[0]===i?x=t[1]:(x=e=>!e&&i(),t[0]=i,t[1]=x);let S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(p,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,F)}),t[2]=S):S=t[2];let C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=c(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,R,`dark:border-edge`),t[3]=C):C=t[3];let w;t[4]===n.details?w=t[5]:(w=(0,$.jsx)(_,{className:`text-base font-semibold tracking-tight text-fg`,children:n.details}),t[4]=n.details,t[5]=w);let E;t[6]!==n.copied||t[7]!==n.copyJson||t[8]!==n.copyMessage||t[9]!==a||t[10]!==r||t[11]!==l||t[12]!==s?(E=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(typeof r.message==`string`?r.message:``).then(e=>{e&&s()})},children:[(0,$.jsx)(P,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`message`?n.copied:n.copyMessage})]}),(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1 px-2 text-xs`,onClick:()=>{b(JSON.stringify(r,null,2)).then(e=>{e&&l()})},children:[(0,$.jsx)(P,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:a===`json`?n.copied:n.copyJson})]})]}):null,t[6]=n.copied,t[7]=n.copyJson,t[8]=n.copyMessage,t[9]=a,t[10]=r,t[11]=l,t[12]=s,t[13]=E):E=t[13];let D;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(o,{className:`size-5`,strokeWidth:1.75}),t[14]=D):D=t[14];let O;t[15]===n.close?O=t[16]:(O=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:D})}),t[15]=n.close,t[16]=O);let k;t[17]!==E||t[18]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[E,O]}),t[17]=E,t[18]=O,t[19]=k):k=t[19];let A;t[20]!==w||t[21]!==k?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[w,k]}),t[20]=w,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==n.conversationId||t[24]!==n.filterByRequestId||t[25]!==n.filterByTranscriptId||t[26]!==n.level||t[27]!==n.message||t[28]!==n.metadata||t[29]!==n.module||t[30]!==n.openChat||t[31]!==n.phase||t[32]!==n.requestId||t[33]!==n.stackTrace||t[34]!==n.time||t[35]!==n.transcriptId||t[36]!==r||t[37]!==u||t[38]!==d||t[39]!==f?(j=r?(0,$.jsx)(Ve,{log:r,labels:{time:n.time,level:n.level,module:n.module,message:n.message,metadata:n.metadata,requestId:n.requestId,conversationId:n.conversationId,transcriptId:n.transcriptId,phase:n.phase,stackTrace:n.stackTrace,filterByRequestId:n.filterByRequestId,filterByTranscriptId:n.filterByTranscriptId,openChat:n.openChat},onFilterByRequestId:u,onFilterByTranscriptId:d,onOpenChat:f}):null,t[23]=n.conversationId,t[24]=n.filterByRequestId,t[25]=n.filterByTranscriptId,t[26]=n.level,t[27]=n.message,t[28]=n.metadata,t[29]=n.module,t[30]=n.openChat,t[31]=n.phase,t[32]=n.requestId,t[33]=n.stackTrace,t[34]=n.time,t[35]=n.transcriptId,t[36]=r,t[37]=u,t[38]=d,t[39]=f,t[40]=j):j=t[40];let M;t[41]===j?M=t[42]:(M=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 font-mono text-sm leading-relaxed`,children:j}),t[41]=j,t[42]=M);let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(h,{children:[S,(0,$.jsxs)(g,{className:C,"aria-describedby":void 0,children:[A,M]})]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let I;return t[46]!==y||t[47]!==N||t[48]!==x?(I=(0,$.jsx)(v,{open:y,onOpenChange:x,children:N}),t[46]=y,t[47]=N,t[48]=x,t[49]=I):I=t[49],I}function Ue(e){let t=(0,K.c)(25),{L:n,open:r,onOpenChange:i,files:a,logDir:s}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(p,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,F)}),t[0]=l):l=t[0];let u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,85vh)] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,R,`dark:border-edge`),t[1]=u):u=t[1];let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(A,{className:`size-4 text-fg-muted`,strokeWidth:1.75}),t[2]=d):d=t[2];let f;t[3]===n.logFiles?f=t[4]:(f=(0,$.jsxs)(_,{className:`flex items-center gap-2 text-base font-semibold tracking-tight text-fg`,children:[d,n.logFiles]}),t[3]=n.logFiles,t[4]=f);let y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(o,{className:`size-5`,strokeWidth:1.75}),t[5]=y):y=t[5];let b;t[6]===n.close?b=t[7]:(b=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:y})}),t[6]=n.close,t[7]=b);let x;t[8]!==f||t[9]!==b?(x=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[f,b]}),t[8]=f,t[9]=b,t[10]=x):x=t[10];let S;t[11]!==n.filesEmpty||t[12]!==a?(S=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:a.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.filesEmpty}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map(We)})}),t[11]=n.filesEmpty,t[12]=a,t[13]=S):S=t[13];let C;t[14]!==n.logDir||t[15]!==s?(C=s?(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2 text-xs text-fg-subtle dark:border-edge`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[n.logDir,`: `]}),(0,$.jsx)(`code`,{className:`break-all text-fg-subtle`,children:s})]}):null,t[14]=n.logDir,t[15]=s,t[16]=C):C=t[16];let w;t[17]!==x||t[18]!==S||t[19]!==C?(w=(0,$.jsxs)(h,{children:[l,(0,$.jsxs)(g,{className:u,children:[x,S,C]})]}),t[17]=x,t[18]=S,t[19]=C,t[20]=w):w=t[20];let E;return t[21]!==i||t[22]!==r||t[23]!==w?(E=(0,$.jsx)(v,{open:r,onOpenChange:i,children:w}),t[21]=i,t[22]=r,t[23]=w,t[24]=E):E=t[24],E}function We(e){return(0,$.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-xs text-fg`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:Ee(e.size)}),(0,$.jsx)(`span`,{children:Te(e.modified)})]})]},e.name)}function Ge(e){let t=(0,K.c)(68),{L:n,open:r,onOpenChange:i,dateFrom:a,onDateFromChange:s,dateTo:l,onDateToChange:u,selectedLevels:d,onToggleLevel:f}=e,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(p,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,F)}),t[0]=y):y=t[0];let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex max-h-[min(32rem,90vh)] w-[min(100%-2rem,22rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,R,`dark:border-edge`),t[1]=b):b=t[1];let x;t[2]===n.filtersDialogTitle?x=t[3]:(x=(0,$.jsx)(_,{className:`text-base font-semibold tracking-tight text-fg`,children:n.filtersDialogTitle}),t[2]=n.filtersDialogTitle,t[3]=x);let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(o,{className:`size-5`,strokeWidth:1.75}),t[4]=S):S=t[4];let C;t[5]===n.close?C=t[6]:(C=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":n.close,children:S})}),t[5]=n.close,t[6]=C);let w;t[7]!==x||t[8]!==C?(w=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[x,C]}),t[7]=x,t[8]=C,t[9]=w):w=t[9];let E;t[10]===n.filtersDialogDesc?E=t[11]:(E=(0,$.jsx)(`div`,{id:`log-filters-desc`,className:`sr-only`,children:n.filtersDialogDesc}),t[10]=n.filtersDialogDesc,t[11]=E);let D;t[12]===n.timeRange?D=t[13]:(D=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.timeRange}),t[12]=n.timeRange,t[13]=D);let O;t[14]===n.from?O=t[15]:(O=(0,$.jsx)(`label`,{htmlFor:`log-from-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.from}),t[14]=n.from,t[15]=O);let k;t[16]===s?k=t[17]:(k=e=>s(e.target.value),t[16]=s,t[17]=k);let A;t[18]!==a||t[19]!==k?(A=(0,$.jsx)(`input`,{id:`log-from-d`,type:`datetime-local`,value:a,onChange:k,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[18]=a,t[19]=k,t[20]=A):A=t[20];let j;t[21]!==A||t[22]!==O?(j=(0,$.jsxs)(`div`,{children:[O,A]}),t[21]=A,t[22]=O,t[23]=j):j=t[23];let M;t[24]===n.to?M=t[25]:(M=(0,$.jsx)(`label`,{htmlFor:`log-to-d`,className:`mb-1 block text-xs text-fg-muted`,children:n.to}),t[24]=n.to,t[25]=M);let N;t[26]===u?N=t[27]:(N=e=>u(e.target.value),t[26]=u,t[27]=N);let P;t[28]!==l||t[29]!==N?(P=(0,$.jsx)(`input`,{id:`log-to-d`,type:`datetime-local`,value:l,onChange:N,className:`w-full rounded-xl border border-edge bg-surface-base p-2 text-sm text-fg dark:border-edge`}),t[28]=l,t[29]=N,t[30]=P):P=t[30];let I;t[31]!==M||t[32]!==P?(I=(0,$.jsxs)(`div`,{children:[M,P]}),t[31]=M,t[32]=P,t[33]=I):I=t[33];let L;t[34]!==j||t[35]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3`,children:[j,I]}),t[34]=j,t[35]=I,t[36]=L):L=t[36];let z;t[37]===n.levelCustom?z=t[38]:(z=(0,$.jsx)(`p`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:n.levelCustom}),t[37]=n.levelCustom,t[38]=z);let B;t[39]===n.levelCustomHint?B=t[40]:(B=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:n.levelCustomHint}),t[39]=n.levelCustomHint,t[40]=B);let ee=n.level,te;t[41]!==n.levelNames||t[42]!==f||t[43]!==d?(te=ce.map(e=>(0,$.jsx)(`button`,{type:`button`,className:c(`rounded-full border px-3 py-1.5 text-xs font-medium capitalize transition-[color,background-color,border-color] 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-panel`,d.has(e)?`border-edge bg-surface-active text-fg dark:border-edge`:`border-edge-subtle bg-surface-base text-fg-muted hover:bg-surface-hover dark:border-edge`),onClick:()=>f(e),children:n.levelNames[e]},e)),t[41]=n.levelNames,t[42]=f,t[43]=d,t[44]=te):te=t[44];let V;t[45]!==n.level||t[46]!==te?(V=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,role:`group`,"aria-label":ee,children:te}),t[45]=n.level,t[46]=te,t[47]=V):V=t[47];let H;t[48]!==L||t[49]!==z||t[50]!==B||t[51]!==V||t[52]!==D?(H=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:[D,L,z,B,V]}),t[48]=L,t[49]=z,t[50]=B,t[51]=V,t[52]=D,t[53]=H):H=t[53];let U;t[54]===i?U=t[55]:(U=()=>i(!1),t[54]=i,t[55]=U);let W;t[56]!==n.filtersDone||t[57]!==U?(W=(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle px-4 py-3 dark:border-edge`,children:(0,$.jsx)(T,{type:`button`,className:`w-full rounded-xl`,onClick:U,children:n.filtersDone})}),t[56]=n.filtersDone,t[57]=U,t[58]=W):W=t[58];let G;t[59]!==H||t[60]!==W||t[61]!==w||t[62]!==E?(G=(0,$.jsxs)(h,{children:[y,(0,$.jsxs)(g,{className:b,"aria-describedby":`log-filters-desc`,children:[w,E,H,W]})]}),t[59]=H,t[60]=W,t[61]=w,t[62]=E,t[63]=G):G=t[63];let q;return t[64]!==i||t[65]!==r||t[66]!==G?(q=(0,$.jsx)(v,{open:r,onOpenChange:i,children:G}),t[64]=i,t[65]=r,t[66]=G,t[67]=q):q=t[67],q}var Ke=1;function qe(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===t?{x:n,y:r}:null}var Je=`pointer-events-none absolute left-0 top-0 z-[1] rounded-pill bg-surface-panel shadow-sm will-change-transform [backface-visibility:hidden] dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,Ye=`touch-target relative z-[2] box-border flex h-6 flex-1 cursor-pointer items-center justify-center gap-1 rounded-pill border-0 bg-transparent px-2 py-0 text-center text-xs font-medium leading-none outline-none transition-[color,background-color,box-shadow] 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-panel active:scale-100 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`;function Xe({value:e,onChange:t,options:n,"aria-label":r,className:i,buttonClassName:a}){let o=(0,G.useRef)(null),s=(0,G.useRef)([]),[l,u]=(0,G.useState)({x:0,y:0,w:0,h:0}),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),h=(0,G.useCallback)(()=>{let t=o.current;if(!t)return;let r=n.findIndex(t=>t.value===e);if(r<0)return;let i=s.current[r];if(!i)return;let a=Ke,c=t.getBoundingClientRect(),l=i.getBoundingClientRect(),d=qe(i,t),p,m;if(d)p=d.x,m=d.y;else{let e=getComputedStyle(t),n=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderTopWidth)||0;p=l.left-c.left-n,m=l.top-c.top-r}u({x:p+a,y:m+a,w:Math.max(0,l.width-a*2),h:Math.max(0,l.height-a*2)}),f(!0)},[n,e]),g=(0,G.useRef)(h);return g.current=h,(0,G.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>h());return()=>cancelAnimationFrame(e)},[h]),(0,G.useEffect)(()=>{let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>m(!0))});return()=>cancelAnimationFrame(e)},[]),(0,G.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{requestAnimationFrame(()=>g.current())},n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]),(0,$.jsxs)(`div`,{ref:o,className:c(S,`relative isolate flex w-full max-w-full flex-row items-center`,i),role:`group`,"aria-label":r,children:[(0,$.jsx)(`div`,{"aria-hidden":!0,className:c(Je,`motion-reduce:!transition-none motion-reduce:!duration-0`,p&&`transition-[transform,width,height] duration-300 [transition-timing-function:cubic-bezier(0.32,0.72,0,1)]`),style:{width:l.w,height:l.h,transform:`translate3d(${l.x}px, ${l.y}px, 0)`,opacity:d&&l.w>0?1:0}}),n.map((n,r)=>{let i=n.icon,o=e===n.value;return(0,$.jsxs)(`button`,{ref:e=>{s.current[r]=e},type:`button`,"aria-pressed":o,title:n.title??n.label,onClick:()=>t(n.value),className:c(Ye,o?`text-fg`:`text-fg-subtle`,a),children:[i?(0,$.jsx)(i,{className:`block size-3 shrink-0 opacity-80`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,$.jsx)(`span`,{className:`min-w-0 shrink truncate leading-none`,children:n.label})]},n.value)})]})}function Ze(e){let t=(0,K.c)(76),{L:n,levelSegment:r,onLevelSegment:i,searchInput:a,onSearchInputChange:s,moduleFilter:l,onModuleFilterChange:u,modules:d,onOpenFilters:f,activeFilterCount:p,hasActiveFilters:m,onClearFilters:h,autoRefresh:g}=e,_=n.filters,v;t[0]===n.presetAll?v=t[1]:(v={value:`all`,label:n.presetAll},t[0]=n.presetAll,t[1]=v);let y;t[2]===n.presetErrors?y=t[3]:(y={value:`errors`,label:n.presetErrors},t[2]=n.presetErrors,t[3]=y);let b;t[4]===n.presetWarnPlus?b=t[5]:(b={value:`warnPlus`,label:n.presetWarnPlus},t[4]=n.presetWarnPlus,t[5]=b);let x;t[6]===n.presetInfoPlus?x=t[7]:(x={value:`infoPlus`,label:n.presetInfoPlus},t[6]=n.presetInfoPlus,t[7]=x);let S;t[8]===n.presetVerbose?S=t[9]:(S={value:`verbose`,label:n.presetVerbose},t[8]=n.presetVerbose,t[9]=S);let C;t[10]===n.presetOther?C=t[11]:(C={value:`other`,label:n.presetOther},t[10]=n.presetOther,t[11]=C);let E;t[12]!==v||t[13]!==y||t[14]!==b||t[15]!==x||t[16]!==S||t[17]!==C?(E=[v,y,b,x,S,C],t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=E):E=t[18];let D;t[19]!==n.levelPresetAria||t[20]!==r||t[21]!==i||t[22]!==E?(D=(0,$.jsx)(`div`,{className:`overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsx)(`div`,{className:`min-w-[min(100%,36rem)]`,children:(0,$.jsx)(Xe,{"aria-label":n.levelPresetAria,value:r,onChange:i,options:E,buttonClassName:`h-8 px-1.5 text-[11px] sm:px-2 sm:text-xs`})})}),t[19]=n.levelPresetAria,t[20]=r,t[21]=i,t[22]=E,t[23]=D):D=t[23];let k;t[24]===n.searchPlaceholder?k=t[25]:(k=(0,$.jsx)(`span`,{className:`sr-only`,children:n.searchPlaceholder}),t[24]=n.searchPlaceholder,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[26]=A):A=t[26];let j;t[27]===s?j=t[28]:(j=e=>s(e.target.value),t[27]=s,t[28]=j);let M=n.searchPlaceholder,N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=c(`h-10 w-full rounded-md border border-edge bg-surface-panel py-0 pl-10 pr-3 text-sm leading-5 text-fg placeholder:text-fg-subtle dark:border-edge`,O),t[29]=N):N=t[29];let P;t[30]!==n.searchPlaceholder||t[31]!==a||t[32]!==j?(P=(0,$.jsx)(`input`,{type:`search`,value:a,onChange:j,placeholder:M,autoComplete:`off`,spellCheck:!1,className:N}),t[30]=n.searchPlaceholder,t[31]=a,t[32]=j,t[33]=P):P=t[33];let F;t[34]!==k||t[35]!==P?(F=(0,$.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:min-w-[12rem]`,children:[k,A,P]}),t[34]=k,t[35]=P,t[36]=F):F=t[36];let I;t[37]===u?I=t[38]:(I=e=>u(e.target.value),t[37]=u,t[38]=I);let R=n.module,ee=n.module,V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=c(w,`h-10 w-full min-w-0 rounded-md py-0`),t[39]=V):V=t[39];let H;t[40]===n.allModules?H=t[41]:(H=(0,$.jsx)(te,{value:``,children:n.allModules}),t[40]=n.allModules,t[41]=H);let U;t[42]===d?U=t[43]:(U=d.map(Qe),t[42]=d,t[43]=U);let W;t[44]!==n.module||t[45]!==l||t[46]!==I||t[47]!==H||t[48]!==U?(W=(0,$.jsxs)(z,{id:`log-module`,value:l,onChange:I,"aria-label":R,title:ee,className:V,children:[H,U]}),t[44]=n.module,t[45]=l,t[46]=I,t[47]=H,t[48]=U,t[49]=W):W=t[49];let G;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(B,{className:`size-4`,strokeWidth:1.75}),t[50]=G):G=t[50];let q;t[51]===p?q=t[52]:(q=p>0?(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 text-xs tabular-nums text-fg-muted`,children:p}):null,t[51]=p,t[52]=q);let J;t[53]!==n.filtersMore||t[54]!==f||t[55]!==q?(J=(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-10 min-h-[44px] gap-2 rounded-md sm:min-h-10`,onClick:f,children:[G,n.filtersMore,q]}),t[53]=n.filtersMore,t[54]=f,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==n.clear||t[58]!==m||t[59]!==h?(Y=m?(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-10 min-h-[44px] gap-1 sm:min-h-10`,onClick:h,children:[(0,$.jsx)(o,{className:`size-4`,strokeWidth:1.75}),n.clear]}):null,t[57]=n.clear,t[58]=m,t[59]=h,t[60]=Y):Y=t[60];let X;t[61]!==J||t[62]!==Y?(X=(0,$.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[J,Y]}),t[61]=J,t[62]=Y,t[63]=X):X=t[63];let Z;t[64]!==F||t[65]!==W||t[66]!==X?(Z=(0,$.jsxs)(`div`,{className:`grid gap-2 lg:grid-cols-[minmax(16rem,1fr)_minmax(12rem,16rem)_auto] lg:items-center`,children:[F,W,X]}),t[64]=F,t[65]=W,t[66]=X,t[67]=Z):Z=t[67];let Q;t[68]!==n.liveHint||t[69]!==g?(Q=g?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:n.liveHint}):null,t[68]=n.liveHint,t[69]=g,t[70]=Q):Q=t[70];let ne;return t[71]!==n.filters||t[72]!==Z||t[73]!==Q||t[74]!==D?(ne=(0,$.jsxs)(`section`,{className:`flex flex-col gap-4 rounded-xl bg-surface-hover/20 p-4 sm:p-5`,"aria-label":_,children:[D,Z,Q]}),t[71]=n.filters,t[72]=Z,t[73]=Q,t[74]=D,t[75]=ne):ne=t[75],ne}function Qe(e){return(0,$.jsx)(te,{value:e,children:e},e)}function $e(e){let t=(0,K.c)(20),{L:n,logs:r,loading:i,hasMore:a,onSelectLog:o,onLoadMore:s,onRefreshAll:l,onFilterByRequestId:u}=e,d;t[0]!==i||t[1]!==r.length?(d=i&&r.length===0?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20`,"aria-busy":`true`,children:Array.from({length:8}).map(et)}):null,t[0]=i,t[1]=r.length,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==i||t[5]!==r.length||t[6]!==l?(f=!i&&r.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl bg-surface-hover/20 py-16 text-center`,children:[(0,$.jsx)(k,{className:`size-12 text-fg-subtle`,strokeWidth:1.5,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.noLogs}),(0,$.jsx)(`p`,{className:`max-w-sm text-sm leading-relaxed text-fg-muted`,children:n.noLogsDescription}),(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`mt-4 gap-2`,onClick:l,children:[(0,$.jsx)(I,{className:`size-4`,strokeWidth:1.75}),n.refresh]})]}):null,t[3]=n,t[4]=i,t[5]=r.length,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==n||t[9]!==a||t[10]!==i||t[11]!==r||t[12]!==u||t[13]!==s||t[14]!==o?(p=r.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:[xe(n.showingCount,{count:String(r.length)}),a?(0,$.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,n.moreAvailable]}):null]}),(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-hover/20 p-1 text-sm leading-6`,children:[(0,$.jsxs)(`div`,{className:`hidden items-center gap-3 px-3 py-2 text-xs font-medium text-fg-subtle md:flex`,"aria-hidden":!0,children:[(0,$.jsx)(`span`,{className:`w-[5.25rem] shrink-0`,children:n.time}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0`,children:n.level}),(0,$.jsx)(`span`,{className:`w-[4.5rem] shrink-0 sm:w-[5.25rem]`,children:n.requestId}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 xl:block`,children:n.phase}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 lg:block`,children:n.module}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:n.message})]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r.map(e=>{let t=e.level??`info`,r=typeof e.requestId==`string`?e.requestId.trim():``,i=ke(e),a=t===`error`||t===`fatal`;return(0,$.jsx)(`li`,{className:`rounded-lg bg-surface-base/45`,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:c(`flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,a&&`bg-red-500/5`),children:[(0,$.jsx)(`span`,{className:`w-[4.75rem] shrink-0 font-mono text-xs tabular-nums text-fg-subtle sm:w-[5.25rem] sm:text-sm`,children:we(e.timestamp)}),(0,$.jsx)(`span`,{className:c(`w-[4.5rem] shrink-0 truncate`,a?`font-medium text-red-600 dark:text-red-400`:`text-fg-muted`),title:t,children:Oe(t)}),(0,$.jsx)(`span`,{className:`hidden w-[4.5rem] shrink-0 truncate font-mono sm:block sm:w-[5.25rem]`,children:r?u?(0,$.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer text-accent hover:underline`,title:`${n.requestId}: ${r}`,onClick:e=>{e.stopPropagation(),u(r)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),u(r))},children:De(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,title:`${n.requestId}: ${r}`,children:De(r)}):(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:`—`})}),(0,$.jsx)(`span`,{className:`hidden max-w-[6rem] shrink-0 truncate text-fg-subtle xl:inline`,title:i===`—`?void 0:i,children:i===`—`?`—`:i}),(0,$.jsx)(`span`,{className:`hidden max-w-[7rem] shrink-0 truncate text-fg-muted lg:inline`,title:Se(e),children:Se(e)}),(0,$.jsx)(`span`,{className:c(`min-w-0 flex-1 truncate`,`text-fg`),children:Ce(e)})]})},Ae(e))})})]}),a?(0,$.jsx)(`div`,{className:`flex justify-center pt-1`,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`gap-2`,disabled:i,onClick:s,children:[i?(0,$.jsx)(I,{className:`size-4 animate-spin motion-reduce:animate-none`,strokeWidth:1.75}):(0,$.jsx)(ee,{className:`size-4`,strokeWidth:1.75}),n.loadMore]})}):null]}):null,t[8]=n,t[9]=a,t[10]=i,t[11]=r,t[12]=u,t[13]=s,t[14]=o,t[15]=p):p=t[15];let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,$.jsxs)($.Fragment,{children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function et(e,t){return(0,$.jsxs)(`div`,{className:`flex gap-3 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`h-4 w-16 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-12 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 w-20 shrink-0 bg-surface-hover motion-reduce:animate-none animate-pulse`}),(0,$.jsx)(`div`,{className:`h-4 min-w-0 flex-1 bg-surface-hover motion-reduce:animate-none animate-pulse`})]},t)}function tt(e){let t=(0,K.c)(8),{L:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=r):r=t[0];let i;t[1]===n.title?i=t[2]:(i=(0,$.jsx)(`h1`,{className:`text-base font-semibold tracking-tight text-fg`,children:n.title}),t[1]=n.title,t[2]=i);let a;t[3]===n.needToken?a=t[4]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.needToken}),t[3]=n.needToken,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-10 sm:px-5 xl:px-6`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[r,(0,$.jsxs)(`div`,{children:[i,a]})]})}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function nt(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function rt(e){let t=[`timestamp`,`level`,`module`,`phase`,`requestId`,`transcriptId`,`message`],n=e.map(e=>{let t=String(e.module||``),n=String(e.phase??e.meta?.phase??``);return[e.timestamp,e.level,t,n,e.requestId??``,e.transcriptId??``,e.message??``].map(e=>nt(String(e))).join(`,`)});return[t.join(`,`),...n].join(`
2
- `)}function it(e,t,n){let r=new Blob([e],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),URL.revokeObjectURL(i)}function at(e,t){let n=new Date().toISOString().replace(/[:.]/g,`-`);if(t===`json`){it(JSON.stringify(e,null,2),`xopc-logs-${n}.json`,`application/json`);return}it(rt(e),`xopc-logs-${n}.csv`,`text/csv;charset=utf-8`)}function ot(e){let t=(0,K.c)(32),{L:n,logs:r,disabled:i}=e,o=i||r.length===0,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75}),t[0]=s):s=t[0];let l;t[1]===n.exportLogs?l=t[2]:(l=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.exportLogs}),t[1]=n.exportLogs,t[2]=l);let u;t[3]!==n.exportLogs||t[4]!==o||t[5]!==l?(u=(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,disabled:o,title:n.exportLogs,children:[s,l]})}),t[3]=n.exportLogs,t[4]=o,t[5]=l,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=c(`w-52 rounded-xl border border-edge bg-surface-panel p-2 shadow-popover outline-none`,V,`dark:border-edge`),t[7]=d):d=t[7];let f;t[8]===n.exportLogs?f=t[9]:(f=(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-fg`,children:n.exportLogs}),t[8]=n.exportLogs,t[9]=f);let p;t[10]===n.exportHint?p=t[11]:(p=(0,$.jsx)(`p`,{className:`px-2 pb-2 text-xs leading-5 text-fg-muted`,children:n.exportHint}),t[10]=n.exportHint,t[11]=p);let m;t[12]===r?m=t[13]:(m=()=>at(r,`json`),t[12]=r,t[13]=m);let h;t[14]!==n.exportJson||t[15]!==m?(h=(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:m,children:n.exportJson}),t[14]=n.exportJson,t[15]=m,t[16]=h):h=t[16];let g;t[17]===r?g=t[18]:(g=()=>at(r,`csv`),t[17]=r,t[18]=g);let _;t[19]!==n.exportCsv||t[20]!==g?(_=(0,$.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 justify-start px-2 text-xs`,onClick:g,children:n.exportCsv}),t[19]=n.exportCsv,t[20]=g,t[21]=_):_=t[21];let v;t[22]!==_||t[23]!==h?(v=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[h,_]}),t[22]=_,t[23]=h,t[24]=v):v=t[24];let y;t[25]!==v||t[26]!==f||t[27]!==p?(y=(0,$.jsx)(C,{children:(0,$.jsxs)(j,{side:`bottom`,align:`end`,sideOffset:6,className:d,children:[f,p,v]})}),t[25]=v,t[26]=f,t[27]=p,t[28]=y):y=t[28];let b;return t[29]!==y||t[30]!==u?(b=(0,$.jsxs)(H,{children:[u,y]}),t[29]=y,t[30]=u,t[31]=b):b=t[31],b}function st(e){let t=(0,K.c)(38),{L:n}=e,[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(`info`),[s,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),f,p;t[0]!==n.logLevelLoadError||t[1]!==r?(f=()=>{if(!r)return;let e=!1;return ne().then(t=>{e||o(t)}).catch(t=>{e||d(t instanceof Error?t.message:n.logLevelLoadError)}),()=>{e=!0}},p=[r,n.logLevelLoadError],t[0]=n.logLevelLoadError,t[1]=r,t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,G.useEffect)(f,p);let m;t[4]===n.logLevelSaveError?m=t[5]:(m=e=>{l(!0),d(null),re(e).then(e=>{o(e.current),i(!1)}).catch(e=>{d(e instanceof Error?e.message:n.logLevelSaveError)}).finally(()=>l(!1))},t[4]=n.logLevelSaveError,t[5]=m);let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.75}),t[6]=g):g=t[6];let _;t[7]===n.logLevelTitle?_=t[8]:(_=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n.logLevelTitle}),t[7]=n.logLevelTitle,t[8]=_);let v;t[9]===a?v=t[10]:(v=(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:a}),t[9]=a,t[10]=v);let y;t[11]!==n.logLevelTitle||t[12]!==_||t[13]!==v?(y=(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9 gap-2 whitespace-nowrap px-3 text-xs`,title:n.logLevelTitle,children:[g,_,v]})}),t[11]=n.logLevelTitle,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=c(`w-56 rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,V,`dark:border-edge`),t[15]=b):b=t[15];let x;t[16]===n.logLevelTitle?x=t[17]:(x=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.logLevelTitle}),t[16]=n.logLevelTitle,t[17]=x);let S;t[18]===n.logLevelHint?S=t[19]:(S=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.logLevelHint}),t[18]=n.logLevelHint,t[19]=S);let w;t[20]!==n.levelNames||t[21]!==h||t[22]!==a||t[23]!==s?(w=ce.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>h(e),className:c(`flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-xs transition-colors`,a===e?`bg-accent/10 font-medium text-accent`:`text-fg hover:bg-surface-hover`),children:[(0,$.jsx)(`span`,{children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] uppercase text-fg-subtle`,children:e})]})},e)),t[20]=n.levelNames,t[21]=h,t[22]=a,t[23]=s,t[24]=w):w=t[24];let E;t[25]===w?E=t[26]:(E=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1`,children:w}),t[25]=w,t[26]=E);let D;t[27]===u?D=t[28]:(D=u?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:u}):null,t[27]=u,t[28]=D);let O;t[29]!==S||t[30]!==E||t[31]!==D||t[32]!==x?(O=(0,$.jsx)(C,{children:(0,$.jsxs)(j,{side:`bottom`,align:`end`,sideOffset:6,className:b,children:[x,S,E,D]})}),t[29]=S,t[30]=E,t[31]=D,t[32]=x,t[33]=O):O=t[33];let k;return t[34]!==r||t[35]!==O||t[36]!==y?(k=(0,$.jsxs)(H,{open:r,onOpenChange:i,children:[y,O]}),t[34]=r,t[35]=O,t[36]=y,t[37]=k):k=t[37],k}function ct(e){let t=(0,K.c)(49),{L:n,autoRefresh:r,onAutoRefreshChange:i,fileCount:a,onOpenFiles:o,loading:s,onRefreshAll:c,logs:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,$.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-lg`,children:n.title}),t[0]=n.title,t[1]=u);let d;t[2]===n.subtitle?d=t[3]:(d=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:n.subtitle}),t[2]=n.subtitle,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p=r?`live`:`paused`,m;t[7]===i?m=t[8]:(m=e=>i(e===`live`),t[7]=i,t[8]=m);let h;t[9]===n.refreshManual?h=t[10]:(h={value:`paused`,label:n.refreshManual},t[9]=n.refreshManual,t[10]=h);let g;t[11]===n.refreshLive?g=t[12]:(g={value:`live`,label:n.refreshLive},t[11]=n.refreshLive,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=[h,g],t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==n.refreshModeAria||t[17]!==p||t[18]!==m||t[19]!==_?(v=(0,$.jsx)(`div`,{className:`w-full sm:w-52`,children:(0,$.jsx)(Xe,{"aria-label":n.refreshModeAria,value:p,onChange:m,options:_,buttonClassName:`h-8`})}),t[16]=n.refreshModeAria,t[17]=p,t[18]=m,t[19]=_,t[20]=v):v=t[20];let y;t[21]===n?y=t[22]:(y=(0,$.jsx)(st,{L:n}),t[21]=n,t[22]=y);let b;t[23]!==n||t[24]!==s||t[25]!==l?(b=(0,$.jsx)(ot,{L:n,logs:l,disabled:s}),t[23]=n,t[24]=s,t[25]=l,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(A,{className:`size-4`,strokeWidth:1.75}),t[27]=x):x=t[27];let S;t[28]===a?S=t[29]:(S=a>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-1.5 text-xs text-fg-muted`,children:a}):null,t[28]=a,t[29]=S);let C;t[30]!==n.logFiles||t[31]!==o||t[32]!==S?(C=(0,$.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,title:n.logFiles,"aria-label":n.logFiles,onClick:o,children:[x,S]}),t[30]=n.logFiles,t[31]=o,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==n.refresh||t[35]!==s||t[36]!==c?(w=(0,$.jsx)(N,{className:`h-9 min-h-[44px] min-w-[44px] px-2 sm:min-h-9 sm:min-w-0`,loading:s,label:n.refresh,onClick:c}),t[34]=n.refresh,t[35]=s,t[36]=c,t[37]=w):w=t[37];let E;t[38]!==y||t[39]!==b||t[40]!==C||t[41]!==w?(E=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1 sm:self-center`,children:[y,b,C,w]}),t[38]=y,t[39]=b,t[40]=C,t[41]=w,t[42]=E):E=t[42];let D;t[43]!==E||t[44]!==v?(D=(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 flex-col gap-2 rounded-xl bg-surface-hover/20 p-2 sm:flex-row sm:items-center sm:justify-between`,children:[v,E]}),t[43]=E,t[44]=v,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==f?(O=(0,$.jsxs)(`header`,{className:`flex flex-col gap-4`,children:[f,D]}),t[46]=D,t[47]=f,t[48]=O):O=t[48],O}function lt(e){let t=(0,K.c)(33),{L:n,stats:r}=e,i;t[0]===r.byLevel?i=t[1]:(i=r.byLevel??{},t[0]=r.byLevel,t[1]=i);let a;t[2]!==n.levelNames||t[3]!==i?(a=Ne(i,n.levelNames),t[2]=n.levelNames,t[3]=i,t[4]=a):a=t[4];let o=a,s=r.runtime?.errorsLast24h;if(!o&&s==null)return null;let l;t[5]===n.statsRegion?l=t[6]:(l=(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.statsRegion}),t[5]=n.statsRegion,t[6]=l);let u;t[7]===o?u=t[8]:(u=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:o})]}):null,t[7]=o,t[8]=u);let d;t[9]!==n.runtimeErrors||t[10]!==s?(d=s!=null&&s>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mx-1.5 text-fg-subtle`,children:`·`}),(0,$.jsxs)(`span`,{className:`tabular-nums text-red-600 dark:text-red-400`,children:[n.runtimeErrors,` `,s]})]}):null,t[9]=n.runtimeErrors,t[10]=s,t[11]=d):d=t[11];let f;t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded-lg border border-transparent px-1 py-0.5 text-left text-xs leading-5 text-fg-subtle transition-colors duration-150 ease-out hover:border-edge-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel dark:hover:border-edge`,children:[l,u,d]})}),t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15];let p;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(p=c(`w-[min(calc(100vw-2rem),20rem)] rounded-xl border border-edge bg-surface-panel p-3 shadow-popover outline-none`,V,`dark:border-edge`),t[16]=p):p=t[16];let m;t[17]===n.statsDetailTitle?m=t[18]:(m=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.statsDetailTitle}),t[17]=n.statsDetailTitle,t[18]=m);let h;t[19]===n.statsHint?h=t[20]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.statsHint}),t[19]=n.statsHint,t[20]=h);let g;t[21]!==n.levelNames||t[22]!==r.byLevel?(g=ce.map(e=>{let t=r.byLevel?.[e]??0;return t===0?null:(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs dark:border-edge`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize text-fg`,children:n.levelNames[e]}),(0,$.jsx)(`span`,{className:`tabular-nums text-fg-muted`,children:t})]},e)}),t[21]=n.levelNames,t[22]=r.byLevel,t[23]=g):g=t[23];let _;t[24]===g?_=t[25]:(_=(0,$.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1.5`,children:g}),t[24]=g,t[25]=_);let v;t[26]!==_||t[27]!==m||t[28]!==h?(v=(0,$.jsx)(C,{children:(0,$.jsxs)(j,{side:`bottom`,align:`start`,sideOffset:6,className:p,children:[m,h,_]})}),t[26]=_,t[27]=m,t[28]=h,t[29]=v):v=t[29];let y;return t[30]!==v||t[31]!==f?(y=(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(H,{children:[f,v]})}),t[30]=v,t[31]=f,t[32]=y):y=t[32],y}function ut(){let e=(0,K.c)(89),{L:t,hasToken:n,logs:r,loading:i,error:a,hasMore:o,searchInput:s,setSearchInput:c,selectedLevels:l,moduleFilter:u,setModuleFilter:f,dateFrom:p,setDateFrom:m,dateTo:h,setDateTo:g,modules:_,files:v,stats:y,selectedLog:b,setSelectedLog:x,filesOpen:S,setFilesOpen:C,filtersOpen:w,setFiltersOpen:T,logDir:E,autoRefresh:D,setAutoRefresh:O,copiedDetail:k,setCopiedDetail:A,hasActiveFilters:j,activeFilterCount:M,clearFilters:N,toggleDialogLevel:P,handleLoadMore:F,refreshAll:I,levelSegment:L,handleLevelSegment:R,filterByRequestId:z,filterByTranscriptId:B,filterByErrorSummary:ee,openChatForSession:te,errorSummary:V,errorSummaryLoading:H}=Le(d(dt));if(!n){let n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(tt,{L:t}),e[0]=t,e[1]=n),n}let U;e[2]===C?U=e[3]:(U=()=>C(!0),e[2]=C,e[3]=U);let G;e[4]!==t||e[5]!==D||e[6]!==v.length||e[7]!==i||e[8]!==r||e[9]!==I||e[10]!==O||e[11]!==U?(G=(0,$.jsx)(ct,{L:t,autoRefresh:D,onAutoRefreshChange:O,fileCount:v.length,onOpenFiles:U,loading:i,onRefreshAll:I,logs:r}),e[4]=t,e[5]=D,e[6]=v.length,e[7]=i,e[8]=r,e[9]=I,e[10]=O,e[11]=U,e[12]=G):G=e[12];let q;e[13]===a?q=e[14]:(q=a?(0,$.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:a}):null,e[13]=a,e[14]=q);let J;e[15]!==t||e[16]!==y?(J=y?(0,$.jsx)(lt,{L:t,stats:y}):null,e[15]=t,e[16]=y,e[17]=J):J=e[17];let Y;e[18]!==t||e[19]!==V||e[20]!==H||e[21]!==ee?(Y=(0,$.jsx)(Re,{L:t,items:V,loading:H,onSelectItem:ee}),e[18]=t,e[19]=V,e[20]=H,e[21]=ee,e[22]=Y):Y=e[22];let X;e[23]===T?X=e[24]:(X=()=>T(!0),e[23]=T,e[24]=X);let Z;e[25]!==t||e[26]!==M||e[27]!==D||e[28]!==N||e[29]!==R||e[30]!==j||e[31]!==L||e[32]!==u||e[33]!==_||e[34]!==s||e[35]!==f||e[36]!==c||e[37]!==X?(Z=(0,$.jsx)(Ze,{L:t,levelSegment:L,onLevelSegment:R,searchInput:s,onSearchInputChange:c,moduleFilter:u,onModuleFilterChange:f,modules:_,onOpenFilters:X,activeFilterCount:M,hasActiveFilters:j,onClearFilters:N,autoRefresh:D}),e[25]=t,e[26]=M,e[27]=D,e[28]=N,e[29]=R,e[30]=j,e[31]=L,e[32]=u,e[33]=_,e[34]=s,e[35]=f,e[36]=c,e[37]=X,e[38]=Z):Z=e[38];let Q;e[39]!==t||e[40]!==z||e[41]!==F||e[42]!==o||e[43]!==i||e[44]!==r||e[45]!==I||e[46]!==x?(Q=(0,$.jsx)($e,{L:t,logs:r,loading:i,hasMore:o,onSelectLog:x,onLoadMore:F,onRefreshAll:I,onFilterByRequestId:z}),e[39]=t,e[40]=z,e[41]=F,e[42]=o,e[43]=i,e[44]=r,e[45]=I,e[46]=x,e[47]=Q):Q=e[47];let ne;e[48]!==t||e[49]!==p||e[50]!==h||e[51]!==w||e[52]!==l||e[53]!==m||e[54]!==g||e[55]!==T||e[56]!==P?(ne=(0,$.jsx)(Ge,{L:t,open:w,onOpenChange:T,dateFrom:p,onDateFromChange:m,dateTo:h,onDateToChange:g,selectedLevels:l,onToggleLevel:P}),e[48]=t,e[49]=p,e[50]=h,e[51]=w,e[52]=l,e[53]=m,e[54]=g,e[55]=T,e[56]=P,e[57]=ne):ne=e[57];let re;e[58]===x?re=e[59]:(re=()=>x(null),e[58]=x,e[59]=re);let ie,ae;e[60]===A?(ie=e[61],ae=e[62]):(ie=()=>A(`message`),ae=()=>A(`json`),e[60]=A,e[61]=ie,e[62]=ae);let oe;e[63]!==t||e[64]!==k||e[65]!==z||e[66]!==B||e[67]!==te||e[68]!==b||e[69]!==ie||e[70]!==ae||e[71]!==re?(oe=(0,$.jsx)(He,{L:t,log:b,onClose:re,copiedDetail:k,onCopiedMessage:ie,onCopiedJson:ae,onFilterByRequestId:z,onFilterByTranscriptId:B,onOpenChat:te}),e[63]=t,e[64]=k,e[65]=z,e[66]=B,e[67]=te,e[68]=b,e[69]=ie,e[70]=ae,e[71]=re,e[72]=oe):oe=e[72];let se;e[73]!==t||e[74]!==v||e[75]!==S||e[76]!==E||e[77]!==C?(se=(0,$.jsx)(Ue,{L:t,open:S,onOpenChange:C,files:v,logDir:E}),e[73]=t,e[74]=v,e[75]=S,e[76]=E,e[77]=C,e[78]=se):se=e[78];let ce;return e[79]!==G||e[80]!==oe||e[81]!==se||e[82]!==q||e[83]!==J||e[84]!==Y||e[85]!==Z||e[86]!==Q||e[87]!==ne?(ce=(0,$.jsxs)(W,{gap:`gap-6`,children:[G,q,J,Y,Z,Q,ne,oe,se]}),e[79]=G,e[80]=oe,e[81]=se,e[82]=q,e[83]=J,e[84]=Y,e[85]=Z,e[86]=Q,e[87]=ne,e[88]=ce):ce=e[88],ce}function dt(e){return e.language}export{ut as LogsPage};
@@ -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{g as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./plus-Q2yW6OE7.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./messages-CaeL_miw.js";import{t as c}from"./cn-0WouolD0.js";import{i as l,n as u,r as d}from"./locale-store-CE7L6MlS.js";import{a as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{s as v}from"./session-api-CaAUJvu1.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{Hc as b,Ic as x,Of as S,On as C,Wl as w,Xa as T,Ya as E,_s as ee,af as D,cs as O,do as k,eu as A,gs as te,ju as j,ns as M,of as N,ql as ne,rd as P}from"./index-CKdOZoVu.js";import{n as F,r as I,t as L}from"./settings-page-layout-Dx5S-Msc.js";import{t as R}from"./device-pairing-wizard-D_WWTsze.js";var z=n(),B=e(t(),1),V=r();async function H(e=`GET`,t,n){let r=await l(d(`/api/endpoint-tools/target-authorizations`+(n?`/`+encodeURIComponent(n):``)),{method:e,...t?{body:JSON.stringify(t)}:{}});if(!r.ok)throw Error(r.status===403?`owner`:`unavailable`);return(await r.json()).payload}function re({devices:e,zh:t}){let n=y(`device-single-call-grants`,()=>H(),{refreshInterval:5e3,shouldRetryOnError:!1}),r=y(n.error?null:`device-grant-conversations`,()=>v({limit:100}),{shouldRetryOnError:!1}),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(`weather`),[f,p]=(0,B.useState)(`approximate`),[m,h]=(0,B.useState)(`restaurant`),[g,_]=(0,B.useState)(!1),[S,C]=(0,B.useState)(!1);if(n.error)return null;let w=e.flatMap(e=>e.endpoints.map(t=>({...t,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))),T=w.find(e=>e.endpointId===c)?.tools.find(e=>e.descriptor.name.endsWith(`.device.get_location`))?.descriptor.name,E=async()=>{if(!(!T||!i||!o)){_(!0),C(!1);try{await H(`POST`,{conversationId:i,requestorPrincipalId:o,targetEndpointId:c,toolName:T,arguments:{purpose:u,precision:f,...u===`nearby`?{category:m}:{}}}),await n.mutate()}catch{C(!0)}finally{_(!1)}}};return(0,V.jsxs)(`section`,{className:`mb-5 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-fg`,children:t?`跨设备单次授权`:`Single-call device authorization`}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t?`为指定会话和来源设备授权一次定位查询,60 秒后失效。目标设备仍需确认;授权后请在来源设备继续请求。`:`Authorize one location query for a conversation and source device. Expires in 60 seconds; target-device consent is still required. Continue the request from the source device.`}),n.isLoading||r.isLoading?(0,V.jsx)(x,{className:`mt-3 h-28`}):(0,V.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(O,{value:i,onChange:a,placeholder:t?`选择会话`:`Conversation`,ariaLabel:t?`会话`:`Conversation`,options:(r.data?.items??[]).map(e=>({value:e.key,label:e.name||e.key}))}),(0,V.jsx)(O,{value:o,onChange:s,placeholder:t?`消息来源设备`:`Source device`,ariaLabel:t?`消息来源设备`:`Source device`,options:e.filter(e=>e.endpoints.length>0).map(e=>({value:e.id,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))}),(0,V.jsx)(O,{value:c,onChange:l,placeholder:t?`使用哪台设备的位置`:`Location device`,ariaLabel:t?`目标设备`:`Target device`,options:w.filter(e=>e.tools.some(e=>e.descriptor.name.endsWith(`.device.get_location`))).map(e=>({value:e.endpointId,label:e.label}))}),(0,V.jsx)(O,{placeholder:t?`用途`:`Purpose`,value:u,onChange:e=>d(e),ariaLabel:t?`用途`:`Purpose`,options:[{value:`weather`,label:t?`查询天气`:`Weather`},{value:`nearby`,label:t?`附近地点`:`Nearby places`}],allowEmpty:!1}),(0,V.jsx)(O,{placeholder:t?`精度`:`Precision`,value:f,onChange:e=>p(e),ariaLabel:t?`精度`:`Precision`,options:[{value:`approximate`,label:t?`大致位置`:`Approximate`},{value:`precise`,label:t?`精确位置`:`Precise`}],allowEmpty:!1}),u===`nearby`?(0,V.jsx)(O,{placeholder:t?`地点类型`:`Category`,value:m,onChange:h,ariaLabel:t?`附近地点类型`:`Place category`,options:[`restaurant`,`cafe`,`pharmacy`,`park`].map((e,n)=>({value:e,label:t?[`餐厅`,`咖啡馆`,`药店`,`公园`][n]:e})),allowEmpty:!1}):null,(0,V.jsx)(b,{variant:`primary`,disabled:g||!i||!o||!T,onClick:()=>void E(),children:t?`允许一次`:`Allow once`})]}),S?(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-fg-muted`,children:t?`授权失败,请检查设备连接后重试。`:`Authorization failed. Check the device connection.`}):null,(0,V.jsx)(`div`,{className:`mt-3 space-y-2`,children:n.data?.map(r=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-fg-muted`,children:[(0,V.jsxs)(`span`,{children:[e.find(e=>e.endpoints.some(e=>e.endpointId===r.targetEndpointId))?.displayName??(t?`设备`:`Device`),` · `,r.state===`running`?t?`执行中`:`Running`:t?`等待本次调用`:`Awaiting one call`]}),(0,V.jsx)(b,{disabled:g,onClick:()=>{_(!0),H(`DELETE`,void 0,r.id).then(()=>n.mutate()).catch(()=>C(!0)).finally(()=>_(!1))},children:t?`撤销`:`Revoke`})]},r.id))})]})}var U=720*60*60*1e3;function W(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function G(e){return W(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function ie(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ae(e,t=Date.now()){return G(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-U:!1}function oe(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=G(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ae(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function se(e){return e.length>8?e.slice(-8):e}function ce(e){let t=(0,z.c)(61),{device:n,busy:r,onClose:i,onRevoke:a,onRename:l}=e,d=u(le),v;t[0]===d?v=t[1]:(v=s(d),t[0]=d,t[1]=v);let y=v.endpointToolsSettings,x=d===`zh`?`zh-CN`:`en`,S;t[2]===x?S=t[3]:(S=new Intl.DateTimeFormat(x,{dateStyle:`medium`,timeStyle:`short`}),t[2]=x,t[3]=S);let C=S,w;t[4]===n?w=t[5]:(w=n?G(n):`offline`,t[4]=n,t[5]=w);let T=w,E=n!==null,D;t[6]===i?D=t[7]:(D=e=>!e&&i(),t[6]=i,t[7]=D);let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,V.jsx)(f,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ee)}),t[8]=O):O=t[8];let k;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=c(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,te),t[9]=k):k=t[9];let A=n?.displayName??y.deviceDetails,j;t[10]===A?j=t[11]:(j=(0,V.jsx)(g,{className:`truncate text-base font-semibold text-fg`,children:A}),t[10]=A,t[11]=j);let M;t[12]===n?M=t[13]:(M=n?(0,V.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,se(n.id)]}):null,t[12]=n,t[13]=M);let N;t[14]!==j||t[15]!==M?(N=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),t[14]=j,t[15]=M,t[16]=N):N=t[16];let P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,V.jsx)(o,{className:`size-5`,"aria-hidden":!0}),t[17]=P):P=t[17];let F;t[18]===y.close?F=t[19]:(F=(0,V.jsx)(p,{asChild:!0,children:(0,V.jsx)(b,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":y.close,children:P})}),t[18]=y.close,t[19]=F);let I;t[20]!==N||t[21]!==F?(I=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[N,F]}),t[20]=N,t[21]=F,t[22]=I):I=t[22];let L;t[23]!==y.accessActive||t[24]!==y.accessRevoked||t[25]!==y.accessTitle||t[26]!==y.createdAt||t[27]!==y.endpointCount||t[28]!==y.endpointsTitle||t[29]!==y.identityId||t[30]!==y.identityTitle||t[31]!==y.lastSeen||t[32]!==y.never||t[33]!==y.noAccessIdentity||t[34]!==y.noOnlineEndpoints||t[35]!==y.noPermissions||t[36]!==y.permissions||t[37]!==y.status||t[38]!==y.statusLabel||t[39]!==y.toolCount||t[40]!==n||t[41]!==C||t[42]!==d||t[43]!==l||t[44]!==T?(L=n?(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[n.principal&&T!==`revoked`&&l?(0,V.jsx)(ue,{device:n,zh:d===`zh`,onRename:l},`${n.id}:${n.settingsRevision??0}`):null,(0,V.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,V.jsx)(K,{label:y.statusLabel,value:y.status[T]}),(0,V.jsx)(K,{label:y.lastSeen,value:n.lastSeenAt?C.format(n.lastSeenAt):y.never}),(0,V.jsx)(K,{label:y.endpointCount,value:String(n.endpoints.length)}),(0,V.jsx)(K,{label:y.toolCount,value:String(ie(n))})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.accessTitle}),(0,V.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{children:n.access.revokedAt?y.accessRevoked:y.accessActive}),(0,V.jsx)(`p`,{className:`mt-1`,children:n.access.requestProofVersion===1?d===`zh`?`设备请求签名已启用`:`Device request signing enabled`:d===`zh`?`旧版兼容:尚未启用请求签名`:`Legacy compatibility: request signing not enabled`}),(0,V.jsxs)(`p`,{className:`mt-1 break-words`,children:[y.permissions,`: `,n.access.scopes.join(`, `)||y.noPermissions]})]}):(0,V.jsx)(`p`,{children:y.noAccessIdentity})})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.endpointsTitle}),(0,V.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,V.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,V.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[y.status[e.availability],` · v`,e.appVersion]})]}),(0,V.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,V.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.title}),(0,V.jsxs)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:[t.requiresForeground?d===`zh`?`需要设备在前台 · `:`Requires foreground · `:``,t.confirmation===`always`?d===`zh`?`每次确认`:`Confirm each time`:d===`zh`?`按已授权范围调用`:`Uses the authorized scope`]})]},t.name)})})]},e.connectionId))]})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.identityTitle}),n.principal&&T!==`revoked`&&l?(0,V.jsx)(ue,{device:n,zh:d===`zh`,onRename:l},`${n.id}:${n.settingsRevision??0}`):null,(0,V.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,V.jsx)(K,{label:y.identityId,value:n.id,breakAll:!0}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(K,{label:y.createdAt,value:C.format(n.createdAt)})})]})]})]}):null,t[23]=y.accessActive,t[24]=y.accessRevoked,t[25]=y.accessTitle,t[26]=y.createdAt,t[27]=y.endpointCount,t[28]=y.endpointsTitle,t[29]=y.identityId,t[30]=y.identityTitle,t[31]=y.lastSeen,t[32]=y.never,t[33]=y.noAccessIdentity,t[34]=y.noOnlineEndpoints,t[35]=y.noPermissions,t[36]=y.permissions,t[37]=y.status,t[38]=y.statusLabel,t[39]=y.toolCount,t[40]=n,t[41]=C,t[42]=d,t[43]=l,t[44]=T,t[45]=L):L=t[45];let R;t[46]!==r||t[47]!==y.removeDevice||t[48]!==y.revoking||t[49]!==n||t[50]!==a||t[51]!==T?(R=n&&T!==`revoked`?(0,V.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,V.jsxs)(b,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,V.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),r?y.revoking:y.removeDevice]})}):null,t[46]=r,t[47]=y.removeDevice,t[48]=y.revoking,t[49]=n,t[50]=a,t[51]=T,t[52]=R):R=t[52];let B;t[53]!==I||t[54]!==L||t[55]!==R?(B=(0,V.jsxs)(m,{children:[O,(0,V.jsxs)(h,{className:k,"aria-describedby":void 0,children:[I,L,R]})]}),t[53]=I,t[54]=L,t[55]=R,t[56]=B):B=t[56];let H;return t[57]!==B||t[58]!==E||t[59]!==D?(H=(0,V.jsx)(_,{open:E,onOpenChange:D,children:B}),t[57]=B,t[58]=E,t[59]=D,t[60]=H):H=t[60],H}function le(e){return e.language}function K(e){let t=(0,z.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,V.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,l;t[2]===s?l=t[3]:(l=c(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,V.jsx)(`dd`,{className:l,children:r}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function ue({device:e,zh:t,onRename:n}){let[r,i]=(0,B.useState)(e.displayName),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1);return(0,V.jsxs)(`form`,{className:`space-y-2`,onSubmit:async t=>{if(t.preventDefault(),!(a||!r.trim())){o(!0),c(!1);try{await n(e,r.trim())}catch{c(!0)}finally{o(!1)}}},children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[t?`设备名称`:`Device name`,(0,V.jsx)(`input`,{value:r,maxLength:80,onChange:e=>i(e.target.value),className:`mt-2 h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-fg`})]}),(0,V.jsx)(b,{type:`submit`,variant:`secondary`,disabled:a||!r.trim()||r.trim()===e.displayName,children:a?t?`保存中…`:`Saving…`:t?`保存名称`:`Save name`}),s?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`保存失败,请刷新设备信息后重试。`:`Unable to save. Refresh device information and retry.`}):null]})}function de(e){let t=(0,z.c)(19),{onPaired:n}=e,[r,o]=i(),c=u(pe),l;t[0]===c?l=t[1]:(l=s(c),t[0]=c,t[1]=l);let d=l.endpointToolsSettings.deviceAccess,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={open:!1},t[2]=f):f=t[2];let[p,m]=(0,B.useState)(f),h,g;t[3]!==r||t[4]!==o?(h=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(m({open:!0,target:e}),o(fe,{replace:!0}))},g=[r,o],t[3]=r,t[4]=o,t[5]=h,t[6]=g):(h=t[5],g=t[6]),(0,B.useEffect)(h,g);let _,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>m({open:!0}),v=(0,V.jsx)(a,{className:`size-4`,"aria-hidden":!0}),t[7]=_,t[8]=v):(_=t[7],v=t[8]);let y;t[9]===d.addDevice?y=t[10]:(y=(0,V.jsxs)(b,{variant:`primary`,onClick:_,children:[v,d.addDevice]}),t[9]=d.addDevice,t[10]=y);let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>m(t=>({...t,open:e})),t[11]=x):x=t[11];let S;t[12]!==p.open||t[13]!==p.target||t[14]!==n?(S=(0,V.jsx)(R,{open:p.open,onOpenChange:x,onPaired:n,targetKind:p.target}),t[12]=p.open,t[13]=p.target,t[14]=n,t[15]=S):S=t[15];let C;return t[16]!==y||t[17]!==S?(C=(0,V.jsxs)(V.Fragment,{children:[y,S]}),t[16]=y,t[17]=S,t[18]=C):C=t[18],C}function fe(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function pe(e){return e.language}async function q(e){let t=await e.json().catch(()=>null);if(!e.ok||t?.payload===void 0)throw Error(t?.error?.message??`Endpoint management request failed: ${e.status}`);return t.payload}function me(){return d(`/api/endpoint-tools/devices`)}function he(e){let t=new URLSearchParams({page:String(e.page),pageSize:String(e.pageSize)});return e.query.trim()&&t.set(`query`,e.query.trim()),e.principalId&&t.set(`principalId`,e.principalId),e.status&&t.set(`status`,e.status),e.effect&&t.set(`effect`,e.effect),d(`/api/endpoint-tools/invocations?${t}`)}async function ge(){return q(await l(me()))}async function _e(e){let t=Array.from({length:Math.ceil(e.length/100)},(t,n)=>e.slice(n*100,(n+1)*100));await Promise.all(t.map(async e=>{await q(await l(d(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function ve(e){return q(await l(he(e)))}async function ye(e,t,n){await q(await l(d(`/api/endpoint-tools/devices/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({nickname:t,expectedRevision:n})}))}var be=5e3,J=20,xe=20;function Se(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function Ce(e){let t=(0,z.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=c(`rounded-full px-2 py-0.5 text-xs font-medium`,Se(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,V.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function we(){let e=u(e=>e.language),t=s(e).endpointToolsSettings,[n,r]=i(),a=n.get(`view`)===`activity`?`activity`:`devices`,[o,l]=(0,B.useState)(null),[d,f]=(0,B.useState)([]),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(``),[x,ee]=(0,B.useState)(`active`),[te,R]=(0,B.useState)(``),[z,H]=(0,B.useState)(1),[U,W]=(0,B.useState)(()=>new Set),[le,K]=(0,B.useState)(``),[ue]=k(le,250),[fe,pe]=(0,B.useState)(``),[q,Se]=(0,B.useState)(``),[we,Te]=(0,B.useState)(``),[Ee,Y]=(0,B.useState)(1),De={page:Ee,pageSize:xe,query:ue,principalId:fe,status:q,effect:we},X=y(me(),ge,{refreshInterval:be}),Z=y(a===`activity`?he(De):null,()=>ve(De),{refreshInterval:be,keepPreviousData:!0}),Oe=(0,B.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(X.isLoading&&!X.data)return(0,V.jsx)(I,{children:(0,V.jsx)(C,{sections:2})});let Q=X.data??[],ke=Z.data?.items??[],Ae=Q.filter(e=>G(e)===`online`).length,je=Q.filter(e=>G(e)!==`revoked`).length,Me=Q.filter(e=>ae(e)).length,Ne=[...new Set(Q.map(e=>e.platform))].toSorted(),Pe=oe(Q,{query:_,status:x,platform:te}),Fe=Math.max(1,Math.ceil(Pe.length/J)),$=Math.min(z,Fe),Ie=Pe.slice(($-1)*J,$*J),Le=Ie.reduce((e,t)=>(G(t)!==`revoked`&&e.push(t.id),e),[]),Re=Le.length>0&&Le.every(e=>U.has(e)),ze=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Be=async()=>{await Promise.all([X.mutate(),a===`activity`?Z.mutate():Promise.resolve()])},Ve=async()=>{if(!(d.length===0||p)){m(!0),g(!1);try{await _e(d.map(e=>e.id)),f([]),W(new Set),await X.mutate()}catch{g(!0)}finally{m(!1)}}},He=e=>{e(),H(1),W(new Set)};return(0,V.jsxs)(I,{children:[(0,V.jsx)(F,{title:t.title,subtitle:t.subtitle,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(E,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Be}),(0,V.jsx)(de,{onPaired:()=>void X.mutate()})]})}),X.error||Z.error?(0,V.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,V.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:je,filter:`active`},{label:t.onlineDevices,value:Ae,filter:`online`},{label:t.staleDevices,value:Me,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,V.jsxs)(`button`,{type:`button`,className:c(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,x===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":x===n,onClick:()=>{He(()=>ee(n)),ze(`devices`)},children:[(0,V.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,V.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,V.jsx)(M,{items:[{id:`devices`,label:t.devicesTab,icon:j,count:je},{id:`activity`,label:t.activityTab,icon:S,count:Z.data?.total}],activeTab:a,onChange:ze,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,V.jsxs)(L,{id:`devices`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,V.jsx)(re,{devices:Q,zh:e===`zh`}),(0,V.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,V.jsxs)(`label`,{className:`relative block`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,V.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,V.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:_,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>He(()=>v(e.target.value))})]}),(0,V.jsx)(O,{value:x,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>He(()=>ee(e))}),(0,V.jsx)(O,{value:te,options:Ne.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>He(()=>R(e))})]}),U.size>0?(0,V.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(U.size))}),(0,V.jsxs)(b,{variant:`secondary`,className:`text-danger`,onClick:()=>{g(!1),f(Q.filter(e=>U.has(e.id)))},children:[(0,V.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Q.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Pe.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,V.jsxs)(`label`,{className:c(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Le.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,V.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Re,disabled:Le.length===0,className:`size-4 accent-accent`,onChange:e=>{W(t=>{let n=new Set(t);for(let t of Le)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,V.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Ie.map(e=>{let n=G(e),r=e.kind===`mobile`?w:P;return(0,V.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`label`,{className:c(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,V.jsx)(`input`,{type:`checkbox`,checked:U.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{W(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,V.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>l(e),children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,V.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,V.jsx)(Ce,{status:n,label:t.status[n]})]}),(0,V.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,se(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Oe.format(e.lastSeenAt):t.never]})]}),(0,V.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(ie(e)))}),(0,V.jsx)(D,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String(($-1)*J+1)).replace(`{{to}}`,String(Math.min($*J,Pe.length))).replace(`{{total}}`,String(Pe.length))}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:$<=1,onClick:()=>H(e=>Math.max(1,e-1)),children:(0,V.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:$>=Fe,onClick:()=>H(e=>Math.min(Fe,e+1)),children:(0,V.jsx)(D,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,V.jsxs)(L,{id:`activity`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,V.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,V.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,V.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,V.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:le,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{K(e.target.value),Y(1)}})]}),(0,V.jsx)(O,{value:fe,options:Q.map(e=>({value:e.id,label:`${e.displayName} · ${se(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{pe(e),Y(1)}}),(0,V.jsx)(O,{value:q,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Se(e),Y(1)}}),(0,V.jsx)(O,{value:we,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Te(e),Y(1)}})]}),Z.isLoading&&!Z.data?(0,V.jsx)(C,{sections:1}):null,ke.length===0&&!Z.isLoading?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,V.jsx)(`div`,{className:`space-y-2`,children:ke.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,V.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Oe.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,V.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,V.jsx)(Ce,{status:e.status,label:t.status[e.status]})]},e.id))}),Z.data&&Z.data.total>0?(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Z.data.page-1)*Z.data.pageSize+1)).replace(`{{to}}`,String(Math.min(Z.data.page*Z.data.pageSize,Z.data.total))).replace(`{{total}}`,String(Z.data.total))}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Z.data.page<=1,onClick:()=>Y(e=>Math.max(1,e-1)),children:(0,V.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Z.data.page>=Z.data.totalPages,onClick:()=>Y(e=>Math.min(Z.data.totalPages,e+1)),children:(0,V.jsx)(D,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,V.jsx)(ce,{device:o,busy:p,onRename:async(e,t)=>{await ye(e.id,t,e.settingsRevision??0),l((await X.mutate())?.find(t=>t.id===e.id)??null)},onClose:()=>l(null),onRevoke:e=>{l(null),g(!1),f([e])}}),(0,V.jsx)(T,{open:d.length>0,title:d.length>1?t.removeManyTitle:t.removeTitle,description:`${d.length>1?t.removeManyDescription.replace(`{{count}}`,String(d.length)):t.removeDescription.replace(`{{name}}`,d[0]?.displayName??``)}${h?`\n\n${t.revokeError}`:``}`,confirmLabel:p?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Ve(),onCancel:()=>{p||f([])}})]})}export{we as EndpointToolsManagementSettings};
@@ -1 +0,0 @@
1
- import{Vc as e}from"./index-CKdOZoVu.js";export{e as Mermaid};
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-_Y-QwZ-3.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CKdOZoVu.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-CE7L6MlS.js","assets/messages-CaeL_miw.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-PrKvVpRh.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-B2HK1psj.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-BV_eGr7l.js","assets/product-delivery-DwmnNJvk.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/session-manager-DoFTlgNz.js","assets/gateway-realtime-Dng_VOvI.js","assets/gateway-realtime-store-DtlBf7oH.js","assets/local-session-drafts-CYEDUPH7.js","assets/session-api-CaAUJvu1.js","assets/gateway-startup-retry-CDCiy7Cd.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BO2Ck3aA.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-B5aykqg_.js","assets/gateway-config-swr-BEePO3Wl.js","assets/capabilities-pt2M56-E.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/files-Bw4SBGdM.js","assets/index-Rxjt-jc3.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-BYNLO2pt.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{d as a,f as o,t as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./download-Dk-ZjtO6.js";import{t as f}from"./ellipsis-0k4rZLoy.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./eye-CABVeTq0.js";import{P as h}from"./markdown-view-PrKvVpRh.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./messages-CaeL_miw.js";import{t as v}from"./cn-0WouolD0.js";import{a as y,c as b,f as x,n as S,p as C,r as w}from"./locale-store-CE7L6MlS.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./dist-BGTk37IG.js";import{t as M}from"./session-manager-DoFTlgNz.js";import{t as N}from"./copy-to-clipboard-HOJ79TWv.js";import{i as P}from"./vendor-swr-BIWyz7Rc.js";import{$n as F,$r as I,Al as L,Ar as R,Cr as z,Cs as B,Dr as V,Ds as ee,Hc as H,Hu as te,Ic as ne,It as re,Lu as ie,Mr as ae,N as U,Od as W,Ol as G,Or as oe,P as se,Pr as ce,Qr as K,Rs as le,Ss as ue,Ta as de,Tf as fe,Ts as pe,Ud as q,Ul as me,Uo as he,Vl as ge,Xa as _e,Yl as ve,Zr as ye,Zu as be,_a as xe,_n as Se,_r as Ce,a as J,au as Y,br as we,c as X,cn as Te,ei as Ee,er as De,eu as Oe,fr as ke,gn as Ae,gr as je,hr as Me,ir as Ne,jl as Pe,jr as Fe,kr as Ie,l as Le,ln as Re,lr as ze,ls as Be,mr as Ve,nr as He,o as Ue,on as We,pd as Ge,pr as Ke,pu as qe,rr as Je,s as Z,sf as Ye,sn as Xe,tr as Ze,un as Qe,ur as $e,us as et,va as tt,vn as nt,vr as rt,vu as it,wa as at,wf as ot,ws as st,xa as ct,xr as lt,yn as ut,zl as dt}from"./index-CKdOZoVu.js";import{n as ft,t as pt}from"./note-image-lightbox-BYNLO2pt.js";import{t as mt}from"./page-context-capture-button-Cn_WK68Y.js";var Q=e(t(),1),ht=n(),$=r(),gt=6e4,_t=36e5,vt=864e5;function yt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function bt(e,t,n){let r=t-e;if(r<gt)return n.justNow;if(r<_t){let e=Math.floor(r/gt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=yt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-vt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*vt){let e=Math.floor(r/vt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function xt(e,t,n){let r=yt(t);if(e>=r)return n.today;if(e>=r-vt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function St(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Ct(e){let t=(0,ht.c)(45),{title:n,description:r,prompt:i,coverage:a,className:s,variant:c}=e,u=c===void 0?`card`:c,d=S(Et),f=_(d).automations.suggestions,p=_(d).automations,m=o(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=P(a?`automation-suggestion-coverage`:null,Tt,h),y=a?g?.automations.find(e=>X(e,a)):void 0,b=y?Ue(y,p):[];if(u===`titleAction`){if(y){let e;t[1]===s?e=t[2]:(e=v(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(H,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=v(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(be,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(H,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[u,f.setup]})]})}if(y){let e;t[16]===s?e=t[17]:(e=v(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(H,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Z(f.coveredDescription,{name:y.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.map(wt)})]}),i]})}let x;t[24]===s?x=t[25]:(x=v(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=x);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(be,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===n?w=t[28]:(w=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=w);let T;t[29]===r?T=t[30]:(T=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=T);let E;t[31]!==w||t[32]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[C,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]})]}),t[31]=w,t[32]=T,t[33]=E):E=t[33];let D;t[34]!==m||t[35]!==i?(D=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==f.create||t[39]!==D?(k=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(H,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,f.create]})}),t[38]=f.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==x||t[43]!==E?(A=(0,$.jsxs)(`section`,{className:x,children:[E,k]}),t[41]=k,t[42]=x,t[43]=E,t[44]=A):A=t[44],A}function wt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Tt(){return Le.list()}function Et(e){return e.language}function Dt(e){let t=(0,ht.c)(93),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,pageText:c,editing:l,onOrganize:u,onRegenerate:p,onPersonalNotes:m,noteActions:h}=e,[g,_]=(0,Q.useState)(!1),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{_(!1),e()},t[0]=v):v=t[0];let y=v,b=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,x=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,S=a?`更多笔记操作`:`More note actions`,C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(f,{className:`size-5`,"aria-hidden":!0}),t[1]=C):C=t[1];let T;t[2]===S?T=t[3]:(T=(0,$.jsx)(pe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":S,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:C})}),t[2]=S,t[3]=T);let E=a?`笔记工具`:`Note tools`,D;t[4]!==m||t[5]!==a?(D=m?(0,$.jsxs)(H,{className:`min-h-11 w-full justify-start`,onClick:()=>y(m),children:[(0,$.jsx)(ge,{className:`size-4`}),a?`添加我的补充`:`Add my notes`]}):null,t[4]=m,t[5]=a,t[6]=D):D=t[6];let O;t[7]!==h||t[8]!==a?(O=h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(H,{className:`min-h-11 w-full justify-start`,disabled:h.busy,onClick:()=>y(h.onAnalyze),children:[(0,$.jsx)(me,{className:`size-4`}),a?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(H,{className:`min-h-11 w-full justify-start`,disabled:h.busy,onClick:()=>y(h.onChat),children:[(0,$.jsx)(ie,{className:`size-4`}),a?`就这篇笔记提问`:`Ask about this note`]})]}):null,t[7]=h,t[8]=a,t[9]=O):O=t[9];let k=a?`整理笔记`:`Organize notes`,A;t[10]===k?A=t[11]:(A=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:k}),t[10]=k,t[11]=A);let j=a?`纪要模板`:`Summary template`,M;t[12]===i?M=t[13]:(M=e=>i(e.target.value),t[12]=i,t[13]=M);let N=a?`通用会议`:`General`,P;t[14]===N?P=t[15]:(P=(0,$.jsx)(et,{value:`general`,children:N}),t[14]=N,t[15]=P);let F=a?`项目例会`:`Project`,I;t[16]===F?I=t[17]:(I=(0,$.jsx)(et,{value:`project`,children:F}),t[16]=F,t[17]=I);let L=a?`需求评审`:`Review`,R;t[18]===L?R=t[19]:(R=(0,$.jsx)(et,{value:`review`,children:L}),t[18]=L,t[19]=R);let z=a?`客户访谈`:`Interview`,V;t[20]===z?V=t[21]:(V=(0,$.jsx)(et,{value:`interview`,children:z}),t[20]=z,t[21]=V);let ee;t[22]!==j||t[23]!==M||t[24]!==P||t[25]!==I||t[26]!==R||t[27]!==V||t[28]!==r?(ee=(0,$.jsxs)(Be,{value:r,"aria-label":j,onChange:M,children:[P,I,R,V]}),t[22]=j,t[23]=M,t[24]=P,t[25]=I,t[26]=R,t[27]=V,t[28]=r,t[29]=ee):ee=t[29];let te=o||s||!n.discussion.canonicalTranscript,ne;t[30]===u?ne=t[31]:(ne=()=>y(u),t[30]=u,t[31]=ne);let re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(Y,{className:`size-4`}),t[32]=re):re=t[32];let ae=a?`重新整理纪要`:`Regenerate summary`,U;t[33]!==te||t[34]!==ne||t[35]!==ae?(U=(0,$.jsxs)(H,{className:`min-h-11 w-full justify-start`,disabled:te,onClick:ne,children:[re,ae]}),t[33]=te,t[34]=ne,t[35]=ae,t[36]=U):U=t[36];let W;t[37]!==x||t[38]!==o||t[39]!==n.discussion.status||t[40]!==p||t[41]!==s||t[42]!==a?(W=x&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsx)(H,{className:`min-h-11 w-full justify-start`,disabled:o||s,onClick:()=>y(p),children:a?`从原音重新生成`:`Regenerate from audio`}):null,t[37]=x,t[38]=o,t[39]=n.discussion.status,t[40]=p,t[41]=s,t[42]=a,t[43]=W):W=t[43];let G;t[44]!==ee||t[45]!==U||t[46]!==W||t[47]!==A?(G=(0,$.jsxs)(`div`,{className:`space-y-2 py-3`,children:[A,ee,U,W]}),t[44]=ee,t[45]=U,t[46]=W,t[47]=A,t[48]=G):G=t[48];let oe=a?`导出与分享`:`Export and share`,se;t[49]===oe?se=t[50]:(se=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:oe}),t[49]=oe,t[50]=se);let ce;t[51]!==x||t[52]!==b||t[53]!==a?(ce=x?(0,$.jsxs)(`a`,{className:`flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:w(`${b}/audio`),download:!0,children:[(0,$.jsx)(d,{className:`size-4`}),a?`下载录音`:`Download recording`]}):null,t[51]=x,t[52]=b,t[53]=a,t[54]=ce):ce=t[54];let K;t[55]!==h||t[56]!==a?(K=h?(0,$.jsx)(H,{className:`min-h-11 w-full justify-start`,disabled:h.busy,onClick:()=>y(h.onShare),children:a?`分享笔记`:`Share note`}):null,t[55]=h,t[56]=a,t[57]=K):K=t[57];let le;t[58]===b?le=t[59]:(le=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`md`,`txt`,`srt`].map(e=>(0,$.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:w(`${b}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))}),t[58]=b,t[59]=le);let de=n.note.id,fe=String(n.note.remoteVersion??1),q;t[60]!==n.note.id||t[61]!==fe?(q={kind:`note`,id:de,revision:fe},t[60]=n.note.id,t[61]=fe,t[62]=q):q=t[62];let he;t[63]===c?he=t[64]:(he={text:c,draft:!1},t[63]=c,t[64]=he);let _e=a?`带到新对话`:`Use in a new chat`,ve=o||s||l||!c||c.length>16e3,ye;t[65]!==q||t[66]!==he||t[67]!==_e||t[68]!==ve?(ye=(0,$.jsx)(mt,{resource:q,selection:he,label:_e,disabled:ve}),t[65]=q,t[66]=he,t[67]=_e,t[68]=ve,t[69]=ye):ye=t[69];let be=c.length>16e3?a?`内容较长,请先筛选部分原文。`:`Filter the transcript to share a smaller selection.`:a?`分享当前显示的文字,不包含原音。`:`Shares displayed text, without audio.`,xe;t[70]===be?xe=t[71]:(xe=(0,$.jsx)(`p`,{className:`px-2 text-xs leading-5 text-fg-muted`,children:be}),t[70]=be,t[71]=xe);let Se;t[72]!==se||t[73]!==ce||t[74]!==K||t[75]!==le||t[76]!==ye||t[77]!==xe?(Se=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle py-3`,children:[se,ce,K,le,ye,xe]}),t[72]=se,t[73]=ce,t[74]=K,t[75]=le,t[76]=ye,t[77]=xe,t[78]=Se):Se=t[78];let Ce;t[79]!==h||t[80]!==a?(Ce=h?(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(H,{className:`min-h-11 w-full justify-start`,onClick:()=>y(h.onHistory),children:a?`版本历史`:`Version history`}),(0,$.jsx)(H,{className:`min-h-11 w-full justify-start text-danger`,disabled:h.busy,onClick:()=>y(h.onDelete),children:a?`删除笔记`:`Delete note`})]}):null,t[79]=h,t[80]=a,t[81]=Ce):Ce=t[81];let J;t[82]!==G||t[83]!==Se||t[84]!==Ce||t[85]!==E||t[86]!==D||t[87]!==O?(J=(0,$.jsx)(B,{children:(0,$.jsxs)(ue,{align:`end`,sideOffset:6,collisionPadding:12,"aria-label":E,className:`z-[140] max-h-[min(38rem,var(--radix-popover-content-available-height,85dvh))] w-[min(20rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 text-fg shadow-elevated`,children:[D,O,G,Se,Ce]})}),t[82]=G,t[83]=Se,t[84]=Ce,t[85]=E,t[86]=D,t[87]=O,t[88]=J):J=t[88];let we;return t[89]!==g||t[90]!==T||t[91]!==J?(we=(0,$.jsxs)(st,{open:g,onOpenChange:_,children:[T,J]}),t[89]=g,t[90]=T,t[91]=J,t[92]=we):we=t[92],we}var Ot=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function kt({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(0),[v,b]=(0,Q.useState)(),[x,S]=(0,Q.useState)(),[C,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>D(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{S(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++_.current,r=new AbortController;f(!0),g(!1),m(``);let a=window.setTimeout(()=>{y(w(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{_.current===n&&(u(e),b(i),T(t))}).catch(e=>{_.current===n&&!r.signal.aborted&&m(String(e))}).finally(()=>{_.current===n&&f(!1)})},t?200:0);return()=>{_.current++,r.abort(),window.clearTimeout(a)}},[e,t,r,i,E]);async function O(){if(!l||h)return;let r=_.current;g(!0);try{let n=await y(w(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${l.hits.length}&version=${l.version}`));r===_.current&&u({...n,hits:[...l.hits,...n.hits]})}catch(e){r===_.current&&m(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{g(!1)}}function k(e){S(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:l?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let A=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,j=e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>k(e),children:[e.startedAtMs===void 0?``:`${Ot(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Ot(e.endedAtMs)}`} · `,e.title||A(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[A(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||x?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Ot(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(H,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Ot(e.startedAtMs),`–`,Ot(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(H,{onClick:()=>k(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[p?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p}),(0,$.jsx)(H,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`})]}):null,d&&(!l||v!==i||C!==t)?(0,$.jsx)(ne,{className:`h-20 w-full`}):null,l&&v===i&&(!t||C===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,$.jsx)(H,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:l.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,l.coverage.durationMs))}%`},"aria-label":`${Ot(e.startedAtMs)} ${e.title||A(e)}`,onClick:()=>k(e)},e.id))}),l.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(j)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&l.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,l.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(j)})]}):null,l.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(j)]}):null]}),l.hasMore?(0,$.jsx)(H,{disabled:h,onClick:()=>void O(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,Ot(l.coverage.processedMs),` / `,Ot(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Ot(l.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Ot(e.startedAtMs)}–${Ot(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,l.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,l.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),x?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function At({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=P(`/api/discussions/${t}/annotations`,e=>y(w(e))),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),h=(0,Q.useCallback)(async()=>{c(await Te(e))},[e]),g=(0,Q.useCallback)(async()=>{try{await We(e,t),await h(),await o()}catch(e){await o(),m(e instanceof Error?e.message:String(e))}},[e,t,h,o]);(0,Q.useEffect)(()=>{h().catch(e=>m(String(e))),g();let e=()=>{h().catch(e=>m(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,g);let t=window.setInterval(()=>{navigator.onLine&&g()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,g),window.clearInterval(t)}},[h,g]);let _=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!_.has(e.annotation.id)){let t=_.get(e.annotation.id);_.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let v=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await Qe(e,{...t,updatedAt:Date.now()},n),f(null),m(``),await h(),g()}catch(e){m(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[p?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[p,(0,$.jsx)(H,{onClick:()=>void g(),children:n?`重试同步`:`Retry sync`})]}):null,_.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[..._.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(H,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(H,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(H,{onClick:()=>{u(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),f({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(H,{onClick:()=>void v({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(H,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&Xe(t,n.annotation).then(h)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),d?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(Be,{value:d.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>f({...d,kind:e.target.value}),children:[(0,$.jsx)(et,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(et,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(et,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:d.text,onChange:e=>f({...d,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(H,{onClick:()=>void v(d,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(H,{onClick:()=>f(null),children:n?`取消`:`Cancel`})]}):null]})}var jt={tab:`summary`,query:``,page:1,positionMs:0},Mt=C((e,t)=>({notes:{},update:(n,r)=>{let i={...Pt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Nt=new Map;function Pt(e,t){if(t)return t;if(Nt.has(e))return Nt.get(e);let n=jt;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...jt,...t})}catch{}return Nt.set(e,n),n}function Ft(e){let t=(0,ht.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(A,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,$.jsx)(H,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==i||t[32]!==s.text?(w=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=w):w=t[33];let E;t[34]!==s||t[35]!==o?(E=()=>void o(s),t[34]=s,t[35]=o,t[36]=E):E=t[36];let D=r?`保存修改`:`Save changes`,M;t[37]!==w||t[38]!==E||t[39]!==D?(M=(0,$.jsx)(H,{variant:`primary`,disabled:w,onClick:E,children:D}),t[37]=w,t[38]=E,t[39]=D,t[40]=M):M=t[40];let N;t[41]!==C||t[42]!==M?(N=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,M]}),t[41]=C,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==x||t[45]!==N||t[46]!==f?(P=(0,$.jsxs)(O,{children:[u,(0,$.jsxs)(k,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,x,N]})]}),t[44]=x,t[45]=N,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,$.jsx)(j,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function It(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var Lt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Rt({noteId:e,onPersonalNotes:t,noteActions:n}){let r=a(),i=S(e=>e.language)===`zh`,{data:o,mutate:l,isLoading:u}=P([`note-discussion-document`,e],()=>Ae(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),d=o?.discussion.id,f=`/api/discussions/${encodeURIComponent(d??``)}`,{data:p=[],mutate:m}=P(d?`${f}/actions`:null,e=>y(w(e)),{refreshInterval:1e4}),_=Mt(t=>Pt(e,t.notes[e])),v=Mt(e=>e.update),b=_.tab,x=t=>v(e,{tab:t}),C=_.query,E=t=>v(e,{query:t}),[D,M]=(0,Q.useState)(!1),N=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{D&&N.current?.focus()},[D]);let[F,I]=(0,Q.useState)(`general`),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,ee]=(0,Q.useState)(null),[te,re]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)([]),[U,W]=(0,Q.useState)(null),[G,oe]=(0,Q.useState)(!1),se=_.page,ce=t=>v(e,{page:t}),K=(0,Q.useRef)(null),[le,ue]=(0,Q.useState)([]),de=(0,Q.useRef)(0),fe=(0,Q.useRef)(0),pe=(0,Q.useRef)(o?.transcript.revision);pe.current=o?.transcript.revision;let q=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[,he]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{l(),m()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[l,m]),(0,Q.useEffect)(()=>{o?.discussion.template&&I(o.discussion.template)},[o?.discussion.template]);async function _e(e){if(!G){oe(!0),W(null);try{await e(),await l(),await m()}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(!1)}}}function ve(e,t){q.current&&(K.current=t??null,q.current.readyState===0?(me.current=e/1e3,q.current.load()):(q.current.currentTime=e/1e3,q.current.play().catch(()=>void 0)))}function ye(e){let t=e.stale||e.transcriptRevision!==pe.current;R({...e,stale:t}),t||ue(e.segments.map(e=>e.sequence))}async function be(e,t,n=!1){if(!o)return;let r=de.current,i=++fe.current;await _e(async()=>{let a=await y(w(`${f}/evidence?revision=${t??o.organization?.transcriptRevision??o.transcript.revision}&segments=${e.join(`,`)}`));if(!(r!==de.current||i!==fe.current)&&(ye(a),n&&a.segments[0]?.playback[0])){let e=a.segments[0].playback[0];ve(e.startedAtMs,e.endedAtMs)}})}async function xe(e){o&&await _e(async()=>{await Qe(o.discussion.clientRequestId,Re({type:`transcript`,capturedAt:Date.now(),transcriptRevision:o.transcript.revision,segmentIds:[e.sequence]})),x(`marks`),We(o.discussion.clientRequestId,o.discussion.id).catch(e=>W(String(e)))})}(0,Q.useEffect)(()=>(de.current++,R(null),ue([]),B(null),ee(null),ae([]),W(null),K.current=null,()=>{de.current++}),[e]),(0,Q.useEffect)(()=>{let t=o?.discussion.audioSha256??o?.discussion.audioAttachmentId;if(!t)return;let n=Pt(e,Mt.getState().notes[e]);n.source&&n.source!==t?(de.current++,R(null),ue([]),q.current?.pause(),v(e,{positionMs:0,source:t}),me.current=0,K.current=null):v(e,{source:t})},[e,o?.discussion.audioSha256,o?.discussion.audioAttachmentId,v]),(0,Q.useEffect)(()=>{o?.discussion.audioDeletedAt&&(q.current?.pause(),me.current=null,K.current=null,R(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[o?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{_.tab===`transcript`&&_.anchor!==void 0&&_.anchorRevision===o?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${_.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[_.tab,_.anchor,_.anchorRevision,o?.transcript.revision]),(0,Q.useEffect)(()=>{ue([]),R(e=>e&&e.transcriptRevision!==o?.transcript.revision?{...e,stale:!0}:e)},[o?.transcript.revision]);let Ce=(e,t,n)=>t.some(e=>te||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>te||!e.ignored).map(e=>(0,$.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:G,onClick:()=>ee({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:i?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:G,className:`shrink-0 text-accent-fg`,onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无定位`:`No source timing`})]},e.id))]}):null;if(u)return(0,$.jsx)(ne,{className:`h-48 w-full`});if(!o)return null;let{discussion:J,transcript:Y,organization:we}=o,X=we?.organization,Te=[`stopping`,`sealing`,`organizing`].includes(J.status),Ee=[`recording`,`completed`,`needs_attention`].includes(J.status),De=Y.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(C.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(C.toLocaleLowerCase())),ke=b===`marks`||C.trim()?``:It(o,b,{query:C,page:se,showIgnored:te});return(0,$.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),M(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 px-5 pb-3 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold leading-snug tracking-tight`,children:!o.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(o.note.title)?i?`语音笔记`:`Voice note`:o.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[i?`录音`:`Recording`,` · `,Lt(J.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":i?`搜索此 Note`:`Search this Note`,"aria-expanded":D||!!C,onClick:()=>{M(e=>!e),D&&E(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Oe,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Dt,{noteActions:n,detail:o,template:F,onTemplate:I,zh:i,busy:G,processing:Te,pageText:ke,editing:!!V||!!z,onPersonalNotes:t,onOrganize:()=>void _e(()=>y(w(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:F})})),onRegenerate:()=>void _e(()=>Se(J.id,`from_audio`))})]}),(0,$.jsx)(`nav`,{"aria-label":i?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-1 rounded-xl bg-surface-inset p-1 sm:mx-7`,children:[`summary`,`transcript`,`marks`].map(e=>(0,$.jsx)(`button`,{"aria-pressed":b===e,className:`min-h-11 min-w-0 flex-1 rounded-lg px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${b===e?`bg-surface-panel font-medium text-fg shadow-sm`:`text-fg-muted hover:text-fg`}`,onClick:()=>x(e),children:e===`summary`?i?`概览`:`Overview`:e===`marks`?i?`标记`:`Highlights`:i?`原文`:`Transcript`},e))}),U?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:i?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:U})]}):null,D||C?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(Oe,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:N,"aria-label":i?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:i?`搜索这篇笔记`:`Search this note`,value:C,onChange:e=>{E(e.target.value),ce(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`关闭搜索`:`Close search`,onClick:()=>{E(``),M(!1)},children:(0,$.jsx)(g,{className:`size-4`})})]}):null,(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7`,children:[J.status!==`recording`||o.recordingJob?(0,$.jsx)(nt,{context:`note`,input:ut(o),zh:i,busy:G,onRetry:e=>void _e(()=>e===`analyze`?y(w(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:F})}):Se(J.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{hidden:!!C.trim(),children:b===`marks`?(0,$.jsx)(At,{recordingId:J.clientRequestId,discussionId:J.id,zh:i,onEvidence:ye,onPlay:e=>ve(e.startedAtMs,e.endedAtMs)},J.id):b===`summary`?X?(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`摘要`:`Summary`}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`编辑概要`:`Edit overview`,title:i?`编辑概要`:`Edit overview`,disabled:G||Te,onClick:()=>ee({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(H,{onClick:()=>void be(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[i?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:i?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(H,{onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`})]},e.id))]}):X.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:X.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:te,onChange:e=>re(e.target.checked)}),i?`显示已忽略项`:`Show ignored items`]}):null,ie.length?(0,$.jsx)(H,{disabled:G,onClick:()=>void _e(async()=>{for(let e of ie)await y(w(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:we.revision})});ae([])}),children:i?`加入所选 ${ie.length} 项任务`:`Add ${ie.length} selected tasks`}):null,Ce(i?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>te||!e.ignored).map(e=>{let t=p.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${i?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:ie.includes(e.id),onChange:t=>ae(t.target.checked?[...ie,e.id]:ie.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:G||Te,onClick:()=>ee({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:i?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(i?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(i?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:G,className:`text-accent-fg`,onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:i?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(s,{className:`text-accent-fg`,to:h(`${r.pathname}${r.search}`,t.taskId),children:t.resolution===`done`?i?`已完成 · 查看任务`:`Done · View task`:i?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(H,{disabled:G||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void _e(()=>y(w(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:we.revision})})),children:i?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Ce(i?`风险`:`Risks`,X.risks,`risks`),Ce(i?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`前后变更`:`Changes during the meeting`}),X.changes.map(e=>{let t=[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?i?`后续撤销或替代`:`Later superseded`:i?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void be(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void be(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 py-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:Y.text?i?`录音摘录`:`From your recording`:i?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Y.text?`text-fg`:`text-fg-muted`}`,children:Y.text?Y.text.slice(0,400)+(Y.text.length>400?`…`:``):i?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Y.text?(0,$.jsx)(H,{className:`min-h-11`,onClick:()=>x(`transcript`),children:i?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[De.slice(0,se*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${le.includes(e.sequence)||_.anchor===e.sequence&&_.anchorRevision===Y.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!J.audioAttachmentId||!!J.audioDeletedAt,onClick:()=>void be([e.sequence],Y.revision,!0),children:[(0,$.jsx)(qe,{className:`size-3`}),Lt(e.startedAtMs)]}),e.status===`confirmed`?(0,$.jsx)(`button`,{onClick:()=>void xe(e),children:i?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(i?`未区分说话人`:`Speaker unknown`)}),Ee&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>B({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:i?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(i?`等待转写`:`Awaiting transcription`)})]},e.sequence)),De.length>se*50?(0,$.jsx)(H,{onClick:()=>ce(se+1),children:i?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(kt,{id:J.id,query:C.trim(),zh:i,sourceKey:`${J.audioSha256}:${J.audioDeletedAt}`,active:Te||J.status===`recording`,tab:b,refreshKey:`${J.updatedAt}:${Y.revision}:${we?.revision}`,onEvidence:ye,onPlay:ve},J.id)})]}),J.audioAttachmentId&&!J.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:q,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:w(`${f}/audio`),onTimeUpdate:()=>{let t=(q.current?.currentTime??0)*1e3;he(t),v(e,{positionMs:t}),K.current!==null&&t>=K.current&&(q.current?.pause(),K.current=null)},onLoadedMetadata:()=>{me.current!==null&&q.current?(q.current.currentTime=me.current,me.current=null,q.current.play().catch(()=>void 0)):q.current&&(q.current.currentTime=_.positionMs/1e3)},onError:()=>W(i?`录音暂不可播放`:`Recording unavailable`)})}):null,L?(0,$.jsxs)(`aside`,{"aria-label":i?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[i?`原话证据`:`Source evidence`,` · v`,L.transcriptRevision]}),(0,$.jsx)(`button`,{"aria-label":i?`关闭`:`Close`,onClick:()=>R(null),children:(0,$.jsx)(g,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),L.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!L.audioAvailable||!L.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,L.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Lt(t.startedAtMs),`–`,Lt(t.endedAtMs),` · `,t.speakerLabel??(i?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(H,{onClick:()=>ve(e.startedAtMs,e.endedAtMs),children:[i?`播放原话`:`Play source`,` `,Lt(e.startedAtMs),`–`,Lt(e.endedAtMs)]},t)),L.stale?null:(0,$.jsx)(H,{onClick:()=>{E(``),ce(Math.max(se,Math.ceil((Y.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),x(`transcript`),ue([t.sequence]),R(null),v(e,{anchor:t.sequence,anchorRevision:Y.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:i?`定位原文`:`Locate transcript`})]},t.sequence))]})]}):null,V&&we?(0,$.jsx)(Ft,{initial:V,zh:i,busy:G,onClose:()=>ee(null),onSave:e=>_e(async()=>{await y(w(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:we.revision})}),ee(null)})},`${V.kind}:${V.itemId}:${we.revision}`):null,z?(0,$.jsx)(j,{open:!0,onOpenChange:e=>{e||B(null)},children:(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(k,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(A,{children:i?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":i?`关闭校对`:`Close editor`,onClick:()=>B(null),children:(0,$.jsx)(g,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[i?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.speaker,onChange:e=>B({...z,speaker:e.target.value})})]}),z.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!z.applyToSpeakerGroup,onChange:e=>B({...z,applyToSpeakerGroup:e.target.checked})}),i?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:z.text,onChange:e=>B({...z,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(H,{variant:`primary`,disabled:G||!z.text.trim(),onClick:()=>void _e(async()=>{await y(w(`${f}/segments/${z.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:z.text,speakerLabel:z.speaker,expectedRevision:z.segment.revision,applyToSpeakerGroup:z.applyToSpeakerGroup,expectedTranscriptRevision:Y.revision})}),B(null)}),children:[(0,$.jsx)(c,{className:`size-4`}),i?`保存修订`:`Save revision`]})})]})]})}):null]})}var zt={edit:it,ai_edit:me,sync:Y,restore:fe};function Bt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Vt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=S(e=>e.language),o=_(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:x(a)},{data:c}=P(e?[`note-history`,e]:null,()=>rt(e)),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=(0,Q.useCallback)(async t=>{u(!0),m(null);try{await Fe(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(g,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=zt[e.trigger]??it,i=t===e.timestamp,a=d===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:v(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Bt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:bt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Ht({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=_(S(e=>e.language)).notes,d=o(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Q.useState)(null),[g,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:C}=P(e?[`note-agent-context-status`,e]:null,()=>Me(e),{revalidateOnFocus:!1}),w=(0,Q.useCallback)(async()=>{if(!g){y(!0),h(null);try{await x(()=>V(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[g,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),T=(0,Q.useCallback)(async t=>{try{await oe(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(ot,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:C||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),m?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:v(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(L,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:v(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var Ut=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Wt({open:e,onOpenChange:t,note:n}){let r=S(e=>e.language)===`zh`,i=r?Jt:Yt,{data:a,mutate:o}=P(e?[`note-shares`,n.id]:null,()=>we(n.id)),s=P(e?`hosted-share-auth-status`:null,ct),l=s.data===!0,d=P(e&&l?`hosted-publication-capabilities`:null,tt),f=d.data?.publishing.allowed===!0,m=P(e&&l?[`hosted-note-publications`,n.id]:null,()=>Ce(n.id)),[h,_]=(0,Q.useState)(new Set),[v,y]=(0,Q.useState)(`86400000`),[b,x]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),[M,F]=(0,Q.useState)(`hosted`),[I,L]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(null),[V,ee]=(0,Q.useState)(null),[ne,ie]=(0,Q.useState)(!1),[ae,U]=(0,Q.useState)(null),W=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(_(new Set(W.map(e=>e.id))),ee(null),ie(!1),U(null))},[e,W]);let G=async()=>{L(!0),U(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...h],ttlMs:Number(v),maxViews:b.trim()?Number(b):null,description:C.trim()||void 0};M===`hosted`?(ee((await $e(n.id,e)).shareUrl),await m.mutate()):(ee((await ke(n.id,e)).payload.shareUrl),await o())}catch(e){U(e instanceof Error?e.message:String(e))}finally{L(!1)}},oe=async(e,t)=>{B(e.id),U(null);try{t===`refresh`?await Ie(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...h]}):await at(e.id),await m.mutate()}catch(e){U(e instanceof Error?e.message:String(e))}finally{B(null)}},se=async(e,t)=>{B(e.id),U(null);try{t===`refresh`?await R(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...h]}):t===`extend`?await xe(e.id,864e5):await de(e.id),await o()}catch(e){U(e instanceof Error?e.message:String(e))}finally{B(null)}},ce=async e=>{U(null);try{if(!await N(e)){ie(!1),U(i.copyFailed);return}ie(!0),window.setTimeout(()=>ie(!1),1500)}catch{ie(!1),U(i.copyFailed)}};return(0,$.jsx)(j,{open:e,onOpenChange:t,children:(0,$.jsxs)(O,{children:[(0,$.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(k,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(A,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(ve,{className:`size-4`}),i.title]}),(0,$.jsx)(E,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(g,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),W.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:W.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:h.has(e.id),onChange:()=>_(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:qt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(Be,{value:M,onChange:e=>F(e.target.value),children:[(0,$.jsx)(et,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(et,{value:`local`,children:i.deliveryLocal})]})]}),M===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(re,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,M===`hosted`&&l&&d.data&&!f?(0,$.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(Be,{value:v,onChange:e=>y(e.target.value),children:Ut.map(e=>(0,$.jsx)(et,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:b,onChange:e=>x(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:C,onChange:e=>w(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),V?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:V,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(H,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ce(V),children:[ne?(0,$.jsx)(c,{className:`size-4`}):(0,$.jsx)(u,{className:`size-4`}),ne?i.copied:i.copy]}),(0,$.jsxs)(H,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(V,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(p,{className:`size-4`}),i.open]})]})}):null,ae?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ae}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Kt,{share:e,busy:z===e.id,t:i,onCopy:ce,onAction:se},e.id))})]}):null,(m.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:m.data.map(e=>(0,$.jsx)(Gt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:z===e.id,publishingAllowed:f,t:i,onCopy:ce,onAction:oe},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(H,{type:`button`,onClick:()=>void G(),disabled:I||M===`hosted`&&(!l||!f),children:[I?(0,$.jsx)(te,{className:`size-4 animate-spin`}):(0,$.jsx)(ve,{className:`size-4`}),I?i.creating:i.create]})]})]})]})})}function Gt(e){let t=(0,ht.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,d=l&&`opacity-60`,f;t[0]===d?f=t[1]:(f=v(`rounded-lg border border-edge-subtle p-3`,d),t[0]=d,t[1]=f);let m=r&&!l?o.stale:l?o.inactive:o.active,h;t[2]===m?h=t[3]:(h=(0,$.jsx)(`span`,{children:m}),t[2]=m,t[3]=h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`span`,{children:`·`}),t[4]=g):g=t[4];let _=n.maxViews===null?``:` / ${n.maxViews}`,y;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==_?(y=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,_]}),t[5]=n.viewCount,t[6]=o.views,t[7]=_,t[8]=y):y=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let x;t[10]!==n.revision||t[11]!==o.revision?(x=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=x):x=t[12];let S;t[13]!==h||t[14]!==y||t[15]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[h,g,y,b,x]}),t[13]=h,t[14]=y,t[15]=x,t[16]=S):S=t[16];let C;t[17]===n.shareUrl?C=t[18]:(C=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=C);let w;t[19]!==S||t[20]!==C?(w=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===i?T=t[23]:(T=i?(0,$.jsx)(te,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=T);let E;t[24]!==w||t[25]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,T]}),t[24]=w,t[25]=T,t[26]=E):E=t[26];let D=!a,O;t[27]!==s||t[28]!==n.shareUrl?(O=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=O):O=t[29];let k;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(u,{className:`size-3.5`}),t[30]=k):k=t[30];let A;t[31]!==o.copy||t[32]!==D||t[33]!==O?(A=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:D,onClick:O,children:[k,o.copy]}),t[31]=o.copy,t[32]=D,t[33]=O,t[34]=A):A=t[34];let j=!a,M;t[35]===n.shareUrl?M=t[36]:(M=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=M);let N;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(p,{className:`size-3.5`}),t[37]=N):N=t[37];let P;t[38]!==o.open||t[39]!==j||t[40]!==M?(P=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:j,onClick:M,children:[N,o.open]}),t[38]=o.open,t[39]=j,t[40]=M,t[41]=P):P=t[41];let F;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(F=r&&!l?(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(Y,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=F):F=t[49];let I;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(I=n.revoked?null:(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(G,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=I):I=t[54];let L;t[55]!==A||t[56]!==P||t[57]!==F||t[58]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[A,P,F,I]}),t[55]=A,t[56]=P,t[57]=F,t[58]=I,t[59]=L):L=t[59];let R;return t[60]!==E||t[61]!==f||t[62]!==L?(R=(0,$.jsxs)(`div`,{className:f,children:[E,L]}),t[60]=E,t[61]=f,t[62]=L,t[63]=R):R=t[63],R}function Kt(e){let t=(0,ht.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=v(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let d=n.stale&&!s?i.stale:s?i.inactive:i.active,f;t[2]===d?f=t[3]:(f=(0,$.jsx)(`span`,{children:d}),t[2]=d,t[3]=f);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let y;t[10]===n.expiresAt?y=t[11]:(y=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=y);let b;t[12]===y?b=t[13]:(b=(0,$.jsx)(`span`,{children:y}),t[12]=y,t[13]=b);let x;t[14]!==b||t[15]!==f||t[16]!==g?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[f,m,g,_,b]}),t[14]=b,t[15]=f,t[16]=g,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,$.jsx)(te,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let T;t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==a||t[29]!==n.shareUrl?(E=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=E):E=t[30];let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(u,{className:`size-3.5`}),t[31]=D):D=t[31];let O;t[32]!==i.copy||t[33]!==E?(O=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.copy]}),t[32]=i.copy,t[33]=E,t[34]=O):O=t[34];let k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(p,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==i.open||t[39]!==k?(j=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:k,children:[A,i.open]}),t[38]=i.open,t[39]=k,t[40]=j):j=t[40];let M;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(M=n.stale&&!s?(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=M):M=t[46];let N;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(N=s?null:(0,$.jsx)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=N):N=t[52];let P;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(P=n.revoked?null:(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(G,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=P):P=t[57];let F;t[58]!==O||t[59]!==j||t[60]!==M||t[61]!==N||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[O,j,M,N,P]}),t[58]=O,t[59]=j,t[60]=M,t[61]=N,t[62]=P,t[63]=F):F=t[63];let I;return t[64]!==T||t[65]!==l||t[66]!==F?(I=(0,$.jsxs)(`div`,{className:l,children:[T,F]}),t[64]=T,t[65]=l,t[66]=F,t[67]=I):I=t[67],I}function qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Jt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Yt={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Xt(e){let t=(0,ht.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=K(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=K(u),f=K(Zt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(ye,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,$.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,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`,children:(0,$.jsx)(dt,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Zt(e){return e.stop}function Qt(e,t){let n=I(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=I(e);return!r||n.split(`
3
- `)[0]===r?n:[r,n].filter(Boolean).join(`
4
-
5
- `)}var $t=()=>i(()=>import(`./block-editor-_Y-QwZ-3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57])),en=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([58,1,54,5,59,60,3])),tn=(0,Q.lazy)(()=>$t().then(e=>({default:e.BlockEditor}))),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.MarkdownEditor})));function rn(){let e=(0,ht.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function an(e){let t=(0,ht.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:W},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:q},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:m},t[4]=i.preview,t[5]=s);let l;t[6]!==a||t[7]!==o||t[8]!==s?(l=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,h=on,g;t[13]===p?g=t[14]:(g=(0,$.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=g);let _;t[15]===f.label?_=t[16]:(_=(0,$.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Ye,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==g||t[20]!==_?(y=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":f.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[g,_,v]})}),t[18]=f.label,t[19]=g,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,$.jsx)(Ze,{children:(0,$.jsx)(F,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(De,{onSelect:()=>r(t),onPointerMove:()=>h(t),onFocus:()=>h(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==y?(x=(0,$.jsxs)(He,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function on(e){e===`wysiwyg`&&$t(),e===`source`&&en()}function sn(e){let t=(0,ht.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=S(cn),g;t[0]===h?g=t[1]:(g=_(h),t[0]=h,t[1]=g);let v=g.notes.lightboxClose,y;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(y=(0,$.jsx)(ln,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=y):y=t[12];let b;return t[13]!==v||t[14]!==y?(b=(0,$.jsx)(pt,{closeLabel:v,children:y}),t[13]=v,t[14]=y,t[15]=b):b=t[15],b}function cn(e){return e.language}function ln({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:s,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let p=S(e=>e.language),m=_(p).notes,h=_(p).chat.pageContext,g=_(p).automations.suggestions,{data:y}=P([`note-discussion-document`,e],()=>Ae(e)),[x,C]=(0,Q.useState)(!0),w=o(),T=ee(e=>e.resolved)===`dark`,{openImage:E}=ft(),[D,O]=(0,Q.useState)(u),[k,A]=(0,Q.useState)(null),[j,N]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)(360),[te,ne]=(0,Q.useState)(!1),[re,oe]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{fe.current+=1},[e]);let[pe,q]=(0,Q.useState)(null),[ge,ye]=(0,Q.useState)(!1),[be,xe]=(0,Q.useState)(null),[Se,Ce]=(0,Q.useState)(!1),[Y,we]=(0,Q.useState)(!1),X=(0,Q.useRef)(!1),Te=(0,Q.useRef)(!1),ke=(0,Q.useRef)(null),Me=(0,Q.useRef)(null),Pe=(0,Q.useRef)(null),Fe=(0,Q.useRef)(null),Ie=(0,Q.useRef)(null),Le=(0,Q.useRef)(null),Re=(0,Q.useRef)(null),Be=(0,Q.useRef)(null),Ue=(0,Q.useRef)(null),We=he(e=>e.setPageHeader),qe=he(e=>e.clearPageHeader),{data:Z,mutate:Ye,error:Xe}=P(e?[`note-detail`,e]:null,()=>Ve(e)),{data:Qe=[],mutate:$e}=P(e?[`note-threads`,e]:null,()=>lt(e),{revalidateOnFocus:!1}),et=j!==null,tt=(0,Q.useCallback)(e=>{q(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Ye().catch(tt)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Ye,e,tt]),(0,Q.useEffect)(()=>{X.current=!1,B(``),N(null),A(null),Te.current=!1,Ue.current=null},[e]),(0,Q.useEffect)(()=>{!Z||X.current||(B(Z.title??``),X.current=!0)},[Z]),(0,Q.useEffect)(()=>{if(!l||!Z||et||Ue.current===e)return;let t=window.requestAnimationFrame(()=>{Be.current?.focus(),d?.()});return Ue.current=e,()=>window.cancelAnimationFrame(t)},[l,et,Z,e,d]);let nt=Z?new Date(Z.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,rt=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:v(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,le,i),children:(0,$.jsx)(ot,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),it=(0,Q.useCallback)(()=>{let t=K.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),at=(0,Q.useCallback)(e=>{e!==`preview`&&it(),O(e)},[it]),st=(0,Q.useCallback)(t=>{it(),B(t),e&&(Fe.current=t,Me.current&&clearTimeout(Me.current),Me.current=setTimeout(async()=>{let t=Fe.current;if(Fe.current=null,t!==null){L(!0);try{await ae(e,{title:t}),await Ye(),n?.()}catch{}finally{L(!1)}}},600))},[it,e,Ye,n]),ct=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:v(`flex min-w-0 items-center gap-2`,le),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:R||nt||void 0,children:R||nt}),I?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,I,nt,R]),ut=(0,Q.useCallback)(async(t=!1)=>{de(!0),q(null);try{let n=await z(e,{forceNew:t});await Ye(),await $e(),w(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){q(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{de(!1)}},[Ye,$e,w,e,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),dt=(0,Q.useCallback)(async()=>{oe(!0),q(null);try{await ze(e),await Ye()}catch(e){q(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{oe(!1)}},[Ye,e]),pt=(0,Q.useCallback)(()=>{A(k===`breakdown`?null:`breakdown`),!Z?.aiDeep?.catalysis?.report&&!re&&dt()},[k,re,dt,Z?.aiDeep?.catalysis?.report]),mt=(0,Q.useCallback)(()=>{let t=j?j.markdown??``:Pe.current??Z?.markdown??``,n=j?j.title??``:R,r=Qt(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:Ee(r,p)}},[p,m.titlePlaceholder,Z?.markdown,e,j,R]),ht=(0,Q.useCallback)(async()=>{ke.current&&clearTimeout(ke.current),Me.current&&clearTimeout(Me.current),ke.current=null,Me.current=null;let t=Pe.current,r=Fe.current;Pe.current=null,Fe.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Z??null;L(!0);try{let t=await ae(e,i);return await Ye(t,{revalidate:!1}),n?.(),t}catch(e){return Pe.current===null&&(Pe.current=t),Fe.current===null&&(Fe.current=r),q(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`),null}finally{L(!1)}},[Ye,m.saveFailed,m.saveFailedHint,Z,e,n]),gt=(0,Q.useCallback)(async()=>{if(!Z||ue||I)return;de(!0),q(null);let e=b.getState(),t=++fe.current,n=()=>fe.current===t&&b.getState().baseUrl===e.baseUrl&&b.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Ie.current?.contains(t.anchorNode)&&Ie.current.contains(t.focusNode)?t.toString():``,i=await ht();if(!i||!n())return;if(Pe.current!==null||Fe.current!==null)throw Error(h.unavailable);let a=se.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new M().createSession();if(!n())return;if(Pe.current!==null||Fe.current!==null)throw Error(h.unavailable);let s=U(e.baseUrl,e.conversationId,o.key);if(!se.put(s,a))throw Error(h.unavailable);w(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&q(h.unavailable)}finally{fe.current===t&&de(!1)}},[Z,ue,I,ht,w,h.unavailable]),_t=(0,Q.useCallback)(async()=>{q(null);let e=await ht();e&&(xe(e),ye(!0))},[ht]),vt=(0,Q.useCallback)(async()=>{if(!(Y||I)){Ce(!1),we(!0),q(null),it(),ke.current&&clearTimeout(ke.current),Me.current&&clearTimeout(Me.current),ke.current=null,Me.current=null,Pe.current=null,Fe.current=null;try{await Ke(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){q(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{we(!1)}}},[Y,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,I,it]),yt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:v(`flex min-w-0 items-center gap-1 sm:gap-2`,le),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":m.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Xt,{input:mt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:pt,disabled:re,"aria-label":m.catalysisSectionTitle,className:v(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,k===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:re?m.catalyzing:m.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ut(!1),"aria-label":m.openChatButton,disabled:ue,className:v(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ue?m.openingChat:m.openChatButton})]}),(0,$.jsx)(an,{mode:D,onModeChange:at,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void gt(),disabled:ue||I||!Z||!!j,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,$.jsxs)(He,{modal:!1,children:[(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":m.noteActions,title:m.noteActions,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`,children:(0,$.jsx)(f,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(Ze,{children:(0,$.jsxs)(F,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,$.jsxs)(De,{onSelect:()=>void _t(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(De,{onSelect:()=>A(k===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(Ge,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:m.history}),k===`history`?(0,$.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(Je,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(De,{disabled:Y||I,onSelect:()=>Ce(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[re,pt,ut,gt,h.capture,Z,j,D,m.history,m.modeEdit,m.modePreview,m.modeSource,ue,k,s,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,at,mt,_t,Y,I,p,m.delete,Ce]);(0,Q.useLayoutEffect)(()=>(We({startExtra:rt,main:Z&&!(y&&x)?ct:null,end:Z&&!(y&&x)?yt:null}),()=>{a&&qe()}),[a,qe,yt,ct,rt,y,x,Z,We]);let bt=(0,Q.useCallback)(t=>{e&&(it(),Pe.current=t,ke.current&&clearTimeout(ke.current),ke.current=setTimeout(async()=>{let t=Pe.current;if(Pe.current=null,t!==null){L(!0),q(null);try{await ae(e,{markdown:t}),await Ye(),n?.()}catch(e){q(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`)}finally{L(!1)}}},600))},[it,e,Ye,m.saveFailed,m.saveFailedHint,n]),xt=(0,Q.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&(it(),N(e))})},[e,it]),St=(0,Q.useCallback)(()=>{it(),A(null),N(null)},[it]),wt=(0,Q.useCallback)(()=>{it(),A(null),N(null),Ye().catch(tt),n?.()},[Ye,n,tt,it]);if((0,Q.useEffect)(()=>()=>{ke.current&&clearTimeout(ke.current),Me.current&&clearTimeout(Me.current);let t=Pe.current,n=Fe.current;Pe.current=null,Fe.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&ae(e,r).catch(()=>void 0)},[e]),Z===void 0)return Xe?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Ye().catch(tt),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,$.jsx)(rn,{});if(Z===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let Tt=et?j.title??``:R,Et=et?j.markdown??``:Pe.current??Z.markdown??``,Dt=new Date(Z.createdAt).getTime(),Ot=Number.isFinite(Dt)&&Date.now()-Dt<3600*1e3?(0,$.jsx)(Ct,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[pe?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:pe}):null,(0,$.jsx)(J,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(J,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),y&&!x?(0,$.jsx)(`button`,{className:`mb-2 inline-flex min-h-11 shrink-0 items-center self-start rounded-lg px-2 text-sm text-accent-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>C(!0),children:p===`zh`?`← 返回录音笔记`:`← Back to recording`}):null,(0,$.jsxs)(`div`,{ref:Ie,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[y&&x?(0,$.jsx)(Rt,{noteId:e,noteActions:{onAnalyze:pt,onChat:()=>{ut(!1)},onShare:()=>{_t()},onHistory:()=>A(k===`history`?null:`history`),onDelete:()=>Ce(!0),busy:Y||I||re||ue},onPersonalNotes:()=>{C(!1),window.setTimeout(()=>Be.current?.focus(),0)}}):null,(0,$.jsx)(`div`,{className:y&&x?`hidden`:`min-h-0 min-w-0 flex-1`,children:et?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Tt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Tt}),Et?(0,$.jsx)(ce,{noteId:e,content:Et,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[D===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Be,type:`text`,value:R,onChange:e=>st(e.target.value),onCompositionStart:()=>{Te.current=!0},onCompositionEnd:()=>{Te.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Te.current&&!t.isComposing&&(e.preventDefault(),(Ie.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(rn,{}),children:(0,$.jsx)(tn,{initialContent:Z.markdown??``,onChange:bt,noteId:e},`wysiwyg-${e}`)})})]}),D===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Be,type:`text`,value:R,onChange:e=>st(e.target.value),placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(rn,{}),children:(0,$.jsx)(nn,{initialContent:Z.markdown??``,onChange:bt,isDark:T},`source-${e}`)})})]}),D===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&E(t.currentSrc||t.src,t.alt)},children:[R&&!Z.markdown.trimStart().startsWith(`# ${R.trim()}\n`)&&Z.markdown.trim()!==`# ${R.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:R}),Z.markdown?(0,$.jsx)(ce,{noteId:e,content:Z.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:Le,className:v(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!te&&`transition-[width] duration-300 ease-in-out`),style:{width:k?V:0},children:(0,$.jsxs)(`div`,{ref:Re,className:`flex min-h-0 flex-1 flex-col`,style:{width:V},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=V,i=e.pointerId,a=0,o=V,s=V,c=()=>{a=0,s=o,k&&Le.current?.style.setProperty(`width`,`${s}px`),Re.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}ne(!1),H(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:v(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,te&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:k===`history`?(0,$.jsx)(Vt,{noteId:e,activeTimestamp:j?.timestamp??null,onSelect:xt,onClose:St,onRestored:wt}):k===`breakdown`?(0,$.jsx)(Ht,{noteId:e,note:Z??null,catalyzing:re,onCatalyze:dt,onClose:()=>A(null),noteThreads:Qe,openingChat:ue,onOpenChat:()=>ut(!1),onOpenNewChat:()=>ut(!0)}):null})]})})]}),be?(0,$.jsx)(Wt,{open:ge,onOpenChange:ye,note:be}):null,(0,$.jsx)(_e,{open:Se,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,Z.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void vt(),onCancel:()=>Ce(!1)})]})}export{bt as i,St as n,xt as r,sn as t};
@@ -1,8 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,g as o,m as s}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as c}from"./ellipsis-0k4rZLoy.js";import{z as l}from"./markdown-view-PrKvVpRh.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-CaeL_miw.js";import{t as p}from"./cn-0WouolD0.js";import{c as m,f as h,n as g}from"./locale-store-CE7L6MlS.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{$n as v,Cf as y,Cr as b,Ef as ee,Eu as x,Hu as te,Ic as S,Ir as C,Mr as ne,Nr as w,Nu as T,Od as E,Ol as D,Qn as O,Rl as k,Rs as re,Sd as ie,Sr as ae,Ul as oe,Uo as se,Xa as ce,an as A,bf as le,cd as ue,cf as j,cs as de,dn as M,do as fe,dr as pe,er as me,eu as he,fn as N,hf as ge,hn as P,in as _e,ir as ve,mn as ye,nr as be,pn as F,pr as xe,sf as Se,tr as Ce,tu as we,wf as Te,wl as Ee,xf as De,xu as I,yr as Oe}from"./index-CKdOZoVu.js";import{i as ke,t as L}from"./note-detail-panel-Q4yRx9iZ.js";var R=n(),z=e(t(),1),B=r();function V({projectId:e}){let t=g(e=>e.language)===`zh`,n=a(),r=(0,z.useRef)(null),i=(0,z.useRef)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(null);async function f(){let t=i.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await P();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let a=await _e(t.file,t.requestId),o=await ye({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await N({...a,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await A(a,o.discussion.id,s),await M(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,B.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&i.current?void f():r.current?.click(),children:[(0,B.jsx)(Ee,{className:`size-3.5`}),o===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,B.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,B.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void F(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,B.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Ae(e){e.note??=await pe({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await w(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${C(t,e.id)})`);e.note=await ne(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
-
3
- `)}`})}return{noteId:t,conversationId:(await b(t,{projectId:e.projectId})).conversationId}}function je(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var H={meeting:le,requirements:E,research:we,weekly:j};function Me({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:o,projectsError:s}){let c=i.home,l=a(),[u,f]=(0,z.useState)(``),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),[b,ee]=(0,z.useState)(!1),[x,S]=(0,z.useState)(null),[C,ne]=(0,z.useState)(``),w=(0,z.useRef)(null),T=(0,z.useRef)(!1),E=(0,z.useRef)(null),D=(0,z.useRef)(null),O=b||!!w.current,k=m?c.templateOptions[m]:null,re=!!(u.trim()||v.length);async function ae(){if(!(T.current||!re&&!w.current)){T.current=!0,ee(!0),S(null),w.current??={requestId:crypto.randomUUID(),title:u.trim().split(`
4
- `)[0]?.slice(0,80)||k?.label||i.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${k?`${k.prompt}\n`:``}${u.trim()}`,projectId:t||void 0,files:[...v],attachments:[],materialHeading:c.materialsHeading};try{let e=await Ae(w.current);r(),l(je(e.conversationId,e.noteId,c.agentPrompt))}catch(e){w.current.note&&r(),S(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{T.current=!1,ee(!1)}}}function se(){w.current=null,S(null),f(``),y([]),h(null),_(!1),D.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ae()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:O,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.agentResultHint}),k?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[k.label,` · `]}),k.prompt.split(`
5
-
6
- `)[0]]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>h(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(d,{className:`size-3.5`})})]}):null,(0,B.jsx)(`textarea`,{ref:D,id:`notes-home-prompt`,value:u,onChange:e=>f(e.target.value),placeholder:k?k.prompt.split(`
7
-
8
- `).at(-1):c.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),ae())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),v.length?(0,B.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:v.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,B.jsx)(I,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${c.removeMaterial}: ${e.name}`,onClick:()=>y(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(d,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,B.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,B.jsx)(de,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(C.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:c.unassigned,placeholder:c.unassigned,emptyLabel:c.unassigned,ariaLabel:c.assignProject,triggerIcon:(0,B.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:O,loading:o,statusMessage:s?c.projectsLoadFailed:void 0,searchPlaceholder:c.projectSearch,searchValue:C,onSearchChange:ne})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>E.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,B.jsx)(I,{className:`size-4`,"aria-hidden":!0}),c.addMaterials]}),(0,B.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`hidden`,"aria-label":c.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);y(e=>[...e,...t]),e.target.value=``}})]})]}),(0,B.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,B.jsxs)(`button`,{type:`submit`,disabled:b||!w.current&&!re,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[b?(0,B.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(De,{className:`size-4`,"aria-hidden":!0}),b?c.creating:x?c.retry:c.agentCreate]})})]}),x?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,B.jsx)(`p`,{children:x}),w.current?.note?(0,B.jsx)(`p`,{className:`mt-1`,children:c.partialFailure}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[w.current?.note?(0,B.jsx)(`button`,{type:`button`,onClick:()=>l(`/notes/${encodeURIComponent(w.current.note.id)}?edit=1`),className:`underline`,children:c.openSavedDraft}):null,(0,B.jsx)(`button`,{type:`button`,onClick:se,className:`underline`,children:c.newRequest})]})]}):null,(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,B.jsxs)(`button`,{type:`button`,disabled:O,"aria-expanded":g,"aria-controls":`notes-home-templates`,onClick:()=>_(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[c.templates,(0,B.jsx)(Se,{className:p(`size-3.5 transition-transform`,g&&`rotate-180`),"aria-hidden":!0})]})}),(0,B.jsxs)(`div`,{id:`notes-home-templates`,hidden:!g,className:p(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,g?`flex`:`hidden`),children:[Object.keys(H).map(e=>{let t=H[e];return(0,B.jsxs)(`button`,{type:`button`,disabled:O,"aria-pressed":m===e,onClick:()=>{h(m===e?null:e),D.current?.focus()},className:p(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,m===e&&`bg-accent-soft text-accent-fg`),children:[(0,B.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),c.templateOptions[e].label]},e)}),(0,B.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle}),(0,B.jsx)(V,{})]})]})}function Ne(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Pe(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function Fe(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||Pe(e).slice(0,48)||t}var U=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted 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`;function W(){let e=g(e=>e.language),t=f(e).notes,n=t.home,r=m(e=>e.conversationId),s=se(e=>e.setPageHeader),l=se(e=>e.clearPageHeader),d=a(),{pathname:b,search:C}=i(),[w,A]=o(),j=w.get(`projectId`)||``,M=w.get(`view`)||`all`,N=w.get(`unassigned`)===`true`||M===`unassigned`,P=w.get(`search`)||``,[_e]=fe(P,250),[ye,F]=(0,z.useState)(j),[we,Ee]=(0,z.useState)(``),[De,I]=(0,z.useState)(null),[L,R]=(0,z.useState)(!1),[V,Ae]=(0,z.useState)(!1),[je,H]=(0,z.useState)(new Set),[W,G]=(0,z.useState)(null),[K,Ie]=(0,z.useState)(null),q=(0,z.useRef)(new Set),J=(0,z.useRef)(null),Le=(0,z.useRef)(!1),Re=(0,z.useRef)(null),ze=Ne(w,_e),Y=(ze.offset??0)/12,{data:Be,error:Ve,isLoading:He,mutate:Ue}=_(r?[`notes-home`,r,ze]:null,()=>ae(ze)),{data:We,error:Ge,isLoading:X,mutate:Ke}=_(r?[`notes-home-projects`,r]:null,Oe),Z=We?.items??[],qe=Z.filter(e=>e.noteCount>0).slice(0,2),Je=Z.find(e=>e.id===j)?.name??n.projectNotes,Ye=Be?.items??[],Q=Be?.total??0,Xe=He||P!==_e,Ze=(0,z.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:h(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[Qe,$e]=(0,z.useState)(()=>Date.now());(0,z.useEffect)(()=>{F(j)},[j]),(0,z.useEffect)(()=>{let e=window.setInterval(()=>$e(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let $=(0,z.useCallback)(()=>{Ue().catch(()=>void 0),Ke().catch(()=>void 0)},[Ue,Ke]);(0,z.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,$)),()=>e.forEach(e=>window.removeEventListener(e,$))},[$]);let et=(0,z.useCallback)((e,t=!1)=>{let n=`${b}${C}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),d(`/notes/${encodeURIComponent(e)}?${r}`)},[b,C,d]),tt=(0,z.useCallback)(async()=>{if(!(Le.current||!r)){Le.current=!0,R(!0),I(null),J.current??={key:crypto.randomUUID(),projectId:j||void 0};try{let e=await pe({markdown:``,kind:`thought`,projectId:J.current.projectId},J.current.key);J.current=null,$(),et(e.id,!0)}catch(e){I(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Le.current=!1,R(!1)}}},[j,t.createBlankFailed,t.createBlankFailedHint,et,$,r]),nt=(0,z.useCallback)(e=>{A(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[A]);function rt(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),F(e),A(n)}function it(e){A(t=>{let n=new URLSearchParams(t);return N&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function at(e,n){if(!q.current.has(e)){q.current.add(e),H(new Set(q.current)),I(null);try{await ne(e,{pinned:n}),$()}catch(e){I(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{q.current.delete(e),H(new Set(q.current))}}}async function ot(){let e=W;if(!(!e||K)){G(null),Ie(e.id),I(null);try{await xe(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),$()}catch(e){I(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Ie(null)}}}if((0,z.useLayoutEffect)(()=>{if(!r){l();return}return s({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,B.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-2`,re),children:(0,B.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,B.jsx)(he,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:Re,type:`search`,value:P,onChange:e=>nt(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>l()},[l,tt,L,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,P,s,nt,r]),(0,z.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),tt()),e.key.toLowerCase()===`f`&&(e.preventDefault(),Re.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[tt]),!r)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let st=[{id:`all`,label:n.homeNav,Icon:x},{id:`favorites`,label:n.favorites,Icon:k},{id:`unassigned`,label:n.unassigned,Icon:ue},{id:`archived`,label:t.filterArchived,Icon:ee}],ct=j?`project:${j}`:N?`unassigned`:`all`,lt=!Xe&&!Ve&&Q===0&&!j&&!N&&!P&&M===`all`;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,B.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[st.map(({id:e,label:t,Icon:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>rt(``,e),"aria-current":!j&&(e===`unassigned`?N:!N&&M===e)?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,!j&&(e===`unassigned`?N:!N&&M===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,B.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),X?[0,1,2].map(e=>(0,B.jsx)(S,{className:`mb-2 h-8 w-full`},e)):Z.slice(0,8).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>rt(e.id),"aria-current":j===e.id?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,j===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:p(U,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,B.jsx)(y,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,B.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col px-4 pb-4 pt-3 sm:px-6 sm:pb-7 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:j?Je:N?n.unassigned:lt?n.firstNoteTitle:n.continueTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:j?n.projectDescription:lt?n.firstNoteDescription:n.continueDescription})]}),j?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects/${encodeURIComponent(j)}`),className:p(U,`text-xs`),children:[n.openProject,(0,B.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),De?(0,B.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:De}):null,(0,B.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void tt(),disabled:L,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[L?(0,B.jsx)(te,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,B.jsx)(u,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,B.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>O(j||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(T,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{Ae(e=>!e),V||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":V,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(oe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,B.jsx)(Se,{className:p(`size-4 transition-transform`,V&&`rotate-180`),"aria-hidden":!0})]}),(0,B.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!V,className:p(`mt-3`,!V&&`hidden`),children:(0,B.jsx)(Me,{projects:Z,projectId:ye,onProjectChange:F,onCreated:$,labels:t,projectsLoading:X,projectsError:!!Ge})})]}),Ge?(0,B.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,B.jsx)(`span`,{children:n.projectsLoadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void Ke().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,lt?null:(0,B.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:M===`favorites`?n.favorites:M===`archived`?t.filterArchived:j?n.projectNotes:n.recentNotes}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===`agent`,onClick:()=>it(M===`agent`?`all`:`agent`),className:p(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,M===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,B.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,B.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,B.jsx)(de,{value:ct,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...Z.filter(e=>e.name.toLowerCase().includes(we.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:j?Je:N?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:X,searchPlaceholder:n.projectSearch,searchValue:we,onSearchChange:Ee,onChange:e=>rt(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===e||e===`all`&&M===`unassigned`,onClick:()=>it(e),className:p(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(M===e||e===`all`&&M===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,B.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ve?(0,B.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void Ue().catch(()=>void 0),className:p(U,`mt-2`),children:n.retry})]}):Xe?(0,B.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,B.jsx)(S,{className:`h-10 w-8 shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,B.jsx)(S,{className:`h-4 w-2/3`}),(0,B.jsx)(S,{className:`h-3 w-1/2`})]})]},e))}):Ye.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,B.jsx)(x,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,B.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:P||M!==`all`&&M!==`unassigned`?n.noMatches:j?n.projectEmpty:n.emptyTitle}),(0,B.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:P||M!==`all`&&M!==`unassigned`?n.noMatchesHint:j?n.projectEmptyHint:n.emptyDescription})]}):(0,B.jsx)(`ul`,{className:`divide-y divide-edge`,children:Ye.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?le:e.kind===`bookmark`?ge:E,i=Fe(e,t.titlePlaceholder,n.voiceNote),a=Pe(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,B.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>et(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,B.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,B.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,B.jsx)(oe,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,B.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,B.jsx)(`span`,{className:`truncate`,children:a})]}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:ke(e.updatedAt,Qe,Ze)})]})]}),(0,B.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:ke(e.updatedAt,Qe,Ze)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void at(e.id,!e.pinned),disabled:je.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,B.jsx)(k,{className:p(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,B.jsxs)(be,{children:[(0,B.jsx)(ve,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,disabled:K===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:K===e.id?(0,B.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(Ce,{children:(0,B.jsx)(v,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,B.jsxs)(me,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>G(e),children:[(0,B.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!Xe&&!Ve&&Q>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Q))}),Q>12||Y>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:Y===0,className:U,onClick:()=>A(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y-1)),t}),children:(0,B.jsx)(Te,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{children:[Y+1,` / `,Math.max(1,Math.ceil(Q/12))]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(Y+1)*12>=Q,className:U,onClick:()=>A(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y+1)),t}),children:(0,B.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!j&&!N&&(X||qe.length>0)?(0,B.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:X?[0,1].map(e=>(0,B.jsx)(S,{className:`h-28 w-full`},e)):qe.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>rt(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,B.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,B.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,B.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,B.jsx)(`span`,{children:e.updatedAt?ke(e.updatedAt,Qe,Ze):n.emptyProject})]})]},e.id))})]}):null]})}),(0,B.jsx)(ce,{open:W!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,W?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void ot(),onCancel:()=>G(null)})]})}function G(){let e=(0,R.c)(12),{noteId:t}=s(),n=a(),[r]=o(),i;e[0]===r?i=e[1]:(i=l(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=i);let c=i,u;e[2]!==n||e[3]!==c?(u=()=>{n(c)},e[2]=n,e[3]=c,e[4]=u):u=e[4];let d=u;if(!t)return null;let f=r.get(`edit`)===`1`?`wysiwyg`:`preview`,p;e[5]===r?p=e[6]:(p=r.get(`edit`),e[5]=r,e[6]=p);let m=p===`1`,h;return e[7]!==d||e[8]!==t||e[9]!==f||e[10]!==m?(h=(0,B.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,B.jsx)(L,{noteId:t,onBack:d,initialMode:f,autoFocus:m},t)}),e[7]=d,e[8]=t,e[9]=f,e[10]=m,e[11]=h):h=e[11],h}function K(){let e=(0,R.c)(2),{noteId:t}=s(),n;return e[0]===t?n=e[1]:(n=t?(0,B.jsx)(G,{}):(0,B.jsx)(W,{}),e[0]=t,e[1]=n),n}export{K as NotesPage};