@xopcai/xopc 0.0.174 → 0.0.176

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 (242) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-CyEDJeIt.js → activity-store-DsFM1upC.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DF7Bol6I.js → agent-avatar-dicebear-DvdMLOga.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-BVjlpbeZ.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-DYunqroX.js → api-BdPLCCBm.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-DwyUxpgY.js → api-Bop4IQRW.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-B4xJyvDu.js → app-management-settings-panel-DMLDOHul.js} +1 -1
  9. package/dist/gateway/static/root/assets/appearance-settings-DbI9foFR.js +1 -0
  10. package/dist/gateway/static/root/assets/apps-page-njqxLWYD.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DWhBmmjD.js → archive-plugin-Dfdxuwvb.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-BOpZfa_I.js → attachment-load-Dn3RlnYD.js} +2 -2
  13. package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
  14. package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
  15. package/dist/gateway/static/root/assets/{automation-suggestion-card-Byu3I7Rs.js → automation-suggestion-card-Bc0Y7A9u.js} +1 -1
  16. package/dist/gateway/static/root/assets/automations-page-D-eweHZJ.js +6 -0
  17. package/dist/gateway/static/root/assets/{binary-plugins-6AG1qatz.js → binary-plugins-0XtB-xC0.js} +2 -2
  18. package/dist/gateway/static/root/assets/{block-editor-CJhrn98_.js → block-editor-C4fXWbEE.js} +6 -6
  19. package/dist/gateway/static/root/assets/browser-settings-page-lC86-drr.js +8 -0
  20. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CBVb4mt9.js → browser-workflow-inputs-CZmzNymN.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-workflows-page-Cq4XUKbu.js → browser-workflows-page-CBYM9HqG.js} +2 -2
  22. package/dist/gateway/static/root/assets/capabilities-settings-panel-6tYNfHqJ.js +7 -0
  23. package/dist/gateway/static/root/assets/{capability-presets-api-hbW4NAKO.js → capability-presets-api-BiJxmmhW.js} +1 -1
  24. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Co-ymbd9.js +1 -0
  25. package/dist/gateway/static/root/assets/{channel-recipient-api-CzMjHb17.js → channel-recipient-api-BKTUZDp-.js} +1 -1
  26. package/dist/gateway/static/root/assets/channels-settings-D46eVjaQ.js +1 -0
  27. package/dist/gateway/static/root/assets/channels-status-swr-BMRAO4zZ.js +1 -0
  28. package/dist/gateway/static/root/assets/{connector-logo-B9Au6gMZ.js → connector-logo-Pr4RIKjj.js} +1 -1
  29. package/dist/gateway/static/root/assets/connectors-page-Dw1eYbRi.js +2 -0
  30. package/dist/gateway/static/root/assets/desktop-pet-B8cZuQUt.js +1 -0
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-CNff5TFb.js → desktop-pet-settings-CEQacUDF.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-Bf956uo-.js → directory-picker-path-field-DWnxdZtc.js} +1 -1
  33. package/dist/gateway/static/root/assets/{dreaming-settings-CHM8FE1g.js → dreaming-settings-D2e2w2Ho.js} +3 -3
  34. package/dist/gateway/static/root/assets/{extension-debug-page-ZqM_0eUs.js → extension-debug-page-BLjTGbv3.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-D4hvXOMM.js → extension-page-D2_UC6hy.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-GsqxaJjA.js → extension-settings-page-BsH6o_PX.js} +1 -1
  37. package/dist/gateway/static/root/assets/{focus-detail-page-CE6uwrl1.js → focus-detail-page-BBXUtxRB.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-api-B4THmgnS.js → gateway-config-api-C-DkC6UJ.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-CPv-MxGE.js → gateway-settings-DEOGiimF.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-MP3K71pP.js → gateway-startup-retry-BlSLh1TF.js} +1 -1
  41. package/dist/gateway/static/root/assets/goal-create-dialog-CSFcRE_N.js +1 -0
  42. package/dist/gateway/static/root/assets/goal-detail-page-VjRArfAJ.js +4 -0
  43. package/dist/gateway/static/root/assets/{goals-config-api-DCcDuIjG.js → goals-config-api-CcdS9qek.js} +1 -1
  44. package/dist/gateway/static/root/assets/goals-page-BAcErdch.js +2 -0
  45. package/dist/gateway/static/root/assets/{goals-settings-o9QMXvNq.js → goals-settings-BY7crl0z.js} +1 -1
  46. package/dist/gateway/static/root/assets/{heartbeat-settings-DixwpXnH.js → heartbeat-settings-DtTkS0gs.js} +1 -1
  47. package/dist/gateway/static/root/assets/{image-generation-api-BOGH9FGi.js → image-generation-api-WGgkbwDZ.js} +1 -1
  48. package/dist/gateway/static/root/assets/index-2UImfRDC.js +212 -0
  49. package/dist/gateway/static/root/assets/index-CS9sVShT.css +1 -0
  50. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D4o4ZPF6.js → keyboard-shortcuts-settings-C5lpWQ3f.js} +1 -1
  51. package/dist/gateway/static/root/assets/local-app-workbench-page-Cl0fcPL4.js +2 -0
  52. package/dist/gateway/static/root/assets/{local-apps-page-GzMmpO7G.js → local-apps-page-b05wWvXG.js} +1 -1
  53. package/dist/gateway/static/root/assets/{locale-store-CAuhEGCn.js → locale-store-sToMfHX_.js} +1 -1
  54. package/dist/gateway/static/root/assets/logs-page-cDE1jLJv.js +7 -0
  55. package/dist/gateway/static/root/assets/{markdown-split-CIX8D1pv.js → markdown-split-0gPVst5y.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-Bp3eIA45.js → media-plugins-Rxyq_KTm.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-CarlxqXV.js +3 -0
  58. package/dist/gateway/static/root/assets/{notes-page-RVFiYAoO.js → notes-page-DRhNDl_Q.js} +1 -1
  59. package/dist/gateway/static/root/assets/notes-workbench-BKNBk0Uf.js +4 -0
  60. package/dist/gateway/static/root/assets/{page-tabs-BGAYH3Ef.js → page-tabs-cOEOQqHh.js} +1 -1
  61. package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
  62. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
  63. package/dist/gateway/static/root/assets/{preview-open-alternatives-BM6pDkHp.js → preview-open-alternatives-BopOLFvu.js} +1 -1
  64. package/dist/gateway/static/root/assets/{product-open-page-BiMetEmn.js → product-open-page-DWVPmmOq.js} +1 -1
  65. package/dist/gateway/static/root/assets/project-detail-page-BhjEXNQW.js +1 -0
  66. package/dist/gateway/static/root/assets/projects-page-B80e69PH.js +1 -0
  67. package/dist/gateway/static/root/assets/remote-access-hub-CwdVob6H.js +1 -0
  68. package/dist/gateway/static/root/assets/{save-bar-controls-BdjV8MK5.js → save-bar-controls-BfZmKe1t.js} +1 -1
  69. package/dist/gateway/static/root/assets/{schedule-field-ChlqXU46.js → schedule-field-Cpi4jCRV.js} +1 -1
  70. package/dist/gateway/static/root/assets/{schema-form-DDKf5ZSH.js → schema-form-OXFkcZQe.js} +1 -1
  71. package/dist/gateway/static/root/assets/sessions-page-BGt3Asj6.js +1 -0
  72. package/dist/gateway/static/root/assets/settings-advanced-gate-BnTdM9Nn.js +1 -0
  73. package/dist/gateway/static/root/assets/{settings-form-section-CPG0KGVs.js → settings-form-section-BwqkZCHJ.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DRSDHucM.js → settings-loading-skeleton-BbqH_S3Y.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-CeB7_xD0.js → settings-page-BoxC-JSa.js} +1 -1
  76. package/dist/gateway/static/root/assets/{settings-page-layout-BENrkwd0.js → settings-page-layout-Ddu2iGaW.js} +1 -1
  77. package/dist/gateway/static/root/assets/setup-status-panel-z1Lwv0js.js +1 -0
  78. package/dist/gateway/static/root/assets/{share-preview-page-DIzczJkG.js → share-preview-page-CVazOFjy.js} +2 -2
  79. package/dist/gateway/static/root/assets/shares-settings-C4lXuyQj.js +1 -0
  80. package/dist/gateway/static/root/assets/skill-reload-api-DSuIDkeI.js +1 -0
  81. package/dist/gateway/static/root/assets/skills-page-xgZczqVe.js +2 -0
  82. package/dist/gateway/static/root/assets/skills-page.utils-DgyB1tSo.js +1 -0
  83. package/dist/gateway/static/root/assets/{system-settings-panel-Dp4d5Q1B.js → system-settings-panel-BoLSQL65.js} +1 -1
  84. package/dist/gateway/static/root/assets/{theme-store-CbGc1laW.js → theme-store-CBNcGOfj.js} +1 -1
  85. package/dist/gateway/static/root/assets/time-picker-gochWrny.js +1 -0
  86. package/dist/gateway/static/root/assets/{typed-models-lib-DwPk3OPL.js → typed-models-lib-DvRnr7YB.js} +1 -1
  87. package/dist/gateway/static/root/assets/{use-channel-catalog-CXrEu2dw.js → use-channel-catalog-CA9BFVB7.js} +1 -1
  88. package/dist/gateway/static/root/assets/user-context-page-CEfIy4WZ.js +1 -0
  89. package/dist/gateway/static/root/assets/{voice-api-key-field-DFoA79LB.js → voice-api-key-field-v8tgylEZ.js} +1 -1
  90. package/dist/gateway/static/root/assets/work-discovery-page-B-3MClaf.js +1 -0
  91. package/dist/gateway/static/root/assets/work-item-detail-page-CEsFEdax.js +1 -0
  92. package/dist/gateway/static/root/assets/work-page-CT9AHnq6.js +3 -0
  93. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CC3cJn5k.js +3 -0
  94. package/dist/gateway/static/root/assets/workflows-page-C-1-_Zp1.js +11 -0
  95. package/dist/gateway/static/root/index.html +7 -7
  96. package/dist/package.js +1 -1
  97. package/dist/src/agent/agent-manager.js +8 -8
  98. package/dist/src/agent/context/execution-scope.d.ts +26 -0
  99. package/dist/src/agent/context/execution-scope.js +84 -0
  100. package/dist/src/agent/context/project-context.d.ts +3 -1
  101. package/dist/src/agent/context/project-context.js +26 -8
  102. package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
  103. package/dist/src/agent/embedded/model-runtime.js +17 -29
  104. package/dist/src/agent/embedded/session-runner.js +2 -3
  105. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  106. package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
  107. package/dist/src/agent/prompt/system-prompt.js +1 -1
  108. package/dist/src/agent/service/process-direct-streaming.js +7 -4
  109. package/dist/src/agent/service.js +1 -1
  110. package/dist/src/agent/session/session-config-service.d.ts +4 -1
  111. package/dist/src/agent/session/session-config-service.js +5 -3
  112. package/dist/src/agent/session/session-inspector.d.ts +6 -0
  113. package/dist/src/agent/session/session-inspector.js +9 -2
  114. package/dist/src/agent/skills/hub-pull.js +1 -1
  115. package/dist/src/agent/skills/index.d.ts +2 -0
  116. package/dist/src/agent/skills/index.js +14 -5
  117. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  118. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  119. package/dist/src/agent/skills/test-framework.js +1 -1
  120. package/dist/src/agent/workflow/subagent-runner.js +2 -0
  121. package/dist/src/agent/workflow/types.d.ts +1 -0
  122. package/dist/src/auth/model-credential-store.d.ts +17 -0
  123. package/dist/src/auth/model-credential-store.js +110 -0
  124. package/dist/src/auth/oauth/github-copilot.js +2 -2
  125. package/dist/src/auth/oauth/openai-codex.js +98 -7
  126. package/dist/src/auth/oauth/types.d.ts +4 -1
  127. package/dist/src/auth/oauth/xopc-cloud.js +124 -6
  128. package/dist/src/automations/domain/defaults.d.ts +1 -0
  129. package/dist/src/automations/domain/defaults.js +4 -0
  130. package/dist/src/automations/domain/index.d.ts +1 -0
  131. package/dist/src/automations/domain/index.js +2 -1
  132. package/dist/src/automations/index.js +2 -1
  133. package/dist/src/automations/service/action-executor.js +2 -2
  134. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  135. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  136. package/dist/src/cli/commands/skills.js +1 -1
  137. package/dist/src/cli/commands/update.js +1 -1
  138. package/dist/src/config/agent-profile.js +1 -1
  139. package/dist/src/config/index.js +2 -2
  140. package/dist/src/config/schema.d.ts +21 -0
  141. package/dist/src/config/schema.js +12 -2
  142. package/dist/src/gateway/agents-admin.js +1 -1
  143. package/dist/src/gateway/heartbeat/service.js +1 -1
  144. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
  145. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  146. package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
  147. package/dist/src/gateway/hono/oauth-async.js +20 -8
  148. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
  149. package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
  150. package/dist/src/gateway/hono/routes/goals.js +13 -0
  151. package/dist/src/gateway/hono/routes/home.d.ts +16 -3
  152. package/dist/src/gateway/hono/routes/home.js +98 -25
  153. package/dist/src/gateway/hono/routes/index.js +2 -0
  154. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  155. package/dist/src/gateway/hono/routes/project-skills.d.ts +3 -0
  156. package/dist/src/gateway/hono/routes/project-skills.js +119 -0
  157. package/dist/src/gateway/hono/routes/update.js +2 -2
  158. package/dist/src/gateway/index.js +1 -1
  159. package/dist/src/gateway/run-loop.js +1 -1
  160. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  161. package/dist/src/gateway/service.js +5 -5
  162. package/dist/src/heartbeat/index.js +1 -1
  163. package/dist/src/infra/gateway-processes.js +1 -1
  164. package/dist/src/infra/update-restart.js +1 -1
  165. package/dist/src/infra/update-runner.js +2 -2
  166. package/dist/src/infra/update-startup.js +1 -1
  167. package/dist/src/mcp/channel-bridge.js +1 -1
  168. package/dist/src/projects/index.d.ts +1 -0
  169. package/dist/src/projects/index.js +2 -1
  170. package/dist/src/projects/project-skill-service.d.ts +67 -0
  171. package/dist/src/projects/project-skill-service.js +131 -0
  172. package/dist/src/providers/index.js +4 -2
  173. package/dist/src/providers/provider-auth-service.d.ts +22 -0
  174. package/dist/src/providers/provider-auth-service.js +66 -0
  175. package/dist/src/providers/register-runtime-providers.d.ts +6 -0
  176. package/dist/src/providers/register-runtime-providers.js +55 -0
  177. package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
  178. package/dist/src/providers/xopc-cloud-account-service.js +6 -5
  179. package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
  180. package/dist/src/providers/xopc-cloud-config.js +13 -0
  181. package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
  182. package/dist/src/providers/xopc-cloud-model-source.js +6 -5
  183. package/dist/src/session/index.d.ts +1 -1
  184. package/dist/src/session/index.js +2 -2
  185. package/dist/src/session/thinking-resolve.d.ts +8 -0
  186. package/dist/src/session/thinking-resolve.js +6 -3
  187. package/dist/src/storage/sqlite/home-attention-repository.d.ts +3 -0
  188. package/dist/src/storage/sqlite/home-attention-repository.js +21 -0
  189. package/dist/src/storage/sqlite/index.d.ts +1 -0
  190. package/dist/src/storage/sqlite/index.js +2 -1
  191. package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +9 -0
  192. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  193. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  194. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  195. package/dist/src/storage/sqlite/schema.js +1 -1
  196. package/dist/src/storage/sqlite/schema.sql +10 -0
  197. package/dist/src/tui/tui-startup-resources.js +1 -1
  198. package/dist/src/tui/tui.js +2 -2
  199. package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
  200. package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
  201. package/dist/src/workflows/engine/workflow-engine.js +2 -0
  202. package/dist/src/workflows/service/workflow-run-service.js +11 -5
  203. package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
  204. package/package.json +5 -5
  205. package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +0 -2
  206. package/dist/gateway/static/root/assets/appearance-settings-B2PQxRiu.js +0 -1
  207. package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +0 -1
  208. package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +0 -6
  209. package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +0 -8
  210. package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +0 -7
  211. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +0 -1
  212. package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +0 -1
  213. package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +0 -1
  214. package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +0 -2
  215. package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +0 -1
  216. package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +0 -1
  217. package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +0 -4
  218. package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +0 -2
  219. package/dist/gateway/static/root/assets/index-CfXiRNN5.css +0 -1
  220. package/dist/gateway/static/root/assets/index-eyttVNS_.js +0 -212
  221. package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +0 -2
  222. package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +0 -7
  223. package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +0 -3
  224. package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +0 -4
  225. package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
  226. package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
  227. package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +0 -1
  228. package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +0 -1
  229. package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +0 -1
  230. package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +0 -1
  231. package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +0 -1
  232. package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +0 -1
  233. package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +0 -1
  234. package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +0 -1
  235. package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +0 -2
  236. package/dist/gateway/static/root/assets/time-picker-BhgCeDuO.js +0 -1
  237. package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +0 -1
  238. package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +0 -1
  239. package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +0 -1
  240. package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +0 -1
  241. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BuniGPO0.js +0 -3
  242. package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.js +0 -11
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CJhrn98_.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-eyttVNS_.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/circle-alert-BEjgurr2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-CAuhEGCn.js","assets/messages-BiBdO1-O.js","assets/cn-JdwAhgNB.js","assets/schemas-DgQq6Z5S.js","assets/product-delivery-BTRT9kCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-MP3K71pP.js","assets/activity-store-CyEDJeIt.js","assets/theme-store-CbGc1laW.js","assets/index-CfXiRNN5.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.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-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-BiBdO1-O.js";import{l as c,n as l}from"./locale-store-CAuhEGCn.js";import{i as u}from"./theme-store-CbGc1laW.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$s as p,Ac as m,Bc as h,Bo as g,Ci as _,Cl as v,Cr as y,Ei as b,Er as x,Fc as S,Fu as C,Go as w,Gs as T,Ho as E,Ic as D,Iu as O,Jc as k,Kl as A,Ks as j,Mc as M,Ms as N,Nt as P,Nu as F,Pc as ee,Qc as I,Rc as L,Rl as R,Sc as z,Si as te,Sl as B,Ti as ne,To as re,Tu as ie,U as ae,Ul as V,Uo as oe,Vo as H,Wo as U,_ as se,_r as W,ac as ce,ar as le,bl as G,br as K,cr as ue,dr as de,er as fe,eu as pe,fr as me,gr as he,hc as ge,hl as _e,hr as ve,ic as q,is as J,lr as ye,mc as Y,mr as be,nc as xe,ns as Se,or as Ce,pr as we,qo as Te,qs as Ee,ru as De,sr as Oe,tl as ke,tr as Ae,ur as je,vr as Me,wi as X,wr as Ne,xi as Pe,xr as Fe,yl as Ie,yr as Le,zo as Re,zu as ze}from"./index-eyttVNS_.js";import{t as Be}from"./automation-suggestion-card-Byu3I7Rs.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(oe,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`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]=h):h=t[4];let _=a?.alt||`Image preview`,v;t[5]===_?v=t[6]:(v=(0,$.jsx)(w,{className:`sr-only`,children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(N,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,$.jsx)(g,{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:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=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]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,$.jsxs)(U,{children:[m,(0,$.jsxs)(H,{className:h,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let C;t[16]!==S||t[17]!==f?(C=(0,$.jsx)(Re,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let T;return t[19]!==n||t[20]!==C?(T=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=T):T=t[21],T}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=x(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`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)(B,{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 u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(Ne,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)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 Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(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 et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=Ae(),p=Ae(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,v=m&&u>0?u:i??0,y=v>0?Math.min(_/v*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(b=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=o(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=h?`Pause`:`Play`,O;t[14]!==g||t[15]!==h?(O=g?(0,$.jsx)(ke,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(L,{className:`size-3.5`}):(0,$.jsx)(M,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${y}%`,j;t[23]===A?j=t[24]:(j=(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:A}})}),t[23]=A,t[24]=j);let N;t[25]!==v||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==j||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,P]}),t[31]=j,t[32]=P,t[33]=F):F=t[33];let ee;return t[34]!==F||t[35]!==w||t[36]!==k?(ee=(0,$.jsxs)(`div`,{className:w,onClick:tt,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=ee):ee=t[37],ee}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=rt(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(ct),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=Xe(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let v=g,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let C=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,w;t[11]===C?w=t[12]:(w=o(`group relative flex cursor-pointer flex-col gap-2 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-panel`,C),t[11]=C,t[12]=w);let E=d?`true`:void 0,D;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=D):D=t[18];let k;t[19]===n.title?k=t[20]:(k=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=k);let j=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,M;t[21]===j?M=t[22]:(M=o(`truncate text-sm leading-5`,j),t[21]=j,t[22]=M);let N;t[23]!==p||t[24]!==M?(N=(0,$.jsx)(`p`,{className:M,children:p}),t[23]=p,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==k||t[27]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[k,N]}),t[26]=k,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(A,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let L;t[34]===n.pinned?L=t[35]:(L=n.pinned?(0,$.jsx)(ee,{className:`size-4`}):(0,$.jsx)(S,{className:`size-4`}),t[34]=n.pinned,t[35]=L);let R=n.pinned?l.unpin:l.pin,z;t[36]!==I||t[37]!==L||t[38]!==R?(z=(0,$.jsxs)(te,{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:I,children:[L,R]}),t[36]=I,t[37]=L,t[38]=R,t[39]=z):z=t[39];let B;t[40]!==n.id||t[41]!==s?(B=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=B):B=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(O,{className:`size-4`}),t[43]=re):re=t[43];let ie;t[44]!==l.archive||t[45]!==B?(ie=(0,$.jsxs)(te,{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:B,children:[re,l.archive]}),t[44]=l.archive,t[45]=B,t[46]=ie):ie=t[46];let ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(ne,{className:`my-1 h-px bg-edge-subtle`}),t[47]=ae):ae=t[47];let V;t[48]!==n.id||t[49]!==c?(V=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=V):V=t[50];let oe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(T,{className:`size-4`}),t[51]=oe):oe=t[51];let H;t[52]!==l.delete||t[53]!==V?(H=(0,$.jsxs)(te,{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:V,children:[oe,l.delete]}),t[52]=l.delete,t[53]=V,t[54]=H):H=t[54];let U;t[55]!==z||t[56]!==ie||t[57]!==H?(U=(0,$.jsxs)(X,{children:[F,(0,$.jsx)(_,{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:ot,children:[z,ie,ae,H]})})]}),t[55]=z,t[56]=ie,t[57]=H,t[58]=U):U=t[58];let se;t[59]!==P||t[60]!==U||t[61]!==D?(se=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,P,U]}),t[59]=P,t[60]=U,t[61]=D,t[62]=se):se=t[62];let W;t[63]===n.pinned?W=t[64]:(W=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)(S,{className:`size-3`})}),t[63]=n.pinned,t[64]=W);let ce;t[65]===n.tags?ce=t[66]:(ce=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=ce);let le;t[67]===v?le=t[68]:(le=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=le);let G;t[69]!==W||t[70]!==ce||t[71]!==le?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[W,ce,le]}),t[69]=W,t[70]=ce,t[71]=le,t[72]=G):G=t[72];let K;return t[73]!==se||t[74]!==G||t[75]!==y||t[76]!==x||t[77]!==w||t[78]!==E?(K=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:w,"aria-current":E,children:[se,G]}),t[73]=se,t[74]=G,t[75]=y,t[76]=x,t[77]=w,t[78]=E,t[79]=K):K=t[79],K}function at(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 ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:D,ai_edit:ce,sync:z,restore:C};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>de(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async t=>{p(!0);try{await K(e,t),h(null),i()}catch{Te({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=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)(v,{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)(N,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??D,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`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:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,_,c)})]}),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(),g(e.timestamp)},disabled:f,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:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children: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 ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:p,onOpenChat:m,onOpenNewChat:h}=e,g=s(l(yt)).notes,_=a(),v=r?.aiDeep?.catalysis,y=v?.report??null,b;t[0]===n?b=t[1]:(b=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=b);let x;t[2]===n?x=t[3]:(x=()=>ye(n),t[2]=n,t[3]=x);let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S={revalidateOnFocus:!1},t[4]=S):S=t[4];let{data:C,mutate:w,isLoading:T}=d(b,x,S),E;t[5]===n?E=t[6]:(E=async e=>{try{await Le(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(F,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=k):k=t[8];let A;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=A):A=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:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:g.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":g.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:k})]}),(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:g.catalysisSectionDescription}),C?(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:g.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Me(n),{revalidate:!1}),disabled:T,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.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:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:g.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,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?g.processing:y?g.recatalyze:g.catalyzeAction}),y?(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:g.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:y.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.nextActions.slice(0,4).map(pt)})]}),(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:g.confidenceLabel.replace(`{{percent}}`,String(Math.round(y.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackHelpfulAria,children:(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackNotHelpfulAria,children:(0,$.jsx)(Ee,{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:g.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:[A,g.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:p,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:p?g.openingChat:g.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:p,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:g.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(`/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||g.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.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:g.noThreads})]})]})]})}function pt(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 mt(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 ht(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 _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(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 yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-CJhrn98_.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])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([28,1,3,25,5,29])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){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 Tt(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:R},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:pe},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:V},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`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]=u,t[12]=r,t[13]=d):d=t[13],d}function Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:p,autoFocus:m=!1,onAutoFocusConsumed:h}){let g=l(e=>e.language),_=s(g).notes,b=s(g).automations.suggestions,x=a(),S=u(e=>e.resolved)===`dark`,{openImage:C}=He(),[w,T]=(0,Q.useState)(`wysiwyg`),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,ee]=(0,Q.useState)(360),[L,R]=(0,Q.useState)(!1),[z,te]=(0,Q.useState)(!1),[B,ne]=(0,Q.useState)(!1),ie=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),oe=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),de=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),he=(0,Q.useRef)(null),_e=re(e=>e.setPageHeader),ve=re(e=>e.clearPageHeader),{data:q,mutate:J}=d(e?[`note-detail`,e]:null,()=>ue(e)),{data:ye=[],mutate:Y}=d(e?[`note-threads`,e]:null,()=>me(e),{revalidateOnFocus:!1}),xe=O!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{ie.current=!1,N(``),k(null),D(null),V.current=!1,he.current=null},[e]),(0,Q.useEffect)(()=>{!q||ie.current||(N(q.title??``),ie.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!m||!q||xe||he.current===e)return;let t=window.requestAnimationFrame(()=>{pe.current?.focus(),h?.()});return he.current=e,()=>window.cancelAnimationFrame(t)},[m,xe,q,e,h]);let Se=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ce=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ze,i),children:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),we=(0,Q.useCallback)(t=>{N(t),e&&(W.current=t,H.current&&clearTimeout(H.current),H.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){j(!0);try{await Fe(e,{title:t}),await J(),n?.()}catch{}finally{j(!1)}}},600))},[e,J,n]),Ee=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||Se||void 0,children:M||Se}),A?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,A,Se,M]),De=(0,Q.useCallback)(async(t=!1)=>{ne(!0);try{let n=await be(e,{forceNew:t});await J(),await Y(),x(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){Te({type:`error`,title:_.chatOpenFailedTitle,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{ne(!1)}},[J,Y,x,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{te(!0);try{await le(e),await J()}catch(e){Te({type:`error`,title:_.catalysisFailed,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{te(!1)}},[J,e]),ke=(0,Q.useCallback)(()=>{D(E===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!z&&Oe()},[E,z,Oe,q?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=O?.markdown??U.current??q?.markdown??``,n=O?.title??M,r=f([n,t].filter(Boolean).join(`
3
-
4
- `));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:fe(r,g)}},[g,_.titlePlaceholder,q?.markdown,e,O,M]),Me=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,ze),children:[p?(0,$.jsx)(`button`,{type:`button`,onClick:p,"aria-label":_.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)(ge,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(ae,{input:Ae,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:z,"aria-label":_.catalysisSectionTitle,className:o(`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`,E===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),z?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(!1),disabled:B,className:o(`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)(I,{className:`size-3.5`,"aria-hidden":!0}),B?_.openingChat:_.openChatButton]}),(0,$.jsx)(Tt,{mode:w,onModeChange:T,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(E===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,E===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}),[z,ke,De,w,_.history,_.modeEdit,_.modePreview,_.modeSource,B,E,p,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,Ae]);(0,Q.useLayoutEffect)(()=>(_e({startExtra:Ce,main:q?Ee:null,end:q?Me:null}),()=>{c&&ve()}),[c,ve,Me,Ee,Ce,q,_e]);let X=(0,Q.useCallback)(t=>{e&&(U.current=t,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{let t=U.current;if(U.current=null,t!==null){j(!0);try{await Fe(e,{markdown:t}),await J(),n?.()}catch(e){Te({type:`error`,title:_.saveFailed,message:e instanceof Error?e.message:_.saveFailedHint})}finally{j(!1)}}},600))},[e,J,_.saveFailed,_.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&k(e)})},[e]),Pe=(0,Q.useCallback)(()=>{D(null),k(null)},[]),Ie=(0,Q.useCallback)(()=>{D(null),k(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{oe.current&&clearTimeout(oe.current),H.current&&clearTimeout(H.current);let t=U.current,n=W.current;U.current=null,W.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Fe(e,r)},[e]),q===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(q===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:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.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:_.back})]});let Le=xe?O.title??``:M,Re=xe?O.markdown??``:q.markdown??``,Z=new Date(q.createdAt).getTime(),Ve=Number.isFinite(Z)&&Date.now()-Z<3600*1e3?(0,$.jsx)(Be,{title:b.noteCreatedTitle,description:b.noteCreatedDescription,prompt:b.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)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(se,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(se,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(`div`,{ref:G,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:xe?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Le&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Le}),Re?(0,$.jsx)(y,{noteId:e,content:Re,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[w===`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:pe,type:`text`,value:M,onChange:e=>we(e.target.value),onCompositionStart:()=>{V.current=!0},onCompositionEnd:()=>{V.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!V.current&&!t.isComposing&&(e.preventDefault(),(G.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(St,{initialContent:q.markdown??``,onChange:X,noteId:e},`wysiwyg-${e}`)})})]}),w===`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:pe,type:`text`,value:M,onChange:e=>we(e.target.value),placeholder:_.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(Ct,{initialContent:q.markdown??``,onChange:X,isDark:S},`source-${e}`)})})]}),w===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&C(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),q.markdown?(0,$.jsx)(y,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})})]}),(0,$.jsx)(`div`,{ref:K,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!L&&`transition-[width] duration-300 ease-in-out`),style:{width:E?P:0},children:(0,$.jsxs)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col`,style:{width:P},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),R(!0);let n=e.clientX,r=P,i=e.pointerId,a=0,o=P,s=P,c=()=>{a=0,s=o,E&&K.current?.style.setProperty(`width`,`${s}px`),de.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}R(!1),ee(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:o(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,L&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:E===`history`?(0,$.jsx)(dt,{noteId:e,activeTimestamp:O?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Ie}):E===`breakdown`?(0,$.jsx)(ft,{noteId:e,note:q??null,catalyzing:z,onCatalyze:Oe,onClose:()=>D(null),noteThreads:ye,openingChat:B,onOpenChat:()=>De(!1),onOpenNewChat:()=>De(!0)}):null})]})})]})}var kt=3e4;function At(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function jt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(0),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)([]),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useCallback)(()=>{w.current&&=(clearInterval(w.current),null),T.current&&=(clearTimeout(T.current),null),x.current?.getTracks().forEach(e=>e.stop()),x.current=null,b.current=null,S.current=[],m(!1),g(0)},[]);(0,Q.useEffect)(()=>()=>E(),[E]);let D=(0,Q.useCallback)(async()=>{let e=b.current;if(!e||e.state!==`recording`)return;v(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-C.current)/1e3)),n=e.mimeType||At()||`audio/webm`,r=new Blob(S.current,{type:n});if(E(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{v(!1)}return}v(!1)},[E,i]),O=(0,Q.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=At(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);x.current=e,b.current=n,S.current=[],C.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&S.current.push(e.data)},n.start(),m(!0),g(0),w.current=setInterval(()=>{g(Math.round((Date.now()-C.current)/1e3))},250),T.current=setTimeout(()=>{D()},kt)}catch{E()}},[E,i,p,D,_]),A=(0,Q.useCallback)(()=>{if(p){D();return}O()},[p,O,D]),j=(0,Q.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),y.current?.focus()}}},[l,d,n]),M=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),j({navigate:!1}))},[j]),N=d||_;return(0,$.jsxs)(`div`,{className:o(`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`,p&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:N||s||p,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(G,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:A,disabled:N||c||d,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,p?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":p?`Stop recording`:`Voice`,"aria-pressed":p,children:p?(0,$.jsx)(xe,{className:`size-4 fill-current`}):(0,$.jsx)(k,{className:`size-4`})}),p?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(h))}):(0,$.jsx)(`textarea`,{ref:y,value:l,onChange:e=>u(e.target.value),onKeyDown:M,placeholder:e,rows:1,disabled:N,className:`min-h-8 flex-1 resize-none 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:!l.trim()||N||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,l.trim()&&!N&&!p?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(Y,{className:`size-4`})})]})}var Mt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Nt=240,Pt=320,Ft=520,It=560;function Lt(e){if(globalThis.localStorage===void 0)return Pt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Pt;let n=Number(t);return Number.isFinite(n)?n:Pt}catch{return Pt}}function Rt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var zt={thought:p,todo:q,voice:k,media:G,bookmark:ie,mixed:p,task:q};function Bt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Vt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Ht(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Ut({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:u,captureTags:f=[],listTitle:_,listDescription:v,emptyText:y,emptyDescription:b,listWidthStorageKey:x=`xopc.notes.listWidth`}){let C=s(l(e=>e.language)).notes,T=!!c(e=>e.token),[D,A]=(0,Q.useReducer)(P,Mt),[j,M]=(0,Q.useState)(!1),[F,ee]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>Lt(x)),[te,B]=(0,Q.useState)(!1),[ne,ae]=(0,Q.useState)(!1),[V,se]=(0,Q.useState)(!1),[ce,le]=(0,Q.useState)(null),K=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),[de]=(0,Q.useState)(()=>Date.now()),fe=a(),pe=(0,Q.useCallback)(e=>{let t=K.current?.clientWidth??window.innerWidth,n=Math.max(Nt,t-It);return Math.max(Nt,Math.min(Math.min(Ft,n),e))},[]),me=(0,Q.useCallback)(e=>{let t=pe(e);z(t),Rt(x,t)},[pe,x]);(0,Q.useLayoutEffect)(()=>{z(e=>pe(e))},[pe]);let{data:ye,mutate:Y,isLoading:be}=d((0,Q.useMemo)(()=>T?[`notes-list`,u,D.statusFilter,D.kindFilter,D.pinnedOnly]:null,[T,u,D.statusFilter,D.kindFilter,D.pinnedOnly]),()=>we({status:D.statusFilter===`all`?void 0:D.statusFilter,kind:D.kindFilter===`all`?void 0:D.kindFilter,tag:u,pinned:D.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),xe=be&&!ye,Ee=ye?.items??[],ke=ye?.total??0,Ae=F.trim(),{data:je,isLoading:Me}=d(T&&j&&Ae?[`notes-search`,u,Ae]:null,()=>we({search:Ae,tag:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=je?.items??[],Ne=e?Ee.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{L(0)},[Ae]),(0,Q.useEffect)(()=>{I>=X.length&&L(Math.max(0,X.length-1))},[I,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Pe=re(e=>e.setPageHeader),Le=re(e=>e.clearPageHeader),Be=ke>0?C.noteCount.replace(`{{count}}`,String(ke)):null,Z=C.searchDialogTitle,Ve=C.searchClose,He=C.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>M(!0),className:o(`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`,ze),"aria-label":Z,children:[(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Z})]}),[Z]);(0,Q.useLayoutEffect)(()=>{if(n)return T?(Pe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:_??C.title}),Be?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Be}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,T,Ue,_,n,C.title,Be,e,Pe]);let We=(0,Q.useMemo)(()=>({justNow:C.justNow,minutesAgo:C.minutesAgo,today:C.today,yesterday:C.yesterday,daysAgo:C.daysAgo}),[C.justNow,C.minutesAgo,C.today,C.yesterday,C.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:C.viewRecent,description:C.viewRecentDescription,icon:De,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:C.filterInbox,description:C.viewInboxDescription,icon:Ie,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:C.pinned,description:C.viewPinnedDescription,icon:S,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:C.viewTasks,description:C.viewTasksDescription,icon:q,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:C.kindVoice,description:C.viewVoiceDescription,icon:k,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:C.kindMedia,description:C.viewMediaDescription,icon:G,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:C.kindBookmark,description:C.viewBookmarksDescription,icon:ie,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:C.filterProcessed,description:C.viewProcessedDescription,icon:_e,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:C.filterArchived,description:C.viewArchiveDescription,icon:O,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[C.filterArchived,C.filterInbox,C.filterProcessed,C.kindBookmark,C.kindMedia,C.kindVoice,C.pinned,C.viewArchiveDescription,C.viewBookmarksDescription,C.viewInboxDescription,C.viewMediaDescription,C.viewPinnedDescription,C.viewProcessedDescription,C.viewRecent,C.viewRecentDescription,C.viewTasks,C.viewTasksDescription,C.viewVoiceDescription]),Ke=Ge.find(e=>Vt(D,e))??Ge[0],qe=_??Ke.label,Je=v??Ke.description,Ye=(0,Q.useCallback)(async(e,n)=>{let r=f.length?await Ce({markdown:e,kind:`thought`,tags:f,channel:`web`}):await ve(e,`web`);await Y(),n?.navigate!==!1&&fe(Ht(t,r.id))},[t,f,Y,fe]),$e=(0,Q.useCallback)(async()=>{if(!V){se(!0);try{let e=await Ce({markdown:``,kind:`thought`,tags:f,channel:`web`});A({type:`patch`,patch:Mt}),await Y(),le(e.id),fe(Ht(t,e.id))}catch(e){Te({type:`error`,title:C.createBlankFailed,message:e instanceof Error?e.message:C.createBlankFailedHint})}finally{se(!1)}}},[t,f,V,Y,C.createBlankFailed,C.createBlankFailedHint,fe]),et=(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{await he(t,`web`),await Y()}catch(e){Te({type:`error`,title:C.imageUploadFailed,message:e instanceof Error?e.message:C.imageUploadFailedHint})}},e.click()},[Y,C.imageUploadFailed,C.imageUploadFailedHint]),tt=(0,Q.useCallback)(async(e,t)=>{try{await W(e,t,`web`),await Y()}catch(e){Te({type:`error`,title:C.voiceUploadFailed,message:e instanceof Error?e.message:C.voiceUploadFailedHint})}},[Y,C.voiceUploadFailed,C.voiceUploadFailedHint]),nt=(0,Q.useCallback)(async(e,t)=>{await Fe(e,{pinned:t}),await Y()},[Y]),rt=(0,Q.useCallback)(async e=>{await Fe(e,{status:`archived`}),await Y()},[Y]),at=(0,Q.useCallback)(async e=>{await Oe(e),await Y()},[Y]),ot=(0,Q.useCallback)(e=>{fe(Ht(t,e))},[t,fe]),st=(0,Q.useCallback)(e=>{fe(Ht(t,e)),M(!1)},[t,fe]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),L(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),L(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[I]??X[0];t&&st(t.id)}}},[I,st,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ue.current;t.setPointerCapture(e.pointerId),B(!0);let r=K.current?.clientWidth??window.innerWidth,i=Math.max(Nt,r-It),a=Math.min(Ft,i),o=e=>Math.max(Nt,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}B(!1),K.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(f),Rt(x,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[x,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),$e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$e]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),me(R-16)):e.key===`ArrowRight`?(e.preventDefault(),me(R+16)):e.key===`Home`?(e.preventDefault(),me(Nt)):e.key===`End`&&(e.preventDefault(),me(Ft))},[me,R]);return T?(0,$.jsxs)(`div`,{ref:K,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:ue,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!te&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ne?`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":ne?!0:void 0,children:[(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(Se,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&A({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 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":C.libraryTitle,children:Ge.map(e=>(0,$.jsx)(J,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Be??Je})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ae(!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":C.collapseNotesList,title:C.collapseNotesList,children:(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:$e,disabled:V,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":C.createBlankNote,title:C.createBlankShortcut,children:(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(!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":C.searchDialogTitle,children:(0,$.jsx)(ge,{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:xe?(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))}):Ee.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(p,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ne?C.noteOutsideCurrentView:y??C.noNotes}),e&&!Ne?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:b??C.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ne?(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:C.noteOutsideCurrentView}):null,Ee.map((t,n)=>{let r=n>0?Qe(Ee[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[Qe(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Ze(t.createdAt,de,We)}),(0,$.jsx)(it,{note:t,selected:t.id===e,onPress:ot,onPin:nt,onArchive:rt,onDelete:at,timeLabels:We,labels:{pin:C.pin,unpin:C.unpin,archive:C.archive,delete:C.delete,imageNote:C.imageNote,noText:C.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(jt,{placeholder:C.quickCapturePlaceholder,sendLabel:C.send,onCapture:Ye,onImagePick:i?et:void 0,onVoiceCapture:i?tt:void 0,recordingLabel:C.recording})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":C.resizeNotesList,"aria-valuemin":Nt,"aria-valuemax":Ft,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>me(Pt),onKeyDown:ut,title:C.resizeNotesList,className:o(`group relative hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ne?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-3 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:o(`h-8 w-1 rounded-pill opacity-0 transition-[background-color,opacity,transform] duration-150`,`bg-edge-strong/55 group-hover:opacity-100 group-focus-visible:opacity-100`,`group-hover:scale-y-110 group-focus-visible:scale-y-110`,te&&`bg-accent opacity-100 scale-y-125`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[ne?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ae(!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":C.expandNotesList,title:C.expandNotesList,children:(0,$.jsx)(h,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Et,{noteId:e,onBack:()=>fe(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>M(!0),autoFocus:e===ce,onAutoFocusConsumed:()=>le(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)(p,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:C.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:C.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:$e,disabled:V,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)(m,{className:`size-4`,"aria-hidden":!0}),V?C.creatingBlankNote:C.createBlankNote]})]})})]}),(0,$.jsx)(Re,{open:j,onOpenChange:M,children:(0,$.jsxs)(U,{children:[(0,$.jsx)(oe,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(H,{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)(w,{className:`text-sm font-semibold text-fg`,children:Z}),(0,$.jsx)(E,{className:`sr-only`,children:C.searchPlaceholder}),(0,$.jsx)(g,{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":Ve,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ge,{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:F,onChange:e=>ee(e.target.value),onKeyDown:ct,placeholder:C.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`}),F?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(``),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":He,children:(0,$.jsx)(N,{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:Ae?Me&&!je?(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)(p,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:C.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:C.searchResultsCount.replace(`{{count}}`,String(je?.total??X.length))}),X.map((e,t)=>{let n=zt[e.kind]||p,r=Bt(e,{imageNote:C.imageNote,noText:C.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>st(e.id),onMouseEnter:()=>L(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===I?`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:Xe(e.updatedAt,de,We)})]}),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)(ge,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:C.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(p,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C.needToken})]})}export{He as n,Ut as t};