@xopcai/xopc 0.0.357 → 0.0.358

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 (422) 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/{activity-store-Bj0GuUUk.js → activity-store-CnmHVy1D.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-5q-LyRB2.js → agent-avatar-dicebear-DEs_xwQi.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BOojrPNq.js → agent-defaults-settings-panel-B23VK3UU.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-3fkKAT0r.js → agent-plugin-dialog-BuKJ-Ybo.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-DJyRK5vN.js → agents-DxH-UFs7.js} +3 -3
  17. package/dist/gateway/static/root/assets/{agents-admin-api-CYqmO7gb.js → agents-admin-api-BtnYiq7O.js} +1 -1
  18. package/dist/gateway/static/root/assets/{app-management-settings-panel-8ODazg-Y.js → app-management-settings-panel-BqyvMQXO.js} +1 -1
  19. package/dist/gateway/static/root/assets/{appearance-settings-0G9nGAsa.js → appearance-settings-Cn9qgXLw.js} +1 -1
  20. package/dist/gateway/static/root/assets/{apps-page-CJyfU05v.js → apps-page-ChPOmrPa.js} +1 -1
  21. package/dist/gateway/static/root/assets/{archive-plugin-BZHSbFiu.js → archive-plugin-DZCN9m71.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automations-page-egZn4y94.js → automations-page-OUapkL2D.js} +1 -1
  23. package/dist/gateway/static/root/assets/{automations-workspace-CI1EK1eb.js → automations-workspace-DMqpfefB.js} +1 -1
  24. package/dist/gateway/static/root/assets/{binary-plugins-x2-RmzUs.js → binary-plugins-U63xxRgh.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-Bi-NBvGE.js → block-editor-_-QK0EnY.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-automation-inputs-uQ2AGFFU.js → browser-automation-inputs-CnLQ649y.js} +1 -1
  27. package/dist/gateway/static/root/assets/{browser-automations-page-D2AYNyC2.js → browser-automations-page-DZlWdikj.js} +1 -1
  28. package/dist/gateway/static/root/assets/{browser-settings-page-DVMJRsch.js → browser-settings-page-CEF_LSjz.js} +1 -1
  29. package/dist/gateway/static/root/assets/{capabilities-Btku0cS3.js → capabilities-BXG_5wIg.js} +1 -1
  30. package/dist/gateway/static/root/assets/{capabilities-Cl1RErL_.js → capabilities-Bigu28Z6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{capabilities-page-CBdEzKy1.js → capabilities-page-KUggKcIq.js} +2 -2
  32. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B7f1WLgL.js → capabilities-settings-panel-CD5K7e1B.js} +1 -1
  33. package/dist/gateway/static/root/assets/{capability-header-actions-BuYo4ONV.js → capability-header-actions-CA_XNTSW.js} +1 -1
  34. package/dist/gateway/static/root/assets/{channels-COGpGGqA.js → channels-CG_xCUnf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-DJnrcf3F.js → chat-terminal-dock-DRV-4qeP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{computer-settings-page-CbKp1tj0.js → computer-settings-page-CqY40STw.js} +1 -1
  37. package/dist/gateway/static/root/assets/{connector-service-page-BxJquXDl.js → connector-service-page-BKAt0jvO.js} +1 -1
  38. package/dist/gateway/static/root/assets/{connectors-page-DJocZ_mY.js → connectors-page-Cn14oruE.js} +1 -1
  39. package/dist/gateway/static/root/assets/{date-picker-CYQyKepm.js → date-picker-B4jSGi8k.js} +1 -1
  40. package/dist/gateway/static/root/assets/{dependency-picker-dc-q0G_j.js → dependency-picker-D0RWVtBt.js} +1 -1
  41. package/dist/gateway/static/root/assets/{desktop-pet-gvvvaJ51.js → desktop-pet-9B1PIjsV.js} +1 -1
  42. package/dist/gateway/static/root/assets/{desktop-pet-settings-w8qYvD9r.js → desktop-pet-settings-cq5n59Pr.js} +1 -1
  43. package/dist/gateway/static/root/assets/{device-pairing-wizard-CAQ2qJIZ.js → device-pairing-wizard-DKO8iqDJ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{directory-picker-path-field-BfJOJnPB.js → directory-picker-path-field-C40-GlX1.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-debug-page-DPc3vTw0.js → extension-debug-page-BodxNAys.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-page-BpyU7d5e.js → extension-page-BshgQ_pO.js} +1 -1
  47. package/dist/gateway/static/root/assets/{extension-provider-D-0AeFhE.js → extension-provider-aigS3RJu.js} +1 -1
  48. package/dist/gateway/static/root/assets/{extension-settings-page-BlzNJ6hK.js → extension-settings-page-DAJZVzIQ.js} +1 -1
  49. package/dist/gateway/static/root/assets/{gateway-config-swr-Da3Oob_s.js → gateway-config-swr-EZxaKXdC.js} +1 -1
  50. package/dist/gateway/static/root/assets/{gateway-realtime-BDh3i8n7.js → gateway-realtime-DBRa17u3.js} +1 -1
  51. package/dist/gateway/static/root/assets/gateway-realtime-store-7glMlD2l.js +1 -0
  52. package/dist/gateway/static/root/assets/{gateway-settings-DyreTpro.js → gateway-settings-DAQu7q_Q.js} +1 -1
  53. package/dist/gateway/static/root/assets/{gateway-startup-retry-BEj_bcbm.js → gateway-startup-retry-Wtxq_y2f.js} +1 -1
  54. package/dist/gateway/static/root/assets/{home-page-rKyHpQpb.js → home-page-BHS2713D.js} +1 -1
  55. package/dist/gateway/static/root/assets/{image-generation-api-8jfU8AlD.js → image-generation-api-Bnl0CH4n.js} +1 -1
  56. package/dist/gateway/static/root/assets/{imports-page-BHUlyE3u.js → imports-page-Bsn8Qted.js} +1 -1
  57. package/dist/gateway/static/root/assets/{index-DOFuObNM.js → index-BcTY7RBG.js} +6 -6
  58. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Pb-3Ryr9.js → keyboard-shortcuts-settings-DjuXyBbC.js} +1 -1
  59. package/dist/gateway/static/root/assets/{local-app-workbench-page-yWS0QdRe.js → local-app-workbench-page-D77r2CKa.js} +1 -1
  60. package/dist/gateway/static/root/assets/{local-apps-page-DgQHDdZh.js → local-apps-page-GsohMT3J.js} +1 -1
  61. package/dist/gateway/static/root/assets/{local-session-drafts-jOqfUlwj.js → local-session-drafts-CeHhcudO.js} +1 -1
  62. package/dist/gateway/static/root/assets/{locale-store-DodizOrj.js → locale-store-ChN_vjs2.js} +1 -1
  63. package/dist/gateway/static/root/assets/{logs-page-CwTIW0J0.js → logs-page-DeBeNPb4.js} +1 -1
  64. package/dist/gateway/static/root/assets/{management-settings-Dm2Fa1QY.js → management-settings-Di9r7yBX.js} +1 -1
  65. package/dist/gateway/static/root/assets/{markdown-view-Bb6ohqHz.js → markdown-view-DKlJx4eo.js} +1 -1
  66. package/dist/gateway/static/root/assets/{media-plugins-DIhqKSK5.js → media-plugins-JWzrPQwt.js} +1 -1
  67. package/dist/gateway/static/root/assets/messages-CnM6Qfr7.js +3 -0
  68. package/dist/gateway/static/root/assets/models-hub-cache-DnIOzcvn.js +1 -0
  69. package/dist/gateway/static/root/assets/{note-detail-panel-D9iPUCQq.js → note-detail-panel-CLq8afeQ.js} +3 -3
  70. package/dist/gateway/static/root/assets/{notes-api-DYfvIxWh.js → notes-api-D8nvWMMC.js} +1 -1
  71. package/dist/gateway/static/root/assets/{notes-page-CbzhN_on.js → notes-page-FORwlFnt.js} +1 -1
  72. package/dist/gateway/static/root/assets/{oauth-api-gSu-iTk5.js → oauth-api-BXn1a9qx.js} +1 -1
  73. package/dist/gateway/static/root/assets/{page-context-capture-button-B6i0R1qQ.js → page-context-capture-button-C9H1dHg2.js} +1 -1
  74. package/dist/gateway/static/root/assets/personal-page-BpTFGG44.js +1 -0
  75. package/dist/gateway/static/root/assets/{product-open-page-CMmB1iyB.js → product-open-page-pW662VEC.js} +1 -1
  76. package/dist/gateway/static/root/assets/project-detail-page-3_Bqq0OV.js +1 -0
  77. package/dist/gateway/static/root/assets/{projects-page-CmjHjX8D.js → projects-page-D85PDbCM.js} +1 -1
  78. package/dist/gateway/static/root/assets/{registry-api-D0eYNizR.js → registry-api-BM_81rLe.js} +1 -1
  79. package/dist/gateway/static/root/assets/{remote-access-hub-WKPLG5V4.js → remote-access-hub-CzzTxbhr.js} +1 -1
  80. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D1IEye-5.js → runtime-tools-settings-panel-BUgsyhm_.js} +1 -1
  81. package/dist/gateway/static/root/assets/{scenes-page-CDxjO8IH.js → scenes-page-Bds4V34P.js} +1 -1
  82. package/dist/gateway/static/root/assets/{schema-form-DrSp5o9r.js → schema-form-BQz6ezGe.js} +1 -1
  83. package/dist/gateway/static/root/assets/{send-session-input-DstpmO44.js → send-session-input-OaBPDJ9E.js} +1 -1
  84. package/dist/gateway/static/root/assets/{session-api-qy4gMa5t.js → session-api-UkGomZfv.js} +1 -1
  85. package/dist/gateway/static/root/assets/{session-manager-CFqOuGy-.js → session-manager-BK5IvdGz.js} +1 -1
  86. package/dist/gateway/static/root/assets/{sessions-page-tL7mZG6X.js → sessions-page-DkXKhSWK.js} +1 -1
  87. package/dist/gateway/static/root/assets/settings-advanced-gate-C7ww6VRj.js +1 -0
  88. package/dist/gateway/static/root/assets/{settings-page-CLx4gCfD.js → settings-page-CKmMkdPu.js} +1 -1
  89. package/dist/gateway/static/root/assets/{setup-status-panel-TBkyBEiM.js → setup-status-panel-Cjv6CDgq.js} +1 -1
  90. package/dist/gateway/static/root/assets/{share-link-dialog-B3Io5mOY.js → share-link-dialog-QAjExHAL.js} +1 -1
  91. package/dist/gateway/static/root/assets/{share-preview-page-BpZqXsgR.js → share-preview-page-M_rAQR60.js} +1 -1
  92. package/dist/gateway/static/root/assets/{shares-api-BNNaREyB.js → shares-api-DwqLga5H.js} +1 -1
  93. package/dist/gateway/static/root/assets/{shares-settings-Bz0BI8lL.js → shares-settings-DXpj-oOC.js} +1 -1
  94. package/dist/gateway/static/root/assets/{skill-api-Bom72qsC.js → skill-api-BO1b2oYj.js} +1 -1
  95. package/dist/gateway/static/root/assets/{skill-reload-api-Dm6GgUYK.js → skill-reload-api-C1hzIawD.js} +1 -1
  96. package/dist/gateway/static/root/assets/{skills-page-BIQrMkmI.js → skills-page-cwXzLyU0.js} +1 -1
  97. package/dist/gateway/static/root/assets/{system-settings-panel-CzAezoel.js → system-settings-panel-CIDRPUj4.js} +1 -1
  98. package/dist/gateway/static/root/assets/task-detail-page-ZmkA0E9f.js +1 -0
  99. package/dist/gateway/static/root/assets/tasks-CH6KoBeY.js +1 -0
  100. package/dist/gateway/static/root/assets/{theme-store-AXut7b8R.js → theme-store-DTYk7Gll.js} +1 -1
  101. package/dist/gateway/static/root/assets/{tunnel-api-DtkDWId1.js → tunnel-api-BkgD61qc.js} +1 -1
  102. package/dist/gateway/static/root/assets/{usage-page-ZKtrJ73f.js → usage-page-BjgYDab4.js} +1 -1
  103. package/dist/gateway/static/root/assets/{use-autosave-BT3l-ETP.js → use-autosave-R3hEHQQq.js} +1 -1
  104. package/dist/gateway/static/root/assets/{use-composer-attachments-zfL8zvRu.js → use-composer-attachments-qK3z-EGz.js} +1 -1
  105. package/dist/gateway/static/root/assets/{use-file-preview-expanded-C4bBXf4j.js → use-file-preview-expanded-D809I8ur.js} +2 -2
  106. package/dist/gateway/static/root/assets/{user-model-page-B6E9ihaw.js → user-model-page-DpPGpkkg.js} +1 -1
  107. package/dist/gateway/static/root/assets/{voice-api-key-field-BF9hOZ_1.js → voice-api-key-field-C-AF-IcO.js} +1 -1
  108. package/dist/gateway/static/root/assets/{voice-config-api-D8G4fALX.js → voice-config-api-CxGsCDoW.js} +1 -1
  109. package/dist/gateway/static/root/assets/{work-discovery-overlay-cD0OrAiy.js → work-discovery-overlay-Ce3PKQvh.js} +1 -1
  110. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-4yISOYK9.js → workflow-run-setup-panel-Dv6xUycS.js} +1 -1
  111. package/dist/gateway/static/root/assets/{workflows-page-B2_1T6js.js → workflows-page-CgJlVdec.js} +1 -1
  112. package/dist/gateway/static/root/assets/{workspace-api-C4q2GwGV.js → workspace-api-BtXzxf_w.js} +2 -2
  113. package/dist/gateway/static/root/index.html +28 -28
  114. package/dist/package.js +1 -1
  115. package/dist/packages/gateway-contract/src/task-lifecycle.js +3 -1
  116. package/dist/src/agent/agent-manager.js +15 -15
  117. package/dist/src/agent/agent-scope.js +2 -2
  118. package/dist/src/agent/background-review/prompts.js +1 -1
  119. package/dist/src/agent/background-review/run-background-review.js +4 -4
  120. package/dist/src/agent/coding/repository-instructions.js +1 -1
  121. package/dist/src/agent/context/coordinator.js +2 -2
  122. package/dist/src/agent/context/execution-context.js +4 -4
  123. package/dist/src/agent/context/execution-scope.js +2 -2
  124. package/dist/src/agent/context/project-context.js +3 -3
  125. package/dist/src/agent/data-acquisition/service.js +1 -1
  126. package/dist/src/agent/embedded/index.js +2 -2
  127. package/dist/src/agent/embedded/model-runtime.js +1 -1
  128. package/dist/src/agent/embedded/run-for-session.js +4 -4
  129. package/dist/src/agent/embedded/run-turn.js +5 -5
  130. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  131. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  132. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  133. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  134. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  135. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  136. package/dist/src/agent/external-tools/mcp-provider.js +3 -3
  137. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  138. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  139. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  140. package/dist/src/agent/image/generation/providers/google.js +1 -1
  141. package/dist/src/agent/image/generation/runtime.js +1 -1
  142. package/dist/src/agent/image/index.js +1 -1
  143. package/dist/src/agent/image/load-image-media.js +1 -1
  144. package/dist/src/agent/image/tool-model-config.js +2 -2
  145. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  146. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  147. package/dist/src/agent/index.js +1 -1
  148. package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
  149. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  150. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  151. package/dist/src/agent/mcp/index.js +2 -2
  152. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  153. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  154. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  155. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  156. package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
  157. package/dist/src/agent/memory/context-recovery.js +1 -1
  158. package/dist/src/agent/memory/index.js +1 -1
  159. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  160. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  161. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  162. package/dist/src/agent/service/direct-turn-helpers.js +4 -4
  163. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  164. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  165. package/dist/src/agent/service/webchat-tts.js +2 -2
  166. package/dist/src/agent/service.js +22 -22
  167. package/dist/src/agent/session/session-config-service.js +1 -1
  168. package/dist/src/agent/session/session-hydrator.js +1 -1
  169. package/dist/src/agent/session/session-inspector.js +1 -1
  170. package/dist/src/agent/skills/hub-lock.js +1 -1
  171. package/dist/src/agent/skills/index.js +1 -1
  172. package/dist/src/agent/skills/managed-store.js +1 -1
  173. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  174. package/dist/src/agent/source-context/index.js +2 -2
  175. package/dist/src/agent/tasks/task-judge-service.js +4 -4
  176. package/dist/src/agent/tools/create-share-tool.js +3 -3
  177. package/dist/src/agent/tools/dataBatch.js +1 -1
  178. package/dist/src/agent/tools/delegate-tool.js +3 -3
  179. package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
  180. package/dist/src/agent/tools/executor.js +1 -1
  181. package/dist/src/agent/tools/factory.js +16 -16
  182. package/dist/src/agent/tools/fetch-text.js +1 -1
  183. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  184. package/dist/src/agent/tools/index.js +6 -6
  185. package/dist/src/agent/tools/list-dir.js +1 -1
  186. package/dist/src/agent/tools/personal-task-tool.js +2 -2
  187. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  188. package/dist/src/agent/tools/read.js +2 -2
  189. package/dist/src/agent/tools/review-workspace.js +1 -1
  190. package/dist/src/agent/tools/send-media.js +2 -2
  191. package/dist/src/agent/tools/skills-tools.js +1 -1
  192. package/dist/src/agent/tools/tts-tool.js +1 -1
  193. package/dist/src/agent/tools/user-context-tool.js +1 -1
  194. package/dist/src/agent/tools/write.js +2 -2
  195. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  196. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  197. package/dist/src/agent-catalog/capabilities.js +2 -2
  198. package/dist/src/ai-assist/text-assist.js +1 -1
  199. package/dist/src/auth/credentials.js +2 -2
  200. package/dist/src/auth/oauth-provider-lock.js +1 -1
  201. package/dist/src/auth/profiles/store.js +1 -1
  202. package/dist/src/auth/sync-provider-auth.js +1 -1
  203. package/dist/src/automations/capabilities/drafts.js +1 -1
  204. package/dist/src/automations/domain/index.js +2 -2
  205. package/dist/src/automations/index.js +4 -4
  206. package/dist/src/automations/service/automation-service.js +2 -2
  207. package/dist/src/backup/archive.js +1 -1
  208. package/dist/src/bootstrap/application-state.js +1 -1
  209. package/dist/src/browser/native-messaging-host.js +1 -1
  210. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  211. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  212. package/dist/src/capabilities/runtime/product.js +1 -1
  213. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  214. package/dist/src/channels/index.js +2 -2
  215. package/dist/src/channels/outbound-sender.js +1 -1
  216. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  217. package/dist/src/channels/pairing/pairing-store.js +6 -6
  218. package/dist/src/chat-commands/agent-edit.js +1 -1
  219. package/dist/src/chat-commands/builtins/config.js +3 -3
  220. package/dist/src/chat-commands/builtins/review.js +1 -1
  221. package/dist/src/chat-commands/builtins/session.js +1 -1
  222. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  223. package/dist/src/chat-commands/builtins/tts.js +1 -1
  224. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  225. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  226. package/dist/src/chat-commands/context.js +3 -3
  227. package/dist/src/chat-commands/index.js +3 -3
  228. package/dist/src/cli/commands/agent.js +7 -7
  229. package/dist/src/cli/commands/agents.js +1 -1
  230. package/dist/src/cli/commands/config.js +1 -1
  231. package/dist/src/cli/commands/connectors.js +1 -1
  232. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  233. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  234. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  235. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  236. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  237. package/dist/src/cli/commands/extension-dev.js +1 -1
  238. package/dist/src/cli/commands/extension-marketplace.js +2 -2
  239. package/dist/src/cli/commands/extension.js +4 -4
  240. package/dist/src/cli/commands/gateway/shared.js +1 -1
  241. package/dist/src/cli/commands/gateway/token.js +1 -1
  242. package/dist/src/cli/commands/image.js +1 -1
  243. package/dist/src/cli/commands/init.js +1 -1
  244. package/dist/src/cli/commands/models.js +1 -1
  245. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  246. package/dist/src/cli/commands/onboard/model.js +1 -1
  247. package/dist/src/cli/commands/onboard.js +1 -1
  248. package/dist/src/cli/commands/project.js +2 -2
  249. package/dist/src/cli/commands/runtime.js +1 -1
  250. package/dist/src/cli/commands/skills.js +2 -2
  251. package/dist/src/cli/commands/tunnel.js +4 -4
  252. package/dist/src/cli/extension-cli-register.js +5 -5
  253. package/dist/src/cli/utils/gateway-client.js +1 -1
  254. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  255. package/dist/src/cli/utils/session.js +1 -1
  256. package/dist/src/computer/runtime.js +2 -2
  257. package/dist/src/config/index.js +8 -8
  258. package/dist/src/config/loader.js +2 -2
  259. package/dist/src/config/models-json.js +2 -2
  260. package/dist/src/config/schema.js +1 -1
  261. package/dist/src/connectors/cli/authorization.js +1 -1
  262. package/dist/src/connectors/cli/runtime.js +1 -1
  263. package/dist/src/connectors/composio-sessions.js +1 -1
  264. package/dist/src/connectors/composio.js +1 -1
  265. package/dist/src/connectors/connected-source-understanding.js +3 -3
  266. package/dist/src/connectors/connection-recovery-service.js +5 -5
  267. package/dist/src/connectors/health.js +1 -1
  268. package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
  269. package/dist/src/discussions/live-worker.js +1 -1
  270. package/dist/src/discussions/recording.js +1 -1
  271. package/dist/src/discussions/sealer.js +1 -1
  272. package/dist/src/extensions/activation-context.js +3 -3
  273. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  274. package/dist/src/extensions/api.js +4 -4
  275. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  276. package/dist/src/extensions/index.js +3 -3
  277. package/dist/src/extensions/install.js +1 -1
  278. package/dist/src/extensions/loader.js +2 -2
  279. package/dist/src/extensions/lockfile.js +1 -1
  280. package/dist/src/extensions/sdk/index.js +1 -1
  281. package/dist/src/extensions/sdk/media.js +1 -1
  282. package/dist/src/extensions/update.js +1 -1
  283. package/dist/src/gateway/agents-admin.js +2 -2
  284. package/dist/src/gateway/device-routes.js +2 -2
  285. package/dist/src/gateway/file-path-classifier.js +2 -2
  286. package/dist/src/gateway/global-defaults-admin.js +1 -1
  287. package/dist/src/gateway/hono/app.js +3 -3
  288. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  289. package/dist/src/gateway/hono/routes/agents.js +1 -1
  290. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  291. package/dist/src/gateway/hono/routes/browser.js +1 -1
  292. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  293. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  294. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  295. package/dist/src/gateway/hono/routes/home.js +1 -1
  296. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  297. package/dist/src/gateway/hono/routes/media.js +1 -1
  298. package/dist/src/gateway/hono/routes/models.js +6 -6
  299. package/dist/src/gateway/hono/routes/notes.js +3 -3
  300. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  301. package/dist/src/gateway/hono/routes/projects.js +4 -4
  302. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  303. package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
  304. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  305. package/dist/src/gateway/hono/routes/shares.js +3 -3
  306. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  307. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  308. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  309. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  310. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  311. package/dist/src/gateway/hono/routes/voice.js +7 -7
  312. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  313. package/dist/src/gateway/image-generation-setup.js +3 -3
  314. package/dist/src/gateway/index.js +1 -1
  315. package/dist/src/gateway/lock.js +11 -11
  316. package/dist/src/gateway/media-access.js +1 -1
  317. package/dist/src/gateway/mobile-privacy.js +2 -2
  318. package/dist/src/gateway/ports.js +6 -6
  319. package/dist/src/gateway/run-loop.js +1 -1
  320. package/dist/src/gateway/scenes/mailContext.js +1 -1
  321. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  322. package/dist/src/gateway/server.js +1 -1
  323. package/dist/src/gateway/service/agent-runner.js +1 -1
  324. package/dist/src/gateway/service/config-coordinator.js +3 -3
  325. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  326. package/dist/src/gateway/service/session-command-service.js +2 -2
  327. package/dist/src/gateway/service/sessions-api.js +1 -1
  328. package/dist/src/gateway/service.js +37 -37
  329. package/dist/src/gateway/session-context-summary.js +2 -2
  330. package/dist/src/gateway/session-reset-service.js +1 -1
  331. package/dist/src/gateway/workspace-editor-path.js +2 -2
  332. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  333. package/dist/src/home-intelligence/generator.js +1 -1
  334. package/dist/src/infra/gateway-processes.js +2 -2
  335. package/dist/src/infra/path-env.js +3 -3
  336. package/dist/src/infra/update-global.js +10 -10
  337. package/dist/src/local-apps/service.js +2 -2
  338. package/dist/src/mcp/gateway-http-client.js +1 -1
  339. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  340. package/dist/src/notes/agent-context.js +4 -4
  341. package/dist/src/notes/index.js +1 -1
  342. package/dist/src/notes/service.js +1 -1
  343. package/dist/src/notes/store.js +1 -1
  344. package/dist/src/personal-agent/service.js +2 -2
  345. package/dist/src/projects/project-loop.d.ts +2 -1
  346. package/dist/src/projects/project-loop.js +1 -1
  347. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  348. package/dist/src/providers/index.js +2 -2
  349. package/dist/src/providers/model-catalog-persistence.js +1 -1
  350. package/dist/src/providers/model-reference-auditor.js +1 -1
  351. package/dist/src/providers/model-registry.js +1 -1
  352. package/dist/src/providers/register-runtime-providers.js +1 -1
  353. package/dist/src/remote-access/exposure-manager.js +1 -1
  354. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  355. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  356. package/dist/src/scenes/taskFollowUp/service.js +4 -4
  357. package/dist/src/session/client-history.js +2 -0
  358. package/dist/src/session/index.js +2 -2
  359. package/dist/src/session/resolve-session.js +1 -1
  360. package/dist/src/session/session-title.js +1 -1
  361. package/dist/src/session/store.js +4 -4
  362. package/dist/src/session/thinking-resolve.js +1 -1
  363. package/dist/src/share/share-store.js +1 -1
  364. package/dist/src/share/share-thumbnail.js +1 -1
  365. package/dist/src/share/share-zip.js +1 -1
  366. package/dist/src/share/site-proxy.js +1 -1
  367. package/dist/src/share/site-share-store.js +1 -1
  368. package/dist/src/storage/sqlite/connection.js +9 -9
  369. package/dist/src/tasks/capabilities/read.js +2 -2
  370. package/dist/src/tasks/capabilities/relations.d.ts +4 -0
  371. package/dist/src/tasks/capabilities/write.d.ts +4 -0
  372. package/dist/src/tasks/capabilities/write.js +1 -1
  373. package/dist/src/tasks/execution-context.js +1 -1
  374. package/dist/src/tasks/home-query-service.js +3 -3
  375. package/dist/src/tasks/index.js +4 -4
  376. package/dist/src/tasks/task-application-service.js +3 -3
  377. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  378. package/dist/src/tasks/task-context-assembler.js +1 -1
  379. package/dist/src/tasks/task-handoff-service.js +1 -1
  380. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  381. package/dist/src/tasks/task-origin-repository.d.ts +2 -0
  382. package/dist/src/tasks/task-origin-repository.js +13 -6
  383. package/dist/src/tasks/task-read-model-projector.js +3 -1
  384. package/dist/src/tui/backends/embedded-backend.js +12 -12
  385. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  386. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  387. package/dist/src/tui/tui-command-formatters.js +1 -1
  388. package/dist/src/tui/tui-commands.js +6 -6
  389. package/dist/src/tui/tui-picker-overlay.js +1 -1
  390. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  391. package/dist/src/tui/tui-startup-resources.js +4 -4
  392. package/dist/src/tui/tui.js +7 -7
  393. package/dist/src/tunnel/frpc-binary.js +1 -1
  394. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  395. package/dist/src/voice/realtime/memory-context.js +3 -3
  396. package/dist/src/voice/realtime/persona-context.js +1 -1
  397. package/dist/src/voice/realtime/runtime.js +4 -4
  398. package/dist/src/voice/stt/index.js +2 -2
  399. package/dist/src/voice/stt/preflight.js +1 -1
  400. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  401. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  402. package/dist/src/voice/stt/transcribe-core.js +1 -1
  403. package/dist/src/voice/tts/index.js +3 -3
  404. package/dist/src/voice/tts/merge-config.js +1 -1
  405. package/dist/src/voice/tts/payload.js +1 -1
  406. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  407. package/dist/src/voice/tts/speak-core.js +1 -1
  408. package/dist/src/work-discovery/incremental-repository.js +1 -1
  409. package/dist/src/work-discovery/index.js +1 -1
  410. package/dist/src/work-discovery/service.js +5 -5
  411. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  412. package/dist/src/workflows/service/workflow-run-service.js +8 -8
  413. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  414. package/package.json +2 -2
  415. package/dist/gateway/static/root/assets/gateway-realtime-store-B5Oq6VCQ.js +0 -1
  416. package/dist/gateway/static/root/assets/messages-D8PmAUB-.js +0 -3
  417. package/dist/gateway/static/root/assets/models-hub-cache-CaYi043g.js +0 -1
  418. package/dist/gateway/static/root/assets/personal-page-DopSoSDc.js +0 -1
  419. package/dist/gateway/static/root/assets/project-detail-page-BrGdrlhx.js +0 -1
  420. package/dist/gateway/static/root/assets/settings-advanced-gate-Dq5CfiKV.js +0 -1
  421. package/dist/gateway/static/root/assets/task-detail-page-GOqAjMLD.js +0 -1
  422. package/dist/gateway/static/root/assets/tasks-Buv1mgPF.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e}from"./locale-store-ChN_vjs2.js";import{o as t}from"./vendor-swr-BIWyz7Rc.js";import{n}from"./gateway-config-swr-EZxaKXdC.js";import{r}from"./registry-api-BM_81rLe.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),r()])}export{s as i,i as n,a as r,o as t};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Bi-NBvGE.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DOFuObNM.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-Bb6ohqHz.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-DodizOrj.js","assets/messages-D8PmAUB-.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-zfL8zvRu.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-C4bBXf4j.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-qy4gMa5t.js","assets/gateway-startup-retry-BEj_bcbm.js","assets/constants-Co2_smKQ.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-C4q2GwGV.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-Bj0GuUUk.js","assets/share-link-dialog-B3Io5mOY.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-Cl1RErL_.js","assets/local-session-drafts-jOqfUlwj.js","assets/tasks-Buv1mgPF.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-BNNaREyB.js","assets/capabilities-Btku0cS3.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-DYfvIxWh.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-BDh3i8n7.js","assets/gateway-realtime-store-B5Oq6VCQ.js","assets/extension-provider-D-0AeFhE.js","assets/session-manager-CFqOuGy-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-D0eYNizR.js","assets/agents-admin-api-CYqmO7gb.js","assets/gateway-config-swr-Da3Oob_s.js","assets/send-session-input-DstpmO44.js","assets/theme-store-AXut7b8R.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-CaYi043g.js","assets/oauth-api-gSu-iTk5.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-Bb6ohqHz.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-DYfvIxWh.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-D8PmAUB-.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-DodizOrj.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-CFqOuGy-.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-AXut7b8R.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-BNNaREyB.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-DOFuObNM.js";import{n as et,t as tt}from"./note-image-lightbox-1qg2v-9j.js";import{t as nt}from"./page-context-capture-button-B6i0R1qQ.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-_-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(`
3
3
  `)[0]===r?n:[r,n].filter(Boolean).join(`
4
4
 
5
- `)}var Mt=()=>i(()=>import(`./block-editor-Bi-NBvGE.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-_-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};
@@ -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{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-Bb6ohqHz.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,c,i as l,r as u}from"./locale-store-DodizOrj.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=c.getState().conversationId??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await l(u(_(e,t)));if(n.status===401&&c.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function ee(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function k(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&c.getState().onUnauthorized(),!i.ok)throw Error(await ee(i));return i.json()}var A=r();function te(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,A.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,A.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,A.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function j(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function M(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function N(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return M(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=j(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,A.jsx)(`div`,{ref:o,children:(0,A.jsx)(a,{content:l,mermaidActions:!0,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function P(){return s(u(`/api/notes/project-summaries`))}async function F(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return s(u(`/api/notes${n?`?${n}`:``}`))}async function I(e,t=`web`){return(await s(u(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function L(e,t){return(await s(u(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function R(e){let t=await l(u(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function z(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function B(e){await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function V(e){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`))}async function H(e,t){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function U(e,t,n){await s(u(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function W(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function G(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function K(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function q(e){return s(u(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function J(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Y(e,t={}){return s(u(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function X(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Z(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ne(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function re(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function ie(e,t={}){return(await s(u(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function ae(e,t,n){let r=new FormData;return r.append(`file`,t),(await k(u(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function Q(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await k(u(`/api/notes`),n)).note}async function oe(e,t=`web`){let n=await Q(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${D(n.id,r.id)})`;return n.markdown!==i&&(n=await z(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Q(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await z(r.id,{markdown:a,kind:`voice`})),r}async function se(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function ce(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function le(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as A,K as C,ae as D,z as E,d as F,E as M,h as N,N as O,g as P,J as S,le as T,Y as _,H as a,$ as b,R as c,W as d,se as f,F as g,X as h,L as i,T as j,te as k,Z as l,V as m,q as n,ie as o,P as p,G as r,B as s,re as t,ce as u,I as v,U as w,ne as x,oe as y};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-DKlJx4eo.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,c,i as l,r as u}from"./locale-store-ChN_vjs2.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=c.getState().conversationId??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await l(u(_(e,t)));if(n.status===401&&c.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function ee(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function k(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&c.getState().onUnauthorized(),!i.ok)throw Error(await ee(i));return i.json()}var A=r();function te(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,A.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,A.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,A.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function j(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function M(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function N(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return M(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=j(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,A.jsx)(`div`,{ref:o,children:(0,A.jsx)(a,{content:l,mermaidActions:!0,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function P(){return s(u(`/api/notes/project-summaries`))}async function F(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return s(u(`/api/notes${n?`?${n}`:``}`))}async function I(e,t=`web`){return(await s(u(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function L(e,t){return(await s(u(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function R(e){let t=await l(u(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function z(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function B(e){await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function V(e){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`))}async function H(e,t){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function U(e,t,n){await s(u(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function W(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function G(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function K(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function q(e){return s(u(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function J(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Y(e,t={}){return s(u(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function X(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Z(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ne(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function re(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function ie(e,t={}){return(await s(u(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function ae(e,t,n){let r=new FormData;return r.append(`file`,t),(await k(u(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function Q(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await k(u(`/api/notes`),n)).note}async function oe(e,t=`web`){let n=await Q(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${D(n.id,r.id)})`;return n.markdown!==i&&(n=await z(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Q(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await z(r.id,{markdown:a,kind:`voice`})),r}async function se(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function ce(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function le(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as A,K as C,ae as D,z as E,d as F,E as M,h as N,N as O,g as P,J as S,le as T,Y as _,H as a,$ as b,R as c,W as d,se as f,F as g,X as h,L as i,T as j,te as k,Z as l,V as m,q as n,ie as o,P as p,G as r,B as s,re as t,ce as u,I as v,U as w,ne as x,oe as y};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./popover-select-BNZZDJpO.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{f as u}from"./markdown-view-Bb6ohqHz.js";import{A as d,D as f,E as p,_ as m,g as h,i as g,p as _,s as v}from"./notes-api-DYfvIxWh.js";import{t as ee}from"./loader-circle-CifKLtgG.js";import{t as y}from"./mic-CuUb7zc-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as te}from"./search-DA7gz22f.js";import{t as ne}from"./sparkles-DHlfQFAF.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-D8PmAUB-.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,f as re,n as ie}from"./locale-store-DodizOrj.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{r as E}from"./app-chrome-BeB4KgOf.js";import{t as D}from"./skeleton-BwbyijEw.js";import{n as O}from"./index.module-Cd9ENXfk.js";import{$o as k,$t as A,Ac as j,Bs as ae,Dn as oe,En as se,Fc as ce,Gs as le,Jo as M,Jt as N,Ki as ue,Mc as de,Mo as fe,Nc as pe,On as me,Qt as he,Tn as P,Xt as ge,Yt as _e,Zt as ve,_c as ye,co as be,en as F,io as I,jn as xe,kc as Se,kn as Ce,ks as we,ti as Te,vc as Ee,vo as De,wc as Oe}from"./index-DOFuObNM.js";import{i as ke,t as L}from"./note-detail-panel-D9iPUCQq.js";var Ae=n(),R=e(t(),1),z=r();function je({projectId:e}){let t=ie(e=>e.language)===`zh`,n=i(),r=(0,R.useRef)(null),a=(0,R.useRef)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null);async function f(){let t=a.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await F();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let i=await N(t.file,t.requestId),o=await A({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await ve({...i,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await _e(i,o.discussion.id,s),await ge(t.requestId),a.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,z.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,z.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}a.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&a.current?void f():r.current?.click(),children:[(0,z.jsx)(I,{className:`size-3.5`}),o===null?c&&a.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,z.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,z.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void he(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Me(e){e.note??=await g({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await f(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${d(t,e.id)})`);e.note=await p(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./popover-select-BNZZDJpO.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{f as u}from"./markdown-view-DKlJx4eo.js";import{A as d,D as f,E as p,_ as m,g as h,i as g,p as _,s as v}from"./notes-api-D8nvWMMC.js";import{t as ee}from"./loader-circle-CifKLtgG.js";import{t as y}from"./mic-CuUb7zc-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as te}from"./search-DA7gz22f.js";import{t as ne}from"./sparkles-DHlfQFAF.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-CnM6Qfr7.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,f as re,n as ie}from"./locale-store-ChN_vjs2.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{r as E}from"./app-chrome-BeB4KgOf.js";import{t as D}from"./skeleton-BwbyijEw.js";import{n as O}from"./index.module-Cd9ENXfk.js";import{$o as k,$t as A,Ac as j,Bs as ae,Dn as oe,En as se,Fc as ce,Gs as le,Jo as M,Jt as N,Ki as ue,Mc as de,Mo as fe,Nc as pe,On as me,Qt as he,Tn as P,Xt as ge,Yt as _e,Zt as ve,_c as ye,co as be,en as F,io as I,jn as xe,kc as Se,kn as Ce,ks as we,ti as Te,vc as Ee,vo as De,wc as Oe}from"./index-BcTY7RBG.js";import{i as ke,t as L}from"./note-detail-panel-CLq8afeQ.js";var Ae=n(),R=e(t(),1),z=r();function je({projectId:e}){let t=ie(e=>e.language)===`zh`,n=i(),r=(0,R.useRef)(null),a=(0,R.useRef)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null);async function f(){let t=a.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await F();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let i=await N(t.file,t.requestId),o=await A({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await ve({...i,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await _e(i,o.discussion.id,s),await ge(t.requestId),a.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,z.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,z.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}a.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&a.current?void f():r.current?.click(),children:[(0,z.jsx)(I,{className:`size-3.5`}),o===null?c&&a.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,z.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,z.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void he(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Me(e){e.note??=await g({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await f(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${d(t,e.id)})`);e.note=await p(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
2
 
3
3
  `)}`})}return{noteId:t,conversationId:(await m(t,{projectId:e.projectId})).conversationId}}function B(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var V={meeting:Se,requirements:le,research:fe,weekly:Ee};function Ne({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let l=a.home,u=i(),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(!1),[_,v]=(0,R.useState)([]),[b,te]=(0,R.useState)(!1),[S,w]=(0,R.useState)(null),[re,ie]=(0,R.useState)(``),T=(0,R.useRef)(null),E=(0,R.useRef)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(null),k=b||!!T.current,A=p?l.templateOptions[p]:null,oe=!!(d.trim()||_.length);async function se(){if(!(E.current||!oe&&!T.current)){E.current=!0,te(!0),w(null),T.current??={requestId:crypto.randomUUID(),title:d.trim().split(`
4
4
  `)[0]?.slice(0,80)||A?.label||a.titlePlaceholder,markdown:`## ${l.requestHeading}\n\n${A?`${A.prompt}\n`:``}${d.trim()}`,projectId:t||void 0,files:[..._],attachments:[],materialHeading:l.materialsHeading};try{let e=await Me(T.current);r(),u(B(e.conversationId,e.noteId,l.agentPrompt))}catch(e){T.current.note&&r(),w(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{E.current=!1,te(!1)}}}function ce(){T.current=null,w(null),f(``),v([]),m(null),g(!1),O.current?.focus()}return(0,z.jsxs)(`section`,{"aria-label":l.askLabel,children:[(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,z.jsxs)(`fieldset`,{disabled:k,className:`min-w-0`,children:[(0,z.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),l.askLabel]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:l.agentResultHint}),A?(0,z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,z.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`font-medium`,children:[A.label,` · `]}),A.prompt.split(`
@@ -1 +1 @@
1
- import{i as e,r as t}from"./locale-store-DodizOrj.js";import{n}from"./electron-env-Dit0bHgy.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
1
+ import{i as e,r as t}from"./locale-store-ChN_vjs2.js";import{n}from"./electron-env-Dit0bHgy.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-D8PmAUB-.js";import{c as s,n as c}from"./locale-store-DodizOrj.js";import{t as l}from"./session-manager-CFqOuGy-.js";import{t as u}from"./capabilities-Btku0cS3.js";import{F as d,Gs as f,I as p}from"./index-DOFuObNM.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=r(),y=i().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await u(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!p.put(d(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 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:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-CnM6Qfr7.js";import{c as s,n as c}from"./locale-store-ChN_vjs2.js";import{t as l}from"./session-manager-BK5IvdGz.js";import{t as u}from"./capabilities-BXG_5wIg.js";import{F as d,Gs as f,I as p}from"./index-BcTY7RBG.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=r(),y=i().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await u(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!p.put(d(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 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:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};