@xopcai/xopc 0.0.358 → 0.0.360

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 (446) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DEs_xwQi.js → agent-avatar-dicebear-CQTERenW.js} +1 -1
  13. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPF0lunJ.js +1 -0
  14. package/dist/gateway/static/root/assets/agent-plugin-dialog-BjDaZlKy.js +1 -0
  15. package/dist/gateway/static/root/assets/agents-XopBILLB.js +66 -0
  16. package/dist/gateway/static/root/assets/{app-management-settings-panel-BqyvMQXO.js → app-management-settings-panel-V5QVeMvW.js} +1 -1
  17. package/dist/gateway/static/root/assets/{appearance-settings-Cn9qgXLw.js → appearance-settings-BDkRcoI6.js} +1 -1
  18. package/dist/gateway/static/root/assets/{apps-page-ChPOmrPa.js → apps-page-DzCyL89L.js} +1 -1
  19. package/dist/gateway/static/root/assets/{automations-page-OUapkL2D.js → automations-page-DOu1wMOV.js} +1 -1
  20. package/dist/gateway/static/root/assets/automations-workspace-CiY_2otj.js +7 -0
  21. package/dist/gateway/static/root/assets/{block-editor-_-QK0EnY.js → block-editor-K6is5GrS.js} +3 -3
  22. package/dist/gateway/static/root/assets/{browser-automation-inputs-CnLQ649y.js → browser-automation-inputs-MmkUGn9W.js} +1 -1
  23. package/dist/gateway/static/root/assets/{browser-automations-page-DZlWdikj.js → browser-automations-page-B8IiXEBs.js} +2 -2
  24. package/dist/gateway/static/root/assets/{browser-settings-page-CEF_LSjz.js → browser-settings-page-Cms2Bu3Q.js} +2 -2
  25. package/dist/gateway/static/root/assets/capabilities-page-BAFRNHQv.js +2 -0
  26. package/dist/gateway/static/root/assets/capabilities-settings-panel-Cws6od1d.js +8 -0
  27. package/dist/gateway/static/root/assets/{capability-header-actions-CA_XNTSW.js → capability-header-actions-wh3Nr0qS.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-DxwismTc.js +1 -0
  29. package/dist/gateway/static/root/assets/{chat-terminal-dock-DRV-4qeP.js → chat-terminal-dock-BU-X9nu1.js} +2 -2
  30. package/dist/gateway/static/root/assets/computer-settings-page-MyXsSqFJ.js +1 -0
  31. package/dist/gateway/static/root/assets/{connector-service-page-BKAt0jvO.js → connector-service-page-DyxPM_MZ.js} +1 -1
  32. package/dist/gateway/static/root/assets/connectors-page-C7-OC3MW.js +2 -0
  33. package/dist/gateway/static/root/assets/{constants-Co2_smKQ.js → constants-Dy8Gw0sF.js} +1 -1
  34. package/dist/gateway/static/root/assets/date-picker-WRFvi7Pu.js +1 -0
  35. package/dist/gateway/static/root/assets/{dependency-picker-D0RWVtBt.js → dependency-picker-CLun5Tst.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-9B1PIjsV.js → desktop-pet-iaVa9vVM.js} +1 -1
  37. package/dist/gateway/static/root/assets/{desktop-pet-settings-cq5n59Pr.js → desktop-pet-settings-0RS3sP3Z.js} +1 -1
  38. package/dist/gateway/static/root/assets/device-pairing-wizard-DVAGb04L.js +1 -0
  39. package/dist/gateway/static/root/assets/{directory-picker-path-field-C40-GlX1.js → directory-picker-path-field-Btlldlt3.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-debug-page-BodxNAys.js → extension-debug-page-BImQT4PU.js} +1 -1
  41. package/dist/gateway/static/root/assets/{extension-page-BshgQ_pO.js → extension-page-BmuLv-ET.js} +1 -1
  42. package/dist/gateway/static/root/assets/{extension-provider-aigS3RJu.js → extension-provider-Dg7cRxDX.js} +1 -1
  43. package/dist/gateway/static/root/assets/{extension-settings-page-DAJZVzIQ.js → extension-settings-page-7Kr8UJK4.js} +1 -1
  44. package/dist/gateway/static/root/assets/fallback-models-B0w1lumZ.js +1 -0
  45. package/dist/gateway/static/root/assets/gateway-settings-DmPvmwYp.js +1 -0
  46. package/dist/gateway/static/root/assets/home-page-N0Mp-eTJ.js +1 -0
  47. package/dist/gateway/static/root/assets/{imports-page-Bsn8Qted.js → imports-page-BLOJY67-.js} +1 -1
  48. package/dist/gateway/static/root/assets/{index-DUgsBdV3.css → index-B7AHDHSO.css} +1 -1
  49. package/dist/gateway/static/root/assets/index-BXrBL_Hb.js +106 -0
  50. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DjuXyBbC.js → keyboard-shortcuts-settings-Dlbsip2R.js} +1 -1
  51. package/dist/gateway/static/root/assets/{local-app-workbench-page-D77r2CKa.js → local-app-workbench-page-nyWeTK0r.js} +1 -1
  52. package/dist/gateway/static/root/assets/{local-apps-page-GsohMT3J.js → local-apps-page-CfEpFLs0.js} +1 -1
  53. package/dist/gateway/static/root/assets/{logs-page-DeBeNPb4.js → logs-page-A38cawkA.js} +2 -2
  54. package/dist/gateway/static/root/assets/{management-settings-Di9r7yBX.js → management-settings-Cse9K61x.js} +1 -1
  55. package/dist/gateway/static/root/assets/{note-detail-panel-CLq8afeQ.js → note-detail-panel-CUGVyo2V.js} +3 -3
  56. package/dist/gateway/static/root/assets/notes-page-Dk89l5dC.js +8 -0
  57. package/dist/gateway/static/root/assets/{page-context-capture-button-C9H1dHg2.js → page-context-capture-button-C72qIgBg.js} +1 -1
  58. package/dist/gateway/static/root/assets/personal-page-DCtduzh8.js +1 -0
  59. package/dist/gateway/static/root/assets/popover-select-BgSdSbCL.js +1 -0
  60. package/dist/gateway/static/root/assets/{product-open-page-pW662VEC.js → product-open-page-CT98FsVl.js} +1 -1
  61. package/dist/gateway/static/root/assets/{project-detail-page-3_Bqq0OV.js → project-detail-page-BlqOVwKP.js} +1 -1
  62. package/dist/gateway/static/root/assets/{projects-page-D85PDbCM.js → projects-page-DVN2q_yR.js} +1 -1
  63. package/dist/gateway/static/root/assets/remote-access-hub-BP5kUgIN.js +1 -0
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BUgsyhm_.js → runtime-tools-settings-panel-ry0jprz7.js} +1 -1
  65. package/dist/gateway/static/root/assets/{scenes-page-Bds4V34P.js → scenes-page-CV1GkOj6.js} +2 -2
  66. package/dist/gateway/static/root/assets/{schema-form-BQz6ezGe.js → schema-form-C5zMrxgR.js} +1 -1
  67. package/dist/gateway/static/root/assets/{send-session-input-OaBPDJ9E.js → send-session-input-Dt0t5SoR.js} +1 -1
  68. package/dist/gateway/static/root/assets/session-manager-DDR-gv_e.js +16 -0
  69. package/dist/gateway/static/root/assets/sessions-page-BXtGeOsR.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-CvFVkELy.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-page-CKmMkdPu.js → settings-page-C88fsfZF.js} +1 -1
  72. package/dist/gateway/static/root/assets/{setup-status-panel-Cjv6CDgq.js → setup-status-panel-DESlRgZS.js} +1 -1
  73. package/dist/gateway/static/root/assets/{share-link-dialog-QAjExHAL.js → share-link-dialog-BvSRHs1P.js} +1 -1
  74. package/dist/gateway/static/root/assets/{share-preview-page-M_rAQR60.js → share-preview-page-D5Gey-6E.js} +1 -1
  75. package/dist/gateway/static/root/assets/shares-settings-btoP07Fx.js +1 -0
  76. package/dist/gateway/static/root/assets/{skill-api-BO1b2oYj.js → skill-api-1hbX3qDC.js} +1 -1
  77. package/dist/gateway/static/root/assets/skills-page-DYJbwwBT.js +2 -0
  78. package/dist/gateway/static/root/assets/{system-settings-panel-CIDRPUj4.js → system-settings-panel-DbNk-Jwq.js} +1 -1
  79. package/dist/gateway/static/root/assets/{task-detail-page-ZmkA0E9f.js → task-detail-page-DoLKOJrE.js} +1 -1
  80. package/dist/gateway/static/root/assets/{tunnel-api-BkgD61qc.js → tunnel-api-H3FheXYH.js} +1 -1
  81. package/dist/gateway/static/root/assets/{usage-page-BjgYDab4.js → usage-page-DGbqcsV6.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-composer-attachments-qK3z-EGz.js → use-composer-attachments-pzPAUV_o.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-file-preview-expanded-D809I8ur.js → use-file-preview-expanded-DNhXjL0W.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-model-page-7pW4Pazn.js +2 -0
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-Ce3PKQvh.js → work-discovery-overlay-DfyI9kVf.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Dv6xUycS.js → workflow-run-setup-panel-De80GODZ.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-BuH3pC1C.js +6 -0
  88. package/dist/gateway/static/root/assets/{workspace-api-BtXzxf_w.js → workspace-api-Dwa8kHdY.js} +2 -2
  89. package/dist/gateway/static/root/index.html +11 -12
  90. package/dist/package.js +1 -1
  91. package/dist/packages/gateway-contract/src/index.js +2 -0
  92. package/dist/packages/gateway-contract/src/task-result-delivery.js +30 -0
  93. package/dist/src/agent/agent-manager.js +13 -13
  94. package/dist/src/agent/agent-scope.js +2 -2
  95. package/dist/src/agent/background-review/prompts.js +1 -1
  96. package/dist/src/agent/background-review/run-background-review.js +3 -3
  97. package/dist/src/agent/coding/repository-instructions.js +1 -1
  98. package/dist/src/agent/context/coordinator.js +2 -2
  99. package/dist/src/agent/context/execution-context.js +4 -4
  100. package/dist/src/agent/context/execution-scope.js +2 -2
  101. package/dist/src/agent/context/project-context.js +3 -3
  102. package/dist/src/agent/context/workspace-templates/SOUL.md +2 -0
  103. package/dist/src/agent/data-acquisition/service.js +1 -1
  104. package/dist/src/agent/embedded/index.js +2 -2
  105. package/dist/src/agent/embedded/model-runtime.js +1 -1
  106. package/dist/src/agent/embedded/run-for-session.js +4 -4
  107. package/dist/src/agent/embedded/run-turn.js +5 -5
  108. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  109. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  110. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  111. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  112. package/dist/src/agent/external-tools/gateway-tools.js +42 -2
  113. package/dist/src/agent/external-tools/mcp-provider.js +3 -3
  114. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  115. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  116. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  117. package/dist/src/agent/image/generation/providers/google.js +1 -1
  118. package/dist/src/agent/image/generation/runtime.js +1 -1
  119. package/dist/src/agent/image/index.js +1 -1
  120. package/dist/src/agent/image/load-image-media.js +1 -1
  121. package/dist/src/agent/image/tool-model-config.js +1 -1
  122. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  123. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  124. package/dist/src/agent/index.js +1 -1
  125. package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
  126. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  127. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  128. package/dist/src/agent/mcp/index.js +2 -2
  129. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  130. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  131. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  132. package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
  133. package/dist/src/agent/memory/context-recovery.js +1 -1
  134. package/dist/src/agent/memory/index.js +1 -1
  135. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  136. package/dist/src/agent/prompt/sections/behavior.js +4 -1
  137. package/dist/src/agent/prompt/sections/memory-skills.js +2 -0
  138. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  139. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  140. package/dist/src/agent/service/direct-turn-helpers.js +4 -4
  141. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  142. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  143. package/dist/src/agent/service/webchat-tts.js +2 -2
  144. package/dist/src/agent/service.js +20 -20
  145. package/dist/src/agent/session/session-config-service.js +12 -4
  146. package/dist/src/agent/session/session-hydrator.js +1 -1
  147. package/dist/src/agent/session/session-inspector.js +1 -1
  148. package/dist/src/agent/source-context/index.js +2 -2
  149. package/dist/src/agent/tasks/task-judge-service.js +4 -4
  150. package/dist/src/agent/tools/create-share-tool.js +3 -3
  151. package/dist/src/agent/tools/dataBatch.js +1 -1
  152. package/dist/src/agent/tools/delegate-tool.js +3 -3
  153. package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
  154. package/dist/src/agent/tools/executor.js +1 -1
  155. package/dist/src/agent/tools/factory.js +48 -22
  156. package/dist/src/agent/tools/fetch-text.js +1 -1
  157. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  158. package/dist/src/agent/tools/index.js +6 -6
  159. package/dist/src/agent/tools/list-dir.js +1 -1
  160. package/dist/src/agent/tools/personal-preference-tool.js +11 -0
  161. package/dist/src/agent/tools/personal-request-result-tool.d.ts +22 -0
  162. package/dist/src/agent/tools/personal-request-result-tool.js +84 -0
  163. package/dist/src/agent/tools/personal-request-tool.d.ts +3 -0
  164. package/dist/src/agent/tools/personal-request-tool.js +100 -0
  165. package/dist/src/agent/tools/personal-task-tool.d.ts +6 -0
  166. package/dist/src/agent/tools/personal-task-tool.js +14 -12
  167. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  168. package/dist/src/agent/tools/read.js +2 -2
  169. package/dist/src/agent/tools/review-workspace.js +1 -1
  170. package/dist/src/agent/tools/send-media.js +2 -2
  171. package/dist/src/agent/tools/skills-tools.js +1 -1
  172. package/dist/src/agent/tools/tool-media.js +2 -3
  173. package/dist/src/agent/tools/tts-tool.js +1 -1
  174. package/dist/src/agent/tools/user-context-tool.js +1 -1
  175. package/dist/src/agent/tools/write.js +2 -2
  176. package/dist/src/agent/tools/xopc-use-tool.js +3 -3
  177. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  178. package/dist/src/ai-assist/text-assist.js +1 -1
  179. package/dist/src/auth/credentials.js +1 -1
  180. package/dist/src/auth/sync-provider-auth.js +1 -1
  181. package/dist/src/automations/domain/index.js +2 -2
  182. package/dist/src/automations/index.js +4 -4
  183. package/dist/src/automations/service/automation-service.js +2 -2
  184. package/dist/src/backup/archive.js +1 -1
  185. package/dist/src/browser/native-messaging-host.js +1 -1
  186. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  187. package/dist/src/channels/index.js +2 -2
  188. package/dist/src/channels/outbound-sender.js +1 -1
  189. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  190. package/dist/src/channels/pairing/pairing-store.js +6 -6
  191. package/dist/src/chat-commands/agent-edit.js +1 -1
  192. package/dist/src/chat-commands/builtins/config.js +3 -3
  193. package/dist/src/chat-commands/builtins/review.js +1 -1
  194. package/dist/src/chat-commands/builtins/session.js +1 -1
  195. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  196. package/dist/src/chat-commands/builtins/tts.js +1 -1
  197. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  198. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  199. package/dist/src/chat-commands/context.js +3 -3
  200. package/dist/src/chat-commands/index.js +3 -3
  201. package/dist/src/cli/commands/agent.js +6 -6
  202. package/dist/src/cli/commands/config.js +1 -1
  203. package/dist/src/cli/commands/connectors.js +1 -1
  204. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  205. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  206. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  207. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  208. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  209. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  210. package/dist/src/cli/commands/extension-dev.js +1 -1
  211. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  212. package/dist/src/cli/commands/extension.js +4 -4
  213. package/dist/src/cli/commands/gateway/shared.js +1 -1
  214. package/dist/src/cli/commands/gateway/token.js +1 -1
  215. package/dist/src/cli/commands/image.js +1 -1
  216. package/dist/src/cli/commands/init.js +1 -1
  217. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  218. package/dist/src/cli/commands/onboard.js +1 -1
  219. package/dist/src/cli/commands/project.js +2 -2
  220. package/dist/src/cli/commands/runtime.js +1 -1
  221. package/dist/src/cli/commands/skills.js +2 -2
  222. package/dist/src/cli/commands/tunnel.js +4 -4
  223. package/dist/src/cli/extension-cli-register.js +5 -5
  224. package/dist/src/cli/templates.js +4 -0
  225. package/dist/src/cli/utils/gateway-client.js +1 -1
  226. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  227. package/dist/src/cli/utils/session.js +1 -1
  228. package/dist/src/computer/runtime.js +2 -2
  229. package/dist/src/config/index.js +5 -5
  230. package/dist/src/config/loader.js +1 -1
  231. package/dist/src/config/models-json.js +1 -1
  232. package/dist/src/connectors/cli/authorization.js +1 -1
  233. package/dist/src/connectors/cli/runtime.js +1 -1
  234. package/dist/src/connectors/composio-sessions.js +1 -1
  235. package/dist/src/connectors/composio.js +1 -1
  236. package/dist/src/connectors/connected-source-understanding.js +3 -3
  237. package/dist/src/connectors/connection-recovery-service.d.ts +2 -0
  238. package/dist/src/connectors/connection-recovery-service.js +28 -10
  239. package/dist/src/connectors/health.js +1 -1
  240. package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
  241. package/dist/src/discussions/live-worker.js +1 -1
  242. package/dist/src/discussions/recording.js +1 -1
  243. package/dist/src/discussions/sealer.js +1 -1
  244. package/dist/src/extensions/activation-context.js +3 -3
  245. package/dist/src/extensions/api.js +4 -4
  246. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  247. package/dist/src/extensions/index.js +3 -3
  248. package/dist/src/extensions/install.js +1 -1
  249. package/dist/src/extensions/loader.js +2 -2
  250. package/dist/src/extensions/sdk/index.js +1 -1
  251. package/dist/src/extensions/sdk/media.js +1 -1
  252. package/dist/src/extensions/update.js +1 -1
  253. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  254. package/dist/src/gateway/agents-admin.js +1 -1
  255. package/dist/src/gateway/device-routes.js +2 -2
  256. package/dist/src/gateway/file-path-classifier.js +2 -2
  257. package/dist/src/gateway/global-defaults-admin.js +1 -1
  258. package/dist/src/gateway/hono/app.js +3 -3
  259. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  260. package/dist/src/gateway/hono/routes/agents.js +1 -1
  261. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  262. package/dist/src/gateway/hono/routes/browser.js +1 -1
  263. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  264. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  265. package/dist/src/gateway/hono/routes/home.js +1 -1
  266. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  267. package/dist/src/gateway/hono/routes/media.js +5 -4
  268. package/dist/src/gateway/hono/routes/models.js +6 -6
  269. package/dist/src/gateway/hono/routes/notes.js +1 -1
  270. package/dist/src/gateway/hono/routes/personal-agent.js +69 -1
  271. package/dist/src/gateway/hono/routes/projects.js +2 -2
  272. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  273. package/dist/src/gateway/hono/routes/session-input-handler.js +3 -3
  274. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  275. package/dist/src/gateway/hono/routes/shares.js +3 -3
  276. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  277. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  278. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  279. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  280. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  281. package/dist/src/gateway/hono/routes/voice.js +7 -7
  282. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  283. package/dist/src/gateway/image-generation-setup.js +1 -1
  284. package/dist/src/gateway/index.js +1 -1
  285. package/dist/src/gateway/lock.js +11 -11
  286. package/dist/src/gateway/media-access.js +3 -3
  287. package/dist/src/gateway/mobile-privacy.js +2 -2
  288. package/dist/src/gateway/ports.js +6 -6
  289. package/dist/src/gateway/run-loop.js +1 -1
  290. package/dist/src/gateway/scenes/mailContext.js +1 -1
  291. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  292. package/dist/src/gateway/server.js +1 -1
  293. package/dist/src/gateway/service/agent-runner.js +1 -1
  294. package/dist/src/gateway/service/config-coordinator.js +3 -3
  295. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  296. package/dist/src/gateway/service/session-command-service.js +2 -2
  297. package/dist/src/gateway/service/sessions-api.js +1 -1
  298. package/dist/src/gateway/service.d.ts +3 -0
  299. package/dist/src/gateway/service.js +81 -40
  300. package/dist/src/gateway/session-context-summary.js +2 -2
  301. package/dist/src/gateway/session-reset-service.js +1 -1
  302. package/dist/src/gateway/workspace-editor-path.js +2 -2
  303. package/dist/src/home-intelligence/generator.js +1 -1
  304. package/dist/src/infra/gateway-processes.js +2 -2
  305. package/dist/src/infra/path-env.js +3 -3
  306. package/dist/src/infra/update-global.js +10 -10
  307. package/dist/src/local-apps/service.js +1 -1
  308. package/dist/src/mcp/gateway-http-client.js +1 -1
  309. package/dist/src/media/index.js +2 -2
  310. package/dist/src/media/session-references.d.ts +2 -0
  311. package/dist/src/media/session-references.js +22 -2
  312. package/dist/src/media/store.d.ts +1 -0
  313. package/dist/src/media/store.js +2 -1
  314. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  315. package/dist/src/notes/agent-context.js +4 -4
  316. package/dist/src/notes/index.js +1 -1
  317. package/dist/src/notes/service.js +1 -1
  318. package/dist/src/notes/store.js +1 -1
  319. package/dist/src/personal-agent/capability-service.d.ts +14 -0
  320. package/dist/src/personal-agent/capability-service.js +63 -0
  321. package/dist/src/personal-agent/communication.d.ts +4 -0
  322. package/dist/src/personal-agent/communication.js +24 -0
  323. package/dist/src/personal-agent/model-config.d.ts +5 -0
  324. package/dist/src/personal-agent/model-config.js +59 -0
  325. package/dist/src/personal-agent/policy.d.ts +1 -1
  326. package/dist/src/personal-agent/policy.js +2 -0
  327. package/dist/src/personal-agent/repository.d.ts +1 -0
  328. package/dist/src/personal-agent/repository.js +3 -1
  329. package/dist/src/personal-agent/request-delivery.d.ts +4 -0
  330. package/dist/src/personal-agent/request-delivery.js +159 -0
  331. package/dist/src/personal-agent/request-repository.d.ts +33 -0
  332. package/dist/src/personal-agent/request-repository.js +71 -0
  333. package/dist/src/personal-agent/request-result.d.ts +21 -0
  334. package/dist/src/personal-agent/request-result.js +45 -0
  335. package/dist/src/personal-agent/request-service.d.ts +18 -0
  336. package/dist/src/personal-agent/request-service.js +308 -0
  337. package/dist/src/personal-agent/service.js +30 -7
  338. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  339. package/dist/src/providers/index.js +2 -2
  340. package/dist/src/providers/model-reference-auditor.js +1 -1
  341. package/dist/src/providers/model-registry.js +1 -1
  342. package/dist/src/providers/register-runtime-providers.js +1 -1
  343. package/dist/src/remote-access/exposure-manager.js +1 -1
  344. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  345. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  346. package/dist/src/scenes/taskFollowUp/service.js +4 -4
  347. package/dist/src/session/client-history.d.ts +2 -1
  348. package/dist/src/session/client-history.js +40 -0
  349. package/dist/src/session/compact-history.js +9 -5
  350. package/dist/src/session/config-store.js +2 -1
  351. package/dist/src/session/index.js +2 -2
  352. package/dist/src/session/resolve-session.js +1 -1
  353. package/dist/src/session/session-context-for-llm.js +55 -0
  354. package/dist/src/session/session-title.js +1 -1
  355. package/dist/src/session/store.js +6 -4
  356. package/dist/src/session/thinking-resolve.js +1 -1
  357. package/dist/src/session/types.d.ts +2 -0
  358. package/dist/src/share/share-store.js +1 -1
  359. package/dist/src/share/share-thumbnail.js +1 -1
  360. package/dist/src/share/share-zip.js +1 -1
  361. package/dist/src/share/site-proxy.js +1 -1
  362. package/dist/src/share/site-share-store.js +1 -1
  363. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +5 -1
  364. package/dist/src/storage/sqlite/connection-wait-repository.js +38 -8
  365. package/dist/src/storage/sqlite/connection.js +9 -9
  366. package/dist/src/storage/sqlite/migrations/231_task_result_deliveries.sql +32 -0
  367. package/dist/src/storage/sqlite/migrations/232_personal_requests.sql +28 -0
  368. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  369. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  370. package/dist/src/storage/sqlite/schema.js +1 -1
  371. package/dist/src/storage/sqlite/session-repository.js +33 -0
  372. package/dist/src/tasks/capabilities/read.js +2 -2
  373. package/dist/src/tasks/capabilities/write.js +1 -1
  374. package/dist/src/tasks/execution-context.js +1 -1
  375. package/dist/src/tasks/home-query-service.js +3 -3
  376. package/dist/src/tasks/index.js +4 -4
  377. package/dist/src/tasks/task-application-service.d.ts +1 -0
  378. package/dist/src/tasks/task-application-service.js +10 -3
  379. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  380. package/dist/src/tasks/task-context-assembler.js +2 -1
  381. package/dist/src/tasks/task-handoff-service.js +1 -1
  382. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  383. package/dist/src/tasks/task-main-update-delivery.js +32 -1
  384. package/dist/src/tasks/task-result-delivery-repository.d.ts +18 -0
  385. package/dist/src/tasks/task-result-delivery-repository.js +144 -0
  386. package/dist/src/tasks/task-result-delivery-service.d.ts +4 -0
  387. package/dist/src/tasks/task-result-delivery-service.js +128 -0
  388. package/dist/src/tasks/task-run-coordinator.js +6 -1
  389. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  390. package/dist/src/tasks/task-run-dispatcher.js +22 -3
  391. package/dist/src/tui/backends/embedded-backend.js +10 -10
  392. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  393. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  394. package/dist/src/tui/tui-command-formatters.js +1 -1
  395. package/dist/src/tui/tui-commands.js +6 -6
  396. package/dist/src/tui/tui-picker-overlay.js +1 -1
  397. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  398. package/dist/src/tui/tui-startup-resources.js +4 -4
  399. package/dist/src/tui/tui.js +7 -7
  400. package/dist/src/tunnel/frpc-binary.js +1 -1
  401. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  402. package/dist/src/voice/realtime/memory-context.js +3 -3
  403. package/dist/src/voice/realtime/runtime.js +4 -4
  404. package/dist/src/voice/stt/index.js +2 -2
  405. package/dist/src/voice/stt/preflight.js +1 -1
  406. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  407. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  408. package/dist/src/voice/stt/transcribe-core.js +1 -1
  409. package/dist/src/voice/tts/index.js +3 -3
  410. package/dist/src/voice/tts/merge-config.js +1 -1
  411. package/dist/src/voice/tts/payload.js +1 -1
  412. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  413. package/dist/src/voice/tts/speak-core.js +1 -1
  414. package/dist/src/work-discovery/incremental-repository.js +1 -1
  415. package/dist/src/work-discovery/index.js +1 -1
  416. package/dist/src/work-discovery/service.js +5 -5
  417. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  418. package/dist/src/workflows/service/workflow-run-service.js +8 -8
  419. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  420. package/package.json +1 -1
  421. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B23VK3UU.js +0 -1
  422. package/dist/gateway/static/root/assets/agent-plugin-dialog-BuKJ-Ybo.js +0 -1
  423. package/dist/gateway/static/root/assets/agents-DxH-UFs7.js +0 -66
  424. package/dist/gateway/static/root/assets/automations-workspace-DMqpfefB.js +0 -7
  425. package/dist/gateway/static/root/assets/capabilities-page-KUggKcIq.js +0 -2
  426. package/dist/gateway/static/root/assets/capabilities-settings-panel-CD5K7e1B.js +0 -8
  427. package/dist/gateway/static/root/assets/channels-CG_xCUnf.js +0 -1
  428. package/dist/gateway/static/root/assets/computer-settings-page-CqY40STw.js +0 -1
  429. package/dist/gateway/static/root/assets/connectors-page-Cn14oruE.js +0 -2
  430. package/dist/gateway/static/root/assets/date-picker-B4jSGi8k.js +0 -1
  431. package/dist/gateway/static/root/assets/device-pairing-wizard-DKO8iqDJ.js +0 -1
  432. package/dist/gateway/static/root/assets/gateway-settings-DAQu7q_Q.js +0 -1
  433. package/dist/gateway/static/root/assets/home-page-BHS2713D.js +0 -1
  434. package/dist/gateway/static/root/assets/index-BcTY7RBG.js +0 -106
  435. package/dist/gateway/static/root/assets/notes-page-FORwlFnt.js +0 -8
  436. package/dist/gateway/static/root/assets/personal-page-BpTFGG44.js +0 -1
  437. package/dist/gateway/static/root/assets/popover-select-BNZZDJpO.js +0 -1
  438. package/dist/gateway/static/root/assets/remote-access-hub-CzzTxbhr.js +0 -1
  439. package/dist/gateway/static/root/assets/session-manager-BK5IvdGz.js +0 -16
  440. package/dist/gateway/static/root/assets/sessions-page-DkXKhSWK.js +0 -1
  441. package/dist/gateway/static/root/assets/settings-advanced-gate-C7ww6VRj.js +0 -1
  442. package/dist/gateway/static/root/assets/settings-shell-layer-context-BTQUDoJ2.js +0 -1
  443. package/dist/gateway/static/root/assets/shares-settings-DXpj-oOC.js +0 -1
  444. package/dist/gateway/static/root/assets/skills-page-cwXzLyU0.js +0 -2
  445. package/dist/gateway/static/root/assets/user-model-page-DpPGpkkg.js +0 -2
  446. package/dist/gateway/static/root/assets/workflows-page-CgJlVdec.js +0 -6
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./activity-YogQEteU.js";import{t as o}from"./chevron-right-BweFrslA.js";import{t as s}from"./popover-select-BNZZDJpO.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-CnM6Qfr7.js";import{t as d}from"./cn-JdwAhgNB.js";import{i as f,n as te,r as p}from"./locale-store-ChN_vjs2.js";import{a as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./button-CS04eWY9.js";import{i as ne,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./index.module-Cd9ENXfk.js";import{Co as re,Eo as ie,ei as w,gc as T,is as E,ti as D,ws as O}from"./index-BcTY7RBG.js";import{t as k}from"./page-tabs-D2xpUV26.js";import{n as A,r as j,t as M}from"./settings-page-layout-X1x-2Cp9.js";import{t as N}from"./device-pairing-wizard-DKO8iqDJ.js";import{n as P}from"./settings-loading-skeleton-CAmWMaOT.js";var F=e(t(),1),I=n(),L=720*60*60*1e3;function R(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function z(e){return R(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function ae(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function oe(e,t=Date.now()){return z(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-L:!1}function se(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=z(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?oe(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 ce(e){return e.length>8?e.slice(-8):e}var B=r();function le(e){let t=(0,I.c)(59),{device:n,busy:r,onClose:i,onRevoke:a}=e,o=te(V),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let c=s.endpointToolsSettings,l=o===`zh`?`zh-CN`:`en`,f;t[2]===l?f=t[3]:(f=new Intl.DateTimeFormat(l,{dateStyle:`medium`,timeStyle:`short`}),t[2]=l,t[3]=f);let p=f,b;t[4]===n?b=t[5]:(b=n?z(n):`offline`,t[4]=n,t[5]=b);let C=b,re=n!==null,w;t[6]===i?w=t[7]:(w=e=>!e&&i(),t[6]=i,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,B.jsx)(m,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=d(`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`,ne),t[9]=E):E=t[9];let D=n?.displayName??c.deviceDetails,O;t[10]===D?O=t[11]:(O=(0,B.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:D}),t[10]=D,t[11]=O);let k;t[12]===n?k=t[13]:(k=n?(0,B.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,ce(n.id)]}):null,t[12]=n,t[13]=k);let A;t[14]!==O||t[15]!==k?(A=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[O,k]}),t[14]=O,t[15]=k,t[16]=A):A=t[16];let j;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,B.jsx)(u,{className:`size-5`,"aria-hidden":!0}),t[17]=j):j=t[17];let M;t[18]===c.close?M=t[19]:(M=(0,B.jsx)(h,{asChild:!0,children:(0,B.jsx)(x,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:j})}),t[18]=c.close,t[19]=M);let N;t[20]!==A||t[21]!==M?(N=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[A,M]}),t[20]=A,t[21]=M,t[22]=N):N=t[22];let P;t[23]!==c.accessActive||t[24]!==c.accessRevoked||t[25]!==c.accessTitle||t[26]!==c.createdAt||t[27]!==c.endpointCount||t[28]!==c.endpointsTitle||t[29]!==c.identityId||t[30]!==c.identityTitle||t[31]!==c.lastSeen||t[32]!==c.never||t[33]!==c.noAccessIdentity||t[34]!==c.noOnlineEndpoints||t[35]!==c.noPermissions||t[36]!==c.permissions||t[37]!==c.status||t[38]!==c.statusLabel||t[39]!==c.toolCount||t[40]!==n||t[41]!==p||t[42]!==C?(P=n?(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,B.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,B.jsx)(H,{label:c.statusLabel,value:c.status[C]}),(0,B.jsx)(H,{label:c.lastSeen,value:n.lastSeenAt?p.format(n.lastSeenAt):c.never}),(0,B.jsx)(H,{label:c.endpointCount,value:String(n.endpoints.length)}),(0,B.jsx)(H,{label:c.toolCount,value:String(ae(n))})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.accessTitle}),(0,B.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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:n.access.revokedAt?c.accessRevoked:c.accessActive}),(0,B.jsxs)(`p`,{className:`mt-1 break-words`,children:[c.permissions,`: `,n.access.scopes.join(`, `)||c.noPermissions]})]}):(0,B.jsx)(`p`,{children:c.noAccessIdentity})})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.endpointsTitle}),(0,B.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,B.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,B.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,B.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[c.status[e.availability],` · v`,e.appVersion]})]}),(0,B.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,B.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,B.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:t.requiredPermissions.join(`, `)||c.noPermissions})]},t.name)})})]},e.connectionId))]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.identityTitle}),(0,B.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,B.jsx)(H,{label:c.identityId,value:n.id,breakAll:!0}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(H,{label:c.createdAt,value:p.format(n.createdAt)})})]})]})]}):null,t[23]=c.accessActive,t[24]=c.accessRevoked,t[25]=c.accessTitle,t[26]=c.createdAt,t[27]=c.endpointCount,t[28]=c.endpointsTitle,t[29]=c.identityId,t[30]=c.identityTitle,t[31]=c.lastSeen,t[32]=c.never,t[33]=c.noAccessIdentity,t[34]=c.noOnlineEndpoints,t[35]=c.noPermissions,t[36]=c.permissions,t[37]=c.status,t[38]=c.statusLabel,t[39]=c.toolCount,t[40]=n,t[41]=p,t[42]=C,t[43]=P):P=t[43];let F;t[44]!==r||t[45]!==c.removeDevice||t[46]!==c.revoking||t[47]!==n||t[48]!==a||t[49]!==C?(F=n&&C!==`revoked`?(0,B.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,B.jsxs)(x,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,B.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),r?c.revoking:c.removeDevice]})}):null,t[44]=r,t[45]=c.removeDevice,t[46]=c.revoking,t[47]=n,t[48]=a,t[49]=C,t[50]=F):F=t[50];let L;t[51]!==N||t[52]!==P||t[53]!==F?(L=(0,B.jsxs)(g,{children:[T,(0,B.jsxs)(_,{className:E,"aria-describedby":void 0,children:[N,P,F]})]}),t[51]=N,t[52]=P,t[53]=F,t[54]=L):L=t[54];let R;return t[55]!==L||t[56]!==re||t[57]!==w?(R=(0,B.jsx)(y,{open:re,onOpenChange:w,children:L}),t[55]=L,t[56]=re,t[57]=w,t[58]=R):R=t[58],R}function V(e){return e.language}function H(e){let t=(0,I.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,B.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`,c;t[2]===s?c=t[3]:(c=d(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,B.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function ue(e){let t=(0,I.c)(19),{onPaired:n}=e,[r,a]=i(),o=te(de),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let l=s.endpointToolsSettings.deviceAccess,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={open:!1},t[2]=u):u=t[2];let[d,f]=(0,F.useState)(u),p,m;t[3]!==r||t[4]!==a?(p=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(f({open:!0,target:e}),a(U,{replace:!0}))},m=[r,a],t[3]=r,t[4]=a,t[5]=p,t[6]=m):(p=t[5],m=t[6]),(0,F.useEffect)(p,m);let h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f({open:!0}),g=(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===l.addDevice?_=t[10]:(_=(0,B.jsxs)(x,{variant:`primary`,onClick:h,children:[g,l.addDevice]}),t[9]=l.addDevice,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>f(t=>({...t,open:e})),t[11]=v):v=t[11];let y;t[12]!==d.open||t[13]!==d.target||t[14]!==n?(y=(0,B.jsx)(N,{open:d.open,onOpenChange:v,onPaired:n,targetKind:d.target}),t[12]=d.open,t[13]=d.target,t[14]=n,t[15]=y):y=t[15];let b;return t[16]!==_||t[17]!==y?(b=(0,B.jsxs)(B.Fragment,{children:[_,y]}),t[16]=_,t[17]=y,t[18]=b):b=t[18],b}function U(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function de(e){return e.language}async function W(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 fe(){return p(`/api/endpoint-tools/devices`)}function pe(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),p(`/api/endpoint-tools/invocations?${t}`)}async function me(){return W(await f(fe()))}async function he(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 W(await f(p(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function ge(e){return W(await f(pe(e)))}var _e=5e3,G=20,ve=20;function ye(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 be(e){let t=(0,I.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=d(`rounded-full px-2 py-0.5 text-xs font-medium`,ye(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,B.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function xe(){let e=te(e=>e.language),t=ee(e).endpointToolsSettings,[n,r]=i(),c=n.get(`view`)===`activity`?`activity`:`devices`,[u,f]=(0,F.useState)(null),[p,m]=(0,F.useState)([]),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(!1),[y,ne]=(0,F.useState)(``),[S,N]=(0,F.useState)(`active`),[I,L]=(0,F.useState)(``),[R,V]=(0,F.useState)(1),[H,U]=(0,F.useState)(()=>new Set),[de,W]=(0,F.useState)(``),[ye]=C(de,250),[xe,Se]=(0,F.useState)(``),[Ce,we]=(0,F.useState)(``),[Te,Ee]=(0,F.useState)(``),[De,K]=(0,F.useState)(1),Oe={page:De,pageSize:ve,query:ye,principalId:xe,status:Ce,effect:Te},q=b(fe(),me,{refreshInterval:_e}),J=b(c===`activity`?pe(Oe):null,()=>ge(Oe),{refreshInterval:_e,keepPreviousData:!0}),ke=(0,F.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(q.isLoading&&!q.data)return(0,B.jsx)(j,{children:(0,B.jsx)(P,{sections:2})});let Y=q.data??[],Ae=J.data?.items??[],je=Y.filter(e=>z(e)===`online`).length,Me=Y.filter(e=>z(e)!==`revoked`).length,Ne=Y.filter(e=>oe(e)).length,Pe=[...new Set(Y.map(e=>e.platform))].toSorted(),X=se(Y,{query:y,status:S,platform:I}),Fe=Math.max(1,Math.ceil(X.length/G)),Z=Math.min(R,Fe),Ie=X.slice((Z-1)*G,Z*G),Q=Ie.reduce((e,t)=>(z(t)!==`revoked`&&e.push(t.id),e),[]),Le=Q.length>0&&Q.every(e=>H.has(e)),Re=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},ze=async()=>{await Promise.all([q.mutate(),c===`activity`?J.mutate():Promise.resolve()])},Be=async()=>{if(!(p.length===0||h)){g(!0),v(!1);try{await he(p.map(e=>e.id)),m([]),U(new Set),await q.mutate()}catch{v(!0)}finally{g(!1)}}},$=e=>{e(),V(1),U(new Set)};return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:t.title,subtitle:t.subtitle,actions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(w,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:ze}),(0,B.jsx)(ue,{onPaired:()=>void q.mutate()})]})}),q.error||J.error?(0,B.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:Me,filter:`active`},{label:t.onlineDevices,value:je,filter:`online`},{label:t.staleDevices,value:Ne,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,B.jsxs)(`button`,{type:`button`,className:d(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,S===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":S===n,onClick:()=>{$(()=>N(n)),Re(`devices`)},children:[(0,B.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,B.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,B.jsx)(k,{items:[{id:`devices`,label:t.devicesTab,icon:E,count:Me},{id:`activity`,label:t.activityTab,icon:a,count:J.data?.total}],activeTab:c,onChange:Re,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,B.jsxs)(M,{id:`devices`,activeTab:c,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,B.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,B.jsxs)(`label`,{className:`relative block`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,B.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:y,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=>$(()=>ne(e.target.value))})]}),(0,B.jsx)(s,{value:S,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=>$(()=>N(e))}),(0,B.jsx)(s,{value:I,options:Pe.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>$(()=>L(e))})]}),H.size>0?(0,B.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,B.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(H.size))}),(0,B.jsxs)(x,{variant:`secondary`,className:`text-danger`,onClick:()=>{v(!1),m(Y.filter(e=>H.has(e.id)))},children:[(0,B.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Y.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):X.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,B.jsxs)(`label`,{className:d(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Q.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Le,disabled:Q.length===0,className:`size-4 accent-accent`,onChange:e=>{U(t=>{let n=new Set(t);for(let t of Q)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,B.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Ie.map(e=>{let n=z(e),r=e.kind===`mobile`?re:O;return(0,B.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`label`,{className:d(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,B.jsx)(`input`,{type:`checkbox`,checked:H.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{U(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,B.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:()=>f(e),children:[(0,B.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset 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.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,B.jsx)(be,{status:n,label:t.status[n]})]}),(0,B.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,ce(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?ke.format(e.lastSeenAt):t.never]})]}),(0,B.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(ae(e)))}),(0,B.jsx)(o,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Z-1)*G+1)).replace(`{{to}}`,String(Math.min(Z*G,X.length))).replace(`{{total}}`,String(X.length))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Z<=1,onClick:()=>V(e=>Math.max(1,e-1)),children:(0,B.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Z>=Fe,onClick:()=>V(e=>Math.min(Fe,e+1)),children:(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,B.jsxs)(M,{id:`activity`,activeTab:c,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,B.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,B.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:de,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=>{W(e.target.value),K(1)}})]}),(0,B.jsx)(s,{value:xe,options:Y.map(e=>({value:e.id,label:`${e.displayName} · ${ce(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{Se(e),K(1)}}),(0,B.jsx)(s,{value:Ce,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=>{we(e),K(1)}}),(0,B.jsx)(s,{value:Te,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=>{Ee(e),K(1)}})]}),J.isLoading&&!J.data?(0,B.jsx)(P,{sections:1}):null,Ae.length===0&&!J.isLoading?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,B.jsx)(`div`,{className:`space-y-2`,children:Ae.map(e=>(0,B.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,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,B.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[ke.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,B.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,B.jsx)(be,{status:e.status,label:t.status[e.status]})]},e.id))}),J.data&&J.data.total>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((J.data.page-1)*J.data.pageSize+1)).replace(`{{to}}`,String(Math.min(J.data.page*J.data.pageSize,J.data.total))).replace(`{{total}}`,String(J.data.total))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:J.data.page<=1,onClick:()=>K(e=>Math.max(1,e-1)),children:(0,B.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:J.data.page>=J.data.totalPages,onClick:()=>K(e=>Math.min(J.data.totalPages,e+1)),children:(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,B.jsx)(le,{device:u,busy:h,onClose:()=>f(null),onRevoke:e=>{f(null),v(!1),m([e])}}),(0,B.jsx)(D,{open:p.length>0,title:p.length>1?t.removeManyTitle:t.removeTitle,description:`${p.length>1?t.removeManyDescription.replace(`{{count}}`,String(p.length)):t.removeDescription.replace(`{{name}}`,p[0]?.displayName??``)}${_?`\n\n${t.revokeError}`:``}`,confirmLabel:h?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Be(),onCancel:()=>{h||m([])}})]})}export{xe as EndpointToolsManagementSettings};
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-BMYIfy9x.js";import{t as a}from"./activity-YogQEteU.js";import{t as o}from"./chevron-right-BweFrslA.js";import{t as s}from"./popover-select-BgSdSbCL.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as ee}from"./messages-CnM6Qfr7.js";import{t as d}from"./cn-JdwAhgNB.js";import{i as f,n as te,r as p}from"./locale-store-ChN_vjs2.js";import{a as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./button-CS04eWY9.js";import{i as ne,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as C}from"./index.module-Cd9ENXfk.js";import{Do as re,Ts as ie,_c as w,as as T,ni as E,ti as D,wo as O}from"./index-BXrBL_Hb.js";import{t as k}from"./page-tabs-D2xpUV26.js";import{n as A,r as j,t as M}from"./settings-page-layout-X1x-2Cp9.js";import{t as N}from"./device-pairing-wizard-DVAGb04L.js";import{n as P}from"./settings-loading-skeleton-CAmWMaOT.js";var F=e(t(),1),I=n(),L=720*60*60*1e3;function R(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function z(e){return R(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function ae(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function oe(e,t=Date.now()){return z(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-L:!1}function se(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=z(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?oe(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 ce(e){return e.length>8?e.slice(-8):e}var B=r();function le(e){let t=(0,I.c)(59),{device:n,busy:r,onClose:i,onRevoke:a}=e,o=te(V),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let c=s.endpointToolsSettings,l=o===`zh`?`zh-CN`:`en`,f;t[2]===l?f=t[3]:(f=new Intl.DateTimeFormat(l,{dateStyle:`medium`,timeStyle:`short`}),t[2]=l,t[3]=f);let p=f,b;t[4]===n?b=t[5]:(b=n?z(n):`offline`,t[4]=n,t[5]=b);let C=b,ie=n!==null,w;t[6]===i?w=t[7]:(w=e=>!e&&i(),t[6]=i,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,B.jsx)(m,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=d(`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`,ne),t[9]=E):E=t[9];let D=n?.displayName??c.deviceDetails,O;t[10]===D?O=t[11]:(O=(0,B.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:D}),t[10]=D,t[11]=O);let k;t[12]===n?k=t[13]:(k=n?(0,B.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,ce(n.id)]}):null,t[12]=n,t[13]=k);let A;t[14]!==O||t[15]!==k?(A=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[O,k]}),t[14]=O,t[15]=k,t[16]=A):A=t[16];let j;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,B.jsx)(u,{className:`size-5`,"aria-hidden":!0}),t[17]=j):j=t[17];let M;t[18]===c.close?M=t[19]:(M=(0,B.jsx)(h,{asChild:!0,children:(0,B.jsx)(x,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":c.close,children:j})}),t[18]=c.close,t[19]=M);let N;t[20]!==A||t[21]!==M?(N=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[A,M]}),t[20]=A,t[21]=M,t[22]=N):N=t[22];let P;t[23]!==c.accessActive||t[24]!==c.accessRevoked||t[25]!==c.accessTitle||t[26]!==c.createdAt||t[27]!==c.endpointCount||t[28]!==c.endpointsTitle||t[29]!==c.identityId||t[30]!==c.identityTitle||t[31]!==c.lastSeen||t[32]!==c.never||t[33]!==c.noAccessIdentity||t[34]!==c.noOnlineEndpoints||t[35]!==c.noPermissions||t[36]!==c.permissions||t[37]!==c.status||t[38]!==c.statusLabel||t[39]!==c.toolCount||t[40]!==n||t[41]!==p||t[42]!==C?(P=n?(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,B.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,B.jsx)(H,{label:c.statusLabel,value:c.status[C]}),(0,B.jsx)(H,{label:c.lastSeen,value:n.lastSeenAt?p.format(n.lastSeenAt):c.never}),(0,B.jsx)(H,{label:c.endpointCount,value:String(n.endpoints.length)}),(0,B.jsx)(H,{label:c.toolCount,value:String(ae(n))})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.accessTitle}),(0,B.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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:n.access.revokedAt?c.accessRevoked:c.accessActive}),(0,B.jsxs)(`p`,{className:`mt-1 break-words`,children:[c.permissions,`: `,n.access.scopes.join(`, `)||c.noPermissions]})]}):(0,B.jsx)(`p`,{children:c.noAccessIdentity})})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.endpointsTitle}),(0,B.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,B.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,B.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,B.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[c.status[e.availability],` · v`,e.appVersion]})]}),(0,B.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,B.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,B.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:t.requiredPermissions.join(`, `)||c.noPermissions})]},t.name)})})]},e.connectionId))]})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.identityTitle}),(0,B.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,B.jsx)(H,{label:c.identityId,value:n.id,breakAll:!0}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(H,{label:c.createdAt,value:p.format(n.createdAt)})})]})]})]}):null,t[23]=c.accessActive,t[24]=c.accessRevoked,t[25]=c.accessTitle,t[26]=c.createdAt,t[27]=c.endpointCount,t[28]=c.endpointsTitle,t[29]=c.identityId,t[30]=c.identityTitle,t[31]=c.lastSeen,t[32]=c.never,t[33]=c.noAccessIdentity,t[34]=c.noOnlineEndpoints,t[35]=c.noPermissions,t[36]=c.permissions,t[37]=c.status,t[38]=c.statusLabel,t[39]=c.toolCount,t[40]=n,t[41]=p,t[42]=C,t[43]=P):P=t[43];let F;t[44]!==r||t[45]!==c.removeDevice||t[46]!==c.revoking||t[47]!==n||t[48]!==a||t[49]!==C?(F=n&&C!==`revoked`?(0,B.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,B.jsxs)(x,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),r?c.revoking:c.removeDevice]})}):null,t[44]=r,t[45]=c.removeDevice,t[46]=c.revoking,t[47]=n,t[48]=a,t[49]=C,t[50]=F):F=t[50];let L;t[51]!==N||t[52]!==P||t[53]!==F?(L=(0,B.jsxs)(g,{children:[T,(0,B.jsxs)(_,{className:E,"aria-describedby":void 0,children:[N,P,F]})]}),t[51]=N,t[52]=P,t[53]=F,t[54]=L):L=t[54];let R;return t[55]!==L||t[56]!==ie||t[57]!==w?(R=(0,B.jsx)(y,{open:ie,onOpenChange:w,children:L}),t[55]=L,t[56]=ie,t[57]=w,t[58]=R):R=t[58],R}function V(e){return e.language}function H(e){let t=(0,I.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,B.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`,c;t[2]===s?c=t[3]:(c=d(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,B.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,B.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function ue(e){let t=(0,I.c)(19),{onPaired:n}=e,[r,a]=i(),o=te(de),s;t[0]===o?s=t[1]:(s=ee(o),t[0]=o,t[1]=s);let l=s.endpointToolsSettings.deviceAccess,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={open:!1},t[2]=u):u=t[2];let[d,f]=(0,F.useState)(u),p,m;t[3]!==r||t[4]!==a?(p=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(f({open:!0,target:e}),a(U,{replace:!0}))},m=[r,a],t[3]=r,t[4]=a,t[5]=p,t[6]=m):(p=t[5],m=t[6]),(0,F.useEffect)(p,m);let h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f({open:!0}),g=(0,B.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===l.addDevice?_=t[10]:(_=(0,B.jsxs)(x,{variant:`primary`,onClick:h,children:[g,l.addDevice]}),t[9]=l.addDevice,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>f(t=>({...t,open:e})),t[11]=v):v=t[11];let y;t[12]!==d.open||t[13]!==d.target||t[14]!==n?(y=(0,B.jsx)(N,{open:d.open,onOpenChange:v,onPaired:n,targetKind:d.target}),t[12]=d.open,t[13]=d.target,t[14]=n,t[15]=y):y=t[15];let b;return t[16]!==_||t[17]!==y?(b=(0,B.jsxs)(B.Fragment,{children:[_,y]}),t[16]=_,t[17]=y,t[18]=b):b=t[18],b}function U(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function de(e){return e.language}async function W(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 fe(){return p(`/api/endpoint-tools/devices`)}function pe(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),p(`/api/endpoint-tools/invocations?${t}`)}async function me(){return W(await f(fe()))}async function he(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 W(await f(p(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function ge(e){return W(await f(pe(e)))}var _e=5e3,G=20,ve=20;function ye(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 be(e){let t=(0,I.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=d(`rounded-full px-2 py-0.5 text-xs font-medium`,ye(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,B.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function xe(){let e=te(e=>e.language),t=ee(e).endpointToolsSettings,[n,r]=i(),c=n.get(`view`)===`activity`?`activity`:`devices`,[u,f]=(0,F.useState)(null),[p,m]=(0,F.useState)([]),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(!1),[y,ne]=(0,F.useState)(``),[S,N]=(0,F.useState)(`active`),[I,L]=(0,F.useState)(``),[R,V]=(0,F.useState)(1),[H,U]=(0,F.useState)(()=>new Set),[de,W]=(0,F.useState)(``),[ye]=C(de,250),[xe,Se]=(0,F.useState)(``),[Ce,we]=(0,F.useState)(``),[Te,Ee]=(0,F.useState)(``),[De,K]=(0,F.useState)(1),Oe={page:De,pageSize:ve,query:ye,principalId:xe,status:Ce,effect:Te},q=b(fe(),me,{refreshInterval:_e}),J=b(c===`activity`?pe(Oe):null,()=>ge(Oe),{refreshInterval:_e,keepPreviousData:!0}),ke=(0,F.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(q.isLoading&&!q.data)return(0,B.jsx)(j,{children:(0,B.jsx)(P,{sections:2})});let Y=q.data??[],Ae=J.data?.items??[],je=Y.filter(e=>z(e)===`online`).length,Me=Y.filter(e=>z(e)!==`revoked`).length,Ne=Y.filter(e=>oe(e)).length,Pe=[...new Set(Y.map(e=>e.platform))].toSorted(),X=se(Y,{query:y,status:S,platform:I}),Fe=Math.max(1,Math.ceil(X.length/G)),Z=Math.min(R,Fe),Ie=X.slice((Z-1)*G,Z*G),Q=Ie.reduce((e,t)=>(z(t)!==`revoked`&&e.push(t.id),e),[]),Le=Q.length>0&&Q.every(e=>H.has(e)),Re=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},ze=async()=>{await Promise.all([q.mutate(),c===`activity`?J.mutate():Promise.resolve()])},Be=async()=>{if(!(p.length===0||h)){g(!0),v(!1);try{await he(p.map(e=>e.id)),m([]),U(new Set),await q.mutate()}catch{v(!0)}finally{g(!1)}}},$=e=>{e(),V(1),U(new Set)};return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:t.title,subtitle:t.subtitle,actions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(D,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:ze}),(0,B.jsx)(ue,{onPaired:()=>void q.mutate()})]})}),q.error||J.error?(0,B.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:Me,filter:`active`},{label:t.onlineDevices,value:je,filter:`online`},{label:t.staleDevices,value:Ne,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,B.jsxs)(`button`,{type:`button`,className:d(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,S===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":S===n,onClick:()=>{$(()=>N(n)),Re(`devices`)},children:[(0,B.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,B.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,B.jsx)(k,{items:[{id:`devices`,label:t.devicesTab,icon:T,count:Me},{id:`activity`,label:t.activityTab,icon:a,count:J.data?.total}],activeTab:c,onChange:Re,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,B.jsxs)(M,{id:`devices`,activeTab:c,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,B.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,B.jsxs)(`label`,{className:`relative block`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,B.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:y,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=>$(()=>ne(e.target.value))})]}),(0,B.jsx)(s,{value:S,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=>$(()=>N(e))}),(0,B.jsx)(s,{value:I,options:Pe.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>$(()=>L(e))})]}),H.size>0?(0,B.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,B.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(H.size))}),(0,B.jsxs)(x,{variant:`secondary`,className:`text-danger`,onClick:()=>{v(!1),m(Y.filter(e=>H.has(e.id)))},children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Y.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):X.length===0?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,B.jsxs)(`label`,{className:d(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Q.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Le,disabled:Q.length===0,className:`size-4 accent-accent`,onChange:e=>{U(t=>{let n=new Set(t);for(let t of Q)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,B.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Ie.map(e=>{let n=z(e),r=e.kind===`mobile`?O:ie;return(0,B.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`label`,{className:d(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,B.jsx)(`input`,{type:`checkbox`,checked:H.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{U(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,B.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:()=>f(e),children:[(0,B.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset 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.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,B.jsx)(be,{status:n,label:t.status[n]})]}),(0,B.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,ce(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?ke.format(e.lastSeenAt):t.never]})]}),(0,B.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(ae(e)))}),(0,B.jsx)(o,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Z-1)*G+1)).replace(`{{to}}`,String(Math.min(Z*G,X.length))).replace(`{{total}}`,String(X.length))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Z<=1,onClick:()=>V(e=>Math.max(1,e-1)),children:(0,B.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Z>=Fe,onClick:()=>V(e=>Math.min(Fe,e+1)),children:(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,B.jsxs)(M,{id:`activity`,activeTab:c,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,B.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,B.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,B.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,B.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:de,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=>{W(e.target.value),K(1)}})]}),(0,B.jsx)(s,{value:xe,options:Y.map(e=>({value:e.id,label:`${e.displayName} · ${ce(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{Se(e),K(1)}}),(0,B.jsx)(s,{value:Ce,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=>{we(e),K(1)}}),(0,B.jsx)(s,{value:Te,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=>{Ee(e),K(1)}})]}),J.isLoading&&!J.data?(0,B.jsx)(P,{sections:1}):null,Ae.length===0&&!J.isLoading?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,B.jsx)(`div`,{className:`space-y-2`,children:Ae.map(e=>(0,B.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,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,B.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[ke.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,B.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,B.jsx)(be,{status:e.status,label:t.status[e.status]})]},e.id))}),J.data&&J.data.total>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((J.data.page-1)*J.data.pageSize+1)).replace(`{{to}}`,String(Math.min(J.data.page*J.data.pageSize,J.data.total))).replace(`{{total}}`,String(J.data.total))}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:J.data.page<=1,onClick:()=>K(e=>Math.max(1,e-1)),children:(0,B.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(x,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:J.data.page>=J.data.totalPages,onClick:()=>K(e=>Math.min(J.data.totalPages,e+1)),children:(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,B.jsx)(le,{device:u,busy:h,onClose:()=>f(null),onRevoke:e=>{f(null),v(!1),m([e])}}),(0,B.jsx)(E,{open:p.length>0,title:p.length>1?t.removeManyTitle:t.removeTitle,description:`${p.length>1?t.removeManyDescription.replace(`{{count}}`,String(p.length)):t.removeDescription.replace(`{{name}}`,p[0]?.displayName??``)}${_?`\n\n${t.revokeError}`:``}`,confirmLabel:h?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Be(),onCancel:()=>{h||m([])}})]})}export{xe as EndpointToolsManagementSettings};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-_-QK0EnY.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BcTY7RBG.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DKlJx4eo.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-ChN_vjs2.js","assets/messages-CnM6Qfr7.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BNZZDJpO.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-DPl3VYM8.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-qK3z-EGz.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-D809I8ur.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-UkGomZfv.js","assets/gateway-startup-retry-Wtxq_y2f.js","assets/constants-Co2_smKQ.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-BtXzxf_w.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-CnmHVy1D.js","assets/share-link-dialog-QAjExHAL.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-Bigu28Z6.js","assets/local-session-drafts-CeHhcudO.js","assets/tasks-CH6KoBeY.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-DwqLga5H.js","assets/capabilities-BXG_5wIg.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-D8nvWMMC.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-DBRa17u3.js","assets/gateway-realtime-store-7glMlD2l.js","assets/extension-provider-aigS3RJu.js","assets/session-manager-BK5IvdGz.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BM_81rLe.js","assets/agents-admin-api-BtnYiq7O.js","assets/gateway-config-swr-EZxaKXdC.js","assets/send-session-input-OaBPDJ9E.js","assets/theme-store-DTYk7Gll.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-DnIOzcvn.js","assets/oauth-api-BXn1a9qx.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-display-name-DXhO9rcM.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-DUgsBdV3.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.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{f as a,t as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u}from"./popover-select-BNZZDJpO.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./ellipsis-0k4rZLoy.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./eye-CABVeTq0.js";import{y as _}from"./markdown-view-DKlJx4eo.js";import{C as v,E as y,O as b,S as x,T as S,_ as C,a as w,c as T,d as E,f as D,h as O,l as k,m as A,n as j,r as M,s as N,u as P,w as F,x as I}from"./notes-api-D8nvWMMC.js";import{t as L}from"./loader-circle-CifKLtgG.js";import{t as R}from"./pencil-DmIY3Oa-.js";import{t as z}from"./play-kxZvpBg8.js";import{t as ee}from"./search-DA7gz22f.js";import{t as B}from"./sparkles-DHlfQFAF.js";import{t as te}from"./x-B_N4OPjy.js";import{t as V}from"./messages-CnM6Qfr7.js";import{t as H}from"./cn-JdwAhgNB.js";import{a as U,c as ne,f as re,n as ie,r as W}from"./locale-store-ChN_vjs2.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./dist-BGTk37IG.js";import{t as fe}from"./session-manager-BK5IvdGz.js";import{t as G}from"./copy-to-clipboard-HOJ79TWv.js";import{i as pe}from"./vendor-swr-BIWyz7Rc.js";import{t as K}from"./button-CS04eWY9.js";import{r as me}from"./app-chrome-BeB4KgOf.js";import{i as he}from"./theme-store-DTYk7Gll.js";import{t as ge}from"./skeleton-BwbyijEw.js";import{b as q,d as _e,o as ve,s as ye,v as be}from"./shares-api-DwqLga5H.js";import{An as xe,Dn as Se,En as Ce,F as we,Fo as Te,Gs as Ee,I as De,Jn as Oe,Ki as ke,Kn as Ae,Nc as je,Ns as Me,On as Ne,Oo as Pe,Pc as Fe,Yn as Ie,_c as Le,a as Re,c as J,co as ze,do as Be,jn as Ve,jt as He,kn as Ue,l as We,nn as Ge,o as Ke,oc as qe,os as Je,qn as Ye,s as Xe,ti as Ze,tn as Qe,uo as $e,vs as Y,yo as X}from"./index-BcTY7RBG.js";import{n as et,t as tt}from"./note-image-lightbox-1qg2v-9j.js";import{t as nt}from"./page-context-capture-button-C9H1dHg2.js";var Z=e(t(),1),rt=n(),Q=r(),it=6e4,at=36e5,ot=864e5;function st(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function $(e,t,n){let r=t-e;if(r<it)return n.justNow;if(r<at){let e=Math.floor(r/it);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=st(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ot)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*ot){let e=Math.floor(r/ot);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function ct(e,t,n){let r=st(t);if(e>=r)return n.today;if(e>=r-ot)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 lt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ut(e){let t=(0,rt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=ie(pt),f=V(u).automations.suggestions,p=V(u).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=pe(o?`automation-suggestion-coverage`:null,ft,h),_=o?g?.automations.find(e=>J(e,o)):void 0,v=_?Ke(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=H(`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,Q.jsx)(d,{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,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(K,{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=H(`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,Q.jsx)(Y,{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,Q.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 l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(K,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=H(`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,Q.jsx)(d,{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,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(K,{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,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Xe(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(dt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=H(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Y,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(K,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,Q.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return We.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.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,Q.jsx)(ae,{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,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(ue,{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,Q.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,Q.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,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.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,Q.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,Q.jsx)(K,{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 T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,D;t[37]!==w||t[38]!==T||t[39]!==E?(D=(0,Q.jsx)(K,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=D):D=t[40];let O;t[41]!==C||t[42]!==D?(O=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,D]}),t[41]=C,t[42]=D,t[43]=O):O=t[43];let k;t[44]!==x||t[45]!==O||t[46]!==f?(k=(0,Q.jsxs)(ce,{children:[u,(0,Q.jsxs)(le,{"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,O]})]}),t[44]=x,t[45]=O,t[46]=f,t[47]=k):k=t[47];let A;return t[48]!==l||t[49]!==k?(A=(0,Q.jsx)(de,{open:!0,onOpenChange:l,children:k}),t[48]=l,t[49]=k,t[50]=A):A=t[50],A}function ht(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 gt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function _t({noteId:e}){let t=s(),n=ie(e=>e.language)===`zh`,{data:r,mutate:i,isLoading:a}=pe([`note-discussion-document`,e],()=>Qe(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),d=r?.discussion.id,f=`/api/discussions/${encodeURIComponent(d??``)}`,{data:m=[],mutate:h}=pe(d?`${f}/actions`:null,e=>U(W(e)),{refreshInterval:1e4}),[g,v]=(0,Z.useState)(`summary`),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`general`),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)([]),[N,P]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(1),B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[H,ne]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{i(),h()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[i,h]),(0,Z.useEffect)(()=>{r?.discussion.template&&S(r.discussion.template)},[r?.discussion.template]);async function re(e){if(!F){I(!0),P(null);try{await e(),await i(),await h()}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(!1)}}}function oe(e){B.current&&(B.current.readyState===0?(V.current=e/1e3,B.current.load()):B.current.currentTime=e/1e3,B.current.play().catch(()=>void 0))}async function se(e,t){r?.organization&&await re(async()=>{w((await U(W(`${f}/transcript?revision=${t??r.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let fe=(e,t,r)=>t.some(e=>k||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>k||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F,onClick:()=>O({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:n?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`shrink-0 text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n?`暂无定位`:`No source timing`})]},e.id))]}):null;if(a)return(0,Q.jsx)(ge,{className:`h-48 w-full`});if(!r)return null;let{discussion:G,transcript:me,organization:he}=r,q=he?.organization,_e=[`stopping`,`sealing`,`organizing`].includes(G.status),ve=[`recording`,`completed`,`needs_attention`].includes(G.status),ye=me.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),be=ht(r,g,{query:y,page:L,showIgnored:k});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(Ee,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(G.durationMs??0),` · `,_e?n?`正在整理`:`Processing`:G.status===`completed`?n?`整理完成`:`Ready`:G.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(l,{value:x,"aria-label":n?`纪要模板`:`Summary template`,onChange:e=>S(e.target.value),children:[(0,Q.jsx)(u,{value:`general`,children:n?`通用会议`:`General`}),(0,Q.jsx)(u,{value:`project`,children:n?`项目例会`:`Project`}),(0,Q.jsx)(u,{value:`review`,children:n?`需求评审`:`Review`}),(0,Q.jsx)(u,{value:`interview`,children:n?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(K,{disabled:F||_e||!G.canonicalTranscript,onClick:()=>void re(()=>U(W(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:x})})),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),n?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":n?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:g===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>v(e),children:e===`summary`?n?`纪要与行动`:`Summary & actions`:n?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(p,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:W(`${f}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(nt,{resource:{kind:`note`,id:e,revision:String(r.note.remoteVersion??1)},selection:{text:be,draft:!1},label:n?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:F||_e||!!(D||T)||!be||be.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:be.length>16e3?n?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:n?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),N?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:N}):null,r.recordingJob?.state===`queued`||r.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:n?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,G.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:G.failureMessage}),(0,Q.jsx)(`button`,{disabled:F,onClick:()=>void re(()=>Ge(G.id)),children:n?`重试`:`Retry`})]}):null,he&&he.transcriptRevision!==me.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:n?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:g===`summary`?q?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:q.summaryEditedByUser?n?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:F||_e,onClick:()=>O({kind:`summary`,itemId:`summary`,text:q.summary}),children:n?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:q.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:k,onChange:e=>A(e.target.checked)}),n?`显示已忽略项`:`Show ignored items`]}),j.length?(0,Q.jsx)(K,{disabled:F,onClick:()=>void re(async()=>{for(let e of j)await U(W(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})});M([])}),children:n?`加入所选 ${j.length} 项任务`:`Add ${j.length} selected tasks`}):null,fe(n?`已决定事项`:`Decisions`,q.decisions,`decisions`),q.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`下一步行动`:`Next actions`}),q.actionItems.filter(e=>k||!e.ignored).map(e=>{let r=m.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!r&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${n?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:j.includes(e.id),onChange:t=>M(t.target.checked?[...j,e.id]:j.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F||_e,onClick:()=>O({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:n?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(n?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(n?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`查看原话`:`Source`}):null,r?r.deleted?(0,Q.jsx)(`span`,{children:n?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:_(`${t.pathname}${t.search}`,r.taskId),children:r.resolution===`done`?n?`已完成 · 查看任务`:`Done · View task`:n?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(K,{disabled:F||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void re(()=>U(W(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})})),children:n?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,fe(n?`风险`:`Risks`,q.risks,`risks`),fe(n?`尚未确定`:`Open questions`,q.openQuestions,`openQuestions`),q.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`前后变更`:`Changes during the meeting`}),q.changes.map(e=>{let t=[...q.decisions,...q.actionItems,...q.risks,...q.openQuestions],r=t.find(t=>t.id===e.fromId),i=t.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?n?`后续撤销或替代`:`Later superseded`:n?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,q.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`章节回顾`:`Chapters`}),q.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_e?n?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:n?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),_e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ge,{className:`h-6 w-3/4`}),(0,Q.jsx)(ge,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(ee,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:n?`查找原话或说话人`:`Search words or speaker`,value:y,onChange:e=>{b(e.target.value),R(1)}})]}),ye.slice(0,L*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${H>=e.startedAtMs&&H<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[(0,Q.jsx)(z,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(n?`未区分说话人`:`Speaker unknown`)}),ve&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>E({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:n?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(n?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ye.length>L*50?(0,Q.jsx)(K,{onClick:()=>R(L+1),children:n?`加载更多`:`More`}):null]})}),G.audioAttachmentId&&!G.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:B,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:W(`${f}/audio`),onTimeUpdate:()=>ne((B.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&B.current&&(B.current.currentTime=V.current,V.current=null)},onError:()=>P(n?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:W(`${f}/audio`),download:!0,children:n?`下载录音`:`Download recording`})]}):null,C?(0,Q.jsxs)(`aside`,{"aria-label":n?`原话证据`:`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,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:n?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭`:`Close`,onClick:()=>w(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:C.length?C.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.speakerLabel??(n?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:n?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,D&&he?(0,Q.jsx)(mt,{initial:D,zh:n,busy:F,onClose:()=>O(null),onSave:e=>re(async()=>{await U(W(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:he.revision})}),O(null)})},`${D.kind}:${D.itemId}:${he.revision}`):null,T?(0,Q.jsx)(de,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{"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,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(ue,{children:n?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭校对`:`Close editor`,onClick:()=>E(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[n?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.speaker,onChange:e=>E({...T,speaker:e.target.value})})]}),T.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!T.applyToSpeakerGroup,onChange:e=>E({...T,applyToSpeakerGroup:e.target.checked})}),n?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.text,onChange:e=>E({...T,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(K,{variant:`primary`,disabled:F||!T.text.trim(),onClick:()=>void re(async()=>{await U(W(`${f}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:me.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),n?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:R,ai_edit:B,sync:Te,restore:Fe};function yt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=ie(e=>e.language),o=V(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:re(a)},{data:c}=pe(e?[`note-history`,e]:null,()=>D(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await S(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.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,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=vt[e.trigger]??R,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:H(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:yt(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:$(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.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,Q.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,Q.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,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function xt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=V(ie(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:b}=pe(e?[`note-agent-context-status`,e]:null,()=>k(e),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>I(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Z.useCallback)(async t=>{try{await x(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(B,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.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,Q.jsx)(je,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:b||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,Q.jsx)(`span`,{className:H(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.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,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.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,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:H(`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,Q.jsx)($e,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:H(`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,Q.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Je,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.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,Q.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})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.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 St=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Ct({open:e,onOpenChange:t,note:n}){let r=ie(e=>e.language)===`zh`,i=r?Dt:Ot,{data:a,mutate:o}=pe(e?[`note-shares`,n.id]:null,()=>A(n.id)),s=pe(e?`hosted-share-auth-status`:null,_e),d=s.data===!0,p=pe(e&&d?`hosted-publication-capabilities`:null,ye),m=p.data?.publishing.allowed===!0,g=pe(e&&d?[`hosted-note-publications`,n.id]:null,()=>E(n.id)),[_,y]=(0,Z.useState)(new Set),[b,x]=(0,Z.useState)(`86400000`),[S,C]=(0,Z.useState)(``),[T,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(`hosted`),[j,N]=(0,Z.useState)(!1),[P,I]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null),[ee,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(null),U=(0,Z.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,Z.useEffect)(()=>{e&&(y(new Set(U.map(e=>e.id))),z(null),B(!1),H(null))},[e,U]);let ne=async()=>{N(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[..._],ttlMs:Number(b),maxViews:S.trim()?Number(S):null,description:T.trim()||void 0};O===`hosted`?(z((await M(n.id,e)).shareUrl),await g.mutate()):(z((await w(n.id,e)).payload.shareUrl),await o())}catch(e){H(e instanceof Error?e.message:String(e))}finally{N(!1)}},re=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):await be(e.id),await g.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},W=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await F(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await ve(e.id,864e5):await q(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},fe=async e=>{H(null);try{if(!await G(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,Q.jsx)(de,{open:e,onOpenChange:t,children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Pe,{className:`size-4`}),i.title]}),(0,Q.jsx)(oe,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(te,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),U.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:U.map(e=>(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:_.has(e.id),onChange:()=>y(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Et(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(l,{value:O,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(u,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(u,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(He,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&d&&p.data&&!m?(0,Q.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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(l,{value:b,onChange:e=>x(e.target.value),children:St.map(e=>(0,Q.jsx)(u,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:S,onChange:e=>C(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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:T,onChange:e=>D(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`})]})]}),R?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:R,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void fe(R),children:[ee?(0,Q.jsx)(c,{className:`size-4`}):(0,Q.jsx)(f,{className:`size-4`}),ee?i.copied:i.copy]}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(R,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(h,{className:`size-4`}),i.open]})]})}):null,V?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:V}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Tt,{share:e,busy:P===e.id,t:i,onCopy:fe,onAction:W},e.id))})]}):null,(g.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:g.data.map(e=>(0,Q.jsx)(wt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:P===e.id,publishingAllowed:m,t:i,onCopy:fe,onAction:re},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(K,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(K,{type:`button`,onClick:()=>void ne(),disabled:j||O===`hosted`&&(!d||!m),children:[j?(0,Q.jsx)(L,{className:`size-4 animate-spin`}):(0,Q.jsx)(Pe,{className:`size-4`}),j?i.creating:i.create]})]})]})]})})}function wt(e){let t=(0,rt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=H(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let p=r&&!l?o.stale:l?o.inactive:o.active,m;t[2]===p?m=t[3]:(m=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=m);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(`span`,{children:`·`}),t[4]=g):g=t[4];let _=n.maxViews===null?``:` / ${n.maxViews}`,v;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==_?(v=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,_]}),t[5]=n.viewCount,t[6]=o.views,t[7]=_,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`span`,{children:`·`}),t[9]=y):y=t[9];let b;t[10]!==n.revision||t[11]!==o.revision?(b=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=b):b=t[12];let x;t[13]!==m||t[14]!==v||t[15]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[m,g,v,y,b]}),t[13]=m,t[14]=v,t[15]=b,t[16]=x):x=t[16];let S;t[17]===n.shareUrl?S=t[18]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=S);let C;t[19]!==x||t[20]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]===i?w=t[23]:(w=i?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E=!a,D;t[27]!==s||t[28]!==n.shareUrl?(D=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=D):D=t[29];let O;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(f,{className:`size-3.5`}),t[30]=O):O=t[30];let k;t[31]!==o.copy||t[32]!==E||t[33]!==D?(k=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:E,onClick:D,children:[O,o.copy]}),t[31]=o.copy,t[32]=E,t[33]=D,t[34]=k):k=t[34];let A=!a,j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==o.open||t[39]!==A||t[40]!==j?(N=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:A,onClick:j,children:[M,o.open]}),t[38]=o.open,t[39]=A,t[40]=j,t[41]=N):N=t[41];let P;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(P=r&&!l?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Te,{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]=P):P=t[49];let F;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(F=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(ze,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=F):F=t[54];let I;t[55]!==k||t[56]!==N||t[57]!==P||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F]}),t[55]=k,t[56]=N,t[57]=P,t[58]=F,t[59]=I):I=t[59];let R;return t[60]!==T||t[61]!==d||t[62]!==I?(R=(0,Q.jsxs)(`div`,{className:d,children:[T,I]}),t[60]=T,t[61]=d,t[62]=I,t[63]=R):R=t[63],R}function Tt(e){let t=(0,rt.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=H(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,Q.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==d||t[16]!==g?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,_,y]}),t[14]=y,t[15]=d,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,Q.jsx)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(ze,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,Q.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={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:`撤销`},Ot={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 kt(e){let t=(0,rt.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=Ye(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=Ye(u),f=Ye(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Ae,{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,Q.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,Q.jsx)(X,{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,Q.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 At(e){return e.stop}function jt(e,t){let n=Oe(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Oe(e);return!r||n.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-K6is5GrS.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BXrBL_Hb.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DKlJx4eo.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-ChN_vjs2.js","assets/messages-CnM6Qfr7.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-right-BweFrslA.js","assets/popover-select-BgSdSbCL.js","assets/dist-C3DSFZCi.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-DPl3VYM8.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-pzPAUV_o.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-DNhXjL0W.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-UkGomZfv.js","assets/gateway-startup-retry-Wtxq_y2f.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-Dwa8kHdY.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-CnmHVy1D.js","assets/share-link-dialog-BvSRHs1P.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-Bigu28Z6.js","assets/local-session-drafts-CeHhcudO.js","assets/tasks-CH6KoBeY.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-DwqLga5H.js","assets/capabilities-BXG_5wIg.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-D8nvWMMC.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-DBRa17u3.js","assets/gateway-realtime-store-7glMlD2l.js","assets/extension-provider-Dg7cRxDX.js","assets/session-manager-DDR-gv_e.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BM_81rLe.js","assets/agents-admin-api-BtnYiq7O.js","assets/gateway-config-swr-EZxaKXdC.js","assets/send-session-input-Dt0t5SoR.js","assets/theme-store-DTYk7Gll.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-DnIOzcvn.js","assets/oauth-api-BXn1a9qx.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-display-name-DXhO9rcM.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-B7AHDHSO.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.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{f as a,t as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u}from"./popover-select-BgSdSbCL.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./ellipsis-0k4rZLoy.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./eye-CABVeTq0.js";import{y as _}from"./markdown-view-DKlJx4eo.js";import{C as v,E as y,O as b,S as x,T as S,_ as C,a as w,c as T,d as E,f as D,h as O,l as k,m as A,n as j,r as M,s as N,u as P,w as F,x as I}from"./notes-api-D8nvWMMC.js";import{t as L}from"./loader-circle-CifKLtgG.js";import{t as R}from"./pencil-DmIY3Oa-.js";import{t as z}from"./play-kxZvpBg8.js";import{t as ee}from"./search-DA7gz22f.js";import{t as B}from"./sparkles-DHlfQFAF.js";import{t as te}from"./x-B_N4OPjy.js";import{t as V}from"./messages-CnM6Qfr7.js";import{t as H}from"./cn-JdwAhgNB.js";import{a as U,c as ne,f as re,n as ie,r as W}from"./locale-store-ChN_vjs2.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./dist-BGTk37IG.js";import{t as fe}from"./session-manager-DDR-gv_e.js";import{t as G}from"./copy-to-clipboard-HOJ79TWv.js";import{i as pe}from"./vendor-swr-BIWyz7Rc.js";import{t as K}from"./button-CS04eWY9.js";import{r as me}from"./app-chrome-BeB4KgOf.js";import{i as he}from"./theme-store-DTYk7Gll.js";import{t as ge}from"./skeleton-BwbyijEw.js";import{b as q,d as _e,o as ve,s as ye,v as be}from"./shares-api-DwqLga5H.js";import{An as xe,Dn as Se,En as Ce,F as we,Fc as Te,I as Ee,Io as De,Jn as Oe,Kn as ke,Ks as Ae,On as je,Pc as Me,Ps as Ne,Yn as Pe,a as Fe,bo as Ie,c as J,do as Le,fo as Re,jn as ze,jt as Be,kn as Ve,ko as He,l as Ue,lo as We,ni as Ge,nn as Ke,o as qe,qi as Je,qn as Ye,s as Xe,sc as Ze,ss as Qe,tn as $e,vc as Y,ys as X}from"./index-BXrBL_Hb.js";import{n as et,t as tt}from"./note-image-lightbox-1qg2v-9j.js";import{t as nt}from"./page-context-capture-button-C72qIgBg.js";var Z=e(t(),1),rt=n(),Q=r(),it=6e4,at=36e5,ot=864e5;function st(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function $(e,t,n){let r=t-e;if(r<it)return n.justNow;if(r<at){let e=Math.floor(r/it);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=st(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ot)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*ot){let e=Math.floor(r/ot);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function ct(e,t,n){let r=st(t);if(e>=r)return n.today;if(e>=r-ot)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 lt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ut(e){let t=(0,rt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=ie(pt),f=V(u).automations.suggestions,p=V(u).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=pe(o?`automation-suggestion-coverage`:null,ft,h),_=o?g?.automations.find(e=>J(e,o)):void 0,v=_?qe(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=H(`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,Q.jsx)(d,{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,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(K,{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=H(`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,Q.jsx)(X,{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,Q.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 l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(K,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=H(`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,Q.jsx)(d,{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,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(K,{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,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Xe(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(dt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=H(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(X,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(K,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,Q.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return Ue.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.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,Q.jsx)(ae,{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,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(ue,{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,Q.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,Q.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,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.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,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.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,Q.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,Q.jsx)(K,{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 T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,D;t[37]!==w||t[38]!==T||t[39]!==E?(D=(0,Q.jsx)(K,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=D):D=t[40];let O;t[41]!==C||t[42]!==D?(O=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,D]}),t[41]=C,t[42]=D,t[43]=O):O=t[43];let k;t[44]!==x||t[45]!==O||t[46]!==f?(k=(0,Q.jsxs)(ce,{children:[u,(0,Q.jsxs)(le,{"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,O]})]}),t[44]=x,t[45]=O,t[46]=f,t[47]=k):k=t[47];let A;return t[48]!==l||t[49]!==k?(A=(0,Q.jsx)(de,{open:!0,onOpenChange:l,children:k}),t[48]=l,t[49]=k,t[50]=A):A=t[50],A}function ht(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 gt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function _t({noteId:e}){let t=s(),n=ie(e=>e.language)===`zh`,{data:r,mutate:i,isLoading:a}=pe([`note-discussion-document`,e],()=>$e(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),d=r?.discussion.id,f=`/api/discussions/${encodeURIComponent(d??``)}`,{data:m=[],mutate:h}=pe(d?`${f}/actions`:null,e=>U(W(e)),{refreshInterval:1e4}),[g,v]=(0,Z.useState)(`summary`),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`general`),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)([]),[N,P]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(1),B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[H,ne]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{i(),h()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[i,h]),(0,Z.useEffect)(()=>{r?.discussion.template&&S(r.discussion.template)},[r?.discussion.template]);async function re(e){if(!F){I(!0),P(null);try{await e(),await i(),await h()}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(!1)}}}function oe(e){B.current&&(B.current.readyState===0?(V.current=e/1e3,B.current.load()):B.current.currentTime=e/1e3,B.current.play().catch(()=>void 0))}async function se(e,t){r?.organization&&await re(async()=>{w((await U(W(`${f}/transcript?revision=${t??r.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let fe=(e,t,r)=>t.some(e=>k||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>k||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F,onClick:()=>O({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:n?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`shrink-0 text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n?`暂无定位`:`No source timing`})]},e.id))]}):null;if(a)return(0,Q.jsx)(ge,{className:`h-48 w-full`});if(!r)return null;let{discussion:G,transcript:me,organization:he}=r,q=he?.organization,_e=[`stopping`,`sealing`,`organizing`].includes(G.status),ve=[`recording`,`completed`,`needs_attention`].includes(G.status),ye=me.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),be=ht(r,g,{query:y,page:L,showIgnored:k});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(Ae,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(G.durationMs??0),` · `,_e?n?`正在整理`:`Processing`:G.status===`completed`?n?`整理完成`:`Ready`:G.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(l,{value:x,"aria-label":n?`纪要模板`:`Summary template`,onChange:e=>S(e.target.value),children:[(0,Q.jsx)(u,{value:`general`,children:n?`通用会议`:`General`}),(0,Q.jsx)(u,{value:`project`,children:n?`项目例会`:`Project`}),(0,Q.jsx)(u,{value:`review`,children:n?`需求评审`:`Review`}),(0,Q.jsx)(u,{value:`interview`,children:n?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(K,{disabled:F||_e||!G.canonicalTranscript,onClick:()=>void re(()=>U(W(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:x})})),children:[(0,Q.jsx)(De,{className:`size-3.5`}),n?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":n?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:g===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>v(e),children:e===`summary`?n?`纪要与行动`:`Summary & actions`:n?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(p,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:W(`${f}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(nt,{resource:{kind:`note`,id:e,revision:String(r.note.remoteVersion??1)},selection:{text:be,draft:!1},label:n?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:F||_e||!!(D||T)||!be||be.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:be.length>16e3?n?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:n?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),N?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:N}):null,r.recordingJob?.state===`queued`||r.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:n?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,G.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:G.failureMessage}),(0,Q.jsx)(`button`,{disabled:F,onClick:()=>void re(()=>Ke(G.id)),children:n?`重试`:`Retry`})]}):null,he&&he.transcriptRevision!==me.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:n?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:g===`summary`?q?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:q.summaryEditedByUser?n?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:F||_e,onClick:()=>O({kind:`summary`,itemId:`summary`,text:q.summary}),children:n?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:q.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:k,onChange:e=>A(e.target.checked)}),n?`显示已忽略项`:`Show ignored items`]}),j.length?(0,Q.jsx)(K,{disabled:F,onClick:()=>void re(async()=>{for(let e of j)await U(W(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})});M([])}),children:n?`加入所选 ${j.length} 项任务`:`Add ${j.length} selected tasks`}):null,fe(n?`已决定事项`:`Decisions`,q.decisions,`decisions`),q.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`下一步行动`:`Next actions`}),q.actionItems.filter(e=>k||!e.ignored).map(e=>{let r=m.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!r&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${n?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:j.includes(e.id),onChange:t=>M(t.target.checked?[...j,e.id]:j.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F||_e,onClick:()=>O({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:n?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(n?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(n?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`查看原话`:`Source`}):null,r?r.deleted?(0,Q.jsx)(`span`,{children:n?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:_(`${t.pathname}${t.search}`,r.taskId),children:r.resolution===`done`?n?`已完成 · 查看任务`:`Done · View task`:n?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(K,{disabled:F||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void re(()=>U(W(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})})),children:n?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,fe(n?`风险`:`Risks`,q.risks,`risks`),fe(n?`尚未确定`:`Open questions`,q.openQuestions,`openQuestions`),q.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`前后变更`:`Changes during the meeting`}),q.changes.map(e=>{let t=[...q.decisions,...q.actionItems,...q.risks,...q.openQuestions],r=t.find(t=>t.id===e.fromId),i=t.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?n?`后续撤销或替代`:`Later superseded`:n?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,q.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`章节回顾`:`Chapters`}),q.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_e?n?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:n?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),_e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ge,{className:`h-6 w-3/4`}),(0,Q.jsx)(ge,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(ee,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:n?`查找原话或说话人`:`Search words or speaker`,value:y,onChange:e=>{b(e.target.value),R(1)}})]}),ye.slice(0,L*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${H>=e.startedAtMs&&H<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[(0,Q.jsx)(z,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(n?`未区分说话人`:`Speaker unknown`)}),ve&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>E({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:n?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(n?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ye.length>L*50?(0,Q.jsx)(K,{onClick:()=>R(L+1),children:n?`加载更多`:`More`}):null]})}),G.audioAttachmentId&&!G.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:B,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:W(`${f}/audio`),onTimeUpdate:()=>ne((B.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&B.current&&(B.current.currentTime=V.current,V.current=null)},onError:()=>P(n?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:W(`${f}/audio`),download:!0,children:n?`下载录音`:`Download recording`})]}):null,C?(0,Q.jsxs)(`aside`,{"aria-label":n?`原话证据`:`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,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:n?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭`:`Close`,onClick:()=>w(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:C.length?C.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.speakerLabel??(n?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:n?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,D&&he?(0,Q.jsx)(mt,{initial:D,zh:n,busy:F,onClose:()=>O(null),onSave:e=>re(async()=>{await U(W(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:he.revision})}),O(null)})},`${D.kind}:${D.itemId}:${he.revision}`):null,T?(0,Q.jsx)(de,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{"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,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(ue,{children:n?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭校对`:`Close editor`,onClick:()=>E(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[n?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.speaker,onChange:e=>E({...T,speaker:e.target.value})})]}),T.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!T.applyToSpeakerGroup,onChange:e=>E({...T,applyToSpeakerGroup:e.target.checked})}),n?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.text,onChange:e=>E({...T,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(K,{variant:`primary`,disabled:F||!T.text.trim(),onClick:()=>void re(async()=>{await U(W(`${f}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:me.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),n?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:R,ai_edit:B,sync:De,restore:Te};function yt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=ie(e=>e.language),o=V(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:re(a)},{data:c}=pe(e?[`note-history`,e]:null,()=>D(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await S(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.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,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=vt[e.trigger]??R,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:H(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:yt(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:$(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.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,Q.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,Q.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,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function xt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=V(ie(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:b}=pe(e?[`note-agent-context-status`,e]:null,()=>k(e),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>I(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Z.useCallback)(async t=>{try{await x(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(B,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.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,Q.jsx)(Me,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:b||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,Q.jsx)(`span`,{className:H(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.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,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.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,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:H(`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,Q.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:H(`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,Q.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Qe,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.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,Q.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})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.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 St=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Ct({open:e,onOpenChange:t,note:n}){let r=ie(e=>e.language)===`zh`,i=r?Dt:Ot,{data:a,mutate:o}=pe(e?[`note-shares`,n.id]:null,()=>A(n.id)),s=pe(e?`hosted-share-auth-status`:null,_e),d=s.data===!0,p=pe(e&&d?`hosted-publication-capabilities`:null,ye),m=p.data?.publishing.allowed===!0,g=pe(e&&d?[`hosted-note-publications`,n.id]:null,()=>E(n.id)),[_,y]=(0,Z.useState)(new Set),[b,x]=(0,Z.useState)(`86400000`),[S,C]=(0,Z.useState)(``),[T,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(`hosted`),[j,N]=(0,Z.useState)(!1),[P,I]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null),[ee,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(null),U=(0,Z.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,Z.useEffect)(()=>{e&&(y(new Set(U.map(e=>e.id))),z(null),B(!1),H(null))},[e,U]);let ne=async()=>{N(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[..._],ttlMs:Number(b),maxViews:S.trim()?Number(S):null,description:T.trim()||void 0};O===`hosted`?(z((await M(n.id,e)).shareUrl),await g.mutate()):(z((await w(n.id,e)).payload.shareUrl),await o())}catch(e){H(e instanceof Error?e.message:String(e))}finally{N(!1)}},re=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):await be(e.id),await g.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},W=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await F(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await ve(e.id,864e5):await q(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},fe=async e=>{H(null);try{if(!await G(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,Q.jsx)(de,{open:e,onOpenChange:t,children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(He,{className:`size-4`}),i.title]}),(0,Q.jsx)(oe,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(te,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),U.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:U.map(e=>(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:_.has(e.id),onChange:()=>y(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Et(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(l,{value:O,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(u,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(u,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(Be,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&d&&p.data&&!m?(0,Q.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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(l,{value:b,onChange:e=>x(e.target.value),children:St.map(e=>(0,Q.jsx)(u,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:S,onChange:e=>C(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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:T,onChange:e=>D(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`})]})]}),R?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:R,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void fe(R),children:[ee?(0,Q.jsx)(c,{className:`size-4`}):(0,Q.jsx)(f,{className:`size-4`}),ee?i.copied:i.copy]}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(R,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(h,{className:`size-4`}),i.open]})]})}):null,V?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:V}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Tt,{share:e,busy:P===e.id,t:i,onCopy:fe,onAction:W},e.id))})]}):null,(g.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:g.data.map(e=>(0,Q.jsx)(wt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:P===e.id,publishingAllowed:m,t:i,onCopy:fe,onAction:re},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(K,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(K,{type:`button`,onClick:()=>void ne(),disabled:j||O===`hosted`&&(!d||!m),children:[j?(0,Q.jsx)(L,{className:`size-4 animate-spin`}):(0,Q.jsx)(He,{className:`size-4`}),j?i.creating:i.create]})]})]})]})})}function wt(e){let t=(0,rt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=H(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let p=r&&!l?o.stale:l?o.inactive:o.active,m;t[2]===p?m=t[3]:(m=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=m);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(`span`,{children:`·`}),t[4]=g):g=t[4];let _=n.maxViews===null?``:` / ${n.maxViews}`,v;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==_?(v=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,_]}),t[5]=n.viewCount,t[6]=o.views,t[7]=_,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`span`,{children:`·`}),t[9]=y):y=t[9];let b;t[10]!==n.revision||t[11]!==o.revision?(b=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=b):b=t[12];let x;t[13]!==m||t[14]!==v||t[15]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[m,g,v,y,b]}),t[13]=m,t[14]=v,t[15]=b,t[16]=x):x=t[16];let S;t[17]===n.shareUrl?S=t[18]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=S);let C;t[19]!==x||t[20]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]===i?w=t[23]:(w=i?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E=!a,D;t[27]!==s||t[28]!==n.shareUrl?(D=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=D):D=t[29];let O;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(f,{className:`size-3.5`}),t[30]=O):O=t[30];let k;t[31]!==o.copy||t[32]!==E||t[33]!==D?(k=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:E,onClick:D,children:[O,o.copy]}),t[31]=o.copy,t[32]=E,t[33]=D,t[34]=k):k=t[34];let A=!a,j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==o.open||t[39]!==A||t[40]!==j?(N=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:A,onClick:j,children:[M,o.open]}),t[38]=o.open,t[39]=A,t[40]=j,t[41]=N):N=t[41];let P;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(P=r&&!l?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(De,{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]=P):P=t[49];let F;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(F=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(We,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=F):F=t[54];let I;t[55]!==k||t[56]!==N||t[57]!==P||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F]}),t[55]=k,t[56]=N,t[57]=P,t[58]=F,t[59]=I):I=t[59];let R;return t[60]!==T||t[61]!==d||t[62]!==I?(R=(0,Q.jsxs)(`div`,{className:d,children:[T,I]}),t[60]=T,t[61]=d,t[62]=I,t[63]=R):R=t[63],R}function Tt(e){let t=(0,rt.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=H(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,Q.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==d||t[16]!==g?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,_,y]}),t[14]=y,t[15]=d,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(De,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,Q.jsx)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(We,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,Q.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={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:`撤销`},Ot={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 kt(e){let t=(0,rt.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=Ye(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=Ye(u),f=Ye(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(ke,{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,Q.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,Q.jsx)(Ie,{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,Q.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 At(e){return e.stop}function jt(e,t){let n=Oe(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Oe(e);return!r||n.split(`
3
3
  `)[0]===r?n:[r,n].filter(Boolean).join(`
4
4
 
5
- `)}var Mt=()=>i(()=>import(`./block-editor-_-QK0EnY.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([114,1,110,5,115,116,3])),Pt=(0,Z.lazy)(()=>Mt().then(e=>({default:e.BlockEditor}))),Ft=(0,Z.lazy)(()=>Nt().then(e=>({default:e.MarkdownEditor})));function It(){let e=(0,rt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Lt(e){let t=(0,rt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ee},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:qe},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:g},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,m=Rt,h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=h);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Le,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==h||t[20]!==_?(y=(0,Q.jsx)(Ve,{asChild:!0,children:(0,Q.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:[h,_,v]})}),t[18]=f.label,t[19]=h,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Ce,{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,Q.jsxs)(Se,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.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,Q.jsxs)(Ue,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function Rt(e){e===`wysiwyg`&&Mt(),e===`source`&&Nt()}function zt(e){let t=(0,rt.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=ie(Bt),g;t[0]===h?g=t[1]:(g=V(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;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?(v=(0,Q.jsx)(Vt,{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]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(tt,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Bt(e){return e.language}function Vt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=ie(e=>e.language),p=V(f).notes,h=V(f).chat.pageContext,g=V(f).automations.suggestions,{data:_}=pe([`note-discussion-document`,e],()=>Qe(e)),[v,x]=(0,Z.useState)(!0),S=a(),w=he(e=>e.resolved)===`dark`,{openImage:E}=et(),[D,k]=(0,Z.useState)(u),[A,M]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(!1),[z,te]=(0,Z.useState)(``),[U,re]=(0,Z.useState)(360),[W,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(!1),ue=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{ue.current+=1},[e]);let[de,G]=(0,Z.useState)(null),[K,ge]=(0,Z.useState)(!1),[q,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[be,Te]=(0,Z.useState)(!1),Oe=(0,Z.useRef)(!1),Ae=(0,Z.useRef)(!1),Fe=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),He=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),qe=(0,Z.useRef)(null),Xe=ke(e=>e.setPageHeader),$e=ke(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=pe(e?[`note-detail`,e]:null,()=>T(e)),{data:nt=[],mutate:rt}=pe(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),it=F!==null,at=(0,Z.useCallback)(e=>{G(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{Oe.current=!1,te(``),I(null),M(null),Ae.current=!1,qe.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Oe.current||(te(Y.title??``),Oe.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||qe.current===e)return;let t=window.requestAnimationFrame(()=>{Ke.current?.focus(),d?.()});return qe.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:H(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,me,i),children:(0,Q.jsx)(je,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=Ye.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),ct=(0,Z.useCallback)(e=>{e!==`preview`&&$(),k(e)},[$]),lt=(0,Z.useCallback)(t=>{$(),te(t),e&&(Be.current=t,Le.current&&clearTimeout(Le.current),Le.current=setTimeout(async()=>{let t=Be.current;if(Be.current=null,t!==null){R(!0);try{await y(e,{title:t}),await X(),n?.()}catch{}finally{R(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-2`,me),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:z||ot||void 0,children:z||ot}),L?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,L,ot,z]),ft=(0,Z.useCallback)(async(t=!1)=>{le(!0),G(null);try{let n=await C(e,{forceNew:t});await X(),await rt(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){G(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{le(!1)}},[X,rt,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{se(!0),G(null);try{await j(e),await X()}catch(e){G(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{se(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!oe&&pt()},[A,oe,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=F?F.markdown??``:J.current??Y?.markdown??``,n=F?F.title??``:z,r=jt(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:Ie(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,F,z]),gt=(0,Z.useCallback)(async()=>{Fe.current&&clearTimeout(Fe.current),Le.current&&clearTimeout(Le.current),Fe.current=null,Le.current=null;let t=J.current,r=Be.current;J.current=null,Be.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;R(!0);try{let t=await y(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return J.current===null&&(J.current=t),Be.current===null&&(Be.current=r),G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{R(!1)}},[X,p.saveFailed,p.saveFailedHint,Y,e,n]),vt=(0,Z.useCallback)(async()=>{if(!Y||ce||L)return;le(!0),G(null);let e=ne.getState(),t=++ue.current,n=()=>ue.current===t&&ne.getState().baseUrl===e.baseUrl&&ne.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&He.current?.contains(t.anchorNode)&&He.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(J.current!==null||Be.current!==null)throw Error(h.unavailable);let a=De.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 fe().createSession();if(!n())return;if(J.current!==null||Be.current!==null)throw Error(h.unavailable);let s=we(e.baseUrl,e.conversationId,o.key);if(!De.put(s,a))throw Error(h.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&G(h.unavailable)}finally{ue.current===t&&le(!1)}},[Y,ce,L,gt,S,h.unavailable]),yt=(0,Z.useCallback)(async()=>{G(null);let e=await gt();e&&(_e(e),ge(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(be||L)){ye(!1),Te(!0),G(null),$(),Fe.current&&clearTimeout(Fe.current),Le.current&&clearTimeout(Le.current),Fe.current=null,Le.current=null,J.current=null,Be.current=null;try{await N(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){G(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Te(!1)}}},[be,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,L,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-1 sm:gap-2`,me),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":p.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,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(kt,{input:ht,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:oe,"aria-label":p.catalysisSectionTitle,className:H(`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`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:oe?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:ce,className:H(`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,Q.jsx)(Je,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ce?p.openingChat:p.openChatButton})]}),(0,Q.jsx)(Lt,{mode:D,onModeChange:ct,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void vt(),disabled:ce||L||!Y||!!F,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,Q.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(Ue,{modal:!1,children:[(0,Q.jsx)(Ve,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":p.noteActions,title:p.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,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ne,{children:(0,Q.jsxs)(Ce,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(Se,{onSelect:()=>void yt(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(Se,{onSelect:()=>M(A===`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,Q.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:p.history}),A===`history`?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(Se,{disabled:be||L,onSelect:()=>ye(!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,Q.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[oe,mt,ft,vt,h.capture,Y,F,D,p.history,p.modeEdit,p.modePreview,p.modeSource,ce,A,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,be,L,f,p.delete,ye]);(0,Z.useLayoutEffect)(()=>(Xe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&$e()}),[o,$e,wt,dt,st,Y,Xe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),J.current=t,Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){R(!0),G(null);try{await y(e,{markdown:t}),await X(),n?.()}catch(e){G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{R(!1)}}},600))},[$,e,X,p.saveFailed,p.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{P(e,t.timestamp).then(e=>{e&&($(),I(e))})},[e,$]),Dt=(0,Z.useCallback)(()=>{$(),M(null),I(null)},[$]),Ot=(0,Z.useCallback)(()=>{$(),M(null),I(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{Fe.current&&clearTimeout(Fe.current),Le.current&&clearTimeout(Le.current);let t=J.current,n=Be.current;J.current=null,Be.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&y(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:p.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,Q.jsx)(It,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:p.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.notFoundDescription}),(0,Q.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:p.back})]});let At=it?F.title??``:z,Mt=it?F.markdown??``:J.current??Y.markdown??``,Nt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Nt)&&Date.now()-Nt<3600*1e3?(0,Q.jsx)(ut,{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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[de?(0,Q.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:de}):null,(0,Q.jsx)(Re,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(Re,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:v?`text-accent-fg`:`text-fg-muted`,onClick:()=>x(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:v?`text-fg-muted`:`text-accent-fg`,onClick:()=>x(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:He,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&v?(0,Q.jsx)(_t,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&v?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[At&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:At}),Mt?(0,Q.jsx)(b,{noteId:e,content:Mt,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[D===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ke,type:`text`,value:z,onChange:e=>lt(e.target.value),onCompositionStart:()=>{Ae.current=!0},onCompositionEnd:()=>{Ae.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ae.current&&!t.isComposing&&(e.preventDefault(),(He.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Pt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),D===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ke,type:`text`,value:z,onChange:e=>lt(e.target.value),placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Ft,{initialContent:Y.markdown??``,onChange:Tt,isDark:w},`source-${e}`)})})]}),D===`preview`&&(0,Q.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:[z&&!Y.markdown.trimStart().startsWith(`# ${z.trim()}\n`)&&Y.markdown.trim()!==`# ${z.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:z}),Y.markdown?(0,Q.jsx)(b,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:We,className:H(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!W&&`transition-[width] duration-300 ease-in-out`),style:{width:A?U:0},children:(0,Q.jsxs)(`div`,{ref:Ge,className:`flex min-h-0 flex-1 flex-col`,style:{width:U},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ae(!0);let n=e.clientX,r=U,i=e.pointerId,a=0,o=U,s=U,c=()=>{a=0,s=o,A&&We.current?.style.setProperty(`width`,`${s}px`),Ge.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{}ae(!1),re(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:H(`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`,W&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(bt,{noteId:e,activeTimestamp:F?.timestamp??null,onSelect:Et,onClose:Dt,onRestored:Ot}):A===`breakdown`?(0,Q.jsx)(xt,{noteId:e,note:Y??null,catalyzing:oe,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:ce,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),q?(0,Q.jsx)(Ct,{open:K,onOpenChange:ge,note:q}):null,(0,Q.jsx)(Ze,{open:ve,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>ye(!1)})]})}export{$ as i,lt as n,ct as r,zt as t};
5
+ `)}var Mt=()=>i(()=>import(`./block-editor-K6is5GrS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([113,1,109,5,114,115,3])),Pt=(0,Z.lazy)(()=>Mt().then(e=>({default:e.BlockEditor}))),Ft=(0,Z.lazy)(()=>Nt().then(e=>({default:e.MarkdownEditor})));function It(){let e=(0,rt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Lt(e){let t=(0,rt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ae},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Ze},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:g},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,m=Rt,h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=h);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Y,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==h||t[20]!==_?(y=(0,Q.jsx)(ze,{asChild:!0,children:(0,Q.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:[h,_,v]})}),t[18]=f.label,t[19]=h,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(je,{children:(0,Q.jsx)(Ce,{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,Q.jsxs)(Se,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.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,Q.jsxs)(Ve,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function Rt(e){e===`wysiwyg`&&Mt(),e===`source`&&Nt()}function zt(e){let t=(0,rt.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=ie(Bt),g;t[0]===h?g=t[1]:(g=V(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;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?(v=(0,Q.jsx)(Vt,{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]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(tt,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Bt(e){return e.language}function Vt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=ie(e=>e.language),p=V(f).notes,h=V(f).chat.pageContext,g=V(f).automations.suggestions,{data:_}=pe([`note-discussion-document`,e],()=>$e(e)),[v,x]=(0,Z.useState)(!0),S=a(),w=he(e=>e.resolved)===`dark`,{openImage:E}=et(),[D,k]=(0,Z.useState)(u),[A,M]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(!1),[z,te]=(0,Z.useState)(``),[U,re]=(0,Z.useState)(360),[W,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(!1),ue=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{ue.current+=1},[e]);let[de,G]=(0,Z.useState)(null),[K,ge]=(0,Z.useState)(!1),[q,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[be,Te]=(0,Z.useState)(!1),De=(0,Z.useRef)(!1),Oe=(0,Z.useRef)(!1),ke=(0,Z.useRef)(null),Ie=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),Re=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),qe=(0,Z.useRef)(null),Xe=Je(e=>e.setPageHeader),Ze=Je(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=pe(e?[`note-detail`,e]:null,()=>T(e)),{data:nt=[],mutate:rt}=pe(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),it=F!==null,at=(0,Z.useCallback)(e=>{G(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{De.current=!1,te(``),I(null),M(null),Oe.current=!1,qe.current=null},[e]),(0,Z.useEffect)(()=>{!Y||De.current||(te(Y.title??``),De.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||qe.current===e)return;let t=window.requestAnimationFrame(()=>{Ke.current?.focus(),d?.()});return qe.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:H(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,me,i),children:(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=Ye.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),ct=(0,Z.useCallback)(e=>{e!==`preview`&&$(),k(e)},[$]),lt=(0,Z.useCallback)(t=>{$(),te(t),e&&(Le.current=t,Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(async()=>{let t=Le.current;if(Le.current=null,t!==null){R(!0);try{await y(e,{title:t}),await X(),n?.()}catch{}finally{R(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-2`,me),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:z||ot||void 0,children:z||ot}),L?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,L,ot,z]),ft=(0,Z.useCallback)(async(t=!1)=>{le(!0),G(null);try{let n=await C(e,{forceNew:t});await X(),await rt(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){G(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{le(!1)}},[X,rt,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{se(!0),G(null);try{await j(e),await X()}catch(e){G(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{se(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!oe&&pt()},[A,oe,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=F?F.markdown??``:J.current??Y?.markdown??``,n=F?F.title??``:z,r=jt(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:Pe(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,F,z]),gt=(0,Z.useCallback)(async()=>{ke.current&&clearTimeout(ke.current),Ie.current&&clearTimeout(Ie.current),ke.current=null,Ie.current=null;let t=J.current,r=Le.current;J.current=null,Le.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;R(!0);try{let t=await y(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return J.current===null&&(J.current=t),Le.current===null&&(Le.current=r),G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{R(!1)}},[X,p.saveFailed,p.saveFailedHint,Y,e,n]),vt=(0,Z.useCallback)(async()=>{if(!Y||ce||L)return;le(!0),G(null);let e=ne.getState(),t=++ue.current,n=()=>ue.current===t&&ne.getState().baseUrl===e.baseUrl&&ne.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Re.current?.contains(t.anchorNode)&&Re.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(J.current!==null||Le.current!==null)throw Error(h.unavailable);let a=Ee.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 fe().createSession();if(!n())return;if(J.current!==null||Le.current!==null)throw Error(h.unavailable);let s=we(e.baseUrl,e.conversationId,o.key);if(!Ee.put(s,a))throw Error(h.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&G(h.unavailable)}finally{ue.current===t&&le(!1)}},[Y,ce,L,gt,S,h.unavailable]),yt=(0,Z.useCallback)(async()=>{G(null);let e=await gt();e&&(_e(e),ge(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(be||L)){ye(!1),Te(!0),G(null),$(),ke.current&&clearTimeout(ke.current),Ie.current&&clearTimeout(Ie.current),ke.current=null,Ie.current=null,J.current=null,Le.current=null;try{await N(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){G(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Te(!1)}}},[be,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,L,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-1 sm:gap-2`,me),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":p.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,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(kt,{input:ht,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:oe,"aria-label":p.catalysisSectionTitle,className:H(`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`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:oe?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:ce,className:H(`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,Q.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ce?p.openingChat:p.openChatButton})]}),(0,Q.jsx)(Lt,{mode:D,onModeChange:ct,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void vt(),disabled:ce||L||!Y||!!F,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,Q.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(Ve,{modal:!1,children:[(0,Q.jsx)(ze,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":p.noteActions,title:p.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,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(je,{children:(0,Q.jsxs)(Ce,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(Se,{onSelect:()=>void yt(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(Se,{onSelect:()=>M(A===`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,Q.jsx)(Ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:p.history}),A===`history`?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(Se,{disabled:be||L,onSelect:()=>ye(!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,Q.jsx)(We,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[oe,mt,ft,vt,h.capture,Y,F,D,p.history,p.modeEdit,p.modePreview,p.modeSource,ce,A,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,be,L,f,p.delete,ye]);(0,Z.useLayoutEffect)(()=>(Xe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&Ze()}),[o,Ze,wt,dt,st,Y,Xe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),J.current=t,ke.current&&clearTimeout(ke.current),ke.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){R(!0),G(null);try{await y(e,{markdown:t}),await X(),n?.()}catch(e){G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{R(!1)}}},600))},[$,e,X,p.saveFailed,p.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{P(e,t.timestamp).then(e=>{e&&($(),I(e))})},[e,$]),Dt=(0,Z.useCallback)(()=>{$(),M(null),I(null)},[$]),Ot=(0,Z.useCallback)(()=>{$(),M(null),I(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{ke.current&&clearTimeout(ke.current),Ie.current&&clearTimeout(Ie.current);let t=J.current,n=Le.current;J.current=null,Le.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&y(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:p.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,Q.jsx)(It,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:p.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.notFoundDescription}),(0,Q.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:p.back})]});let At=it?F.title??``:z,Mt=it?F.markdown??``:J.current??Y.markdown??``,Nt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Nt)&&Date.now()-Nt<3600*1e3?(0,Q.jsx)(ut,{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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[de?(0,Q.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:de}):null,(0,Q.jsx)(Fe,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(Fe,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:v?`text-accent-fg`:`text-fg-muted`,onClick:()=>x(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:v?`text-fg-muted`:`text-accent-fg`,onClick:()=>x(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:Re,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&v?(0,Q.jsx)(_t,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&v?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[At&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:At}),Mt?(0,Q.jsx)(b,{noteId:e,content:Mt,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[D===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ke,type:`text`,value:z,onChange:e=>lt(e.target.value),onCompositionStart:()=>{Oe.current=!0},onCompositionEnd:()=>{Oe.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Oe.current&&!t.isComposing&&(e.preventDefault(),(Re.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Pt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),D===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ke,type:`text`,value:z,onChange:e=>lt(e.target.value),placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Ft,{initialContent:Y.markdown??``,onChange:Tt,isDark:w},`source-${e}`)})})]}),D===`preview`&&(0,Q.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:[z&&!Y.markdown.trimStart().startsWith(`# ${z.trim()}\n`)&&Y.markdown.trim()!==`# ${z.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:z}),Y.markdown?(0,Q.jsx)(b,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Be,className:H(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!W&&`transition-[width] duration-300 ease-in-out`),style:{width:A?U:0},children:(0,Q.jsxs)(`div`,{ref:Ue,className:`flex min-h-0 flex-1 flex-col`,style:{width:U},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ae(!0);let n=e.clientX,r=U,i=e.pointerId,a=0,o=U,s=U,c=()=>{a=0,s=o,A&&Be.current?.style.setProperty(`width`,`${s}px`),Ue.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{}ae(!1),re(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:H(`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`,W&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(bt,{noteId:e,activeTimestamp:F?.timestamp??null,onSelect:Et,onClose:Dt,onRestored:Ot}):A===`breakdown`?(0,Q.jsx)(xt,{noteId:e,note:Y??null,catalyzing:oe,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:ce,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),q?(0,Q.jsx)(Ct,{open:K,onOpenChange:ge,note:q}):null,(0,Q.jsx)(Ge,{open:ve,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>ye(!1)})]})}export{$ as i,lt as n,ct as r,zt as t};