@xopcai/xopc 0.0.136 → 0.0.138
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.
- package/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.js +4 -0
- package/dist/extensions/demo-memory/src/index.js.map +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CER17NHM.js → agent-avatar-dicebear-CIsGDJzd.js} +1 -1
- package/dist/gateway/static/root/assets/agents-fX97A6iN.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B3Ap_wpX.js → app-management-settings-panel-ByM4Bzwm.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-3kBO22Xd.js → appearance-settings-BF_poRd3.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BHYbGQcZ.js → apps-page-BssdA5Qc.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D_vGeNB8.js → archive-plugin-DJaYoyGn.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-hWV_8pHL.js → attachment-load-xx6dBaZU.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DVKmVTIo.js → automation-suggestion-card-BMvGqYob.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BCTXpOBp.js → automations-page-Dip8ZFmx.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BuXIeSPc.js → binary-plugins-CuPLWibr.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1m0u-UU.js → block-editor-bzfvlJnh.js} +58 -54
- package/dist/gateway/static/root/assets/{browser-settings-page-ChUF08V5.js → browser-settings-page-lbx_8Dku.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-presets-api-B7WWYaEh.js → capability-presets-api-X4Imbf8n.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-D_Bh1PnA.js → capability-presets-settings-panel-v9JgKjJu.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-sV06LCht.js → channel-recipient-api-DllrPmp-.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BI2ChQc7.js → channels-settings-CED7Oy5Y.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-EUwWYx8l.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-page-qgvEp09M.js → connectors-page-BMfp0jWL.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BxMJlvb-.js → desktop-pet-oTig6qFO.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DCvpDImn.js → desktop-pet-settings-DXJiPL_H.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D1nxs9PA.js → directory-picker-path-field-CltkXSR2.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-EAWkpOgw.js → dreaming-settings-CYrZQxoL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-LUQ8dE8z.js → extension-debug-page-C-4BOy1R.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B_mnhoRd.js → extension-page-C8nMpXqh.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BWQsGmvW.js → extension-settings-page-CXWYOwka.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-BWXmBizE.js → fetch-BID89uCH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-M9bzPASf.js → gateway-config-api-B3TGdim5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CbgtpprN.js → gateway-settings-D7tOnGAJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BALL91S7.js → gateway-startup-retry-BkrLLlpE.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-CbP4t9aM.js → goal-create-dialog-BL_cRshf.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-DlwI-MZZ.js → goal-detail-page-T1vg6Ng_.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BBhFVzBS.js → goals-config-api-D-WZWhP2.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-D26r7knp.js → goals-page-1vzWXl5W.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DdmVG_TR.js → goals-settings-DgGwvLVC.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DZW2Xq-U.js → heartbeat-settings-yh0bEIwQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-B8s8Pq5U.css +1 -0
- package/dist/gateway/static/root/assets/index-NwiCnzI-.js +262 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-1IWd88-T.js → keyboard-shortcuts-settings-CnxRFbgA.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DxoKJO7-.js → logs-page-DebnvTpD.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BtdBj32h.js → markdown-split-BU69Nof8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CpoPj3s8.js → media-plugins-CDs7OvWt.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DbNQuFdA.js +3 -0
- package/dist/gateway/static/root/assets/{models-hub-panel-D1Rp__dV.js → models-hub-panel-Ca_jy26S.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CgR1bO2W.js → notes-page-DTpeaI65.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-ozsnmDTV.js → notes-workbench-uKMYsjUU.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CVLqCfQB.js → page-tabs-CROo8Vgz.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CKUXJk2t.js → preview-open-alternatives-BxsS9i1G.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B4dqFAQF.js → project-detail-page-BWKOhshy.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DlRGXv4a.js → projects-page-CoowiCLe.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-rZEYQMZV.js → remote-access-hub-CiOaX1wd.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BtGni268.js → save-bar-controls-B4N17dMG.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BDGzKVWn.js → schedule-field-ClJzQ2vz.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DQJsKMCE.js → schema-form-oZvQUfDg.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DxGoCGU8.js → sessions-page-Sx9Gc0cv.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CnbVdze4.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-c8XGd4-8.js → settings-collapsible-section-B0kOLXUf.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-By0YiDWo.js → settings-form-section-DoVPlVFd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-SYCPY-WM.js → settings-loading-skeleton-C7J96bLc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D9NwvnBt.js → settings-page-CXiAByF0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CrICyGob.js → settings-page-layout-R-6ArlMI.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-IjK-hDxf.js → setup-status-panel-Drz23n9l.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Dfnk9M_m.js → share-preview-page-Bn1umseg.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-vQiRBra7.js → shares-settings-Bb-pcMWg.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DE9HCHct.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CruV215G.js → skills-page-B6cDPqkk.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BBVbSDFD.js → system-settings-panel-CtEddAy-.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CwFayhxu.js → typed-models-lib-BkhSnYq7.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BKtHOM50.js → use-channel-catalog-EA4hfbsP.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-_KDWzagh.js → user-profile-settings-panel-BssTVOBS.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-BiUjIHb4.js → utils-CI3ywKLT.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-agJqlm4o.js → voice-api-key-field-DXMEGw9O.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-Bdw4ATCb.js → work-item-detail-page-DsFqU0tK.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D-Dy6mTy.js → workflow-run-setup-panel-DImBi-m6.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-start-dialog-GammZ2GK.js → workflow-start-dialog-DuPpKAAc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Cw5zrqti.js → workflows-page-DfTVzTNY.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
- package/dist/src/agent/agent-manager.d.ts +7 -8
- package/dist/src/agent/agent-manager.js +24 -25
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/background-review/coordinator.d.ts +9 -23
- package/dist/src/agent/background-review/coordinator.js +45 -54
- package/dist/src/agent/background-review/coordinator.js.map +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +2 -4
- package/dist/src/agent/background-review/prompts.js +7 -19
- package/dist/src/agent/background-review/prompts.js.map +1 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -8
- package/dist/src/agent/background-review/run-background-review.js +87 -72
- package/dist/src/agent/background-review/run-background-review.js.map +1 -1
- package/dist/src/agent/background-review/settings.d.ts +4 -4
- package/dist/src/agent/background-review/settings.js +25 -10
- package/dist/src/agent/background-review/settings.js.map +1 -1
- package/dist/src/agent/code-intelligence/binary.d.ts +1 -0
- package/dist/src/agent/code-intelligence/binary.js +42 -0
- package/dist/src/agent/code-intelligence/binary.js.map +1 -0
- package/dist/src/agent/code-intelligence/index.d.ts +4 -0
- package/dist/src/agent/code-intelligence/index.js +4 -0
- package/dist/src/agent/code-intelligence/runtime.d.ts +34 -0
- package/dist/src/agent/code-intelligence/runtime.js +282 -0
- package/dist/src/agent/code-intelligence/runtime.js.map +1 -0
- package/dist/src/agent/code-intelligence/tools.d.ts +6 -0
- package/dist/src/agent/code-intelligence/tools.js +268 -0
- package/dist/src/agent/code-intelligence/tools.js.map +1 -0
- package/dist/src/agent/code-intelligence/types.d.ts +22 -0
- package/dist/src/agent/code-intelligence/types.js +1 -0
- package/dist/src/agent/memory/builtin-provider.d.ts +1 -2
- package/dist/src/agent/memory/builtin-provider.js +31 -12
- package/dist/src/agent/memory/builtin-provider.js.map +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +11 -0
- package/dist/src/agent/memory/context/planner.js +163 -0
- package/dist/src/agent/memory/context/planner.js.map +1 -0
- package/dist/src/agent/memory/context/types.d.ts +19 -0
- package/dist/src/agent/memory/context/types.js +1 -0
- package/dist/src/agent/memory/context-fence.d.ts +3 -3
- package/dist/src/agent/memory/context-fence.js +9 -9
- package/dist/src/agent/memory/context-fence.js.map +1 -1
- package/dist/src/agent/memory/index.d.ts +6 -4
- package/dist/src/agent/memory/index.js +5 -5
- package/dist/src/agent/memory/manager.d.ts +16 -4
- package/dist/src/agent/memory/manager.js +32 -34
- package/dist/src/agent/memory/manager.js.map +1 -1
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +2 -2
- package/dist/src/agent/memory/memory-config.js.map +1 -1
- package/dist/src/agent/memory/provider.d.ts +1 -3
- package/dist/src/agent/memory/stub-memory-provider.d.ts +0 -1
- package/dist/src/agent/memory/stub-memory-provider.js +0 -5
- package/dist/src/agent/memory/stub-memory-provider.js.map +1 -1
- package/dist/src/agent/memory/types.d.ts +31 -2
- package/dist/src/agent/memory/understanding/correction.d.ts +3 -0
- package/dist/src/agent/memory/understanding/correction.js +41 -0
- package/dist/src/agent/memory/understanding/correction.js.map +1 -0
- package/dist/src/agent/memory/understanding/quality.d.ts +8 -0
- package/dist/src/agent/memory/understanding/quality.js +20 -0
- package/dist/src/agent/memory/understanding/quality.js.map +1 -0
- package/dist/src/agent/memory/understanding/service.d.ts +26 -0
- package/dist/src/agent/memory/understanding/service.js +233 -0
- package/dist/src/agent/memory/understanding/service.js.map +1 -0
- package/dist/src/agent/memory/understanding/types.d.ts +22 -0
- package/dist/src/agent/memory/understanding/types.js +1 -0
- package/dist/src/agent/memory/user-context-coordinator.d.ts +21 -0
- package/dist/src/agent/memory/user-context-coordinator.js +90 -0
- package/dist/src/agent/memory/user-context-coordinator.js.map +1 -0
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -0
- package/dist/src/agent/orchestration/agent-event-handler.js +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +2 -2
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/orchestration/index.d.ts +1 -1
- package/dist/src/agent/orchestration/index.js +2 -2
- package/dist/src/agent/prompt/sections/tooling.js +10 -0
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.js +2 -0
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service.js +7 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +8 -2
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +17 -10
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +2 -0
- package/dist/src/agent/workspace-runtime/registry.js +11 -3
- package/dist/src/agent/workspace-runtime/registry.js.map +1 -1
- package/dist/src/agent-manifest/index.js +2 -2
- package/dist/src/agent-manifest/schema.d.ts +91 -0
- package/dist/src/agent-manifest/schema.js +27 -5
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +1 -1
- package/dist/src/agent-runtime/memory-runtime.js.map +1 -1
- package/dist/src/automations/domain/validation.d.ts +22 -22
- package/dist/src/automations/draft/automation-draft-validator.d.ts +4 -4
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-loaders.js.map +1 -1
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/resume.d.ts +1 -0
- package/dist/src/cli/commands/resume.js +31 -0
- package/dist/src/cli/commands/resume.js.map +1 -0
- package/dist/src/cli/commands/tui-runner.d.ts +9 -0
- package/dist/src/cli/commands/tui-runner.js +40 -0
- package/dist/src/cli/commands/tui-runner.js.map +1 -0
- package/dist/src/cli/commands/tui.js +4 -28
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +115 -0
- package/dist/src/config/schema.js +53 -4
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +5 -0
- package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +18 -4
- package/dist/src/gateway/hono/routes/home.js +37 -2
- package/dist/src/gateway/hono/routes/home.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +129 -4
- package/dist/src/gateway/hono/routes/memory.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +16 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/knowledge/index.d.ts +2 -0
- package/dist/src/knowledge/index.js +2 -0
- package/dist/src/knowledge/ingestion-service.d.ts +20 -0
- package/dist/src/knowledge/ingestion-service.js +75 -0
- package/dist/src/knowledge/ingestion-service.js.map +1 -0
- package/dist/src/knowledge/types.d.ts +70 -0
- package/dist/src/knowledge/types.js +1 -0
- package/dist/src/projects/project-kind.js +0 -1
- package/dist/src/projects/project-kind.js.map +1 -1
- package/dist/src/providers/presentation.js +1 -1
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/storage/sqlite/index.d.ts +2 -1
- package/dist/src/storage/sqlite/index.js +3 -2
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +237 -0
- package/dist/src/storage/sqlite/knowledge-repository.js.map +1 -0
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +80 -2
- package/dist/src/storage/sqlite/memory-records-repository.js +271 -9
- package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +133 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/tui-picker-overlay.d.ts +6 -1
- package/dist/src/tui/tui-picker-overlay.js +4 -1
- package/dist/src/tui/tui-picker-overlay.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -0
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +17 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/work-items/work-item-service.d.ts +1 -0
- package/dist/src/work-items/work-item-service.js +3 -0
- package/dist/src/work-items/work-item-service.js.map +1 -1
- package/dist/src/work-items/work-item-store.d.ts +1 -0
- package/dist/src/work-items/work-item-store.js +13 -0
- package/dist/src/work-items/work-item-store.js.map +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/agents-Bv5R-N8Q.js +0 -2
- package/dist/gateway/static/root/assets/channels-status-swr-MY4Xh4fM.js +0 -1
- package/dist/gateway/static/root/assets/index-CPwVzi9x.css +0 -1
- package/dist/gateway/static/root/assets/index-DZOm5_ex.js +0 -262
- package/dist/gateway/static/root/assets/messages-CQ_k8RHj.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +0 -1
- package/dist/src/agent/memory/candidate-extractor.d.ts +0 -6
- package/dist/src/agent/memory/candidate-extractor.js +0 -60
- package/dist/src/agent/memory/candidate-extractor.js.map +0 -1
- package/dist/src/agent/memory/context-assembler.d.ts +0 -10
- package/dist/src/agent/memory/context-assembler.js +0 -26
- package/dist/src/agent/memory/context-assembler.js.map +0 -1
- package/dist/src/agent/memory/inject-prefetch.d.ts +0 -6
- package/dist/src/agent/memory/inject-prefetch.js +0 -48
- package/dist/src/agent/memory/inject-prefetch.js.map +0 -1
- package/dist/src/agent/memory/prefetch-coordinator.d.ts +0 -37
- package/dist/src/agent/memory/prefetch-coordinator.js +0 -45
- package/dist/src/agent/memory/prefetch-coordinator.js.map +0 -1
package/dist/gateway/static/root/assets/{notes-workbench-ozsnmDTV.js → notes-workbench-uKMYsjUU.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-
|
|
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{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-CQ_k8RHj.js";import{a as s}from"./fetch-BWXmBizE.js";import{c,n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{r as d}from"./toast-z0toXu32.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{$o as p,An as m,Ba as h,Bc as g,Bn as _,Bs as v,Cn as y,Cs as b,Dl as x,Dn as S,Do as C,Ds as w,Dt as T,Ec as E,En as D,Fn as O,Fr as k,Ga as A,Gn as j,Ha as M,Hn as N,Ho as P,In as F,Ir as ee,Jo as I,Ka as te,Ks as L,Ln as R,Lr as z,Mc as ne,Mn as re,Nn as ie,Ns as B,On as V,Os as ae,Pn as H,Pr as oe,Rn as se,Rr as ce,Sn as le,Tn as U,Ts as W,Ua as ue,Uc as de,Un as fe,Uo as pe,Us as me,Va as G,Vn as K,Vo as he,Wa as ge,Zo as q,_ as _e,_s as ve,bl as ye,cc as be,dc as J,dl as xe,es as Se,fc as Ce,ic as we,jn as Te,js as Ee,kc as De,kn as Oe,ko as ke,ks as Ae,lc as je,ls as Y,qa as Me,ro as Ne,to as Pe,us as Fe,vl as Ie,wn as Le,xl as Re,zr as ze}from"./index-DZOm5_ex.js";import{t as Be}from"./automation-suggestion-card-DVKmVTIo.js";var X=e(t(),1),Z=n(),Q=r(),Ve={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},$=null,He=null,Ue=null,We=null;function Ge(){return $||($=new Audio,$.addEventListener(`timeupdate`,()=>{qe.setState({currentTime:$.currentTime})}),$.addEventListener(`loadedmetadata`,()=>{let e=$.duration;Number.isFinite(e)&&qe.setState({duration:e})}),$.addEventListener(`ended`,()=>{qe.setState({playing:!1,currentTime:0}),$.currentTime=0}),$.addEventListener(`pause`,()=>{qe.setState({playing:!1})}),$.addEventListener(`play`,()=>{qe.setState({playing:!0})})),$}function Ke(){Ue&&We&&fe(Ue,We),He=null,Ue=null,We=null}var qe=c()((e,t)=>({...Ve,play:async(n,r,i)=>{let a=Ge(),o=t();if(o.noteId===n&&o.attachmentId===r&&He){a.play();return}a.pause(),Ke(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await N(n,r);He=t,Ue=n,We=r,a.src=t,await a.play(),e({loading:!1})}catch{e({loading:!1,playing:!1}),Ke()}},pause:()=>{Ge().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=Ge();n.currentTime=t,e({currentTime:t})},reset:()=>{Ge().pause(),Ge().src=``,Ke(),e(Ve)}})),Je=(0,X.createContext)(null);function Ye(){let e=(0,Z.c)(1),t=(0,X.useContext)(Je);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Xe},e[0]=t):t=e[0],t}return t}function Xe(){}function Ze(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[o,s]=(0,X.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=o!==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,Q.jsx)(ue,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`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]=g):g=t[4];let _=o?.alt||`Image preview`,v;t[5]===_?v=t[6]:(v=(0,Q.jsx)(te,{className:`sr-only`,children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(ke,{className:`h-5 w-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,Q.jsx)(h,{asChild:!0,children:(0,Q.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]===o?x=t[11]:(x=o?(0,Q.jsx)(`img`,{src:o.src,alt:o.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=o,t[11]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,Q.jsxs)(ge,{children:[m,(0,Q.jsxs)(G,{className:g,"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,Q.jsx)(A,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let w;return t[19]!==n||t[20]!==C?(w=(0,Q.jsxs)(Je.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=w):w=t[21],w}function Qe(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[o,s]=(0,X.useState)(!1),c;t[0]!==r||t[1]!==n?(c=j(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(o){let e;t[3]===i?e=t[4]:(e=a(`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,Q.jsx)(J,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.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=a(`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,Q.jsx)(K,{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 $e=6e4,et=36e5,tt=864e5;function nt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function rt(e,t,n){let r=t-e;if(r<$e)return n.justNow;if(r<et){let e=Math.floor(r/$e);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=nt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-tt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*tt){let e=Math.floor(r/tt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function it(e,t,n){let r=nt(t);if(e>=r)return n.today;if(e>=r-tt)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 at(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ot(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 st(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:o}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=qe(),p=qe(lt),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]===o?w=t[11]:(w=a(`flex items-center gap-2`,o),t[10]=o,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=a(`flex h-7 w-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,Q.jsx)(L,{className:`h-3.5 w-3.5 animate-spin`}):h?(0,Q.jsx)(Ee,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(W,{className:`h-3.5 w-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,Q.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,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.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 M;t[25]!==v||t[26]!==m||t[27]!==_?(M=ot(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==w||t[36]!==k?(F=(0,Q.jsxs)(`div`,{className:w,onClick:ct,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function ct(e){return e.stopPropagation()}function lt(e){return e.toggle}function ut(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function dt(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:o,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=ut(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,X.useState)(ht),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=rt(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,x;t[11]===b?x=t[12]:(x=a(`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`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,Q.jsx)(Qe,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(st,{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]=C):C=t[18];let T;t[19]===n.title?T=t[20]:(T=n.title&&(0,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[21]===E?D=t[22]:(D=a(`truncate text-sm leading-5`,E),t[21]=E,t[22]=D);let O;t[23]!==p||t[24]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:p}),t[23]=p,t[24]=D,t[25]=O):O=t[25];let A;t[26]!==T||t[27]!==O?(A=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,O]}),t[26]=T,t[27]=O,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ze,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:mt,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,Q.jsx)(ne,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==o?(M=()=>o(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=o,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,Q.jsx)(w,{className:`h-4 w-4`}):(0,Q.jsx)(ae,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?l.unpin:l.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,Q.jsxs)(k,{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:M,children:[N,P]}),t[36]=M,t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==n.id||t[41]!==s?(I=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=I):I=t[42];let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(Re,{className:`h-4 w-4`}),t[43]=te):te=t[43];let L;t[44]!==l.archive||t[45]!==I?(L=(0,Q.jsxs)(k,{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:[te,l.archive]}),t[44]=l.archive,t[45]=I,t[46]=L):L=t[46];let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(ce,{className:`my-1 h-px bg-edge-subtle`}),t[47]=R):R=t[47];let re;t[48]!==n.id||t[49]!==c?(re=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=re):re=t[50];let ie;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(he,{className:`h-4 w-4`}),t[51]=ie):ie=t[51];let B;t[52]!==l.delete||t[53]!==re?(B=(0,Q.jsxs)(k,{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:re,children:[ie,l.delete]}),t[52]=l.delete,t[53]=re,t[54]=B):B=t[54];let V;t[55]!==F||t[56]!==L||t[57]!==B?(V=(0,Q.jsxs)(z,{children:[j,(0,Q.jsx)(ee,{children:(0,Q.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pt,children:[F,L,R,B]})})]}),t[55]=F,t[56]=L,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==A||t[60]!==V||t[61]!==C?(H=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,A,V]}),t[59]=A,t[60]=V,t[61]=C,t[62]=H):H=t[62];let se;t[63]===n.pinned?se=t[64]:(se=n.pinned&&(0,Q.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,Q.jsx)(ae,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=se);let le;t[65]===n.tags?le=t[66]:(le=n.tags?.slice(0,2).map(ft),t[65]=n.tags,t[66]=le);let U;t[67]===_?U=t[68]:(U=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[67]=_,t[68]=U);let W;t[69]!==se||t[70]!==le||t[71]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[se,le,U]}),t[69]=se,t[70]=le,t[71]=U,t[72]=W):W=t[72];let ue;return t[73]!==H||t[74]!==W||t[75]!==v||t[76]!==y||t[77]!==x||t[78]!==S?(ue=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[H,W]}),t[73]=H,t[74]=W,t[75]=v,t[76]=y,t[77]=x,t[78]=S,t[79]=ue):ue=t[79],ue}function ft(e){return(0,Q.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 pt(e){return e.stopPropagation()}function mt(e){return e.stopPropagation()}function ht(){return Date.now()}var gt={edit:Ae,ai_edit:Se,sync:ve,restore:ye};function _t(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function vt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let s=o(l(e=>e.language)).notes,c=s,{data:u}=f(e?[`note-history`,e]:null,()=>V(e)),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),_=(0,X.useCallback)(async t=>{m(!0);try{await R(e,t),d({type:`success`,title:s.restoreSuccess}),g(null),i()}catch{d({type:`error`,title:s.restoreFailed})}finally{m(!1)}},[e,s.restoreSuccess,s.restoreFailed,i]),v=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Ce,{className:`h-4 w-4`,"aria-hidden":!0}),s.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(ke,{className:`h-4 w-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=gt[e.trigger]??Ae,i=t===e.timestamp,o=h===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:a(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:_t(e.trigger,s)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:rt(e.timestamp,v,c)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:s.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_(e.timestamp)},disabled:p,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:p?`...`:s.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),g(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(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:s.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:s.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:s.historyEmptyDescription})]})})]})}function yt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:s,onClose:c,noteThreads:u,openingChat:d,onOpenChat:p,onOpenNewChat:m}=e,h=o(l(Et)).notes,g=x(),_=r?.aiDeep?.catalysis,v=_?.report??null,y;t[0]===n?y=t[1]:(y=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=y);let b;t[2]===n?b=t[3]:(b=()=>D(n),t[2]=n,t[3]=b);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}=f(y,b,S),E;t[5]===n?E=t[6]:(E=async e=>{try{await F(n,e)}catch{}},t[5]=n,t[6]=E);let k=E,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Se,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[7]=A):A=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Ie,{className:`h-4 w-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(me,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=t[9],(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:h.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:h.catalysisSectionDescription}),C?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>O(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:h.contextRebuild}),(0,Q.jsx)(`span`,{className:a(`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,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:h.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(Tt)}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:s,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?h.processing:v?h.recatalyze:h.catalyzeAction}),v?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:v.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.targetUsers.slice(0,5).map(wt)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.keyQuestions.slice(0,3).map(Ct)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.mvpPath.slice(0,3).map(St)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.risks.slice(0,3).map(xt)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.nextActions.slice(0,4).map(bt)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h.confidenceLabel.replace(`{{percent}}`,String(Math.round(v.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void k(`helpful`),className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackHelpfulAria,children:(0,Q.jsx)(P,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void k(`not_helpful`),className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackNotHelpfulAria,children:(0,Q.jsx)(pe,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:h.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[M,h.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:p,disabled:d,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:d?h.openingChat:h.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:m,disabled:d,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:h.newThread})]})]}),u.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:u.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>g(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||h.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:h.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:h.noThreads})]})]})]})}function bt(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function xt(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e)}function St(e,t){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e)}function Ct(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e)}function wt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Tt(e){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Et(e){return e.language}var Dt=()=>i(()=>import(`./block-editor-C1m0u-UU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),Ot=()=>i(()=>import(`./markdown-editor-jD1LPiP-.js`).then(e=>e.n),__vite__mapDeps([20,1,3,18,6,21])),kt=(0,X.lazy)(()=>Dt().then(e=>({default:e.BlockEditor}))),At=(0,X.lazy)(()=>Ot().then(e=>({default:e.MarkdownEditor})));function jt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Mt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,o;t[0]===i.edit?o=t[1]:(o={id:`wysiwyg`,label:i.edit,Icon:E},t[0]=i.edit,t[1]=o);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:g},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:De},t[4]=i.preview,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=[o,s,c],t[6]=o,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,Q.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:o}=e;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&Dt(),t===`source`&&Ot()},onFocus:()=>{t===`wysiwyg`&&Dt(),t===`source`&&Ot()},className:a(`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,Q.jsx)(o,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Nt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:s,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(Pt),_;t[0]===g?_=t[1]:(_=o(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==s||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,Q.jsx)(Ft,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:s,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=s,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,Q.jsx)(Ze,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Pt(e){return e.language}function Ft({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:s=!0,onOpenSearch:c,autoFocus:p=!1,onAutoFocusConsumed:m}){let h=l(e=>e.language),g=o(h).notes,v=o(h).automations.suggestions,y=x(),b=u(e=>e.resolved)===`dark`,{openImage:w}=Ye(),[T,E]=(0,X.useState)(`wysiwyg`),[D,O]=(0,X.useState)(null),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(``),[F,ee]=(0,X.useState)(360),[I,te]=(0,X.useState)(!1),[L,R]=(0,X.useState)(!1),[z,ne]=(0,X.useState)(!1),re=(0,X.useRef)(!1),ie=(0,X.useRef)(!1),B=(0,X.useRef)(null),V=(0,X.useRef)(null),ae=(0,X.useRef)(null),H=(0,X.useRef)(null),oe=(0,X.useRef)(null),ce=(0,X.useRef)(null),W=(0,X.useRef)(null),ue=(0,X.useRef)(null),de=(0,X.useRef)(null),fe=Me(e=>e.setPageHeader),pe=Me(e=>e.clearPageHeader),{data:G,mutate:K}=f(e?[`note-detail`,e]:null,()=>U(e)),{data:he=[],mutate:ge}=f(e?[`note-threads`,e]:null,()=>Oe(e),{revalidateOnFocus:!1}),q=k!==null;(0,X.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&K()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[K,e]),(0,X.useEffect)(()=>{re.current=!1,P(``),A(null),O(null),ie.current=!1,de.current=null},[e]),(0,X.useEffect)(()=>{!G||re.current||(P(G.title??``),re.current=!0)},[G]),(0,X.useEffect)(()=>{if(!p||!G||q||de.current===e)return;let t=window.requestAnimationFrame(()=>{ue.current?.focus(),m?.()});return de.current=e,()=>window.cancelAnimationFrame(t)},[p,q,G,e,m]);let ve=G?new Date(G.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,ye=(0,X.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":g.back,className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,C,i),children:(0,Q.jsx)(Ie,{className:`h-4 w-4`,"aria-hidden":!0})}):null,[i,g.back,t,r]),be=(0,X.useCallback)(t=>{P(t),e&&(H.current=t,V.current&&clearTimeout(V.current),V.current=setTimeout(async()=>{let t=H.current;if(H.current=null,t!==null){M(!0);try{await se(e,{title:t}),await K(),n?.()}catch{}finally{M(!1)}}},600))},[e,K,n]),J=(0,X.useMemo)(()=>(0,Q.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,C),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||ve||void 0,children:N||ve}),j?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:g.saving}):null]}),[g.saving,j,ve,N]),xe=(0,X.useCallback)(async(t=!1)=>{ne(!0);try{let n=await Te(e,{forceNew:t});await K(),await ge(),y(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){d({type:`error`,title:g.chatOpenFailedTitle,message:e instanceof Error?e.message:g.chatOpenFailedMessage})}finally{ne(!1)}},[K,ge,y,e,g.chatOpenFailedMessage,g.chatOpenFailedTitle]),we=(0,X.useCallback)(async()=>{R(!0);try{await le(e),await K(),d({type:`success`,title:g.catalysisDone})}catch(e){d({type:`error`,title:g.catalysisFailed,message:e instanceof Error?e.message:g.chatOpenFailedMessage})}finally{R(!1)}},[K,e]),Ee=(0,X.useCallback)(()=>{O(D===`breakdown`?null:`breakdown`),!G?.aiDeep?.catalysis?.report&&!L&&we()},[D,L,we,G?.aiDeep?.catalysis?.report]),De=(0,X.useMemo)(()=>(0,Q.jsxs)(`div`,{className:a(`flex items-center gap-2`,C),children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Fe,{className:`h-4 w-4`,"aria-hidden":!0})}):null,(0,Q.jsxs)(`button`,{type:`button`,onClick:Ee,disabled:L,"aria-label":g.catalysisSectionTitle,className:a(`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`,D===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(Se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),L?g.catalyzing:g.catalyzeButton]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>xe(!1),disabled:z,className:a(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(me,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),z?g.openingChat:g.openChatButton]}),(0,Q.jsx)(Mt,{mode:T,onModeChange:E,labels:{edit:g.modeEdit,source:g.modeSource,preview:g.modePreview}}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>O(D===`history`?null:`history`),"aria-label":g.history,className:a(`rounded-lg p-1.5 transition-colors`,D===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,Q.jsx)(Ce,{className:`h-4 w-4`,"aria-hidden":!0})})]}),[L,Ee,xe,T,g.history,g.modeEdit,g.modePreview,g.modeSource,z,D,c,g.searchDialogTitle]);(0,X.useLayoutEffect)(()=>(fe({startExtra:ye,main:G?J:null,end:G?De:null}),()=>{s&&pe()}),[s,pe,De,J,ye,G,fe]);let ke=(0,X.useCallback)(t=>{e&&(ae.current=t,B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{let t=ae.current;if(ae.current=null,t!==null){M(!0);try{await se(e,{markdown:t}),await K(),n?.()}catch(e){d({type:`error`,title:g.saveFailed,message:e instanceof Error?e.message:g.saveFailedHint})}finally{M(!1)}}},600))},[e,K,g.saveFailed,g.saveFailedHint,n]),Ae=(0,X.useCallback)(t=>{S(e,t.timestamp).then(e=>{e&&A(e)})},[e]),je=(0,X.useCallback)(()=>{O(null),A(null)},[]),Y=(0,X.useCallback)(()=>{O(null),A(null),K(),n?.()},[K,n]);if((0,X.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),V.current&&clearTimeout(V.current);let t=ae.current,n=H.current;ae.current=null,H.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&se(e,r)},[e]),G===void 0)return(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(G===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:g.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:g.back})]});let Ne=q?k.title??``:N,Pe=q?k.markdown??``:G.markdown??``,Le=new Date(G.createdAt).getTime(),Re=Number.isFinite(Le)&&Date.now()-Le<3600*1e3?(0,Q.jsx)(Be,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(_e,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(_e,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(`div`,{ref:oe,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:q?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ne&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ne}),Pe?(0,Q.jsx)(_,{noteId:e,content:Pe,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:g.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[T===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:ue,type:`text`,value:N,onChange:e=>be(e.target.value),onCompositionStart:()=>{ie.current=!0},onCompositionEnd:()=>{ie.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ie.current&&!t.isComposing&&(e.preventDefault(),(oe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:g.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`}),Re]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(jt,{}),children:(0,Q.jsx)(kt,{initialContent:G.markdown??``,onChange:ke,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:ue,type:`text`,value:N,onChange:e=>be(e.target.value),placeholder:g.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`}),Re]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(jt,{}),children:(0,Q.jsx)(At,{initialContent:G.markdown??``,onChange:ke,isDark:b},`source-${e}`)})})]}),T===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&w(t.currentSrc||t.src,t.alt)},children:[N&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:N}),G.markdown?(0,Q.jsx)(_,{noteId:e,content:G.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:g.emptyPreview})]})]})})]}),(0,Q.jsx)(`div`,{ref:ce,className:a(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:D?F:0},children:(0,Q.jsxs)(`div`,{ref:W,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),te(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,D&&ce.current?.style.setProperty(`width`,`${s}px`),W.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{}te(!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:a(`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`,I&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:D===`history`?(0,Q.jsx)(vt,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:Ae,onClose:je,onRestored:Y}):D===`breakdown`?(0,Q.jsx)(yt,{noteId:e,note:G??null,catalyzing:L,onCatalyze:we,onClose:()=>O(null),noteThreads:he,openingChat:z,onOpenChat:()=>xe(!1),onOpenNewChat:()=>xe(!0)}):null})]})})]})}var It=3e4;function Lt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Rt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:o=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(0),[_,y]=(0,X.useState)(!1),b=(0,X.useRef)(null),x=(0,X.useRef)(null),S=(0,X.useRef)(null),C=(0,X.useRef)([]),w=(0,X.useRef)(0),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useCallback)(()=>{T.current&&=(clearInterval(T.current),null),E.current&&=(clearTimeout(E.current),null),S.current?.getTracks().forEach(e=>e.stop()),S.current=null,x.current=null,C.current=[],m(!1),g(0)},[]);(0,X.useEffect)(()=>()=>D(),[D]);let O=(0,X.useCallback)(async()=>{let e=x.current;if(!e||e.state!==`recording`)return;y(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-w.current)/1e3)),n=e.mimeType||Lt()||`audio/webm`,r=new Blob(C.current,{type:n});if(D(),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{y(!1)}return}y(!1)},[D,i]),k=(0,X.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Lt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);S.current=e,x.current=n,C.current=[],w.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&C.current.push(e.data)},n.start(),m(!0),g(0),T.current=setInterval(()=>{g(Math.round((Date.now()-w.current)/1e3))},250),E.current=setTimeout(()=>{O()},It)}catch{D()}},[D,i,p,O,_]),A=(0,X.useCallback)(()=>{if(p){O();return}k()},[p,k,O]),j=(0,X.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),b.current?.focus()}}},[l,d,n]),M=(0,X.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,Q.jsxs)(`div`,{className:a(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-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,Q.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,Q.jsx)(je,{className:`h-4 w-4`})}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:A,disabled:N||c||d,className:a(`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,Q.jsx)(q,{className:`h-4 w-4 fill-current`}):(0,Q.jsx)(v,{className:`h-4 w-4`})}),p?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:o.replace(`{{seconds}}`,String(h))}):(0,Q.jsx)(`textarea`,{ref:b,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,Q.jsx)(`button`,{type:`button`,disabled:!l.trim()||N||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:a(`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,Q.jsx)(Y,{className:`h-4 w-4`})})]})}var zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Bt=240,Vt=320,Ht=520,Ut=560;function Wt(e){if(globalThis.localStorage===void 0)return Vt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Vt;let n=Number(t);return Number.isFinite(n)?n:Vt}catch{return Vt}}function Gt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var Kt={thought:I,todo:p,voice:v,media:je,bookmark:xe,mixed:I,task:p};function qt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Yt(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Xt({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:c,captureTags:u=[],listTitle:g,listDescription:_,emptyText:S,emptyDescription:w,listWidthStorageKey:E=`xopc.notes.listWidth`}){let D=o(l(e=>e.language)).notes,O=!!s(e=>e.token),[k,j]=(0,X.useReducer)(T,zt),[N,P]=(0,X.useState)(!1),[F,ee]=(0,X.useState)(``),[L,R]=(0,X.useState)(0),[z,ne]=(0,X.useState)(()=>Wt(E)),[V,oe]=(0,X.useState)(!1),[ce,le]=(0,X.useState)(!1),[U,W]=(0,X.useState)(!1),[fe,pe]=(0,X.useState)(null),me=(0,X.useRef)(null),K=(0,X.useRef)(null),[he]=(0,X.useState)(()=>Date.now()),q=x(),_e=(0,X.useCallback)(e=>{let t=me.current?.clientWidth??window.innerWidth,n=Math.max(Bt,t-Ut);return Math.max(Bt,Math.min(Math.min(Ht,n),e))},[]),ve=(0,X.useCallback)(e=>{let t=_e(e);ne(t),Gt(E,t)},[_e,E]);(0,X.useLayoutEffect)(()=>{ne(e=>_e(e))},[_e]);let{data:ye,mutate:J,isLoading:Se}=f((0,X.useMemo)(()=>O?[`notes-list`,c,k.statusFilter,k.kindFilter,k.pinnedOnly]:null,[O,c,k.statusFilter,k.kindFilter,k.pinnedOnly]),()=>m({status:k.statusFilter===`all`?void 0:k.statusFilter,kind:k.kindFilter===`all`?void 0:k.kindFilter,tag:c,pinned:k.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Ce=Se&&!ye,Te=ye?.items??[],Ee=ye?.total??0,De=F.trim(),{data:Oe,isLoading:Ae}=f(O&&N&&De?[`notes-search`,c,De]:null,()=>m({search:De,tag:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),Y=Oe?.items??[],Ie=e?Te.some(t=>t.id===e):!0;(0,X.useEffect)(()=>{R(0)},[De]),(0,X.useEffect)(()=>{L>=Y.length&&R(Math.max(0,Y.length-1))},[L,Y.length]),(0,X.useEffect)(()=>{let e=()=>{J()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J]);let ze=Me(e=>e.setPageHeader),Be=Me(e=>e.clearPageHeader),Z=Ee>0?D.noteCount.replace(`{{count}}`,String(Ee)):null,Ve=D.searchDialogTitle,$=D.searchClose,He=D.searchClear,Ue=(0,X.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:a(`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`,C),"aria-label":Ve,children:[(0,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:Ve})]}),[Ve]);(0,X.useLayoutEffect)(()=>{if(n)return O?(ze({startExtra:null,main:(0,Q.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,C),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??D.title}),Z?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Z}):null]}),end:Ue}),()=>Be()):(Be(),()=>Be())},[Be,O,Ue,g,n,D.title,Z,e,ze]);let We=(0,X.useMemo)(()=>({justNow:D.justNow,minutesAgo:D.minutesAgo,today:D.today,yesterday:D.yesterday,daysAgo:D.daysAgo}),[D.justNow,D.minutesAgo,D.today,D.yesterday,D.daysAgo]),Ge=(0,X.useMemo)(()=>[{id:`recent`,label:D.viewRecent,description:D.viewRecentDescription,icon:de,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:D.filterInbox,description:D.viewInboxDescription,icon:be,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:D.pinned,description:D.viewPinnedDescription,icon:ae,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:D.viewTasks,description:D.viewTasksDescription,icon:p,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:D.kindVoice,description:D.viewVoiceDescription,icon:v,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:D.kindMedia,description:D.viewMediaDescription,icon:je,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:D.kindBookmark,description:D.viewBookmarksDescription,icon:xe,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:D.filterProcessed,description:D.viewProcessedDescription,icon:we,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:D.filterArchived,description:D.viewArchiveDescription,icon:Re,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[D.filterArchived,D.filterInbox,D.filterProcessed,D.kindBookmark,D.kindMedia,D.kindVoice,D.pinned,D.viewArchiveDescription,D.viewBookmarksDescription,D.viewInboxDescription,D.viewMediaDescription,D.viewPinnedDescription,D.viewProcessedDescription,D.viewRecent,D.viewRecentDescription,D.viewTasks,D.viewTasksDescription,D.viewVoiceDescription]),Ke=Ge.find(e=>Jt(k,e))??Ge[0],qe=g??Ke.label,Je=_??Ke.description,Ye=(0,X.useCallback)(async(e,n)=>{let r=u.length?await y({markdown:e,kind:`thought`,tags:u,channel:`web`}):await re(e,`web`);await J(),n?.navigate!==!1&&q(Yt(t,r.id))},[t,u,J,q]),Xe=(0,X.useCallback)(async()=>{if(!U){W(!0);try{let e=await y({markdown:``,kind:`thought`,tags:u,channel:`web`});j({type:`patch`,patch:zt}),await J(),pe(e.id),q(Yt(t,e.id))}catch(e){d({type:`error`,title:D.createBlankFailed,message:e instanceof Error?e.message:D.createBlankFailedHint})}finally{W(!1)}}},[t,u,U,J,D.createBlankFailed,D.createBlankFailedHint,q]),Ze=(0,X.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{await ie(t,`web`),await J()}catch(e){d({type:`error`,title:D.imageUploadFailed,message:e instanceof Error?e.message:D.imageUploadFailedHint})}},e.click()},[J,D.imageUploadFailed,D.imageUploadFailedHint]),Qe=(0,X.useCallback)(async(e,t)=>{try{await H(e,t,`web`),await J()}catch(e){d({type:`error`,title:D.voiceUploadFailed,message:e instanceof Error?e.message:D.voiceUploadFailedHint})}},[J,D.voiceUploadFailed,D.voiceUploadFailedHint]),$e=(0,X.useCallback)(async(e,t)=>{await se(e,{pinned:t}),await J()},[J]),et=(0,X.useCallback)(async e=>{await se(e,{status:`archived`}),await J()},[J]),tt=(0,X.useCallback)(async e=>{await Le(e),await J()},[J]),nt=(0,X.useCallback)(e=>{q(Yt(t,e))},[t,q]),ot=(0,X.useCallback)(e=>{q(Yt(t,e)),P(!1)},[t,q]),st=(0,X.useCallback)(e=>{if(Y.length){if(e.key===`ArrowDown`)e.preventDefault(),R(e=>Math.min(Y.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),R(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=Y[L]??Y[0];t&&ot(t.id)}}},[L,ot,Y]),ct=(0,X.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=K.current;t.setPointerCapture(e.pointerId),oe(!0);let r=me.current?.clientWidth??window.innerWidth,i=Math.max(Bt,r-Ut),a=Math.min(Ht,i),o=e=>Math.max(Bt,Math.min(a,e)),s=e.clientX,c=o(z),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{}oe(!1),me.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),ne(f),Gt(E,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)},[E,z]);(0,X.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Xe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Xe]);let lt=(0,X.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ve(z-16)):e.key===`ArrowRight`?(e.preventDefault(),ve(z+16)):e.key===`Home`?(e.preventDefault(),ve(Bt)):e.key===`End`&&(e.preventDefault(),ve(Ht))},[ve,z]);return O?(0,Q.jsxs)(`div`,{ref:me,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${z}px`},children:[(0,Q.jsxs)(`section`,{ref:K,className:a(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!V&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ce?`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":ce?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 border-b border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,Q.jsx)(Pe,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&j({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":D.libraryTitle,children:Ge.map(e=>(0,Q.jsx)(Ne,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Z??Je})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>le(!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":D.collapseNotesList,title:D.collapseNotesList,children:(0,Q.jsx)(B,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Xe,disabled:U,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":D.createBlankNote,title:D.createBlankShortcut,children:(0,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(!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":D.searchDialogTitle,children:(0,Q.jsx)(Fe,{className:`h-4 w-4`,"aria-hidden":!0})})]})]}),(0,Q.jsx)(Rt,{placeholder:D.quickCapturePlaceholder,sendLabel:D.send,onCapture:Ye,onImagePick:i?Ze:void 0,onVoiceCapture:i?Qe:void 0,recordingLabel:D.recording})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:Ce?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Te.length===0?(0,Q.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,Q.jsx)(I,{className:`h-8 w-8 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ie?D.noteOutsideCurrentView:S??D.noNotes}),e&&!Ie?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w??D.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ie?(0,Q.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:D.noteOutsideCurrentView}):null,Te.map((t,n)=>{let r=n>0?at(Te[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[at(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:a(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:it(t.createdAt,he,We)}),(0,Q.jsx)(dt,{note:t,selected:t.id===e,onPress:nt,onPin:$e,onArchive:et,onDelete:tt,timeLabels:We,labels:{pin:D.pin,unpin:D.unpin,archive:D.archive,delete:D.delete,imageNote:D.imageNote,noText:D.noText}})]},t.id)})]})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":D.resizeNotesList,"aria-valuemin":Bt,"aria-valuemax":Ht,"aria-valuenow":Math.round(z),tabIndex:0,onPointerDown:ct,onDoubleClick:()=>ve(Vt),onKeyDown:lt,title:D.resizeNotesList,className:a(`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`,ce?`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,Q.jsx)(`span`,{"aria-hidden":!0,className:a(`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`,V&&`bg-accent opacity-100 scale-y-125`)})}),(0,Q.jsxs)(`section`,{className:a(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[ce?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>le(!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":D.expandNotesList,title:D.expandNotesList,children:(0,Q.jsx)(B,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(Nt,{noteId:e,onBack:()=>q(t),onSaved:()=>void J(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>P(!0),autoFocus:e===fe,onAutoFocusConsumed:()=>pe(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(I,{className:`mx-auto h-9 w-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:D.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Xe,disabled:U,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,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0}),U?D.creatingBlankNote:D.createBlankNote]})]})})]}),(0,Q.jsx)(A,{open:N,onOpenChange:P,children:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(ue,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(G,{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,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(te,{className:`text-sm font-semibold text-fg`,children:Ve}),(0,Q.jsx)(M,{className:`sr-only`,children:D.searchPlaceholder}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.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":$,children:(0,Q.jsx)(ke,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Fe,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{autoFocus:!0,type:`search`,value:F,onChange:e=>ee(e.target.value),onKeyDown:st,placeholder:D.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,Q.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,Q.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:De?Ae&&!Oe?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):Y.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(I,{className:`h-7 w-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:D.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:D.searchResultsCount.replace(`{{count}}`,String(Oe?.total??Y.length))}),Y.map((e,t)=>{let n=Kt[e.kind]||I,r=qt(e,{imageNote:D.imageNote,noText:D.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ot(e.id),onMouseEnter:()=>R(t),className:a(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===L?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:rt(e.updatedAt,he,We)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(Fe,{className:`h-7 w-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:D.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(I,{className:`h-10 w-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D.needToken})]})}export{Ye as n,qe as r,Xt as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-bzfvlJnh.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-NwiCnzI-.js","assets/preload-helper-zJ_50EbN.js","assets/dist-Mys7eFJ5.js","assets/Combination-HAlzriaz.js","assets/vendor-react-BOUWij0V.js","assets/vendor-swr-BIWyz7Rc.js","assets/cn-BQ_8x0bT.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Ba72bFmP.js","assets/config-reload-event-Bjh2zoKp.js","assets/messages-DbNQuFdA.js","assets/fetch-BID89uCH.js","assets/gateway-startup-retry-BkrLLlpE.js","assets/toast-z0toXu32.js","assets/theme-store-Bt6vAkSB.js","assets/index-B8s8Pq5U.css","assets/vendor-codemirror-C1WKjCk5.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-jD1LPiP-.js","assets/code-editor--tMO38Tr.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{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-DbNQuFdA.js";import{a as s}from"./fetch-BID89uCH.js";import{c,n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{r as d}from"./toast-z0toXu32.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{$o as p,An as m,Ba as h,Bc as g,Bn as _,Bs as v,Cn as y,Cs as b,Dl as x,Dn as S,Do as C,Ds as w,Dt as T,Ec as E,En as D,Fn as O,Fr as k,Ga as A,Gn as j,Ha as M,Hn as N,Ho as P,In as F,Ir as ee,Jo as I,Ka as te,Ks as L,Ln as R,Lr as z,Mc as ne,Mn as re,Nn as ie,Ns as B,On as V,Os as ae,Pn as H,Pr as oe,Rn as se,Rr as ce,Sn as le,Tn as U,Ts as W,Ua as ue,Uc as de,Un as fe,Uo as pe,Us as me,Va as G,Vn as K,Vo as he,Wa as ge,Zo as q,_ as _e,_s as ve,bl as ye,cc as be,dc as J,dl as xe,es as Se,fc as Ce,ic as we,jn as Te,js as Ee,kc as De,kn as Oe,ko as ke,ks as Ae,lc as je,ls as Y,qa as Me,ro as Ne,to as Pe,us as Fe,vl as Ie,wn as Le,xl as Re,zr as ze}from"./index-NwiCnzI-.js";import{t as Be}from"./automation-suggestion-card-BMvGqYob.js";var X=e(t(),1),Z=n(),Q=r(),Ve={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},$=null,He=null,Ue=null,We=null;function Ge(){return $||($=new Audio,$.addEventListener(`timeupdate`,()=>{qe.setState({currentTime:$.currentTime})}),$.addEventListener(`loadedmetadata`,()=>{let e=$.duration;Number.isFinite(e)&&qe.setState({duration:e})}),$.addEventListener(`ended`,()=>{qe.setState({playing:!1,currentTime:0}),$.currentTime=0}),$.addEventListener(`pause`,()=>{qe.setState({playing:!1})}),$.addEventListener(`play`,()=>{qe.setState({playing:!0})})),$}function Ke(){Ue&&We&&fe(Ue,We),He=null,Ue=null,We=null}var qe=c()((e,t)=>({...Ve,play:async(n,r,i)=>{let a=Ge(),o=t();if(o.noteId===n&&o.attachmentId===r&&He){a.play();return}a.pause(),Ke(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await N(n,r);He=t,Ue=n,We=r,a.src=t,await a.play(),e({loading:!1})}catch{e({loading:!1,playing:!1}),Ke()}},pause:()=>{Ge().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=Ge();n.currentTime=t,e({currentTime:t})},reset:()=>{Ge().pause(),Ge().src=``,Ke(),e(Ve)}})),Je=(0,X.createContext)(null);function Ye(){let e=(0,Z.c)(1),t=(0,X.useContext)(Je);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Xe},e[0]=t):t=e[0],t}return t}function Xe(){}function Ze(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[o,s]=(0,X.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=o!==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,Q.jsx)(ue,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`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]=g):g=t[4];let _=o?.alt||`Image preview`,v;t[5]===_?v=t[6]:(v=(0,Q.jsx)(te,{className:`sr-only`,children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(ke,{className:`h-5 w-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,Q.jsx)(h,{asChild:!0,children:(0,Q.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]===o?x=t[11]:(x=o?(0,Q.jsx)(`img`,{src:o.src,alt:o.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=o,t[11]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,Q.jsxs)(ge,{children:[m,(0,Q.jsxs)(G,{className:g,"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,Q.jsx)(A,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let w;return t[19]!==n||t[20]!==C?(w=(0,Q.jsxs)(Je.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=w):w=t[21],w}function Qe(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[o,s]=(0,X.useState)(!1),c;t[0]!==r||t[1]!==n?(c=j(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(o){let e;t[3]===i?e=t[4]:(e=a(`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,Q.jsx)(J,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.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=a(`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,Q.jsx)(K,{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 $e=6e4,et=36e5,tt=864e5;function nt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function rt(e,t,n){let r=t-e;if(r<$e)return n.justNow;if(r<et){let e=Math.floor(r/$e);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=nt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-tt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*tt){let e=Math.floor(r/tt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function it(e,t,n){let r=nt(t);if(e>=r)return n.today;if(e>=r-tt)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 at(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ot(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 st(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:o}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=qe(),p=qe(lt),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]===o?w=t[11]:(w=a(`flex items-center gap-2`,o),t[10]=o,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=a(`flex h-7 w-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,Q.jsx)(L,{className:`h-3.5 w-3.5 animate-spin`}):h?(0,Q.jsx)(Ee,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(W,{className:`h-3.5 w-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,Q.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,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.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 M;t[25]!==v||t[26]!==m||t[27]!==_?(M=ot(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==w||t[36]!==k?(F=(0,Q.jsxs)(`div`,{className:w,onClick:ct,children:[k,P]}),t[34]=P,t[35]=w,t[36]=k,t[37]=F):F=t[37],F}function ct(e){return e.stopPropagation()}function lt(e){return e.toggle}function ut(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function dt(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:o,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=ut(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,X.useState)(ht),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=rt(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,x;t[11]===b?x=t[12]:(x=a(`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`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,Q.jsx)(Qe,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(st,{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]=C):C=t[18];let T;t[19]===n.title?T=t[20]:(T=n.title&&(0,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[21]===E?D=t[22]:(D=a(`truncate text-sm leading-5`,E),t[21]=E,t[22]=D);let O;t[23]!==p||t[24]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:p}),t[23]=p,t[24]=D,t[25]=O):O=t[25];let A;t[26]!==T||t[27]!==O?(A=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,O]}),t[26]=T,t[27]=O,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ze,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:mt,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,Q.jsx)(ne,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==o?(M=()=>o(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=o,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,Q.jsx)(w,{className:`h-4 w-4`}):(0,Q.jsx)(ae,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?l.unpin:l.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,Q.jsxs)(k,{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:M,children:[N,P]}),t[36]=M,t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==n.id||t[41]!==s?(I=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=I):I=t[42];let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(Re,{className:`h-4 w-4`}),t[43]=te):te=t[43];let L;t[44]!==l.archive||t[45]!==I?(L=(0,Q.jsxs)(k,{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:[te,l.archive]}),t[44]=l.archive,t[45]=I,t[46]=L):L=t[46];let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(ce,{className:`my-1 h-px bg-edge-subtle`}),t[47]=R):R=t[47];let re;t[48]!==n.id||t[49]!==c?(re=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=re):re=t[50];let ie;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(he,{className:`h-4 w-4`}),t[51]=ie):ie=t[51];let B;t[52]!==l.delete||t[53]!==re?(B=(0,Q.jsxs)(k,{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:re,children:[ie,l.delete]}),t[52]=l.delete,t[53]=re,t[54]=B):B=t[54];let V;t[55]!==F||t[56]!==L||t[57]!==B?(V=(0,Q.jsxs)(z,{children:[j,(0,Q.jsx)(ee,{children:(0,Q.jsxs)(oe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:pt,children:[F,L,R,B]})})]}),t[55]=F,t[56]=L,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==A||t[60]!==V||t[61]!==C?(H=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,A,V]}),t[59]=A,t[60]=V,t[61]=C,t[62]=H):H=t[62];let se;t[63]===n.pinned?se=t[64]:(se=n.pinned&&(0,Q.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,Q.jsx)(ae,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=se);let le;t[65]===n.tags?le=t[66]:(le=n.tags?.slice(0,2).map(ft),t[65]=n.tags,t[66]=le);let U;t[67]===_?U=t[68]:(U=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[67]=_,t[68]=U);let W;t[69]!==se||t[70]!==le||t[71]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[se,le,U]}),t[69]=se,t[70]=le,t[71]=U,t[72]=W):W=t[72];let ue;return t[73]!==H||t[74]!==W||t[75]!==v||t[76]!==y||t[77]!==x||t[78]!==S?(ue=(0,Q.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[H,W]}),t[73]=H,t[74]=W,t[75]=v,t[76]=y,t[77]=x,t[78]=S,t[79]=ue):ue=t[79],ue}function ft(e){return(0,Q.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 pt(e){return e.stopPropagation()}function mt(e){return e.stopPropagation()}function ht(){return Date.now()}var gt={edit:Ae,ai_edit:Se,sync:ve,restore:ye};function _t(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function vt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let s=o(l(e=>e.language)).notes,c=s,{data:u}=f(e?[`note-history`,e]:null,()=>V(e)),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),_=(0,X.useCallback)(async t=>{m(!0);try{await R(e,t),d({type:`success`,title:s.restoreSuccess}),g(null),i()}catch{d({type:`error`,title:s.restoreFailed})}finally{m(!1)}},[e,s.restoreSuccess,s.restoreFailed,i]),v=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Ce,{className:`h-4 w-4`,"aria-hidden":!0}),s.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(ke,{className:`h-4 w-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=gt[e.trigger]??Ae,i=t===e.timestamp,o=h===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:a(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:_t(e.trigger,s)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:rt(e.timestamp,v,c)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:s.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_(e.timestamp)},disabled:p,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:p?`...`:s.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),g(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(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:s.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:s.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:s.historyEmptyDescription})]})})]})}function yt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:s,onClose:c,noteThreads:u,openingChat:d,onOpenChat:p,onOpenNewChat:m}=e,h=o(l(Et)).notes,g=x(),_=r?.aiDeep?.catalysis,v=_?.report??null,y;t[0]===n?y=t[1]:(y=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=y);let b;t[2]===n?b=t[3]:(b=()=>D(n),t[2]=n,t[3]=b);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}=f(y,b,S),E;t[5]===n?E=t[6]:(E=async e=>{try{await F(n,e)}catch{}},t[5]=n,t[6]=E);let k=E,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(Se,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[7]=A):A=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Ie,{className:`h-4 w-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(me,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=t[9],(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:h.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:h.catalysisSectionDescription}),C?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>O(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:h.contextRebuild}),(0,Q.jsx)(`span`,{className:a(`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,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:h.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(Tt)}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:s,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?h.processing:v?h.recatalyze:h.catalyzeAction}),v?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:v.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.targetUsers.slice(0,5).map(wt)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.keyQuestions.slice(0,3).map(Ct)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.mvpPath.slice(0,3).map(St)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.risks.slice(0,3).map(xt)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.nextActions.slice(0,4).map(bt)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h.confidenceLabel.replace(`{{percent}}`,String(Math.round(v.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void k(`helpful`),className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackHelpfulAria,children:(0,Q.jsx)(P,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void k(`not_helpful`),className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackNotHelpfulAria,children:(0,Q.jsx)(pe,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:h.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[M,h.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:p,disabled:d,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:d?h.openingChat:h.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:m,disabled:d,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:h.newThread})]})]}),u.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:u.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>g(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||h.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:h.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:h.noThreads})]})]})]})}function bt(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function xt(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e)}function St(e,t){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e)}function Ct(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e)}function wt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Tt(e){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Et(e){return e.language}var Dt=()=>i(()=>import(`./block-editor-bzfvlJnh.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),Ot=()=>i(()=>import(`./markdown-editor-jD1LPiP-.js`).then(e=>e.n),__vite__mapDeps([20,1,3,18,6,21])),kt=(0,X.lazy)(()=>Dt().then(e=>({default:e.BlockEditor}))),At=(0,X.lazy)(()=>Ot().then(e=>({default:e.MarkdownEditor})));function jt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Mt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,o;t[0]===i.edit?o=t[1]:(o={id:`wysiwyg`,label:i.edit,Icon:E},t[0]=i.edit,t[1]=o);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:g},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:De},t[4]=i.preview,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=[o,s,c],t[6]=o,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,Q.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:o}=e;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&Dt(),t===`source`&&Ot()},onFocus:()=>{t===`wysiwyg`&&Dt(),t===`source`&&Ot()},className:a(`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,Q.jsx)(o,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Nt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:s,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(Pt),_;t[0]===g?_=t[1]:(_=o(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==s||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,Q.jsx)(Ft,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:s,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=s,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,Q.jsx)(Ze,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Pt(e){return e.language}function Ft({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:s=!0,onOpenSearch:c,autoFocus:p=!1,onAutoFocusConsumed:m}){let h=l(e=>e.language),g=o(h).notes,v=o(h).automations.suggestions,y=x(),b=u(e=>e.resolved)===`dark`,{openImage:w}=Ye(),[T,E]=(0,X.useState)(`wysiwyg`),[D,O]=(0,X.useState)(null),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(``),[F,ee]=(0,X.useState)(360),[I,te]=(0,X.useState)(!1),[L,R]=(0,X.useState)(!1),[z,ne]=(0,X.useState)(!1),re=(0,X.useRef)(!1),ie=(0,X.useRef)(!1),B=(0,X.useRef)(null),V=(0,X.useRef)(null),ae=(0,X.useRef)(null),H=(0,X.useRef)(null),oe=(0,X.useRef)(null),ce=(0,X.useRef)(null),W=(0,X.useRef)(null),ue=(0,X.useRef)(null),de=(0,X.useRef)(null),fe=Me(e=>e.setPageHeader),pe=Me(e=>e.clearPageHeader),{data:G,mutate:K}=f(e?[`note-detail`,e]:null,()=>U(e)),{data:he=[],mutate:ge}=f(e?[`note-threads`,e]:null,()=>Oe(e),{revalidateOnFocus:!1}),q=k!==null;(0,X.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&K()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[K,e]),(0,X.useEffect)(()=>{re.current=!1,P(``),A(null),O(null),ie.current=!1,de.current=null},[e]),(0,X.useEffect)(()=>{!G||re.current||(P(G.title??``),re.current=!0)},[G]),(0,X.useEffect)(()=>{if(!p||!G||q||de.current===e)return;let t=window.requestAnimationFrame(()=>{ue.current?.focus(),m?.()});return de.current=e,()=>window.cancelAnimationFrame(t)},[p,q,G,e,m]);let ve=G?new Date(G.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,ye=(0,X.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":g.back,className:a(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,C,i),children:(0,Q.jsx)(Ie,{className:`h-4 w-4`,"aria-hidden":!0})}):null,[i,g.back,t,r]),be=(0,X.useCallback)(t=>{P(t),e&&(H.current=t,V.current&&clearTimeout(V.current),V.current=setTimeout(async()=>{let t=H.current;if(H.current=null,t!==null){M(!0);try{await se(e,{title:t}),await K(),n?.()}catch{}finally{M(!1)}}},600))},[e,K,n]),J=(0,X.useMemo)(()=>(0,Q.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,C),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||ve||void 0,children:N||ve}),j?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:g.saving}):null]}),[g.saving,j,ve,N]),xe=(0,X.useCallback)(async(t=!1)=>{ne(!0);try{let n=await Te(e,{forceNew:t});await K(),await ge(),y(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){d({type:`error`,title:g.chatOpenFailedTitle,message:e instanceof Error?e.message:g.chatOpenFailedMessage})}finally{ne(!1)}},[K,ge,y,e,g.chatOpenFailedMessage,g.chatOpenFailedTitle]),we=(0,X.useCallback)(async()=>{R(!0);try{await le(e),await K(),d({type:`success`,title:g.catalysisDone})}catch(e){d({type:`error`,title:g.catalysisFailed,message:e instanceof Error?e.message:g.chatOpenFailedMessage})}finally{R(!1)}},[K,e]),Ee=(0,X.useCallback)(()=>{O(D===`breakdown`?null:`breakdown`),!G?.aiDeep?.catalysis?.report&&!L&&we()},[D,L,we,G?.aiDeep?.catalysis?.report]),De=(0,X.useMemo)(()=>(0,Q.jsxs)(`div`,{className:a(`flex items-center gap-2`,C),children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Fe,{className:`h-4 w-4`,"aria-hidden":!0})}):null,(0,Q.jsxs)(`button`,{type:`button`,onClick:Ee,disabled:L,"aria-label":g.catalysisSectionTitle,className:a(`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`,D===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(Se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),L?g.catalyzing:g.catalyzeButton]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>xe(!1),disabled:z,className:a(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(me,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),z?g.openingChat:g.openChatButton]}),(0,Q.jsx)(Mt,{mode:T,onModeChange:E,labels:{edit:g.modeEdit,source:g.modeSource,preview:g.modePreview}}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>O(D===`history`?null:`history`),"aria-label":g.history,className:a(`rounded-lg p-1.5 transition-colors`,D===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,Q.jsx)(Ce,{className:`h-4 w-4`,"aria-hidden":!0})})]}),[L,Ee,xe,T,g.history,g.modeEdit,g.modePreview,g.modeSource,z,D,c,g.searchDialogTitle]);(0,X.useLayoutEffect)(()=>(fe({startExtra:ye,main:G?J:null,end:G?De:null}),()=>{s&&pe()}),[s,pe,De,J,ye,G,fe]);let ke=(0,X.useCallback)(t=>{e&&(ae.current=t,B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{let t=ae.current;if(ae.current=null,t!==null){M(!0);try{await se(e,{markdown:t}),await K(),n?.()}catch(e){d({type:`error`,title:g.saveFailed,message:e instanceof Error?e.message:g.saveFailedHint})}finally{M(!1)}}},600))},[e,K,g.saveFailed,g.saveFailedHint,n]),Ae=(0,X.useCallback)(t=>{S(e,t.timestamp).then(e=>{e&&A(e)})},[e]),je=(0,X.useCallback)(()=>{O(null),A(null)},[]),Y=(0,X.useCallback)(()=>{O(null),A(null),K(),n?.()},[K,n]);if((0,X.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),V.current&&clearTimeout(V.current);let t=ae.current,n=H.current;ae.current=null,H.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&se(e,r)},[e]),G===void 0)return(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(G===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:g.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:g.back})]});let Ne=q?k.title??``:N,Pe=q?k.markdown??``:G.markdown??``,Le=new Date(G.createdAt).getTime(),Re=Number.isFinite(Le)&&Date.now()-Le<3600*1e3?(0,Q.jsx)(Be,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(_e,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(_e,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(`div`,{ref:oe,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:q?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ne&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ne}),Pe?(0,Q.jsx)(_,{noteId:e,content:Pe,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:g.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[T===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:ue,type:`text`,value:N,onChange:e=>be(e.target.value),onCompositionStart:()=>{ie.current=!0},onCompositionEnd:()=>{ie.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ie.current&&!t.isComposing&&(e.preventDefault(),(oe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:g.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`}),Re]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(jt,{}),children:(0,Q.jsx)(kt,{initialContent:G.markdown??``,onChange:ke,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:ue,type:`text`,value:N,onChange:e=>be(e.target.value),placeholder:g.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`}),Re]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(jt,{}),children:(0,Q.jsx)(At,{initialContent:G.markdown??``,onChange:ke,isDark:b},`source-${e}`)})})]}),T===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&w(t.currentSrc||t.src,t.alt)},children:[N&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:N}),G.markdown?(0,Q.jsx)(_,{noteId:e,content:G.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:g.emptyPreview})]})]})})]}),(0,Q.jsx)(`div`,{ref:ce,className:a(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:D?F:0},children:(0,Q.jsxs)(`div`,{ref:W,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),te(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,D&&ce.current?.style.setProperty(`width`,`${s}px`),W.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{}te(!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:a(`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`,I&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:D===`history`?(0,Q.jsx)(vt,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:Ae,onClose:je,onRestored:Y}):D===`breakdown`?(0,Q.jsx)(yt,{noteId:e,note:G??null,catalyzing:L,onCatalyze:we,onClose:()=>O(null),noteThreads:he,openingChat:z,onOpenChat:()=>xe(!1),onOpenNewChat:()=>xe(!0)}):null})]})})]})}var It=3e4;function Lt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Rt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:o=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(0),[_,y]=(0,X.useState)(!1),b=(0,X.useRef)(null),x=(0,X.useRef)(null),S=(0,X.useRef)(null),C=(0,X.useRef)([]),w=(0,X.useRef)(0),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useCallback)(()=>{T.current&&=(clearInterval(T.current),null),E.current&&=(clearTimeout(E.current),null),S.current?.getTracks().forEach(e=>e.stop()),S.current=null,x.current=null,C.current=[],m(!1),g(0)},[]);(0,X.useEffect)(()=>()=>D(),[D]);let O=(0,X.useCallback)(async()=>{let e=x.current;if(!e||e.state!==`recording`)return;y(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-w.current)/1e3)),n=e.mimeType||Lt()||`audio/webm`,r=new Blob(C.current,{type:n});if(D(),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{y(!1)}return}y(!1)},[D,i]),k=(0,X.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Lt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);S.current=e,x.current=n,C.current=[],w.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&C.current.push(e.data)},n.start(),m(!0),g(0),T.current=setInterval(()=>{g(Math.round((Date.now()-w.current)/1e3))},250),E.current=setTimeout(()=>{O()},It)}catch{D()}},[D,i,p,O,_]),A=(0,X.useCallback)(()=>{if(p){O();return}k()},[p,k,O]),j=(0,X.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),b.current?.focus()}}},[l,d,n]),M=(0,X.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,Q.jsxs)(`div`,{className:a(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel px-2 py-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,Q.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,Q.jsx)(je,{className:`h-4 w-4`})}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:A,disabled:N||c||d,className:a(`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,Q.jsx)(q,{className:`h-4 w-4 fill-current`}):(0,Q.jsx)(v,{className:`h-4 w-4`})}),p?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:o.replace(`{{seconds}}`,String(h))}):(0,Q.jsx)(`textarea`,{ref:b,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,Q.jsx)(`button`,{type:`button`,disabled:!l.trim()||N||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:a(`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,Q.jsx)(Y,{className:`h-4 w-4`})})]})}var zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Bt=240,Vt=320,Ht=520,Ut=560;function Wt(e){if(globalThis.localStorage===void 0)return Vt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Vt;let n=Number(t);return Number.isFinite(n)?n:Vt}catch{return Vt}}function Gt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var Kt={thought:I,todo:p,voice:v,media:je,bookmark:xe,mixed:I,task:p};function qt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Jt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Yt(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Xt({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:c,captureTags:u=[],listTitle:g,listDescription:_,emptyText:S,emptyDescription:w,listWidthStorageKey:E=`xopc.notes.listWidth`}){let D=o(l(e=>e.language)).notes,O=!!s(e=>e.token),[k,j]=(0,X.useReducer)(T,zt),[N,P]=(0,X.useState)(!1),[F,ee]=(0,X.useState)(``),[L,R]=(0,X.useState)(0),[z,ne]=(0,X.useState)(()=>Wt(E)),[V,oe]=(0,X.useState)(!1),[ce,le]=(0,X.useState)(!1),[U,W]=(0,X.useState)(!1),[fe,pe]=(0,X.useState)(null),me=(0,X.useRef)(null),K=(0,X.useRef)(null),[he]=(0,X.useState)(()=>Date.now()),q=x(),_e=(0,X.useCallback)(e=>{let t=me.current?.clientWidth??window.innerWidth,n=Math.max(Bt,t-Ut);return Math.max(Bt,Math.min(Math.min(Ht,n),e))},[]),ve=(0,X.useCallback)(e=>{let t=_e(e);ne(t),Gt(E,t)},[_e,E]);(0,X.useLayoutEffect)(()=>{ne(e=>_e(e))},[_e]);let{data:ye,mutate:J,isLoading:Se}=f((0,X.useMemo)(()=>O?[`notes-list`,c,k.statusFilter,k.kindFilter,k.pinnedOnly]:null,[O,c,k.statusFilter,k.kindFilter,k.pinnedOnly]),()=>m({status:k.statusFilter===`all`?void 0:k.statusFilter,kind:k.kindFilter===`all`?void 0:k.kindFilter,tag:c,pinned:k.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Ce=Se&&!ye,Te=ye?.items??[],Ee=ye?.total??0,De=F.trim(),{data:Oe,isLoading:Ae}=f(O&&N&&De?[`notes-search`,c,De]:null,()=>m({search:De,tag:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),Y=Oe?.items??[],Ie=e?Te.some(t=>t.id===e):!0;(0,X.useEffect)(()=>{R(0)},[De]),(0,X.useEffect)(()=>{L>=Y.length&&R(Math.max(0,Y.length-1))},[L,Y.length]),(0,X.useEffect)(()=>{let e=()=>{J()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J]);let ze=Me(e=>e.setPageHeader),Be=Me(e=>e.clearPageHeader),Z=Ee>0?D.noteCount.replace(`{{count}}`,String(Ee)):null,Ve=D.searchDialogTitle,$=D.searchClose,He=D.searchClear,Ue=(0,X.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:a(`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`,C),"aria-label":Ve,children:[(0,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:Ve})]}),[Ve]);(0,X.useLayoutEffect)(()=>{if(n)return O?(ze({startExtra:null,main:(0,Q.jsxs)(`div`,{className:a(`flex min-w-0 items-center gap-2`,C),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??D.title}),Z?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Z}):null]}),end:Ue}),()=>Be()):(Be(),()=>Be())},[Be,O,Ue,g,n,D.title,Z,e,ze]);let We=(0,X.useMemo)(()=>({justNow:D.justNow,minutesAgo:D.minutesAgo,today:D.today,yesterday:D.yesterday,daysAgo:D.daysAgo}),[D.justNow,D.minutesAgo,D.today,D.yesterday,D.daysAgo]),Ge=(0,X.useMemo)(()=>[{id:`recent`,label:D.viewRecent,description:D.viewRecentDescription,icon:de,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:D.filterInbox,description:D.viewInboxDescription,icon:be,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:D.pinned,description:D.viewPinnedDescription,icon:ae,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:D.viewTasks,description:D.viewTasksDescription,icon:p,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:D.kindVoice,description:D.viewVoiceDescription,icon:v,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:D.kindMedia,description:D.viewMediaDescription,icon:je,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:D.kindBookmark,description:D.viewBookmarksDescription,icon:xe,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:D.filterProcessed,description:D.viewProcessedDescription,icon:we,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:D.filterArchived,description:D.viewArchiveDescription,icon:Re,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[D.filterArchived,D.filterInbox,D.filterProcessed,D.kindBookmark,D.kindMedia,D.kindVoice,D.pinned,D.viewArchiveDescription,D.viewBookmarksDescription,D.viewInboxDescription,D.viewMediaDescription,D.viewPinnedDescription,D.viewProcessedDescription,D.viewRecent,D.viewRecentDescription,D.viewTasks,D.viewTasksDescription,D.viewVoiceDescription]),Ke=Ge.find(e=>Jt(k,e))??Ge[0],qe=g??Ke.label,Je=_??Ke.description,Ye=(0,X.useCallback)(async(e,n)=>{let r=u.length?await y({markdown:e,kind:`thought`,tags:u,channel:`web`}):await re(e,`web`);await J(),n?.navigate!==!1&&q(Yt(t,r.id))},[t,u,J,q]),Xe=(0,X.useCallback)(async()=>{if(!U){W(!0);try{let e=await y({markdown:``,kind:`thought`,tags:u,channel:`web`});j({type:`patch`,patch:zt}),await J(),pe(e.id),q(Yt(t,e.id))}catch(e){d({type:`error`,title:D.createBlankFailed,message:e instanceof Error?e.message:D.createBlankFailedHint})}finally{W(!1)}}},[t,u,U,J,D.createBlankFailed,D.createBlankFailedHint,q]),Ze=(0,X.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{await ie(t,`web`),await J()}catch(e){d({type:`error`,title:D.imageUploadFailed,message:e instanceof Error?e.message:D.imageUploadFailedHint})}},e.click()},[J,D.imageUploadFailed,D.imageUploadFailedHint]),Qe=(0,X.useCallback)(async(e,t)=>{try{await H(e,t,`web`),await J()}catch(e){d({type:`error`,title:D.voiceUploadFailed,message:e instanceof Error?e.message:D.voiceUploadFailedHint})}},[J,D.voiceUploadFailed,D.voiceUploadFailedHint]),$e=(0,X.useCallback)(async(e,t)=>{await se(e,{pinned:t}),await J()},[J]),et=(0,X.useCallback)(async e=>{await se(e,{status:`archived`}),await J()},[J]),tt=(0,X.useCallback)(async e=>{await Le(e),await J()},[J]),nt=(0,X.useCallback)(e=>{q(Yt(t,e))},[t,q]),ot=(0,X.useCallback)(e=>{q(Yt(t,e)),P(!1)},[t,q]),st=(0,X.useCallback)(e=>{if(Y.length){if(e.key===`ArrowDown`)e.preventDefault(),R(e=>Math.min(Y.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),R(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=Y[L]??Y[0];t&&ot(t.id)}}},[L,ot,Y]),ct=(0,X.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=K.current;t.setPointerCapture(e.pointerId),oe(!0);let r=me.current?.clientWidth??window.innerWidth,i=Math.max(Bt,r-Ut),a=Math.min(Ht,i),o=e=>Math.max(Bt,Math.min(a,e)),s=e.clientX,c=o(z),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{}oe(!1),me.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),ne(f),Gt(E,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)},[E,z]);(0,X.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Xe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Xe]);let lt=(0,X.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ve(z-16)):e.key===`ArrowRight`?(e.preventDefault(),ve(z+16)):e.key===`Home`?(e.preventDefault(),ve(Bt)):e.key===`End`&&(e.preventDefault(),ve(Ht))},[ve,z]);return O?(0,Q.jsxs)(`div`,{ref:me,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${z}px`},children:[(0,Q.jsxs)(`section`,{ref:K,className:a(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!V&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ce?`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":ce?!0:void 0,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 border-b border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,Q.jsx)(Pe,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&j({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":D.libraryTitle,children:Ge.map(e=>(0,Q.jsx)(Ne,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Z??Je})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>le(!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":D.collapseNotesList,title:D.collapseNotesList,children:(0,Q.jsx)(B,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Xe,disabled:U,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":D.createBlankNote,title:D.createBlankShortcut,children:(0,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>P(!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":D.searchDialogTitle,children:(0,Q.jsx)(Fe,{className:`h-4 w-4`,"aria-hidden":!0})})]})]}),(0,Q.jsx)(Rt,{placeholder:D.quickCapturePlaceholder,sendLabel:D.send,onCapture:Ye,onImagePick:i?Ze:void 0,onVoiceCapture:i?Qe:void 0,recordingLabel:D.recording})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:Ce?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Te.length===0?(0,Q.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,Q.jsx)(I,{className:`h-8 w-8 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ie?D.noteOutsideCurrentView:S??D.noNotes}),e&&!Ie?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w??D.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ie?(0,Q.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:D.noteOutsideCurrentView}):null,Te.map((t,n)=>{let r=n>0?at(Te[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[at(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:a(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:it(t.createdAt,he,We)}),(0,Q.jsx)(dt,{note:t,selected:t.id===e,onPress:nt,onPin:$e,onArchive:et,onDelete:tt,timeLabels:We,labels:{pin:D.pin,unpin:D.unpin,archive:D.archive,delete:D.delete,imageNote:D.imageNote,noText:D.noText}})]},t.id)})]})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":D.resizeNotesList,"aria-valuemin":Bt,"aria-valuemax":Ht,"aria-valuenow":Math.round(z),tabIndex:0,onPointerDown:ct,onDoubleClick:()=>ve(Vt),onKeyDown:lt,title:D.resizeNotesList,className:a(`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`,ce?`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,Q.jsx)(`span`,{"aria-hidden":!0,className:a(`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`,V&&`bg-accent opacity-100 scale-y-125`)})}),(0,Q.jsxs)(`section`,{className:a(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[ce?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>le(!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":D.expandNotesList,title:D.expandNotesList,children:(0,Q.jsx)(B,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(Nt,{noteId:e,onBack:()=>q(t),onSaved:()=>void J(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>P(!0),autoFocus:e===fe,onAutoFocusConsumed:()=>pe(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(I,{className:`mx-auto h-9 w-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:D.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Xe,disabled:U,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,Q.jsx)(b,{className:`h-4 w-4`,"aria-hidden":!0}),U?D.creatingBlankNote:D.createBlankNote]})]})})]}),(0,Q.jsx)(A,{open:N,onOpenChange:P,children:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(ue,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(G,{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,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(te,{className:`text-sm font-semibold text-fg`,children:Ve}),(0,Q.jsx)(M,{className:`sr-only`,children:D.searchPlaceholder}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.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":$,children:(0,Q.jsx)(ke,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Fe,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{autoFocus:!0,type:`search`,value:F,onChange:e=>ee(e.target.value),onKeyDown:st,placeholder:D.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,Q.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,Q.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:De?Ae&&!Oe?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):Y.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(I,{className:`h-7 w-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:D.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:D.searchResultsCount.replace(`{{count}}`,String(Oe?.total??Y.length))}),Y.map((e,t)=>{let n=Kt[e.kind]||I,r=qt(e,{imageNote:D.imageNote,noText:D.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ot(e.id),onMouseEnter:()=>R(t),className:a(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===L?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:rt(e.updatedAt,he,We)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(Fe,{className:`h-7 w-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:D.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:D.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(I,{className:`h-10 w-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D.needToken})]})}export{Ye as n,qe as r,Xt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{bo as a}from"./index-
|
|
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"./cn-BQ_8x0bT.js";import{bo as a}from"./index-NwiCnzI-.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{Ac as r,Ja as i,Nc as a,bo as o}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{Ac as r,Ja as i,Nc as a,bo as o}from"./index-NwiCnzI-.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=i()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=i()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=n(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:n(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=n(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
|