@xopcai/xopc 0.0.222 → 0.0.224

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 (213) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-NItGQmvR.js → activity-store--GBciH10.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DsR_2U9-.js → agent-avatar-dicebear-K7V4XXt7.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-BsxTpXyq.js +68 -0
  7. package/dist/gateway/static/root/assets/{api-53ZXsuyr.js → api-HoIz_ija.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BCzVX09V.js → app-management-settings-panel-xQCmkAHh.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-DgSpwqQI.js → appearance-settings-BRoeA4kU.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-BXgpBA8w.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-D8o8CP9Y.js → archive-plugin-CteCVsBP.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-BQHcAR6J.js → attachment-load-D7xNA2jB.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-CswK3HFb.js → automations-page-BD1vK7r5.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-wrgf-z7D.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-BlpyTJ1b.js → binary-plugins-C3DaJa0W.js} +1 -1
  16. package/dist/gateway/static/root/assets/block-editor-lTkcHTve.js +184 -0
  17. package/dist/gateway/static/root/assets/browser-settings-page-zhzNkeVG.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-Bi6RSSpD.js → browser-workflow-inputs-1UZ0vnIy.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-CZNOOQY4.js → browser-workflows-page-BHuJOF4M.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DuCmg2Ej.js +7 -0
  21. package/dist/gateway/static/root/assets/{capability-presets-api-pC2fno7r.js → capability-presets-api-yNqTIuyd.js} +1 -1
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DjiP3mQQ.js +3 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-B5Szgu_z.js → channel-recipient-api-krezGsKc.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-B4AtvQHk.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-DMxB7slL.js +1 -0
  26. package/dist/gateway/static/root/assets/{chat-terminal-dock-2fpzufzt.js → chat-terminal-dock-BRrL2iHA.js} +2 -2
  27. package/dist/gateway/static/root/assets/connectors-page-fmda2NEP.js +2 -0
  28. package/dist/gateway/static/root/assets/{cron-expression-VePLfPUR.js → cron-expression-Bl-2DzBQ.js} +1 -1
  29. package/dist/gateway/static/root/assets/{date-picker-CJegmPTJ.js → date-picker-CxTl6Wlz.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dependency-picker-B2o9unBk.js → dependency-picker-DSl0mOPa.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-BH4Np-ay.js → desktop-pet-DTeCmCdb.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-Duu3ctxD.js → desktop-pet-settings-BNebxg0V.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-BBCUZOg2.js → directory-picker-path-field-Dn9XpmXY.js} +1 -1
  34. package/dist/gateway/static/root/assets/dist-DaxPZj9e.js +1 -0
  35. package/dist/gateway/static/root/assets/{dist-DY4Af0fY.js → dist-J_ySZvz0.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-debug-page-DS_o3F97.js → extension-debug-page-D-J-eOTb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-page-BTLBZdCq.js → extension-page-CpST24nU.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-settings-page-KTGrYbgk.js → extension-settings-page-4nQXFnFq.js} +1 -1
  39. package/dist/gateway/static/root/assets/floating-ui.dom-B7uQOZZW.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-config-api-D3YJVfzY.js → gateway-config-api-BHWHduDi.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-BzTbnu4O.js → gateway-config-swr-yUxMMVjK.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-settings-B8--s3yC.js → gateway-settings-BimMKmkM.js} +1 -1
  43. package/dist/gateway/static/root/assets/{gateway-startup-retry-B2zpkNvi.js → gateway-startup-retry-9mrsL84j.js} +1 -1
  44. package/dist/gateway/static/root/assets/heartbeat-settings-MUJ3mEC9.js +1 -0
  45. package/dist/gateway/static/root/assets/home-page-DSM6aPHF.js +1 -0
  46. package/dist/gateway/static/root/assets/{image-generation-api-BXRjz-iY.js → image-generation-api-CgFAGDi8.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-B3zYJBhK.js +74 -0
  48. package/dist/gateway/static/root/assets/index-D3_xSYKd.css +2 -0
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D-Ib-suu.js → keyboard-shortcuts-settings-6Ar5rfX4.js} +1 -1
  50. package/dist/gateway/static/root/assets/local-app-workbench-page-tzM0wTL8.js +2 -0
  51. package/dist/gateway/static/root/assets/{local-apps-page-Bsy1lvAc.js → local-apps-page-B5n-x544.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-iKjqemWG.js → locale-store-CPylQjH9.js} +1 -1
  53. package/dist/gateway/static/root/assets/logs-page-CgoQlera.js +2 -0
  54. package/dist/gateway/static/root/assets/{management-settings-D-akydG4.js → management-settings-CXBLyU-0.js} +1 -1
  55. package/dist/gateway/static/root/assets/{markdown-split-DHH4Cu2i.js → markdown-split-CtmQemJi.js} +1 -1
  56. package/dist/gateway/static/root/assets/markdown-view-CUsob4Pz.js +69 -0
  57. package/dist/gateway/static/root/assets/{media-plugins-BwHtUXkj.js → media-plugins-Dsd-IEOW.js} +1 -1
  58. package/dist/gateway/static/root/assets/messages-B82nsi9k.js +3 -0
  59. package/dist/gateway/static/root/assets/notes-api-CfKZYrBC.js +1 -0
  60. package/dist/gateway/static/root/assets/{notes-page-BxM1p6hz.js → notes-page-BKbOTE2n.js} +1 -1
  61. package/dist/gateway/static/root/assets/notes-workbench-BScELo01.js +4 -0
  62. package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +1 -0
  63. package/dist/gateway/static/root/assets/{popover-select-BzdnTy3h.js → popover-select-CccGri5Y.js} +1 -1
  64. package/dist/gateway/static/root/assets/{product-open-page-DrfWH1ir.js → product-open-page-DqB9bsDB.js} +1 -1
  65. package/dist/gateway/static/root/assets/project-detail-page-DUoyty8X.js +1 -0
  66. package/dist/gateway/static/root/assets/projects-page-PeXUdGdO.js +1 -0
  67. package/dist/gateway/static/root/assets/{registry-api-Cx3JxXSL.js → registry-api-B_5D8epF.js} +1 -1
  68. package/dist/gateway/static/root/assets/remote-access-hub-sHho-uXP.js +1 -0
  69. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DF7syQRd.js → runtime-tools-settings-panel-DBTH_t0O.js} +1 -1
  70. package/dist/gateway/static/root/assets/{schema-form-BQ_qRIsM.js → schema-form-CqMKAwV0.js} +1 -1
  71. package/dist/gateway/static/root/assets/sessions-page-DyvNgaP9.js +1 -0
  72. package/dist/gateway/static/root/assets/settings-advanced-gate-CnYf1R7z.js +1 -0
  73. package/dist/gateway/static/root/assets/{settings-form-section-BBHGOQHU.js → settings-form-section-dPriuuYq.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CiwjP2-b.js → settings-loading-skeleton-B-Mbm8Va.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-Rl9waapk.js → settings-page-Dyj3w-Ml.js} +1 -1
  76. package/dist/gateway/static/root/assets/setup-status-panel-C4FxY5J3.js +1 -0
  77. package/dist/gateway/static/root/assets/share-preview-page-emEdx7YL.js +2 -0
  78. package/dist/gateway/static/root/assets/shares-settings-BQBVq-sN.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-BFoEpQ4I.js +1 -0
  80. package/dist/gateway/static/root/assets/{skills-page-YbtR_zEU.js → skills-page-BNtYnrRT.js} +1 -1
  81. package/dist/gateway/static/root/assets/{skills-page.utils-DTmx2Zza.js → skills-page.utils-DjnbNFs5.js} +1 -1
  82. package/dist/gateway/static/root/assets/{system-settings-panel-BZDJcKdS.js → system-settings-panel-DDStf-jZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/task-detail-page-ZVwr8KbS.js +1 -0
  84. package/dist/gateway/static/root/assets/{theme-store-BOD2D0dJ.js → theme-store-BN-32Fz5.js} +1 -1
  85. package/dist/gateway/static/root/assets/{use-autosave-Be9aR9qA.js → use-autosave-C2mKZ-ua.js} +1 -1
  86. package/dist/gateway/static/root/assets/user-context-page-CHjIinCW.js +1 -0
  87. package/dist/gateway/static/root/assets/{voice-api-key-field-IMc3Ua6C.js → voice-api-key-field-D7OHeQby.js} +1 -1
  88. package/dist/gateway/static/root/assets/{work-discovery-overlay-TC-xQenr.js → work-discovery-overlay-CIiXie7F.js} +1 -1
  89. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-B2auxcRv.js → workflow-run-setup-panel-9_dAGW3_.js} +2 -2
  90. package/dist/gateway/static/root/assets/workflows-page-DXpYJxao.js +5 -0
  91. package/dist/gateway/static/root/index.html +15 -14
  92. package/dist/package.js +1 -1
  93. package/dist/src/agent/agent-instance-gateway.d.ts +3 -0
  94. package/dist/src/agent/agent-manager.d.ts +3 -0
  95. package/dist/src/agent/agent-manager.js +30 -24
  96. package/dist/src/agent/embedded/index.d.ts +1 -1
  97. package/dist/src/agent/embedded/index.js +2 -2
  98. package/dist/src/agent/embedded/run-for-session.js +101 -62
  99. package/dist/src/agent/embedded/run-turn.js +56 -28
  100. package/dist/src/agent/embedded/runs.d.ts +16 -29
  101. package/dist/src/agent/embedded/runs.js +44 -65
  102. package/dist/src/agent/embedded/types.d.ts +4 -0
  103. package/dist/src/agent/orchestration/agent-run-supervisor.d.ts +28 -0
  104. package/dist/src/agent/orchestration/agent-run-supervisor.js +49 -0
  105. package/dist/src/agent/orchestration/agent-turn-policy.d.ts +18 -0
  106. package/dist/src/agent/orchestration/agent-turn-policy.js +36 -0
  107. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +5 -0
  108. package/dist/src/agent/orchestration/llm-turn-retry.js +34 -4
  109. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +10 -1
  110. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +25 -4
  111. package/dist/src/agent/service/async-queue.d.ts +16 -3
  112. package/dist/src/agent/service/async-queue.js +29 -11
  113. package/dist/src/agent/service/process-direct-streaming.js +27 -4
  114. package/dist/src/agent/service.js +1 -0
  115. package/dist/src/agent/tools/exec-command.d.ts +2 -0
  116. package/dist/src/agent/tools/exec-command.js +70 -7
  117. package/dist/src/auth/oauth/index.js +3 -3
  118. package/dist/src/auth/oauth/registry.d.ts +2 -0
  119. package/dist/src/auth/oauth/registry.js +20 -12
  120. package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
  121. package/dist/src/auth/oauth/xopc-cloud.js +32 -16
  122. package/dist/src/cli/commands/channels.js +1 -1
  123. package/dist/src/cli/commands/connectors.js +1 -1
  124. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  125. package/dist/src/cli/commands/models.js +1 -1
  126. package/dist/src/cli/commands/onboard.js +1 -1
  127. package/dist/src/cli/commands/tunnel.js +4 -5
  128. package/dist/src/config/agent-profile.js +1 -1
  129. package/dist/src/config/schema.d.ts +18 -0
  130. package/dist/src/config/schema.js +19 -1
  131. package/dist/src/extensions/sdk/index.js +1 -1
  132. package/dist/src/gateway/agents-admin.js +1 -1
  133. package/dist/src/gateway/hono/app.js +2 -1
  134. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  135. package/dist/src/gateway/hono/oauth-async.js +11 -4
  136. package/dist/src/gateway/hono/routes/config.js +10 -0
  137. package/dist/src/gateway/hono/routes/host-fs.js +40 -1
  138. package/dist/src/gateway/hono/routes/media.js +33 -1
  139. package/dist/src/gateway/hono/routes/notes.js +162 -7
  140. package/dist/src/gateway/hono/routes/shares.js +141 -6
  141. package/dist/src/gateway/hono/routes/tunnel.js +47 -10
  142. package/dist/src/gateway/hono/routes/voice.d.ts +2 -6
  143. package/dist/src/gateway/hono/routes/voice.js +20 -4
  144. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  145. package/dist/src/gateway/run-loop.js +3 -0
  146. package/dist/src/gateway/server.d.ts +3 -0
  147. package/dist/src/gateway/server.js +30 -5
  148. package/dist/src/gateway/service.js +4 -4
  149. package/dist/src/notes/service.d.ts +6 -2
  150. package/dist/src/notes/service.js +36 -4
  151. package/dist/src/providers/index.js +2 -2
  152. package/dist/src/share/note-share-service.d.ts +67 -0
  153. package/dist/src/share/note-share-service.js +283 -0
  154. package/dist/src/share/share-config.js +32 -3
  155. package/dist/src/share/share-landing.d.ts +5 -1
  156. package/dist/src/share/share-landing.js +28 -1
  157. package/dist/src/share/share-store.d.ts +34 -5
  158. package/dist/src/share/share-store.js +125 -19
  159. package/dist/src/share/share-thumbnail.js +4 -2
  160. package/dist/src/share/share-types.d.ts +52 -14
  161. package/dist/src/share/share-types.js +9 -0
  162. package/dist/src/share/share-zip.d.ts +2 -2
  163. package/dist/src/tui/backends/embedded-backend.js +1 -1
  164. package/dist/src/tunnel/env.d.ts +12 -6
  165. package/dist/src/tunnel/env.js +34 -26
  166. package/dist/src/tunnel/gateway-lifecycle.js +2 -13
  167. package/dist/src/tunnel/index.d.ts +1 -1
  168. package/dist/src/tunnel/index.js +2 -2
  169. package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
  170. package/dist/src/tunnel/tunnel-config.d.ts +1 -1
  171. package/dist/src/tunnel/tunnel-config.js +9 -4
  172. package/dist/src/tunnel/tunnel-service.d.ts +1 -1
  173. package/dist/src/tunnel/tunnel-service.js +3 -0
  174. package/dist/src/tunnel/well-known.d.ts +1 -1
  175. package/dist/src/tunnel/well-known.js +1 -1
  176. package/dist/src/tunnel/xopc-cloud-registration.d.ts +9 -0
  177. package/dist/src/tunnel/xopc-cloud-registration.js +42 -0
  178. package/dist/src/voice/stt/transcribe-core.js +17 -1
  179. package/dist/src/voice/stt/types.d.ts +1 -1
  180. package/package.json +2 -2
  181. package/dist/gateway/static/root/assets/agents-DijFbC4G.js +0 -68
  182. package/dist/gateway/static/root/assets/apps-page-BFAmf9hq.js +0 -1
  183. package/dist/gateway/static/root/assets/automations-workspace-B8us5JBf.js +0 -6
  184. package/dist/gateway/static/root/assets/block-editor-C3mwGsms.js +0 -184
  185. package/dist/gateway/static/root/assets/browser-settings-page-BeBd17-3.js +0 -8
  186. package/dist/gateway/static/root/assets/capabilities-settings-panel-Bv0z3KRq.js +0 -7
  187. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BczD-pWE.js +0 -3
  188. package/dist/gateway/static/root/assets/channels-settings-2KQYq6xl.js +0 -1
  189. package/dist/gateway/static/root/assets/channels-status-swr-ByRbxC6z.js +0 -1
  190. package/dist/gateway/static/root/assets/connectors-page-PB1boaNy.js +0 -2
  191. package/dist/gateway/static/root/assets/dist-C230izr8.js +0 -1
  192. package/dist/gateway/static/root/assets/heartbeat-settings-5YQ5BUwp.js +0 -1
  193. package/dist/gateway/static/root/assets/home-page-DfIVWJl3.js +0 -1
  194. package/dist/gateway/static/root/assets/index-BXGC3VFm.css +0 -2
  195. package/dist/gateway/static/root/assets/index-jqDCfet4.js +0 -74
  196. package/dist/gateway/static/root/assets/local-app-workbench-page-CAb0odzu.js +0 -2
  197. package/dist/gateway/static/root/assets/logs-page-CFxKbDZl.js +0 -2
  198. package/dist/gateway/static/root/assets/markdown-view-DYkxMtJA.js +0 -69
  199. package/dist/gateway/static/root/assets/messages-kx5W39dO.js +0 -3
  200. package/dist/gateway/static/root/assets/notes-api-DJizatxh.js +0 -1
  201. package/dist/gateway/static/root/assets/notes-workbench-BGjEC89c.js +0 -4
  202. package/dist/gateway/static/root/assets/project-detail-page-Dj9kEQwg.js +0 -1
  203. package/dist/gateway/static/root/assets/projects-page-CBRy5Ezz.js +0 -1
  204. package/dist/gateway/static/root/assets/remote-access-hub-DSwz9RBh.js +0 -1
  205. package/dist/gateway/static/root/assets/sessions-page-WtattyVX.js +0 -1
  206. package/dist/gateway/static/root/assets/settings-advanced-gate-CNAz_q1F.js +0 -1
  207. package/dist/gateway/static/root/assets/setup-status-panel-CNo4Ajhn.js +0 -1
  208. package/dist/gateway/static/root/assets/share-preview-page-B7PI3yZ6.js +0 -2
  209. package/dist/gateway/static/root/assets/shares-settings-DpOH0zWB.js +0 -1
  210. package/dist/gateway/static/root/assets/skill-reload-api-BOf4xCat.js +0 -1
  211. package/dist/gateway/static/root/assets/task-detail-page-DrMX5Yhj.js +0 -1
  212. package/dist/gateway/static/root/assets/user-context-page-ewIK2ddC.js +0 -1
  213. package/dist/gateway/static/root/assets/workflows-page-Bdn82kFQ.js +0 -5
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-CUsob4Pz.js";import{t as o}from"./cn-JdwAhgNB.js";import{l as s,o as c,r as l,s as u}from"./locale-store-CPylQjH9.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=s.getState().token??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await c(l(_(e,t)));if(n.status===401&&s.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function k(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function A(e,t){let n=s.getState().token,r=new Headers;n&&r.set(`Authorization`,`Bearer ${n}`);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&s.getState().onUnauthorized(),!i.ok)throw Error(await k(i));return i.json()}var j=r();function ee(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,j.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,j.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,j.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function M(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function N(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function P(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return N(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=M(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,j.jsx)(`div`,{ref:o,children:(0,j.jsx)(a,{content:l,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function F(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return u(l(`/api/notes${n?`?${n}`:``}`))}async function I(e,t=`web`){return(await u(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function L(e){return(await u(l(`/api/notes`),{method:`POST`,body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function R(e){let t=await c(l(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function z(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function B(e){await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function V(e){return u(l(`/api/notes/${encodeURIComponent(e)}/shares`))}async function H(e,t){return u(l(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function U(e,t,n){await u(l(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function W(e){return u(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function G(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function K(e,t={}){return u(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t.forceNew?{forceNew:!0}:{})})}async function q(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function J(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function Y(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function X(e,t,n){return(await u(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Z(e,t={}){return(await u(l(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceSessionKey:t.sourceSessionKey||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function Q(e,t){let n=new FormData;return n.append(`file`,t),(await A(l(`/api/notes/${encodeURIComponent(e)}/media`),n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await A(l(`/api/notes`),n)).note}async function te(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`![${r.fileName}](${D(n.id,r.id)})`;return n.markdown!==i&&(n=await z(n.id,{markdown:i})),n}async function ne(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await z(r.id,{markdown:a,kind:`voice`})),r}async function re(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function ie(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function ae(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{g as A,Q as C,T as D,D as E,E as O,z as S,ee as T,ne as _,Z as a,U as b,J as c,V as d,q as f,te as g,I as h,H as i,d as j,h as k,ie as l,K as m,W as n,B as o,F as p,L as r,R as s,X as t,re as u,Y as v,P as w,ae as x,G as y};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-BGjEC89c.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-BScELo01.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-lTkcHTve.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B3zYJBhK.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DaxPZj9e.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-CUsob4Pz.js","assets/dist-BPoKqzeH.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-CPylQjH9.js","assets/messages-B82nsi9k.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DD_PgVue.css","assets/dist-J_ySZvz0.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-CccGri5Y.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/file-code-corner-byQA1VfD.js","assets/globe-DSSGFWFn.js","assets/notes-api-CfKZYrBC.js","assets/loader-circle-CifKLtgG.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-B_5D8epF.js","assets/gateway-startup-retry-9mrsL84j.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-yUxMMVjK.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store--GBciH10.js","assets/theme-store-BN-32Fz5.js","assets/index-D3_xSYKd.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.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{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-CccGri5Y.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./copy-Dv6d4Dvw.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./eye-CABVeTq0.js";import{D as p,O as m,S as h,T as g,_,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,p as j,r as M,s as N,u as P,v as F,w as I,x as L,y as ee}from"./notes-api-CfKZYrBC.js";import{t as R}from"./loader-circle-CifKLtgG.js";import{t as te}from"./plus-Q2yW6OE7.js";import{t as z}from"./search-DA7gz22f.js";import{t as B}from"./x-B_N4OPjy.js";import{t as V}from"./cn-JdwAhgNB.js";import{t as H}from"./button-CSEbl4zT.js";import{t as U}from"./messages-B82nsi9k.js";import{l as ne,n as W}from"./locale-store-CPylQjH9.js";import{i as re}from"./theme-store-BN-32Fz5.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as G}from"./dist-BPoKqzeH.js";import{i as ue}from"./vendor-swr-BIWyz7Rc.js";import{$a as de,Ac as K,Bc as fe,Br as pe,Bs as me,Es as he,Gr as q,Hi as ge,Hl as _e,Hr as ve,Jl as J,Jn as Y,Jr as ye,Ms as be,Ns as xe,Ql as Se,Ua as Ce,Uc as we,Ur as Te,Vr as X,Wi as Ee,Wr as De,Ws as Oe,Xa as ke,Xr as Ae,Yr as je,ac as Me,al as Ne,bc as Pe,bs as Fe,c as Ie,cl as Le,d as Re,do as ze,eu as Be,gc as Ve,hl as He,ic as Ue,iu as We,ks as Ge,l as Ke,lc as qe,qr as Je,qs as Ye,rc as Xe,s as Ze,sc as Qe,tc as $e,tu as et,u as tt,vs as nt,xs as rt,ys as it}from"./index-B3zYJBhK.js";var Z=n(),Q=e(t(),1),$=r(),at=(0,Q.createContext)(null);function ot(){let e=(0,Z.c)(1),t=(0,Q.useContext)(at);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:st},e[0]=t):t=e[0],t}return t}function st(){}function ct(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ie,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=V(`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]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(le,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(B,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(oe,{asChild:!0,children:(0,$.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:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=a?(0,$.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]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(se,{children:[p,(0,$.jsxs)(ce,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(G,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(at.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function lt(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=E(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=V(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(T,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=V(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(g,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var ut=6e4,dt=36e5,ft=864e5;function pt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function mt(e,t,n){let r=t-e;if(r<ut)return n.justNow;if(r<dt){let e=Math.floor(r/ut);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=pt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ft)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*ft){let e=Math.floor(r/ft);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ht(e,t,n){let r=pt(t);if(e>=r)return n.today;if(e>=r-ft)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function gt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function _t(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function vt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ae(),f=Ae(bt),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=V(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=V(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(R,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Qe,{className:`size-3.5`}):(0,$.jsx)($e,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=_t(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let M;t[29]===j?M=t[30]:(M=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=M);let N;t[31]!==A||t[32]!==M?(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,M]}),t[31]=A,t[32]=M,t[33]=N):N=t[33];let P;return t[34]!==N||t[35]!==C||t[36]!==O?(P=(0,$.jsxs)(`div`,{className:C,onClick:yt,children:[O,N]}),t[34]=N,t[35]=C,t[36]=O,t[37]=P):P=t[37],P}function yt(e){return e.stopPropagation()}function bt(e){return e.toggle}function xt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function St(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=xt(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(Et),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=mt(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=V(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(vt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=V(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Le,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(q,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Tt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(Xe,{className:`size-4`}):(0,$.jsx)(Ue,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(X,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(et,{className:`size-4`}),t[47]=I):I=t[47];let L;t[48]!==c.archive||t[49]!==F?(L=(0,$.jsxs)(X,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:F,children:[I,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=L):L=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(De,{className:`my-1 h-px bg-edge-subtle`}),t[51]=ee):ee=t[51];let R;t[52]!==n.id||t[53]!==s?(R=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=R):R=t[54];let te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(it,{className:`size-4`}),t[55]=te):te=t[55];let z;t[56]!==c.delete||t[57]!==R?(z=(0,$.jsxs)(X,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:R,children:[te,c.delete]}),t[56]=c.delete,t[57]=R,t[58]=z):z=t[58];let B;t[59]!==P||t[60]!==L||t[61]!==z?(B=(0,$.jsx)(ve,{children:(0,$.jsxs)(pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:wt,children:[P,L,ee,z]})}),t[59]=P,t[60]=L,t[61]=z,t[62]=B):B=t[62];let H;t[63]!==A||t[64]!==B?(H=(0,$.jsxs)(Te,{children:[A,B]}),t[63]=A,t[64]=B,t[65]=H):H=t[65];let U;t[66]!==C||t[67]!==O||t[68]!==H?(U=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,H]}),t[66]=C,t[67]=O,t[68]=H,t[69]=U):U=t[69];let ne;t[70]===n.pinned?ne=t[71]:(ne=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(Ue,{className:`size-3`})}),t[70]=n.pinned,t[71]=ne);let W;t[72]===n.tags?W=t[73]:(W=n.tags?.slice(0,2).map(Ct),t[72]=n.tags,t[73]=W);let re;t[74]===g?re=t[75]:(re=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=re);let ie;t[76]!==ne||t[77]!==W||t[78]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ne,W,re]}),t[76]=ne,t[77]=W,t[78]=re,t[79]=ie):ie=t[79];let ae;return t[80]!==U||t[81]!==ie||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,U,ie]}),t[80]=U,t[81]=ie,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function Ct(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function wt(e){return e.stopPropagation()}function Tt(e){return e.stopPropagation()}function Et(){return Date.now()}function Dt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,u=c===void 0?`card`:c,d=W(At),f=U(d).automations.suggestions,p=U(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=ue(o?`automation-suggestion-coverage`:null,kt,h),_=o?g?.automations.find(e=>tt(e,o)):void 0,v=_?Ie(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=V(`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,$.jsx)(l,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(H,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=V(`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,$.jsx)(K,{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,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(H,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=V(`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,$.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(H,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ke(f.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Ot)})]}),i]})}let y;t[24]===s?y=t[25]:(y=V(`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,$.jsx)(K,{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,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(H,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function Ot(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function kt(){return Re.list()}function At(e){return e.language}function jt(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Mt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Mt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function Nt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),p(n,r).then(i=>{if(e=!0,t){m(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&m(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.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,$.jsx)(ke,{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,$.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 Pt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=U(W(Lt)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Y(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}=ue(i,a,o),u,d;if(t[4]===c?(u=t[5],d=t[6]):(u=()=>{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(It);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)}},d=[c],t[4]=c,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.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]!==m?(v=m?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(xe,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(jt,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(jt,{values:m.actionItems.map(Ft)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(jt,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(jt,{values:m.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]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Ve,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(Nt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Ve,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(nt,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(l,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.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:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.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,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Ft(e){return e.title}function It(e,t){return e.sequence-t.sequence}function Lt(e){return e.language}var Rt={edit:Me,ai_edit:xe,sync:Ye,restore:Be};function zt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=U(W(e=>e.language)).notes,o=a,{data:s}=ue(e?[`note-history`,e]:null,()=>P(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await L(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(we,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Rt[e.trigger]??Me,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:V(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:zt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:mt(e.timestamp,h,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,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:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),d(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:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function Vt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=U(W(Jt)).notes,p=a(),m=r?.aiDeep?.catalysis,h=m?.report??null,g;t[0]===n?g=t[1]:(g=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=g);let _;t[2]===n?_=t[3]:(_=()=>y(n),t[2]=n,t[3]=_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[4]=v):v=t[4];let{data:b,mutate:x,isLoading:S}=ue(g,_,v),C;t[5]===n?C=t[6]:(C=async e=>{try{await ee(n,e)}catch{}},t[5]=n,t[6]=C);let w=C,T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=T):T=t[7];let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Se,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=E):E=t[8];let D;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(Pe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=D):D=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[T,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:E})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:f.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(()=>F(n),{revalidate:!1}),disabled:S,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:f.contextRebuild}),(0,$.jsx)(`span`,{className:V(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(qt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,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:i?f.processing:h?f.recatalyze:f.catalyzeAction}),h?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:h.targetUsers.slice(0,5).map(Kt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(Gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map(Wt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.risks.slice(0,3).map(Ut)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.nextActions.slice(0,4).map(Ht)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:V(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:V(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(rt,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:f.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[D,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,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:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,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:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:f.noThreads})]})]})]})}function Ht(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Ut(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Wt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Gt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function Kt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function qt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Jt(e){return e.language}var Yt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Xt({open:e,onOpenChange:t,note:n}){let r=W(e=>e.language)===`zh`,i=r?$t:en,{data:a,mutate:l}=ue(e?[`note-shares`,n.id]:null,()=>b(n.id)),[f,p]=(0,Q.useState)(new Set),[m,h]=(0,Q.useState)(`86400000`),[g,_]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(p(new Set(N.map(e=>e.id))),O(null),A(!1),M(null))},[e,N]);let P=async()=>{C(!0),M(null);try{O((await w(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f],ttlMs:Number(m),maxViews:g.trim()?Number(g):null,description:y.trim()||void 0})).payload.shareUrl),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{C(!1)}},F=async(e,t)=>{E(e.id),M(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...f]}):t===`extend`?await ge(e.id,864e5):await Ee(e.id),await l()}catch(e){M(e instanceof Error?e.message:String(e))}finally{E(null)}},I=async e=>{await navigator.clipboard.writeText(e),A(!0),window.setTimeout(()=>A(!1),1500)};return(0,$.jsx)(G,{open:e,onOpenChange:t,children:(0,$.jsxs)(se,{children:[(0,$.jsx)(ie,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ce,{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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(le,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(me,{className:`size-4`}),i.title]}),(0,$.jsx)(ae,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(B,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),N.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:N.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:()=>p(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Qt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(s,{value:m,onChange:e=>h(e.target.value),children:Yt.map(e=>(0,$.jsx)(c,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:g,onChange:e=>_(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:y,onChange:e=>x(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),D?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:D,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(H,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void I(D),children:[k?(0,$.jsx)(o,{className:`size-4`}):(0,$.jsx)(u,{className:`size-4`}),k?i.copied:i.copy]}),(0,$.jsxs)(H,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(D,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(d,{className:`size-4`}),i.open]})]})}):null,j?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:j}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Zt,{share:e,busy:T===e.id,t:i,onCopy:I,onAction:F},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(H,{type:`button`,onClick:()=>void P(),disabled:S,children:[S?(0,$.jsx)(R,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),S?i.creating:i.create]})]})]})]})})}function Zt(e){let t=(0,Z.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=V(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let f=n.stale&&!s?i.stale:s?i.inactive:i.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,$.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==p||t[16]!==g?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,y]}),t[14]=y,t[15]=p,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,$.jsx)(R,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(u,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(d,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Ye,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,$.jsx)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,$.jsxs)(H,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(it,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,$.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var $t={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},en={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`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`},tn=()=>i(()=>import(`./block-editor-lTkcHTve.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56])),nn=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([57,1,3,54,5,58])),rn=(0,Q.lazy)(()=>tn().then(e=>({default:e.BlockEditor}))),an=(0,Q.lazy)(()=>nn().then(e=>({default:e.MarkdownEditor})));function on(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function sn(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ne},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:He},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:f},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,$.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,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},onFocus:()=>{t===`wysiwyg`&&tn(),t===`source`&&nn()},className:V(`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,$.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 cn(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=W(ln),h;t[0]===m?h=t[1]:(h=U(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(un,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(ct,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function ln(e){return e.language}function un({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=W(e=>e.language),d=U(u).notes,f=U(u).automations.suggestions,p=a(),m=re(e=>e.resolved)===`dark`,{openImage:g}=ot(),[_,v]=(0,Q.useState)(`wysiwyg`),[y,b]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[L,ee]=(0,Q.useState)(!1),[R,te]=(0,Q.useState)(!1),[B,H]=(0,Q.useState)(null),[ne,ie]=(0,Q.useState)(!1),[ae,oe]=(0,Q.useState)(null),se=(0,Q.useRef)(!1),ce=(0,Q.useRef)(!1),le=(0,Q.useRef)(null),G=(0,Q.useRef)(null),de=(0,Q.useRef)(null),K=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),he=(0,Q.useRef)(null),q=(0,Q.useRef)(null),ge=(0,Q.useRef)(null),_e=ze(e=>e.setPageHeader),ve=ze(e=>e.clearPageHeader),{data:J,mutate:Y}=ue(e?[`note-detail`,e]:null,()=>N(e)),{data:be=[],mutate:Ce}=ue(e?[`note-threads`,e]:null,()=>x(e),{revalidateOnFocus:!1}),Te=S!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e]),(0,Q.useEffect)(()=>{se.current=!1,A(``),C(null),b(null),ce.current=!1,ge.current=null},[e]),(0,Q.useEffect)(()=>{!J||se.current||(A(J.title??``),se.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!c||!J||Te||ge.current===e)return;let t=window.requestAnimationFrame(()=>{q.current?.focus(),l?.()});return ge.current=e,()=>window.cancelAnimationFrame(t)},[c,Te,J,e,l]);let X=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ee=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:V(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,We,i),children:(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),De=(0,Q.useCallback)(t=>{A(t),e&&(K.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){T(!0);try{await h(e,{title:t}),await Y(),n?.()}catch{}finally{T(!1)}}},600))},[e,Y,n]),Oe=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:V(`flex min-w-0 items-center gap-2`,We),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:E||X||void 0,children:E||X}),w?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,w,X,E]),ke=(0,Q.useCallback)(async(t=!1)=>{te(!0),H(null);try{let n=await O(e,{forceNew:t});await Y(),await Ce(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{te(!1)}},[Y,Ce,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),Ae=(0,Q.useCallback)(async()=>{ee(!0),H(null);try{await k(e),await Y()}catch(e){H(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ee(!1)}},[Y,e]),Me=(0,Q.useCallback)(()=>{b(y===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!L&&Ae()},[y,L,Ae,J?.aiDeep?.catalysis?.report]),Ne=(0,Q.useCallback)(()=>{let t=S?.markdown??de.current??J?.markdown??``,n=S?.title??E,r=ye([n,t].filter(Boolean).join(`
3
+
4
+ `));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:je(r,u)}},[u,d.titlePlaceholder,J?.markdown,e,S,E]),Fe=(0,Q.useCallback)(async()=>{le.current&&clearTimeout(le.current),G.current&&clearTimeout(G.current),le.current=null,G.current=null;let t=de.current,r=K.current;de.current=null,K.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return J??null;T(!0);try{let t=await h(e,i);return await Y(t,{revalidate:!1}),n?.(),t}catch(e){return H(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`),null}finally{T(!1)}},[Y,d.saveFailed,d.saveFailedHint,J,e,n]),Ie=(0,Q.useCallback)(async()=>{H(null);let e=await Fe();e&&(oe(e),ie(!0))},[Fe]),Le=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:V(`flex items-center gap-2`,We),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Je,{input:Ne,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ie(),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,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),u===`zh`?`分享`:`Share`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:Me,disabled:L,"aria-label":d.catalysisSectionTitle,className:V(`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,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),L?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ke(!1),disabled:R,className:V(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),R?d.openingChat:d.openChatButton]}),(0,$.jsx)(sn,{mode:_,onModeChange:v,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(y===`history`?null:`history`),"aria-label":d.history,className:V(`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,$.jsx)(we,{className:`size-4`,"aria-hidden":!0})})]}),[L,Me,ke,_,d.history,d.modeEdit,d.modePreview,d.modeSource,R,y,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,Ne,Ie,u]);(0,Q.useLayoutEffect)(()=>(_e({startExtra:Ee,main:J?Oe:null,end:J?Le:null}),()=>{o&&ve()}),[o,ve,Le,Oe,Ee,J,_e]);let Re=(0,Q.useCallback)(t=>{e&&(de.current=t,le.current&&clearTimeout(le.current),le.current=setTimeout(async()=>{let t=de.current;if(de.current=null,t!==null){T(!0),H(null);try{await h(e,{markdown:t}),await Y(),n?.()}catch(e){H(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{T(!1)}}},600))},[e,Y,d.saveFailed,d.saveFailedHint,n]),Be=(0,Q.useCallback)(t=>{D(e,t.timestamp).then(e=>{e&&C(e)})},[e]),Ve=(0,Q.useCallback)(()=>{b(null),C(null)},[]),He=(0,Q.useCallback)(()=>{b(null),C(null),Y(),n?.()},[Y,n]);if((0,Q.useEffect)(()=>()=>{le.current&&clearTimeout(le.current),G.current&&clearTimeout(G.current);let t=de.current,n=K.current;de.current=null,K.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&h(e,r)},[e]),J===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(J===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:d.back})]});let Ue=Te?S.title??``:E,Ge=Te?S.markdown??``:J.markdown??``,Ke=new Date(J.createdAt).getTime(),qe=Number.isFinite(Ke)&&Date.now()-Ke<3600*1e3?(0,$.jsx)(Dt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[B?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:B}):null,(0,$.jsx)(Ze,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ze,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:fe,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,$.jsx)(Pt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:Te?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ue&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ue}),Ge?(0,$.jsx)(I,{noteId:e,content:Ge,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[_===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:q,type:`text`,value:E,onChange:e=>De(e.target.value),onCompositionStart:()=>{ce.current=!0},onCompositionEnd:()=>{ce.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ce.current&&!t.isComposing&&(e.preventDefault(),(fe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.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`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(rn,{initialContent:J.markdown??``,onChange:Re,noteId:e},`wysiwyg-${e}`)})})]}),_===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:q,type:`text`,value:E,onChange:e=>De(e.target.value),placeholder:d.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`}),qe]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(on,{}),children:(0,$.jsx)(an,{initialContent:J.markdown??``,onChange:Re,isDark:m},`source-${e}`)})})]}),_===`preview`&&(0,$.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:[E&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:E}),J.markdown?(0,$.jsx)(I,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:pe,className:V(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!P&&`transition-[width] duration-300 ease-in-out`),style:{width:y?j:0},children:(0,$.jsxs)(`div`,{ref:he,className:`flex min-h-0 flex-1 flex-col`,style:{width:j},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),F(!0);let n=e.clientX,r=j,i=e.pointerId,a=0,o=j,s=j,c=()=>{a=0,s=o,y&&pe.current?.style.setProperty(`width`,`${s}px`),he.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}F(!1),M(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:V(`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`,P&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:y===`history`?(0,$.jsx)(Bt,{noteId:e,activeTimestamp:S?.timestamp??null,onSelect:Be,onClose:Ve,onRestored:He}):y===`breakdown`?(0,$.jsx)(Vt,{noteId:e,note:J??null,catalyzing:L,onCatalyze:Ae,onClose:()=>b(null),noteThreads:be,openingChat:R,onOpenChat:()=>ke(!1),onOpenNewChat:()=>ke(!0)}):null})]})})]}),ae?(0,$.jsx)(Xt,{open:ne,onOpenChange:ie,note:ae}):null]})}var dn=3e4;function fn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function pn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let N=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||fn()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[M,c]),P=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=fn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{N()},dn)}catch{M(),l?.()}}},[M,c,l,y,N,C]),F=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),I=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),F())},[F]),L=_||C,ee=!!(s||c||p);return(0,$.jsxs)(`div`,{className:V(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":L,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(Ge,{className:`size-4 fill-current`,"aria-hidden":!0})}):ee?(0,$.jsxs)(Te,{children:[(0,$.jsx)(q,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:L,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors 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`,"aria-label":n,title:n,children:(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ve,{children:(0,$.jsxs)(pe,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(X,{disabled:d,onSelect:s,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(fe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(X,{disabled:f,onSelect:()=>void P(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(X,{onSelect:p,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(J,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:I,placeholder:e,"aria-label":e,rows:1,disabled:L,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!h.trim()||L||y,onClick:()=>void F(),"aria-label":t,title:t,className:V(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!L&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})})]})}var mn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},hn=240,gn=320,_n=520,vn=560;function yn(e){if(globalThis.localStorage===void 0)return gn;try{let t=globalThis.localStorage.getItem(e);if(!t)return gn;let n=Number(t);return Number.isFinite(n)?n:gn}catch{return gn}}function bn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var xn={thought:he,todo:be,voice:Ve,media:fe,bookmark:_e,mixed:he,task:be};function Sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function wn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Tn({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:o,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let m=U(W(e=>e.language)).notes,g=!!ne(e=>e.token),[v,y]=(0,Q.useReducer)(Ce,mn),[b,x]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(0),[O,k]=(0,Q.useState)(()=>yn(p)),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,ee]=(0,Q.useState)(!1),[R,H]=(0,Q.useState)(null),[re,K]=(0,Q.useState)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),[me]=(0,Q.useState)(()=>Date.now()),q=a(),ge=(0,Q.useCallback)(e=>{let t=fe.current?.clientWidth??window.innerWidth,n=Math.max(hn,t-vn);return Math.max(hn,Math.min(Math.min(_n,n),e))},[]),_e=(0,Q.useCallback)(e=>{let t=ge(e);k(t),bn(p,t)},[ge,p]);(0,Q.useLayoutEffect)(()=>{k(e=>ge(e))},[ge]);let{data:ve,mutate:J,isLoading:Y}=ue((0,Q.useMemo)(()=>g?[`notes-list`,o,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[g,o,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>j({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:o,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ye=Y&&!ve,be=ve?.items??[],xe=ve?.total??0,Se=w.trim(),{data:we,isLoading:Te}=ue(g&&b&&Se?[`notes-search`,o,Se]:null,()=>j({search:Se,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=we?.items??[],Ee=e?be.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{D(0)},[Se]),(0,Q.useEffect)(()=>{E>=X.length&&D(Math.max(0,X.length-1))},[E,X.length]),(0,Q.useEffect)(()=>{let e=()=>{J()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J]);let De=ze(e=>e.setPageHeader),Oe=ze(e=>e.clearPageHeader),ke=m.noteCount.replace(`{{count}}`,String(xe)),Ae=!r&&xe===0&&u?u:ke,je=m.searchDialogTitle,Me=m.searchClose,Ne=m.searchClear,Pe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),className:V(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,We),"aria-label":je,children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:je})]}),[je]);(0,Q.useLayoutEffect)(()=>{if(n)return g?(De({startExtra:null,main:(0,$.jsxs)(`div`,{className:V(`flex min-w-0 items-center gap-2`,We),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??m.title}),ke?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:ke}):null]}),end:Pe}),()=>Oe()):(Oe(),()=>Oe())},[Oe,g,Pe,l,n,m.title,ke,e,De]);let Fe=(0,Q.useMemo)(()=>({justNow:m.justNow,minutesAgo:m.minutesAgo,today:m.today,yesterday:m.yesterday,daysAgo:m.daysAgo}),[m.justNow,m.minutesAgo,m.today,m.yesterday,m.daysAgo]),Ie=(0,Q.useMemo)(()=>[{id:`recent`,label:m.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:m.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:m.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:m.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:m.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:m.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:m.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:m.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:m.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[m.filterArchived,m.filterInbox,m.filterProcessed,m.kindBookmark,m.kindMedia,m.kindVoice,m.pinned,m.viewRecent,m.viewTasks]),Le=Ie.find(e=>Cn(v,e))??Ie[0],Re=l??Le.label,Be=(0,Q.useCallback)(async e=>{H(null);try{let n=o?await M({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await C(e,`web`);await J(),q(wn(t,n.id))}catch(e){throw H(`${m.quickCaptureFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`),e}},[t,J,m.quickCaptureFailed,m.quickCaptureFailedHint,q,o]),Ve=(0,Q.useCallback)(async()=>{if(!L){ee(!0),H(null);try{let e=await M({markdown:``,kind:`thought`,projectId:o,channel:`web`});y({type:`patch`,patch:mn}),await J(),K(e.id),q(wn(t,e.id))}catch(e){H(`${m.createBlankFailed}: ${e instanceof Error?e.message:m.createBlankFailedHint}`)}finally{ee(!1)}}},[t,L,J,m.createBlankFailed,m.createBlankFailedHint,q,o]),He=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{H(null),await S(t,`web`),await J()}catch(e){H(`${m.imageUploadFailed}: ${e instanceof Error?e.message:m.imageUploadFailedHint}`)}},e.click()},[J,m.imageUploadFailed,m.imageUploadFailedHint]),Ue=(0,Q.useCallback)(async(e,t)=>{try{H(null),await _(e,t,`web`),await J()}catch(e){H(`${m.voiceUploadFailed}: ${e instanceof Error?e.message:m.voiceUploadFailedHint}`)}},[J,m.voiceUploadFailed,m.voiceUploadFailedHint]),Ge=(0,Q.useCallback)(()=>{H(`${m.voiceCaptureFailed}: ${m.voiceCaptureFailedHint}`)},[m.voiceCaptureFailed,m.voiceCaptureFailedHint]),Ke=(0,Q.useCallback)(async(e,t)=>{await h(e,{pinned:t}),await J()},[J]),Je=(0,Q.useCallback)(async e=>{await h(e,{status:`archived`}),await J()},[J]),Ye=(0,Q.useCallback)(async e=>{await A(e),await J()},[J]),Xe=(0,Q.useCallback)(e=>{q(wn(t,e))},[t,q]),Ze=(0,Q.useCallback)(e=>{q(wn(t,e)),x(!1)},[t,q]),Qe=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),D(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),D(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[E]??X[0];t&&Ze(t.id)}}},[E,Ze,X]),$e=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=pe.current;t.setPointerCapture(e.pointerId),P(!0);let r=fe.current?.clientWidth??window.innerWidth,i=Math.max(hn,r-vn),a=Math.min(_n,i),o=e=>Math.max(hn,Math.min(a,e)),s=e.clientX,c=o(O),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}P(!1),fe.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),k(f),bn(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,O]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ve())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let et=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),_e(O-16)):e.key===`ArrowRight`?(e.preventDefault(),_e(O+16)):e.key===`Home`?(e.preventDefault(),_e(hn)):e.key===`End`&&(e.preventDefault(),_e(_n))},[_e,O]);return g?(0,$.jsxs)(`div`,{ref:fe,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${O}px`},children:[(0,$.jsxs)(`section`,{ref:pe,className:V(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!N&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,F?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":F?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[R?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:R}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(s,{value:Le.id,onChange:e=>{let t=Ie.find(t=>t.id===e.target.value);t&&y({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":m.libraryTitle,children:Ie.map(e=>(0,$.jsx)(c,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Re}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ae})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>I(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":m.collapseNotesList,title:m.collapseNotesList,children:(0,$.jsx)(qe,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ve,disabled:L,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":m.createBlankNote,title:m.createBlankShortcut,children:(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":m.searchDialogTitle,title:m.searchDialogTitle,children:(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ye?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):be.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(he,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Ee?m.noteOutsideCurrentView:d??m.noNotes}),e&&!Ee?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??m.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ee?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:m.noteOutsideCurrentView}):null,be.map((t,n)=>{let r=n>0?gt(be[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[gt(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:V(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ht(t.createdAt,me,Fe)}),(0,$.jsx)(St,{note:t,selected:t.id===e,onPress:Xe,onPin:Ke,onArchive:Je,onDelete:Ye,timeLabels:Fe,labels:{pin:m.pin,unpin:m.unpin,archive:m.archive,delete:m.delete,actions:m.noteActions,imageNote:m.imageNote,noText:m.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(pn,{placeholder:m.quickCapturePlaceholder,submitLabel:m.quickCaptureSubmit,actionsLabel:m.quickCaptureActions,imageLabel:m.quickCaptureImage,voiceLabel:m.quickCaptureVoice,stopRecordingLabel:m.stopRecording,onCapture:Be,onImagePick:i?He:void 0,onVoiceCapture:i?Ue:void 0,onVoiceError:Ge,recordingLabel:m.recording,discussionCaptureLabel:m.discussionCapture.title,onDiscussionCapture:()=>de(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.resizeNotesList,"aria-valuemin":hn,"aria-valuemax":_n,"aria-valuenow":Math.round(O),tabIndex:0,onPointerDown:$e,onDoubleClick:()=>_e(gn),onKeyDown:et,title:m.resizeNotesList,className:V(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,F?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:V(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,N&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:V(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[F?(0,$.jsx)(`button`,{type:`button`,onClick:()=>I(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":m.expandNotesList,title:m.expandNotesList,children:(0,$.jsx)(qe,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(cn,{noteId:e,onBack:()=>q(t),onSaved:()=>void J(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>x(!0),autoFocus:e===re,onAutoFocusConsumed:()=>K(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(he,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:m.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ve,disabled:L,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),L?m.creatingBlankNote:m.createBlankNote]})]})})]}),(0,$.jsx)(G,{open:b,onOpenChange:x,children:(0,$.jsxs)(se,{children:[(0,$.jsx)(ie,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ce,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(le,{className:`text-sm font-semibold text-fg`,children:je}),(0,$.jsx)(ae,{className:`sr-only`,children:m.searchPlaceholder}),(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,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`,"aria-label":Me,children:(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(z,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:w,onChange:e=>T(e.target.value),onKeyDown:Qe,placeholder:m.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),w?(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ne,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Se?Te&&!we?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(he,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:m.searchResultsCount.replace(`{{count}}`,String(we?.total??X.length))}),X.map((e,t)=>{let n=xn[e.kind]||he,r=Sn(e,{imageNote:m.imageNote,noText:m.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ze(e.id),onMouseEnter:()=>D(t),className:V(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===E?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:mt(e.updatedAt,me,Fe)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(z,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:m.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:m.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(he,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.needToken})]})}export{ot as n,Tn as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./electron-env-DH5wF8X8.js";function t(){if(e())return null;let t=window.open(`about:blank`,`xopc-oauth`);return t&&(t.opener=null),t}async function n(t,n){return e()?(await window.electronAPI?.shell?.openExternalUrl(t))?.ok===!0:!n||n.closed?!1:(n.location.replace(t),!0)}function r(e){e&&!e.closed&&e.close()}export{n,t as r,r as t};
@@ -1 +1 @@
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{t as a}from"./createLucideIcon-DPHK1VkS.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{i as c,n as l}from"./dist-CxGUk8J-.js";import{a as u,c as d,g as f,h as p,i as m,l as h,n as g,o as _,p as v,r as y,t as b,u as x}from"./Combination-14nmIgxH.js";import{a as S,i as C,n as w,r as T,t as E}from"./dist-C230izr8.js";import{a as D,s as O,t as k}from"./settings-shell-dialog-layer-BU3UuiJr.js";var A=a(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ee=r(),te=t({Anchor:()=>pe,Arrow:()=>he,Close:()=>me,Content:()=>Z,Popover:()=>z,PopoverAnchor:()=>B,PopoverArrow:()=>q,PopoverClose:()=>K,PopoverContent:()=>G,PopoverPortal:()=>U,PopoverTrigger:()=>V,Portal:()=>X,Root:()=>J,Trigger:()=>Y,createPopoverScope:()=>F}),j=e(n(),1),M=i(),N=`Popover`,[P,F]=p(N,[S]),I=S(),[L,R]=P(N),z=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=I(t),c=j.useRef(null),[l,u]=j.useState(!1),[d,f]=y({prop:r,defaultProp:i??!1,onChange:a,caller:N});return(0,M.jsx)(C,{...s,children:(0,M.jsx)(L,{scope:t,contentId:_(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:j.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:j.useCallback(()=>u(!0),[]),onCustomAnchorRemove:j.useCallback(()=>u(!1),[]),modal:o,children:n})})};z.displayName=N;var ne=`PopoverAnchor`,B=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ne,n),a=I(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return j.useEffect(()=>(o(),()=>s()),[o,s]),(0,M.jsx)(E,{...a,...r,ref:t})});B.displayName=ne;var re=`PopoverTrigger`,V=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(re,n),a=I(n),o=c(t,i.triggerRef),s=(0,M.jsx)(v.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fe(i.open),...r,ref:o,onClick:f(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,M.jsx)(E,{asChild:!0,...a,children:s})});V.displayName=re;var H=`PopoverPortal`,[ie,ae]=P(H,{forceMount:void 0}),U=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=R(H,t);return(0,M.jsx)(ie,{scope:t,forceMount:n,children:(0,M.jsx)(m,{present:n||a.open,children:(0,M.jsx)(u,{asChild:!0,container:i,children:r})})})};U.displayName=H;var W=`PopoverContent`,G=j.forwardRef((e,t)=>{let n=ae(W,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=R(W,e.__scopePopover);return(0,M.jsx)(m,{present:r||a.open,children:a.modal?(0,M.jsx)(se,{...i,ref:t}):(0,M.jsx)(ce,{...i,ref:t})})});G.displayName=W;var oe=l(`PopoverContent.RemoveScroll`),se=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(null),i=c(t,r),a=j.useRef(!1);return j.useEffect(()=>{let e=r.current;if(e)return g(e)},[]),(0,M.jsx)(b,{as:oe,allowPinchZoom:!0,children:(0,M.jsx)(le,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:f(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:f(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ce=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(!1),i=j.useRef(!1);return(0,M.jsx)(le,{...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()}})}),le=j.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=R(W,n),m=I(n);return h(),(0,M.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(x,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,M.jsx)(T,{"data-state":fe(p.open),role:`dialog`,id:p.contentId,...m,...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)`}})})})}),ue=`PopoverClose`,K=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ue,n);return(0,M.jsx)(v.button,{type:`button`,...r,ref:t,onClick:f(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=ue;var de=`PopoverArrow`,q=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=I(n);return(0,M.jsx)(w,{...i,...r,ref:t})});q.displayName=de;function fe(e){return e?`open`:`closed`}var J=z,pe=B,Y=V,X=U,Z=G,me=K,he=q;function ge(e,t=!1){if(!t)return k;switch(e){case`modal`:return D;case`page`:return O;default:return`z-50`}}var Q=(0,j.createContext)({layer:`default`,portalContainer:null});function _e(e,t){return e===`modal`||t===`modal`?`modal`:e===`page`||t===`page`?`page`:`default`}function ve(e){let t=(0,ee.c)(9),{layer:n,portalContainer:r,children:i}=e,a=(0,j.useContext)(Q),o;t[0]!==n||t[1]!==a.layer?(o=_e(a.layer,n),t[0]=n,t[1]=a.layer,t[2]=o):o=t[2];let s=o,c=r??a.portalContainer,l;t[3]!==s||t[4]!==c?(l={layer:s,portalContainer:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==l?(u=(0,M.jsx)(Q.Provider,{value:l,children:i}),t[6]=i,t[7]=l,t[8]=u):u=t[8],u}function ye(){return(0,j.useContext)(Q).layer}function be(){return(0,j.useContext)(Q).portalContainer}function xe({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:a=!1,disabledValues:c,disabled:l,id:u,ariaLabel:d,ariaLabelledBy:f,title:p,triggerClassName:m,contentClassName:h,side:g=`bottom`,align:_=`start`,onChange:v}){let[y,b]=(0,j.useState)(!1),x=ye(),S=be(),C=ge(x,S!==null),w=t.find(t=>t.value===e)?.label??(e?`${e} · unavailable`:n),T;return(0,M.jsxs)(J,{open:y,onOpenChange:b,children:[(0,M.jsx)(Y,{asChild:!0,children:(0,M.jsxs)(`button`,{id:u,type:`button`,"aria-label":d,"aria-labelledby":f,title:p,disabled:l,className:s(`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`,l&&`cursor-not-allowed opacity-50 hover:border-edge`,m),children:[(0,M.jsx)(`span`,{className:s(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:w}),(0,M.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,M.jsx)(X,{container:S??void 0,children:(0,M.jsx)(Z,{side:g,align:_,sideOffset:4,className:s(C,`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`,h),children:(0,M.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[r?(0,M.jsxs)(`button`,{type:`button`,disabled:a,className:s(`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||(v(``),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,t.map(t=>{let n=t.disabled===!0||c?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==T;return T=t.group,(0,M.jsxs)(j.Fragment,{children:[r?(0,M.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,M.jsxs)(`button`,{type:`button`,disabled:n,className:s(`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||(v(t.value),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]})]},`${t.group??``}:${t.value}`)})]})})})]})}function $(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map($).join(``):(0,j.isValidElement)(e)?$(e.props.children):``}function Se(e,t){let n=[];return j.Children.forEach(e,e=>{if(!(0,j.isValidElement)(e))return;if(e.type===j.Fragment){n.push(...Se(e.props.children,t));return}if(e.type===we){let t=e.props;n.push(...Se(t.children,$(t.label)));return}if(e.type!==Ce)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 Ce(e){return null}function we(e){return null}function Te(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 Ee(e){let t=(0,ee.c)(66),n,r,i,a,o,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:o,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,j.useId)(),g=m==null?``:String(m),_,v,y,b,x,S,C,w,T,E;if(t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==g){let e=Se(r);b=e.find(Oe),v=b!==void 0,y=b?.label||u||``,w=o||void 0,t[31]===i?T=t[32]:(T=Te(i),t[31]=i,t[32]=T),E=d.name,_=xe,x=c??h,S=g,C=e.filter(De),t[13]=r,t[14]=i,t[15]=o,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else _=t[21],v=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D=u??y,O=b?.disabled===!0,k=d[`aria-label`],A=d[`aria-labelledby`],te=d.title,N;t[33]!==i||t[34]!==p?(N=s(i,p),t[33]=i,t[34]=p,t[35]=N):N=t[35];let P;t[36]===l?P=t[37]:(P=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=P);let F;t[38]!==_||t[39]!==n||t[40]!==v||t[41]!==a||t[42]!==o||t[43]!==y||t[44]!==d.title||t[45]!==f||t[46]!==x||t[47]!==A||t[48]!==N||t[49]!==P||t[50]!==S||t[51]!==C||t[52]!==D||t[53]!==O||t[54]!==k?(F=(0,M.jsx)(_,{id:x,value:S,options:C,placeholder:D,allowEmpty:v,emptyLabel:y,emptyDisabled:O,disabled:o,ariaLabel:k,ariaLabelledBy:A,title:te,side:f,align:n,triggerClassName:N,contentClassName:a,onChange:P}),t[38]=_,t[39]=n,t[40]=v,t[41]=a,t[42]=o,t[43]=y,t[44]=d.title,t[45]=f,t[46]=x,t[47]=A,t[48]=N,t[49]=P,t[50]=S,t[51]=C,t[52]=D,t[53]=O,t[54]=k,t[55]=F):F=t[55];let I;t[56]!==o||t[57]!==d.name||t[58]!==g?(I=(0,M.jsx)(`input`,{name:d.name,value:g,readOnly:!0,hidden:!0,disabled:o}),t[56]=o,t[57]=d.name,t[58]=g,t[59]=I):I=t[59];let L;return t[60]!==F||t[61]!==I||t[62]!==w||t[63]!==T||t[64]!==E?(L=(0,M.jsxs)(`div`,{"aria-disabled":w,className:T,"data-select-name":E,children:[F,I]}),t[60]=F,t[61]=I,t[62]=w,t[63]=T,t[64]=E,t[65]=L):L=t[65],L}function De(e){return e.value!==``}function Oe(e){return e.value===``}export{ye as a,he as c,X as d,J as f,A as h,ve as i,me as l,te as m,Ee as n,be as o,Y as p,Ce as r,ge as s,xe as t,Z as u};
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{t as a}from"./createLucideIcon-DPHK1VkS.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{i as c,n as l}from"./dist-CxGUk8J-.js";import{a as u,c as d,g as f,h as p,i as m,l as h,n as g,o as _,p as v,r as y,t as b,u as x}from"./Combination-14nmIgxH.js";import{a as S,i as C,n as w,r as T,t as E}from"./dist-DaxPZj9e.js";import{a as D,s as O,t as k}from"./settings-shell-dialog-layer-BU3UuiJr.js";var A=a(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ee=r(),te=t({Anchor:()=>pe,Arrow:()=>he,Close:()=>me,Content:()=>Z,Popover:()=>z,PopoverAnchor:()=>B,PopoverArrow:()=>q,PopoverClose:()=>K,PopoverContent:()=>G,PopoverPortal:()=>U,PopoverTrigger:()=>V,Portal:()=>X,Root:()=>J,Trigger:()=>Y,createPopoverScope:()=>F}),j=e(n(),1),M=i(),N=`Popover`,[P,F]=p(N,[S]),I=S(),[L,R]=P(N),z=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=I(t),c=j.useRef(null),[l,u]=j.useState(!1),[d,f]=y({prop:r,defaultProp:i??!1,onChange:a,caller:N});return(0,M.jsx)(C,{...s,children:(0,M.jsx)(L,{scope:t,contentId:_(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:j.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:j.useCallback(()=>u(!0),[]),onCustomAnchorRemove:j.useCallback(()=>u(!1),[]),modal:o,children:n})})};z.displayName=N;var ne=`PopoverAnchor`,B=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ne,n),a=I(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return j.useEffect(()=>(o(),()=>s()),[o,s]),(0,M.jsx)(E,{...a,...r,ref:t})});B.displayName=ne;var re=`PopoverTrigger`,V=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(re,n),a=I(n),o=c(t,i.triggerRef),s=(0,M.jsx)(v.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":fe(i.open),...r,ref:o,onClick:f(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,M.jsx)(E,{asChild:!0,...a,children:s})});V.displayName=re;var H=`PopoverPortal`,[ie,ae]=P(H,{forceMount:void 0}),U=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=R(H,t);return(0,M.jsx)(ie,{scope:t,forceMount:n,children:(0,M.jsx)(m,{present:n||a.open,children:(0,M.jsx)(u,{asChild:!0,container:i,children:r})})})};U.displayName=H;var W=`PopoverContent`,G=j.forwardRef((e,t)=>{let n=ae(W,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=R(W,e.__scopePopover);return(0,M.jsx)(m,{present:r||a.open,children:a.modal?(0,M.jsx)(se,{...i,ref:t}):(0,M.jsx)(ce,{...i,ref:t})})});G.displayName=W;var oe=l(`PopoverContent.RemoveScroll`),se=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(null),i=c(t,r),a=j.useRef(!1);return j.useEffect(()=>{let e=r.current;if(e)return g(e)},[]),(0,M.jsx)(b,{as:oe,allowPinchZoom:!0,children:(0,M.jsx)(le,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:f(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:f(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ce=j.forwardRef((e,t)=>{let n=R(W,e.__scopePopover),r=j.useRef(!1),i=j.useRef(!1);return(0,M.jsx)(le,{...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()}})}),le=j.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=R(W,n),m=I(n);return h(),(0,M.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(x,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,M.jsx)(T,{"data-state":fe(p.open),role:`dialog`,id:p.contentId,...m,...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)`}})})})}),ue=`PopoverClose`,K=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(ue,n);return(0,M.jsx)(v.button,{type:`button`,...r,ref:t,onClick:f(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=ue;var de=`PopoverArrow`,q=j.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=I(n);return(0,M.jsx)(w,{...i,...r,ref:t})});q.displayName=de;function fe(e){return e?`open`:`closed`}var J=z,pe=B,Y=V,X=U,Z=G,me=K,he=q;function ge(e,t=!1){if(!t)return k;switch(e){case`modal`:return D;case`page`:return O;default:return`z-50`}}var Q=(0,j.createContext)({layer:`default`,portalContainer:null});function _e(e,t){return e===`modal`||t===`modal`?`modal`:e===`page`||t===`page`?`page`:`default`}function ve(e){let t=(0,ee.c)(9),{layer:n,portalContainer:r,children:i}=e,a=(0,j.useContext)(Q),o;t[0]!==n||t[1]!==a.layer?(o=_e(a.layer,n),t[0]=n,t[1]=a.layer,t[2]=o):o=t[2];let s=o,c=r??a.portalContainer,l;t[3]!==s||t[4]!==c?(l={layer:s,portalContainer:c},t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==l?(u=(0,M.jsx)(Q.Provider,{value:l,children:i}),t[6]=i,t[7]=l,t[8]=u):u=t[8],u}function ye(){return(0,j.useContext)(Q).layer}function be(){return(0,j.useContext)(Q).portalContainer}function xe({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:a=!1,disabledValues:c,disabled:l,id:u,ariaLabel:d,ariaLabelledBy:f,title:p,triggerClassName:m,contentClassName:h,side:g=`bottom`,align:_=`start`,onChange:v}){let[y,b]=(0,j.useState)(!1),x=ye(),S=be(),C=ge(x,S!==null),w=t.find(t=>t.value===e)?.label??(e?`${e} · unavailable`:n),T;return(0,M.jsxs)(J,{open:y,onOpenChange:b,children:[(0,M.jsx)(Y,{asChild:!0,children:(0,M.jsxs)(`button`,{id:u,type:`button`,"aria-label":d,"aria-labelledby":f,title:p,disabled:l,className:s(`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`,l&&`cursor-not-allowed opacity-50 hover:border-edge`,m),children:[(0,M.jsx)(`span`,{className:s(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:w}),(0,M.jsx)(A,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,M.jsx)(X,{container:S??void 0,children:(0,M.jsx)(Z,{side:g,align:_,sideOffset:4,className:s(C,`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`,h),children:(0,M.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[r?(0,M.jsxs)(`button`,{type:`button`,disabled:a,className:s(`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||(v(``),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,t.map(t=>{let n=t.disabled===!0||c?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==T;return T=t.group,(0,M.jsxs)(j.Fragment,{children:[r?(0,M.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,M.jsxs)(`button`,{type:`button`,disabled:n,className:s(`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||(v(t.value),b(!1))},children:[(0,M.jsx)(o,{className:s(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]})]},`${t.group??``}:${t.value}`)})]})})})]})}function $(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map($).join(``):(0,j.isValidElement)(e)?$(e.props.children):``}function Se(e,t){let n=[];return j.Children.forEach(e,e=>{if(!(0,j.isValidElement)(e))return;if(e.type===j.Fragment){n.push(...Se(e.props.children,t));return}if(e.type===we){let t=e.props;n.push(...Se(t.children,$(t.label)));return}if(e.type!==Ce)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 Ce(e){return null}function we(e){return null}function Te(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 Ee(e){let t=(0,ee.c)(66),n,r,i,a,o,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:o,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,j.useId)(),g=m==null?``:String(m),_,v,y,b,x,S,C,w,T,E;if(t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==g){let e=Se(r);b=e.find(Oe),v=b!==void 0,y=b?.label||u||``,w=o||void 0,t[31]===i?T=t[32]:(T=Te(i),t[31]=i,t[32]=T),E=d.name,_=xe,x=c??h,S=g,C=e.filter(De),t[13]=r,t[14]=i,t[15]=o,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else _=t[21],v=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D=u??y,O=b?.disabled===!0,k=d[`aria-label`],A=d[`aria-labelledby`],te=d.title,N;t[33]!==i||t[34]!==p?(N=s(i,p),t[33]=i,t[34]=p,t[35]=N):N=t[35];let P;t[36]===l?P=t[37]:(P=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=P);let F;t[38]!==_||t[39]!==n||t[40]!==v||t[41]!==a||t[42]!==o||t[43]!==y||t[44]!==d.title||t[45]!==f||t[46]!==x||t[47]!==A||t[48]!==N||t[49]!==P||t[50]!==S||t[51]!==C||t[52]!==D||t[53]!==O||t[54]!==k?(F=(0,M.jsx)(_,{id:x,value:S,options:C,placeholder:D,allowEmpty:v,emptyLabel:y,emptyDisabled:O,disabled:o,ariaLabel:k,ariaLabelledBy:A,title:te,side:f,align:n,triggerClassName:N,contentClassName:a,onChange:P}),t[38]=_,t[39]=n,t[40]=v,t[41]=a,t[42]=o,t[43]=y,t[44]=d.title,t[45]=f,t[46]=x,t[47]=A,t[48]=N,t[49]=P,t[50]=S,t[51]=C,t[52]=D,t[53]=O,t[54]=k,t[55]=F):F=t[55];let I;t[56]!==o||t[57]!==d.name||t[58]!==g?(I=(0,M.jsx)(`input`,{name:d.name,value:g,readOnly:!0,hidden:!0,disabled:o}),t[56]=o,t[57]=d.name,t[58]=g,t[59]=I):I=t[59];let L;return t[60]!==F||t[61]!==I||t[62]!==w||t[63]!==T||t[64]!==E?(L=(0,M.jsxs)(`div`,{"aria-disabled":w,className:T,"data-select-name":E,children:[F,I]}),t[60]=F,t[61]=I,t[62]=w,t[63]=T,t[64]=E,t[65]=L):L=t[65],L}function De(e){return e.value!==``}function Oe(e){return e.value===``}export{ye as a,he as c,X as d,J as f,A as h,ve as i,me as l,te as m,Ee as n,be as o,Y as p,Ce as r,ge as s,xe as t,Z as u};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-iKjqemWG.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Ya as l}from"./index-jqDCfet4.js";import{n as u}from"./api-53ZXsuyr.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-CPylQjH9.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Xa as l}from"./index-B3zYJBhK.js";import{n as u}from"./api-HoIz_ija.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};