@xopcai/xopc 0.0.385 → 0.0.387

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 (360) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +1 -1
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cb9eaXxR.js → agent-avatar-dicebear-Bv8M5ygD.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DEV-xtgm.js → agent-defaults-settings-panel-UBy01-65.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DXKc3Luj.js → agent-plugin-dialog-Q9guA8kU.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-DcNxwpJQ.js → agents-yfJFubD0.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-X5i0Tz7_.js → app-management-settings-panel-Cdyad8c1.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-CmHHzquT.js → appearance-settings-DPPvnKH_.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-ChFA4Zp0.js → apps-page-Bn_jwaeA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-BFqsIqOI.js → automations-page-CAB2sLJ5.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-workspace-Blfak-fT.js → automations-workspace-CYRUhhH4.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-CpOLG3Co.js → block-editor-B9DmMEa8.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automations-page-BSbTJ9j2.js → browser-automations-page-BHAWpZE2.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page-BUlILJrB.js → browser-settings-page-BG_17NcQ.js} +2 -2
  16. package/dist/gateway/static/root/assets/{capabilities-2Do3eKMM.js → capabilities-BX1rCiVm.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-XFwwUNU3.js → capabilities-CW389yo6.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-page-CeRdkwRf.js → capabilities-page-BAnBYWlY.js} +2 -2
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-S-cKsGja.js → capabilities-settings-panel-Ca-d6lXk.js} +3 -3
  20. package/dist/gateway/static/root/assets/{capability-header-actions-6w8pQhnn.js → capability-header-actions-B3TL8TcF.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-DfNTGBmp.js → channels-BadpS-nq.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-terminal-dock-DnoQHpDc.js → chat-terminal-dock-C_vntFpP.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-7yliE7sG.js → computer-settings-page-B-5kxk70.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-DOLAUFSW.js → connector-service-page-DTnfpLHL.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-DAsn97XG.js → connectors-page-CmJV7gqj.js} +1 -1
  27. package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
  28. package/dist/gateway/static/root/assets/{date-picker-DNDqr4Fk.js → date-picker-D5zYeC8q.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-B5oG7RgE.js → dependency-picker-D72vT-tb.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-K7kUCX1O.js → desktop-pet-DvoeVPf_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-KgOAuqSh.js → desktop-pet-settings-Dfb392hs.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-DvqniZDm.js → device-pairing-wizard-B06Sqn5D.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-BmOguLDl.js → directory-picker-path-field-CA3H3bc-.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-DtHNy4TE.js → extension-debug-page-B0wTBCx4.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-DSSuMQxp.js → extension-page-BeHiXhB1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-provider-nbgU7xBS.js → extension-provider-CJZ5EVpQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-DSd__mNd.js → extension-settings-page-Q88-LFCJ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{fallback-models-D7bjbiwZ.js → fallback-models-BXoPCvzq.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-hSXGWumL.js → gateway-settings-IICLMGDI.js} +1 -1
  40. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-C7xJwE61.js → highlighted-body-KQOG7T2V-D336so8z.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page--MvqsFhQ.js +2 -0
  42. package/dist/gateway/static/root/assets/{imports-page-BufZPzGE.js → imports-page-muV1SduS.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-D0qMv3jf.js +260 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8pPP5RF.js → keyboard-shortcuts-settings-i1sDWcwl.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-app-workbench-page-zEtvE7pJ.js → local-app-workbench-page-DY9tXEO6.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-apps-page-Bli7e_eg.js → local-apps-page-BHD73STy.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
  48. package/dist/gateway/static/root/assets/{logs-page-BimZk3R4.js → logs-page-DsPpe8Ws.js} +1 -1
  49. package/dist/gateway/static/root/assets/{management-settings-5Y4COyU9.js → management-settings-Buwi2wQE.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
  51. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +1 -0
  52. package/dist/gateway/static/root/assets/{note-detail-panel-KLDPLVg7.js → note-detail-panel-D8n80Gbr.js} +3 -3
  53. package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
  54. package/dist/gateway/static/root/assets/{notes-page-DST0oPXD.js → notes-page-Btf-jSS_.js} +5 -5
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-Bmed83-6.js → page-context-capture-button-97RL8Gc7.js} +1 -1
  56. package/dist/gateway/static/root/assets/{personal-page-BG4Ystrm.js → personal-page-B04L8Oz5.js} +1 -1
  57. package/dist/gateway/static/root/assets/product-open-page-9zEDvZa7.js +1 -0
  58. package/dist/gateway/static/root/assets/{product-preview-content-DjmupQSq.js → product-preview-content-DynBrIXq.js} +1 -1
  59. package/dist/gateway/static/root/assets/{project-detail-page-CzBmV0P6.js → project-detail-page-BM7MsoVA.js} +1 -1
  60. package/dist/gateway/static/root/assets/{projects-page-DByqe5Em.js → projects-page-pcyeEJnz.js} +1 -1
  61. package/dist/gateway/static/root/assets/{remote-access-hub-DTjj-odF.js → remote-access-hub-CphyTu22.js} +1 -1
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B_ptn3T8.js → runtime-tools-settings-panel-DPafoO0G.js} +1 -1
  63. package/dist/gateway/static/root/assets/{scenes-page-wkua4l5y.js → scenes-page-j97FrDRW.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-VvOSM84Y.js → schema-form-CuJNwKHO.js} +1 -1
  65. package/dist/gateway/static/root/assets/{send-session-input-BCAF-Ikt.js → send-session-input-C293-Hbx.js} +1 -1
  66. package/dist/gateway/static/root/assets/session-manager-COd9RECl.js +16 -0
  67. package/dist/gateway/static/root/assets/{sessions-page-D06XwYAT.js → sessions-page-D8t_8fMl.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-page-C-6BJdb1.js → settings-page-DS9DMYUe.js} +1 -1
  70. package/dist/gateway/static/root/assets/{setup-status-panel-L0JSG0K-.js → setup-status-panel-DRDvm9yZ.js} +1 -1
  71. package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-nJ2FWAEP.js → share-preview-page-BF2WaO43.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-BbgAUM3v.js → shares-settings-DQTQZu6V.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skill-api-BFU1tPyw.js → skill-api-DzVa7G-O.js} +1 -1
  75. package/dist/gateway/static/root/assets/{skills-page-DZw6el4o.js → skills-page-CfJIjRdS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-DshSGWNg.js → system-settings-panel-Bzhqed-a.js} +1 -1
  77. package/dist/gateway/static/root/assets/task-detail-page-BYQFC0-U.js +2 -0
  78. package/dist/gateway/static/root/assets/task-expandable-content-C9ohICpw.js +1 -0
  79. package/dist/gateway/static/root/assets/{tasks-DJIeIk9C.js → tasks-PuIUgF9L.js} +1 -1
  80. package/dist/gateway/static/root/assets/{tunnel-api-DFDXwWnU.js → tunnel-api-DrgpZ81I.js} +1 -1
  81. package/dist/gateway/static/root/assets/{usage-page-2RJLg54s.js → usage-page-Drk8FWnj.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-composer-attachments-BFP3k6oC.js → use-composer-attachments-rgW7h4sD.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B1BiTQNS.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
  84. package/dist/gateway/static/root/assets/{user-model-page-y1gjGYPI.js → user-model-page-07t2-nFE.js} +2 -2
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-Ch-KfpCF.js → work-discovery-overlay-TQ5bjVot.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CTu297Hc.js → workflow-run-setup-panel-C9HP2uGG.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-CRZXG_rm.js → workflows-page-DK01JRI1.js} +3 -3
  88. package/dist/gateway/static/root/assets/{workspace-api-Xr3wz8T3.js → workspace-api-JWHOFos6.js} +2 -2
  89. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-hEfjVjnc.js → xopc-cloud-account-card-B-BhQdAf.js} +1 -1
  90. package/dist/gateway/static/root/index.html +16 -16
  91. package/dist/package.js +1 -1
  92. package/dist/packages/gateway-contract/src/index.js +4 -0
  93. package/dist/packages/gateway-contract/src/result-reference.js +25 -0
  94. package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
  95. package/dist/packages/gateway-contract/src/task-research-result.js +90 -0
  96. package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
  97. package/dist/packages/gateway-contract/src/tasks.js +7 -1
  98. package/dist/packages/gateway-contract/src/turn-outcome.js +4 -0
  99. package/dist/src/agent/agent-manager.js +3 -3
  100. package/dist/src/agent/background-review/run-background-review.js +1 -1
  101. package/dist/src/agent/child-agent-factory.d.ts +4 -1
  102. package/dist/src/agent/child-agent-factory.js +86 -12
  103. package/dist/src/agent/context/connection-objective-context.d.ts +1 -0
  104. package/dist/src/agent/context/connection-objective-context.js +33 -0
  105. package/dist/src/agent/data-acquisition/service.js +41 -6
  106. package/dist/src/agent/data-acquisition/types.d.ts +2 -0
  107. package/dist/src/agent/embedded/agent-profile-context.d.ts +7 -0
  108. package/dist/src/agent/embedded/agent-profile-context.js +92 -0
  109. package/dist/src/agent/embedded/run-for-session.js +5 -2
  110. package/dist/src/agent/embedded/run-turn.js +19 -6
  111. package/dist/src/agent/embedded/runs.d.ts +9 -2
  112. package/dist/src/agent/embedded/runs.js +30 -7
  113. package/dist/src/agent/embedded/session-runner.js +5 -2
  114. package/dist/src/agent/embedded/types.d.ts +4 -0
  115. package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
  116. package/dist/src/agent/external-tools/cliProvider.js +1 -1
  117. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  118. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  119. package/dist/src/agent/external-tools/gateway-tools.js +8 -4
  120. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  121. package/dist/src/agent/orchestration/agent-run-supervisor.js +2 -1
  122. package/dist/src/agent/orchestration/agent-turn-policy.js +5 -1
  123. package/dist/src/agent/orchestration/delegation-budget.d.ts +7 -1
  124. package/dist/src/agent/orchestration/delegation-budget.js +17 -9
  125. package/dist/src/agent/orchestration/research-checkpoint.d.ts +56 -0
  126. package/dist/src/agent/orchestration/research-checkpoint.js +64 -0
  127. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +3 -1
  128. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +15 -2
  129. package/dist/src/agent/orchestration/run-termination.d.ts +12 -0
  130. package/dist/src/agent/orchestration/run-termination.js +24 -0
  131. package/dist/src/agent/orchestration/turn-recovery.d.ts +4 -1
  132. package/dist/src/agent/orchestration/turn-recovery.js +19 -3
  133. package/dist/src/agent/prompt/sections/agent-identity.js +12 -7
  134. package/dist/src/agent/prompt/sections/messaging-runtime.js +1 -1
  135. package/dist/src/agent/prompt/sections/project-context.js +1 -1
  136. package/dist/src/agent/prompt/sections/response-language.d.ts +1 -1
  137. package/dist/src/agent/prompt/sections/response-language.js +6 -2
  138. package/dist/src/agent/prompt/subagent-context.js +1 -1
  139. package/dist/src/agent/prompt/system-prompt.js +4 -6
  140. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
  141. package/dist/src/agent/service/direct-turn-helpers.js +4 -0
  142. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  143. package/dist/src/agent/service/process-direct-streaming.js +3 -2
  144. package/dist/src/agent/service.js +2 -2
  145. package/dist/src/agent/skills/index.js +1 -1
  146. package/dist/src/agent/skills/managed-store.js +1 -1
  147. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  148. package/dist/src/agent/source-context/index.js +1 -1
  149. package/dist/src/agent/source-context/result-context.d.ts +2 -0
  150. package/dist/src/agent/source-context/result-context.js +32 -0
  151. package/dist/src/agent/source-context/types.d.ts +2 -2
  152. package/dist/src/agent/source-context/types.js +1 -1
  153. package/dist/src/agent/tasks/task-judge-service.js +3 -1
  154. package/dist/src/agent/tools/apply-patch.js +1 -1
  155. package/dist/src/agent/tools/delegate-tool.js +216 -121
  156. package/dist/src/agent/tools/delegation-policy.js +13 -1
  157. package/dist/src/agent/tools/exec-command.js +47 -2
  158. package/dist/src/agent/tools/factory.js +19 -10
  159. package/dist/src/agent/tools/index.d.ts +1 -0
  160. package/dist/src/agent/tools/index.js +2 -1
  161. package/dist/src/agent/tools/language-diagnostics.js +1 -1
  162. package/dist/src/agent/tools/personal-performance.d.ts +2 -0
  163. package/dist/src/agent/tools/personal-performance.js +82 -0
  164. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  165. package/dist/src/agent/tools/personal-request-tool.js +9 -14
  166. package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
  167. package/dist/src/agent/tools/personal-result-tool.js +106 -0
  168. package/dist/src/agent/tools/personal-task-tool.d.ts +12 -3
  169. package/dist/src/agent/tools/personal-task-tool.js +115 -10
  170. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  171. package/dist/src/agent/tools/research-checkpoint-tool.d.ts +3 -0
  172. package/dist/src/agent/tools/research-checkpoint-tool.js +28 -0
  173. package/dist/src/agent/tools/review-workspace.js +21 -2
  174. package/dist/src/agent/tools/search/cache.d.ts +20 -0
  175. package/dist/src/agent/tools/search/cache.js +19 -0
  176. package/dist/src/agent/tools/search/errors.d.ts +19 -0
  177. package/dist/src/agent/tools/search/errors.js +69 -0
  178. package/dist/src/agent/tools/search/providers/bing-api.js +2 -1
  179. package/dist/src/agent/tools/search/providers/bing-html.js +2 -1
  180. package/dist/src/agent/tools/search/providers/brave.js +2 -1
  181. package/dist/src/agent/tools/search/providers/duckduckgo-html.js +2 -1
  182. package/dist/src/agent/tools/search/providers/searxng.js +2 -1
  183. package/dist/src/agent/tools/search/providers/tavily.js +2 -1
  184. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +1 -0
  185. package/dist/src/agent/tools/search/providers/xopc-cloud.js +7 -2
  186. package/dist/src/agent/tools/search/registry.d.ts +21 -5
  187. package/dist/src/agent/tools/search/registry.js +252 -25
  188. package/dist/src/agent/tools/search/types.d.ts +25 -0
  189. package/dist/src/agent/tools/send-media.js +1 -1
  190. package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
  191. package/dist/src/agent/tools/task-collaboration-tool.js +121 -2
  192. package/dist/src/agent/tools/task-evidence.d.ts +3 -0
  193. package/dist/src/agent/tools/task-evidence.js +71 -0
  194. package/dist/src/agent/tools/task-result-tool.d.ts +2 -0
  195. package/dist/src/agent/tools/task-result-tool.js +93 -0
  196. package/dist/src/agent/tools/tool-media.js +1 -1
  197. package/dist/src/agent/tools/web.d.ts +16 -2
  198. package/dist/src/agent/tools/web.js +74 -29
  199. package/dist/src/agent/tools/xopc-use-tool.js +27 -6
  200. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  201. package/dist/src/agent-catalog/capabilities.js +2 -2
  202. package/dist/src/automations/capabilities/drafts.js +1 -1
  203. package/dist/src/automations/capabilities/write.d.ts +4 -4
  204. package/dist/src/automations/domain/validation.d.ts +8 -8
  205. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
  206. package/dist/src/automations/service/action-executor.js +1 -1
  207. package/dist/src/bootstrap/application-state.js +1 -1
  208. package/dist/src/browser/automations/schema.d.ts +2 -2
  209. package/dist/src/browser/automations/service.d.ts +2 -2
  210. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  211. package/dist/src/capabilities/runtime/product.js +1 -1
  212. package/dist/src/chat-commands/agent-edit.js +1 -1
  213. package/dist/src/cli/commands/agent.js +1 -1
  214. package/dist/src/cli/commands/agents.js +1 -1
  215. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  216. package/dist/src/cli/commands/models.js +1 -1
  217. package/dist/src/cli/commands/onboard/model.js +1 -1
  218. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  219. package/dist/src/config/agent-profile.js +2 -2
  220. package/dist/src/config/index.js +2 -2
  221. package/dist/src/config/loader.js +1 -1
  222. package/dist/src/config/models-json.js +1 -1
  223. package/dist/src/config/schema.d.ts +1 -0
  224. package/dist/src/config/schema.js +5 -2
  225. package/dist/src/connectors/connection-recovery-service.d.ts +3 -1
  226. package/dist/src/connectors/connection-recovery-service.js +67 -6
  227. package/dist/src/discussions/action-tasks.d.ts +2 -2
  228. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  229. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  230. package/dist/src/gateway/agents-admin.js +2 -2
  231. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  232. package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
  233. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  234. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  235. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  236. package/dist/src/gateway/hono/routes/notes.js +2 -2
  237. package/dist/src/gateway/hono/routes/projects.js +3 -3
  238. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +18 -2
  239. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  240. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  241. package/dist/src/gateway/image-generation-setup.js +1 -1
  242. package/dist/src/gateway/lock.js +1 -1
  243. package/dist/src/gateway/media-access.js +1 -1
  244. package/dist/src/gateway/service/agent-runner.d.ts +2 -0
  245. package/dist/src/gateway/service/agent-runner.js +30 -17
  246. package/dist/src/gateway/service/run-gateway-agent.js +32 -2
  247. package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
  248. package/dist/src/gateway/service/session-input-coordinator.js +214 -27
  249. package/dist/src/gateway/service.d.ts +1 -0
  250. package/dist/src/gateway/service.js +49 -16
  251. package/dist/src/gateway/session-context-summary.js +1 -1
  252. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  253. package/dist/src/home-intelligence/host.js +2 -2
  254. package/dist/src/local-apps/service.js +1 -1
  255. package/dist/src/media/session-references.js +1 -1
  256. package/dist/src/personal-agent/communication.js +1 -0
  257. package/dist/src/personal-agent/performance.d.ts +83 -0
  258. package/dist/src/personal-agent/performance.js +65 -0
  259. package/dist/src/personal-agent/policy.d.ts +1 -1
  260. package/dist/src/personal-agent/policy.js +1 -0
  261. package/dist/src/personal-agent/proactivity/service.js +1 -1
  262. package/dist/src/personal-agent/prompt-context.js +3 -1
  263. package/dist/src/personal-agent/prompts.js +10 -4
  264. package/dist/src/personal-agent/reply-composer.d.ts +1 -0
  265. package/dist/src/personal-agent/reply-composer.js +149 -20
  266. package/dist/src/personal-agent/reply-style.d.ts +1 -1
  267. package/dist/src/personal-agent/reply-style.js +1 -0
  268. package/dist/src/personal-agent/repository.d.ts +1 -1
  269. package/dist/src/personal-agent/repository.js +1 -1
  270. package/dist/src/personal-agent/request-delivery.js +3 -1
  271. package/dist/src/personal-agent/request-repository.d.ts +2 -0
  272. package/dist/src/personal-agent/request-service.d.ts +4 -0
  273. package/dist/src/personal-agent/request-service.js +91 -20
  274. package/dist/src/personal-agent/result-extraction.d.ts +42 -0
  275. package/dist/src/personal-agent/result-extraction.js +209 -0
  276. package/dist/src/personal-agent/result-file-links.d.ts +3 -0
  277. package/dist/src/personal-agent/result-file-links.js +21 -0
  278. package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
  279. package/dist/src/personal-agent/result-read-continuations.js +78 -0
  280. package/dist/src/personal-agent/result-reader.d.ts +43 -0
  281. package/dist/src/personal-agent/result-reader.js +461 -0
  282. package/dist/src/personal-agent/service.js +2 -2
  283. package/dist/src/personal-agent/task-cancel.js +85 -35
  284. package/dist/src/providers/model-catalog-persistence.js +1 -1
  285. package/dist/src/routing/resolve-route.js +1 -1
  286. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  287. package/dist/src/scenes/taskFollowUp/service.d.ts +15 -5
  288. package/dist/src/session/client-history.d.ts +1 -1
  289. package/dist/src/session/client-history.js +1 -1
  290. package/dist/src/session/session-context-for-llm.js +4 -2
  291. package/dist/src/session/store.d.ts +3 -1
  292. package/dist/src/session/store.js +13 -3
  293. package/dist/src/share/hosted-session-share.js +1 -1
  294. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +5 -2
  295. package/dist/src/storage/sqlite/connection-wait-repository.js +42 -17
  296. package/dist/src/storage/sqlite/index.d.ts +1 -0
  297. package/dist/src/storage/sqlite/index.js +3 -1
  298. package/dist/src/storage/sqlite/migrations/250_research_checkpoints.sql +15 -0
  299. package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
  300. package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -0
  301. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  302. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  303. package/dist/src/storage/sqlite/research-checkpoint-repository.d.ts +24 -0
  304. package/dist/src/storage/sqlite/research-checkpoint-repository.js +91 -0
  305. package/dist/src/storage/sqlite/schema.js +1 -1
  306. package/dist/src/storage/sqlite/session-creation-repository.js +3 -2
  307. package/dist/src/storage/sqlite/session-input-repository.d.ts +16 -0
  308. package/dist/src/storage/sqlite/session-input-repository.js +41 -7
  309. package/dist/src/tasks/capabilities/management.d.ts +2 -2
  310. package/dist/src/tasks/capabilities/read.js +2 -2
  311. package/dist/src/tasks/capabilities/relations.d.ts +7 -7
  312. package/dist/src/tasks/capabilities/write.d.ts +2 -2
  313. package/dist/src/tasks/capabilities/write.js +1 -1
  314. package/dist/src/tasks/index.js +1 -1
  315. package/dist/src/tasks/task-allocation-service.d.ts +2 -0
  316. package/dist/src/tasks/task-allocation-service.js +100 -8
  317. package/dist/src/tasks/task-application-service.d.ts +18 -0
  318. package/dist/src/tasks/task-application-service.js +133 -2
  319. package/dist/src/tasks/task-context-assembler.js +13 -5
  320. package/dist/src/tasks/task-continuation.d.ts +1 -0
  321. package/dist/src/tasks/task-continuation.js +1 -0
  322. package/dist/src/tasks/task-contract-definition.d.ts +3 -0
  323. package/dist/src/tasks/task-contract-planner.d.ts +1 -0
  324. package/dist/src/tasks/task-contract-planner.js +61 -20
  325. package/dist/src/tasks/task-conversation-repository.js +1 -1
  326. package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
  327. package/dist/src/tasks/task-evidence-ranges.js +20 -0
  328. package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
  329. package/dist/src/tasks/task-execution-capabilities.js +117 -0
  330. package/dist/src/tasks/task-handoff-service.js +1 -1
  331. package/dist/src/tasks/task-handoff.d.ts +56 -0
  332. package/dist/src/tasks/task-handoff.js +510 -0
  333. package/dist/src/tasks/task-model-call.d.ts +7 -0
  334. package/dist/src/tasks/task-model-call.js +35 -0
  335. package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
  336. package/dist/src/tasks/task-read-model-projector.js +12 -1
  337. package/dist/src/tasks/task-research-repair.d.ts +19 -0
  338. package/dist/src/tasks/task-research-repair.js +79 -0
  339. package/dist/src/tasks/task-research-result.d.ts +99 -0
  340. package/dist/src/tasks/task-research-result.js +478 -0
  341. package/dist/src/tasks/task-result-delivery-repository.js +37 -3
  342. package/dist/src/tasks/task-result-delivery-service.js +38 -10
  343. package/dist/src/tasks/task-run-coordinator.js +71 -15
  344. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  345. package/dist/src/tasks/task-run-dispatcher.js +3 -1
  346. package/dist/src/tasks/task-run-repository.d.ts +5 -0
  347. package/dist/src/tasks/task-run-repository.js +88 -1
  348. package/dist/src/tui/backends/embedded-backend.js +2 -2
  349. package/dist/src/voice/realtime/persona-context.js +1 -1
  350. package/package.json +12 -6
  351. package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
  352. package/dist/gateway/static/root/assets/home-page-DJNmlMfH.js +0 -2
  353. package/dist/gateway/static/root/assets/index-K8SXDtxr.js +0 -260
  354. package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
  355. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DBRj4-1-.js +0 -1
  356. package/dist/gateway/static/root/assets/product-open-page-CXkYP9xE.js +0 -1
  357. package/dist/gateway/static/root/assets/session-manager-_yy4bxhT.js +0 -16
  358. package/dist/gateway/static/root/assets/settings-advanced-gate-DoAHy1wj.js +0 -1
  359. package/dist/gateway/static/root/assets/task-detail-page-CfZhq4XZ.js +0 -2
  360. package/dist/gateway/static/root/assets/task-expandable-content-CF6Bj-Qa.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CpOLG3Co.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-K8SXDtxr.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-uRu_DsWm.js","assets/messages-DTqbfje6.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DHfQAvZQ.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/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-4gpFbdsr.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/copy-text-row-C7egVuKr.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/button-aIC072nz.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/chevron-left-DqFhpbvK.js","assets/chevron-right-BweFrslA.js","assets/popover-select-DHC7J4lG.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-BxWHx6J6.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-BFP3k6oC.js","assets/use-file-preview-expanded-B1BiTQNS.js","assets/folder-open-CyzJ19I9.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-CzVTrG8n.js","assets/gateway-startup-retry-C1DQsIH3.js","assets/constants-Dy8Gw0sF.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-Xr3wz8T3.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-CB2X4Gmu.js","assets/mic-CuUb7zc-.js","assets/share-link-dialog-C47Xgzta.js","assets/globe-DSSGFWFn.js","assets/capabilities-XFwwUNU3.js","assets/local-session-drafts-D_tYFy7d.js","assets/tasks-DJIeIk9C.js","assets/specialists-4bkS5rZ4.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-B0HlMAzi.js","assets/capabilities-2Do3eKMM.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-nqN2wKYc.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/session-manager-_yy4bxhT.js","assets/gateway-realtime-BnHraJ3O.js","assets/gateway-realtime-store-BVriF6Zj.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-CYqA7bfl.js","assets/agents-admin-api-BkULgC6Q.js","assets/gateway-config-swr-D0tBjSgj.js","assets/extension-provider-nbgU7xBS.js","assets/send-session-input-BCAF-Ikt.js","assets/theme-store-BUfzeDvL.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-Ct6X5zmB.js","assets/skill-api-utils-C7V4JVXM.js","assets/date-formatters-CUZAyDEg.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-DBRwvWzm.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-BYNLO2pt.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{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-DHC7J4lG.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{F as _}from"./markdown-view-DHfQAvZQ.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-nqN2wKYc.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-DTqbfje6.js";import{t as H}from"./cn-0WouolD0.js";import{a as U,c as ne,f as re,n as ie,r as ae}from"./locale-store-uRu_DsWm.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./dist-BGTk37IG.js";import{t as pe}from"./session-manager-_yy4bxhT.js";import{t as W}from"./copy-to-clipboard-HOJ79TWv.js";import{i as me}from"./vendor-swr-BIWyz7Rc.js";import{t as G}from"./button-aIC072nz.js";import{r as he}from"./app-chrome-BeB4KgOf.js";import{i as ge}from"./theme-store-BUfzeDvL.js";import{t as _e}from"./skeleton-BI5TyibZ.js";import{b as K,d as ve,o as ye,s as be,v as xe}from"./shares-api-B0HlMAzi.js";import{Ac as Se,Bn as Ce,Co as we,Eo as Te,F as Ee,Fn as De,I as Oe,In as ke,Js as Ae,Kc as je,Ln as Me,Ns as Ne,Nt as Pe,Po as Fe,Rn as Ie,To as q,Uo as Le,Xo as J,a as Re,ar as ze,bc as Be,c as Ve,ir as He,l as Ue,ln as We,na as Ge,nr as Ke,o as qe,oc as Je,qc as Ye,rr as Xe,s as Y,ui as Ze,un as X,xs as Qe,zn as $e}from"./index-K8SXDtxr.js";import{n as et,t as tt}from"./note-image-lightbox-BYNLO2pt.js";import{t as nt}from"./page-context-capture-button-Bmed83-6.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}=me(o?`automation-suggestion-coverage`:null,ft,h),_=o?g?.automations.find(e=>Ve(e,o)):void 0,v=_?qe(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=H(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(G,{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)(Ne,{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)(G,{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)(G,{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:Y(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)(Ne,{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)(G,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,Q.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return Ue.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(oe,{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)(de,{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)(G,{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)(G,{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)(le,{children:[u,(0,Q.jsxs)(ue,{"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)(fe,{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}=me([`note-discussion-document`,e],()=>We(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}=me(d?`${f}/actions`:null,e=>U(ae(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 se(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 ce(e,t){r?.organization&&await re(async()=>{w((await U(ae(`${f}/transcript?revision=${t??r.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let pe=(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 ce(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)(_e,{className:`h-48 w-full`});if(!r)return null;let{discussion:W,transcript:he,organization:ge}=r,K=ge?.organization,ve=[`stopping`,`sealing`,`organizing`].includes(W.status),ye=[`recording`,`completed`,`needs_attention`].includes(W.status),be=he.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),xe=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)(Je,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(W.durationMs??0),` · `,ve?n?`正在整理`:`Processing`:W.status===`completed`?n?`整理完成`:`Ready`:W.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)(G,{disabled:F||ve||!W.canonicalTranscript,onClick:()=>void re(()=>U(ae(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:x})})),children:[(0,Q.jsx)(J,{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:ae(`${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:xe,draft:!1},label:n?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:F||ve||!!(D||T)||!xe||xe.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:xe.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,W.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:W.failureMessage}),(0,Q.jsx)(`button`,{disabled:F,onClick:()=>void re(()=>X(W.id)),children:n?`重试`:`Retry`})]}):null,ge&&ge.transcriptRevision!==he.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`?K?(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:K.summaryEditedByUser?n?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:F||ve,onClick:()=>O({kind:`summary`,itemId:`summary`,text:K.summary}),children:n?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:K.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)(G,{disabled:F,onClick:()=>void re(async()=>{for(let e of j)await U(ae(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:ge.revision})});M([])}),children:n?`加入所选 ${j.length} 项任务`:`Add ${j.length} selected tasks`}):null,pe(n?`已决定事项`:`Decisions`,K.decisions,`decisions`),K.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`下一步行动`:`Next actions`}),K.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||ve,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 ce(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)(G,{disabled:F||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void re(()=>U(ae(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:ge.revision})})),children:n?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,pe(n?`风险`:`Risks`,K.risks,`risks`),pe(n?`尚未确定`:`Open questions`,K.openQuestions,`openQuestions`),K.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`前后变更`:`Changes during the meeting`}),K.changes.map(e=>{let t=[...K.decisions,...K.actionItems,...K.risks,...K.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 ce(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 ce(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,K.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`章节回顾`:`Chapters`}),K.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>se(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:ve?n?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:n?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),ve?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_e,{className:`h-6 w-3/4`}),(0,Q.jsx)(_e,{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)}})]}),be.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:()=>se(e.startedAtMs),children:[(0,Q.jsx)(z,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(n?`未区分说话人`:`Speaker unknown`)}),ye&&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)),be.length>L*50?(0,Q.jsx)(G,{onClick:()=>R(L+1),children:n?`加载更多`:`More`}):null]})}),W.audioAttachmentId&&!W.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:ae(`${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:ae(`${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:()=>se(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&&ge?(0,Q.jsx)(mt,{initial:D,zh:n,busy:F,onClose:()=>O(null),onSave:e=>re(async()=>{await U(ae(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:ge.revision})}),O(null)})},`${D.kind}:${D.itemId}:${ge.revision}`):null,T?(0,Q.jsx)(fe,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ue,{"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)(de,{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)(G,{variant:`primary`,disabled:F||!T.text.trim(),onClick:()=>void re(async()=>{await U(ae(`${f}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:he.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),n?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:R,ai_edit:B,sync:J,restore:Ye};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}=me(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)(Ae,{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}=me(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)(q,{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)(Te,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Qe,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var St=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Ct({open:e,onOpenChange:t,note:n}){let r=ie(e=>e.language)===`zh`,i=r?Dt:Ot,{data:a,mutate:o}=me(e?[`note-shares`,n.id]:null,()=>A(n.id)),s=me(e?`hosted-share-auth-status`:null,ve),d=s.data===!0,p=me(e&&d?`hosted-publication-capabilities`:null,be),m=p.data?.publishing.allowed===!0,g=me(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 xe(e.id),await g.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},ae=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await F(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await ye(e.id,864e5):await K(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},pe=async e=>{H(null);try{if(!await W(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,Q.jsx)(fe,{open:e,onOpenChange:t,children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ue,{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)(de,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Le,{className:`size-4`}),i.title]}),(0,Q.jsx)(se,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(ce,{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)(Pe,{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)(G,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void pe(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)(G,{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:pe,onAction:ae},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:pe,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)(ce,{asChild:!0,children:(0,Q.jsx)(G,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(G,{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)(Le,{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)(G,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(J,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(we,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=F):F=t[54];let I;t[55]!==k||t[56]!==N||t[57]!==P||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F]}),t[55]=k,t[56]=N,t[57]=P,t[58]=F,t[59]=I):I=t[59];let R;return t[60]!==T||t[61]!==d||t[62]!==I?(R=(0,Q.jsxs)(`div`,{className:d,children:[T,I]}),t[60]=T,t[61]=d,t[62]=I,t[63]=R):R=t[63],R}function Tt(e){let t=(0,rt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=H(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,Q.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==d||t[16]!==g?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,_,y]}),t[14]=y,t[15]=d,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,Q.jsxs)(G,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(J,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(we,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,Q.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Ot={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function kt(e){let t=(0,rt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=Xe(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=Xe(u),f=Xe(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Ke,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Fe,{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=He(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=He(e);return!r||n.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-B9DmMEa8.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D0qMv3jf.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-uRu_DsWm.js","assets/messages-DTqbfje6.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-CBjl-XEc.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE--EKdQGRF.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/mermaid-render-604gISVe.js","assets/xml-_d7dTN2Q.js","assets/app-link-4gpFbdsr.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Ct4sKkUf.css","assets/copy-text-row-C7egVuKr.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/button-aIC072nz.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/chevron-left-DqFhpbvK.js","assets/chevron-right-BweFrslA.js","assets/popover-select-DHC7J4lG.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-BxWHx6J6.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-rgW7h4sD.js","assets/use-file-preview-expanded-DSKIxfz9.js","assets/folder-open-CyzJ19I9.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-CzVTrG8n.js","assets/gateway-startup-retry-C1DQsIH3.js","assets/constants-DeXt1mV-.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-JWHOFos6.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-CB2X4Gmu.js","assets/mic-CuUb7zc-.js","assets/share-link-dialog-BKGI8Kr0.js","assets/globe-DSSGFWFn.js","assets/capabilities-CW389yo6.js","assets/local-session-drafts-Be4BGM4Z.js","assets/tasks-PuIUgF9L.js","assets/specialists-4bkS5rZ4.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-B0HlMAzi.js","assets/capabilities-BX1rCiVm.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-BlGP533W.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/session-manager-COd9RECl.js","assets/gateway-realtime-BnHraJ3O.js","assets/gateway-realtime-store-BVriF6Zj.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-CYqA7bfl.js","assets/agents-admin-api-BkULgC6Q.js","assets/gateway-config-swr-D0tBjSgj.js","assets/extension-provider-CJZ5EVpQ.js","assets/send-session-input-C293-Hbx.js","assets/theme-store-BUfzeDvL.js","assets/loopi-Djb8XU3l.js","assets/loopi-C09I2mNj.css","assets/models-hub-cache-Ct6X5zmB.js","assets/skill-api-utils-C7V4JVXM.js","assets/date-formatters-CUZAyDEg.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-DBRwvWzm.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-BYNLO2pt.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{d as a,p as o,t as s}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u}from"./popover-select-DHC7J4lG.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{F as _}from"./markdown-view-CBjl-XEc.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-BlGP533W.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-DTqbfje6.js";import{t as H}from"./cn-0WouolD0.js";import{a as U,c as ne,f as re,n as ie,r as ae}from"./locale-store-uRu_DsWm.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./dist-BGTk37IG.js";import{t as pe}from"./session-manager-COd9RECl.js";import{t as W}from"./copy-to-clipboard-HOJ79TWv.js";import{i as me}from"./vendor-swr-BIWyz7Rc.js";import{t as G}from"./button-aIC072nz.js";import{r as he}from"./app-chrome-BeB4KgOf.js";import{i as ge}from"./theme-store-BUfzeDvL.js";import{t as _e}from"./skeleton-BI5TyibZ.js";import{b as K,d as ve,o as ye,s as be,v as xe}from"./shares-api-B0HlMAzi.js";import{Ac as Se,Bn as Ce,Co as we,Eo as Te,F as Ee,Fn as De,I as Oe,In as ke,Js as Ae,Kc as je,Ln as Me,Ns as Ne,Nt as Pe,Po as Fe,Rn as Ie,To as q,Uo as Le,Xo as J,a as Re,ar as ze,bc as Be,c as Ve,ir as He,l as Ue,ln as We,na as Ge,nr as Ke,o as qe,oc as Je,qc as Ye,rr as Xe,s as Y,ui as Ze,un as X,xs as Qe,zn as $e}from"./index-D0qMv3jf.js";import{n as et,t as tt}from"./note-image-lightbox-BYNLO2pt.js";import{t as nt}from"./page-context-capture-button-97RL8Gc7.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:a,className:s,variant:c}=e,l=c===void 0?`card`:c,u=ie(pt),f=V(u).automations.suggestions,p=V(u).automations,m=o(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=me(a?`automation-suggestion-coverage`:null,ft,h),_=a?g?.automations.find(e=>Ve(e,a)):void 0,v=_?qe(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=H(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(G,{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)(Ne,{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)(G,{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)(G,{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:Y(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)(Ne,{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)(G,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,Q.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return Ue.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(oe,{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)(de,{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)(G,{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)(G,{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)(le,{children:[u,(0,Q.jsxs)(ue,{"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)(fe,{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=a(),n=ie(e=>e.language)===`zh`,{data:r,mutate:i,isLoading:o}=me([`note-discussion-document`,e],()=>We(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}=me(d?`${f}/actions`:null,e=>U(ae(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 se(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 ce(e,t){r?.organization&&await re(async()=>{w((await U(ae(`${f}/transcript?revision=${t??r.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let pe=(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 ce(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(o)return(0,Q.jsx)(_e,{className:`h-48 w-full`});if(!r)return null;let{discussion:W,transcript:he,organization:ge}=r,K=ge?.organization,ve=[`stopping`,`sealing`,`organizing`].includes(W.status),ye=[`recording`,`completed`,`needs_attention`].includes(W.status),be=he.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),xe=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)(Je,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(W.durationMs??0),` · `,ve?n?`正在整理`:`Processing`:W.status===`completed`?n?`整理完成`:`Ready`:W.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)(G,{disabled:F||ve||!W.canonicalTranscript,onClick:()=>void re(()=>U(ae(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:x})})),children:[(0,Q.jsx)(J,{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:ae(`${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:xe,draft:!1},label:n?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:F||ve||!!(D||T)||!xe||xe.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:xe.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,W.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:W.failureMessage}),(0,Q.jsx)(`button`,{disabled:F,onClick:()=>void re(()=>X(W.id)),children:n?`重试`:`Retry`})]}):null,ge&&ge.transcriptRevision!==he.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`?K?(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:K.summaryEditedByUser?n?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:F||ve,onClick:()=>O({kind:`summary`,itemId:`summary`,text:K.summary}),children:n?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:K.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)(G,{disabled:F,onClick:()=>void re(async()=>{for(let e of j)await U(ae(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:ge.revision})});M([])}),children:n?`加入所选 ${j.length} 项任务`:`Add ${j.length} selected tasks`}):null,pe(n?`已决定事项`:`Decisions`,K.decisions,`decisions`),K.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`下一步行动`:`Next actions`}),K.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||ve,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 ce(e.evidenceSegmentIds,e.evidenceRevision),children:n?`查看原话`:`Source`}):null,r?r.deleted?(0,Q.jsx)(`span`,{children:n?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(s,{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)(G,{disabled:F||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void re(()=>U(ae(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:ge.revision})})),children:n?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,pe(n?`风险`:`Risks`,K.risks,`risks`),pe(n?`尚未确定`:`Open questions`,K.openQuestions,`openQuestions`),K.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`前后变更`:`Changes during the meeting`}),K.changes.map(e=>{let t=[...K.decisions,...K.actionItems,...K.risks,...K.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 ce(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 ce(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,K.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`章节回顾`:`Chapters`}),K.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>se(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:ve?n?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:n?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),ve?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_e,{className:`h-6 w-3/4`}),(0,Q.jsx)(_e,{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)}})]}),be.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:()=>se(e.startedAtMs),children:[(0,Q.jsx)(z,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(n?`未区分说话人`:`Speaker unknown`)}),ye&&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)),be.length>L*50?(0,Q.jsx)(G,{onClick:()=>R(L+1),children:n?`加载更多`:`More`}):null]})}),W.audioAttachmentId&&!W.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:ae(`${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:ae(`${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:()=>se(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&&ge?(0,Q.jsx)(mt,{initial:D,zh:n,busy:F,onClose:()=>O(null),onSave:e=>re(async()=>{await U(ae(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:ge.revision})}),O(null)})},`${D.kind}:${D.itemId}:${ge.revision}`):null,T?(0,Q.jsx)(fe,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ue,{"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)(de,{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)(G,{variant:`primary`,disabled:F||!T.text.trim(),onClick:()=>void re(async()=>{await U(ae(`${f}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:he.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),n?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:R,ai_edit:B,sync:J,restore:Ye};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}=me(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)(Ae,{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:a,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=V(ie(e=>e.language)).notes,d=o(),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}=me(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)(q,{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)(Te,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Qe,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:a.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}=me(e?[`note-shares`,n.id]:null,()=>A(n.id)),s=me(e?`hosted-share-auth-status`:null,ve),d=s.data===!0,p=me(e&&d?`hosted-publication-capabilities`:null,be),m=p.data?.publishing.allowed===!0,g=me(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 xe(e.id),await g.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},ae=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await F(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await ye(e.id,864e5):await K(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},pe=async e=>{H(null);try{if(!await W(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,Q.jsx)(fe,{open:e,onOpenChange:t,children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(ue,{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)(de,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Le,{className:`size-4`}),i.title]}),(0,Q.jsx)(se,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(ce,{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)(Pe,{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)(G,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void pe(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)(G,{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:pe,onAction:ae},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:pe,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)(ce,{asChild:!0,children:(0,Q.jsx)(G,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(G,{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)(Le,{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)(G,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(J,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(we,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=F):F=t[54];let I;t[55]!==k||t[56]!==N||t[57]!==P||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F]}),t[55]=k,t[56]=N,t[57]=P,t[58]=F,t[59]=I):I=t[59];let R;return t[60]!==T||t[61]!==d||t[62]!==I?(R=(0,Q.jsxs)(`div`,{className:d,children:[T,I]}),t[60]=T,t[61]=d,t[62]=I,t[63]=R):R=t[63],R}function Tt(e){let t=(0,rt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=H(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,Q.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==d||t[16]!==g?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,_,y]}),t[14]=y,t[15]=d,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,Q.jsxs)(G,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(J,{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)(G,{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)(G,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(we,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,Q.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Ot={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function kt(e){let t=(0,rt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=Xe(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=Xe(u),f=Xe(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Ke,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Fe,{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=He(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=He(e);return!r||n.split(`
3
3
  `)[0]===r?n:[r,n].filter(Boolean).join(`
4
4
 
5
- `)}var Mt=()=>i(()=>import(`./block-editor-CpOLG3Co.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,114])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([115,1,111,5,116,117,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:Je},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Be},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)(Se,{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)(Ce,{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)(Me,{children:(0,Q.jsx)(De,{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)(ke,{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)(Ie,{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:_}=me([`note-discussion-document`,e],()=>We(e)),[v,x]=(0,Z.useState)(!0),S=a(),w=ge(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),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(!1),de=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{de.current+=1},[e]);let[fe,W]=(0,Z.useState)(null),[G,_e]=(0,Z.useState)(!1),[K,ve]=(0,Z.useState)(null),[ye,be]=(0,Z.useState)(!1),[xe,Se]=(0,Z.useState)(!1),Te=(0,Z.useRef)(!1),Ne=(0,Z.useRef)(!1),Pe=(0,Z.useRef)(null),Fe=(0,Z.useRef)(null),q=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),Ve=(0,Z.useRef)(null),He=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),qe=Ge(e=>e.setPageHeader),Ye=Ge(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=me(e?[`note-detail`,e]:null,()=>T(e)),{data:nt=[],mutate:rt}=me(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),it=F!==null,at=(0,Z.useCallback)(e=>{W(`${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)(()=>{Te.current=!1,te(``),I(null),M(null),Ne.current=!1,Ke.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Te.current||(te(Y.title??``),Te.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Ke.current===e)return;let t=window.requestAnimationFrame(()=>{Ue.current?.focus(),d?.()});return Ke.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`,he,i),children:(0,Q.jsx)(je,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=Xe.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&&(J.current=t,Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(async()=>{let t=J.current;if(J.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`,he),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)=>{ue(!0),W(null);try{let n=await C(e,{forceNew:t});await X(),await rt(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){W(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{ue(!1)}},[X,rt,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{ce(!0),W(null);try{await j(e),await X()}catch(e){W(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{ce(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!se&&pt()},[A,se,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=F?F.markdown??``:q.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:ze(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,F,z]),gt=(0,Z.useCallback)(async()=>{Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current),Pe.current=null,Fe.current=null;let t=q.current,r=J.current;q.current=null,J.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 q.current===null&&(q.current=t),J.current===null&&(J.current=r),W(`${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||le||L)return;ue(!0),W(null);let e=ne.getState(),t=++de.current,n=()=>de.current===t&&ne.getState().baseUrl===e.baseUrl&&ne.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Be.current?.contains(t.anchorNode)&&Be.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let a=Oe.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 pe().createSession();if(!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let s=Ee(e.baseUrl,e.conversationId,o.key);if(!Oe.put(s,a))throw Error(h.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&W(h.unavailable)}finally{de.current===t&&ue(!1)}},[Y,le,L,gt,S,h.unavailable]),yt=(0,Z.useCallback)(async()=>{W(null);let e=await gt();e&&(ve(e),_e(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(xe||L)){be(!1),Se(!0),W(null),$(),Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current),Pe.current=null,Fe.current=null,q.current=null,J.current=null;try{await N(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){W(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Se(!1)}}},[xe,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`,he),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:se,"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:se?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:le,className:H(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:le?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:le||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)(Je,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(Ie,{modal:!1,children:[(0,Q.jsx)(Ce,{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)(Me,{children:(0,Q.jsxs)(De,{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)(ke,{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)(Le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(ke,{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)(Ae,{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)($e,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(ke,{disabled:xe||L,onSelect:()=>be(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(we,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[se,mt,ft,vt,h.capture,Y,F,D,p.history,p.modeEdit,p.modePreview,p.modeSource,le,A,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,xe,L,f,p.delete,be]);(0,Z.useLayoutEffect)(()=>(qe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&Ye()}),[o,Ye,wt,dt,st,Y,qe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),q.current=t,Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){R(!0),W(null);try{await y(e,{markdown:t}),await X(),n?.()}catch(e){W(`${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)(()=>()=>{Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current);let t=q.current,n=J.current;q.current=null,J.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??``:q.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:[fe?(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:fe}):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:Be,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:Ue,type:`text`,value:z,onChange:e=>lt(e.target.value),onCompositionStart:()=>{Ne.current=!0},onCompositionEnd:()=>{Ne.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ne.current&&!t.isComposing&&(e.preventDefault(),(Be.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:Ue,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:Ve,className:H(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ae&&`transition-[width] duration-300 ease-in-out`),style:{width:A?U:0},children:(0,Q.jsxs)(`div`,{ref:He,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),oe(!0);let n=e.clientX,r=U,i=e.pointerId,a=0,o=U,s=U,c=()=>{a=0,s=o,A&&Ve.current?.style.setProperty(`width`,`${s}px`),He.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{}oe(!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`,ae&&`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:se,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:le,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),K?(0,Q.jsx)(Ct,{open:G,onOpenChange:_e,note:K}):null,(0,Q.jsx)(Ze,{open:ye,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>be(!1)})]})}export{$ as i,lt as n,ct as r,zt as t};
5
+ `)}var Mt=()=>i(()=>import(`./block-editor-B9DmMEa8.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,114])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([115,1,111,5,116,117,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:Je},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Be},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)(Se,{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)(Ce,{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)(Me,{children:(0,Q.jsx)(De,{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)(ke,{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)(Ie,{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:a=!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:_}=me([`note-discussion-document`,e],()=>We(e)),[v,x]=(0,Z.useState)(!0),S=o(),w=ge(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),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(!1),de=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{de.current+=1},[e]);let[fe,W]=(0,Z.useState)(null),[G,_e]=(0,Z.useState)(!1),[K,ve]=(0,Z.useState)(null),[ye,be]=(0,Z.useState)(!1),[xe,Se]=(0,Z.useState)(!1),Te=(0,Z.useRef)(!1),Ne=(0,Z.useRef)(!1),Pe=(0,Z.useRef)(null),Fe=(0,Z.useRef)(null),q=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),Ve=(0,Z.useRef)(null),He=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),qe=Ge(e=>e.setPageHeader),Ye=Ge(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=me(e?[`note-detail`,e]:null,()=>T(e)),{data:nt=[],mutate:rt}=me(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),it=F!==null,at=(0,Z.useCallback)(e=>{W(`${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)(()=>{Te.current=!1,te(``),I(null),M(null),Ne.current=!1,Ke.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Te.current||(te(Y.title??``),Te.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Ke.current===e)return;let t=window.requestAnimationFrame(()=>{Ue.current?.focus(),d?.()});return Ke.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`,he,i),children:(0,Q.jsx)(je,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=Xe.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&&(J.current=t,Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(async()=>{let t=J.current;if(J.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`,he),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)=>{ue(!0),W(null);try{let n=await C(e,{forceNew:t});await X(),await rt(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){W(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{ue(!1)}},[X,rt,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{ce(!0),W(null);try{await j(e),await X()}catch(e){W(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{ce(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!se&&pt()},[A,se,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=F?F.markdown??``:q.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:ze(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,F,z]),gt=(0,Z.useCallback)(async()=>{Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current),Pe.current=null,Fe.current=null;let t=q.current,r=J.current;q.current=null,J.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 q.current===null&&(q.current=t),J.current===null&&(J.current=r),W(`${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||le||L)return;ue(!0),W(null);let e=ne.getState(),t=++de.current,n=()=>de.current===t&&ne.getState().baseUrl===e.baseUrl&&ne.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Be.current?.contains(t.anchorNode)&&Be.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let a=Oe.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 pe().createSession();if(!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let s=Ee(e.baseUrl,e.conversationId,o.key);if(!Oe.put(s,a))throw Error(h.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&W(h.unavailable)}finally{de.current===t&&ue(!1)}},[Y,le,L,gt,S,h.unavailable]),yt=(0,Z.useCallback)(async()=>{W(null);let e=await gt();e&&(ve(e),_e(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(xe||L)){be(!1),Se(!0),W(null),$(),Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current),Pe.current=null,Fe.current=null,q.current=null,J.current=null;try{await N(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){W(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Se(!1)}}},[xe,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`,he),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:se,"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:se?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:le,className:H(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:le?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:le||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)(Je,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(Ie,{modal:!1,children:[(0,Q.jsx)(Ce,{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)(Me,{children:(0,Q.jsxs)(De,{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)(ke,{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)(Le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(ke,{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)(Ae,{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)($e,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(ke,{disabled:xe||L,onSelect:()=>be(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(we,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[se,mt,ft,vt,h.capture,Y,F,D,p.history,p.modeEdit,p.modePreview,p.modeSource,le,A,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,xe,L,f,p.delete,be]);(0,Z.useLayoutEffect)(()=>(qe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{a&&Ye()}),[a,Ye,wt,dt,st,Y,qe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),q.current=t,Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){R(!0),W(null);try{await y(e,{markdown:t}),await X(),n?.()}catch(e){W(`${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)(()=>()=>{Pe.current&&clearTimeout(Pe.current),Fe.current&&clearTimeout(Fe.current);let t=q.current,n=J.current;q.current=null,J.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??``:q.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:[fe?(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:fe}):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:Be,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:Ue,type:`text`,value:z,onChange:e=>lt(e.target.value),onCompositionStart:()=>{Ne.current=!0},onCompositionEnd:()=>{Ne.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ne.current&&!t.isComposing&&(e.preventDefault(),(Be.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:Ue,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:Ve,className:H(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ae&&`transition-[width] duration-300 ease-in-out`),style:{width:A?U:0},children:(0,Q.jsxs)(`div`,{ref:He,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),oe(!0);let n=e.clientX,r=U,i=e.pointerId,a=0,o=U,s=U,c=()=>{a=0,s=o,A&&Ve.current?.style.setProperty(`width`,`${s}px`),He.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{}oe(!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`,ae&&`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:se,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:le,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),K?(0,Q.jsx)(Ct,{open:G,onOpenChange:_e,note:K}):null,(0,Q.jsx)(Ze,{open:ye,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>be(!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-DHfQAvZQ.js";import{t as o}from"./cn-0WouolD0.js";import{a as s,c,i as l,r as u}from"./locale-store-uRu_DsWm.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-CBjl-XEc.js";import{t as o}from"./cn-0WouolD0.js";import{a as s,c,i as l,r as u}from"./locale-store-uRu_DsWm.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};