@xopcai/xopc 0.0.253 → 0.0.255

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 (203) hide show
  1. package/dist/browser-ext/dist/background.js +59 -13
  2. package/dist/browser-ext/dist/content.js +0 -5
  3. package/dist/browser-ext/manifest.json +2 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-CeS1bgXP.js → activity-store-DvjK5FEm.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BdF3HhCW.js → agent-avatar-dicebear-Cqspzbf_.js} +1 -1
  7. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CL3Mi-uM.js +1 -0
  8. package/dist/gateway/static/root/assets/agents-odqXmGhA.js +1 -0
  9. package/dist/gateway/static/root/assets/{api-zMPeC0yU.js → api-CsYi3heY.js} +1 -1
  10. package/dist/gateway/static/root/assets/{app-management-settings-panel-BaAFln8W.js → app-management-settings-panel-Gd4a5hdE.js} +1 -1
  11. package/dist/gateway/static/root/assets/{appearance-settings-CXvsoBlw.js → appearance-settings-CZ6KOnbd.js} +1 -1
  12. package/dist/gateway/static/root/assets/apps-page-DyBDoCam.js +1 -0
  13. package/dist/gateway/static/root/assets/{archive-plugin-C0o_mVQI.js → archive-plugin-y82Rwhjm.js} +1 -1
  14. package/dist/gateway/static/root/assets/{attachment-load-B5Ry3tGL.js → attachment-load-D46SGNpv.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-page-DY5QAEQd.js → automations-page-wilciIZ1.js} +1 -1
  16. package/dist/gateway/static/root/assets/automations-workspace-8U86Umig.js +6 -0
  17. package/dist/gateway/static/root/assets/{binary-plugins-BydpEgBA.js → binary-plugins-CuMkNNCe.js} +1 -1
  18. package/dist/gateway/static/root/assets/{block-editor-D0CpUOMo.js → block-editor-DFnPsrxI.js} +44 -44
  19. package/dist/gateway/static/root/assets/{browser-automation-inputs-DzbTsGI6.js → browser-automation-inputs-hlmcSp4p.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-automations-page-D7fZYjni.js → browser-automations-page-OjZvbARU.js} +2 -2
  21. package/dist/gateway/static/root/assets/browser-settings-page-DOUG84qV.js +8 -0
  22. package/dist/gateway/static/root/assets/capabilities-settings-panel-CG73Mwi8.js +7 -0
  23. package/dist/gateway/static/root/assets/channels-settings-MDywEWWM.js +1 -0
  24. package/dist/gateway/static/root/assets/{channels-status-swr-BGGRTkn6.js → channels-status-swr-D1HHFzkE.js} +1 -1
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-_CP4nvlg.js → chat-terminal-dock-Ce_T9BPq.js} +2 -2
  26. package/dist/gateway/static/root/assets/connectors-page-D29p6Zvm.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-g2U8Rllf.js → cron-expression-BRrCwYyD.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-C35RuuWW.js +1 -0
  29. package/dist/gateway/static/root/assets/{dependency-picker-D-0gcbbM.js → dependency-picker-4pNXVcRM.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-D7kvWQ9H.js → desktop-pet-settings-BvV1UA5g.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-Cl3JRIu6.js → desktop-pet-z91GYnPf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-DtP2tJHY.js → extension-debug-page-CkVF5HvV.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-CphZDdoT.js → extension-page-DW0zQGaB.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-CsxVLV4-.js → extension-settings-page-BLQhizZ3.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-swr-BW3Bx-aV.js → gateway-config-swr-02BBC1mK.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-DxBZ05dX.js → gateway-settings-rAXx8FGP.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAq74TZe.js → gateway-startup-retry-XZnY6621.js} +1 -1
  38. package/dist/gateway/static/root/assets/heartbeat-settings-BaW_r1t9.js +1 -0
  39. package/dist/gateway/static/root/assets/home-page-BoTS8-Z9.js +1 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-MPuaXDRs.js → image-generation-api-CIcKz4Xs.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-DsonmRCH.css +2 -0
  42. package/dist/gateway/static/root/assets/index-PksHo9hS.js +74 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfhaTqgE.js → keyboard-shortcuts-settings-yfaGz6SE.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-CR6asX7L.js → local-app-workbench-page-B3flRQH1.js} +2 -2
  45. package/dist/gateway/static/root/assets/{local-apps-page-g01W3kEK.js → local-apps-page-Cp-nEtgV.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-BkeaPZpn.js → locale-store-VsboRLD7.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-DkqsRCri.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-DeGxJF_Z.js → management-settings-24_JyDPk.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-Ca7BRBLL.js → markdown-view-CPXhy6nh.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-FmOhmzlD.js → media-plugins-CwLvIb9r.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-DngsF_Kx.js +3 -0
  52. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-BXNbn05L.js → mobile-pairing-wizard-BbJCDv57.js} +1 -1
  53. package/dist/gateway/static/root/assets/note-detail-panel-OklYXK7y.js +5 -0
  54. package/dist/gateway/static/root/assets/notes-page-BjfgJIQw.js +8 -0
  55. package/dist/gateway/static/root/assets/{page-tabs-pyukZ1PJ.js → page-tabs-0YXn9Gkl.js} +1 -1
  56. package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +1 -0
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-slFHoMUe.js → preview-open-alternatives-2jVV5kfZ.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-CXa3FNNk.js → product-open-page-D7p0NfTK.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-rLNM2mP0.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-D6jY2ZWl.js +1 -0
  61. package/dist/gateway/static/root/assets/{registry-api-CviQoUBf.js → registry-api-DlTWbXQA.js} +1 -1
  62. package/dist/gateway/static/root/assets/remote-access-hub-CZZg0kXc.js +1 -0
  63. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-O9D9o7-O.js → runtime-tools-settings-panel-B-NDgmJ4.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-8FesicnL.js → schema-form-DZYeBS1v.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-BvuxJegi.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-BAQHP4mB.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-CBic9TFH.js → settings-form-section-zy5UMvPk.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-Xz66_Mjg.js → settings-page-CTuipbJq.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-BkWoc5j5.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page--JpjwB58.js → share-preview-page-D3Uawo_h.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-B2doziIn.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-D2ymjqG5.js +1 -0
  73. package/dist/gateway/static/root/assets/{skills-page-fVKExKv5.js → skills-page-DDbabz7p.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skills-page.utils-Yv9u3uJp.js → skills-page.utils-DkGhbiMa.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-CCWjVdc2.js → system-settings-panel-Fc-WbX6-.js} +1 -1
  76. package/dist/gateway/static/root/assets/task-detail-page-7w7eB9nB.js +1 -0
  77. package/dist/gateway/static/root/assets/{theme-store-BtkaVpMm.js → theme-store-vdB57bTn.js} +1 -1
  78. package/dist/gateway/static/root/assets/{tunnel-api-C__W9BaN.js → tunnel-api-DZ0evABj.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-Dow9RRcq.js → use-autosave-Ckof_m7e.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-model-page-CcNCyrXZ.js +2 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CvF3lEyx.js → voice-api-key-field-CnmtpWlq.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-config-api-BEUVAyM6.js → voice-config-api-OA04c71t.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-overlay-B9PDfReq.js → work-discovery-overlay-sxvsDIC3.js} +1 -1
  84. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CUCfBpPF.js +3 -0
  85. package/dist/gateway/static/root/assets/workflows-page-Bp-nvnLa.js +5 -0
  86. package/dist/gateway/static/root/index.html +11 -11
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/agent-manager.js +4 -4
  89. package/dist/src/agent/background-review/run-background-review.js +1 -1
  90. package/dist/src/agent/embedded/model-runtime.js +1 -1
  91. package/dist/src/agent/embedded/run-for-session.js +1 -1
  92. package/dist/src/agent/image/tool-model-config.js +1 -1
  93. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  94. package/dist/src/agent/service.js +2 -2
  95. package/dist/src/agent/session/session-inspector.js +1 -1
  96. package/dist/src/agent/skills/hub-lock.js +1 -1
  97. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  98. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +17 -2
  99. package/dist/src/agent/tools/browser/tool/schemas.d.ts +85 -1
  100. package/dist/src/agent/tools/browser/tool/schemas.js +212 -5
  101. package/dist/src/agent/tools/create-share-tool.js +39 -1
  102. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  103. package/dist/src/ai-assist/text-assist.js +1 -1
  104. package/dist/src/auth/credentials.js +2 -2
  105. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  106. package/dist/src/auth/profiles/store.js +1 -1
  107. package/dist/src/auth/sync-provider-auth.js +2 -2
  108. package/dist/src/browser/drivers/extension-driver.d.ts +4 -4
  109. package/dist/src/browser/drivers/extension-driver.js +20 -8
  110. package/dist/src/browser/drivers/playwright-driver.js +1 -1
  111. package/dist/src/browser/providers/browser-ext-install.d.ts +3 -0
  112. package/dist/src/browser/providers/browser-ext-install.js +19 -4
  113. package/dist/src/browser/providers/extension.d.ts +14 -1
  114. package/dist/src/browser/providers/extension.js +89 -11
  115. package/dist/src/browser/providers/playwright-install.js +8 -12
  116. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  117. package/dist/src/cli/commands/models.js +1 -1
  118. package/dist/src/cli/commands/tunnel.js +3 -3
  119. package/dist/src/config/index.js +4 -4
  120. package/dist/src/config/loader.js +2 -2
  121. package/dist/src/config/models-json.js +1 -1
  122. package/dist/src/extensions/lockfile.js +1 -1
  123. package/dist/src/gateway/agents-admin.js +1 -1
  124. package/dist/src/gateway/device-routes.js +1 -1
  125. package/dist/src/gateway/file-path-classifier.js +1 -1
  126. package/dist/src/gateway/heartbeat/service.js +1 -1
  127. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  128. package/dist/src/gateway/hono/routes/browser.js +149 -27
  129. package/dist/src/gateway/hono/routes/lazy-bundles.js +3 -3
  130. package/dist/src/gateway/hono/routes/models.js +1 -1
  131. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  132. package/dist/src/gateway/hono/routes/shares.js +404 -7
  133. package/dist/src/gateway/hono/routes/site-shares.js +19 -13
  134. package/dist/src/gateway/hono/routes/tunnel.js +1 -1
  135. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  136. package/dist/src/gateway/service/config-coordinator.js +1 -1
  137. package/dist/src/gateway/service/sessions-api.js +1 -1
  138. package/dist/src/gateway/service.js +13 -13
  139. package/dist/src/heartbeat/index.js +1 -1
  140. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  141. package/dist/src/providers/index.js +2 -2
  142. package/dist/src/providers/model-registry.js +1 -1
  143. package/dist/src/providers/model-thinking.js +57 -20
  144. package/dist/src/providers/register-runtime-providers.js +1 -1
  145. package/dist/src/remote-access/exposure-manager.js +1 -1
  146. package/dist/src/session/index.js +1 -1
  147. package/dist/src/session/store.js +1 -1
  148. package/dist/src/share/hosted-note-publication.d.ts +22 -0
  149. package/dist/src/share/hosted-note-publication.js +96 -0
  150. package/dist/src/share/hosted-session-share.d.ts +86 -7
  151. package/dist/src/share/hosted-session-share.js +72 -15
  152. package/dist/src/share/hosted-static-site-publication.d.ts +16 -0
  153. package/dist/src/share/hosted-static-site-publication.js +108 -0
  154. package/dist/src/share/hosted-static-site-publish.d.ts +23 -0
  155. package/dist/src/share/hosted-static-site-publish.js +53 -0
  156. package/dist/src/share/note-share-service.d.ts +1 -0
  157. package/dist/src/share/note-share-service.js +4 -4
  158. package/dist/src/share/share-url.d.ts +1 -1
  159. package/dist/src/share/share-url.js +14 -9
  160. package/dist/src/tasks/home-query-service.js +2 -2
  161. package/dist/src/tui/backends/embedded-backend.js +2 -2
  162. package/dist/src/tui/tui-agent-events.js +1 -1
  163. package/dist/src/tui/tui-startup-resources.js +1 -1
  164. package/dist/src/tui/tui.js +1 -1
  165. package/dist/src/tunnel/index.js +1 -1
  166. package/dist/src/tunnel/tunnel-service.js +1 -1
  167. package/dist/src/voice/realtime/agentEngine.js +17 -0
  168. package/dist/src/voice/realtime/memory-context.js +1 -1
  169. package/dist/src/voice/realtime/playback-echo.d.ts +2 -0
  170. package/dist/src/voice/realtime/playback-echo.js +15 -0
  171. package/dist/src/work-discovery/service.js +1 -1
  172. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  173. package/package.json +2 -2
  174. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Bs34Kp0K.js +0 -1
  175. package/dist/gateway/static/root/assets/agents-DARlgjTm.js +0 -1
  176. package/dist/gateway/static/root/assets/apps-page-BhgvfBJT.js +0 -1
  177. package/dist/gateway/static/root/assets/automations-workspace-BzX4lILP.js +0 -6
  178. package/dist/gateway/static/root/assets/browser-settings-page-BBdMqxl0.js +0 -3
  179. package/dist/gateway/static/root/assets/capabilities-settings-panel-D_WfftDW.js +0 -7
  180. package/dist/gateway/static/root/assets/channels-settings-bdRLT9KA.js +0 -1
  181. package/dist/gateway/static/root/assets/connectors-page-CPDjU5wU.js +0 -2
  182. package/dist/gateway/static/root/assets/date-picker-SmVlhtj_.js +0 -1
  183. package/dist/gateway/static/root/assets/heartbeat-settings-DWcKsIoZ.js +0 -1
  184. package/dist/gateway/static/root/assets/home-page-BdvLZKQZ.js +0 -1
  185. package/dist/gateway/static/root/assets/index-C7RDs6S-.js +0 -74
  186. package/dist/gateway/static/root/assets/index-Cu8xqZQ9.css +0 -2
  187. package/dist/gateway/static/root/assets/logs-page-ZP4QTWoC.js +0 -2
  188. package/dist/gateway/static/root/assets/messages-C72stReU.js +0 -3
  189. package/dist/gateway/static/root/assets/note-detail-panel-EeVeF4II.js +0 -5
  190. package/dist/gateway/static/root/assets/notes-page-D7bMff96.js +0 -8
  191. package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +0 -1
  192. package/dist/gateway/static/root/assets/project-detail-page-BDF88VdN.js +0 -1
  193. package/dist/gateway/static/root/assets/projects-page-DeTD6pu1.js +0 -1
  194. package/dist/gateway/static/root/assets/remote-access-hub-CxKrdQ6a.js +0 -1
  195. package/dist/gateway/static/root/assets/sessions-page-DUFJN-2t.js +0 -1
  196. package/dist/gateway/static/root/assets/settings-advanced-gate-CcSYDjaH.js +0 -1
  197. package/dist/gateway/static/root/assets/setup-status-panel-C6DuwrP5.js +0 -1
  198. package/dist/gateway/static/root/assets/shares-settings-CovcdHSC.js +0 -1
  199. package/dist/gateway/static/root/assets/skill-reload-api-CrHagTsE.js +0 -1
  200. package/dist/gateway/static/root/assets/task-detail-page-I8hueJnG.js +0 -1
  201. package/dist/gateway/static/root/assets/user-model-page-CU6nxmoM.js +0 -2
  202. package/dist/gateway/static/root/assets/workflow-run-setup-panel-kWGFkhjz.js +0 -3
  203. package/dist/gateway/static/root/assets/workflows-page-B4Is5E42.js +0 -5
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-D0CpUOMo.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C7RDs6S-.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-BvLh9GaE.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DBS3OB8K.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-Ca7BRBLL.js","assets/dist-CpzYSoz7.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-BkeaPZpn.js","assets/messages-C72stReU.js","assets/cn-JdwAhgNB.js","assets/product-delivery-CV4pDOtG.js","assets/schemas-BHS7bo06.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-DLmwHyAh.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-C-Hj-nXR.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/middleware-Pd0e8Igk.js","assets/files-BArWTfr7.js","assets/tool-activity-R8V9l6nk.js","assets/button-CtTvuElV.js","assets/registry-api-CviQoUBf.js","assets/gateway-startup-retry-DAq74TZe.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-BW3Bx-aV.js","assets/electron-env-DH5wF8X8.js","assets/activity-store-CeS1bgXP.js","assets/theme-store-BtkaVpMm.js","assets/index-Cu8xqZQ9.css","assets/vendor-codemirror-Qdcjid65.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BjMTIM-m.js","assets/languages-5WaOu0Lf.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-C-Hj-nXR.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./loader-circle-CifKLtgG.js";import{t as b}from"./x-B_N4OPjy.js";import{t as x}from"./copy-to-clipboard-HOJ79TWv.js";import{t as S}from"./messages-C72stReU.js";import{d as C,n as w}from"./locale-store-BkeaPZpn.js";import{t as T}from"./cn-JdwAhgNB.js";import{i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-CtTvuElV.js";import{i as O}from"./theme-store-BtkaVpMm.js";import{t as k}from"./skeleton-BwbyijEw.js";import{As as A,Cn as j,Dc as M,Di as N,Dn as P,En as F,Fn as I,Gn as L,In as R,Jn as z,Kn as ee,Ln as te,Ml as B,Nn as V,Os as H,Pn as ne,Sl as U,Sn as re,Uc as ie,Un as ae,Us as oe,Ut as se,Va as ce,Wn as le,Yn as ue,Ys as de,_c as fe,_n as pe,a as me,ac as he,ai as ge,bn as _e,c as ve,ec as ye,fu as be,il as xe,io as Se,jc as Ce,js as we,kn as Te,ks as Ee,l as W,o as G,pu as K,s as q,si as De,wn as Oe,xn as ke,yl as Ae,yn as je,zn as Me,zs as Ne}from"./index-C7RDs6S-.js";var J=n(),Y=e(t(),1),X=r(),Pe=(0,Y.createContext)(null);function Fe(){let e=(0,J.c)(1),t=(0,Y.useContext)(Pe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Z},e[0]=t):t=e[0],t}return t}function Z(){}function Q(e){let t=(0,J.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Y.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=T(`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]=x):x=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,X.jsx)(d,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(b,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let E;t[8]===i?E=t[9]:(E=(0,X.jsx)(c,{asChild:!0,children:(0,X.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:w})}),t[8]=i,t[9]=E);let D;t[10]===a?D=t[11]:(D=a?(0,X.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]=D);let O;t[12]!==E||t[13]!==D||t[14]!==C?(O=(0,X.jsxs)(l,{children:[y,(0,X.jsxs)(u,{className:x,"aria-describedby":void 0,children:[C,E,D]})]}),t[12]=E,t[13]=D,t[14]=C,t[15]=O):O=t[15];let k;t[16]!==O||t[17]!==_?(k=(0,X.jsx)(f,{open:_,onOpenChange:v,children:O}),t[16]=O,t[17]=_,t[18]=k):k=t[18];let A;return t[19]!==n||t[20]!==k?(A=(0,X.jsxs)(Pe.Provider,{value:g,children:[n,k]}),t[19]=n,t[20]=k,t[21]=A):A=t[21],A}var Ie=6e4,Le=36e5,Re=864e5;function ze(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Be(e,t,n){let r=t-e;if(r<Ie)return n.justNow;if(r<Le){let e=Math.floor(r/Ie);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=ze(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Re)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*Re){let e=Math.floor(r/Re);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function Ve(e,t,n){let r=ze(t);if(e>=r)return n.today;if(e>=r-Re)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 He(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Ue(e){let t=(0,J.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=w(Ge),d=S(u).automations.suggestions,f=S(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=E(o?`automation-suggestion-coverage`:null,We,m),_=o?h?.automations.find(e=>ve(e,o)):void 0,v=_?G(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=T(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(g,{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]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,X.jsxs)(`section`,{className:e,children:[n,(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,X.jsx)(D,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=T(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ie,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,X.jsxs)(`section`,{className:e,children:[a,o,(0,X.jsxs)(D,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=T(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(g,{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]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(D,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,X.jsxs)(`section`,{className:e,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:q(d.coveredDescription,{name:_.name})})]})]}),(0,X.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,X.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map($)})]}),i]})}let y;t[24]===s?y=t[25]:(y=T(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let C;t[29]===r?C=t[30]:(C=(0,X.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let O;t[31]!==x||t[32]!==C?(O=(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,C]})]}),t[31]=x,t[32]=C,t[33]=O):O=t[33];let k;t[34]!==p||t[35]!==i?(k=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=k):k=t[36];let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==d.create||t[39]!==k?(j=(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsxs)(D,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:k,children:[A,d.create]})}),t[38]=d.create,t[39]=k,t[40]=j):j=t[40];let M;return t[41]!==j||t[42]!==y||t[43]!==O?(M=(0,X.jsxs)(`section`,{className:y,children:[O,j]}),t[41]=j,t[42]=y,t[43]=O,t[44]=M):M=t[44],M}function $(e){return(0,X.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function We(){return W.list()}function Ge(e){return e.language}function Ke(e){let t=(0,J.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(qe),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function qe(e,t){return(0,X.jsx)(`li`,{children:e},`${t}:${e}`)}function Je(e){let t=(0,J.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),z(n,r).then(i=>{if(e=!0,t){ue(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&ue(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Y.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(k,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,X.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function Ye(e){let t=(0,J.c)(39),{noteId:n}=e,r=S(w(Qe)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>se(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=E(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Ze);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Y.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==p?(v=p?(0,X.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,X.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,X.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,X.jsx)(Ke,{values:p.decisions})]}):null,p.actionItems.length>0?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,X.jsx)(Ke,{values:p.actionItems.map(Xe)})]}):null,p.risks.length>0?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,X.jsx)(Ke,{values:p.risks})]}):null,p.openQuestions.length>0?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,X.jsx)(Ke,{values:p.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,X.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,X.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(M,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,X.jsx)(Je,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(M,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,C;t[20]===x?C=t[21]:(C=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=C);let T;t[22]===d.status?T=t[23]:(T=d.status===`needs_attention`?(0,X.jsx)(H,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,X.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=T);let D=d.status===`needs_attention`?d.failureMessage:_,O;t[24]!==T||t[25]!==D?(O=(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[T,D]}),t[24]=T,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==C||t[28]!==O?(k=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,O]}),t[27]=C,t[28]=O,t[29]=k):k=t[29];let A=f.text||r.waitingTranscript,j;t[30]===A?j=t[31]:(j=(0,X.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:A}),t[30]=A,t[31]=j);let N;t[32]!==k||t[33]!==j?(N=(0,X.jsxs)(`section`,{className:`px-6 py-4`,children:[k,j]}),t[32]=k,t[33]=j,t[34]=N):N=t[34];let P;return t[35]!==N||t[36]!==v||t[37]!==y?(P=(0,X.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,N]}),t[35]=N,t[36]=v,t[37]=y,t[38]=P):P=t[38],P}function Xe(e){return e.title}function Ze(e,t){return e.sequence-t.sequence}function Qe(e){return e.language}var $e={edit:fe,ai_edit:oe,sync:he,restore:K};function et(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function tt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=w(e=>e.language),o=S(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:C(a)},{data:c}=E(e?[`note-history`,e]:null,()=>Oe(e)),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(null),h=(0,Y.useCallback)(async t=>{u(!0),m(null);try{await R(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(xe,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,X.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,X.jsx)(b,{className:`size-4`,"aria-hidden":!0})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,X.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,X.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=$e[e.trigger]??fe,i=t===e.timestamp,a=d===e.timestamp;return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:T(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:et(e.trigger,o)}),(0,X.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Be(e.timestamp,g,s)})]}),e.snippet&&(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,X.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,X.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,X.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,X.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,X.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function nt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=S(w(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),{data:v,mutate:y,isLoading:b}=E(e?[`note-agent-context-status`,e]:null,()=>re(e),{revalidateOnFocus:!1}),x=(0,Y.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>V(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Y.useCallback)(async t=>{try{await ne(e,t)}catch{}},[e]);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(oe,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,X.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,X.jsx)(be,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,X.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,X.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,X.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:v.status})]}),(0,X.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,X.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,X.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,X.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,X.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-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,X.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,X.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,X.jsxs)(`li`,{className:`flex gap-2`,children:[(0,X.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,X.jsx)(`span`,{children:e})]},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,X.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,X.jsxs)(`li`,{className:`flex gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,X.jsx)(`span`,{children:e})]},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,X.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,X.jsxs)(`li`,{className:`flex gap-2`,children:[(0,X.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,X.jsx)(`span`,{children:e})]},e))})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,X.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,X.jsxs)(`li`,{className:`flex gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,X.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,X.jsx)(we,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,X.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,X.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(Ce,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,X.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,X.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,X.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,X.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 rt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function it({open:e,onOpenChange:t,note:n}){let r=w(e=>e.language)===`zh`,i=r?st:ct,{data:a,mutate:g}=E(e?[`note-shares`,n.id]:null,()=>F(n.id)),[S,C]=(0,Y.useState)(new Set),[T,O]=(0,Y.useState)(`86400000`),[k,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(``),[N,P]=(0,Y.useState)(!1),[L,R]=(0,Y.useState)(null),[z,ee]=(0,Y.useState)(null),[te,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(null),ne=(0,Y.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,Y.useEffect)(()=>{e&&(C(new Set(ne.map(e=>e.id))),ee(null),B(!1),H(null))},[e,ne]);let U=async()=>{P(!0),H(null);try{ee((await je(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...S],ttlMs:Number(T),maxViews:k.trim()?Number(k):null,description:j.trim()||void 0})).payload.shareUrl),await g()}catch(e){H(e instanceof Error?e.message:String(e))}finally{P(!1)}},re=async(e,t)=>{R(e.id),H(null);try{t===`refresh`?await I(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...S]}):t===`extend`?await ge(e.id,864e5):await De(e.id),await g()}catch(e){H(e instanceof Error?e.message:String(e))}finally{R(null)}},ie=async e=>{H(null);try{if(!await x(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,X.jsx)(f,{open:e,onOpenChange:t,children:(0,X.jsxs)(l,{children:[(0,X.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(u,{className:`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-panel shadow-popover outline-none`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,X.jsx)(de,{className:`size-4`}),i.title]}),(0,X.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,X.jsx)(c,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,X.jsx)(b,{className:`size-4`})})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,X.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,X.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ne.length>0?(0,X.jsxs)(`section`,{className:`mt-5`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,X.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ne.map(e=>(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:S.has(e.id),onChange:()=>C(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:ot(e.size)})]},e.id))})]}):null,(0,X.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,X.jsx)(m,{value:T,onChange:e=>O(e.target.value),children:rt.map(e=>(0,X.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,X.jsx)(`input`,{type:`number`,min:1,max:1e3,value:k,onChange:e=>A(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,X.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,X.jsx)(`input`,{value:j,onChange:e=>M(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`})]})]}),z?(0,X.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(`input`,{readOnly:!0,value:z,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,X.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ie(z),children:[te?(0,X.jsx)(p,{className:`size-4`}):(0,X.jsx)(_,{className:`size-4`}),te?i.copied:i.copy]}),(0,X.jsxs)(D,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(z,`_blank`,`noopener,noreferrer`),children:[(0,X.jsx)(v,{className:`size-4`}),i.open]})]})}):null,V?(0,X.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:V}):null,(a?.items.length??0)>0?(0,X.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,X.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,X.jsx)(at,{share:e,busy:L===e.id,t:i,onCopy:ie,onAction:re},e.id))})]}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,X.jsx)(c,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,children:i.close})}),(0,X.jsxs)(D,{type:`button`,onClick:()=>void U(),disabled:N,children:[N?(0,X.jsx)(y,{className:`size-4 animate-spin`}):(0,X.jsx)(de,{className:`size-4`}),N?i.creating:i.create]})]})]})]})})}function at(e){let t=(0,J.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=T(`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,X.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.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,X.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,X.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 b;t[12]===g?b=t[13]:(b=(0,X.jsx)(`span`,{children:g}),t[12]=g,t[13]=b);let x;t[14]!==b||t[15]!==d||t[16]!==m?(x=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,b]}),t[14]=b,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,X.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,X.jsx)(y,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let E;t[25]!==C||t[26]!==w?(E=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=E):E=t[27];let O;t[28]!==a||t[29]!==n.shareUrl?(O=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(_,{className:`size-3.5`}),t[31]=k):k=t[31];let A;t[32]!==i.copy||t[33]!==O?(A=(0,X.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.copy]}),t[32]=i.copy,t[33]=O,t[34]=A):A=t[34];let j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(v,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==i.open||t[39]!==j?(N=(0,X.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:j,children:[M,i.open]}),t[38]=i.open,t[39]=j,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,X.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,X.jsx)(he,{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]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,X.jsx)(D,{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]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,X.jsxs)(D,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,X.jsx)(Ee,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==A||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[A,N,P,F,I]}),t[58]=A,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==L?(R=(0,X.jsxs)(`div`,{className:l,children:[E,L]}),t[64]=E,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function ot(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var st={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},ct={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.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function lt(e){let t=(0,J.c)(17),{input:n,labels:r}=e,i;t[0]===n?i=t[1]:(i=n(),t[0]=n,t[1]=i);let a=i.source.id,o;t[2]===a?o=t[3]:(o=e=>e.source?.type===`note`&&e.source.id===a&&e.status!==`idle`,t[2]=a,t[3]=o);let s=le(o),c;t[4]===a?c=t[5]:(c=e=>e.source?.type===`note`&&e.source.id===a&&e.status===`preparing`,t[4]=a,t[5]=c);let l=le(c),u=le(ut),d;t[6]!==n||t[7]!==r||t[8]!==l?(d=(0,X.jsx)(ae,{input:n,labels:r,disabled:l,showLabel:!0}),t[6]=n,t[7]=r,t[8]=l,t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==r||t[12]!==u?(f=s?(0,X.jsx)(`button`,{type:`button`,onClick:u,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,X.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0})}):null,t[10]=s,t[11]=r,t[12]=u,t[13]=f):f=t[13];let p;return t[14]!==d||t[15]!==f?(p=(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[d,f]}),t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function ut(e){return e.stop}function dt(e,t){let n=L(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=L(e);return!r||n.split(`
3
- `)[0]===r?n:[r,n].filter(Boolean).join(`
4
-
5
- `)}var ft=()=>i(()=>import(`./block-editor-D0CpUOMo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49])),pt=()=>i(()=>import(`./markdown-editor-BjMTIM-m.js`),__vite__mapDeps([50,1,47,5,51,3])),mt=(0,Y.lazy)(()=>ft().then(e=>({default:e.BlockEditor}))),ht=(0,Y.lazy)(()=>pt().then(e=>({default:e.MarkdownEditor})));function gt(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,X.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,X.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,X.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,X.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function _t(e){let t=(0,J.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ae},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:B},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:U},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;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,X.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&ft(),t===`source`&&pt()},onFocus:()=>{t===`wysiwyg`&&ft(),t===`source`&&pt()},className:T(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,X.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function vt(e){let t=(0,J.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=w(yt),g;t[0]===h?g=t[1]:(g=S(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,X.jsx)(bt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,X.jsx)(Q,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function yt(e){return e.language}function bt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let d=w(e=>e.language),f=S(d).notes,p=S(d).automations.suggestions,m=a(),h=O(e=>e.resolved)===`dark`,{openImage:g}=Fe(),[_,v]=(0,Y.useState)(l),[y,b]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[D,k]=(0,Y.useState)(!1),[A,M]=(0,Y.useState)(``),[F,I]=(0,Y.useState)(360),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(!1),[ne,U]=(0,Y.useState)(null),[re,ie]=(0,Y.useState)(!1),[ae,se]=(0,Y.useState)(null),[ue,fe]=(0,Y.useState)(!1),[he,ge]=(0,Y.useState)(!1),ve=(0,Y.useRef)(!1),we=(0,Y.useRef)(!1),W=(0,Y.useRef)(null),G=(0,Y.useRef)(null),K=(0,Y.useRef)(null),q=(0,Y.useRef)(null),De=(0,Y.useRef)(null),Oe=(0,Y.useRef)(null),Ae=(0,Y.useRef)(null),je=(0,Y.useRef)(null),Ne=(0,Y.useRef)(null),J=ce(e=>e.setPageHeader),Pe=ce(e=>e.clearPageHeader),{data:Z,mutate:Q,error:Ie}=E(e?[`note-detail`,e]:null,()=>ke(e)),{data:Le=[],mutate:Re}=E(e?[`note-threads`,e]:null,()=>P(e),{revalidateOnFocus:!1}),ze=x!==null,Be=(0,Y.useCallback)(e=>{U(`${f.refreshFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)},[f.quickCaptureFailedHint,f.refreshFailed]);(0,Y.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Q().catch(Be)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Q,e,Be]),(0,Y.useEffect)(()=>{ve.current=!1,M(``),C(null),b(null),we.current=!1,Ne.current=null},[e]),(0,Y.useEffect)(()=>{!Z||ve.current||(M(Z.title??``),ve.current=!0)},[Z]),(0,Y.useEffect)(()=>{if(!c||!Z||ze||Ne.current===e)return;let t=window.requestAnimationFrame(()=>{je.current?.focus(),u?.()});return Ne.current=e,()=>window.cancelAnimationFrame(t)},[c,ze,Z,e,u]);let Ve=Z?new Date(Z.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,He=(0,Y.useMemo)(()=>r?(0,X.jsx)(`button`,{type:`button`,onClick:t,"aria-label":f.back,className:T(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Se,i),children:(0,X.jsx)(be,{className:`size-4`,"aria-hidden":!0})}):null,[i,f.back,t,r]),$=(0,Y.useCallback)(()=>{let t=le.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),We=(0,Y.useCallback)(e=>{e!==`preview`&&$(),v(e)},[$]),Ge=(0,Y.useCallback)(t=>{$(),M(t),e&&(q.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){k(!0);try{await te(e,{title:t}),await Q(),n?.()}catch{}finally{k(!1)}}},600))},[$,e,Q,n]),Ke=(0,Y.useMemo)(()=>(0,X.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,Se),children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:A||Ve||void 0,children:A||Ve}),D?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:f.saving}):null]}),[f.saving,D,Ve,A]),qe=(0,Y.useCallback)(async(t=!1)=>{H(!0),U(null);try{let n=await Te(e,{forceNew:t});await Q(),await Re(),m(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){U(`${f.chatOpenFailedTitle}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{H(!1)}},[Q,Re,m,e,f.chatOpenFailedMessage,f.chatOpenFailedTitle]),Je=(0,Y.useCallback)(async()=>{B(!0),U(null);try{await pe(e),await Q()}catch(e){U(`${f.catalysisFailed}: ${e instanceof Error?e.message:f.chatOpenFailedMessage}`)}finally{B(!1)}},[Q,e]),Xe=(0,Y.useCallback)(()=>{b(y===`breakdown`?null:`breakdown`),!Z?.aiDeep?.catalysis?.report&&!z&&Je()},[y,z,Je,Z?.aiDeep?.catalysis?.report]),Ze=(0,Y.useCallback)(()=>{let t=x?x.markdown??``:K.current??Z?.markdown??``,n=x?x.title??``:A,r=dt(n,t);return{source:{type:`note`,id:e,title:n||f.titlePlaceholder},text:r,language:ee(r,d)}},[d,f.titlePlaceholder,Z?.markdown,e,x,A]),Qe=(0,Y.useCallback)(async()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null;let t=K.current,r=q.current;K.current=null,q.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Z??null;k(!0);try{let t=await te(e,i);return await Q(t,{revalidate:!1}),n?.(),t}catch(e){return U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`),null}finally{k(!1)}},[Q,f.saveFailed,f.saveFailedHint,Z,e,n]),$e=(0,Y.useCallback)(async()=>{U(null);let e=await Qe();e&&(se(e),ie(!0))},[Qe]),et=(0,Y.useCallback)(async()=>{if(!(he||D)){fe(!1),ge(!0),U(null),$(),W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current),W.current=null,G.current=null,K.current=null,q.current=null;try{await _e(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){U(`${f.deleteFailed}: ${e instanceof Error?e.message:f.quickCaptureFailedHint}`)}finally{ge(!1)}}},[he,f.deleteFailed,f.quickCaptureFailedHint,e,t,n,D,$]),rt=(0,Y.useMemo)(()=>(0,X.jsxs)(`div`,{className:T(`flex items-center gap-2`,Se),children:[s?(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.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,X.jsx)(ye,{className:`size-4`,"aria-hidden":!0})}):null,(0,X.jsx)(lt,{input:Ze,labels:{read:f.readAloud,preparing:f.readAloudPreparing,pause:f.readAloudPause,resume:f.readAloudResume,retry:f.readAloudRetry,stop:f.readAloudStop}}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>void $e(),className:`inline-flex items-center gap-1.5 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`,children:[(0,X.jsx)(de,{className:`size-3.5`,"aria-hidden":!0}),d===`zh`?`分享`:`Share`]}),(0,X.jsxs)(`button`,{type:`button`,onClick:Xe,disabled:z,"aria-label":f.catalysisSectionTitle,className:T(`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`,y===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),z?f.catalyzing:f.catalyzeButton]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>qe(!1),disabled:V,className:T(`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,X.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),V?f.openingChat:f.openChatButton]}),(0,X.jsx)(_t,{mode:_,onModeChange:We,labels:{edit:f.modeEdit,source:f.modeSource,preview:f.modePreview}}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>b(y===`history`?null:`history`),"aria-label":f.history,className:T(`rounded-lg p-1.5 transition-colors`,y===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,X.jsx)(xe,{className:`size-4`,"aria-hidden":!0})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>fe(!0),disabled:he||D,"aria-label":f.delete,title:f.delete,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-danger-soft hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger disabled:cursor-not-allowed disabled:opacity-50`,children:(0,X.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})})]}),[z,Xe,qe,_,f.history,f.modeEdit,f.modePreview,f.modeSource,V,y,s,f.searchDialogTitle,f.readAloud,f.readAloudPause,f.readAloudPreparing,f.readAloudResume,f.readAloudRetry,f.readAloudStop,We,Ze,$e,he,D,d,f.delete,fe]);(0,Y.useLayoutEffect)(()=>(J({startExtra:He,main:Z?Ke:null,end:Z?rt:null}),()=>{o&&Pe()}),[o,Pe,rt,Ke,He,Z,J]);let at=(0,Y.useCallback)(t=>{e&&($(),K.current=t,W.current&&clearTimeout(W.current),W.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){k(!0),U(null);try{await te(e,{markdown:t}),await Q(),n?.()}catch(e){U(`${f.saveFailed}: ${e instanceof Error?e.message:f.saveFailedHint}`)}finally{k(!1)}}},600))},[$,e,Q,f.saveFailed,f.saveFailedHint,n]),ot=(0,Y.useCallback)(t=>{j(e,t.timestamp).then(e=>{e&&($(),C(e))})},[e,$]),st=(0,Y.useCallback)(()=>{$(),b(null),C(null)},[$]),ct=(0,Y.useCallback)(()=>{$(),b(null),C(null),Q().catch(Be),n?.()},[Q,n,Be,$]);if((0,Y.useEffect)(()=>()=>{W.current&&clearTimeout(W.current),G.current&&clearTimeout(G.current);let t=K.current,n=q.current;K.current=null,q.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&te(e,r).catch(()=>void 0)},[e]),Z===void 0)return Ie?(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,X.jsx)(`p`,{className:`text-sm text-danger`,children:f.home.loadFailed}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void Q().catch(Be),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:f.home.retry}),(0,X.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:f.back})]}):(0,X.jsx)(gt,{});if(Z===null)return(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:f.notFoundTitle}),(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.notFoundDescription}),(0,X.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:f.back})]});let ut=ze?x.title??``:A,ft=ze?x.markdown??``:K.current??Z.markdown??``,pt=new Date(Z.createdAt).getTime(),vt=Number.isFinite(pt)&&Date.now()-pt<3600*1e3?(0,X.jsx)(Ue,{title:p.noteCreatedTitle,description:p.noteCreatedDescription,prompt:p.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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,X.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ne?(0,X.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:ne}):null,(0,X.jsx)(me,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,X.jsx)(me,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,X.jsxs)(`div`,{ref:De,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,X.jsx)(Ye,{noteId:e}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:ze?(0,X.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[ut&&(0,X.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:ut}),ft?(0,X.jsx)(Me,{noteId:e,content:ft,className:`opacity-80`}):(0,X.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]}):(0,X.jsxs)(X.Fragment,{children:[_===`wysiwyg`&&(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,X.jsx)(`input`,{ref:je,type:`text`,value:A,onChange:e=>Ge(e.target.value),onCompositionStart:()=>{we.current=!0},onCompositionEnd:()=>{we.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!we.current&&!t.isComposing&&(e.preventDefault(),(De.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:f.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`}),vt]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gt,{}),children:(0,X.jsx)(mt,{initialContent:Z.markdown??``,onChange:at,noteId:e},`wysiwyg-${e}`)})})]}),_===`source`&&(0,X.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,X.jsx)(`input`,{ref:je,type:`text`,value:A,onChange:e=>Ge(e.target.value),placeholder:f.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`}),vt]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gt,{}),children:(0,X.jsx)(ht,{initialContent:Z.markdown??``,onChange:at,isDark:h},`source-${e}`)})})]}),_===`preview`&&(0,X.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&g(t.currentSrc||t.src,t.alt)},children:[A&&(0,X.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:A}),Z.markdown?(0,X.jsx)(Me,{noteId:e,content:Z.markdown,className:`[&_img]:cursor-zoom-in`}):(0,X.jsx)(`p`,{className:`italic text-fg-muted`,children:f.emptyPreview})]})]})})]})]}),(0,X.jsx)(`div`,{ref:Oe,className:T(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!L&&`transition-[width] duration-300 ease-in-out`),style:{width:y?F:0},children:(0,X.jsxs)(`div`,{ref:Ae,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),R(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,y&&Oe.current?.style.setProperty(`width`,`${s}px`),Ae.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{}R(!1),I(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:T(`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`,L&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:y===`history`?(0,X.jsx)(tt,{noteId:e,activeTimestamp:x?.timestamp??null,onSelect:ot,onClose:st,onRestored:ct}):y===`breakdown`?(0,X.jsx)(nt,{noteId:e,note:Z??null,catalyzing:z,onCatalyze:Je,onClose:()=>b(null),noteThreads:Le,openingChat:V,onOpenChat:()=>qe(!1),onOpenNewChat:()=>qe(!0)}):null})]})})]}),ae?(0,X.jsx)(it,{open:re,onOpenChange:ie,note:ae}):null,(0,X.jsx)(N,{open:ue,title:f.deleteConfirmTitle,description:f.deleteConfirmDescription.replace(`{{title}}`,Z.title||f.titlePlaceholder),confirmLabel:f.deleteConfirmLabel,cancelLabel:f.deleteCancelLabel,destructive:!0,onConfirm:()=>void et(),onCancel:()=>fe(!1)})]})}export{Fe as a,Be as i,He as n,Ve as r,vt as t};
@@ -1,8 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,d as a,l as o,p as ee}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as s}from"./popover-select-C-Hj-nXR.js";import{d as c}from"./markdown-view-Ca7BRBLL.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-C72stReU.js";import{d as p,n as m,s as h}from"./locale-store-BkeaPZpn.js";import{t as g}from"./cn-JdwAhgNB.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./skeleton-BwbyijEw.js";import{$c as y,Cl as te,Dc as ne,Di as b,Ln as x,On as re,Rn as S,Rs as C,Tn as w,Us as ie,Va as T,Vn as E,Yl as D,bc as O,bn as k,cu as A,dn as ae,du as j,ec as oe,fi as se,fl as ce,fn as le,fu as ue,gn as de,io as fe,kn as M,ks as pe,lu as N,mn as me,mu as he,nu as ge,pn as _e,tc as P,va as F,vn as ve,wc as ye,yl as be}from"./index-C7RDs6S-.js";import{i as xe,t as I}from"./note-detail-panel-EeVeF4II.js";var L=e(t(),1),R=n();async function z(e){e.note??=await ve({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 S(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,` `)}](${E(t,e.id)})`);e.note=await x(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
-
3
- `)}`})}return{noteId:t,sessionKey:(await M(t,{projectId:e.projectId})).sessionKey}}function Se(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var B=r(),V={meeting:A,requirements:be,research:P,weekly:D};function Ce({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:ee}){let c=i.home,u=o(),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(null),[_,v]=(0,L.useState)([]),[y,te]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),[re,S]=(0,L.useState)(``),C=(0,L.useRef)(null),w=(0,L.useRef)(!1),T=(0,L.useRef)(null),E=(0,L.useRef)(null),D=y||!!C.current,k=m?c.templateOptions[m]:null,A=!!(f.trim()||_.length);async function ae(){if(!(w.current||!A&&!C.current)){w.current=!0,te(!0),x(null),C.current??={requestId:crypto.randomUUID(),title:f.trim().split(`
4
- `)[0]?.slice(0,80)||k?.label||i.titlePlaceholder,markdown:`## ${c.requestHeading}\n\n${k?`${k.prompt}\n`:``}${f.trim()}`,projectId:t||void 0,files:[..._],attachments:[],materialHeading:c.materialsHeading};try{let e=await z(C.current);r(),u(Se(e.sessionKey,e.noteId,c.agentPrompt))}catch(e){C.current.note&&r(),x(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{w.current=!1,te(!1)}}}function j(){C.current=null,x(null),p(``),v([]),h(null),E.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":c.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),ae()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:D,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),c.askLabel]}),k?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[k.label,` · `]}),k.prompt.split(`
5
-
6
- `)[0]]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>h(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(d,{className:`size-3.5`})})]}):null,(0,B.jsx)(`textarea`,{ref:E,id:`notes-home-prompt`,value:f,onChange:e=>p(e.target.value),placeholder:k?k.prompt.split(`
7
-
8
- `).at(-1):c.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),ae())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),_.length?(0,B.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:_.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,B.jsx)(O,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${c.removeMaterial}: ${e.name}`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(d,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,B.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,B.jsx)(s,{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,B.jsx)(ce,{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:D,loading:a,statusMessage:ee?c.projectsLoadFailed:void 0,searchPlaceholder:c.projectSearch,searchValue:re,onSearchChange:S})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>T.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,B.jsx)(O,{className:`size-4`,"aria-hidden":!0}),c.addMaterials]}),(0,B.jsx)(`input`,{ref:T,type:`file`,multiple:!0,className:`hidden`,"aria-label":c.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);v(e=>[...e,...t]),e.target.value=``}})]})]}),(0,B.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,B.jsxs)(`button`,{type:`submit`,disabled:y||!C.current&&!A,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-white 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:[y?(0,B.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(N,{className:`size-4`,"aria-hidden":!0}),y?c.creating:b?c.retry:c.agentCreate]})})]}),b?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,B.jsx)(`p`,{children:b}),C.current?.note?(0,B.jsx)(`p`,{className:`mt-1`,children:c.partialFailure}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[C.current?.note?(0,B.jsx)(`button`,{type:`button`,onClick:()=>u(`/notes/${encodeURIComponent(C.current.note.id)}?edit=1`),className:`underline`,children:c.openSavedDraft}):null,(0,B.jsx)(`button`,{type:`button`,onClick:j,className:`underline`,children:c.newRequest})]})]}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-1 gap-y-1 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{className:`mr-1 py-2`,children:c.templates}),Object.keys(V).map(e=>{let t=V[e];return(0,B.jsxs)(`button`,{type:`button`,disabled:D,"aria-pressed":m===e,onClick:()=>{h(m===e?null:e),E.current?.focus()},className:g(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,m===e&&`bg-accent-soft text-accent-fg`),children:[(0,B.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),c.templateOptions[e].label]},e)}),(0,B.jsxs)(`button`,{type:`button`,disabled:y,onClick:()=>F(),className:`ml-auto inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover`,children:[(0,B.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),c.recordDiscussion]})]})]})}function we(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Te(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}var H=`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 U(){let e=m(e=>e.language),t=f(e).notes,n=t.home,r=h(e=>e.token),a=T(e=>e.setPageHeader),c=T(e=>e.clearPageHeader),d=o(),{pathname:ne,search:S}=i(),[E,D]=ee(),O=E.get(`projectId`)||``,M=E.get(`view`)||`all`,N=E.get(`unassigned`)===`true`||M===`unassigned`,P=E.get(`search`)||``,[F]=se(P,250),[I,R]=(0,L.useState)(O),[z,Se]=(0,L.useState)(``),[V,U]=(0,L.useState)(null),[W,Ee]=(0,L.useState)(!1),[De,Oe]=(0,L.useState)(new Set),[ke,Ae]=(0,L.useState)(null),[je,Me]=(0,L.useState)(null),G=(0,L.useRef)(new Set),K=(0,L.useRef)(null),Ne=(0,L.useRef)(!1),Pe=(0,L.useRef)(null),Fe=we(E,F),q=(Fe.offset??0)/12,{data:Ie,error:Le,isLoading:Re,mutate:ze}=_(r?[`notes-home`,r,Fe]:null,()=>re(Fe)),{data:Be,error:Ve,isLoading:J,mutate:He}=_(r?[`notes-home-projects`,r]:null,w),Y=Be?.items??[],Ue=Y.find(e=>e.id===O)?.name??n.projectNotes,We=Ie?.items??[],X=Ie?.total??0,Ge=Re||P!==F,Ke=(0,L.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:p(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[qe,Je]=(0,L.useState)(()=>Date.now());(0,L.useEffect)(()=>{R(O)},[O]),(0,L.useEffect)(()=>{let e=window.setInterval(()=>Je(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Z=(0,L.useCallback)(()=>{ze().catch(()=>void 0),He().catch(()=>void 0)},[ze,He]);(0,L.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 Ye=(0,L.useCallback)((e,t=!1)=>{let n=`${ne}${S}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),d(`/notes/${encodeURIComponent(e)}?${r}`)},[ne,S,d]),Q=(0,L.useCallback)(async()=>{if(!(Ne.current||!r)){Ne.current=!0,Ee(!0),U(null),K.current??={key:crypto.randomUUID(),projectId:I||void 0};try{let e=await ve({markdown:``,kind:`thought`,projectId:K.current.projectId},K.current.key);K.current=null,Z(),Ye(e.id,!0)}catch(e){U(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Ne.current=!1,Ee(!1)}}},[I,t.createBlankFailed,t.createBlankFailedHint,Ye,Z,r]),Xe=(0,L.useCallback)(e=>{D(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[D]);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),R(e),D(n)}function Ze(e){D(t=>{let n=new URLSearchParams(t);return N&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function Qe(e,n){if(!G.current.has(e)){G.current.add(e),Oe(new Set(G.current)),U(null);try{await x(e,{pinned:n}),Z()}catch(e){U(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{G.current.delete(e),Oe(new Set(G.current))}}}async function $e(){let e=ke;if(!(!e||je)){Ae(null),Me(e.id),U(null);try{await k(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Z()}catch(e){U(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Me(null)}}}if((0,L.useLayoutEffect)(()=>{if(!r){c();return}return a({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,B.jsxs)(`div`,{className:g(`flex min-w-0 items-center gap-2`,fe),children:[(0,B.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,B.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:Pe,type:`search`,value:P,onChange:e=>Xe(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`})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void Q(),disabled:W,"aria-label":n.blankNote,className:g(H,`border border-edge bg-surface-panel text-fg`),children:[W?(0,B.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(u,{className:`size-4`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:n.blankNote})]})]})}),()=>c()},[c,Q,W,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,P,a,Xe,r]),(0,L.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(),Pe.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Q]),!r)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let et=[{id:`all`,label:n.homeNav,Icon:ye},{id:`favorites`,label:n.favorites,Icon:C},{id:`unassigned`,label:n.unassigned,Icon:y},{id:`archived`,label:t.filterArchived,Icon:he}],tt=O?`project:${O}`:N?`unassigned`:`all`;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,B.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[et.map(({id:e,label:t,Icon:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>$(``,e),"aria-current":!O&&(e===`unassigned`?N:!N&&M===e)?`page`:void 0,className:g(H,`justify-start px-2 text-left text-xs`,!O&&(e===`unassigned`?N:!N&&M===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,B.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),J?[0,1,2].map(e=>(0,B.jsx)(v,{className:`mb-2 h-8 w-full`},e)):Y.slice(0,8).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),"aria-current":O===e.id?`page`:void 0,className:g(H,`justify-start px-2 text-left text-xs`,O===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(ce,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:g(H,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,B.jsx)(j,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,B.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,B.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl px-4 py-7 sm:px-8 lg:px-10 lg:py-9`,children:[(0,B.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`break-words text-2xl font-semibold tracking-tight text-fg`,children:O?Ue:N?n.unassigned:n.homeTitle}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:O?n.projectDescription:n.homeDescription})]}),O?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects/${encodeURIComponent(O)}`),className:g(H,`text-xs`),children:[n.openProject,(0,B.jsx)(j,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),V?(0,B.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:V}):null,(0,B.jsx)(Ce,{projects:Y,projectId:I,onProjectChange:R,onCreated:Z,labels:t,projectsLoading:J,projectsError:!!Ve}),Ve?(0,B.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,B.jsx)(`span`,{children:n.projectsLoadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void He().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,!O&&!N&&(J||Y.length>0)?(0,B.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:J?[0,1,2].map(e=>(0,B.jsx)(v,{className:`h-28 w-full`},e)):Y.slice(0,3).map(e=>(0,B.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,B.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,B.jsx)(ce,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,B.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,B.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,B.jsx)(`span`,{children:e.updatedAt?xe(e.updatedAt,qe,Ke):n.emptyProject})]})]},e.id))})]}):null,(0,B.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O?n.projectNotes:n.recentNotes}),(0,B.jsx)(`div`,{className:`w-48 max-w-full`,children:(0,B.jsx)(s,{value:tt,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(z.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:O?Ue:N?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:J,searchPlaceholder:n.projectSearch,searchValue:z,onSearchChange:Se,onChange:e=>$(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge`,"aria-label":t.libraryTitle,children:[[{id:`all`,label:t.filterAll},{id:`agent`,label:n.agentEdited},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===e||e===`all`&&M===`unassigned`,onClick:()=>Ze(e),className:g(`border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(M===e||e===`all`&&M===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,B.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Le?(0,B.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void ze().catch(()=>void 0),className:g(H,`mt-2`),children:n.retry})]}):Ge?(0,B.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,B.jsx)(v,{className:`h-10 w-8 shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,B.jsx)(v,{className:`h-4 w-2/3`}),(0,B.jsx)(v,{className:`h-3 w-1/2`})]})]},e))}):We.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,B.jsx)(ye,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,B.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:P||M!==`all`&&M!==`unassigned`?n.noMatches:O?n.projectEmpty:n.emptyTitle}),(0,B.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:P||M!==`all`&&M!==`unassigned`?n.noMatchesHint:O?n.projectEmptyHint:n.emptyDescription})]}):(0,B.jsx)(`ul`,{className:`divide-y divide-edge`,children:We.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?A:e.kind===`bookmark`?ge:be,i=Te(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,B.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Ye(e.id),className:`flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg group-hover:text-accent-fg`,children:e.title||t.titlePlaceholder}),(0,B.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,B.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,B.jsx)(ie,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,B.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,B.jsx)(`span`,{className:`truncate`,children:i})]})]})]}),(0,B.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:xe(e.updatedAt,qe,Ke)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void Qe(e.id,!e.pinned),disabled:De.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${e.title||t.titlePlaceholder}`,"aria-pressed":!!e.pinned,className:`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,B.jsx)(C,{className:g(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,B.jsxs)(me,{children:[(0,B.jsx)(de,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,disabled:je===e.id,"aria-label":`${t.noteActions}: ${e.title||t.titlePlaceholder}`,className:`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:je===e.id?(0,B.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(te,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(_e,{children:(0,B.jsx)(ae,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,B.jsxs)(le,{className:`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:()=>Ae(e),children:[(0,B.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!Ge&&!Le&&X>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(X))}),X>12||q>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:q===0,className:H,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(q-1)),t}),children:(0,B.jsx)(ue,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{children:[q+1,` / `,Math.max(1,Math.ceil(X/12))]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(q+1)*12>=X,className:H,onClick:()=>D(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(q+1)),t}),children:(0,B.jsx)(j,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]})]})}),(0,B.jsx)(b,{open:ke!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,ke?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void $e(),onCancel:()=>Ae(null)})]})}function W(){let e=(0,R.c)(12),{noteId:t}=a(),n=o(),[r]=ee(),i;e[0]===r?i=e[1]:(i=c(r.get(`returnTo`),`/notes`,[`/chat`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=i);let s=i,l;e[2]!==n||e[3]!==s?(l=()=>{n(s)},e[2]=n,e[3]=s,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,B.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,B.jsx)(I,{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 Ee(){let e=(0,R.c)(2),{noteId:t}=a(),n;return e[0]===t?n=e[1]:(n=t?(0,B.jsx)(W,{}):(0,B.jsx)(U,{}),e[0]=t,e[1]=n),n}export{Ee as NotesPage};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,f as o,g as s,h as c,i as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./es2015-BvLh9GaE.js";import{i as _,n as v}from"./dist-CxGUk8J-.js";import{t as y}from"./createLucideIcon-DPHK1VkS.js";import{t as b}from"./check-DUBLcKHA.js";import{t as x}from"./cn-JdwAhgNB.js";import{a as S,i as C,n as w,r as T,t as E}from"./dist-DBS3OB8K.js";import{t as D}from"./skeleton-BwbyijEw.js";import{a as O,s as k,t as A}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as ee,r as j}from"./settings-shell-layer-context-DCp6ykjQ.js";var M=y(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),te=r(),N=t({Anchor:()=>he,Arrow:()=>_e,Close:()=>ge,Content:()=>Q,Popover:()=>B,PopoverAnchor:()=>V,PopoverArrow:()=>J,PopoverClose:()=>q,PopoverContent:()=>K,PopoverPortal:()=>W,PopoverTrigger:()=>H,Portal:()=>Z,Root:()=>Y,Trigger:()=>X,createPopoverScope:()=>ne}),P=e(n(),1),F=i(),I=`Popover`,[L,ne]=c(I,[S]),R=S(),[re,z]=L(I),B=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:s=!1}=e,c=R(t),l=P.useRef(null),[u,d]=P.useState(!1),[p,m]=o({prop:r,defaultProp:i??!1,onChange:a,caller:I});return(0,F.jsx)(C,{...c,children:(0,F.jsx)(re,{scope:t,contentId:f(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:P.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:P.useCallback(()=>d(!0),[]),onCustomAnchorRemove:P.useCallback(()=>d(!1),[]),modal:s,children:n})})};B.displayName=I;var ie=`PopoverAnchor`,V=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(ie,n),a=R(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return P.useEffect(()=>(o(),()=>s()),[o,s]),(0,F.jsx)(E,{...a,...r,ref:t})});V.displayName=ie;var ae=`PopoverTrigger`,H=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(ae,n),a=R(n),o=_(t,i.triggerRef),c=(0,F.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":me(i.open),...r,ref:o,onClick:s(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,F.jsx)(E,{asChild:!0,...a,children:c})});H.displayName=ae;var U=`PopoverPortal`,[oe,se]=L(U,{forceMount:void 0}),W=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=z(U,t);return(0,F.jsx)(oe,{scope:t,forceMount:n,children:(0,F.jsx)(l,{present:n||o.open,children:(0,F.jsx)(a,{asChild:!0,container:i,children:r})})})};W.displayName=U;var G=`PopoverContent`,K=P.forwardRef((e,t)=>{let n=se(G,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=z(G,e.__scopePopover);return(0,F.jsx)(l,{present:r||a.open,children:a.modal?(0,F.jsx)(le,{...i,ref:t}):(0,F.jsx)(ue,{...i,ref:t})})});K.displayName=G;var ce=v(`PopoverContent.RemoveScroll`),le=P.forwardRef((e,t)=>{let n=z(G,e.__scopePopover),r=P.useRef(null),i=_(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,F.jsx)(u,{as:ce,allowPinchZoom:!0,children:(0,F.jsx)(de,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ue=P.forwardRef((e,t)=>{let n=z(G,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(de,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),de=P.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,h=z(G,n),g=R(n);return p(),(0,F.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(m,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,F.jsx)(T,{"data-state":me(h.open),role:`dialog`,id:h.contentId,...g,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),fe=`PopoverClose`,q=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(fe,n);return(0,F.jsx)(g.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});q.displayName=fe;var pe=`PopoverArrow`,J=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(n);return(0,F.jsx)(w,{...i,...r,ref:t})});J.displayName=pe;function me(e){return e?`open`:`closed`}var Y=B,he=V,X=H,Z=W,Q=K,ge=q,_e=J;function ve(e,t=!1){if(!t)return A;switch(e){case`modal`:return O;case`page`:return k;default:return`z-50`}}function ye({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:a=!1,disabledValues:o,disabled:s,id:c,ariaLabel:l,ariaLabelledBy:u,title:d,triggerClassName:f,triggerIcon:p,contentClassName:m,side:h=`bottom`,align:g=`start`,onChange:_,searchPlaceholder:v,searchValue:y,onSearchChange:S,loading:C=!1,statusMessage:w,selectedLabel:T}){let[E,O]=(0,P.useState)(!1),k=ee(),A=j(),te=ve(k,A!==null),N=t.find(t=>t.value===e),I=T??N?.label??(e?`${e} · unavailable`:n),L;return(0,F.jsxs)(Y,{open:E,onOpenChange:O,children:[(0,F.jsx)(X,{asChild:!0,children:(0,F.jsxs)(`button`,{id:c,type:`button`,"aria-label":l,"aria-labelledby":u,title:d,disabled:s,className:x(`box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-subtle px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:border-edge-strong`,s&&`cursor-not-allowed opacity-50 hover:border-edge`,f),children:[p,(0,F.jsx)(`span`,{className:x(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:I}),(0,F.jsx)(M,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,F.jsx)(Z,{container:A??void 0,children:(0,F.jsxs)(Q,{side:h,align:g,sideOffset:4,className:x(te,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] overflow-hidden rounded-lg border border-edge bg-surface-panel p-1 shadow-popover outline-none`,m),children:[v?(0,F.jsx)(`input`,{type:`search`,"aria-label":v,placeholder:v,value:y,onChange:e=>S?.(e.target.value),className:`mb-1 w-full rounded-md bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,(0,F.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[r?(0,F.jsxs)(`button`,{type:`button`,disabled:a,className:x(`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,a&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{a||(_(``),O(!1))},children:[(0,F.jsx)(b,{className:x(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,C?(0,F.jsx)(`div`,{className:`space-y-2 p-2`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,F.jsx)(D,{className:`h-8 w-full`},e))}):null,w&&!C?(0,F.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-fg-muted`,children:w}):null,(C?[]:t).map(t=>{let n=t.disabled===!0||o?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==L;return L=t.group,(0,F.jsxs)(P.Fragment,{children:[r?(0,F.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,F.jsxs)(`button`,{type:`button`,disabled:n,className:x(`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(_(t.value),O(!1))},children:[t.icon??(0,F.jsx)(b,{className:x(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),t.icon?(0,F.jsx)(b,{className:x(`ml-auto size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":!0}):null]})]},`${t.group??``}:${t.value}`)})]})]})})]})}function $(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map($).join(``):(0,P.isValidElement)(e)?$(e.props.children):``}function be(e,t){let n=[];return P.Children.forEach(e,e=>{if(!(0,P.isValidElement)(e))return;if(e.type===P.Fragment){n.push(...be(e.props.children,t));return}if(e.type===Se){let t=e.props;n.push(...be(t.children,$(t.label)));return}if(e.type!==xe)return;let r=e.props,i=$(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function xe(e){return null}function Se(e){return null}function Ce(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function we(e){let t=(0,te.c)(66),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:o,id:s,onChange:c,placeholder:l,side:d,triggerClassName:f,value:p,...u}=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,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m=(0,P.useId)(),h=p==null?``:String(p),g,_,v,y,b,S,C,w,T,E;if(t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==m||t[17]!==s||t[18]!==l||t[19]!==u.name||t[20]!==h){let e=be(r);y=e.find(Ee),_=y!==void 0,v=y?.label||l||``,w=o||void 0,t[31]===i?T=t[32]:(T=Ce(i),t[31]=i,t[32]=T),E=u.name,g=ye,b=s??m,S=h,C=e.filter(Te),t[13]=r,t[14]=i,t[15]=o,t[16]=m,t[17]=s,t[18]=l,t[19]=u.name,t[20]=h,t[21]=g,t[22]=_,t[23]=v,t[24]=y,t[25]=b,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else g=t[21],_=t[22],v=t[23],y=t[24],b=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D=l??v,O=y?.disabled===!0,k=u[`aria-label`],A=u[`aria-labelledby`],ee=u.title,j;t[33]!==i||t[34]!==f?(j=x(i,f),t[33]=i,t[34]=f,t[35]=j):j=t[35];let M;t[36]===c?M=t[37]:(M=e=>c?.({target:{value:e},currentTarget:{value:e}}),t[36]=c,t[37]=M);let N;t[38]!==g||t[39]!==n||t[40]!==_||t[41]!==a||t[42]!==o||t[43]!==v||t[44]!==u.title||t[45]!==d||t[46]!==b||t[47]!==A||t[48]!==j||t[49]!==M||t[50]!==S||t[51]!==C||t[52]!==D||t[53]!==O||t[54]!==k?(N=(0,F.jsx)(g,{id:b,value:S,options:C,placeholder:D,allowEmpty:_,emptyLabel:v,emptyDisabled:O,disabled:o,ariaLabel:k,ariaLabelledBy:A,title:ee,side:d,align:n,triggerClassName:j,contentClassName:a,onChange:M}),t[38]=g,t[39]=n,t[40]=_,t[41]=a,t[42]=o,t[43]=v,t[44]=u.title,t[45]=d,t[46]=b,t[47]=A,t[48]=j,t[49]=M,t[50]=S,t[51]=C,t[52]=D,t[53]=O,t[54]=k,t[55]=N):N=t[55];let I;t[56]!==o||t[57]!==u.name||t[58]!==h?(I=(0,F.jsx)(`input`,{name:u.name,value:h,readOnly:!0,hidden:!0,disabled:o}),t[56]=o,t[57]=u.name,t[58]=h,t[59]=I):I=t[59];let L;return t[60]!==N||t[61]!==I||t[62]!==w||t[63]!==T||t[64]!==E?(L=(0,F.jsxs)(`div`,{"aria-disabled":w,className:T,"data-select-name":E,children:[N,I]}),t[60]=N,t[61]=I,t[62]=w,t[63]=T,t[64]=E,t[65]=L):L=t[65],L}function Te(e){return e.value!==``}function Ee(e){return e.value===``}export{_e as a,Z as c,N as d,M as f,ve as i,Y as l,we as n,ge as o,xe as r,Q as s,ye as t,X as u};