@xopcai/xopc 0.0.420 → 0.0.421

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 (324) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-DnqOM8GN.js → activity-store-CKrylgib.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1UABT2KS.js → agent-avatar-dicebear-Dv5Rda4y.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-avatar-display-B1ycycx2.js +2 -0
  6. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D285zy0S.js +1 -0
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-D3yCqVan.js +1 -0
  8. package/dist/gateway/static/root/assets/{agents-O7mago-m.js → agents-DyAuR3rG.js} +5 -5
  9. package/dist/gateway/static/root/assets/{agents-admin-api-CyjykMEh.js → agents-admin-api-CASGzvkW.js} +1 -1
  10. package/dist/gateway/static/root/assets/{api-C1dxxDZx.js → api-C4LxuNzq.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-Ddrs70xV.js → api-Uk05lF9i.js} +1 -1
  12. package/dist/gateway/static/root/assets/app-management-settings-panel-CDnZNKHt.js +1 -0
  13. package/dist/gateway/static/root/assets/appearance-settings-CmCF7PZ5.js +1 -0
  14. package/dist/gateway/static/root/assets/apps-page-BR9qoA2P.js +1 -0
  15. package/dist/gateway/static/root/assets/{archive-plugin-n5lPr79c.js → archive-plugin-nuHYYVty.js} +1 -1
  16. package/dist/gateway/static/root/assets/automation-api-DtJfd1QM.js +1 -0
  17. package/dist/gateway/static/root/assets/automation-display-BlGt8MAC.js +2 -0
  18. package/dist/gateway/static/root/assets/automation-task-card-Cp3RIw5d.js +2 -0
  19. package/dist/gateway/static/root/assets/{automations-page-oLsNzu_6.js → automations-page-DM4IdUJh.js} +1 -1
  20. package/dist/gateway/static/root/assets/automations-workspace-CXLu04I-.js +9 -0
  21. package/dist/gateway/static/root/assets/{binary-plugins-D9VW7dWP.js → binary-plugins-CHCAr8jt.js} +1 -1
  22. package/dist/gateway/static/root/assets/{block-editor-C477bTtO.js → block-editor-B0v8KxsO.js} +4 -4
  23. package/dist/gateway/static/root/assets/{browser-automation-inputs-CCiYXxmh.js → browser-automation-inputs-DjUW7PEB.js} +1 -1
  24. package/dist/gateway/static/root/assets/browser-automations-page-Cf8AoQz1.js +3 -0
  25. package/dist/gateway/static/root/assets/{browser-control-api-Y3fvmeBk.js → browser-control-api-C6NZgaA1.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-settings-page-DjkGahlz.js → browser-settings-page-DV2FNEDf.js} +2 -2
  27. package/dist/gateway/static/root/assets/{capabilities-DAyA681v.js → capabilities-CwdjWz2r.js} +1 -1
  28. package/dist/gateway/static/root/assets/{capabilities-DRVXLssH.js → capabilities-D0-HCZ5J.js} +1 -1
  29. package/dist/gateway/static/root/assets/capabilities-page-DwDkritH.js +2 -0
  30. package/dist/gateway/static/root/assets/capabilities-settings-panel-mme16Fbp.js +8 -0
  31. package/dist/gateway/static/root/assets/channels-lKFLu8p-.js +1 -0
  32. package/dist/gateway/static/root/assets/{chat-agents-api-D5nR_JVe.js → chat-agents-api-l80cvSac.js} +1 -1
  33. package/dist/gateway/static/root/assets/{chat-chart-block-K2t333qv.js → chat-chart-block-BwP5QXEk.js} +1 -1
  34. package/dist/gateway/static/root/assets/chat-page-CT3K7lFT.js +71 -0
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-CkFG6mA3.js → chat-terminal-dock-D2bV9YUL.js} +2 -2
  36. package/dist/gateway/static/root/assets/{list-filter-COkzTdOz.js → clipboard-copy-DuJk5WD6.js} +1 -1
  37. package/dist/gateway/static/root/assets/{command-palette-api-Do_66X1B.js → command-palette-api-CtapG8ck.js} +1 -1
  38. package/dist/gateway/static/root/assets/composer-payload-handoff-DYuhKZRC.js +1 -0
  39. package/dist/gateway/static/root/assets/{computer-settings-page-DBxOcMko.js → computer-settings-page-DZtMuihL.js} +1 -1
  40. package/dist/gateway/static/root/assets/connected-providers-grid-BQH5k3iC.js +1 -0
  41. package/dist/gateway/static/root/assets/{connector-service-page-rWpnchb3.js → connector-service-page-DrvFdP3G.js} +1 -1
  42. package/dist/gateway/static/root/assets/{connectors-api-DIBG72k4.js → connectors-api-BzkgVBYC.js} +1 -1
  43. package/dist/gateway/static/root/assets/connectors-page-BtRNVCFy.js +1 -0
  44. package/dist/gateway/static/root/assets/{date-picker-CE-cZFCU.js → date-picker-ByTasrfl.js} +1 -1
  45. package/dist/gateway/static/root/assets/{dependency-picker-7SpSfDSg.js → dependency-picker-Dh8hPmsT.js} +1 -1
  46. package/dist/gateway/static/root/assets/desktop-pet-CFz8bqyI.js +1 -0
  47. package/dist/gateway/static/root/assets/desktop-pet-settings-COaboNn1.js +1 -0
  48. package/dist/gateway/static/root/assets/{dev-view-store-57HgVuZ6.js → dev-view-store-D8XYHVqG.js} +1 -1
  49. package/dist/gateway/static/root/assets/device-pairing-wizard-BKMpLdIA.js +1 -0
  50. package/dist/gateway/static/root/assets/{directory-picker-path-field-D4jMhpka.js → directory-picker-path-field-Cjv7rdo3.js} +1 -1
  51. package/dist/gateway/static/root/assets/discussion-annotation-sync-YvlVw17j.js +1 -0
  52. package/dist/gateway/static/root/assets/{dist-DNCdG_qB.js → dist-D3lWNSe7.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-debug-page-BsK2LMXQ.js → extension-debug-page-CXx3m5-B.js} +1 -1
  54. package/dist/gateway/static/root/assets/extension-iframe-host-CnOdNwbo.js +1 -0
  55. package/dist/gateway/static/root/assets/{extension-marketplace-api-CVJPqJOB.js → extension-marketplace-api-BABmUY2s.js} +1 -1
  56. package/dist/gateway/static/root/assets/extension-page-C1nGr4DD.js +1 -0
  57. package/dist/gateway/static/root/assets/{extension-provider-Byrd8Sor.js → extension-provider-BA0Y2Rvs.js} +1 -1
  58. package/dist/gateway/static/root/assets/extension-settings-page-QIPI8e7k.js +1 -0
  59. package/dist/gateway/static/root/assets/{file-preview-surface-BlprUrIs.js → file-preview-surface-BsB7bnFH.js} +1 -1
  60. package/dist/gateway/static/root/assets/{gateway-config-swr-BAmUhiP1.js → gateway-config-swr-Bt8w0Iio.js} +1 -1
  61. package/dist/gateway/static/root/assets/{gateway-realtime-CsykKL4l.js → gateway-realtime-CyCCNUxm.js} +1 -1
  62. package/dist/gateway/static/root/assets/gateway-realtime-store-0gmDfPeP.js +1 -0
  63. package/dist/gateway/static/root/assets/gateway-restart-Ty4AzDxa.js +1 -0
  64. package/dist/gateway/static/root/assets/{gateway-settings-BA5-Uuwx.js → gateway-settings-BvKq7vuz.js} +1 -1
  65. package/dist/gateway/static/root/assets/{gateway-startup-retry-CtUB3g6N.js → gateway-startup-retry-N3k-C7c2.js} +1 -1
  66. package/dist/gateway/static/root/assets/{global-defaults-api-CINf-C6a.js → global-defaults-api-D8EB2vfY.js} +1 -1
  67. package/dist/gateway/static/root/assets/home-page-eRuAzi58.js +2 -0
  68. package/dist/gateway/static/root/assets/image-generation-api-C99Fsofm.js +1 -0
  69. package/dist/gateway/static/root/assets/{imports-page-BWShtGRQ.js → imports-page-Cp9RquVb.js} +1 -1
  70. package/dist/gateway/static/root/assets/index-6vVrWfwM.js +11 -0
  71. package/dist/gateway/static/root/assets/index-DDGK6klk.css +1 -0
  72. package/dist/gateway/static/root/assets/install-connector-dialog-CsoAidXp.js +1 -0
  73. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CdM4BQwp.js → keyboard-shortcuts-settings-DFhOP2aD.js} +1 -1
  74. package/dist/gateway/static/root/assets/list-filter-CIPvpfLA.js +1 -0
  75. package/dist/gateway/static/root/assets/local-app-workbench-page-DbtU_A-l.js +1 -0
  76. package/dist/gateway/static/root/assets/{local-apps-page-CxyRVfjD.js → local-apps-page-rjhHfLpe.js} +1 -1
  77. package/dist/gateway/static/root/assets/{local-session-drafts-B9ZPwotC.js → local-session-drafts-DHM4vWDO.js} +1 -1
  78. package/dist/gateway/static/root/assets/{locale-store-lIXD1FMw.js → locale-store-5Hf8J8-_.js} +1 -1
  79. package/dist/gateway/static/root/assets/logs-page-Dx_JIOpF.js +2 -0
  80. package/dist/gateway/static/root/assets/management-settings-CuSzixOw.js +1 -0
  81. package/dist/gateway/static/root/assets/{markdown-view-CJt-i2Dp.js → markdown-view-pzSRu7av.js} +3 -3
  82. package/dist/gateway/static/root/assets/{media-plugins-D_bR23mA.js → media-plugins-3cJuHbO7.js} +1 -1
  83. package/dist/gateway/static/root/assets/messages-uXxg5p54.js +3 -0
  84. package/dist/gateway/static/root/assets/model-selector-ksLo-5B_.js +1 -0
  85. package/dist/gateway/static/root/assets/{models-hub-cache-za2fWJLg.js → models-hub-cache-DhZng2nF.js} +1 -1
  86. package/dist/gateway/static/root/assets/navigation-D62kPsA9.js +1 -0
  87. package/dist/gateway/static/root/assets/note-detail-panel-B6RbjwJq.js +5 -0
  88. package/dist/gateway/static/root/assets/note-image-lightbox-BCjvBqwy.js +1 -0
  89. package/dist/gateway/static/root/assets/{notes-api-C_458rv5.js → notes-api-DocbsBbT.js} +1 -1
  90. package/dist/gateway/static/root/assets/notes-page-B7889s6-.js +8 -0
  91. package/dist/gateway/static/root/assets/{oauth-api-C3X9FLYw.js → oauth-api-CCFIPbA0.js} +1 -1
  92. package/dist/gateway/static/root/assets/{oauth-provider-connect-H81se_3n.js → oauth-provider-connect-GxkF0vWJ.js} +1 -1
  93. package/dist/gateway/static/root/assets/open-capability-settings-Cvb65hQB.js +1 -0
  94. package/dist/gateway/static/root/assets/{page-context-capture-button-BkAlQ7cB.js → page-context-capture-button-CvWLVeRA.js} +1 -1
  95. package/dist/gateway/static/root/assets/{page-context-draft-ClLgaOaD.js → page-context-draft-CMRDNv4d.js} +1 -1
  96. package/dist/gateway/static/root/assets/page-header-store-reh1es-3.js +1 -0
  97. package/dist/gateway/static/root/assets/{personal-avatar-BLtHt8fV.js → personal-avatar-CqNJ48Ge.js} +1 -1
  98. package/dist/gateway/static/root/assets/personal-page-D95FHaw9.js +1 -0
  99. package/dist/gateway/static/root/assets/personal-settings-panel-DAcl8DU4.js +1 -0
  100. package/dist/gateway/static/root/assets/{phone-dependencies-card-DISHarj8.js → phone-dependencies-card-DLWblGj7.js} +1 -1
  101. package/dist/gateway/static/root/assets/phone-model-picker-ugrT9GJu.js +1 -0
  102. package/dist/gateway/static/root/assets/phone-settings-page-DIIt7JOE.js +1 -0
  103. package/dist/gateway/static/root/assets/{phone-workspace-store-fhnZrgy_.js → phone-workspace-store-mawKT5kV.js} +1 -1
  104. package/dist/gateway/static/root/assets/plugin-details-dialog-BdueMT3q.js +1 -0
  105. package/dist/gateway/static/root/assets/popover-select-DD8fmrxH.js +1 -0
  106. package/dist/gateway/static/root/assets/preference-select-fields-CmLZNwbm.js +1 -0
  107. package/dist/gateway/static/root/assets/product-automation-feedback-DYwhL37Y.js +7 -0
  108. package/dist/gateway/static/root/assets/{product-open-page-xn9G4hSI.js → product-open-page-B5G4X71t.js} +1 -1
  109. package/dist/gateway/static/root/assets/{product-preview-content-DcoK-iZe.js → product-preview-content-BUheyLqt.js} +1 -1
  110. package/dist/gateway/static/root/assets/{product-preview-modal-Ruw9WSKK.js → product-preview-modal-Cj_Zxu4G.js} +2 -2
  111. package/dist/gateway/static/root/assets/project-detail-page-CRJb69vP.js +7 -0
  112. package/dist/gateway/static/root/assets/project-understanding-D3w8cZEm.js +1 -0
  113. package/dist/gateway/static/root/assets/projects-page-CkifzKjz.js +1 -0
  114. package/dist/gateway/static/root/assets/{providers-api-CzVkFKFg.js → providers-api-CKFg2PZQ.js} +1 -1
  115. package/dist/gateway/static/root/assets/{recording-upload-0jxahBMo.js → recording-upload-ZkmRf0GR.js} +1 -1
  116. package/dist/gateway/static/root/assets/{registry-api-n8TwtJ_j.js → registry-api-B1Mh3bNo.js} +1 -1
  117. package/dist/gateway/static/root/assets/{remote-access-hub-cZpBi4Rk.js → remote-access-hub-Dw5rG-aA.js} +1 -1
  118. package/dist/gateway/static/root/assets/resource-unavailable-BUWsH3fp.js +1 -0
  119. package/dist/gateway/static/root/assets/route-preload-CRKbVwQ1.js +2 -0
  120. package/dist/gateway/static/root/assets/runtime-impact-DbySfhdp.js +1 -0
  121. package/dist/gateway/static/root/assets/{runtime-tools-api-D-8KjYK6.js → runtime-tools-api-BXvn5ImA.js} +1 -1
  122. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-BALcypHp.js +1 -0
  123. package/dist/gateway/static/root/assets/schema-form-BKeP5G7b.js +1 -0
  124. package/dist/gateway/static/root/assets/service-recommendation-list-CpVUnz89.js +1 -0
  125. package/dist/gateway/static/root/assets/{session-api-CsCoI2im.js → session-api-VquhIBHI.js} +1 -1
  126. package/dist/gateway/static/root/assets/session-manager-DNMosCtW.js +23 -0
  127. package/dist/gateway/static/root/assets/sessions-page-DlvPkE5Y.js +1 -0
  128. package/dist/gateway/static/root/assets/settings-advanced-gate-Ckc1aCLG.js +1 -0
  129. package/dist/gateway/static/root/assets/{settings-advanced-section-BqoVSko2.js → settings-advanced-section-c9_iZ-46.js} +1 -1
  130. package/dist/gateway/static/root/assets/{settings-mode-store-CBsJ-Qg2.js → settings-mode-store-Dem6-TBe.js} +1 -1
  131. package/dist/gateway/static/root/assets/{settings-page-DROUGyJl.js → settings-page-B_wNfFQe.js} +1 -1
  132. package/dist/gateway/static/root/assets/{settings-page-header-Bv-kQFTm.js → settings-page-header-C8a_oOyw.js} +1 -1
  133. package/dist/gateway/static/root/assets/{settings-page-layout-DHP6MrrL.js → settings-page-layout-CTSRWljG.js} +1 -1
  134. package/dist/gateway/static/root/assets/setup-status-panel-BNZoqF40.js +1 -0
  135. package/dist/gateway/static/root/assets/{share-link-dialog-BJHRQVKC.js → share-link-dialog-C5JTTxsy.js} +1 -1
  136. package/dist/gateway/static/root/assets/share-preview-page-D-KxzXgm.js +2 -0
  137. package/dist/gateway/static/root/assets/{shares-api-rtWVHA_d.js → shares-api-CztKbxdd.js} +1 -1
  138. package/dist/gateway/static/root/assets/shares-settings-CzR21j6e.js +1 -0
  139. package/dist/gateway/static/root/assets/skill-api-B7kWl6LK.js +1 -0
  140. package/dist/gateway/static/root/assets/{skill-list-api-BzlKXPsE.js → skill-list-api-Cn07P6qZ.js} +1 -1
  141. package/dist/gateway/static/root/assets/{skill-reload-api-Cff2GgZb.js → skill-reload-api-Bhl0u16_.js} +1 -1
  142. package/dist/gateway/static/root/assets/skills-page-BmkuxHZe.js +2 -0
  143. package/dist/gateway/static/root/assets/{system-settings-panel-BeQeUUMH.js → system-settings-panel-Ce6zIcki.js} +1 -1
  144. package/dist/gateway/static/root/assets/task-detail-page-CysJhG3B.js +2 -0
  145. package/dist/gateway/static/root/assets/task-result-evidence-CGZKMnNo.js +1 -0
  146. package/dist/gateway/static/root/assets/{terminal-panel-store-5Fzctajw.js → terminal-panel-store-YwLUkuyV.js} +1 -1
  147. package/dist/gateway/static/root/assets/{theme-store-DW45fWYQ.js → theme-store-DOJ9tu-j.js} +1 -1
  148. package/dist/gateway/static/root/assets/tracing-settings-page-BplBpTdL.js +1 -0
  149. package/dist/gateway/static/root/assets/tunnel-api-B5-Ypvqa.js +1 -0
  150. package/dist/gateway/static/root/assets/{understanding-activity-store-CTe6TFB0.js → understanding-activity-store-CmwtE8Kd.js} +1 -1
  151. package/dist/gateway/static/root/assets/{understanding-refresh-store-mE9OKG6q.js → understanding-refresh-store-9apSmAVL.js} +1 -1
  152. package/dist/gateway/static/root/assets/usage-page-cPbirpXX.js +1 -0
  153. package/dist/gateway/static/root/assets/{use-autosave-Cs2Ga_Y_.js → use-autosave-B3p2QWaF.js} +1 -1
  154. package/dist/gateway/static/root/assets/use-composer-attachments-D-AEYC85.js +2 -0
  155. package/dist/gateway/static/root/assets/use-file-preview-expanded-CO4SC-LX.js +2 -0
  156. package/dist/gateway/static/root/assets/{use-personal-profile-BHL2AxWU.js → use-personal-profile-DocmhC9I.js} +1 -1
  157. package/dist/gateway/static/root/assets/{use-workspace-tree-CnmPZrpx.js → use-workspace-tree-VraTGKx-.js} +1 -1
  158. package/dist/gateway/static/root/assets/user-model-page-DuRALzhe.js +2 -0
  159. package/dist/gateway/static/root/assets/{voice-api-key-field-3gyc2UV3.js → voice-api-key-field-DbSQHZZW.js} +1 -1
  160. package/dist/gateway/static/root/assets/{voice-config-api-Cda2uBIC.js → voice-config-api-D9iNJSvm.js} +1 -1
  161. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DtYHsPLF.js → voice-input-shortcut-events-hso9_VvT.js} +1 -1
  162. package/dist/gateway/static/root/assets/voice-transcribe-api-BqIs0jgv.js +1 -0
  163. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dqu5CQCS.js → work-discovery-overlay-fsL9RJqB.js} +1 -1
  164. package/dist/gateway/static/root/assets/work-discovery-page-DAQPKVDs.js +1 -0
  165. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DHl2cZY1.js → working-directory-picker-modal-Ta73QrNw.js} +1 -1
  166. package/dist/gateway/static/root/assets/{workspace-api-CtDbI6T7.js → workspace-api-CgrcNyBc.js} +2 -2
  167. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Dw6wtadX.js +1 -0
  168. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CTIbUfKb.js → workspace-file-preview-dialog-B7uBuPtA.js} +1 -1
  169. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BwxouqdZ.js → workspace-open-location-menu-Bi2vRvaQ.js} +1 -1
  170. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CFb-23rS.js → xopc-cloud-account-card-CCOOBG-7.js} +1 -1
  171. package/dist/gateway/static/root/index.html +86 -81
  172. package/dist/package.js +1 -1
  173. package/dist/packages/gateway-contract/src/index.js +2 -0
  174. package/dist/packages/gateway-contract/src/task-display.js +14 -0
  175. package/dist/src/agent/agent-manager.js +1 -1
  176. package/dist/src/agent/background-review/run-background-review.js +1 -1
  177. package/dist/src/agent/context/execution-scope.js +10 -5
  178. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  179. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  180. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  181. package/dist/src/agent/service.js +1 -1
  182. package/dist/src/agent/skills/index.js +1 -1
  183. package/dist/src/agent/skills/managed-store.js +1 -1
  184. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  185. package/dist/src/agent/tools/automation-tool.d.ts +2 -1
  186. package/dist/src/agent/tools/automation-tool.js +10 -3
  187. package/dist/src/agent/tools/factory.js +1 -0
  188. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  189. package/dist/src/agent/tools/personal-task-tool.js +2 -1
  190. package/dist/src/agent/tools/xopc-use-tool.js +7 -5
  191. package/dist/src/agent-catalog/capabilities.js +2 -2
  192. package/dist/src/agent-catalog/repository.js +1 -1
  193. package/dist/src/automations/api/routes.js +38 -0
  194. package/dist/src/automations/capabilities/drafts.js +1 -1
  195. package/dist/src/automations/capabilities/write.js +25 -9
  196. package/dist/src/automations/configuration-conversation.d.ts +16 -0
  197. package/dist/src/automations/configuration-conversation.js +120 -0
  198. package/dist/src/automations/delivery/delivery-router.d.ts +2 -0
  199. package/dist/src/automations/delivery/delivery-router.js +30 -9
  200. package/dist/src/automations/domain/types.d.ts +1 -0
  201. package/dist/src/automations/index.js +5 -5
  202. package/dist/src/automations/service/action-executor.js +41 -12
  203. package/dist/src/automations/service/automation-service.d.ts +6 -0
  204. package/dist/src/automations/service/automation-service.js +47 -12
  205. package/dist/src/automations/service/index.js +2 -2
  206. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  207. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  208. package/dist/src/capabilities/runtime/product.js +1 -1
  209. package/dist/src/cli/commands/agents.js +1 -1
  210. package/dist/src/cli/commands/models.js +1 -1
  211. package/dist/src/cli/commands/onboard/model.js +1 -1
  212. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  213. package/dist/src/computer/broker.js +16 -3
  214. package/dist/src/computer/diagnostics.js +1 -1
  215. package/dist/src/computer/errors.js +4 -0
  216. package/dist/src/config/agent-profile.js +1 -1
  217. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  218. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  219. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  220. package/dist/src/gateway/agents-admin.js +2 -2
  221. package/dist/src/gateway/automation-completion-delivery.d.ts +4 -0
  222. package/dist/src/gateway/automation-completion-delivery.js +14 -0
  223. package/dist/src/gateway/global-defaults-admin.js +1 -1
  224. package/dist/src/gateway/hono/routes/agents.js +1 -1
  225. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  226. package/dist/src/gateway/hono/routes/notes.js +2 -2
  227. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  228. package/dist/src/gateway/hono/routes/projects.js +2 -2
  229. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  230. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  231. package/dist/src/gateway/image-generation-setup.js +1 -1
  232. package/dist/src/gateway/respawn.js +2 -1
  233. package/dist/src/gateway/service.js +4 -4
  234. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  235. package/dist/src/imports/importService.js +1 -1
  236. package/dist/src/local-apps/service.js +1 -1
  237. package/dist/src/observability/store.d.ts +9 -0
  238. package/dist/src/observability/store.js +77 -32
  239. package/dist/src/personal-agent/communication.d.ts +1 -1
  240. package/dist/src/personal-agent/communication.js +3 -6
  241. package/dist/src/personal-agent/request-service.js +2 -1
  242. package/dist/src/personal-agent/service.js +1 -1
  243. package/dist/src/runtime-tools/archive.js +1 -1
  244. package/dist/src/tasks/capabilities/read.js +2 -2
  245. package/dist/src/tasks/capabilities/write.js +1 -1
  246. package/dist/src/tasks/task-contract-planner.js +2 -1
  247. package/dist/src/tui/backends/embedded-backend.js +1 -1
  248. package/dist/src/voice/realtime/persona-context.js +1 -1
  249. package/package.json +3 -3
  250. package/dist/gateway/static/root/assets/agent-avatar-display-Cy50vjbq.js +0 -2
  251. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-V4NX_cWz.js +0 -1
  252. package/dist/gateway/static/root/assets/agent-plugin-dialog-CQ5LLDMO.js +0 -1
  253. package/dist/gateway/static/root/assets/app-management-settings-panel-C1Zs-eha.js +0 -1
  254. package/dist/gateway/static/root/assets/appearance-settings-lIfGokbz.js +0 -1
  255. package/dist/gateway/static/root/assets/apps-page-CUvtsRYD.js +0 -1
  256. package/dist/gateway/static/root/assets/automation-api-Bld8blNl.js +0 -1
  257. package/dist/gateway/static/root/assets/automation-display-BcfZOQTC.js +0 -2
  258. package/dist/gateway/static/root/assets/automations-workspace-BgtYY2Mm.js +0 -8
  259. package/dist/gateway/static/root/assets/browser-automations-page-DIUNY94X.js +0 -3
  260. package/dist/gateway/static/root/assets/capabilities-page-DFW4Y0x8.js +0 -2
  261. package/dist/gateway/static/root/assets/capabilities-settings-panel-uOHSMQPZ.js +0 -8
  262. package/dist/gateway/static/root/assets/channels-D2a69dSt.js +0 -1
  263. package/dist/gateway/static/root/assets/chat-page-CG38tCHE.js +0 -71
  264. package/dist/gateway/static/root/assets/composer-payload-handoff-BU3B-C26.js +0 -1
  265. package/dist/gateway/static/root/assets/connected-providers-grid-Dmnu2zle.js +0 -1
  266. package/dist/gateway/static/root/assets/connectors-page-DT_WrC1y.js +0 -1
  267. package/dist/gateway/static/root/assets/desktop-pet-lorocS9j.js +0 -1
  268. package/dist/gateway/static/root/assets/desktop-pet-settings-CEcohlZq.js +0 -1
  269. package/dist/gateway/static/root/assets/device-pairing-wizard-CLCPuf4R.js +0 -1
  270. package/dist/gateway/static/root/assets/discussion-annotation-sync-BKjf9gWe.js +0 -1
  271. package/dist/gateway/static/root/assets/extension-iframe-host-Dhkk5JV2.js +0 -1
  272. package/dist/gateway/static/root/assets/extension-page-Brps2XDP.js +0 -1
  273. package/dist/gateway/static/root/assets/extension-settings-page-CHY68DpG.js +0 -1
  274. package/dist/gateway/static/root/assets/gateway-realtime-store-DQqMBruB.js +0 -1
  275. package/dist/gateway/static/root/assets/gateway-restart-Ch128Lrr.js +0 -1
  276. package/dist/gateway/static/root/assets/home-page-DaMFBYo1.js +0 -2
  277. package/dist/gateway/static/root/assets/image-generation-api-I_JgLL_m.js +0 -1
  278. package/dist/gateway/static/root/assets/index-DY2Y83b9.css +0 -1
  279. package/dist/gateway/static/root/assets/index-UCOlAnf-.js +0 -11
  280. package/dist/gateway/static/root/assets/install-connector-dialog-DU1Tz7B3.js +0 -1
  281. package/dist/gateway/static/root/assets/local-app-workbench-page-qPflPuQD.js +0 -1
  282. package/dist/gateway/static/root/assets/logs-page-CbY1N-zi.js +0 -2
  283. package/dist/gateway/static/root/assets/management-settings-Diy12JfQ.js +0 -1
  284. package/dist/gateway/static/root/assets/messages-DRR9N3HC.js +0 -3
  285. package/dist/gateway/static/root/assets/model-selector-DCYA_ntf.js +0 -1
  286. package/dist/gateway/static/root/assets/navigation-BkjnOw30.js +0 -1
  287. package/dist/gateway/static/root/assets/note-detail-panel-DBs1yHLy.js +0 -5
  288. package/dist/gateway/static/root/assets/note-image-lightbox-CivkB6LB.js +0 -1
  289. package/dist/gateway/static/root/assets/notes-page-DL3c-41a.js +0 -8
  290. package/dist/gateway/static/root/assets/page-header-store-DH8K0xii.js +0 -1
  291. package/dist/gateway/static/root/assets/personal-page-B5DP3lO-.js +0 -1
  292. package/dist/gateway/static/root/assets/personal-settings-panel-DjDc5Kaz.js +0 -1
  293. package/dist/gateway/static/root/assets/phone-model-picker-u8YIQCgo.js +0 -1
  294. package/dist/gateway/static/root/assets/phone-settings-page-el3pT0PD.js +0 -1
  295. package/dist/gateway/static/root/assets/plugin-details-dialog-CTBs1Jde.js +0 -1
  296. package/dist/gateway/static/root/assets/popover-select-DniHw2dy.js +0 -1
  297. package/dist/gateway/static/root/assets/preference-select-fields-D7oluyHN.js +0 -1
  298. package/dist/gateway/static/root/assets/product-automation-feedback-DsUSqCOX.js +0 -7
  299. package/dist/gateway/static/root/assets/project-detail-page-BKvWLiMw.js +0 -7
  300. package/dist/gateway/static/root/assets/project-understanding-BCQr0AZ_.js +0 -1
  301. package/dist/gateway/static/root/assets/projects-page-D4g7bB7X.js +0 -1
  302. package/dist/gateway/static/root/assets/route-preload-B5UiReO7.js +0 -2
  303. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-MKlLFuow.js +0 -1
  304. package/dist/gateway/static/root/assets/schema-form-v4N4lawq.js +0 -1
  305. package/dist/gateway/static/root/assets/service-recommendation-list-B1xuVT3N.js +0 -1
  306. package/dist/gateway/static/root/assets/session-manager-5l9q0cd5.js +0 -16
  307. package/dist/gateway/static/root/assets/sessions-page-DsLw2aMD.js +0 -1
  308. package/dist/gateway/static/root/assets/settings-advanced-gate-B5lQeVNi.js +0 -1
  309. package/dist/gateway/static/root/assets/setup-status-panel-MJE3B_LX.js +0 -1
  310. package/dist/gateway/static/root/assets/share-preview-page-Bsrv_zOQ.js +0 -2
  311. package/dist/gateway/static/root/assets/shares-settings-CfIRv4uX.js +0 -1
  312. package/dist/gateway/static/root/assets/skill-api-B_W1K3sv.js +0 -1
  313. package/dist/gateway/static/root/assets/skills-page-DtBloYeU.js +0 -2
  314. package/dist/gateway/static/root/assets/task-detail-page-Drrv-Hp0.js +0 -2
  315. package/dist/gateway/static/root/assets/task-result-evidence-D1Kyskm_.js +0 -1
  316. package/dist/gateway/static/root/assets/tracing-settings-page-B12u5D9A.js +0 -1
  317. package/dist/gateway/static/root/assets/tunnel-api-DGO56LQU.js +0 -1
  318. package/dist/gateway/static/root/assets/usage-page-Ud2U9UG1.js +0 -1
  319. package/dist/gateway/static/root/assets/use-composer-attachments-BCbMj-MN.js +0 -2
  320. package/dist/gateway/static/root/assets/use-file-preview-expanded-DSpCRXUW.js +0 -2
  321. package/dist/gateway/static/root/assets/user-model-page-p5iPfnwl.js +0 -2
  322. package/dist/gateway/static/root/assets/voice-transcribe-api-TInEfIYo.js +0 -1
  323. package/dist/gateway/static/root/assets/work-discovery-page-p-8ciZ0i.js +0 -1
  324. package/dist/gateway/static/root/assets/workspace-editor-agent-store-B94Q2nN8.js +0 -1
@@ -0,0 +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{l as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-5Hf8J8-_.js";import{t as ee}from"./messages-uXxg5p54.js";import{t as te}from"./check-DUBLcKHA.js";import{a as ne,c as s,d as c,l,o as u,u as re}from"./popover-select-DD8fmrxH.js";import{t as ie}from"./settings-2-D-csvaET.js";import{t as d}from"./cn-0WouolD0.js";import{i as ae}from"./vendor-swr-CdRzEUwF.js";import{c as f,s as oe}from"./dist-CaUuvp8-.js";import{t as se}from"./open-capability-settings-Cvb65hQB.js";import{n as ce}from"./interaction-BdhHBbYa.js";import{n as le,t as ue}from"./registry-api-B1Mh3bNo.js";import{i as de,n as fe,r as pe}from"./form-field-width-DJw_jULe.js";var me=n();function p(e,t){return e.displayNames?.[t.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`]||(t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/auto`&&e.name===`Standard`?`标准`:t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/advanced`&&e.name===`Advanced`?`高级`:e.name)}var m=e(t(),1);function he(e,t,n){if(t===`computer-use`)return e.filter(e=>!!e.computerUse);let r=e=>e.computerUse?.profile!==void 0&&e.computerUse.dedicated!==!1&&e.computerUse.profile!==`openai-responses-computer-v1`;if(t!==`vision`)return e.filter(e=>!r(e)&&!e.phoneUse||e.id===n);let i=e.filter(e=>e.vision===!0&&!r(e)&&!e.phoneUse);if(!n||i.some(e=>e.id===n))return i;let a=e.find(e=>e.id===n);if(a)return[a,...i];let o=n.indexOf(`/`),ee=o>=0?n.slice(0,o):``;return[{id:n,name:(o>=0?n.slice(o+1):n)||n,provider:ee||`—`,vision:!1},...i]}var h=r();function g(e){return`${e.id} ${e.name} ${Object.values(e.displayNames??{}).join(` `)} ${e.provider}`.toLowerCase()}var ge=[];function _e(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=n.split(/\s+/).filter(Boolean);return e.filter(e=>{let t=g(e);return r.every(e=>t.includes(e))})}function _(e){let t=(0,me.c)(100),{value:n,disabled:r,placeholder:u,searchPlaceholder:g,noMatches:_,models:v,modelsLoading:xe,modelsError:Se,capabilitiesFilter:y,outOfFilterNote:Ce,registryEmptyHint:we,allowEmpty:Te,emptyLabel:Ee,compact:De,showProviderInTrigger:Oe,contentSide:ke,contentAlign:Ae,className:je,popoverContentClassName:Me,showProviderSettingsFooter:Ne,settingsFooterLink:Pe,ariaLabel:Fe,onChange:b}=e,Ie=Te!==void 0&&Te,Le=Oe===void 0||Oe,Re=ke===void 0?`bottom`:ke,ze=Ae===void 0?`end`:Ae,Be=a(),x=i(),S=o(ye),C;t[0]===S?C=t[1]:(C=ee(S),t[0]=S,t[1]=C);let Ve=C.chat,[He,Ue]=(0,m.useState)(!1),[w,T]=(0,m.useState)(``),[We,Ge]=(0,m.useState)(null),Ke=l(),qe=s(We),Je=re(Ke,qe!==null),E;t[2]!==Ve||t[3]!==Pe||t[4]!==Ne?(E=Pe??(Ne?{label:Ve.modelProviderSettingsLink,path:`/settings/capabilities/models`}:void 0),t[2]=Ve,t[3]=Pe,t[4]=Ne,t[5]=E):E=t[5];let D=E,O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O={revalidateOnFocus:!1},t[6]=O):O=t[6];let Ye=ae(v?null:ue,le,O),k=v??Ye.data??ge,Xe=v?!!xe:Ye.isLoading,A=v?Se:Ye.error,Ze;t[7]===n?Ze=t[8]:(Ze=n.trim(),t[7]=n,t[8]=Ze);let j=Ze,Qe;t[9]!==y||t[10]!==k||t[11]!==j?(Qe=he(k,y,j),t[9]=y,t[10]=k,t[11]=j,t[12]=Qe):Qe=t[12];let M=Qe,$e=y===`computer-use`||M.length>10,et=$e?w:``,tt;t[13]!==M||t[14]!==et?(tt=_e(M,et),t[13]=M,t[14]=et,t[15]=tt):tt=t[15];let N=tt,nt;t[16]!==k||t[17]!==M||t[18]!==n?(nt=k.find(e=>e.id===n)??M.find(e=>e.id===n),t[16]=k,t[17]=M,t[18]=n,t[19]=nt):nt=t[19];let P=nt,F;t[20]!==S||t[21]!==u||t[22]!==P||t[23]!==Le||t[24]!==n?(F=P?Le?`${p(P,S)} (${P.provider})`:p(P,S):n||u,t[20]=S,t[21]=u,t[22]=P,t[23]=Le,t[24]=n,t[25]=F):F=t[25];let rt=F,I=!A&&!!y&&M.length===0,it=f,at=r||Xe,L;t[26]!==S||t[27]!==u||t[28]!==P?(L=P?`${p(P,S)} (${P.provider})`:u,t[26]=S,t[27]=u,t[28]=P,t[29]=L):L=t[29];let ot=De&&`py-1.5 text-[13px]`,R;t[30]!==je||t[31]!==ot?(R=d(fe,`items-center gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-left text-sm font-normal text-fg`,ce.transition,`hover:border-edge hover:bg-surface-hover/45`,de,`disabled:cursor-not-allowed disabled:opacity-50`,`dark:border-edge-subtle dark:hover:bg-surface-hover/55`,ot,je),t[30]=je,t[31]=ot,t[32]=R):R=t[32];let st=Xe?`…`:rt,z;t[33]===st?z=t[34]:(z=(0,h.jsx)(`span`,{className:`min-w-0 truncate`,children:st}),t[33]=st,t[34]=z);let B;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,h.jsx)(c,{className:`size-4 shrink-0 text-fg-subtle opacity-70`,"aria-hidden":!0}),t[35]=B):B=t[35];let V;t[36]!==Fe||t[37]!==at||t[38]!==L||t[39]!==R||t[40]!==z?(V=(0,h.jsx)(oe,{asChild:!0,children:(0,h.jsxs)(`button`,{ref:Ge,type:`button`,"aria-label":Fe,disabled:at,title:L,className:R,children:[z,B]})}),t[36]=Fe,t[37]=at,t[38]=L,t[39]=R,t[40]=z,t[41]=V):V=t[41];let ct=f,lt=qe??void 0,ut=f,dt=d(Je,ne,`w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge-subtle bg-surface-overlay p-1 shadow-elevated dark:border-edge-subtle`,Me),H;t[42]!==w||t[43]!==g||t[44]!==$e?(H=$e?(0,h.jsx)(`input`,{type:`search`,"aria-label":g,className:d(`mb-1 w-full shrink-0 rounded-lg border border-edge-subtle bg-surface-base px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-disabled dark:bg-surface-hover/40`,pe),placeholder:g,value:w,onChange:e=>T(e.target.value)}):null,t[42]=w,t[43]=g,t[44]=$e,t[45]=H):H=t[45];let U;t[46]!==Ie||t[47]!==Ee||t[48]!==b||t[49]!==u||t[50]!==j?(U=Ie?(0,h.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,j===``&&`bg-surface-hover/90 font-medium dark:bg-surface-hover/70`),onClick:()=>{b(``),Ue(!1),T(``)},children:[(0,h.jsx)(te,{className:d(`size-4 shrink-0`,j!==``&&`invisible`),"aria-hidden":!0}),(0,h.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,children:Ee??u})]}):null,t[46]=Ie,t[47]=Ee,t[48]=b,t[49]=u,t[50]=j,t[51]=U):U=t[51];let W;t[52]===A?W=t[53]:(W=A?(0,h.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:`Failed to load models`}):null,t[52]=A,t[53]=W);let G;t[54]!==A||t[55]!==_||t[56]!==we||t[57]!==I?(G=!A&&I?(0,h.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:we??_}):null,t[54]=A,t[55]=_,t[56]=we,t[57]=I,t[58]=G):G=t[58];let K;t[59]!==A||t[60]!==N||t[61]!==_||t[62]!==I?(K=!A&&!I&&N.length===0?(0,h.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:_}):null,t[59]=A,t[60]=N,t[61]=_,t[62]=I,t[63]=K):K=t[63];let ft=y===`vision`?Ce:void 0,q;t[64]===b?q=t[65]:(q=e=>{b(e),Ue(!1),T(``)},t[64]=b,t[65]=q);let J;t[66]!==N||t[67]!==_||t[68]!==g||t[69]!==ft||t[70]!==q||t[71]!==n?(J=(0,h.jsx)(be,{models:N,value:n,searchPlaceholder:g,noMatches:_,showSearch:!1,outOfFilterNote:ft,onChange:q}),t[66]=N,t[67]=_,t[68]=g,t[69]=ft,t[70]=q,t[71]=n,t[72]=J):J=t[72];let Y;t[73]!==U||t[74]!==W||t[75]!==G||t[76]!==K||t[77]!==J?(Y=(0,h.jsxs)(`div`,{className:`flex min-h-0 max-h-60 flex-1 flex-col overflow-hidden`,children:[U,W,G,K,J]}),t[73]=U,t[74]=W,t[75]=G,t[76]=K,t[77]=J,t[78]=Y):Y=t[78];let X;t[79]!==D||t[80]!==x||t[81]!==Be?(X=D?(0,h.jsx)(`div`,{className:`mt-1 shrink-0 border-t border-edge-subtle pt-1`,children:(0,h.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md p-2 text-left text-sm font-medium text-accent`,ce.transition,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),onClick:()=>{D.path===`/settings/capabilities/models`?se(x.pathname.startsWith(`/automations`)?`background`:`chat`,`services`,x.pathname.startsWith(`/automations`)?`automation`:void 0):Be(D.path,{state:{settingsBackPath:`${x.pathname}${x.search}`}}),Ue(!1),T(``)},children:[(0,h.jsx)(ie,{className:`size-4 shrink-0 opacity-90`,"aria-hidden":!0}),(0,h.jsx)(`span`,{className:`min-w-0`,children:D.label})]})}):null,t[79]=D,t[80]=x,t[81]=Be,t[82]=X):X=t[82];let Z;t[83]!==ze||t[84]!==Re||t[85]!==ut.Content||t[86]!==dt||t[87]!==H||t[88]!==Y||t[89]!==X?(Z=(0,h.jsxs)(ut.Content,{className:dt,side:Re,sideOffset:4,align:ze,collisionPadding:8,onOpenAutoFocus:ve,children:[H,Y,X]}),t[83]=ze,t[84]=Re,t[85]=ut.Content,t[86]=dt,t[87]=H,t[88]=Y,t[89]=X,t[90]=Z):Z=t[90];let Q;t[91]!==ct.Portal||t[92]!==lt||t[93]!==Z?(Q=(0,h.jsx)(ct.Portal,{container:lt,children:Z}),t[91]=ct.Portal,t[92]=lt,t[93]=Z,t[94]=Q):Q=t[94];let $;return t[95]!==He||t[96]!==it.Root||t[97]!==V||t[98]!==Q?($=(0,h.jsxs)(it.Root,{open:He,onOpenChange:Ue,children:[V,Q]}),t[95]=He,t[96]=it.Root,t[97]=V,t[98]=Q,t[99]=$):$=t[99],$}function ve(e){return e.preventDefault()}function ye(e){return e.language}function be({models:e,value:t,onChange:n,searchPlaceholder:r,noMatches:i,disabled:a,showSearch:ee=e.length>10,outOfFilterNote:ne,groupByProvider:s=!1}){let c=o(e=>e.language),[l,re]=(0,m.useState)(``),ie=_e(e,ee?l:``),ae=(0,m.useRef)(null);(0,m.useLayoutEffect)(()=>{l||ae.current?.scrollIntoView?.({block:`nearest`})},[t,l,ie.some(e=>e.id===t)]);let f=new Map;for(let t of e){let e=s?t.provider:``;f.has(e)||f.set(e,[])}for(let e of ie)f.get(s?e.provider:``).push(e);return(0,h.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[ee&&(0,h.jsx)(`input`,{type:`search`,"aria-label":r,placeholder:r,value:l,onChange:e=>re(e.target.value),className:d(`mx-1 mb-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`,`focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:shadow-none focus-visible:border-edge`)}),(0,h.jsxs)(`div`,{"data-select-scroll-region":!0,className:d(u,s&&`scroll-pt-8`),children:[ie.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-sm text-fg-muted`,children:i}),[...f].filter(([,e])=>e.length>0).map(([r,i])=>(0,h.jsxs)(`div`,{role:s?`group`:void 0,"aria-label":s?r:void 0,className:s?`border-t border-edge-subtle pb-1 first:border-t-0`:void 0,children:[s&&(0,h.jsx)(`p`,{className:`sticky top-0 z-10 bg-surface-overlay px-3 pb-1 pt-3 text-xs font-medium text-fg-muted`,children:r}),i.map(r=>(0,h.jsxs)(`button`,{type:`button`,disabled:a,title:r.id,ref:r.id===t?ae:void 0,"aria-pressed":r.id===t,style:e.length>50?{contentVisibility:`auto`,containIntrinsicSize:`auto 60px`}:void 0,className:d(`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover disabled:opacity-50`,ce.focusRingPanel,r.id===t&&`bg-surface-hover`),onClick:()=>n(r.id),children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`truncate font-medium`,children:p(r,c)}),(r.phoneUse||r.computerUse?.dedicated||r.reasoning)&&(0,h.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:r.phoneUse?c===`zh`?`手机控制`:`Phone control`:r.computerUse?.dedicated?c===`zh`?`电脑控制`:`Computer control`:c===`zh`?`推理`:`Reasoning`})]}),!s&&(0,h.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:r.provider}),ne&&!r.vision&&r.id===t&&(0,h.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:ne})]}),(0,h.jsx)(te,{className:d(`size-4 shrink-0 text-accent-fg`,r.id!==t&&`invisible`),"aria-hidden":!0})]},r.id))]},r))]})]})}export{_ as n,p as r,be as t};
@@ -1 +1 @@
1
- import{i as e}from"./locale-store-lIXD1FMw.js";import{o as t}from"./vendor-swr-CdRzEUwF.js";import{n}from"./gateway-config-swr-BAmUhiP1.js";import{r}from"./registry-api-n8TwtJ_j.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),t(`settings-agent-defaults`),t(`model-capability-media-sources`),t(`native-voice-connections`),t(`voice-dictation-route`),t(e=>Array.isArray(e)&&[`model-use-choices`,`native-voice-connections`,`capability-service-connections`].includes(e[0])),r()])}export{s as i,i as n,a as r,o as t};
1
+ import{i as e}from"./locale-store-5Hf8J8-_.js";import{o as t}from"./vendor-swr-CdRzEUwF.js";import{n}from"./gateway-config-swr-Bt8w0Iio.js";import{r}from"./registry-api-B1Mh3bNo.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),t(`settings-agent-defaults`),t(`model-capability-media-sources`),t(`native-voice-connections`),t(`voice-dictation-route`),t(e=>Array.isArray(e)&&[`model-use-choices`,`native-voice-connections`,`capability-service-connections`].includes(e[0])),r()])}export{s as i,i as n,a as r,o as t};
@@ -0,0 +1 @@
1
+ var e={settingsImports:`imports`,settingsOverview:`overview`,settingsAppearance:`appearance`,settingsKeyboardShortcuts:`keyboard-shortcuts`,settingsPersonal:`personal`,settingsSystem:`system`,settingsDesktopPet:`desktop-pet`,settingsDesktopApp:`desktop-app`,settingsAgentDefaults:`agent-defaults`,settingsGateway:`gateway`,settingsRuntimes:`runtimes`,settingsDevices:`devices`,settingsTunnel:`remote-access`,settingsShares:`shares`};function t(t){return e[t]??null}var n=new Set([`settingsDesktopPet`,`settingsDesktopApp`]),r={id:`system`,tabs:[`settingsDesktopPet`,`settingsDesktopApp`]},i=[{id:`general`,tabs:[`settingsOverview`,`settingsAppearance`,`settingsPersonal`,`settingsSystem`,`settingsKeyboardShortcuts`]},{id:`capabilities`,tabs:[`settingsModels`,`settingsSearch`,`settingsAgentDefaults`]},{id:`integrations`,tabs:[`settingsAgentBrowser`,`settingsComputerUse`,`settingsPhoneUse`]},{id:`connection`,tabs:[`settingsDevices`,`settingsTunnel`,`settingsShares`]},{id:`system`,tabs:[`settingsGateway`,`settingsRuntimes`,`settingsImports`,`sessions`,`usage`,`tracing`,`logs`]}],a=`https://xopcai.github.io/xopc`;function o(e){return e===`zh`?`${a}/zh/`:`${a}/`}function s(e,t){let n=t.replace(/^\/+/,``).replace(/\.md$/,``);return e===`zh`?`${a}/zh/${n}`:`${a}/${n}`}function c(e,t){let n=s(e,`remote-access`);return t?`${n}#${t}`:n}function l(e){if(e===`settingsKeyboardShortcuts`)return`/settings/keyboard-shortcuts`;if(e===`settingsAgentBrowser`)return`/settings/agent-browser`;if(e===`settingsPhoneUse`)return`/settings/phone-use`;if(e===`settingsComputerUse`)return`/settings/computer-use`;if(e===`settingsModels`)return u(`models`);if(e===`settingsSearch`)return u(`search`);let n=t(e);return n?`/settings/${n}`:e===`sessions`||e===`usage`||e===`tracing`||e===`logs`?`/settings/${e}`:`/${e}`}function u(e){return`/settings/capabilities/${e}`}function d(e,t){return e===`settingsModels`?t===u(`models`):t===l(e)}function f(e,t){return/^https:\/\//i.test(t)?t:/^[a-z][a-z0-9+.-]*:|^\/\//i.test(t)?o(e):s(e,t.replace(/^\/?zh\//,``))}export{f as a,d as c,u as i,l,r as n,s as o,i as r,o as s,n as t,c as u};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-B0v8KxsO.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-5Hf8J8-_.js","assets/messages-uXxg5p54.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-DocbsBbT.js","assets/markdown-view-pzSRu7av.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/dist-DfWfZ9iu.js","assets/dist-CxGUk8J-.js","assets/es2015-DBLcMg5B.js","assets/app-link-CytZ5zkp.js","assets/product-delivery-BU_H84jL.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-C-DHb3Io.css","assets/chat-chart-block-BwP5QXEk.js","assets/skeleton-BI5TyibZ.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-BCjvBqwy.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-BuuGlcfG.js","assets/languages-zXtNocoy.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-Czpn1I53.js";import{l as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,i as l,l as u,n as d,o as f,p}from"./locale-store-5Hf8J8-_.js";import{t as m}from"./messages-uXxg5p54.js";import{E as h,b as g,d as _,h as v,i as y,n as b,o as x,r as S,t as C,w,x as T}from"./discussion-annotation-sync-YvlVw17j.js";import{t as E}from"./arrow-left-D880xG-P.js";import{a as D,c as O,d as k,i as A,l as j,n as M,o as N,r as P,s as F,t as ee,u as I}from"./product-automation-feedback-DYwhL37Y.js";import{t as te}from"./check-DUBLcKHA.js";import{t as L}from"./chevron-down-ccbiQQz_.js";import{n as ne,r as R}from"./popover-select-DD8fmrxH.js";import{t as re}from"./circle-check-C23XjkUj.js";import{t as ie}from"./code-xml-DJtYhZUF.js";import{t as ae}from"./copy-Dv6d4Dvw.js";import{t as oe}from"./download-Dk-ZjtO6.js";import{t as se}from"./ellipsis-0k4rZLoy.js";import{t as ce}from"./external-link-DjqjBmc3.js";import{t as z}from"./eye-CABVeTq0.js";import{t as le}from"./file-text-D12HbeVy.js";import{t as ue}from"./history-DXH_9jsE.js";import{C as de,E as B,F as fe,O as pe,P as V,S as me,T as H,_ as U,a as he,c as ge,d as _e,f as ve,h as ye,l as be,m as xe,n as Se,r as W,s as G,u as Ce,w as K,x as we}from"./notes-api-DocbsBbT.js";import{t as Te}from"./loader-circle-CifKLtgG.js";import{P as Ee}from"./markdown-view-pzSRu7av.js";import{t as De}from"./message-circle-Badhj-4D.js";import{t as Oe}from"./pencil-DmIY3Oa-.js";import{t as ke}from"./play-kxZvpBg8.js";import{t as q}from"./refresh-cw-BRlGaq2w.js";import{t as Ae}from"./search-DA7gz22f.js";import{t as je}from"./sparkles-DHlfQFAF.js";import{t as Me}from"./square-pen-B8FsvqNu.js";import{t as Ne}from"./square-DMK_fB-3.js";import{t as Pe}from"./trash-2-DusmjVPV.js";import{t as Fe}from"./x-B_N4OPjy.js";import{t as J}from"./cn-0WouolD0.js";import{i as Ie}from"./vendor-swr-CdRzEUwF.js";import{t as Y}from"./button-CnRSIP6m.js";import{t as Le}from"./skeleton-BI5TyibZ.js";import{a as Re,i as ze,n as Be,o as X,r as Z,s as Ve,t as He}from"./dist-DfWfZ9iu.js";import{a as Ue,i as We,o as Ge,s as Ke}from"./dist-CaUuvp8-.js";import{t as qe}from"./session-manager-DNMosCtW.js";import{t as Je}from"./copy-to-clipboard-HOJ79TWv.js";import{r as Ye}from"./app-chrome-BeB4KgOf.js";import{i as Xe}from"./theme-store-DOJ9tu-j.js";import{t as Ze}from"./page-header-store-reh1es-3.js";import{t as Qe}from"./sliding-tab-list-DuQyViqe.js";import{t as $e}from"./confirm-dialog-XGclfBqe.js";import{b as et,d as tt,o as nt,s as rt,v as it}from"./shares-api-CztKbxdd.js";import{l as at,m as ot,o as st,r as ct,t as lt,u as ut}from"./dist-D3lWNSe7.js";import{t as dt}from"./automation-api-DtJfd1QM.js";import{t as ft}from"./oauth-provider-connect-GxkF0vWJ.js";import{n as pt,t as mt}from"./page-context-draft-CMRDNv4d.js";import"./note-image-lightbox-BCjvBqwy.js";import{t as ht}from"./page-context-capture-button-CvWLVeRA.js";var Q=e(t(),1),gt=n(),$=r(),_t=6e4,vt=36e5,yt=864e5;function bt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function xt(e,t,n){let r=t-e;if(r<_t)return n.justNow;if(r<vt){let e=Math.floor(r/_t);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=bt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-yt)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*yt){let e=Math.floor(r/yt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function St(e,t,n){let r=bt(t);if(e>=r)return n.today;if(e>=r-yt)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 Ct(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function wt(e){let t=(0,gt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:c}=e,l=c===void 0?`card`:c,u=d(Dt),f=m(u).automations.suggestions,p=m(u).automations,h=s(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=g):g=t[0];let{data:_}=Ie(a?`automation-suggestion-coverage`:null,Et,g),v=a?_?.automations.find(e=>A(e,a)):void 0,y=v?M(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=J(`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`,o),t[1]=o,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(re,{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]===h?r=t[5]:(r=()=>h(`/automations`),t[4]=h,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(Y,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===o?e=t[7]:(e=J(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,o),t[6]=o,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(w,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==h||t[13]!==i?(c=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[12]=h,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Y,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(v){let e;t[16]===o?e=t[17]:(e=J(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,o),t[16]=o,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(re,{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]===h?r=t[20]:(r=()=>h(`/automations`),t[19]=h,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Y,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:P(f.coveredDescription,{name:v.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(Tt)})]}),i]})}let b;t[24]===o?b=t[25]:(b=J(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=b);let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=x):x=t[26];let S;t[27]===n?S=t[28]:(S=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=S);let C;t[29]===r?C=t[30]:(C=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let T;t[31]!==S||t[32]!==C?(T=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})]}),t[31]=S,t[32]=C,t[33]=T):T=t[33];let E;t[34]!==h||t[35]!==i?(E=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});h(`/automations?${e.toString()}`)},t[34]=h,t[35]=i,t[36]=E):E=t[36];let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),t[37]=D):D=t[37];let O;t[38]!==f.create||t[39]!==E?(O=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Y,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:E,children:[D,f.create]})}),t[38]=f.create,t[39]=E,t[40]=O):O=t[40];let k;return t[41]!==O||t[42]!==b||t[43]!==T?(k=(0,$.jsxs)(`section`,{className:b,children:[T,O]}),t[41]=O,t[42]=b,t[43]=T,t[44]=k):k=t[44],k}function Tt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Et(){return dt.list()}function Dt(e){return e.language}function Ot(e){let t=(0,gt.c)(93),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,pageText:c,editing:u,onOrganize:d,onRegenerate:f,onPersonalNotes:p,noteActions:m}=e,[h,g]=(0,Q.useState)(!1),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{g(!1),e()},t[0]=_):_=t[0];let v=_,y=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,b=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,x=a?`更多笔记操作`:`More note actions`,S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(se,{className:`size-5`,"aria-hidden":!0}),t[1]=S):S=t[1];let C;t[2]===x?C=t[3]:(C=(0,$.jsx)(Ke,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":x,className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:S})}),t[2]=x,t[3]=C);let w=a?`笔记工具`:`Note tools`,T;t[4]!==p||t[5]!==a?(T=p?(0,$.jsxs)(Y,{className:`min-h-11 w-full justify-start`,onClick:()=>v(p),children:[(0,$.jsx)(Me,{className:`size-4`}),a?`添加我的补充`:`Add my notes`]}):null,t[4]=p,t[5]=a,t[6]=T):T=t[6];let E;t[7]!==m||t[8]!==a?(E=m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Y,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onAnalyze),children:[(0,$.jsx)(je,{className:`size-4`}),a?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(Y,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onChat),children:[(0,$.jsx)(De,{className:`size-4`}),a?`就这篇笔记提问`:`Ask about this note`]})]}):null,t[7]=m,t[8]=a,t[9]=E):E=t[9];let D=a?`整理笔记`:`Organize notes`,O;t[10]===D?O=t[11]:(O=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:D}),t[10]=D,t[11]=O);let k=a?`纪要模板`:`Summary template`,A;t[12]===i?A=t[13]:(A=e=>i(e.target.value),t[12]=i,t[13]=A);let j=a?`通用会议`:`General`,M;t[14]===j?M=t[15]:(M=(0,$.jsx)(R,{value:`general`,children:j}),t[14]=j,t[15]=M);let N=a?`项目例会`:`Project`,P;t[16]===N?P=t[17]:(P=(0,$.jsx)(R,{value:`project`,children:N}),t[16]=N,t[17]=P);let F=a?`需求评审`:`Review`,ee;t[18]===F?ee=t[19]:(ee=(0,$.jsx)(R,{value:`review`,children:F}),t[18]=F,t[19]=ee);let I=a?`客户访谈`:`Interview`,te;t[20]===I?te=t[21]:(te=(0,$.jsx)(R,{value:`interview`,children:I}),t[20]=I,t[21]=te);let L;t[22]!==k||t[23]!==A||t[24]!==M||t[25]!==P||t[26]!==ee||t[27]!==te||t[28]!==r?(L=(0,$.jsxs)(ne,{value:r,"aria-label":k,onChange:A,children:[M,P,ee,te]}),t[22]=k,t[23]=A,t[24]=M,t[25]=P,t[26]=ee,t[27]=te,t[28]=r,t[29]=L):L=t[29];let re=o||s||!n.discussion.canonicalTranscript,ie;t[30]===d?ie=t[31]:(ie=()=>v(d),t[30]=d,t[31]=ie);let ae;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(q,{className:`size-4`}),t[32]=ae):ae=t[32];let ce=a?`重新整理纪要`:`Regenerate summary`,z;t[33]!==re||t[34]!==ie||t[35]!==ce?(z=(0,$.jsxs)(Y,{className:`min-h-11 w-full justify-start`,disabled:re,onClick:ie,children:[ae,ce]}),t[33]=re,t[34]=ie,t[35]=ce,t[36]=z):z=t[36];let le;t[37]!==b||t[38]!==o||t[39]!==n.discussion.status||t[40]!==f||t[41]!==s||t[42]!==a?(le=b&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsx)(Y,{className:`min-h-11 w-full justify-start`,disabled:o||s,onClick:()=>v(f),children:a?`从原音重新生成`:`Regenerate from audio`}):null,t[37]=b,t[38]=o,t[39]=n.discussion.status,t[40]=f,t[41]=s,t[42]=a,t[43]=le):le=t[43];let ue;t[44]!==L||t[45]!==z||t[46]!==le||t[47]!==O?(ue=(0,$.jsxs)(`div`,{className:`space-y-2 py-3`,children:[O,L,z,le]}),t[44]=L,t[45]=z,t[46]=le,t[47]=O,t[48]=ue):ue=t[48];let de=a?`导出与分享`:`Export and share`,B;t[49]===de?B=t[50]:(B=(0,$.jsx)(`p`,{className:`px-2 text-xs text-fg-muted`,children:de}),t[49]=de,t[50]=B);let fe;t[51]!==b||t[52]!==y||t[53]!==a?(fe=b?(0,$.jsxs)(`a`,{className:`flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/audio`),download:!0,children:[(0,$.jsx)(oe,{className:`size-4`}),a?`下载录音`:`Download recording`]}):null,t[51]=b,t[52]=y,t[53]=a,t[54]=fe):fe=t[54];let pe;t[55]!==m||t[56]!==a?(pe=m?(0,$.jsx)(Y,{className:`min-h-11 w-full justify-start`,disabled:m.busy,onClick:()=>v(m.onShare),children:a?`分享笔记`:`Share note`}):null,t[55]=m,t[56]=a,t[57]=pe):pe=t[57];let V;t[58]===y?V=t[59]:(V=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`md`,`txt`,`srt`].map(e=>(0,$.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,href:l(`${y}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))}),t[58]=y,t[59]=V);let me=n.note.id,H=String(n.note.remoteVersion??1),U;t[60]!==n.note.id||t[61]!==H?(U={kind:`note`,id:me,revision:H},t[60]=n.note.id,t[61]=H,t[62]=U):U=t[62];let he;t[63]===c?he=t[64]:(he={text:c,draft:!1},t[63]=c,t[64]=he);let ge=a?`带到新对话`:`Use in a new chat`,_e=o||s||u||!c||c.length>16e3,ve;t[65]!==U||t[66]!==he||t[67]!==ge||t[68]!==_e?(ve=(0,$.jsx)(ht,{resource:U,selection:he,label:ge,disabled:_e}),t[65]=U,t[66]=he,t[67]=ge,t[68]=_e,t[69]=ve):ve=t[69];let ye=c.length>16e3?a?`内容较长,请先筛选部分原文。`:`Filter the transcript to share a smaller selection.`:a?`分享当前显示的文字,不包含原音。`:`Shares displayed text, without audio.`,be;t[70]===ye?be=t[71]:(be=(0,$.jsx)(`p`,{className:`px-2 text-xs leading-5 text-fg-muted`,children:ye}),t[70]=ye,t[71]=be);let xe;t[72]!==B||t[73]!==fe||t[74]!==pe||t[75]!==V||t[76]!==ve||t[77]!==be?(xe=(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle py-3`,children:[B,fe,pe,V,ve,be]}),t[72]=B,t[73]=fe,t[74]=pe,t[75]=V,t[76]=ve,t[77]=be,t[78]=xe):xe=t[78];let Se;t[79]!==m||t[80]!==a?(Se=m?(0,$.jsxs)(`div`,{className:`space-y-1 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(Y,{className:`min-h-11 w-full justify-start`,onClick:()=>v(m.onHistory),children:a?`版本历史`:`Version history`}),(0,$.jsx)(Y,{className:`min-h-11 w-full justify-start text-danger`,disabled:m.busy,onClick:()=>v(m.onDelete),children:a?`删除笔记`:`Delete note`})]}):null,t[79]=m,t[80]=a,t[81]=Se):Se=t[81];let W;t[82]!==ue||t[83]!==xe||t[84]!==Se||t[85]!==w||t[86]!==T||t[87]!==E?(W=(0,$.jsx)(Ue,{children:(0,$.jsxs)(We,{align:`end`,sideOffset:6,collisionPadding:12,"aria-label":w,className:`z-[140] max-h-[min(38rem,var(--radix-popover-content-available-height,85dvh))] w-[min(20rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 text-fg shadow-elevated`,children:[T,E,ue,xe,Se]})}),t[82]=ue,t[83]=xe,t[84]=Se,t[85]=w,t[86]=T,t[87]=E,t[88]=W):W=t[88];let G;return t[89]!==h||t[90]!==C||t[91]!==W?(G=(0,$.jsxs)(Ge,{open:h,onOpenChange:g,children:[C,W]}),t[89]=h,t[90]=C,t[91]=W,t[92]=G):G=t[92],G}var kt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function At({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[u,d]=(0,Q.useState)(),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(0),[b,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>D(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{C(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++y.current,r=new AbortController;m(!0),v(!1),g(``);let a=window.setTimeout(()=>{f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{y.current===n&&(d(e),x(i),T(t))}).catch(e=>{y.current===n&&!r.signal.aborted&&g(String(e))}).finally(()=>{y.current===n&&m(!1)})},t?200:0);return()=>{y.current++,r.abort(),window.clearTimeout(a)}},[e,t,r,i,E]);async function O(){if(!u||_)return;let r=y.current;v(!0);try{let n=await f(l(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${u.hits.length}&version=${u.version}`));r===y.current&&d({...n,hits:[...u.hits,...n.hits]})}catch(e){r===y.current&&g(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{v(!1)}}function k(e){C(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:u?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let A=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,j=e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>k(e),children:[e.startedAtMs===void 0?``:`${kt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${kt(e.endedAtMs)}`} · `,e.title||A(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[A(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||S?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[kt(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,kt(e.startedAtMs),`–`,kt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(Y,{onClick:()=>k(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[h?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:h}),(0,$.jsx)(Y,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`})]}):null,p&&(!u||b!==i||w!==t)?(0,$.jsx)(Le,{className:`h-20 w-full`}):null,u&&b===i&&(!t||w===t)?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${u.total}`:`Search results · ${u.total}`}),(0,$.jsx)(Y,{onClick:()=>D(e=>e+1),children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:u.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,u.coverage.durationMs))}%`},"aria-label":`${kt(e.startedAtMs)} ${e.title||A(e)}`,onClick:()=>k(e)},e.id))}),u.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),u.hits.map(j)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&u.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,u.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:u.chapters.map(j)})]}):null,u.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),u.hits.map(j)]}):null]}),u.hasMore?(0,$.jsx)(Y,{disabled:_,onClick:()=>void O(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,u.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,kt(u.coverage.processedMs),` / `,kt(u.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,kt(u.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,u.coverage.analysisRanges.length?u.coverage.analysisRanges.map(e=>`${kt(e.startedAtMs)}–${kt(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,u.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,u.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),S?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function jt({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=Ie(`/api/discussions/${t}/annotations`,e=>f(l(e))),[s,c]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await S(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await C(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Q.useEffect)(()=>{_().catch(e=>g(String(e))),v();let e=()=>{_().catch(e=>g(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,v);let t=window.setInterval(()=>{navigator.onLine&&v()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,v),window.clearInterval(t)}},[_,v]);let y=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!y.has(e.annotation.id)){let t=y.get(e.annotation.id);y.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let w=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await x(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,$.jsx)(Y,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(Y,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(Y,{onClick:()=>{d(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),m({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(Y,{onClick:()=>void w({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(Y,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&b(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),p?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(ne,{value:p.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...p,kind:e.target.value}),children:[(0,$.jsx)(R,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(R,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(R,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:p.text,onChange:e=>m({...p,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(Y,{onClick:()=>void w(p,u),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(Y,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Mt={tab:`summary`,query:``,page:1,positionMs:0},Nt=p((e,t)=>({notes:{},update:(n,r)=>{let i={...Ft(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Pt=new Map;function Ft(e,t){if(t)return t;if(Pt.has(e))return Pt.get(e);let n=Mt;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...Mt,...t})}catch{}return Pt.set(e,n),n}function It(e){let t=(0,gt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(Re,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(Ve,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,$.jsx)(Y,{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,$.jsx)(Y,{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,$.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,$.jsxs)(X,{children:[u,(0,$.jsxs)(Z,{"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,$.jsx)(He,{open:!0,onOpenChange:l,children:k}),t[48]=l,t[49]=k,t[50]=A):A=t[50],A}function Lt(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 Rt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function zt({noteId:e,onPersonalNotes:t,noteActions:n}){let r=a(),i=d(e=>e.language)===`zh`,{data:s,mutate:c,isLoading:u}=Ie([`note-discussion-document`,e],()=>_(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),p=s?.discussion.id,m=`/api/discussions/${encodeURIComponent(p??``)}`,{data:h=[],mutate:b}=Ie(p?`${m}/actions`:null,e=>f(l(e)),{refreshInterval:1e4}),S=Nt(t=>Ft(e,t.notes[e])),w=Nt(e=>e.update),E=S.tab,D=t=>w(e,{tab:t}),O=S.query,k=t=>w(e,{query:t}),[A,j]=(0,Q.useState)(!1),M=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{A&&M.current?.focus()},[A]);let[N,P]=(0,Q.useState)(`general`),[F,ee]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(null),[ne,R]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)([]),[se,ce]=(0,Q.useState)(null),[z,le]=(0,Q.useState)(!1),ue=S.page,de=t=>w(e,{page:t}),B=(0,Q.useRef)(null),[fe,pe]=(0,Q.useState)([]),V=(0,Q.useRef)(0),me=(0,Q.useRef)(0),H=(0,Q.useRef)(s?.transcript.revision);H.current=s?.transcript.revision;let U=(0,Q.useRef)(null),he=(0,Q.useRef)(null),[,ge]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{c(),b()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[c,b]),(0,Q.useEffect)(()=>{s?.discussion.template&&P(s.discussion.template)},[s?.discussion.template]);async function _e(e){if(!z){le(!0),ce(null);try{await e(),await c(),await b()}catch(e){ce(e instanceof Error?e.message:String(e))}finally{le(!1)}}}function ve(e,t){U.current&&(B.current=t??null,U.current.readyState===0?(he.current=e/1e3,U.current.load()):(U.current.currentTime=e/1e3,U.current.play().catch(()=>void 0)))}function ye(e){let t=e.stale||e.transcriptRevision!==H.current;ee({...e,stale:t}),t||pe(e.segments.map(e=>e.sequence))}async function be(e,t,n=!1){if(!s)return;let r=V.current,i=++me.current;await _e(async()=>{let a=await f(l(`${m}/evidence?revision=${t??s.organization?.transcriptRevision??s.transcript.revision}&segments=${e.join(`,`)}`));if(!(r!==V.current||i!==me.current)&&(ye(a),n&&a.segments[0]?.playback[0])){let e=a.segments[0].playback[0];ve(e.startedAtMs,e.endedAtMs)}})}async function xe(e){s&&await _e(async()=>{await x(s.discussion.clientRequestId,y({type:`transcript`,capturedAt:Date.now(),transcriptRevision:s.transcript.revision,segmentIds:[e.sequence]})),D(`marks`),C(s.discussion.clientRequestId,s.discussion.id).catch(e=>ce(String(e)))})}(0,Q.useEffect)(()=>(V.current++,ee(null),pe([]),L(null),R(null),oe([]),ce(null),B.current=null,()=>{V.current++}),[e]),(0,Q.useEffect)(()=>{let t=s?.discussion.audioSha256??s?.discussion.audioAttachmentId;if(!t)return;let n=Ft(e,Nt.getState().notes[e]);n.source&&n.source!==t?(V.current++,ee(null),pe([]),U.current?.pause(),w(e,{positionMs:0,source:t}),he.current=0,B.current=null):w(e,{source:t})},[e,s?.discussion.audioSha256,s?.discussion.audioAttachmentId,w]),(0,Q.useEffect)(()=>{s?.discussion.audioDeletedAt&&(U.current?.pause(),he.current=null,B.current=null,ee(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[s?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{S.tab===`transcript`&&S.anchor!==void 0&&S.anchorRevision===s?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${S.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[S.tab,S.anchor,S.anchorRevision,s?.transcript.revision]),(0,Q.useEffect)(()=>{pe([]),ee(e=>e&&e.transcriptRevision!==s?.transcript.revision?{...e,stale:!0}:e)},[s?.transcript.revision]);let Se=(e,t,n)=>t.some(e=>re||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>re||!e.ignored).map(e=>(0,$.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:z,onClick:()=>R({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:i?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:z,className:`shrink-0 text-accent-fg`,onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i?`暂无定位`:`No source timing`})]},e.id))]}):null;if(u)return(0,$.jsx)(Le,{className:`h-48 w-full`});if(!s)return null;let{discussion:W,transcript:G,organization:Ce}=s,K=Ce?.organization,we=[`stopping`,`sealing`,`organizing`].includes(W.status),Te=[`recording`,`completed`,`needs_attention`].includes(W.status),De=G.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(O.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(O.toLocaleLowerCase())),Oe=E===`marks`||O.trim()?``:Lt(s,E,{query:O,page:ue,showIgnored:re});return(0,$.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),j(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 px-5 pb-3 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold leading-snug tracking-tight`,children:!s.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(s.note.title)?i?`语音笔记`:`Voice note`:s.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[i?`录音`:`Recording`,` · `,Rt(W.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":i?`搜索此 Note`:`Search this Note`,"aria-expanded":A||!!O,onClick:()=>{j(e=>!e),A&&k(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ae,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:n,detail:s,template:N,onTemplate:P,zh:i,busy:z,processing:we,pageText:Oe,editing:!!ne||!!I,onPersonalNotes:t,onOrganize:()=>void _e(()=>f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:N})})),onRegenerate:()=>void _e(()=>v(W.id,`from_audio`))})]}),(0,$.jsx)(Qe,{as:`nav`,"aria-label":i?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-1 rounded-xl bg-surface-inset p-1 sm:mx-7`,indicatorClassName:`rounded-lg bg-surface-panel shadow-sm`,children:[`summary`,`transcript`,`marks`].map(e=>(0,$.jsx)(`button`,{"aria-pressed":E===e,className:`min-h-11 min-w-0 flex-1 rounded-lg px-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${E===e?`bg-surface-panel font-medium text-fg shadow-sm`:`text-fg-muted hover:text-fg`}`,onClick:()=>D(e),children:e===`summary`?i?`概览`:`Overview`:e===`marks`?i?`标记`:`Highlights`:i?`原文`:`Transcript`},e))}),se?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:i?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:se})]}):null,A||O?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(Ae,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:M,"aria-label":i?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:i?`搜索这篇笔记`:`Search this note`,value:O,onChange:e=>{k(e.target.value),de(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`关闭搜索`:`Close search`,onClick:()=>{k(``),j(!1)},children:(0,$.jsx)(Fe,{className:`size-4`})})]}):null,(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7`,children:[W.status!==`recording`||s.recordingJob?(0,$.jsx)(g,{context:`note`,input:T(s),zh:i,busy:z,onRetry:e=>void _e(()=>e===`analyze`?f(l(`${m}/organize`),{method:`POST`,body:JSON.stringify({template:N})}):v(W.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{hidden:!!O.trim(),children:E===`marks`?(0,$.jsx)(jt,{recordingId:W.clientRequestId,discussionId:W.id,zh:i,onEvidence:ye,onPlay:e=>ve(e.startedAtMs,e.endedAtMs)},W.id):E===`summary`?K?(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`摘要`:`Summary`}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":i?`编辑概要`:`Edit overview`,title:i?`编辑概要`:`Edit overview`,disabled:z||we,onClick:()=>R({kind:`summary`,itemId:`summary`,text:K.summary}),children:(0,$.jsx)(Me,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:K.summary}),K.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`已由你编辑`:`Edited by you`}):null,K.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(K.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(Y,{onClick:()=>void be(K.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[i?`查看原话`:`View source`,K.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,K.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:i?`重点结论`:`Key points`}),K.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(Y,{onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`原话`:`Source`})]},e.id))]}):K.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:i?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:K.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...K.decisions,...K.actionItems,...K.risks,...K.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:re,onChange:e=>ie(e.target.checked)}),i?`显示已忽略项`:`Show ignored items`]}):null,ae.length?(0,$.jsx)(Y,{disabled:z,onClick:()=>void _e(async()=>{for(let e of ae)await f(l(`${m}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Ce.revision})});oe([])}),children:i?`加入所选 ${ae.length} 项任务`:`Add ${ae.length} selected tasks`}):null,Se(i?`已决定事项`:`Decisions`,K.decisions,`decisions`),K.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`下一步行动`:`Next actions`}),K.actionItems.filter(e=>re||!e.ignored).map(e=>{let t=h.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${i?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:ae.includes(e.id),onChange:t=>oe(t.target.checked?[...ae,e.id]:ae.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:i?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:z||we,onClick:()=>R({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:i?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(i?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(i?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:z,className:`text-accent-fg`,onClick:()=>void be(e.evidenceSegmentIds,e.evidenceRevision),children:i?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:i?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(o,{className:`text-accent-fg`,to:Ee(`${r.pathname}${r.search}`,t.taskId),children:t.resolution===`done`?i?`已完成 · 查看任务`:`Done · View task`:i?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(Y,{disabled:z||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void _e(()=>f(l(`${m}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Ce.revision})})),children:i?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Se(i?`风险`:`Risks`,K.risks,`risks`),Se(i?`尚未确定`:`Open questions`,K.openQuestions,`openQuestions`),K.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:i?`前后变更`:`Changes during the meeting`}),K.changes.map(e=>{let t=[...K.decisions,...K.actionItems,...K.risks,...K.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?i?`后续撤销或替代`:`Later superseded`:i?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void be(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void be(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4 py-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:G.text?i?`录音摘录`:`From your recording`:i?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${G.text?`text-fg`:`text-fg-muted`}`,children:G.text?G.text.slice(0,400)+(G.text.length>400?`…`:``):i?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),G.text?(0,$.jsx)(Y,{className:`min-h-11`,onClick:()=>D(`transcript`),children:i?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[De.slice(0,ue*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${fe.includes(e.sequence)||S.anchor===e.sequence&&S.anchorRevision===G.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!W.audioAttachmentId||!!W.audioDeletedAt,onClick:()=>void be([e.sequence],G.revision,!0),children:[(0,$.jsx)(ke,{className:`size-3`}),Rt(e.startedAtMs)]}),e.status===`confirmed`?(0,$.jsx)(`button`,{onClick:()=>void xe(e),children:i?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(i?`未区分说话人`:`Speaker unknown`)}),Te&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>L({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:i?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(i?`等待转写`:`Awaiting transcription`)})]},e.sequence)),De.length>ue*50?(0,$.jsx)(Y,{onClick:()=>de(ue+1),children:i?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{children:(0,$.jsx)(At,{id:W.id,query:O.trim(),zh:i,sourceKey:`${W.audioSha256}:${W.audioDeletedAt}`,active:we||W.status===`recording`,tab:E,refreshKey:`${W.updatedAt}:${G.revision}:${Ce?.revision}`,onEvidence:ye,onPlay:ve},W.id)})]}),W.audioAttachmentId&&!W.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:U,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:l(`${m}/audio`),onTimeUpdate:()=>{let t=(U.current?.currentTime??0)*1e3;ge(t),w(e,{positionMs:t}),B.current!==null&&t>=B.current&&(U.current?.pause(),B.current=null)},onLoadedMetadata:()=>{he.current!==null&&U.current?(U.current.currentTime=he.current,he.current=null,U.current.play().catch(()=>void 0)):U.current&&(U.current.currentTime=S.positionMs/1e3)},onError:()=>ce(i?`录音暂不可播放`:`Recording unavailable`)})}):null,F?(0,$.jsxs)(`aside`,{"aria-label":i?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[i?`原话证据`:`Source evidence`,` · v`,F.transcriptRevision]}),(0,$.jsx)(`button`,{"aria-label":i?`关闭`:`Close`,onClick:()=>ee(null),children:(0,$.jsx)(Fe,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),F.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!F.audioAvailable||!F.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,F.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Rt(t.startedAtMs),`–`,Rt(t.endedAtMs),` · `,t.speakerLabel??(i?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(Y,{onClick:()=>ve(e.startedAtMs,e.endedAtMs),children:[i?`播放原话`:`Play source`,` `,Rt(e.startedAtMs),`–`,Rt(e.endedAtMs)]},t)),F.stale?null:(0,$.jsx)(Y,{onClick:()=>{k(``),de(Math.max(ue,Math.ceil((G.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),D(`transcript`),pe([t.sequence]),ee(null),w(e,{anchor:t.sequence,anchorRevision:G.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:i?`定位原文`:`Locate transcript`})]},t.sequence))]})]}):null,ne&&Ce?(0,$.jsx)(It,{initial:ne,zh:i,busy:z,onClose:()=>R(null),onSave:e=>_e(async()=>{await f(l(`${m}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:Ce.revision})}),R(null)})},`${ne.kind}:${ne.itemId}:${Ce.revision}`):null,I?(0,$.jsx)(He,{open:!0,onOpenChange:e=>{e||L(null)},children:(0,$.jsxs)(X,{children:[(0,$.jsx)(Re,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(Z,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(Ve,{children:i?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":i?`关闭校对`:`Close editor`,onClick:()=>L(null),children:(0,$.jsx)(Fe,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[i?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:I.speaker,onChange:e=>L({...I,speaker:e.target.value})})]}),I.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!I.applyToSpeakerGroup,onChange:e=>L({...I,applyToSpeakerGroup:e.target.checked})}),i?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:I.text,onChange:e=>L({...I,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(Y,{variant:`primary`,disabled:z||!I.text.trim(),onClick:()=>void _e(async()=>{await f(l(`${m}/segments/${I.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:I.text,speakerLabel:I.speaker,expectedRevision:I.segment.revision,applyToSpeakerGroup:I.applyToSpeakerGroup,expectedTranscriptRevision:G.revision})}),L(null)}),children:[(0,$.jsx)(te,{className:`size-4`}),i?`保存修订`:`Save revision`]})})]})]})}):null]})}var Bt={edit:Oe,ai_edit:je,sync:q,restore:h};function Vt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Ht({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(e=>e.language),o=m(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:c(a)},{data:l}=Ie(e?[`note-history`,e]:null,()=>ve(e)),[u,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{f(!0),_(null);try{await H(e,t),h(null),i()}catch{_(o.restoreFailed)}finally{f(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(Fe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,l?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>{let r=Bt[e.trigger]??Oe,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:J(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Vt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:xt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:u,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:u?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Ut({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:c,onOpenNewChat:l}){let u=m(d(e=>e.language)).notes,f=s(),p=t?.aiDeep?.catalysis,h=p?.report??null,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:S}=Ie(e?[`note-agent-context-status`,e]:null,()=>be(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>we(e),{revalidate:!1})}catch(e){_(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await me(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(je,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(E,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||v,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:v?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:J(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),g?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:h?u.recatalyze:u.catalyzeAction}),h?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:J(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:J(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:o,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:o?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:o,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var Wt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Gt({open:e,onOpenChange:t,note:n}){let r=d(e=>e.language)===`zh`,i=r?Yt:Xt,{data:a,mutate:o}=Ie(e?[`note-shares`,n.id]:null,()=>xe(n.id)),s=Ie(e?`hosted-share-auth-status`:null,tt),c=s.data===!0,l=Ie(e&&c?`hosted-publication-capabilities`:null,rt),u=l.data?.publishing.allowed===!0,f=Ie(e&&c?[`hosted-note-publications`,n.id]:null,()=>_e(n.id)),[p,m]=(0,Q.useState)(new Set),[h,g]=(0,Q.useState)(`86400000`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`hosted`),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(m(new Set(P.map(e=>e.id))),O(null),j(!1),N(null))},[e,P]);let F=async()=>{w(!0),N(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...p],ttlMs:Number(h),maxViews:_.trim()?Number(_):null,description:y.trim()||void 0};if(x===`hosted`){let t=await W(n.id,e);O(t.shareUrl),await f.mutate()}else{let t=await he(n.id,e);O(t.payload.shareUrl),await o()}}catch(e){N(e instanceof Error?e.message:String(e))}finally{w(!1)}},ee=async(e,t)=>{E(e.id),N(null);try{t===`refresh`?await de(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await it(e.id),await f.mutate()}catch(e){N(e instanceof Error?e.message:String(e))}finally{E(null)}},I=async(e,t)=>{E(e.id),N(null);try{t===`refresh`?await K(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await nt(e.id,864e5):await et(e.id),await o()}catch(e){N(e instanceof Error?e.message:String(e))}finally{E(null)}},L=async e=>{N(null);try{if(!await Je(e)){j(!1),N(i.copyFailed);return}j(!0),window.setTimeout(()=>j(!1),1500)}catch{j(!1),N(i.copyFailed)}};return(0,$.jsx)(He,{open:e,onOpenChange:t,children:(0,$.jsxs)(X,{children:[(0,$.jsx)(Re,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(Z,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Ve,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(k,{className:`size-4`}),i.title]}),(0,$.jsx)(ze,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(Be,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(Fe,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),P.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:P.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Jt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(ne,{value:x,onChange:e=>S(e.target.value),children:[(0,$.jsx)(R,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(R,{value:`local`,children:i.deliveryLocal})]})]}),x===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(ft,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,x===`hosted`&&c&&l.data&&!u?(0,$.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(ne,{value:h,onChange:e=>g(e.target.value),children:Wt.map(e=>(0,$.jsx)(R,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:_,onChange:e=>v(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:y,onChange:e=>b(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`})]})]}),D?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:D,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(Y,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void L(D),children:[A?(0,$.jsx)(te,{className:`size-4`}):(0,$.jsx)(ae,{className:`size-4`}),A?i.copied:i.copy]}),(0,$.jsxs)(Y,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(D,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(ce,{className:`size-4`}),i.open]})]})}):null,M?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:M}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(qt,{share:e,busy:T===e.id,t:i,onCopy:L,onAction:I},e.id))})]}):null,(f.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:f.data.map(e=>(0,$.jsx)(Kt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:T===e.id,publishingAllowed:u,t:i,onCopy:L,onAction:ee},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(Be,{asChild:!0,children:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(Y,{type:`button`,onClick:()=>void F(),disabled:C||x===`hosted`&&(!c||!u),children:[C?(0,$.jsx)(Te,{className:`size-4 animate-spin`}):(0,$.jsx)(k,{className:`size-4`}),C?i.creating:i.create]})]})]})]})})}function Kt(e){let t=(0,gt.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=J(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=v):v=t[12];let y;t[13]!==p||t[14]!==g||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,v]}),t[13]=p,t[14]=g,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.shareUrl?b=t[18]:(b=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i?S=t[23]:(S=i?(0,$.jsx)(Te,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=S);let C;t[24]!==x||t[25]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26];let w=!a,T;t[27]!==s||t[28]!==n.shareUrl?(T=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(ae,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:w,onClick:T,children:[E,o.copy]}),t[31]=o.copy,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O=!a,k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(ce,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.open]}),t[38]=o.open,t[39]=O,t[40]=k,t[41]=j):j=t[41];let M;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(M=r&&!l?(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(q,{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]=M):M=t[49];let N;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(N=n.revoked?null:(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(Pe,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=N):N=t[54];let P;t[55]!==D||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,j,M,N]}),t[55]=D,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59];let F;return t[60]!==C||t[61]!==d||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function qt(e){let t=(0,gt.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=J(`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,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,_]}),t[14]=_,t[15]=d,t[16]=m,t[17]=v):v=t[17];let y;t[18]===n.shareUrl?y=t[19]:(y=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=y);let b;t[20]!==v||t[21]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===r?x=t[24]:(x=r?(0,$.jsx)(Te,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=x);let S;t[25]!==b||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==a||t[29]!==n.shareUrl?(C=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=C):C=t[30];let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ae,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:C,children:[w,i.copy]}),t[32]=i.copy,t[33]=C,t[34]=T):T=t[34];let E;t[35]===n.shareUrl?E=t[36]:(E=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=E);let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(ce,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.open]}),t[38]=i.open,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(k=n.stale&&!s?(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(q,{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]=k):k=t[46];let A;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(A=s?null:(0,$.jsx)(Y,{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]=A):A=t[52];let j;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(j=n.revoked?null:(0,$.jsxs)(Y,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(Pe,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=j):j=t[57];let M;t[58]!==T||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[T,O,k,A,j]}),t[58]=T,t[59]=O,t[60]=k,t[61]=A,t[62]=j,t[63]=M):M=t[63];let N;return t[64]!==S||t[65]!==l||t[66]!==M?(N=(0,$.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function Jt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Yt={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:`撤销`},Xt={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 Zt(e){let t=(0,gt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 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=N(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=N(u),f=N(Qt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(D,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,$.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Qt(e){return e.stop}function $t(e,t){let n=F(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=F(e);return!r||n.split(`
3
+ `)[0]===r?n:[r,n].filter(Boolean).join(`
4
+
5
+ `)}var en=()=>i(()=>import(`./block-editor-B0v8KxsO.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])),tn=()=>i(()=>import(`./markdown-editor-BuuGlcfG.js`),__vite__mapDeps([45,1,2,41,46,13])),nn=(0,Q.lazy)(()=>en().then(e=>({default:e.BlockEditor}))),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.MarkdownEditor})));function an(){let e=(0,gt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function on(e){let t=(0,gt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:le},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ie},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:z},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,p=sn,m;t[13]===f?m=t[14]:(m=(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=m);let h;t[15]===d.label?h=t[16]:(h=(0,$.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(L,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=g):g=t[17];let _;t[18]!==d.label||t[19]!==m||t[20]!==h?(_=(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":d.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:[m,h,g]})}),t[18]=d.label,t[19]=m,t[20]=h,t[21]=_):_=t[21];let v;t[22]!==n||t[23]!==l||t[24]!==r?(v=(0,$.jsx)(st,{children:(0,$.jsx)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(ct,{onSelect:()=>r(t),onPointerMove:()=>p(t),onFocus:()=>p(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,$.jsxs)(at,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function sn(e){e===`wysiwyg`&&en(),e===`source`&&tn()}function cn(e){let t=(0,gt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:f}=e,p=a===void 0||a,h=s===void 0||s,g=l!==void 0&&l,_=d(ln),v;t[0]===_?v=t[1]:(v=m(_),t[0]=_,t[1]=v);let y=v.notes.lightboxClose,b;t[2]!==g||t[3]!==o||t[4]!==h||t[5]!==u||t[6]!==n||t[7]!==f||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==p?(b=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:h,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:f}),t[2]=g,t[3]=o,t[4]=h,t[5]=u,t[6]=n,t[7]=f,t[8]=r,t[9]=c,t[10]=i,t[11]=p,t[12]=b):b=t[12];let x;return t[13]!==y||t[14]!==b?(x=(0,$.jsx)(V,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:f}){let p=d(e=>e.language),h=m(p).notes,g=m(p).chat.pageContext,v=m(p).automations.suggestions,{data:y}=Ie([`note-discussion-document`,e],()=>_(e)),[b,x]=(0,Q.useState)(!0),S=s(),C=Xe(e=>e.resolved)===`dark`,{openImage:w}=fe(),[T,D]=(0,Q.useState)(l),[A,j]=(0,Q.useState)(null),[M,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),[L,ne]=(0,Q.useState)(``),[R,re]=(0,Q.useState)(360),[ie,ae]=(0,Q.useState)(!1),[oe,ce]=(0,Q.useState)(!1),[z,de]=(0,Q.useState)(!1),V=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{V.current+=1},[e]);let[me,H]=(0,Q.useState)(null),[he,_e]=(0,Q.useState)(!1),[ve,be]=(0,Q.useState)(null),[xe,W]=(0,Q.useState)(!1),[K,we]=(0,Q.useState)(!1),Te=(0,Q.useRef)(!1),Ee=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),q=(0,Q.useRef)(null),Me=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),Fe=(0,Q.useRef)(null),Y=(0,Q.useRef)(null),Le=(0,Q.useRef)(null),Re=(0,Q.useRef)(null),ze=Ze(e=>e.setPageHeader),Be=Ze(e=>e.clearPageHeader),{data:X,mutate:Z,error:Ve}=Ie(e?[`note-detail`,e]:null,()=>ge(e)),{data:He=[],mutate:Ue}=Ie(e?[`note-threads`,e]:null,()=>ye(e),{revalidateOnFocus:!1}),We=M!==null,Ge=(0,Q.useCallback)(e=>{H(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)},[h.quickCaptureFailedHint,h.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Z().catch(Ge)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Z,e,Ge]),(0,Q.useEffect)(()=>{Te.current=!1,ne(``),P(null),j(null),Ee.current=!1,Re.current=null},[e]),(0,Q.useEffect)(()=>{!X||Te.current||(ne(X.title??``),Te.current=!0)},[X]),(0,Q.useEffect)(()=>{if(!c||!X||We||Re.current===e)return;let t=window.requestAnimationFrame(()=>{Le.current?.focus(),f?.()});return Re.current=e,()=>window.cancelAnimationFrame(t)},[c,We,X,e,f]);let Ke=X?new Date(X.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Je=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:J(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ye,i),children:(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Qe=(0,Q.useCallback)(()=>{let t=N.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),et=(0,Q.useCallback)(e=>{e!==`preview`&&Qe(),D(e)},[Qe]),tt=(0,Q.useCallback)(t=>{Qe(),ne(t),e&&(Me.current=t,ke.current&&clearTimeout(ke.current),ke.current=setTimeout(async()=>{let t=Me.current;if(Me.current=null,t!==null){I(!0);try{await B(e,{title:t}),await Z(),n?.()}catch{}finally{I(!1)}}},600))},[Qe,e,Z,n]),nt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:J(`flex min-w-0 items-center gap-2`,Ye),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:L||Ke||void 0,children:L||Ke}),F?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,F,Ke,L]),rt=(0,Q.useCallback)(async(t=!1)=>{de(!0),H(null);try{let n=await U(e,{forceNew:t});await Z(),await Ue(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){H(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{de(!1)}},[Z,Ue,S,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),it=(0,Q.useCallback)(async()=>{ce(!0),H(null);try{await Se(e),await Z()}catch(e){H(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{ce(!1)}},[Z,e]),dt=(0,Q.useCallback)(()=>{j(A===`breakdown`?null:`breakdown`),!X?.aiDeep?.catalysis?.report&&!oe&&it()},[A,oe,it,X?.aiDeep?.catalysis?.report]),ft=(0,Q.useCallback)(()=>{let t=M?M.markdown??``:q.current??X?.markdown??``,n=M?M.title??``:L,r=$t(n,t);return{source:{type:`note`,id:e,title:n||h.titlePlaceholder},text:r,language:O(r,p)}},[p,h.titlePlaceholder,X?.markdown,e,M,L]),ht=(0,Q.useCallback)(async()=>{Oe.current&&clearTimeout(Oe.current),ke.current&&clearTimeout(ke.current),Oe.current=null,ke.current=null;let t=q.current,r=Me.current;q.current=null,Me.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return X??null;I(!0);try{let t=await B(e,i);return await Z(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),Me.current===null&&(Me.current=r),H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`),null}finally{I(!1)}},[Z,h.saveFailed,h.saveFailedHint,X,e,n]),gt=(0,Q.useCallback)(async()=>{if(!X||z||F)return;de(!0),H(null);let e=u.getState(),t=++V.current,n=()=>V.current===t&&u.getState().baseUrl===e.baseUrl&&u.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Ne.current?.contains(t.anchorNode)&&Ne.current.contains(t.focusNode)?t.toString():``,i=await ht();if(!i||!n())return;if(q.current!==null||Me.current!==null)throw Error(g.unavailable);let a=pt.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 qe().createSession();if(!n())return;if(q.current!==null||Me.current!==null)throw Error(g.unavailable);let s=mt(e.baseUrl,e.conversationId,o.key);if(!pt.put(s,a))throw Error(g.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&H(g.unavailable)}finally{V.current===t&&de(!1)}},[X,z,F,ht,S,g.unavailable]),_t=(0,Q.useCallback)(async()=>{H(null);let e=await ht();e&&(be(e),_e(!0))},[ht]),vt=(0,Q.useCallback)(async()=>{if(!(K||F)){W(!1),we(!0),H(null),Qe(),Oe.current&&clearTimeout(Oe.current),ke.current&&clearTimeout(ke.current),Oe.current=null,ke.current=null,q.current=null,Me.current=null;try{await G(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){H(`${h.deleteFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}finally{we(!1)}}},[K,h.deleteFailed,h.quickCaptureFailedHint,e,t,n,F,Qe]),yt=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:J(`flex min-w-0 items-center gap-1 sm:gap-2`,Ye),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":h.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Zt,{input:ft,showLabel:!1,labels:{read:h.readAloud,preparing:h.readAloudPreparing,pause:h.readAloudPause,resume:h.readAloudResume,retry:h.readAloudRetry,stop:h.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:dt,disabled:oe,"aria-label":h.catalysisSectionTitle,className:J(`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,$.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:oe?h.catalyzing:h.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>rt(!1),"aria-label":h.openChatButton,disabled:z,className:J(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:z?h.openingChat:h.openChatButton})]}),(0,$.jsx)(on,{mode:T,onModeChange:et,labels:{edit:h.modeEdit,source:h.modeSource,preview:h.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void gt(),disabled:z||F||!X||!!M,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,$.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(at,{modal:!1,children:[(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":h.noteActions,title:h.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(se,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(ct,{onSelect:()=>void _t(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(k,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(ct,{onSelect:()=>j(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,$.jsx)(ue,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:h.history}),A===`history`?(0,$.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{disabled:K||F,onSelect:()=>W(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),h.delete]})]})})]})]}),[oe,dt,rt,gt,g.capture,X,M,T,h.history,h.modeEdit,h.modePreview,h.modeSource,z,A,o,h.searchDialogTitle,h.readAloud,h.readAloudPause,h.readAloudPreparing,h.readAloudResume,h.readAloudRetry,h.readAloudStop,et,ft,_t,K,F,p,h.delete,W]);(0,Q.useLayoutEffect)(()=>(ze({startExtra:Je,main:X&&!(y&&b)?nt:null,end:X&&!(y&&b)?yt:null}),()=>{a&&Be()}),[a,Be,yt,nt,Je,y,b,X,ze]);let bt=(0,Q.useCallback)(t=>{e&&(Qe(),q.current=t,Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){I(!0),H(null);try{await B(e,{markdown:t}),await Z(),n?.()}catch(e){H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`)}finally{I(!1)}}},600))},[Qe,e,Z,h.saveFailed,h.saveFailedHint,n]),xt=(0,Q.useCallback)(t=>{Ce(e,t.timestamp).then(e=>{e&&(Qe(),P(e))})},[e,Qe]),St=(0,Q.useCallback)(()=>{Qe(),j(null),P(null)},[Qe]),Ct=(0,Q.useCallback)(()=>{Qe(),j(null),P(null),Z().catch(Ge),n?.()},[Z,n,Ge,Qe]);if((0,Q.useEffect)(()=>()=>{Oe.current&&clearTimeout(Oe.current),ke.current&&clearTimeout(ke.current);let t=q.current,n=Me.current;q.current=null,Me.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&B(e,r).catch(()=>void 0)},[e]),X===void 0)return Ve?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:h.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Z().catch(Ge),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:h.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:h.back})]}):(0,$.jsx)(an,{});if(X===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:h.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:h.back})]});let Tt=We?M.title??``:L,Et=We?M.markdown??``:q.current??X.markdown??``,Dt=new Date(X.createdAt).getTime(),Ot=Number.isFinite(Dt)&&Date.now()-Dt<3600*1e3?(0,$.jsx)(wt,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[me?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:me}):null,(0,$.jsx)(ee,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ee,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),y&&!b?(0,$.jsx)(`button`,{className:`mb-2 inline-flex min-h-11 shrink-0 items-center self-start rounded-lg px-2 text-sm text-accent-fg focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>x(!0),children:p===`zh`?`← 返回录音笔记`:`← Back to recording`}):null,(0,$.jsxs)(`div`,{ref:Ne,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[y&&b?(0,$.jsx)(zt,{noteId:e,noteActions:{onAnalyze:dt,onChat:()=>{rt(!1)},onShare:()=>{_t()},onHistory:()=>j(A===`history`?null:`history`),onDelete:()=>W(!0),busy:K||F||oe||z},onPersonalNotes:()=>{x(!1),window.setTimeout(()=>Le.current?.focus(),0)}}):null,(0,$.jsx)(`div`,{className:y&&b?`hidden`:`min-h-0 min-w-0 flex-1`,children:We?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Tt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Tt}),Et?(0,$.jsx)(pe,{noteId:e,content:Et,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[T===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Le,type:`text`,value:L,onChange:e=>tt(e.target.value),onCompositionStart:()=>{Ee.current=!0},onCompositionEnd:()=>{Ee.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ee.current&&!t.isComposing&&(e.preventDefault(),(Ne.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(nn,{initialContent:X.markdown??``,onChange:bt,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:Le,type:`text`,value:L,onChange:e=>tt(e.target.value),placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ot]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(an,{}),children:(0,$.jsx)(rn,{initialContent:X.markdown??``,onChange:bt,isDark:C},`source-${e}`)})})]}),T===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&w(t.currentSrc||t.src,t.alt)},children:[L&&!X.markdown.trimStart().startsWith(`# ${L.trim()}\n`)&&X.markdown.trim()!==`# ${L.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:L}),X.markdown?(0,$.jsx)(pe,{noteId:e,content:X.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:Fe,className:J(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ie&&`transition-[width] duration-300 ease-in-out`),style:{width:A?R:0},children:(0,$.jsxs)(`div`,{ref:Y,className:`flex min-h-0 flex-1 flex-col`,style:{width:R},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ae(!0);let n=e.clientX,r=R,i=e.pointerId,a=0,o=R,s=R,c=()=>{a=0,s=o,A&&Fe.current?.style.setProperty(`width`,`${s}px`),Y.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}ae(!1),re(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:J(`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`,ie&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,$.jsx)(Ht,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:xt,onClose:St,onRestored:Ct}):A===`breakdown`?(0,$.jsx)(Ut,{noteId:e,note:X??null,catalyzing:oe,onCatalyze:it,onClose:()=>j(null),noteThreads:He,openingChat:z,onOpenChat:()=>rt(!1),onOpenNewChat:()=>rt(!0)}):null})]})})]}),ve?(0,$.jsx)(Gt,{open:he,onOpenChange:_e,note:ve}):null,(0,$.jsx)($e,{open:xe,title:h.deleteConfirmTitle,description:h.deleteConfirmDescription.replace(`{{title}}`,X.title||h.titlePlaceholder),confirmLabel:h.deleteConfirmLabel,cancelLabel:h.deleteCancelLabel,destructive:!0,onConfirm:()=>void vt(),onCancel:()=>W(!1)})]})}export{xt as i,Ct as n,St as r,cn as t};
@@ -0,0 +1 @@
1
+ import"./notes-api-DocbsBbT.js";
@@ -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-CJt-i2Dp.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./cn-0WouolD0.js";import{a as c,i as l,l as u,o as d,p as f}from"./locale-store-lIXD1FMw.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DfWfZ9iu.js";import{r as y,t as b}from"./chat-chart-block-K2t333qv.js";var x=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`}]]),S=n(),C=e(t(),1),w=r(),T=(0,C.createContext)(null);function E(){let e=(0,S.c)(1),t=(0,C.useContext)(T);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:D},e[0]=t):t=e[0],t}return t}function D(){}function O(e){let t=(0,S.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,c]=(0,C.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{c({src:e,alt:t})},t[0]=l):l=t[0];let u=l,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d={openImage:u},t[1]=d):d=t[1];let f=d,y=a!==null,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||c(null)},t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(p,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=x):x=t[3];let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=s(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=E):E=t[4];let D=a?.alt||`Image preview`,O;t[5]===D?O=t[6]:(O=(0,w.jsx)(_,{className:`sr-only`,children:D}),t[5]=D,t[6]=O);let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,w.jsx)(o,{className:`size-5`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===i?A=t[9]:(A=(0,w.jsx)(m,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:k})}),t[8]=i,t[9]=A);let j;t[10]===a?j=t[11]:(j=a?(0,w.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=j);let M;t[12]!==A||t[13]!==j||t[14]!==O?(M=(0,w.jsxs)(h,{children:[x,(0,w.jsxs)(g,{className:E,"aria-describedby":void 0,children:[O,A,j]})]}),t[12]=A,t[13]=j,t[14]=O,t[15]=M):M=t[15];let N;t[16]!==M||t[17]!==y?(N=(0,w.jsx)(v,{open:y,onOpenChange:b,children:M}),t[16]=M,t[17]=y,t[18]=N):N=t[18];let P;return t[19]!==n||t[20]!==N?(P=(0,w.jsxs)(T.Provider,{value:f,children:[n,N]}),t[19]=n,t[20]=N,t[21]=P):P=t[21],P}var k=`xopc-attachment`,A=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,j=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function M(e,t){return`${k}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function N(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(A),a=r.match(j),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 P(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var F=new Map,I=``;function L(e,t,n){return`${n}:${e}:${t}`}function R(){let e=u.getState().conversationId??``;if(e!==I){for(let e of F.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);F.clear(),I=e}}async function ee(e,t){R();let n=L(e,t,u.getState().conversationId??``),r=F.get(n);return r||(r={blob:(async()=>{let n=await c(l(P(e,t)));if(n.status===401&&u.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},F.set(n,r)),r.blob}async function z(e,t){R();let n=L(e,t,u.getState().conversationId??``),r=F.get(n);if(r||(r={blob:ee(e,t),objectUrl:null,refCount:0},F.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function B(e,t){R();let n=L(e,t,u.getState().conversationId??``),r=F.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,F.delete(n)))}var V={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},H=null,U=null,W=null,G=null;function K(){return H||(H=new Audio,H.addEventListener(`timeupdate`,()=>{J.setState({currentTime:H.currentTime})}),H.addEventListener(`loadedmetadata`,()=>{let e=H.duration;Number.isFinite(e)&&J.setState({duration:e})}),H.addEventListener(`ended`,()=>{J.setState({playing:!1,currentTime:0}),H.currentTime=0}),H.addEventListener(`pause`,()=>{J.setState({playing:!1})}),H.addEventListener(`play`,()=>{J.setState({playing:!0})})),H}function q(){W&&G&&B(W,G),U=null,W=null,G=null}var J=f()((e,t)=>({...V,play:async(n,r,i)=>{let a=K(),o=t();if(o.noteId===n&&o.attachmentId===r&&U){a.play();return}a.pause(),q(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await z(n,r);U=t,W=n,G=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),q()}},pause:()=>{K().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=K();n.currentTime=t,e({currentTime:t})},reset:()=>{K().pause(),K().src=``,q(),e(V)}}));function Y(e,t){return M(e,t)}function te(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 ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function X(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&&u.getState().onUnauthorized(),!i.ok)throw Error(await ne(i));return i.json()}function re(e){let t=(0,S.c)(39),n,r,i,a,o,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l);let u=l===void 0?``:l,d;t[8]!==r||t[9]!==c?(d=N(c,r),t[8]=r,t[9]=c,t[10]=d):d=t[10];let f=d,[p,m]=(0,C.useState)(f?null:c),[h,g]=(0,C.useState)(!1),_,v;if(t[11]!==a||t[12]!==f||t[13]!==c?(_=()=>{if(g(!1),!f){m(c);return}let e=!1;return m(null),z(f.noteId,f.attachmentId).then(t=>{e||m(t)}).catch(()=>{e||(g(!0),a?.())}),()=>{e=!0,B(f.noteId,f.attachmentId)}},v=[c,f,a],t[11]=a,t[12]=f,t[13]=c,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,C.useEffect)(_,v),h){let e;t[16]===n?e=t[17]:(e=s(`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,w.jsx)(x,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,w.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!p){let e;t[22]===n?e=t[23]:(e=s(`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,w.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let y;t[27]!==p||t[28]!==i?(y=i?()=>i(p):void 0,t[27]=p,t[28]=i,t[29]=y):y=t[29];let b;t[30]===a?b=t[31]:(b=()=>{g(!0),a?.()},t[30]=a,t[31]=b);let T;return t[32]!==u||t[33]!==n||t[34]!==p||t[35]!==o||t[36]!==y||t[37]!==b?(T=(0,w.jsx)(`img`,{...o,src:p,alt:u,className:n,onClick:y,onError:b}),t[32]=u,t[33]=n,t[34]=p,t[35]=o,t[36]=y,t[37]=b,t[38]=T):T=t[38],T}function ie(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ae(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=N(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;z(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,B(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=N(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;z(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,B(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function oe(e){let t=(0,S.c)(21),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,C.useRef)(null),s;t[4]!==i.codeCopy||t[5]!==i.streaming?(s=e=>(0,w.jsx)(b,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=s):s=t[6];let c=s,l;t[7]===r?l=t[8]:(l=()=>{let e=o.current;if(e)return ae(e,r)},t[7]=r,t[8]=l);let u;t[9]!==n||t[10]!==r?(u=[n,r],t[9]=n,t[10]=r,t[11]=u):u=t[11],(0,C.useLayoutEffect)(l,u);let d;t[12]===n?d=t[13]:(d=ie(n),t[12]=n,t[13]=d);let f;t[14]===i.className?f=t[15]:(f=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=f);let p=f.join(` `),m;return t[16]!==c||t[17]!==i||t[18]!==d||t[19]!==p?(m=(0,w.jsx)(`div`,{ref:o,children:(0,w.jsx)(y,{children:(0,w.jsx)(a,{content:d,mermaidActions:!0,...i,renderChart:c,className:p})})}),t[16]=c,t[17]=i,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}async function se(){return d(l(`/api/notes/project-summaries`))}async function ce(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 d(l(`/api/notes${n?`?${n}`:``}`))}async function le(e,t=`web`){return(await d(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function ue(e,t){return(await d(l(`/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 de(e){let t=await c(l(`/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 d(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function fe(e){await d(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function pe(e){return d(l(`/api/notes/${encodeURIComponent(e)}/shares`))}async function me(e,t){return d(l(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function he(e,t,n){await d(l(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function ge(e){return(await d(l(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function _e(e,t){return(await d(l(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function ve(e,t,n){return(await d(l(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ye(e){return d(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function be(e,t){return(await d(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function xe(e,t={}){return d(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function Se(e){return(await d(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Ce(e){return d(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function we(e){return d(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Te(e,t,n){return(await d(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Q(e,t={}){return(await d(l(`/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 Ee(e,t,n){let r=new FormData;return r.append(`file`,t),(await X(l(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(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 X(l(`/api/notes`),n)).note}async function De(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${Y(n.id,r.id)})`;return n.markdown!==i&&(n=await Z(n.id,{markdown:i})),n}async function Oe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${te(t)}](${Y(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function ke(e){return(await d(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ae(e,t){return(await d(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function je(e,t){return(await d(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{Y as A,ve as C,Ee as D,Z as E,E as F,x as I,M,N,oe as O,O as P,be as S,je as T,xe as _,me as a,Oe as b,de as c,ge as d,ke as f,ce as g,Se as h,ue as i,J as j,re as k,Ce as l,pe as m,ye as n,Q as o,se as p,_e as r,fe as s,Te as t,Ae as u,le as v,he as w,we as x,De 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{a as i,i as a,l as o,o as s,p as c}from"./locale-store-5Hf8J8-_.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{t as u}from"./markdown-view-pzSRu7av.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-0WouolD0.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-DfWfZ9iu.js";import{r as y,t as b}from"./chat-chart-block-BwP5QXEk.js";var x=l(`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`}]]),S=n(),C=e(t(),1),w=r(),T=(0,C.createContext)(null);function E(){let e=(0,S.c)(1),t=(0,C.useContext)(T);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:D},e[0]=t):t=e[0],t}return t}function D(){}function O(e){let t=(0,S.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,C.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,y=a!==null,b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||o(null)},t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(p,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=x):x=t[3];let E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=f(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=E):E=t[4];let D=a?.alt||`Image preview`,O;t[5]===D?O=t[6]:(O=(0,w.jsx)(_,{className:`sr-only`,children:D}),t[5]=D,t[6]=O);let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,w.jsx)(d,{className:`size-5`,"aria-hidden":!0}),t[7]=k):k=t[7];let A;t[8]===i?A=t[9]:(A=(0,w.jsx)(m,{asChild:!0,children:(0,w.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:k})}),t[8]=i,t[9]=A);let j;t[10]===a?j=t[11]:(j=a?(0,w.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=j);let M;t[12]!==A||t[13]!==j||t[14]!==O?(M=(0,w.jsxs)(h,{children:[x,(0,w.jsxs)(g,{className:E,"aria-describedby":void 0,children:[O,A,j]})]}),t[12]=A,t[13]=j,t[14]=O,t[15]=M):M=t[15];let N;t[16]!==M||t[17]!==y?(N=(0,w.jsx)(v,{open:y,onOpenChange:b,children:M}),t[16]=M,t[17]=y,t[18]=N):N=t[18];let P;return t[19]!==n||t[20]!==N?(P=(0,w.jsxs)(T.Provider,{value:u,children:[n,N]}),t[19]=n,t[20]=N,t[21]=P):P=t[21],P}var k=`xopc-attachment`,A=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,j=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function M(e,t){return`${k}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function N(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(A),a=r.match(j),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 P(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var F=new Map,I=``;function L(e,t,n){return`${n}:${e}:${t}`}function R(){let e=o.getState().conversationId??``;if(e!==I){for(let e of F.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);F.clear(),I=e}}async function ee(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);return r||(r={blob:(async()=>{let n=await i(a(P(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},F.set(n,r)),r.blob}async function z(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);if(r||(r={blob:ee(e,t),objectUrl:null,refCount:0},F.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function B(e,t){R();let n=L(e,t,o.getState().conversationId??``),r=F.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,F.delete(n)))}var V={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},H=null,U=null,W=null,G=null;function K(){return H||(H=new Audio,H.addEventListener(`timeupdate`,()=>{J.setState({currentTime:H.currentTime})}),H.addEventListener(`loadedmetadata`,()=>{let e=H.duration;Number.isFinite(e)&&J.setState({duration:e})}),H.addEventListener(`ended`,()=>{J.setState({playing:!1,currentTime:0}),H.currentTime=0}),H.addEventListener(`pause`,()=>{J.setState({playing:!1})}),H.addEventListener(`play`,()=>{J.setState({playing:!0})})),H}function q(){W&&G&&B(W,G),U=null,W=null,G=null}var J=c()((e,t)=>({...V,play:async(n,r,i)=>{let a=K(),o=t();if(o.noteId===n&&o.attachmentId===r&&U){a.play();return}a.pause(),q(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await z(n,r);U=t,W=n,G=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),q()}},pause:()=>{K().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=K();n.currentTime=t,e({currentTime:t})},reset:()=>{K().pause(),K().src=``,q(),e(V)}}));function Y(e,t){return M(e,t)}function te(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 ne(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function X(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&&o.getState().onUnauthorized(),!i.ok)throw Error(await ne(i));return i.json()}function re(e){let t=(0,S.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=N(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[p,m]=(0,C.useState)(d?null:s),[h,g]=(0,C.useState)(!1),_,v;if(t[11]!==a||t[12]!==d||t[13]!==s?(_=()=>{if(g(!1),!d){m(s);return}let e=!1;return m(null),z(d.noteId,d.attachmentId).then(t=>{e||m(t)}).catch(()=>{e||(g(!0),a?.())}),()=>{e=!0,B(d.noteId,d.attachmentId)}},v=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=_,t[15]=v):(_=t[14],v=t[15]),(0,C.useEffect)(_,v),h){let e;t[16]===n?e=t[17]:(e=f(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,w.jsx)(x,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,w.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!p){let e;t[22]===n?e=t[23]:(e=f(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,w.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let y;t[27]!==p||t[28]!==i?(y=i?()=>i(p):void 0,t[27]=p,t[28]=i,t[29]=y):y=t[29];let b;t[30]===a?b=t[31]:(b=()=>{g(!0),a?.()},t[30]=a,t[31]=b);let T;return t[32]!==l||t[33]!==n||t[34]!==p||t[35]!==o||t[36]!==y||t[37]!==b?(T=(0,w.jsx)(`img`,{...o,src:p,alt:l,className:n,onClick:y,onError:b}),t[32]=l,t[33]=n,t[34]=p,t[35]=o,t[36]=y,t[37]=b,t[38]=T):T=t[38],T}function ie(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ae(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=N(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;z(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,B(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=N(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;z(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,B(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function oe(e){let t=(0,S.c)(21),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 a=(0,C.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,w.jsx)(b,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ae(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,C.useLayoutEffect)(c,l);let d;t[12]===n?d=t[13]:(d=ie(n),t[12]=n,t[13]=d);let f;t[14]===i.className?f=t[15]:(f=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=f);let p=f.join(` `),m;return t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==p?(m=(0,w.jsx)(`div`,{ref:a,children:(0,w.jsx)(y,{children:(0,w.jsx)(u,{content:d,mermaidActions:!0,...i,renderChart:s,className:p})})}),t[16]=s,t[17]=i,t[18]=d,t[19]=p,t[20]=m):m=t[20],m}async function se(){return s(a(`/api/notes/project-summaries`))}async function ce(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(a(`/api/notes${n?`?${n}`:``}`))}async function le(e,t=`web`){return(await s(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function ue(e,t){return(await s(a(`/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 de(e){let t=await i(a(`/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(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function fe(e){await s(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function pe(e){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function me(e,t){return s(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function he(e,t,n){await s(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function ge(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function _e(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function ve(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function ye(e){return s(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function be(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function xe(e,t={}){return s(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function Se(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Ce(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function we(e){return s(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Te(e,t,n){return(await s(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Q(e,t={}){return(await s(a(`/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 Ee(e,t,n){let r=new FormData;return r.append(`file`,t),(await X(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(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 X(a(`/api/notes`),n)).note}async function De(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${Y(n.id,r.id)})`;return n.markdown!==i&&(n=await Z(n.id,{markdown:i})),n}async function Oe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${te(t)}](${Y(r.id,i.id)})`;return r.markdown!==a&&(r=await Z(r.id,{markdown:a,kind:`voice`})),r}async function ke(e){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ae(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function je(e,t){return(await s(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{Y as A,ve as C,Ee as D,Z as E,E as F,x as I,M,N,oe as O,O as P,be as S,je as T,xe as _,me as a,Oe as b,de as c,ge as d,ke as f,ce as g,Se as h,ue as i,J as j,re as k,Ce as l,pe as m,ye as n,Q as o,se as p,_e as r,fe as s,Te as t,Ae as u,le as v,he as w,we as x,De as y};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a,m as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as c,l,n as u}from"./locale-store-5Hf8J8-_.js";import{t as d}from"./messages-uXxg5p54.js";import{t as f}from"./archive-Dz0hferG.js";import{C as p,T as m,c as h,s as g,u as _}from"./discussion-annotation-sync-YvlVw17j.js";import{t as v}from"./arrow-left-D880xG-P.js";import{t as y}from"./arrow-right-DSSvoX71.js";import{t as ee}from"./arrow-up-D5ZtR1QT.js";import{f as b}from"./product-automation-feedback-DYwhL37Y.js";import{t as x}from"./calendar-days-hw_Y-g-s.js";import{t as te}from"./chevron-down-ccbiQQz_.js";import{t as ne}from"./popover-select-DD8fmrxH.js";import{t as re}from"./ellipsis-0k4rZLoy.js";import{t as ie}from"./file-text-D12HbeVy.js";import{t as ae}from"./folder-CN-pC3XL.js";import{A as S,D as C,E as w,_ as T,g as E,i as D,p as oe,s as se}from"./notes-api-DocbsBbT.js";import{b as ce,l as O,n as k,r as le,t as ue,v as A,y as de}from"./recording-upload-ZkmRf0GR.js";import{t as fe}from"./loader-circle-CifKLtgG.js";import{z as pe}from"./markdown-view-pzSRu7av.js";import{t as me}from"./mic-CuUb7zc-.js";import{t as he}from"./paperclip-f1HujQY1.js";import{t as ge}from"./plus-Q2yW6OE7.js";import{t as _e}from"./search-DA7gz22f.js";import{t as ve}from"./sparkles-DHlfQFAF.js";import{t as ye}from"./star-BUWJqJ5c.js";import{t as be}from"./trash-2-DusmjVPV.js";import{t as xe}from"./upload-rrb46c3c.js";import{t as j}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{i as Se}from"./vendor-swr-CdRzEUwF.js";import{t as N}from"./skeleton-BI5TyibZ.js";import{r as Ce}from"./app-chrome-BeB4KgOf.js";import{t as we}from"./page-header-store-reh1es-3.js";import{t as Te}from"./sliding-tab-list-DuQyViqe.js";import{n as Ee}from"./index.module-Cd9ENXfk.js";import{t as De}from"./confirm-dialog-XGclfBqe.js";import{l as Oe,m as ke,o as Ae,r as je,t as Me}from"./dist-D3lWNSe7.js";import{i as Ne,t as P}from"./note-detail-panel-B6RbjwJq.js";var F=n(),I=e(t(),1),L=r();function R({projectId:e}){let t=u(e=>e.language)===`zh`,n=s(),r=(0,I.useRef)(null),i=(0,I.useRef)(null),[a,o]=(0,I.useState)(null),[c,l]=(0,I.useState)(null),[d,f]=(0,I.useState)(null);async function p(){let t=i.current;if(!(!t||a!==null)){o(0),l(null);try{let r=await _();if(r.consentAcknowledgedAt==null){f(r.consentPolicyVersion);return}let a=await ue(t.file,t.requestId),s=await h({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=s.discussion.id,await O({...a,serverDiscussionId:s.discussion.id,projectId:e}),s.discussion.audioAttachmentId||await k(a,s.discussion.id,o),await le(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(s.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(null)}}}return(0,L.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,L.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},p()}}}),(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:a!==null,onClick:()=>c&&i.current?void p():r.current?.click(),children:[(0,L.jsx)(xe,{className:`size-3.5`}),a===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${a}%`]}),d===null?null:(0,L.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,L.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void g(d).then(()=>(f(null),p())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,L.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Pe(e){e.note??=await D({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await C(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${S(t,e.id)})`);e.note=await w(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
+
3
+ `)}`})}return{noteId:t,conversationId:(await T(t,{projectId:e.projectId})).conversationId}}function Fe(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var z={meeting:b,requirements:ie,research:A,weekly:x};function Ie({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:o}){let c=i.home,l=s(),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)([]),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),[re,ie]=(0,I.useState)(``),S=(0,I.useRef)(null),C=(0,I.useRef)(!1),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=v||!!S.current,D=f?c.templateOptions[f]:null,oe=!!(u.trim()||g.length);async function se(){if(!(C.current||!oe&&!S.current)){C.current=!0,y(!0),x(null),S.current??={requestId:crypto.randomUUID(),title:u.trim().split(`
4
+ `)[0]?.slice(0,80)||D?.label||i.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${D?`${D.prompt}\n`:``}${u.trim()}`,projectId:t||void 0,files:[...g],attachments:[],materialHeading:c.materialsHeading};try{let e=await Pe(S.current);r(),l(Fe(e.conversationId,e.noteId,c.agentPrompt))}catch(e){S.current.note&&r(),x(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{C.current=!1,y(!1)}}}function ce(){S.current=null,x(null),d(``),_([]),p(null),h(!1),T.current?.focus()}return(0,L.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,L.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,L.jsxs)(`fieldset`,{disabled:E,className:`min-w-0`,children:[(0,L.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,L.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:c.agentResultHint}),D?(0,L.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,L.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`font-medium`,children:[D.label,` · `]}),D.prompt.split(`
5
+
6
+ `)[0]]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>p(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,L.jsx)(j,{className:`size-3.5`})})]}):null,(0,L.jsx)(`textarea`,{ref:T,id:`notes-home-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:D?D.prompt.split(`
7
+
8
+ `).at(-1):c.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),g.length?(0,L.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:g.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,L.jsx)(he,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`${c.removeMaterial}: ${e.name}`,onClick:()=>_(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,L.jsx)(j,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,L.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,L.jsx)(ne,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(re.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:c.unassigned,placeholder:c.unassigned,emptyLabel:c.unassigned,ariaLabel:c.assignProject,triggerIcon:(0,L.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:E,loading:a,statusMessage:o?c.projectsLoadFailed:void 0,searchPlaceholder:c.projectSearch,searchValue:re,onSearchChange:ie})}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>w.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,L.jsx)(he,{className:`size-4`,"aria-hidden":!0}),c.addMaterials]}),(0,L.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,"aria-label":c.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);_(e=>[...e,...t]),e.target.value=``}})]})]}),(0,L.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,L.jsxs)(`button`,{type:`submit`,disabled:v||!S.current&&!oe,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[v?(0,L.jsx)(fe,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,L.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),v?c.creating:b?c.retry:c.agentCreate]})})]}),b?(0,L.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,L.jsx)(`p`,{children:b}),S.current?.note?(0,L.jsx)(`p`,{className:`mt-1`,children:c.partialFailure}):null,(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[S.current?.note?(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(`/notes/${encodeURIComponent(S.current.note.id)}?edit=1`),className:`underline`,children:c.openSavedDraft}):null,(0,L.jsx)(`button`,{type:`button`,onClick:ce,className:`underline`,children:c.newRequest})]})]}):null,(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,L.jsxs)(`button`,{type:`button`,disabled:E,"aria-expanded":m,"aria-controls":`notes-home-templates`,onClick:()=>h(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[c.templates,(0,L.jsx)(te,{className:M(`size-3.5 transition-transform`,m&&`rotate-180`),"aria-hidden":!0})]})}),(0,L.jsxs)(Te,{id:`notes-home-templates`,hidden:!m,className:M(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,m?`flex`:`hidden`),role:`group`,"aria-label":c.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(z).map(e=>{let t=z[e];return(0,L.jsxs)(`button`,{type:`button`,disabled:E,"aria-pressed":f===e,onClick:()=>{p(f===e?null:e),T.current?.focus()},className:M(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,f===e&&`bg-accent-soft text-accent-fg`),children:[(0,L.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),c.templateOptions[e].label]},e)}),(0,L.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle}),(0,L.jsx)(R,{})]})]})}function Le(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`||void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Re(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function ze(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||Re(e).slice(0,48)||t}var B=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function V(){let e=u(e=>e.language),t=d(e).notes,n=t.home,r=l(e=>e.conversationId),i=we(e=>e.setPageHeader),h=we(e=>e.clearPageHeader),g=s(),{pathname:_,search:ee}=a(),[x,S]=o(),C=x.get(`projectId`)||``,T=x.get(`view`)||`all`,O=x.get(`unassigned`)===`true`||T===`unassigned`,k=x.get(`search`)||``,[le]=Ee(k,250),[ue,A]=(0,I.useState)(C),[pe,he]=(0,I.useState)(``),[xe,j]=(0,I.useState)(null),[P,F]=(0,I.useState)(!1),[R,Pe]=(0,I.useState)(!1),[Fe,z]=(0,I.useState)(new Set),[V,H]=(0,I.useState)(null),[U,Be]=(0,I.useState)(null),W=(0,I.useRef)(new Set),G=(0,I.useRef)(null),Ve=(0,I.useRef)(!1),He=(0,I.useRef)(null),Ue=Le(x,le),K=(Ue.offset??0)/12,{data:We,error:Ge,isLoading:Ke,mutate:qe}=Se(r?[`notes-home`,r,Ue]:null,()=>E(Ue)),{data:Je,error:Ye,isLoading:q,mutate:J}=Se(r?[`notes-home-projects`,r]:null,oe),Y=Je?.items??[],Xe=Y.filter(e=>e.noteCount>0).slice(0,2),Ze=Y.find(e=>e.id===C)?.name??n.projectNotes,Qe=We?.items??[],X=We?.total??0,$e=Ke||k!==le,et=(0,I.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:c(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[tt,nt]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{A(C)},[C]),(0,I.useEffect)(()=>{let e=window.setInterval(()=>nt(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Z=(0,I.useCallback)(()=>{qe().catch(()=>void 0),J().catch(()=>void 0)},[qe,J]);(0,I.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,Z)),()=>e.forEach(e=>window.removeEventListener(e,Z))},[Z]);let rt=(0,I.useCallback)((e,t=!1)=>{let n=`${_}${ee}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),g(`/notes/${encodeURIComponent(e)}?${r}`)},[_,ee,g]),Q=(0,I.useCallback)(async()=>{if(!(Ve.current||!r)){Ve.current=!0,F(!0),j(null),G.current??={key:crypto.randomUUID(),projectId:C||void 0};try{let e=await D({markdown:``,kind:`thought`,projectId:G.current.projectId},G.current.key);G.current=null,Z(),rt(e.id,!0)}catch(e){j(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Ve.current=!1,F(!1)}}},[C,t.createBlankFailed,t.createBlankFailedHint,rt,Z,r]),it=(0,I.useCallback)(e=>{S(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[S]);function $(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),A(e),S(n)}function at(e){S(t=>{let n=new URLSearchParams(t);return O&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function ot(e,n){if(!W.current.has(e)){W.current.add(e),z(new Set(W.current)),j(null);try{await w(e,{pinned:n}),Z()}catch(e){j(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{W.current.delete(e),z(new Set(W.current))}}}async function st(){let e=V;if(!(!e||U)){H(null),Be(e.id),j(null);try{await se(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Z()}catch(e){j(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Be(null)}}}if((0,I.useLayoutEffect)(()=>{if(!r){h();return}return i({startExtra:null,main:(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,L.jsx)(`div`,{className:M(`flex min-w-0 items-center gap-2`,Ce),children:(0,L.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,L.jsx)(_e,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,L.jsx)(`input`,{ref:He,type:`search`,value:k,onChange:e=>it(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>h()},[h,Q,P,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,k,i,it,r]),(0,I.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),Q()),e.key.toLowerCase()===`f`&&(e.preventDefault(),He.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Q]),!r)return(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let ct=[{id:`all`,label:n.homeNav,Icon:de},{id:`favorites`,label:n.favorites,Icon:ye},{id:`unassigned`,label:n.unassigned,Icon:ce},{id:`archived`,label:t.filterArchived,Icon:f}],lt=C?`project:${C}`:O?`unassigned`:`all`,ut=!$e&&!Ge&&X===0&&!C&&!O&&!k&&T===`all`;return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,L.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[ct.map(({id:e,label:t,Icon:n})=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>$(``,e),"aria-current":!C&&(e===`unassigned`?O:!O&&T===e)?`page`:void 0,className:M(B,`justify-start px-2 text-left text-xs`,!C&&(e===`unassigned`?O:!O&&T===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,L.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,L.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),q?[0,1,2].map(e=>(0,L.jsx)(N,{className:`mb-2 h-8 w-full`},e)):Y.slice(0,8).map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),"aria-current":C===e.id?`page`:void 0,className:M(B,`justify-start px-2 text-left text-xs`,C===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,L.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g(`/projects`),className:M(B,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,L.jsx)(y,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col px-4 pb-4 pt-3 sm:px-6 sm:pb-7 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,L.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:C?Ze:O?n.unassigned:ut?n.firstNoteTitle:n.continueTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C?n.projectDescription:ut?n.firstNoteDescription:n.continueDescription})]}),C?(0,L.jsxs)(`button`,{type:`button`,onClick:()=>g(`/projects/${encodeURIComponent(C)}`),className:M(B,`text-xs`),children:[n.openProject,(0,L.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),xe?(0,L.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:xe}):null,(0,L.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void Q(),disabled:P,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[P?(0,L.jsx)(fe,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,L.jsx)(ge,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,L.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>p(C||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,L.jsx)(me,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{Pe(e=>!e),R||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":R,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,L.jsx)(ve,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,L.jsx)(te,{className:M(`size-4 transition-transform`,R&&`rotate-180`),"aria-hidden":!0})]}),(0,L.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!R,className:M(`mt-3`,!R&&`hidden`),children:(0,L.jsx)(Ie,{projects:Y,projectId:ue,onProjectChange:A,onCreated:Z,labels:t,projectsLoading:q,projectsError:!!Ye})})]}),Ye?(0,L.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,L.jsx)(`span`,{children:n.projectsLoadFailed}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void J().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,ut?null:(0,L.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:T===`favorites`?n.favorites:T===`archived`?t.filterArchived:C?n.projectNotes:n.recentNotes}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":T===`agent`,onClick:()=>at(T===`agent`?`all`:`agent`),className:M(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,T===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,L.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,L.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,L.jsx)(ne,{value:lt,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...Y.filter(e=>e.name.toLowerCase().includes(pe.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:C?Ze:O?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:q,searchPlaceholder:n.projectSearch,searchValue:pe,onSearchChange:he,onChange:e=>$(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,L.jsxs)(Te,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,role:`group`,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":T===e||e===`all`&&T===`unassigned`,onClick:()=>at(e),className:M(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(T===e||e===`all`&&T===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,L.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ge?(0,L.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,L.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void qe().catch(()=>void 0),className:M(B,`mt-2`),children:n.retry})]}):$e?(0,L.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,L.jsx)(N,{className:`h-10 w-8 shrink-0`}),(0,L.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,L.jsx)(N,{className:`h-4 w-2/3`}),(0,L.jsx)(N,{className:`h-3 w-1/2`})]})]},e))}):Qe.length===0?(0,L.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,L.jsx)(de,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,L.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:k||T!==`all`&&T!==`unassigned`?n.noMatches:C?n.projectEmpty:n.emptyTitle}),(0,L.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:k||T!==`all`&&T!==`unassigned`?n.noMatchesHint:C?n.projectEmptyHint:n.emptyDescription})]}):(0,L.jsx)(`ul`,{className:`divide-y divide-edge`,children:Qe.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?b:e.kind===`bookmark`?m:ie,i=ze(e,t.titlePlaceholder,n.voiceNote),a=Re(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,L.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>rt(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,L.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,L.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,L.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,L.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,L.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,L.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,L.jsx)(`span`,{className:`truncate`,children:a})]}),(0,L.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Ne(e.updatedAt,tt,et)})]})]}),(0,L.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,L.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Ne(e.updatedAt,tt,et)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void ot(e.id,!e.pinned),disabled:Fe.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,L.jsx)(ye,{className:M(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,L.jsxs)(Oe,{children:[(0,L.jsx)(ke,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,disabled:U===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:U===e.id?(0,L.jsx)(fe,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,L.jsx)(re,{className:`size-4`,"aria-hidden":!0})})}),(0,L.jsx)(Ae,{children:(0,L.jsx)(Me,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,L.jsxs)(je,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>H(e),children:[(0,L.jsx)(be,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!$e&&!Ge&&X>0?(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,L.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(X))}),X>12||K>0?(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:K===0,className:B,onClick:()=>S(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K-1)),t}),children:(0,L.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsxs)(`span`,{children:[K+1,` / `,Math.max(1,Math.ceil(X/12))]}),(0,L.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(K+1)*12>=X,className:B,onClick:()=>S(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K+1)),t}),children:(0,L.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!C&&!O&&(q||Xe.length>0)?(0,L.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>g(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:q?[0,1].map(e=>(0,L.jsx)(N,{className:`h-28 w-full`},e)):Xe.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,L.jsx)(ae,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,L.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,L.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,L.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,L.jsx)(`span`,{children:e.updatedAt?Ne(e.updatedAt,tt,et):n.emptyProject})]})]},e.id))})]}):null]})}),(0,L.jsx)(De,{open:V!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,V?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>H(null)})]})}function H(){let e=(0,F.c)(12),{noteId:t}=i(),n=s(),[r]=o(),a;e[0]===r?a=e[1]:(a=pe(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=a);let c=a,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let u=l;if(!t)return null;let d=r.get(`edit`)===`1`?`wysiwyg`:`preview`,f;e[5]===r?f=e[6]:(f=r.get(`edit`),e[5]=r,e[6]=f);let p=f===`1`,m;return e[7]!==u||e[8]!==t||e[9]!==d||e[10]!==p?(m=(0,L.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,L.jsx)(P,{noteId:t,onBack:u,initialMode:d,autoFocus:p},t)}),e[7]=u,e[8]=t,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function U(){let e=(0,F.c)(2),{noteId:t}=i(),n;return e[0]===t?n=e[1]:(n=t?(0,L.jsx)(H,{}):(0,L.jsx)(V,{}),e[0]=t,e[1]=n),n}export{U as NotesPage};
@@ -1 +1 @@
1
- import{a as e,i as t}from"./locale-store-lIXD1FMw.js";import{n}from"./electron-env-DHOGevH3.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
1
+ import{a as e,i as t}from"./locale-store-5Hf8J8-_.js";import{n}from"./electron-env-DHOGevH3.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./circle-check-C23XjkUj.js";import{t as i}from"./cloud-C4-yfnnk.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{n as o}from"./locale-store-lIXD1FMw.js";import{a as s}from"./vendor-swr-CdRzEUwF.js";import{t as c}from"./button-CnRSIP6m.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-za2fWJLg.js";import{a as d,n as f,r as p}from"./oauth-api-C3X9FLYw.js";var m=e(t(),1),h=`xopc-onboarding-model-setup-dismissed`,g=`/api/models/cloud-onboarding`,_=n();function v({providerId:e,displayName:t,connected:n,onConnected:h}){let v=o(e=>e.language),{mutate:y}=s(),b=v===`zh`,[x,S]=(0,m.useState)(`idle`),[C,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(null),D=(0,m.useRef)(!1),O=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{D.current=!0,O.current?.close(),O.current=null},[]);let k=async()=>{D.current=!1,w(null),E(null),S(`waiting`);let t=l();t||(O.current?.close(),O.current=window.open(`about:blank`,`xopc-oauth`),O.current&&(O.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!D.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),D.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,E(i.authUrl),t){let e=await window.electronAPI?.shell?.openExternalUrl(i.authUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else O.current&&!O.current.closed&&O.current.location.replace(i.authUrl);if(i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){e===`xopc-cloud`&&await y(g),await u(),O.current?.close(),O.current=null,S(`connected`),h?.();return}}}catch(e){O.current?.close(),O.current=null,D.current||(S(`idle`),w(e instanceof Error?e.message:b?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},A=n||x===`connected`;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-inset p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,_.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-surface-active text-fg-muted`,children:(0,_.jsx)(i,{className:`size-5`,"aria-hidden":!0})}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),A?(0,_.jsx)(r,{className:`size-4 text-emerald-500`,"aria-label":b?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x===`waiting`?b?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:A?b?`已通过 OAuth 连接。`:`Connected with OAuth.`:b?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),x===`waiting`&&T?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:T,target:`_blank`,rel:`noreferrer`,children:b?`打开授权页面`:`Open authorization page`}):null,C?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:C}):null]})]}),(0,_.jsxs)(c,{type:`button`,variant:A?`secondary`:`primary`,disabled:x===`waiting`,onClick:()=>void k(),children:[x===`waiting`?(0,_.jsx)(a,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x===`waiting`?b?`等待授权…`:`Waiting…`:A?b?`重新授权`:`Reauthorize`:b?`授权`:`Authorize`]})]})}export{g as n,h as r,v as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-5Hf8J8-_.js";import{t as i}from"./circle-check-C23XjkUj.js";import{t as a}from"./cloud-C4-yfnnk.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{a as s}from"./vendor-swr-CdRzEUwF.js";import{t as c}from"./button-CnRSIP6m.js";import{n as l}from"./electron-env-DHOGevH3.js";import{i as u}from"./models-hub-cache-DhZng2nF.js";import{a as d,n as f,r as p}from"./oauth-api-CCFIPbA0.js";var m=e(t(),1),h=`xopc-onboarding-model-setup-dismissed`,g=`/api/models/cloud-onboarding`,_=n();function v({providerId:e,displayName:t,connected:n,onConnected:h}){let v=r(e=>e.language),{mutate:y}=s(),b=v===`zh`,[x,S]=(0,m.useState)(`idle`),[C,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(null),D=(0,m.useRef)(!1),O=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{D.current=!0,O.current?.close(),O.current=null},[]);let k=async()=>{D.current=!1,w(null),E(null),S(`waiting`);let t=l();t||(O.current?.close(),O.current=window.open(`about:blank`,`xopc-oauth`),O.current&&(O.current.opener=null));let n=null,r=null;try{for(n=(await d(e)).sessionId;!D.current;){if(await new Promise(e=>window.setTimeout(e,1e3)),D.current)return;let i=await p(n);if(i.authUrl&&i.authUrl!==r)if(r=i.authUrl,E(i.authUrl),t){let e=await window.electronAPI?.shell?.openExternalUrl(i.authUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else O.current&&!O.current.closed&&O.current.location.replace(i.authUrl);if(i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){e===`xopc-cloud`&&await y(g),await u(),O.current?.close(),O.current=null,S(`connected`),h?.();return}}}catch(e){O.current?.close(),O.current=null,D.current||(S(`idle`),w(e instanceof Error?e.message:b?`连接失败`:`Connection failed`))}finally{n&&f(n).catch(()=>{})}},A=n||x===`connected`;return(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-inset p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,_.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-surface-active text-fg-muted`,children:(0,_.jsx)(a,{className:`size-5`,"aria-hidden":!0})}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),A?(0,_.jsx)(i,{className:`size-4 text-emerald-500`,"aria-label":b?`已连接`:`Connected`}):null]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:x===`waiting`?b?`请在浏览器中完成 OAuth 授权。`:`Complete OAuth authorization in your browser.`:A?b?`已通过 OAuth 连接。`:`Connected with OAuth.`:b?`使用 OAuth 连接,无需 API Key。`:`Connect with OAuth. No API key is required.`}),x===`waiting`&&T?(0,_.jsx)(`a`,{className:`mt-1 inline-flex text-sm text-accent hover:underline`,href:T,target:`_blank`,rel:`noreferrer`,children:b?`打开授权页面`:`Open authorization page`}):null,C?(0,_.jsx)(`p`,{className:`mt-1 text-sm text-danger`,children:C}):null]})]}),(0,_.jsxs)(c,{type:`button`,variant:A?`secondary`:`primary`,disabled:x===`waiting`,onClick:()=>void k(),children:[x===`waiting`?(0,_.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,x===`waiting`?b?`等待授权…`:`Waiting…`:A?b?`重新授权`:`Reauthorize`:b?`授权`:`Authorize`]})]})}export{g as n,h as r,v as t};
@@ -0,0 +1 @@
1
+ function e(e,t=`settings`,n){window.dispatchEvent(new CustomEvent(`open-capability-settings`,{detail:{use:e,view:t,purpose:n}}))}export{e as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./file-text-D12HbeVy.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-DRR9N3HC.js";import{l as c,n as l}from"./locale-store-lIXD1FMw.js";import{t as u}from"./session-manager-5l9q0cd5.js";import{t as d}from"./capabilities-DAyA681v.js";import{n as f,t as p}from"./page-context-draft-ClLgaOaD.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=s(l(e=>e.language)).chat.pageContext,v=i(),y=r().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=c(e=>e.baseUrl),D=c(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&c.getState().baseUrl===E&&c.getState().conversationId===D;try{let n=f.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await d(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new u().createSession();if(!r())return;if(!f.put(p(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[b?(0,h.jsx)(o,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as a,n as o}from"./locale-store-5Hf8J8-_.js";import{t as s}from"./messages-uXxg5p54.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./session-manager-DNMosCtW.js";import{t as d}from"./capabilities-CwdjWz2r.js";import{n as f,t as p}from"./page-context-draft-CMRDNv4d.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=s(o(e=>e.language)).chat.pageContext,v=i(),y=r().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=a(e=>e.baseUrl),D=a(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&a.getState().baseUrl===E&&a.getState().conversationId===D;try{let n=f.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await d(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new u().createSession();if(!r())return;if(!f.put(p(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[b?(0,h.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-lIXD1FMw.js";import{_ as t}from"./local-session-drafts-B9ZPwotC.js";function n(){let n=crypto.randomUUID(),r=crypto.randomUUID(),i=0,a=e(()=>({drafts:{}}));return{store:a,capture(e){return{envelope:t({version:1,clientInstanceId:n,tabId:r,sequence:++i,surface:`web`,capturedAt:Date.now(),resourceRefs:e.resourceRefs,selection:e.selection}),title:e.title,preview:e.text.slice(0,16e3),truncated:e.text.length>16e3}},put(e,t){let n=a.getState().drafts;return n[e]||Object.keys(n).length>=20?!1:(a.setState({drafts:{...n,[e]:structuredClone(t)}}),!0)},remove(e,t){let n=a.getState().drafts;if(n[e]!==t)return;let r={...n};delete r[e],a.setState({drafts:r})}}}var r=n();function i(e,t,n){return JSON.stringify([e,t??null,n])}export{r as n,i as t};
1
+ import{p as e}from"./locale-store-5Hf8J8-_.js";import{_ as t}from"./local-session-drafts-DHM4vWDO.js";function n(){let n=crypto.randomUUID(),r=crypto.randomUUID(),i=0,a=e(()=>({drafts:{}}));return{store:a,capture(e){return{envelope:t({version:1,clientInstanceId:n,tabId:r,sequence:++i,surface:`web`,capturedAt:Date.now(),resourceRefs:e.resourceRefs,selection:e.selection}),title:e.title,preview:e.text.slice(0,16e3),truncated:e.text.length>16e3}},put(e,t){let n=a.getState().drafts;return n[e]||Object.keys(n).length>=20?!1:(a.setState({drafts:{...n,[e]:structuredClone(t)}}),!0)},remove(e,t){let n=a.getState().drafts;if(n[e]!==t)return;let r={...n};delete r[e],a.setState({drafts:r})}}}var r=n();function i(e,t,n){return JSON.stringify([e,t??null,n])}export{r as n,i as t};
@@ -0,0 +1 @@
1
+ import{p as e}from"./locale-store-5Hf8J8-_.js";var t={startExtra:null,main:null,end:null},n=e(e=>({...t,setPageHeader:t=>e(t),clearPageHeader:()=>e(t)}));export{n as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{t as r}from"./loopi-CNtmi9FU.js";import{t as i}from"./agent-avatar-display-Cy50vjbq.js";var a=n(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),o=e(),s=t(),c={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`};function l(e){let t=(0,o.c)(8),{appearance:n,agentId:a,className:l}=e,u=l===void 0?``:l;if(n===`custom`&&a){let e;return t[0]!==a||t[1]!==u?(e=(0,s.jsx)(i,{agentId:a,avatar:`xopc:custom`,className:u}),t[0]=a,t[1]=u,t[2]=e):e=t[2],e}let d=n===`custom`?`idle`:c[n],f=`personal-avatar-motion inline-flex items-center justify-center ${u}`,p;t[3]===d?p=t[4]:(p=(0,s.jsx)(r,{variant:`avatar`,mood:d,className:`size-full`}),t[3]=d,t[4]=p);let m;return t[5]!==f||t[6]!==p?(m=(0,s.jsx)(`span`,{className:f,"aria-hidden":`true`,children:p}),t[5]=f,t[6]=p,t[7]=m):m=t[7],m}export{a as n,l as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{t as r}from"./loopi-CNtmi9FU.js";import{t as i}from"./agent-avatar-display-B1ycycx2.js";var a=n(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),o=e(),s=t(),c={loopi:`idle`,"loopi-curious":`curious`,"loopi-care":`care`};function l(e){let t=(0,o.c)(8),{appearance:n,agentId:a,className:l}=e,u=l===void 0?``:l;if(n===`custom`&&a){let e;return t[0]!==a||t[1]!==u?(e=(0,s.jsx)(i,{agentId:a,avatar:`xopc:custom`,className:u}),t[0]=a,t[1]=u,t[2]=e):e=t[2],e}let d=n===`custom`?`idle`:c[n],f=`personal-avatar-motion inline-flex items-center justify-center ${u}`,p;t[3]===d?p=t[4]:(p=(0,s.jsx)(r,{variant:`avatar`,mood:d,className:`size-full`}),t[3]=d,t[4]=p);let m;return t[5]!==f||t[6]!==p?(m=(0,s.jsx)(`span`,{className:f,"aria-hidden":`true`,children:p}),t[5]=f,t[6]=p,t[7]=m):m=t[7],m}export{a as n,l as t};