@xopcai/xopc 0.0.101 → 0.0.103
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/feishu/src/transport/webhook/monitor.js +2 -2
- package/dist/extensions/feishu/src/transport/webhook/monitor.js.map +1 -1
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/send-options.js +8 -5
- package/dist/extensions/telegram/src/send-options.js.map +1 -1
- package/dist/extensions/telegram/src/update-offset-store.js +1 -1
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/{agents-u8cmUfGQ.js → agents-BwXkia_W.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DF8m9cUE.js → apps-page-C5RmwmTT.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BM3doRvi.js → channels-settings-tlOTdaXw.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-ah4zWEIP.js → channels-status-swr-D4XjqwqC.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-DgMuL_2b.js → cron-api-DcmfGuj0.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-COfUPKfq.js → cron-page-CijJ4G6F.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-Dzy3Q0ZH.js → dist-CWm8hTXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-kyxxefKh.js → extension-debug-page-BzYgTkS9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BVbCBHoI.js → extension-page-BmTZH6gL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-t1lb2A7v.js → extension-settings-page-CyJk_G64.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-drJUxxKP.js → fetch-CMoWY2Si.js} +1 -1
- package/dist/gateway/static/root/assets/{field-primitives-6Vo1Yga4.js → field-primitives-C4GpxsDo.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BF3psu4O.js → heartbeat-config-api-CLD0Gpi3.js} +1 -1
- package/dist/gateway/static/root/assets/index-0HmunJW9.js +4845 -0
- package/dist/gateway/static/root/assets/index-Bk75Phrd.css +1 -0
- package/dist/gateway/static/root/assets/{logs-page-BTVPXcHV.js → logs-page-BjdQjHwk.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-page-DqSAg_5Z.js → note-detail-page-8Er4197b.js} +2 -2
- package/dist/gateway/static/root/assets/{note-time-FSOjchic.js → note-time-CF3vf1jm.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DkRX7BE2.js → notes-page-BBnTh0uI.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Khdw35Zk.js → sessions-page-B0riYK7j.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-advanced-gate-DspC8oEm.js → settings-advanced-gate-DiP_WHu_.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DuxvUuur.js → settings-form-section-C7qA7y0J.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DN8JBZ8F.js → settings-page-1ZPhcCZ9.js} +2 -2
- package/dist/gateway/static/root/assets/share-preview-page-Tvr5Mtq5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page-ByYT0fXZ.js → skills-page-BQ1hllKD.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B6KXPHgK.js → theme-store-HTvJlFLL.js} +1 -1
- package/dist/gateway/static/root/assets/url-F3_D_6zZ.js +3 -0
- package/dist/gateway/static/root/assets/{utils-DK_1H47k.js → utils-CPr3FBh2.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BYN2EIMs.js → voice-api-key-field-BkbDl6dH.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-Bi19YNTr.js → workflow-page.utils-CeBkAjP7.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DP57FEKW.js → workflows-page-D059ysoF.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +7 -7
- package/dist/src/agent/agent-scope.js +1 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -1
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/context/workspace-state.js +1 -1
- package/dist/src/agent/goals/goal-run-store.js +4 -4
- package/dist/src/agent/goals/persistent-goal-service.js +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/image/load-image-media.js +2 -2
- package/dist/src/agent/inbound/attachment-pipeline.js +2 -2
- package/dist/src/agent/inbound/attachment-pipeline.js.map +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/memory-flush.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/reply/post-compaction-context.js +1 -1
- package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +2 -2
- package/dist/src/agent/service.js +4 -4
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/send-media.js +2 -3
- package/dist/src/agent/tools/send-media.js.map +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/workflow/catalog.js +1 -1
- package/dist/src/auth/credentials.d.ts +7 -0
- package/dist/src/auth/credentials.js +37 -4
- package/dist/src/auth/credentials.js.map +1 -1
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/index.js.map +1 -1
- package/dist/src/auth/oauth/github-copilot.d.ts +1 -1
- package/dist/src/auth/oauth/google-antigravity.d.ts +1 -3
- package/dist/src/auth/oauth/google-antigravity.js +1 -1
- package/dist/src/auth/oauth/google-gemini-cli.d.ts +1 -3
- package/dist/src/auth/oauth/google-gemini-cli.js +1 -1
- package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/google-antigravity.js +3 -5
- package/dist/src/auth/oauth/google-oauth/google-antigravity.js.map +1 -0
- package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/google-gemini-cli.js +4 -5
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js.map +1 -0
- package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/oauth-page.js +12 -4
- package/dist/src/auth/oauth/google-oauth/oauth-page.js.map +1 -0
- package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/pkce.d.ts +1 -1
- package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/pkce.js +2 -2
- package/dist/src/auth/oauth/google-oauth/pkce.js.map +1 -0
- package/dist/src/auth/oauth/index.js +2 -2
- package/dist/src/auth/oauth/kimi-coding.d.ts +1 -1
- package/dist/src/auth/oauth/kimi-coding.js +1 -1
- package/dist/src/auth/oauth/kimi-coding.js.map +1 -1
- package/dist/src/auth/oauth/minimax-cn.js +1 -1
- package/dist/src/auth/oauth/minimax-cn.js.map +1 -1
- package/dist/src/auth/oauth/minimax.js +1 -1
- package/dist/src/auth/oauth/minimax.js.map +1 -1
- package/dist/src/auth/oauth/openai-codex.d.ts +7 -2
- package/dist/src/auth/oauth/openai-codex.js +318 -1
- package/dist/src/auth/oauth/openai-codex.js.map +1 -0
- package/dist/src/auth/profiles/store.js +4 -3
- package/dist/src/auth/profiles/store.js.map +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/browser/cache-dir-policy.js +1 -1
- package/dist/src/browser/cdp-local-launcher.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +3 -3
- package/dist/src/browser/providers/cloakbrowser.js +4 -4
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/channels/attachments/attachment-classifiers.d.ts +1 -0
- package/dist/src/channels/attachments/attachment-classifiers.js +13 -2
- package/dist/src/channels/attachments/attachment-classifiers.js.map +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/agent-edit.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/model.js +2 -2
- package/dist/src/chat-commands/builtins/model.js.map +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/auth.js +39 -51
- package/dist/src/cli/commands/auth.js.map +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/logs.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +3 -3
- package/dist/src/cli/commands/models.js +189 -54
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/cli/commands/onboard/model.d.ts +1 -4
- package/dist/src/cli/commands/onboard/model.js +253 -183
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/cli/utils/oauth-login.d.ts +17 -0
- package/dist/src/cli/utils/oauth-login.js +93 -0
- package/dist/src/cli/utils/oauth-login.js.map +1 -0
- package/dist/src/cli/utils/oauth-providers.js +2 -2
- package/dist/src/commands/agents.config.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/paths-state.js +1 -1
- package/dist/src/config/profile.js +2 -2
- package/dist/src/config/workspace-path.js +1 -1
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/daemon/constants.js +1 -1
- package/dist/src/daemon/install-plan.js +2 -2
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/schtasks.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/bundle-mcp.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +3 -3
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/extension-store.js +2 -2
- package/dist/src/gateway/hono/lib/static-ui.js +2 -2
- package/dist/src/gateway/hono/oauth-async.js +3 -3
- package/dist/src/gateway/hono/oauth.js +3 -3
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +2 -2
- package/dist/src/gateway/hono/routes/models.js +26 -6
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/notes.js +9 -22
- package/dist/src/gateway/hono/routes/notes.js.map +1 -1
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +2 -2
- package/dist/src/gateway/lock.js +3 -3
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service.js +1 -1
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/infra/brew.js +1 -1
- package/dist/src/infra/package-json.js +1 -1
- package/dist/src/infra/package-update-steps.js +1 -1
- package/dist/src/infra/path-env.js +2 -2
- package/dist/src/infra/restart.js +2 -2
- package/dist/src/infra/stable-node-path.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-global.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/media/store.js +4 -1
- package/dist/src/media/store.js.map +1 -1
- package/dist/src/notes/note-attachment-sync.d.ts +2 -3
- package/dist/src/notes/note-attachment-sync.js +2 -27
- package/dist/src/notes/note-attachment-sync.js.map +1 -1
- package/dist/src/notes/note-index-meta.d.ts +6 -2
- package/dist/src/notes/note-index-meta.js +11 -16
- package/dist/src/notes/note-index-meta.js.map +1 -1
- package/dist/src/notes/note-markdown.d.ts +61 -0
- package/dist/src/notes/note-markdown.js +177 -0
- package/dist/src/notes/note-markdown.js.map +1 -0
- package/dist/src/notes/service.d.ts +9 -7
- package/dist/src/notes/service.js +163 -312
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/notes/store.js +4 -5
- package/dist/src/notes/store.js.map +1 -1
- package/dist/src/notes/types.d.ts +29 -58
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.d.ts +3 -3
- package/dist/src/providers/index.js +25 -17
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/presentation.d.ts +34 -0
- package/dist/src/providers/presentation.js +162 -0
- package/dist/src/providers/presentation.js.map +1 -0
- package/dist/src/session/init-session-turn.js +2 -2
- package/dist/src/session/resolve-session.js +3 -3
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/store.js +2 -2
- package/dist/src/share/share-auto.js +2 -2
- package/dist/src/share/share-store.js +3 -3
- package/dist/src/share/share-thumbnail.js +2 -2
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-share-store.js +3 -3
- package/dist/src/share/site-static-serve.js +1 -1
- package/dist/src/storage/sqlite/connection.js +2 -2
- package/dist/src/storage/sqlite/memory-index-repository.js +2 -2
- package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +4 -0
- package/dist/src/storage/sqlite/migrations/discover.js +1 -1
- package/dist/src/storage/sqlite/migrations/runner.d.ts +2 -2
- package/dist/src/storage/sqlite/migrations/runner.js +5 -5
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +2 -2
- package/dist/src/storage/sqlite/notes-repository.js +18 -6
- package/dist/src/storage/sqlite/notes-repository.js.map +1 -1
- package/dist/src/storage/sqlite/schema.js +4 -4
- package/dist/src/storage/sqlite/schema.sql +5 -1
- package/dist/src/tui/clipboard-image.js +3 -3
- package/dist/src/tui/theme-manager.js +1 -1
- package/dist/src/tui/tui-keybindings-file.js +1 -1
- package/dist/src/tui/tui-scoped-models.js +2 -2
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui.js +3 -3
- package/dist/src/tunnel/frpc-binary.js +3 -3
- package/dist/src/tunnel/frpc-config.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/tunnel-state.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +2 -2
- package/dist/src/workflows/store/event-store.js +1 -1
- package/dist/src/workflows/store/run-store.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/index-DjNDHzwG.css +0 -1
- package/dist/gateway/static/root/assets/index-WAyKAilR.js +0 -4840
- package/dist/gateway/static/root/assets/share-preview-page-UNAcbiMb.js +0 -2
- package/dist/gateway/static/root/assets/url-q28QhI7l.js +0 -3
- package/dist/src/auth/oauth/vendor-pi-google/google-antigravity.js.map +0 -1
- package/dist/src/auth/oauth/vendor-pi-google/google-gemini-cli.js.map +0 -1
- package/dist/src/auth/oauth/vendor-pi-google/oauth-page.js.map +0 -1
- package/dist/src/auth/oauth/vendor-pi-google/pkce.js.map +0 -1
- /package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/google-antigravity.d.ts +0 -0
- /package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/google-gemini-cli.d.ts +0 -0
- /package/dist/src/auth/oauth/{vendor-pi-google → google-oauth}/oauth-page.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{i as s,o as c}from"./url-q28QhI7l.js";import{i as l,s as u}from"./vendor-swr-BIWyz7Rc.js";import{i as d}from"./theme-store-B6KXPHgK.js";import{r as f}from"./toast-z0toXu32.js";import{C as p,S as m}from"./vendor-codemirror-DYoKfS8f.js";import{Aa as h,Cr as g,Ct as _,Di as v,Dr as y,Ei as b,Er as x,Fn as S,Ho as C,Hr as w,Ja as T,Ka as ee,Na as te,Oa as ne,Or as re,Qa as ie,Qo as E,Ri as D,Sa as ae,Si as oe,Ta as se,Ua as ce,Uo as le,Xa as ue,Za as de,Zo as fe,_o as pe,_t as me,ao as he,at as ge,di as O,go as k,gt as A,ht as _e,ia as ve,it as ye,ja as be,ji as xe,ka as Se,kr as Ce,la as we,lt as Te,ma as Ee,mt as De,na as Oe,nt as ke,ot as Ae,pa as je,pi as Me,pt as Ne,ra as Pe,so as Fe,st as Ie,vt as Le,wr as Re,xa as ze,xt as Be,zo as Ve,zr as He}from"./index-WAyKAilR.js";import{i as Ue,r as We}from"./note-time-FSOjchic.js";var j=e(r(),1),Ge=e(i(),1),Ke=u(),qe=a(),M=o();function N(e){this.content=e}N.prototype={constructor:N,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new N(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new N(n)},addToStart:function(e,t){return new N([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new N(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new N(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=N.from(e),e.size?new N(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=N.from(e),e.size?new N(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=N.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},N.from=function(e){if(e instanceof N)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new N(t)};function Je(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Je(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ye(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Ye(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var P=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Je(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ye(this,e,t,n)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ze(t+1,i):Ze(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};P.empty=new P([],0);var Xe={index:0,offset:0};function Ze(e,t){return Xe.index=e,Xe.offset=t,Xe}function Qe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Qe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Qe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var F=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};F.none=[];var $e=class extends Error{},I=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=tt(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(et(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(P.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};I.empty=new I(P.empty,0,0);function et(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(et(a.content,t-i-1,n-i-1)))}function tt(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=tt(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function nt(e,t,n){if(n.openStart>e.depth)throw new $e(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $e(`Inconsistent open depths`);return rt(e,t,n,0)}function rt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=rt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ct(a,ut(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ct(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=dt(n,e);return ct(a,lt(e,i,o,t,r))}}function it(e,t){if(!t.type.compatibleContent(e.type))throw new $e(`Cannot join `+t.type.name+` onto `+e.type.name)}function at(e,t,n){let r=e.node(n);return it(r,t.node(n)),r}function ot(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function st(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ot(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ot(i.child(e),r);t&&t.depth==n&&t.textOffset&&ot(t.nodeBefore,r)}function ct(e,t){return e.type.checkContent(t),e.copy(t)}function lt(e,t,n,r,i){let a=e.depth>i&&at(e,t,i+1),o=r.depth>i&&at(n,r,i+1),s=[];return st(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(it(a,o),ot(ct(a,lt(e,t,n,r,i+1)),s)):(a&&ot(ct(a,ut(e,t,i+1)),s),st(t,n,i,s),o&&ot(ct(o,ut(n,r,i+1)),s)),st(r,null,i,s),new P(s)}function ut(e,t,n){let r=[];return st(null,e,n,r),e.depth>n&&ot(ct(at(e,t,n+1),ut(e,t,n+1)),r),st(t,null,n,r),new P(r)}function dt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(P.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ft=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new gt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ht.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ht.set(t,r=new pt);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%mt,i}},pt=class{constructor(){this.elts=[],this.i=0}},mt=12,ht=new WeakMap,gt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},_t=Object.create(null),vt=class e{constructor(e,t,n,r=F.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||P.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Qe(this.attrs,t||e.defaultAttrs||_t)&&F.sameSet(this.marks,n||F.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return I.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new I(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return nt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ft.resolveCached(this,e)}resolveNoCache(e){return ft.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),bt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=P.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!F.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=P.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};vt.prototype.text=void 0;var yt=class e extends vt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function bt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var xt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new St(t,n);if(r.next==null)return e.empty;let i=Ct(r);r.next&&r.err(`Unexpected trailing text`);let a=Nt(At(i));return Pt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return P.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{i as s,o as c}from"./url-F3_D_6zZ.js";import{i as l,s as u}from"./vendor-swr-BIWyz7Rc.js";import{i as d}from"./theme-store-HTvJlFLL.js";import{r as f}from"./toast-z0toXu32.js";import{C as p,S as m}from"./vendor-codemirror-DYoKfS8f.js";import{Aa as h,Cr as g,Ct as _,Di as v,Dr as y,Ei as b,Er as x,Fn as S,Ho as C,Hr as w,Ja as T,Ka as ee,Na as te,Oa as ne,Or as re,Qa as ie,Qo as E,Ri as D,Sa as ae,Si as oe,Ta as se,Ua as ce,Uo as le,Xa as ue,Za as de,Zo as fe,_o as pe,_t as me,ao as he,at as ge,di as O,go as k,gt as A,ht as _e,ia as ve,it as ye,ja as be,ji as xe,ka as Se,kr as Ce,la as we,lt as Te,ma as Ee,mt as De,na as Oe,nt as ke,ot as Ae,pa as je,pi as Me,pt as Ne,ra as Pe,so as Fe,st as Ie,vt as Le,wr as Re,xa as ze,xt as Be,zo as Ve,zr as He}from"./index-0HmunJW9.js";import{i as Ue,r as We}from"./note-time-CF3vf1jm.js";var j=e(r(),1),Ge=e(i(),1),Ke=u(),qe=a(),M=o();function N(e){this.content=e}N.prototype={constructor:N,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new N(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new N(n)},addToStart:function(e,t){return new N([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new N(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new N(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=N.from(e),e.size?new N(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=N.from(e),e.size?new N(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=N.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},N.from=function(e){if(e instanceof N)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new N(t)};function Je(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Je(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ye(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Ye(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var P=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Je(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ye(this,e,t,n)}findIndex(e){if(e==0)return Ze(0,e);if(e==this.size)return Ze(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ze(t+1,i):Ze(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};P.empty=new P([],0);var Xe={index:0,offset:0};function Ze(e,t){return Xe.index=e,Xe.offset=t,Xe}function Qe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Qe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Qe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var F=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};F.none=[];var $e=class extends Error{},I=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=tt(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(et(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(P.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};I.empty=new I(P.empty,0,0);function et(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(et(a.content,t-i-1,n-i-1)))}function tt(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=tt(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function nt(e,t,n){if(n.openStart>e.depth)throw new $e(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $e(`Inconsistent open depths`);return rt(e,t,n,0)}function rt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=rt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ct(a,ut(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ct(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=dt(n,e);return ct(a,lt(e,i,o,t,r))}}function it(e,t){if(!t.type.compatibleContent(e.type))throw new $e(`Cannot join `+t.type.name+` onto `+e.type.name)}function at(e,t,n){let r=e.node(n);return it(r,t.node(n)),r}function ot(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function st(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ot(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ot(i.child(e),r);t&&t.depth==n&&t.textOffset&&ot(t.nodeBefore,r)}function ct(e,t){return e.type.checkContent(t),e.copy(t)}function lt(e,t,n,r,i){let a=e.depth>i&&at(e,t,i+1),o=r.depth>i&&at(n,r,i+1),s=[];return st(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(it(a,o),ot(ct(a,lt(e,t,n,r,i+1)),s)):(a&&ot(ct(a,ut(e,t,i+1)),s),st(t,n,i,s),o&&ot(ct(o,ut(n,r,i+1)),s)),st(r,null,i,s),new P(s)}function ut(e,t,n){let r=[];return st(null,e,n,r),e.depth>n&&ot(ct(at(e,t,n+1),ut(e,t,n+1)),r),st(t,null,n,r),new P(r)}function dt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(P.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ft=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return F.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new gt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ht.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ht.set(t,r=new pt);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%mt,i}},pt=class{constructor(){this.elts=[],this.i=0}},mt=12,ht=new WeakMap,gt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},_t=Object.create(null),vt=class e{constructor(e,t,n,r=F.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||P.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Qe(this.attrs,t||e.defaultAttrs||_t)&&F.sameSet(this.marks,n||F.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return I.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new I(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return nt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ft.resolveCached(this,e)}resolveNoCache(e){return ft.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),bt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=P.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=F.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!F.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=P.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};vt.prototype.text=void 0;var yt=class e extends vt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function bt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var xt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new St(t,n);if(r.next==null)return e.empty;let i=Ct(r);r.next&&r.err(`Unexpected trailing text`);let a=Nt(At(i));return Pt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return P.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
2
|
`)}};xt.empty=new xt(!0);var St=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ct(e){let t=[];do t.push(wt(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function wt(e){let t=[];do t.push(Tt(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Tt(e){let t=kt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Dt(e,t);else break;return t}function Et(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Dt(e,t){let n=Et(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Et(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ot(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function kt(e){if(e.eat(`(`)){let t=Ct(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ot(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function At(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function jt(e,t){return t-e}function Mt(e,t){let n=[];return r(t),n.sort(jt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Nt(e){let t=Object.create(null);return n(Mt(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Mt(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new xt(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(jt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Pt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ft(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function It(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Lt(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Rt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Vt(e,r,t[r]);return n}var zt=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Rt(e,n.attrs),this.defaultAttrs=Ft(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:It(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new vt(this,this.computeAttrs(e),P.from(t),F.setFrom(n))}createChecked(e=null,t,n){return t=P.from(t),this.checkContent(t),new vt(this,this.computeAttrs(e),t,F.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=P.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(P.empty,!0);return i?new vt(this,e,t.append(i),F.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Lt(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:F.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Bt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Vt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Bt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ht=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Rt(e,r.attrs),this.excluded=null;let i=Ft(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,It(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Lt(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ut=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=N.from(e.nodes),t.marks=N.from(e.marks||{}),this.nodes=zt.compile(this.spec.nodes,this),this.marks=Ht.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=xt.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Wt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Wt(this,n.split(` `))}this.nodeFromJSON=e=>vt.fromJSON(this,e),this.markFromJSON=e=>F.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof zt))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new yt(n,n.defaultAttrs,e,F.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Wt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Gt(e){return e.tag!=null}function Kt(e){return e.style!=null}var qt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Gt(e))this.tags.push(e);else if(Kt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new nn(this,t,!1);return n.addAll(e,F.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new nn(this,t,!0);return n.addAll(e,F.none,t.from,t.to),I.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(an(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=on(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=on(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Jt={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Yt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xt={ol:!0,ul:!0},Zt=1,Qt=2,$t=4;function en(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Zt:0)|(t===`full`?Qt:0)}var tn=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=F.none,this.match=i||(a&$t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(P.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Zt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=P.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(P.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},nn=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=en(null,t.preserveWhitespace,0)|(n?$t:0);i=r?new tn(r.type,r.attrs,F.none,!0,t.topMatch||r.type.contentMatch,a):n?new tn(null,null,F.none,!0,null,a):new tn(e.schema.topNodeType,null,F.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Qt?`full`:this.localPreserveWS||(r.options&Zt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Xt.hasOwnProperty(a)&&this.parser.normalizeLists&&rn(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Yt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Jt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=F.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):sn(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=en(e,i,a.options);a.options&$t&&a.content.length==0&&(o|=$t);let s=F.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):sn(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new tn(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Zt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function rn(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Xt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function an(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function on(e){let t={};for(let n in e)t[n]=e[n];return t}function sn(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var cn=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=un(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return un(t).createTextNode(e.text);let{dom:n,contentDOM:r}=mn(un(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&mn(un(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:mn(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=ln(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return ln(e.marks)}};function ln(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function un(e){return e.document||window.document}var dn=new WeakMap;function fn(e){let t=dn.get(e);return t===void 0&&dn.set(e,t=pn(e)),t}function pn(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function mn(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=fn(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=mn(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var hn=65535,gn=2**16;function _n(e,t){return e+t*gn}function vn(e){return e&hn}function yn(e){return(e-(e&hn))/gn}var bn=1,xn=2,Sn=4,Cn=8,wn=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Cn)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Sn)>0}},Tn=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=vn(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+yn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:_n(o/3,e-s),f=e==s?xn:e==u?bn:Sn;return(t<0?e!=s:e!=u)&&(f|=Cn),new wn(a,f,d)}r+=l-c}return n?e+r:new wn(e+r,0,null)}touches(e,t){let n=0,r=vn(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Tn.empty=new Tn([]);var En=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new wn(e,r,null)}},Dn=Object.create(null),On=class{getMap(){return Tn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Dn[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Dn)throw RangeError(`Duplicate use of step JSON ID `+e);return Dn[e]=t,t.prototype.jsonID=e,t}},kn=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof $e)return e.fail(t.message);throw t}}};function An(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(An(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return P.fromArray(r)}var jn=class e extends On{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new I(An(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return kn.fromReplace(e,this.from,this.to,i)}invert(){return new Mn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};On.jsonID(`addMark`,jn);var Mn=class e extends On{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new I(An(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return kn.fromReplace(e,this.from,this.to,n)}invert(){return new jn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};On.jsonID(`removeMark`,Mn);var Nn=class e extends On{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return kn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return kn.fromReplace(e,this.pos,this.pos+1,new I(P.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Pn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};On.jsonID(`addNodeMark`,Nn);var Pn=class e extends On{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return kn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return kn.fromReplace(e,this.pos,this.pos+1,new I(P.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Nn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};On.jsonID(`removeNodeMark`,Pn);var Fn=class e extends On{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ln(e,this.from,this.to)?kn.fail(`Structure replace would overwrite content`):kn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Tn([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?I.empty:new I(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?I.empty:new I(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,I.fromJSON(t,n.slice),!!n.structure)}};Fn.MAP_BIAS=1,On.jsonID(`replace`,Fn);var In=class e extends On{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Ln(e,this.from,this.gapFrom)||Ln(e,this.gapTo,this.to)))return kn.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return kn.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?kn.fromReplace(e,this.from,this.to,n):kn.fail(`Content does not fit in gap`)}getMap(){return new Tn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,I.fromJSON(t,n.slice),n.insert,!!n.structure)}};On.jsonID(`replaceAround`,In);function Ln(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Rn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Mn(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new jn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function zn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Ht){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Mn(t.from,t.to,t.style)))}function Bn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Fn(s,l,I.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Mn(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new I(P.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Fn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(P.empty,!0);e.replace(s,s,new I(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Vn(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Hn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Vn(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Un(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=P.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=P.from(r.node(e).copy(u)),d++):c--;let f=P.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=P.from(i.node(e).copy(f)),p++):l++;e.step(new In(c,l,o,s,new I(u.append(f),d,p),u.size-d,!0))}function Wn(e,t,n=null,r=e){let i=Kn(e,t),a=i&&qn(r,t);return a?i.map(Gn).concat({type:t,attrs:n}).concat(a.map(Gn)):null}function Gn(e){return{type:e,attrs:null}}function Kn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function qn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Jn(e,t,n){let r=P.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=P.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new In(i,a,i,a,new I(r,0,0),n.length,!0))}function Yn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Qn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Zn(e,t,n,a),Bn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new In(c,l,c+1,l-1,new I(P.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Xn(e,t,n,a),!1}})}function Xn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Zn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
@@ -177,4 +177,4 @@ ${t.innerHTML}
|
|
|
177
177
|
`);return}},parse:{}}}}}),IT=q.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:sT.nodes.heading,parse:{}}}}}),LT=q.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:sT.nodes.horizontal_rule,parse:{}}}}}),RT=q.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:sT.nodes.image,parse:{}}}}}),zT=q.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:sT.nodes.list_item,parse:{}}}}}),BT=q.create({name:`orderedList`});function VT(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var HT=BT.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=VT(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),UT=q.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:sT.nodes.paragraph,parse:{}}}}});function WT(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var GT=q.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!qT(t)){kT.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function KT(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function qT(e){let t=WT(e),n=t[0],r=t.slice(1);return!(WT(n).some(e=>e.type.name!==`tableHeader`||KT(e)||e.childCount>1)||r.some(e=>WT(e).some(e=>e.type.name===`tableHeader`||KT(e)||e.childCount>1)))}var JT=[MT,NT,PT,FT,IT,LT,kT,RT,zT,HT,UT,GT,q.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),q.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:NT.storage.markdown.serialize,parse:{setup(e){e.use(dT.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),q.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(ET(t.text))},parse:{}}}}}),uf.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:sT.marks.strong,parse:{}}}}}),uf.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:sT.marks.code,parse:{}}}}}),CT,uf.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:sT.marks.em,parse:{}}}}}),uf.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:sT.marks.link,parse:{}}}}}),uf.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function YT(e){let t=e.storage?.markdown,n=JT.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var XT=class{constructor(e){mT(this,`editor`,null),this.editor=e}serialize(e){let t=new ST(this.nodes,this.marks,{hardBreakNodeName:FT.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(kT)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(CT)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=YT(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=YT(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},ZT=class{constructor(e,t){mT(this,`editor`,null),mT(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(Yw({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=YT(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=TT(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=YT(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&DT(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}OT(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
|
|
178
178
|
`?t:t[t.length-1]===`
|
|
179
179
|
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},QT=K.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new B({key:new V(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return qt.fromSchema(this.editor.schema).parseSlice(TT(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),$T=K.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=yf.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new ZT(this.editor,this.options),serializer:new XT(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[hT.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),QT.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),eE=[1,1.5,2];function tE(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 nE(e){let t=(0,qe.c)(63),{noteId:n,attachment:r,transcript:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=Ue(),f=Ue(iE),p=Ue(rE),m=u===n&&d===r.id,h=m&&o,g=m&&s,_=m?c:0,v=m&&l>0?l:r.duration??0,y=v>0?Math.min(_/v*100,100):0,[b,x]=(0,j.useState)(0),S=(0,j.useRef)(null),C;t[0]!==r.duration||t[1]!==r.id||t[2]!==n||t[3]!==f?(C=()=>{f(n,r.id,r.duration)},t[0]=r.duration,t[1]=r.id,t[2]=n,t[3]=f,t[4]=C):C=t[4];let w=C,T;t[5]===p?T=t[6]:(T=e=>{p(Number(e.target.value))},t[5]=p,t[6]=T);let ee=T,te;t[7]===b?te=t[8]:(te=()=>{x((b+1)%eE.length)},t[7]=b,t[8]=te);let re=te,ie;t[9]!==m||t[10]!==b?(ie=()=>{if(!m)return;let e=document.querySelector(`audio`);e&&(e.playbackRate=eE[b])},t[9]=m,t[10]=b,t[11]=ie):ie=t[11];let E;t[12]!==m||t[13]!==h||t[14]!==b?(E=[b,m,h],t[12]=m,t[13]=h,t[14]=b,t[15]=E):E=t[15],(0,j.useEffect)(ie,E);let D;t[16]===a?D=t[17]:(D=O(`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4`,a),t[16]=a,t[17]=D);let oe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,M.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-accent/10`,children:(0,M.jsx)(ae,{className:`h-5 w-5 text-accent`})}),t[18]=oe):oe=t[18];let se=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,ce;t[19]===se?ce=t[20]:(ce=O(`flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors`,se),t[19]=se,t[20]=ce);let le=h?`Pause`:`Play`,ue;t[21]!==g||t[22]!==h?(ue=g?(0,M.jsx)(ne,{className:`h-4 w-4 animate-spin`}):h?(0,M.jsx)(Ee,{className:`h-4 w-4`}):(0,M.jsx)(we,{className:`h-4 w-4 ml-0.5`}),t[21]=g,t[22]=h,t[23]=ue):ue=t[23];let de;t[24]!==w||t[25]!==le||t[26]!==ue||t[27]!==ce?(de=(0,M.jsx)(`button`,{type:`button`,onClick:w,className:ce,"aria-label":le,children:ue}),t[24]=w,t[25]=le,t[26]=ue,t[27]=ce,t[28]=de):de=t[28];let fe=v||1,pe=`linear-gradient(to right, var(--color-accent) ${y}%, var(--color-accent-alpha-10, rgba(59,130,246,0.1)) ${y}%)`,me;t[29]===pe?me=t[30]:(me={background:pe},t[29]=pe,t[30]=me);let he;t[31]!==ee||t[32]!==_||t[33]!==fe||t[34]!==me?(he=(0,M.jsx)(`input`,{ref:S,type:`range`,min:0,max:fe,step:.1,value:_,onChange:ee,className:`voice-progress-range h-1.5 w-full cursor-pointer appearance-none rounded-full bg-accent/10 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent`,style:me}),t[31]=ee,t[32]=_,t[33]=fe,t[34]=me,t[35]=he):he=t[35];let ge;t[36]===_?ge=t[37]:(ge=tE(_),t[36]=_,t[37]=ge);let k;t[38]===ge?k=t[39]:(k=(0,M.jsx)(`span`,{children:ge}),t[38]=ge,t[39]=k);let A;t[40]===v?A=t[41]:(A=tE(v),t[40]=v,t[41]=A);let _e;t[42]===A?_e=t[43]:(_e=(0,M.jsx)(`span`,{children:A}),t[42]=A,t[43]=_e);let ve;t[44]!==k||t[45]!==_e?(ve=(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] tabular-nums text-fg-muted`,children:[k,_e]}),t[44]=k,t[45]=_e,t[46]=ve):ve=t[46];let ye;t[47]!==he||t[48]!==ve?(ye=(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[he,ve]}),t[47]=he,t[48]=ve,t[49]=ye):ye=t[49];let be=eE[b],xe;t[50]!==re||t[51]!==be?(xe=(0,M.jsxs)(`button`,{type:`button`,onClick:re,className:`shrink-0 rounded-md px-1.5 py-0.5 text-[11px] font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,"aria-label":`Playback speed`,children:[be,`x`]}),t[50]=re,t[51]=be,t[52]=xe):xe=t[52];let Se;t[53]!==de||t[54]!==ye||t[55]!==xe?(Se=(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[oe,(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[de,ye,xe]})})]}),t[53]=de,t[54]=ye,t[55]=xe,t[56]=Se):Se=t[56];let Ce;t[57]===i?Ce=t[58]:(Ce=i&&(0,M.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2`,children:(0,M.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i})}),t[57]=i,t[58]=Ce);let Te;return t[59]!==Se||t[60]!==Ce||t[61]!==D?(Te=(0,M.jsxs)(`div`,{className:D,children:[Se,Ce]}),t[59]=Se,t[60]=Ce,t[61]=D,t[62]=Te):Te=t[62],Te}function rE(e){return e.seek}function iE(e){return e.toggle}function aE(e){let t=(0,qe.c)(11),{node:n}=e,{href:r,label:i}=n.attrs,a;t[0]===r?a=t[1]:(a=_(r),t[0]=r,t[1]=a);let o=a;if(!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(_m,{as:`span`,className:`inline text-fg-muted italic text-sm`,children:`[audio unavailable]`}),t[2]=e):e=t[2],e}let s;t[3]===i?s=t[4]:(s=i?.match(/(\d+):(\d+)/),t[3]=i,t[4]=s);let c=s,l=c?Number(c[1])*60+Number(c[2]):void 0,u;t[5]!==l||t[6]!==o.attachmentId?(u={id:o.attachmentId,type:`audio`,mimeType:`audio/webm`,fileName:``,size:0,relativePath:``,duration:l},t[5]=l,t[6]=o.attachmentId,t[7]=u):u=t[7];let d=u,f;return t[8]!==d||t[9]!==o.noteId?(f=(0,M.jsx)(_m,{className:`my-3`,children:(0,M.jsx)(nE,{noteId:o.noteId,attachment:d,className:`max-w-md`})}),t[8]=d,t[9]=o.noteId,t[10]=f):f=t[10],f}var oE=/^\[([^\]]*)\]\((xopc-attachment:\/\/notes\/[^)]+)\)$/,sE=q.create({name:`audioAttachment`,group:`block`,atom:!0,draggable:!1,selectable:!0,addAttributes(){return{href:{default:null},label:{default:null}}},parseHTML(){return[{tag:`a[data-audio-attachment]`,getAttrs:e=>typeof e==`string`?!1:{href:e.getAttribute(`href`),label:e.textContent}}]},renderHTML({HTMLAttributes:e}){return[`a`,G(e,{"data-audio-attachment":``}),e.label||`Audio`]},addNodeView(){return Tm(aE)},addProseMirrorPlugins(){let e=this.type;return[new B({key:new V(`audioAttachmentTransform`),appendTransaction(t,n,r){let{tr:i}=r,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name!==`paragraph`||t.childCount!==1)return;let r=t.firstChild;if(!r||r.type.name!==`text`)return;let o=r.text??``,s=o.match(oE);if(s){let r=s[1],o=s[2];if(o.includes(`xopc-attachment://notes/`)){let s=e.create({href:o,label:r});i.replaceWith(n,n+t.nodeSize,s),a=!0;return}}let c=r.marks.find(e=>e.type.name===`link`&&typeof e.attrs.href==`string`&&e.attrs.href.includes(`xopc-attachment://notes/`));if(c){let r=e.create({href:c.attrs.href,label:o});i.replaceWith(n,n+t.nodeSize,r),a=!0}}),a?i:null}})]}});function cE(e){let{selection:t,doc:n}=e,r=n.type.schema,i=t.from;if(t instanceof z)i=t.to;else{if(n.resolve(i).parent.isTextblock)return!0;i=Math.min(i+1,n.content.size)}let a=n.resolve(Math.min(i,n.content.size));if(a.parent.isTextblock)return e.setSelection(R.near(a,1)),!0;let o=r.nodes.paragraph;if(!o)return!1;let s=n.content.size;return e.insert(s,o.create()),e.setSelection(R.near(e.doc.resolve(s+1),1)),!0}function lE(e){e.commands.command(({tr:e,dispatch:t})=>(t&&cE(e),!0))}var uE=K.create({name:`extraKeyboardShortcuts`,addKeyboardShortcuts(){return{"Mod-Shift-1":()=>this.editor.chain().focus().toggleHeading({level:1}).run(),"Mod-Shift-2":()=>this.editor.chain().focus().toggleHeading({level:2}).run(),"Mod-Shift-3":()=>this.editor.chain().focus().toggleHeading({level:3}).run(),"Mod-Shift-8":()=>this.editor.chain().focus().toggleBulletList().run(),"Mod-Shift-9":()=>this.editor.chain().focus().toggleOrderedList().run(),"Mod-Shift-0":()=>this.editor.chain().focus().toggleTaskList().run()}}});function dE(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Hf(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function fE(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
180
|
-
`);return/\s/.test(n)}):!1}var pE=new V(`suggestion`);function mE({pluginKey:e=pE,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=dE,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!fE(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new B({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),Cc.create(e.doc,[bc.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var hE=mE,gE=[{id:`heading1`,label:`Heading 1`,description:`Large section heading`,keywords:[`h1`,`title`,`heading`]},{id:`heading2`,label:`Heading 2`,description:`Medium section heading`,keywords:[`h2`,`heading`]},{id:`heading3`,label:`Heading 3`,description:`Small section heading`,keywords:[`h3`,`heading`]},{id:`bulletList`,label:`Bullet List`,description:`Unordered list`,keywords:[`ul`,`list`,`bullet`]},{id:`orderedList`,label:`Numbered List`,description:`Ordered list`,keywords:[`ol`,`list`,`numbered`]},{id:`taskList`,label:`Task List`,description:`List with checkboxes`,keywords:[`todo`,`task`,`checkbox`]},{id:`blockquote`,label:`Quote`,description:`Block quotation`,keywords:[`quote`,`blockquote`]},{id:`codeBlock`,label:`Code Block`,description:`Fenced code snippet`,keywords:[`code`,`snippet`]},{id:`divider`,label:`Divider`,description:`Horizontal rule`,keywords:[`hr`,`rule`,`line`]},{id:`image`,label:`Image`,description:`Upload an image`,keywords:[`img`,`photo`,`picture`]}];function _E(e){let t=e.trim().toLowerCase();return t?gE.filter(e=>[e.label,e.description,...e.keywords].join(` `).toLowerCase().includes(t)):gE}function vE(e,t,n,r){if(e.id===`image`){t.chain().focus().deleteRange(n).run(),r.requestImagePicker&&setTimeout(()=>r.requestImagePicker?.(),0);return}let i=t.chain().focus().deleteRange(n);switch(e.id){case`heading1`:i.setHeading({level:1}).run();return;case`heading2`:i.setHeading({level:2}).run();return;case`heading3`:i.setHeading({level:3}).run();return;case`bulletList`:i.toggleBulletList().run();return;case`orderedList`:i.toggleOrderedList().run();return;case`taskList`:i.toggleTaskList().run();return;case`blockquote`:i.toggleBlockquote().run();return;case`codeBlock`:i.toggleCodeBlock().run();return;case`divider`:i.setHorizontalRule().run(),lE(t);return;default:return}}var yE=`slash-menu-panel fixed z-[9999] w-64 overflow-hidden rounded-lg border border-edge bg-surface-base shadow-lg`,bE=`flex w-full items-center gap-3 rounded-md px-2.5 py-2 text-left transition-colors text-fg-muted hover:bg-surface-hover hover:text-fg`,xE=`bg-surface-hover text-fg`;function SE({editor:e,getRuntime:t}){let n=null,r=null,i=null,a=null,o=0,s=``,c=null,l=()=>{n?.remove(),n=null,r=null,i=null,a=null,c=null,o=0,s=``},u=()=>{n||(n=document.createElement(`div`),n.setAttribute(`data-slash-menu-root`,`true`),r=document.createElement(`div`),r.className=yE,i=document.createElement(`div`),i.className=`slash-menu-scroll max-h-72 overflow-y-auto p-1`,a=document.createElement(`input`),a.type=`file`,a.accept=`image/*`,a.className=`hidden`,a.addEventListener(`change`,()=>{let e=a?.files?.[0],n=t();e&&n.onImageUpload&&n.onImageUpload(e),a&&(a.value=``)}),r.appendChild(i),n.append(r,a),document.body.appendChild(n))},d=()=>{if(!r||!c)return;let e=c.clientRect?.()??null;if(e){r.style.top=`${e.bottom+6}px`,r.style.left=`${e.left}px`;return}let t=c.editor.view.coordsAtPos(c.range.to);r.style.top=`${t.bottom+6}px`,r.style.left=`${t.left}px`},f=()=>{if(!c||!i||!r)return;i.replaceChildren();let e=i;c.items.forEach((n,r)=>{let i=document.createElement(`button`);i.type=`button`,i.className=`${bE}${r===o?` ${xE}`:``}`;let s=document.createElement(`span`);s.className=`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-edge bg-surface-raised text-xs font-semibold uppercase text-fg-muted`,s.textContent=n.label.slice(0,2);let l=document.createElement(`span`);l.className=`min-w-0 flex-1`;let u=document.createElement(`span`);u.className=`block truncate text-sm font-medium text-fg`,u.textContent=n.label;let d=document.createElement(`span`);d.className=`block truncate text-xs text-fg-muted`,d.textContent=n.description,l.append(u,d),i.append(s,l),i.addEventListener(`mousedown`,e=>{if(e.preventDefault(),c){if(n.id===`image`){vE(n,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())});return}c.command(n)}}),e.appendChild(i)}),d()},p=e=>{e.query!==s&&(o=0,s=e.query),c=e,u(),f()};return e.on(`destroy`,l),{onStart:e=>{p(e)},onUpdate:e=>{p(e)},onExit:()=>{l()},onKeyDown:({event:e})=>{let n=c?.items??[];if(!n.length)return!1;if(e.key===`ArrowDown`)return o=(o+1)%n.length,f(),!0;if(e.key===`ArrowUp`)return o=(o-1+n.length)%n.length,f(),!0;if(e.key===`Enter`){let e=n[o];return e&&c&&(e.id===`image`?vE(e,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())}):c.command(e)),!0}return!1},destroy:l}}var CE=new V(`slashCommands`),wE=K.create({name:`slashCommands`,addOptions(){return{getRuntime:()=>({})}},addStorage(){return{active:!1}},onDestroy(){this.storage.active=!1},addProseMirrorPlugins(){let e=this,t=SE({editor:this.editor,getRuntime:()=>e.options.getRuntime()});return[hE({pluginKey:CE,editor:this.editor,char:`/`,allowedPrefixes:null,items:({query:e})=>_E(e),command:({editor:t,range:n,props:r})=>{vE(r,t,n,e.options.getRuntime())},render:()=>({onStart:n=>{e.storage.active=!0,t.onStart(n)},onUpdate:e=>{t.onUpdate(e)},onExit:()=>{e.storage.active=!1,t.onExit()},onKeyDown:t.onKeyDown})})]}}),TE=Ib.configure({node:`paragraph`,notAfter:[`paragraph`]});function EE(e){let t=(0,qe.c)(9),{onClick:n,isActive:r,disabled:i,title:a,children:o}=e,s=r&&`bg-surface-hover text-accent`,c=i&&`pointer-events-none opacity-40`,l;t[0]!==s||t[1]!==c?(l=O(`rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,s,c),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==l||t[7]!==a?(u=(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:i,title:a,className:l,children:o}),t[3]=o,t[4]=i,t[5]=n,t[6]=l,t[7]=a,t[8]=u):u=t[8],u}function DE(){let e=(0,qe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(`div`,{className:`mx-1 h-5 w-px bg-edge`}),e[0]=t):t=e[0],t}function OE(e){let t=(0,qe.c)(132),{editor:n,onImageUpload:r,imageUploading:i}=e,a=i===void 0?!1:i,o=(0,j.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o.current?.click()},t[0]=s):s=t[0];let c=s,l;t[1]!==a||t[2]!==r?(l=e=>{let t=e.target.files?.[0];t&&r&&!a&&r(t),o.current&&(o.current.value=``)},t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]===n?d=t[5]:(d=()=>{let e=n.getAttributes(`link`).href??``,t=window.prompt(`URL`,e);if(t!==null){if(t===``){n.chain().focus().extendMarkRange(`link`).unsetLink().run();return}n.chain().focus().extendMarkRange(`link`).setLink({href:t}).run()}},t[4]=n,t[5]=d);let f=d,p,m;t[6]===n?(p=t[7],m=t[8]):(p=()=>n.chain().focus().undo().run(),m=n.can().undo(),t[6]=n,t[7]=p,t[8]=m);let g=!m,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,M.jsx)(oe,{size:16}),t[9]=_):_=t[9];let v;t[10]!==p||t[11]!==g?(v=(0,M.jsx)(EE,{onClick:p,disabled:g,title:`Undo`,children:_}),t[10]=p,t[11]=g,t[12]=v):v=t[12];let y,b;t[13]===n?(y=t[14],b=t[15]):(y=()=>n.chain().focus().redo().run(),b=n.can().redo(),t[13]=n,t[14]=y,t[15]=b);let x=!b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(Pe,{size:16}),t[16]=S):S=t[16];let C;t[17]!==y||t[18]!==x?(C=(0,M.jsx)(EE,{onClick:y,disabled:x,title:`Redo`,children:S}),t[17]=y,t[18]=x,t[19]=C):C=t[19];let w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,M.jsx)(DE,{}),t[20]=w):w=t[20];let T,ne;t[21]===n?(T=t[22],ne=t[23]):(T=()=>n.chain().focus().toggleHeading({level:1}).run(),ne=n.isActive(`heading`,{level:1}),t[21]=n,t[22]=T,t[23]=ne);let re;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,M.jsx)(ie,{size:16}),t[24]=re):re=t[24];let E;t[25]!==T||t[26]!==ne?(E=(0,M.jsx)(EE,{onClick:T,isActive:ne,title:`Heading 1`,children:re}),t[25]=T,t[26]=ne,t[27]=E):E=t[27];let D,ae;t[28]===n?(D=t[29],ae=t[30]):(D=()=>n.chain().focus().toggleHeading({level:2}).run(),ae=n.isActive(`heading`,{level:2}),t[28]=n,t[29]=D,t[30]=ae);let se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,M.jsx)(de,{size:16}),t[31]=se):se=t[31];let le;t[32]!==D||t[33]!==ae?(le=(0,M.jsx)(EE,{onClick:D,isActive:ae,title:`Heading 2`,children:se}),t[32]=D,t[33]=ae,t[34]=le):le=t[34];let fe,pe;t[35]===n?(fe=t[36],pe=t[37]):(fe=()=>n.chain().focus().toggleHeading({level:3}).run(),pe=n.isActive(`heading`,{level:3}),t[35]=n,t[36]=fe,t[37]=pe);let me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,M.jsx)(ue,{size:16}),t[38]=me):me=t[38];let he;t[39]!==fe||t[40]!==pe?(he=(0,M.jsx)(EE,{onClick:fe,isActive:pe,title:`Heading 3`,children:me}),t[39]=fe,t[40]=pe,t[41]=he):he=t[41];let ge;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,M.jsx)(DE,{}),t[42]=ge):ge=t[42];let O,A;t[43]===n?(O=t[44],A=t[45]):(O=()=>n.chain().focus().toggleBold().run(),A=n.isActive(`bold`),t[43]=n,t[44]=O,t[45]=A);let _e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,M.jsx)(Ve,{size:16}),t[46]=_e):_e=t[46];let ye;t[47]!==O||t[48]!==A?(ye=(0,M.jsx)(EE,{onClick:O,isActive:A,title:`Bold (⌘B)`,children:_e}),t[47]=O,t[48]=A,t[49]=ye):ye=t[49];let Ce,we;t[50]===n?(Ce=t[51],we=t[52]):(Ce=()=>n.chain().focus().toggleItalic().run(),we=n.isActive(`italic`),t[50]=n,t[51]=Ce,t[52]=we);let Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,M.jsx)(ce,{size:16}),t[53]=Te):Te=t[53];let Ee;t[54]!==Ce||t[55]!==we?(Ee=(0,M.jsx)(EE,{onClick:Ce,isActive:we,title:`Italic (⌘I)`,children:Te}),t[54]=Ce,t[55]=we,t[56]=Ee):Ee=t[56];let De,Oe;t[57]===n?(De=t[58],Oe=t[59]):(De=()=>n.chain().focus().toggleStrike().run(),Oe=n.isActive(`strike`),t[57]=n,t[58]=De,t[59]=Oe);let ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,M.jsx)(xe,{size:16}),t[60]=ke):ke=t[60];let Ae;t[61]!==De||t[62]!==Oe?(Ae=(0,M.jsx)(EE,{onClick:De,isActive:Oe,title:`Strikethrough`,children:ke}),t[61]=De,t[62]=Oe,t[63]=Ae):Ae=t[63];let je,Me;t[64]===n?(je=t[65],Me=t[66]):(je=()=>n.chain().focus().toggleCode().run(),Me=n.isActive(`code`),t[64]=n,t[65]=je,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,M.jsx)(k,{size:16}),t[67]=Ne):Ne=t[67];let Fe;t[68]!==je||t[69]!==Me?(Fe=(0,M.jsx)(EE,{onClick:je,isActive:Me,title:`Inline code`,children:Ne}),t[68]=je,t[69]=Me,t[70]=Fe):Fe=t[70];let Ie;t[71]===n?Ie=t[72]:(Ie=n.isActive(`link`),t[71]=n,t[72]=Ie);let Le;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,M.jsx)(te,{size:16}),t[73]=Le):Le=t[73];let Re;t[74]!==f||t[75]!==Ie?(Re=(0,M.jsx)(EE,{onClick:f,isActive:Ie,title:`Link`,children:Le}),t[74]=f,t[75]=Ie,t[76]=Re):Re=t[76];let Be;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,M.jsx)(DE,{}),t[77]=Be):Be=t[77];let He,Ue;t[78]===n?(He=t[79],Ue=t[80]):(He=()=>n.chain().focus().toggleBulletList().run(),Ue=n.isActive(`bulletList`),t[78]=n,t[79]=He,t[80]=Ue);let We;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,M.jsx)(Se,{size:16}),t[81]=We):We=t[81];let Ge;t[82]!==He||t[83]!==Ue?(Ge=(0,M.jsx)(EE,{onClick:He,isActive:Ue,title:`Bullet list`,children:We}),t[82]=He,t[83]=Ue,t[84]=Ge):Ge=t[84];let Ke,N;t[85]===n?(Ke=t[86],N=t[87]):(Ke=()=>n.chain().focus().toggleOrderedList().run(),N=n.isActive(`orderedList`),t[85]=n,t[86]=Ke,t[87]=N);let Je;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,M.jsx)(be,{size:16}),t[88]=Je):Je=t[88];let Ye;t[89]!==Ke||t[90]!==N?(Ye=(0,M.jsx)(EE,{onClick:Ke,isActive:N,title:`Ordered list`,children:Je}),t[89]=Ke,t[90]=N,t[91]=Ye):Ye=t[91];let P,Xe;t[92]===n?(P=t[93],Xe=t[94]):(P=()=>n.chain().focus().toggleTaskList().run(),Xe=n.isActive(`taskList`),t[92]=n,t[93]=P,t[94]=Xe);let Ze;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,M.jsx)(h,{size:16}),t[95]=Ze):Ze=t[95];let Qe;t[96]!==P||t[97]!==Xe?(Qe=(0,M.jsx)(EE,{onClick:P,isActive:Xe,title:`Task list`,children:Ze}),t[96]=P,t[97]=Xe,t[98]=Qe):Qe=t[98];let F,$e;t[99]===n?(F=t[100],$e=t[101]):(F=()=>n.chain().focus().toggleBlockquote().run(),$e=n.isActive(`blockquote`),t[99]=n,t[100]=F,t[101]=$e);let I;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,M.jsx)(ve,{size:16}),t[102]=I):I=t[102];let et;t[103]!==F||t[104]!==$e?(et=(0,M.jsx)(EE,{onClick:F,isActive:$e,title:`Quote`,children:I}),t[103]=F,t[104]=$e,t[105]=et):et=t[105];let tt;t[106]===n?tt=t[107]:(tt=()=>{n.chain().focus().setHorizontalRule().run(),lE(n)},t[106]=n,t[107]=tt);let nt;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,M.jsx)(ze,{size:16}),t[108]=nt):nt=t[108];let rt;t[109]===tt?rt=t[110]:(rt=(0,M.jsx)(EE,{onClick:tt,title:`Divider`,children:nt}),t[109]=tt,t[110]=rt);let it;t[111]!==u||t[112]!==a||t[113]!==r?(it=r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(DE,{}),(0,M.jsx)(EE,{onClick:c,disabled:a,title:a?`Uploading…`:`Insert image`,children:(0,M.jsx)(ee,{size:16,className:a?`animate-pulse`:void 0})}),(0,M.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,onChange:u,className:`hidden`})]}),t[111]=u,t[112]=a,t[113]=r,t[114]=it):it=t[114];let at;return t[115]!==C||t[116]!==E||t[117]!==le||t[118]!==he||t[119]!==ye||t[120]!==Ee||t[121]!==Ae||t[122]!==Fe||t[123]!==Re||t[124]!==Ge||t[125]!==Ye||t[126]!==Qe||t[127]!==et||t[128]!==rt||t[129]!==it||t[130]!==v?(at=(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-edge px-3 py-1.5`,children:[v,C,w,E,le,he,ge,ye,Ee,Ae,Fe,Re,Be,Ge,Ye,Qe,et,rt,it]}),t[115]=C,t[116]=E,t[117]=le,t[118]=he,t[119]=ye,t[120]=Ee,t[121]=Ae,t[122]=Fe,t[123]=Re,t[124]=Ge,t[125]=Ye,t[126]=Qe,t[127]=et,t[128]=rt,t[129]=it,t[130]=v,t[131]=at):at=t[131],at}var kE=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,AE=q.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,G(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=G(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new Bf({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[If({find:kE,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),jE=(0,j.createContext)(null);function ME(){let e=(0,qe.c)(1),t=(0,j.useContext)(jE);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:NE},e[0]=t):t=e[0],t}return t}function NE(){}function PE(e){let t=(0,qe.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,j.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,M.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=O(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=m):m=t[4];let h=a?.alt||`Image preview`,_;t[5]===h?_=t[6]:(_=(0,M.jsx)(Ce,{className:`sr-only`,children:h}),t[5]=h,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,M.jsx)(Me,{className:`h-5 w-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let b;t[8]===i?b=t[9]:(b=(0,M.jsx)(g,{asChild:!0,children:(0,M.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:v})}),t[8]=i,t[9]=b);let S;t[10]===a?S=t[11]:(S=a?(0,M.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=S);let C;t[12]!==b||t[13]!==S||t[14]!==_?(C=(0,M.jsxs)(y,{children:[p,(0,M.jsxs)(Re,{className:m,"aria-describedby":void 0,children:[_,b,S]})]}),t[12]=b,t[13]=S,t[14]=_,t[15]=C):C=t[15];let w;t[16]!==C||t[17]!==d?(w=(0,M.jsx)(re,{open:d,onOpenChange:f,children:C}),t[16]=C,t[17]=d,t[18]=w):w=t[18];let T;return t[19]!==n||t[20]!==w?(T=(0,M.jsxs)(jE.Provider,{value:u,children:[n,w]}),t[19]=n,t[20]=w,t[21]=T):T=t[21],T}function FE(e){let t=(0,qe.c)(28),{node:n,updateAttributes:r,selected:i}=e,{src:a,alt:o,title:s}=n.attrs,{openImage:c}=ME(),[l,u]=(0,j.useState)(!1),d=(0,j.useRef)(null),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(0),h=(0,j.useRef)(0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),e.stopPropagation(),p(!0),m.current=e.clientX,h.current=d.current?.offsetWidth??400},t[0]=g):g=t[0];let _=g,v,y;t[1]!==f||t[2]!==r?(v=()=>{if(!f)return;let e=e=>{let t=e.clientX-m.current;r({width:Math.max(100,h.current+t)})},t=()=>{p(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},y=[f,r],t[1]=f,t[2]=r,t[3]=v,t[4]=y):(v=t[3],y=t[4]),(0,j.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{u(!1)},t[5]=b):b=t[5];let x;t[6]===a?x=t[7]:(x=[a],t[6]=a,t[7]=x),(0,j.useEffect)(b,x);let S=n.attrs.width,C=i&&`ring-2 ring-accent ring-offset-2 ring-offset-surface-base rounded-lg`,w;t[8]===C?w=t[9]:(w=O(`relative inline-block`,C),t[8]=C,t[9]=w);let T=S?`${S}px`:void 0,ee;t[10]===T?ee=t[11]:(ee={width:T,maxWidth:`100%`},t[10]=T,t[11]=ee);let te;t[12]!==o||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==s?(te=l?(0,M.jsx)(`div`,{className:`flex min-h-24 min-w-[12rem] items-center justify-center rounded-lg border border-dashed border-edge bg-surface-hover text-fg-muted`,children:(0,M.jsx)(`span`,{className:`text-xs`,children:`Image unavailable`})}):(0,M.jsx)(Le,{src:a,alt:o??``,title:s??void 0,className:`block h-auto w-full cursor-zoom-in rounded-lg`,draggable:!1,onClick:e=>c(e,o??void 0),onLoadFailed:()=>u(!0)}),t[12]=o,t[13]=l,t[14]=c,t[15]=a,t[16]=s,t[17]=te):te=t[17];let ne=(i||f)&&`opacity-100`,re;t[18]===ne?re=t[19]:(re=O(`absolute bottom-1 right-1 h-4 w-4 cursor-se-resize rounded-sm opacity-0 transition-opacity`,`bg-accent/70 hover:bg-accent`,ne),t[18]=ne,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,M.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,className:`m-0.5 text-white`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,M.jsx)(`path`,{d:`M10 2L2 10M10 6L6 10M10 10L10 10`,strokeLinecap:`round`})}),t[20]=ie):ie=t[20];let E;t[21]===re?E=t[22]:(E=(0,M.jsx)(`div`,{onMouseDown:_,className:re,title:`Drag to resize`,children:ie}),t[21]=re,t[22]=E);let D;return t[23]!==te||t[24]!==E||t[25]!==w||t[26]!==ee?(D=(0,M.jsx)(_m,{className:`block-editor-image-wrapper`,children:(0,M.jsxs)(`div`,{ref:d,className:w,style:ee,children:[te,E]})}),t[23]=te,t[24]=E,t[25]=w,t[26]=ee,t[27]=D):D=t[27],D}var IE=AE.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute(`width`)||e.style.width;return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width: ${e.width}px`}:{}}}},addNodeView(){return Tm(FE)}});function LE(e,t){let{doc:n}=e.state,r=n.resolve(t);return r.index(0)===0?`first`:r.index(0)===n.childCount-1?`last`:null}function RE({initialContent:e,onChange:t,placeholder:n=`Start writing, or type "/" for commands…`,className:r,noteId:i}){let a=c(s(e=>e.language)).notes,[o,l]=(0,j.useState)(!1),u=(0,j.useRef)(t);u.current=t;let d=(0,j.useRef)(null),p=(0,j.useRef)({}),m=pm({extensions:[Rb.configure({heading:{levels:[1,2,3]},codeBlock:{HTMLAttributes:{class:`block-editor-code`}}}),TE,IE.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:`block-editor-image`}}),zb,Bb.configure({nested:!0}),Vb.configure({placeholder:({editor:e,node:t,pos:r})=>{if(t.type.name!==`paragraph`||t.content.size>0)return``;let i=LE(e,r);return i===`first`||i===`last`?n:``},includeChildren:!0}),Vv.configure({openOnClick:!1,autolink:!0,HTMLAttributes:{class:`block-editor-link`}}),$T.configure({html:!0,transformPastedText:!0,transformCopiedText:!0}),sE,uE,wE.configure({getRuntime:()=>p.current})],content:e,onUpdate:({editor:e})=>{let t=e.storage.markdown.getMarkdown();u.current(t)},editorProps:{attributes:{class:`block-editor-content`}}}),h=(0,j.useCallback)(async e=>{if(!(!i||!m))try{l(!0);let t=await A(i,e);m.chain().focus().setImage({src:Be(i,t.id),alt:e.name}).run(),lE(m)}catch(e){f({type:`error`,title:a.imageUploadFailed,message:e instanceof Error?e.message:a.imageUploadFailedHint})}finally{l(!1)}},[m,i,a.imageUploadFailed,a.imageUploadFailedHint]),g=(0,j.useCallback)(()=>{d.current?.click()},[]);return p.current={onImageUpload:i?h:void 0,requestImagePicker:i?g:void 0},(0,j.useEffect)(()=>{if(!m||!i)return;let e=e=>{let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type.startsWith(`image/`)){e.preventDefault();let t=n.getAsFile();t&&h(t);return}}},t=e=>{let t=e.dataTransfer?.files;if(t?.length){for(let n of t)if(n.type.startsWith(`image/`)){e.preventDefault(),h(n);return}}},n=m.view.dom;return n.addEventListener(`paste`,e),n.addEventListener(`drop`,t),()=>{n.removeEventListener(`paste`,e),n.removeEventListener(`drop`,t)}},[m,i,h]),m?(0,M.jsxs)(`div`,{className:O(`flex h-full flex-col overflow-hidden`,r),children:[(0,M.jsx)(OE,{editor:m,onImageUpload:i?h:void 0,imageUploading:o}),(0,M.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:(0,M.jsx)(am,{editor:m})}),(0,M.jsx)(`input`,{ref:d,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&i&&h(t),d.current&&(d.current.value=``)},className:`hidden`})]}):null}var zE={edit:je,ai_edit:D,sync:Oe,restore:le};function BE(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function VE({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=c(s(e=>e.language)).notes,o=a,{data:u}=l(e?[`note-history`,e]:null,()=>Ae(e)),[d,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),g=(0,j.useCallback)(async t=>{p(!0);try{await De(e,t),f({type:`success`,title:a.restoreSuccess}),h(null),i()}catch{f({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=Date.now();return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,M.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0}),a.history]}),(0,M.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,M.jsx)(Me,{className:`h-4 w-4`,"aria-hidden":!0})})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,M.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=zE[e.trigger]??je,i=t===e.timestamp,s=m===e.timestamp;return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:O(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:BE(e.trigger,a)}),(0,M.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:We(e.timestamp,_,o)})]}),e.snippet&&(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,M.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,M.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e.timestamp)},disabled:d,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:d?`...`:a.restore}),(0,M.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,M.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})})]})}function HE(e){let t=(0,qe.c)(5),{noteId:n,note:r,catalyzing:i,onCatalyze:a,onClose:o,noteThreads:l,openingChat:u,onOpenChat:d}=e,f=c(s(GE)).notes,p=fe(),m=r?.aiDeep?.catalysis,h=m?.report??null,g;t[0]===n?g=t[1]:(g=async e=>{try{await Ne(n,e)}catch{}},t[0]=n,t[1]=g);let _=g,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,M.jsx)(D,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[2]=y):y=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,M.jsx)(C,{className:`h-4 w-4 rotate-180`,"aria-hidden":!0}),t[3]=x):x=t[3];let S;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(se,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[4]=S):S=t[4],(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,(0,M.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,M.jsx)(`button`,{type:`button`,onClick:o,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:x})]}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,M.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:f.catalysisSectionDescription}),(0,M.jsx)(`button`,{type:`button`,onClick:a,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:h?f.recatalyze:f.catalyzeAction}),h?(0,M.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.valueHypothesis}),(0,M.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,M.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(WE)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,M.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map(UE)})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,M.jsx)(`span`,{className:`text-xs text-fg-muted`,children:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void _(`helpful`),className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,M.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void _(`not_helpful`),className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,M.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]}):(0,M.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:f.noCatalysisReportHint}),(0,M.jsxs)(`section`,{className:`mt-6 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[S,f.relatedThreadsTitle]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,M.jsx)(`button`,{type:`button`,onClick:d,disabled:u,className:`shrink-0 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:u?f.openingChat:f.openThread})]}),l.length>0?(0,M.jsx)(`div`,{className:`space-y-2`,children:l.slice(0,5).map(e=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>p(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,M.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||f.noteDiscussionFallback}),(0,M.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,M.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:f.noThreads})]})]})]})}function UE(e,t){return(0,M.jsxs)(`li`,{className:`flex gap-2`,children:[(0,M.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,M.jsx)(`span`,{children:e})]},e)}function WE(e){return(0,M.jsxs)(`li`,{className:`flex gap-2`,children:[(0,M.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-accent`}),(0,M.jsx)(`span`,{children:e})]},e)}function GE(e){return e.language}function KE(e){let t=(0,qe.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:he},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:pe},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Fe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,M.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,M.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:O(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,M.jsx)(a,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function qE(e){let t=(0,qe.c)(9),{noteId:n,onBack:r,onSaved:i}=e,a=s(JE),o;t[0]===a?o=t[1]:(o=c(a),t[0]=a,t[1]=o);let l=o.notes.lightboxClose,u;t[2]!==n||t[3]!==r||t[4]!==i?(u=(0,M.jsx)(YE,{noteId:n,onBack:r,onSaved:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=u):u=t[5];let d;return t[6]!==l||t[7]!==u?(d=(0,M.jsx)(PE,{closeLabel:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8],d}function JE(e){return e.language}function YE({noteId:e,onBack:t,onSaved:n}){let r=c(s(e=>e.language)).notes,i=fe(),a=d(e=>e.resolved)===`dark`,{openImage:o}=ME(),[u,p]=(0,j.useState)(`wysiwyg`),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)(null),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(``),[ee,te]=(0,j.useState)(360),[ne,re]=(0,j.useState)(!1),[ie,E]=(0,j.useState)(!1),[ae,oe]=(0,j.useState)(!1),ce=(0,j.useRef)(!1),le=(0,j.useRef)(null),ue=(0,j.useRef)(null),de=(0,j.useRef)(null),pe=He(e=>e.setPageHeader),he=He(e=>e.clearPageHeader),{data:k,mutate:A}=l(e?[`note-detail`,e]:null,()=>ye(e)),{data:ve=[],mutate:be}=l(e?[`note-threads`,e]:null,()=>Ie(e),{revalidateOnFocus:!1});k&&!ce.current&&(x(k.title??``),ce.current=!0);let xe=k?new Date(k.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,j.useMemo)(()=>(0,M.jsx)(`button`,{type:`button`,onClick:t,"aria-label":r.back,className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,w),children:(0,M.jsx)(C,{className:`h-4 w-4`,"aria-hidden":!0})}),[r.back,t]),Ce=(0,j.useCallback)(t=>{x(t),e&&(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{y(!0);try{await _e(e,{title:t}),await A(),n?.()}catch{}finally{y(!1)}},600))},[e,A,n]),we=(0,j.useMemo)(()=>(0,M.jsxs)(`div`,{className:O(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,w),children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:b||xe||void 0,children:b||xe}),v?(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:r.saving}):null]}),[r.saving,v,xe,b]),Ee=(0,j.useCallback)(async()=>{oe(!0);try{let t=await Te(e);await A(),await be(),i(`/chat/${encodeURIComponent(t.sessionKey)}`)}catch(e){f({type:`error`,title:r.chatOpenFailedTitle,message:e instanceof Error?e.message:r.chatOpenFailedMessage})}finally{oe(!1)}},[A,be,i,e]),De=(0,j.useCallback)(async()=>{E(!0);try{await ke(e),await A(),f({type:`success`,title:r.catalysisDone})}catch(e){f({type:`error`,title:r.catalysisFailed,message:e instanceof Error?e.message:r.chatOpenFailedMessage})}finally{E(!1)}},[A,e]),Oe=(0,j.useMemo)(()=>(0,M.jsxs)(`div`,{className:O(`flex items-center gap-2`,w),children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>h(m===`breakdown`?null:`breakdown`),"aria-label":r.catalysisSectionTitle,className:O(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,m===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),r.catalyzeButton]}),(0,M.jsxs)(`button`,{type:`button`,onClick:Ee,disabled:ae,className:O(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,M.jsx)(se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),ae?r.openingChat:r.openChatButton]}),(0,M.jsx)(KE,{mode:u,onModeChange:p,labels:{edit:r.modeEdit,source:r.modeSource,preview:r.modePreview}}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(m===`history`?null:`history`),"aria-label":r.history,className:O(`rounded-lg p-1.5 transition-colors`,m===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,M.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0})})]}),[ie,De,Ee,u,r.history,r.modeEdit,r.modePreview,r.modeSource,ae,m]);(0,j.useLayoutEffect)(()=>(pe({startExtra:Se,main:k?we:null,end:k?Oe:null}),()=>he()),[he,Oe,we,Se,k,pe]);let Ae=(0,j.useCallback)(t=>{e&&(le.current&&clearTimeout(le.current),le.current=setTimeout(async()=>{y(!0);try{await _e(e,{text:t}),await A(),n?.()}catch(e){f({type:`error`,title:r.saveFailed,message:e instanceof Error?e.message:r.saveFailedHint})}finally{y(!1)}},600))},[e,A,r.saveFailed,r.saveFailedHint,n]),je=(0,j.useCallback)(t=>{ge(e,t.timestamp).then(e=>{e&&_(e)})},[e]),Me=(0,j.useCallback)(()=>{h(null),_(null)},[]),Ne=(0,j.useCallback)(()=>{h(null),_(null),A(),n?.()},[A,n]);if(!k)return(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,M.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});let Pe=g!==null,Fe=Pe?g.title??``:b,Le=Pe?g.text??``:k.text??``;return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,M.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,M.jsx)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:Pe?(0,M.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Fe&&(0,M.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Fe}),Le?(0,M.jsx)(me,{noteId:e,content:Le,className:`opacity-80`}):(0,M.jsx)(`p`,{className:`italic text-fg-muted`,children:r.emptyPreview})]}):(0,M.jsxs)(M.Fragment,{children:[u===`wysiwyg`&&(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(`div`,{className:`shrink-0 px-6 pt-4`,children:(0,M.jsx)(`input`,{type:`text`,value:b,onChange:e=>Ce(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),(de.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:r.titlePlaceholder,className:`w-full border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`})}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,M.jsx)(RE,{initialContent:k.text??``,onChange:Ae,noteId:e},`wysiwyg-${e}`)})]}),u===`source`&&(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(`div`,{className:`shrink-0 px-6 pt-4`,children:(0,M.jsx)(`input`,{type:`text`,value:b,onChange:e=>Ce(e.target.value),placeholder:r.titlePlaceholder,className:`w-full border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`})}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,M.jsx)(S,{initialContent:k.text??``,onChange:Ae,isDark:a},`source-${e}`)})]}),u===`preview`&&(0,M.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&o(t.currentSrc||t.src,t.alt)},children:[b&&(0,M.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:b}),k.text?(0,M.jsx)(me,{noteId:e,content:k.text,className:`[&_img]:cursor-zoom-in`}):(0,M.jsx)(`p`,{className:`italic text-fg-muted`,children:r.emptyPreview})]})]})})}),(0,M.jsx)(`div`,{className:O(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ne&&`transition-[width] duration-300 ease-in-out`),style:{width:m?ee:0},children:(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,style:{width:ee},children:[(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),re(!0);let n=e.clientX,r=ee,i=e.pointerId,a=e=>{let t=r-(e.clientX-n);te(Math.max(280,Math.min(600,t)))},o=()=>{try{t.releasePointerCapture(i)}catch{}re(!1),window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)},className:O(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,ne&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,M.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:m===`history`?(0,M.jsx)(VE,{noteId:e,activeTimestamp:g?.timestamp??null,onSelect:je,onClose:Me,onRestored:Ne}):m===`breakdown`?(0,M.jsx)(HE,{noteId:e,note:k??null,catalyzing:ie,onCatalyze:De,onClose:()=>h(null),noteThreads:ve,openingChat:ae,onOpenChat:Ee}):null})]})})]})}function XE(){let e=(0,qe.c)(5),{noteId:t}=E(),n=fe(),r;e[0]===n?r=e[1]:(r=()=>{n(`/notes`)},e[0]=n,e[1]=r);let i=r;if(!t)return null;let a;return e[2]!==i||e[3]!==t?(a=(0,M.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,M.jsx)(qE,{noteId:t,onBack:i})}),e[2]=i,e[3]=t,e[4]=a):a=e[4],a}export{XE as NoteDetailPage};
|
|
180
|
+
`);return/\s/.test(n)}):!1}var pE=new V(`suggestion`);function mE({pluginKey:e=pE,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=dE,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!fE(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new B({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),Cc.create(e.doc,[bc.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var hE=mE,gE=[{id:`heading1`,label:`Heading 1`,description:`Large section heading`,keywords:[`h1`,`title`,`heading`]},{id:`heading2`,label:`Heading 2`,description:`Medium section heading`,keywords:[`h2`,`heading`]},{id:`heading3`,label:`Heading 3`,description:`Small section heading`,keywords:[`h3`,`heading`]},{id:`bulletList`,label:`Bullet List`,description:`Unordered list`,keywords:[`ul`,`list`,`bullet`]},{id:`orderedList`,label:`Numbered List`,description:`Ordered list`,keywords:[`ol`,`list`,`numbered`]},{id:`taskList`,label:`Task List`,description:`List with checkboxes`,keywords:[`todo`,`task`,`checkbox`]},{id:`blockquote`,label:`Quote`,description:`Block quotation`,keywords:[`quote`,`blockquote`]},{id:`codeBlock`,label:`Code Block`,description:`Fenced code snippet`,keywords:[`code`,`snippet`]},{id:`divider`,label:`Divider`,description:`Horizontal rule`,keywords:[`hr`,`rule`,`line`]},{id:`image`,label:`Image`,description:`Upload an image`,keywords:[`img`,`photo`,`picture`]}];function _E(e){let t=e.trim().toLowerCase();return t?gE.filter(e=>[e.label,e.description,...e.keywords].join(` `).toLowerCase().includes(t)):gE}function vE(e,t,n,r){if(e.id===`image`){t.chain().focus().deleteRange(n).run(),r.requestImagePicker&&setTimeout(()=>r.requestImagePicker?.(),0);return}let i=t.chain().focus().deleteRange(n);switch(e.id){case`heading1`:i.setHeading({level:1}).run();return;case`heading2`:i.setHeading({level:2}).run();return;case`heading3`:i.setHeading({level:3}).run();return;case`bulletList`:i.toggleBulletList().run();return;case`orderedList`:i.toggleOrderedList().run();return;case`taskList`:i.toggleTaskList().run();return;case`blockquote`:i.toggleBlockquote().run();return;case`codeBlock`:i.toggleCodeBlock().run();return;case`divider`:i.setHorizontalRule().run(),lE(t);return;default:return}}var yE=`slash-menu-panel fixed z-[9999] w-64 overflow-hidden rounded-lg border border-edge bg-surface-base shadow-lg`,bE=`flex w-full items-center gap-3 rounded-md px-2.5 py-2 text-left transition-colors text-fg-muted hover:bg-surface-hover hover:text-fg`,xE=`bg-surface-hover text-fg`;function SE({editor:e,getRuntime:t}){let n=null,r=null,i=null,a=null,o=0,s=``,c=null,l=()=>{n?.remove(),n=null,r=null,i=null,a=null,c=null,o=0,s=``},u=()=>{n||(n=document.createElement(`div`),n.setAttribute(`data-slash-menu-root`,`true`),r=document.createElement(`div`),r.className=yE,i=document.createElement(`div`),i.className=`slash-menu-scroll max-h-72 overflow-y-auto p-1`,a=document.createElement(`input`),a.type=`file`,a.accept=`image/*`,a.className=`hidden`,a.addEventListener(`change`,()=>{let e=a?.files?.[0],n=t();e&&n.onImageUpload&&n.onImageUpload(e),a&&(a.value=``)}),r.appendChild(i),n.append(r,a),document.body.appendChild(n))},d=()=>{if(!r||!c)return;let e=c.clientRect?.()??null;if(e){r.style.top=`${e.bottom+6}px`,r.style.left=`${e.left}px`;return}let t=c.editor.view.coordsAtPos(c.range.to);r.style.top=`${t.bottom+6}px`,r.style.left=`${t.left}px`},f=()=>{if(!c||!i||!r)return;i.replaceChildren();let e=i;c.items.forEach((n,r)=>{let i=document.createElement(`button`);i.type=`button`,i.className=`${bE}${r===o?` ${xE}`:``}`;let s=document.createElement(`span`);s.className=`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-edge bg-surface-raised text-xs font-semibold uppercase text-fg-muted`,s.textContent=n.label.slice(0,2);let l=document.createElement(`span`);l.className=`min-w-0 flex-1`;let u=document.createElement(`span`);u.className=`block truncate text-sm font-medium text-fg`,u.textContent=n.label;let d=document.createElement(`span`);d.className=`block truncate text-xs text-fg-muted`,d.textContent=n.description,l.append(u,d),i.append(s,l),i.addEventListener(`mousedown`,e=>{if(e.preventDefault(),c){if(n.id===`image`){vE(n,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())});return}c.command(n)}}),e.appendChild(i)}),d()},p=e=>{e.query!==s&&(o=0,s=e.query),c=e,u(),f()};return e.on(`destroy`,l),{onStart:e=>{p(e)},onUpdate:e=>{p(e)},onExit:()=>{l()},onKeyDown:({event:e})=>{let n=c?.items??[];if(!n.length)return!1;if(e.key===`ArrowDown`)return o=(o+1)%n.length,f(),!0;if(e.key===`ArrowUp`)return o=(o-1+n.length)%n.length,f(),!0;if(e.key===`Enter`){let e=n[o];return e&&c&&(e.id===`image`?vE(e,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())}):c.command(e)),!0}return!1},destroy:l}}var CE=new V(`slashCommands`),wE=K.create({name:`slashCommands`,addOptions(){return{getRuntime:()=>({})}},addStorage(){return{active:!1}},onDestroy(){this.storage.active=!1},addProseMirrorPlugins(){let e=this,t=SE({editor:this.editor,getRuntime:()=>e.options.getRuntime()});return[hE({pluginKey:CE,editor:this.editor,char:`/`,allowedPrefixes:null,items:({query:e})=>_E(e),command:({editor:t,range:n,props:r})=>{vE(r,t,n,e.options.getRuntime())},render:()=>({onStart:n=>{e.storage.active=!0,t.onStart(n)},onUpdate:e=>{t.onUpdate(e)},onExit:()=>{e.storage.active=!1,t.onExit()},onKeyDown:t.onKeyDown})})]}}),TE=Ib.configure({node:`paragraph`,notAfter:[`paragraph`]});function EE(e){let t=(0,qe.c)(9),{onClick:n,isActive:r,disabled:i,title:a,children:o}=e,s=r&&`bg-surface-hover text-accent`,c=i&&`pointer-events-none opacity-40`,l;t[0]!==s||t[1]!==c?(l=O(`rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,s,c),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==l||t[7]!==a?(u=(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:i,title:a,className:l,children:o}),t[3]=o,t[4]=i,t[5]=n,t[6]=l,t[7]=a,t[8]=u):u=t[8],u}function DE(){let e=(0,qe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(`div`,{className:`mx-1 h-5 w-px bg-edge`}),e[0]=t):t=e[0],t}function OE(e){let t=(0,qe.c)(132),{editor:n,onImageUpload:r,imageUploading:i}=e,a=i===void 0?!1:i,o=(0,j.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o.current?.click()},t[0]=s):s=t[0];let c=s,l;t[1]!==a||t[2]!==r?(l=e=>{let t=e.target.files?.[0];t&&r&&!a&&r(t),o.current&&(o.current.value=``)},t[1]=a,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]===n?d=t[5]:(d=()=>{let e=n.getAttributes(`link`).href??``,t=window.prompt(`URL`,e);if(t!==null){if(t===``){n.chain().focus().extendMarkRange(`link`).unsetLink().run();return}n.chain().focus().extendMarkRange(`link`).setLink({href:t}).run()}},t[4]=n,t[5]=d);let f=d,p,m;t[6]===n?(p=t[7],m=t[8]):(p=()=>n.chain().focus().undo().run(),m=n.can().undo(),t[6]=n,t[7]=p,t[8]=m);let g=!m,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,M.jsx)(oe,{size:16}),t[9]=_):_=t[9];let v;t[10]!==p||t[11]!==g?(v=(0,M.jsx)(EE,{onClick:p,disabled:g,title:`Undo`,children:_}),t[10]=p,t[11]=g,t[12]=v):v=t[12];let y,b;t[13]===n?(y=t[14],b=t[15]):(y=()=>n.chain().focus().redo().run(),b=n.can().redo(),t[13]=n,t[14]=y,t[15]=b);let x=!b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(Pe,{size:16}),t[16]=S):S=t[16];let C;t[17]!==y||t[18]!==x?(C=(0,M.jsx)(EE,{onClick:y,disabled:x,title:`Redo`,children:S}),t[17]=y,t[18]=x,t[19]=C):C=t[19];let w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,M.jsx)(DE,{}),t[20]=w):w=t[20];let T,ne;t[21]===n?(T=t[22],ne=t[23]):(T=()=>n.chain().focus().toggleHeading({level:1}).run(),ne=n.isActive(`heading`,{level:1}),t[21]=n,t[22]=T,t[23]=ne);let re;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,M.jsx)(ie,{size:16}),t[24]=re):re=t[24];let E;t[25]!==T||t[26]!==ne?(E=(0,M.jsx)(EE,{onClick:T,isActive:ne,title:`Heading 1`,children:re}),t[25]=T,t[26]=ne,t[27]=E):E=t[27];let D,ae;t[28]===n?(D=t[29],ae=t[30]):(D=()=>n.chain().focus().toggleHeading({level:2}).run(),ae=n.isActive(`heading`,{level:2}),t[28]=n,t[29]=D,t[30]=ae);let se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,M.jsx)(de,{size:16}),t[31]=se):se=t[31];let le;t[32]!==D||t[33]!==ae?(le=(0,M.jsx)(EE,{onClick:D,isActive:ae,title:`Heading 2`,children:se}),t[32]=D,t[33]=ae,t[34]=le):le=t[34];let fe,pe;t[35]===n?(fe=t[36],pe=t[37]):(fe=()=>n.chain().focus().toggleHeading({level:3}).run(),pe=n.isActive(`heading`,{level:3}),t[35]=n,t[36]=fe,t[37]=pe);let me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,M.jsx)(ue,{size:16}),t[38]=me):me=t[38];let he;t[39]!==fe||t[40]!==pe?(he=(0,M.jsx)(EE,{onClick:fe,isActive:pe,title:`Heading 3`,children:me}),t[39]=fe,t[40]=pe,t[41]=he):he=t[41];let ge;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,M.jsx)(DE,{}),t[42]=ge):ge=t[42];let O,A;t[43]===n?(O=t[44],A=t[45]):(O=()=>n.chain().focus().toggleBold().run(),A=n.isActive(`bold`),t[43]=n,t[44]=O,t[45]=A);let _e;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,M.jsx)(Ve,{size:16}),t[46]=_e):_e=t[46];let ye;t[47]!==O||t[48]!==A?(ye=(0,M.jsx)(EE,{onClick:O,isActive:A,title:`Bold (⌘B)`,children:_e}),t[47]=O,t[48]=A,t[49]=ye):ye=t[49];let Ce,we;t[50]===n?(Ce=t[51],we=t[52]):(Ce=()=>n.chain().focus().toggleItalic().run(),we=n.isActive(`italic`),t[50]=n,t[51]=Ce,t[52]=we);let Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,M.jsx)(ce,{size:16}),t[53]=Te):Te=t[53];let Ee;t[54]!==Ce||t[55]!==we?(Ee=(0,M.jsx)(EE,{onClick:Ce,isActive:we,title:`Italic (⌘I)`,children:Te}),t[54]=Ce,t[55]=we,t[56]=Ee):Ee=t[56];let De,Oe;t[57]===n?(De=t[58],Oe=t[59]):(De=()=>n.chain().focus().toggleStrike().run(),Oe=n.isActive(`strike`),t[57]=n,t[58]=De,t[59]=Oe);let ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,M.jsx)(xe,{size:16}),t[60]=ke):ke=t[60];let Ae;t[61]!==De||t[62]!==Oe?(Ae=(0,M.jsx)(EE,{onClick:De,isActive:Oe,title:`Strikethrough`,children:ke}),t[61]=De,t[62]=Oe,t[63]=Ae):Ae=t[63];let je,Me;t[64]===n?(je=t[65],Me=t[66]):(je=()=>n.chain().focus().toggleCode().run(),Me=n.isActive(`code`),t[64]=n,t[65]=je,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,M.jsx)(k,{size:16}),t[67]=Ne):Ne=t[67];let Fe;t[68]!==je||t[69]!==Me?(Fe=(0,M.jsx)(EE,{onClick:je,isActive:Me,title:`Inline code`,children:Ne}),t[68]=je,t[69]=Me,t[70]=Fe):Fe=t[70];let Ie;t[71]===n?Ie=t[72]:(Ie=n.isActive(`link`),t[71]=n,t[72]=Ie);let Le;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,M.jsx)(te,{size:16}),t[73]=Le):Le=t[73];let Re;t[74]!==f||t[75]!==Ie?(Re=(0,M.jsx)(EE,{onClick:f,isActive:Ie,title:`Link`,children:Le}),t[74]=f,t[75]=Ie,t[76]=Re):Re=t[76];let Be;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,M.jsx)(DE,{}),t[77]=Be):Be=t[77];let He,Ue;t[78]===n?(He=t[79],Ue=t[80]):(He=()=>n.chain().focus().toggleBulletList().run(),Ue=n.isActive(`bulletList`),t[78]=n,t[79]=He,t[80]=Ue);let We;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,M.jsx)(Se,{size:16}),t[81]=We):We=t[81];let Ge;t[82]!==He||t[83]!==Ue?(Ge=(0,M.jsx)(EE,{onClick:He,isActive:Ue,title:`Bullet list`,children:We}),t[82]=He,t[83]=Ue,t[84]=Ge):Ge=t[84];let Ke,N;t[85]===n?(Ke=t[86],N=t[87]):(Ke=()=>n.chain().focus().toggleOrderedList().run(),N=n.isActive(`orderedList`),t[85]=n,t[86]=Ke,t[87]=N);let Je;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,M.jsx)(be,{size:16}),t[88]=Je):Je=t[88];let Ye;t[89]!==Ke||t[90]!==N?(Ye=(0,M.jsx)(EE,{onClick:Ke,isActive:N,title:`Ordered list`,children:Je}),t[89]=Ke,t[90]=N,t[91]=Ye):Ye=t[91];let P,Xe;t[92]===n?(P=t[93],Xe=t[94]):(P=()=>n.chain().focus().toggleTaskList().run(),Xe=n.isActive(`taskList`),t[92]=n,t[93]=P,t[94]=Xe);let Ze;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,M.jsx)(h,{size:16}),t[95]=Ze):Ze=t[95];let Qe;t[96]!==P||t[97]!==Xe?(Qe=(0,M.jsx)(EE,{onClick:P,isActive:Xe,title:`Task list`,children:Ze}),t[96]=P,t[97]=Xe,t[98]=Qe):Qe=t[98];let F,$e;t[99]===n?(F=t[100],$e=t[101]):(F=()=>n.chain().focus().toggleBlockquote().run(),$e=n.isActive(`blockquote`),t[99]=n,t[100]=F,t[101]=$e);let I;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,M.jsx)(ve,{size:16}),t[102]=I):I=t[102];let et;t[103]!==F||t[104]!==$e?(et=(0,M.jsx)(EE,{onClick:F,isActive:$e,title:`Quote`,children:I}),t[103]=F,t[104]=$e,t[105]=et):et=t[105];let tt;t[106]===n?tt=t[107]:(tt=()=>{n.chain().focus().setHorizontalRule().run(),lE(n)},t[106]=n,t[107]=tt);let nt;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,M.jsx)(ze,{size:16}),t[108]=nt):nt=t[108];let rt;t[109]===tt?rt=t[110]:(rt=(0,M.jsx)(EE,{onClick:tt,title:`Divider`,children:nt}),t[109]=tt,t[110]=rt);let it;t[111]!==u||t[112]!==a||t[113]!==r?(it=r&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(DE,{}),(0,M.jsx)(EE,{onClick:c,disabled:a,title:a?`Uploading…`:`Insert image`,children:(0,M.jsx)(ee,{size:16,className:a?`animate-pulse`:void 0})}),(0,M.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,onChange:u,className:`hidden`})]}),t[111]=u,t[112]=a,t[113]=r,t[114]=it):it=t[114];let at;return t[115]!==C||t[116]!==E||t[117]!==le||t[118]!==he||t[119]!==ye||t[120]!==Ee||t[121]!==Ae||t[122]!==Fe||t[123]!==Re||t[124]!==Ge||t[125]!==Ye||t[126]!==Qe||t[127]!==et||t[128]!==rt||t[129]!==it||t[130]!==v?(at=(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-edge px-3 py-1.5`,children:[v,C,w,E,le,he,ge,ye,Ee,Ae,Fe,Re,Be,Ge,Ye,Qe,et,rt,it]}),t[115]=C,t[116]=E,t[117]=le,t[118]=he,t[119]=ye,t[120]=Ee,t[121]=Ae,t[122]=Fe,t[123]=Re,t[124]=Ge,t[125]=Ye,t[126]=Qe,t[127]=et,t[128]=rt,t[129]=it,t[130]=v,t[131]=at):at=t[131],at}var kE=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,AE=q.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,G(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=G(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new Bf({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[If({find:kE,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),jE=(0,j.createContext)(null);function ME(){let e=(0,qe.c)(1),t=(0,j.useContext)(jE);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:NE},e[0]=t):t=e[0],t}return t}function NE(){}function PE(e){let t=(0,qe.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,j.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,M.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=O(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=m):m=t[4];let h=a?.alt||`Image preview`,_;t[5]===h?_=t[6]:(_=(0,M.jsx)(Ce,{className:`sr-only`,children:h}),t[5]=h,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,M.jsx)(Me,{className:`h-5 w-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let b;t[8]===i?b=t[9]:(b=(0,M.jsx)(g,{asChild:!0,children:(0,M.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:v})}),t[8]=i,t[9]=b);let S;t[10]===a?S=t[11]:(S=a?(0,M.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=S);let C;t[12]!==b||t[13]!==S||t[14]!==_?(C=(0,M.jsxs)(y,{children:[p,(0,M.jsxs)(Re,{className:m,"aria-describedby":void 0,children:[_,b,S]})]}),t[12]=b,t[13]=S,t[14]=_,t[15]=C):C=t[15];let w;t[16]!==C||t[17]!==d?(w=(0,M.jsx)(re,{open:d,onOpenChange:f,children:C}),t[16]=C,t[17]=d,t[18]=w):w=t[18];let T;return t[19]!==n||t[20]!==w?(T=(0,M.jsxs)(jE.Provider,{value:u,children:[n,w]}),t[19]=n,t[20]=w,t[21]=T):T=t[21],T}function FE(e){let t=(0,qe.c)(28),{node:n,updateAttributes:r,selected:i}=e,{src:a,alt:o,title:s}=n.attrs,{openImage:c}=ME(),[l,u]=(0,j.useState)(!1),d=(0,j.useRef)(null),[f,p]=(0,j.useState)(!1),m=(0,j.useRef)(0),h=(0,j.useRef)(0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),e.stopPropagation(),p(!0),m.current=e.clientX,h.current=d.current?.offsetWidth??400},t[0]=g):g=t[0];let _=g,v,y;t[1]!==f||t[2]!==r?(v=()=>{if(!f)return;let e=e=>{let t=e.clientX-m.current;r({width:Math.max(100,h.current+t)})},t=()=>{p(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},y=[f,r],t[1]=f,t[2]=r,t[3]=v,t[4]=y):(v=t[3],y=t[4]),(0,j.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{u(!1)},t[5]=b):b=t[5];let x;t[6]===a?x=t[7]:(x=[a],t[6]=a,t[7]=x),(0,j.useEffect)(b,x);let S=n.attrs.width,C=i&&`ring-2 ring-accent ring-offset-2 ring-offset-surface-base rounded-lg`,w;t[8]===C?w=t[9]:(w=O(`relative inline-block`,C),t[8]=C,t[9]=w);let T=S?`${S}px`:void 0,ee;t[10]===T?ee=t[11]:(ee={width:T,maxWidth:`100%`},t[10]=T,t[11]=ee);let te;t[12]!==o||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==s?(te=l?(0,M.jsx)(`div`,{className:`flex min-h-24 min-w-[12rem] items-center justify-center rounded-lg border border-dashed border-edge bg-surface-hover text-fg-muted`,children:(0,M.jsx)(`span`,{className:`text-xs`,children:`Image unavailable`})}):(0,M.jsx)(Le,{src:a,alt:o??``,title:s??void 0,className:`block h-auto w-full cursor-zoom-in rounded-lg`,draggable:!1,onClick:e=>c(e,o??void 0),onLoadFailed:()=>u(!0)}),t[12]=o,t[13]=l,t[14]=c,t[15]=a,t[16]=s,t[17]=te):te=t[17];let ne=(i||f)&&`opacity-100`,re;t[18]===ne?re=t[19]:(re=O(`absolute bottom-1 right-1 h-4 w-4 cursor-se-resize rounded-sm opacity-0 transition-opacity`,`bg-accent/70 hover:bg-accent`,ne),t[18]=ne,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,M.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,className:`m-0.5 text-white`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,M.jsx)(`path`,{d:`M10 2L2 10M10 6L6 10M10 10L10 10`,strokeLinecap:`round`})}),t[20]=ie):ie=t[20];let E;t[21]===re?E=t[22]:(E=(0,M.jsx)(`div`,{onMouseDown:_,className:re,title:`Drag to resize`,children:ie}),t[21]=re,t[22]=E);let D;return t[23]!==te||t[24]!==E||t[25]!==w||t[26]!==ee?(D=(0,M.jsx)(_m,{className:`block-editor-image-wrapper`,children:(0,M.jsxs)(`div`,{ref:d,className:w,style:ee,children:[te,E]})}),t[23]=te,t[24]=E,t[25]=w,t[26]=ee,t[27]=D):D=t[27],D}var IE=AE.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute(`width`)||e.style.width;return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width: ${e.width}px`}:{}}}},addNodeView(){return Tm(FE)}});function LE(e,t){let{doc:n}=e.state,r=n.resolve(t);return r.index(0)===0?`first`:r.index(0)===n.childCount-1?`last`:null}function RE({initialContent:e,onChange:t,placeholder:n=`Start writing, or type "/" for commands…`,className:r,noteId:i}){let a=c(s(e=>e.language)).notes,[o,l]=(0,j.useState)(!1),u=(0,j.useRef)(t);u.current=t;let d=(0,j.useRef)(null),p=(0,j.useRef)({}),m=pm({extensions:[Rb.configure({heading:{levels:[1,2,3]},codeBlock:{HTMLAttributes:{class:`block-editor-code`}}}),TE,IE.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:`block-editor-image`}}),zb,Bb.configure({nested:!0}),Vb.configure({placeholder:({editor:e,node:t,pos:r})=>{if(t.type.name!==`paragraph`||t.content.size>0)return``;let i=LE(e,r);return i===`first`||i===`last`?n:``},includeChildren:!0}),Vv.configure({openOnClick:!1,autolink:!0,HTMLAttributes:{class:`block-editor-link`}}),$T.configure({html:!0,transformPastedText:!0,transformCopiedText:!0}),sE,uE,wE.configure({getRuntime:()=>p.current})],content:e,onUpdate:({editor:e})=>{let t=e.storage.markdown.getMarkdown();u.current(t)},editorProps:{attributes:{class:`block-editor-content`}}}),h=(0,j.useCallback)(async e=>{if(!(!i||!m))try{l(!0);let t=await A(i,e);m.chain().focus().setImage({src:Be(i,t.id),alt:e.name}).run(),lE(m)}catch(e){f({type:`error`,title:a.imageUploadFailed,message:e instanceof Error?e.message:a.imageUploadFailedHint})}finally{l(!1)}},[m,i,a.imageUploadFailed,a.imageUploadFailedHint]),g=(0,j.useCallback)(()=>{d.current?.click()},[]);return p.current={onImageUpload:i?h:void 0,requestImagePicker:i?g:void 0},(0,j.useEffect)(()=>{if(!m||!i)return;let e=e=>{let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type.startsWith(`image/`)){e.preventDefault();let t=n.getAsFile();t&&h(t);return}}},t=e=>{let t=e.dataTransfer?.files;if(t?.length){for(let n of t)if(n.type.startsWith(`image/`)){e.preventDefault(),h(n);return}}},n=m.view.dom;return n.addEventListener(`paste`,e),n.addEventListener(`drop`,t),()=>{n.removeEventListener(`paste`,e),n.removeEventListener(`drop`,t)}},[m,i,h]),m?(0,M.jsxs)(`div`,{className:O(`flex h-full flex-col overflow-hidden`,r),children:[(0,M.jsx)(OE,{editor:m,onImageUpload:i?h:void 0,imageUploading:o}),(0,M.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:(0,M.jsx)(am,{editor:m})}),(0,M.jsx)(`input`,{ref:d,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&i&&h(t),d.current&&(d.current.value=``)},className:`hidden`})]}):null}var zE={edit:je,ai_edit:D,sync:Oe,restore:le};function BE(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function VE({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=c(s(e=>e.language)).notes,o=a,{data:u}=l(e?[`note-history`,e]:null,()=>Ae(e)),[d,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),g=(0,j.useCallback)(async t=>{p(!0);try{await De(e,t),f({type:`success`,title:a.restoreSuccess}),h(null),i()}catch{f({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=Date.now();return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,M.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0}),a.history]}),(0,M.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,M.jsx)(Me,{className:`h-4 w-4`,"aria-hidden":!0})})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,M.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=zE[e.trigger]??je,i=t===e.timestamp,s=m===e.timestamp;return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:O(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:BE(e.trigger,a)}),(0,M.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:We(e.timestamp,_,o)})]}),e.snippet&&(0,M.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,M.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,M.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e.timestamp)},disabled:d,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:d?`...`:a.restore}),(0,M.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,M.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})})]})}function HE(e){let t=(0,qe.c)(5),{noteId:n,note:r,catalyzing:i,onCatalyze:a,onClose:o,noteThreads:l,openingChat:u,onOpenChat:d}=e,f=c(s(GE)).notes,p=fe(),m=r?.aiDeep?.catalysis,h=m?.report??null,g;t[0]===n?g=t[1]:(g=async e=>{try{await Ne(n,e)}catch{}},t[0]=n,t[1]=g);let _=g,y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,M.jsx)(D,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[2]=y):y=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,M.jsx)(C,{className:`h-4 w-4 rotate-180`,"aria-hidden":!0}),t[3]=x):x=t[3];let S;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,M.jsx)(se,{className:`h-4 w-4 text-accent`,"aria-hidden":!0}),t[4]=S):S=t[4],(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,(0,M.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,M.jsx)(`button`,{type:`button`,onClick:o,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:x})]}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,M.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:f.catalysisSectionDescription}),(0,M.jsx)(`button`,{type:`button`,onClick:a,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:h?f.recatalyze:f.catalyzeAction}),h?(0,M.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.valueHypothesis}),(0,M.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:h.valueHypothesis})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,M.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.keyQuestions.slice(0,3).map(WE)})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,M.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:h.mvpPath.slice(0,3).map(UE)})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,M.jsx)(`span`,{className:`text-xs text-fg-muted`,children:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(h.confidence*100)))}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void _(`helpful`),className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,M.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void _(`not_helpful`),className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,m?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,M.jsx)(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0})})]})]})]}):(0,M.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:f.noCatalysisReportHint}),(0,M.jsxs)(`section`,{className:`mt-6 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[S,f.relatedThreadsTitle]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,M.jsx)(`button`,{type:`button`,onClick:d,disabled:u,className:`shrink-0 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:u?f.openingChat:f.openThread})]}),l.length>0?(0,M.jsx)(`div`,{className:`space-y-2`,children:l.slice(0,5).map(e=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>p(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,M.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||f.noteDiscussionFallback}),(0,M.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,M.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:f.noThreads})]})]})]})}function UE(e,t){return(0,M.jsxs)(`li`,{className:`flex gap-2`,children:[(0,M.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,M.jsx)(`span`,{children:e})]},e)}function WE(e){return(0,M.jsxs)(`li`,{className:`flex gap-2`,children:[(0,M.jsx)(`span`,{className:`mt-2 h-1 w-1 shrink-0 rounded-full bg-accent`}),(0,M.jsx)(`span`,{children:e})]},e)}function GE(e){return e.language}function KE(e){let t=(0,qe.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:he},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:pe},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Fe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,M.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,M.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:O(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,M.jsx)(a,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=l,t[12]=r,t[13]=u):u=t[13],u}function qE(e){let t=(0,qe.c)(9),{noteId:n,onBack:r,onSaved:i}=e,a=s(JE),o;t[0]===a?o=t[1]:(o=c(a),t[0]=a,t[1]=o);let l=o.notes.lightboxClose,u;t[2]!==n||t[3]!==r||t[4]!==i?(u=(0,M.jsx)(YE,{noteId:n,onBack:r,onSaved:i}),t[2]=n,t[3]=r,t[4]=i,t[5]=u):u=t[5];let d;return t[6]!==l||t[7]!==u?(d=(0,M.jsx)(PE,{closeLabel:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8],d}function JE(e){return e.language}function YE({noteId:e,onBack:t,onSaved:n}){let r=c(s(e=>e.language)).notes,i=fe(),a=d(e=>e.resolved)===`dark`,{openImage:o}=ME(),[u,p]=(0,j.useState)(`wysiwyg`),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)(null),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(``),[ee,te]=(0,j.useState)(360),[ne,re]=(0,j.useState)(!1),[ie,E]=(0,j.useState)(!1),[ae,oe]=(0,j.useState)(!1),ce=(0,j.useRef)(!1),le=(0,j.useRef)(null),ue=(0,j.useRef)(null),de=(0,j.useRef)(null),pe=He(e=>e.setPageHeader),he=He(e=>e.clearPageHeader),{data:k,mutate:A}=l(e?[`note-detail`,e]:null,()=>ye(e)),{data:ve=[],mutate:be}=l(e?[`note-threads`,e]:null,()=>Ie(e),{revalidateOnFocus:!1});k&&!ce.current&&(x(k.title??``),ce.current=!0);let xe=k?new Date(k.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,j.useMemo)(()=>(0,M.jsx)(`button`,{type:`button`,onClick:t,"aria-label":r.back,className:O(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,w),children:(0,M.jsx)(C,{className:`h-4 w-4`,"aria-hidden":!0})}),[r.back,t]),Ce=(0,j.useCallback)(t=>{x(t),e&&(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{y(!0);try{await _e(e,{title:t}),await A(),n?.()}catch{}finally{y(!1)}},600))},[e,A,n]),we=(0,j.useMemo)(()=>(0,M.jsxs)(`div`,{className:O(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,w),children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:b||xe||void 0,children:b||xe}),v?(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:r.saving}):null]}),[r.saving,v,xe,b]),Ee=(0,j.useCallback)(async()=>{oe(!0);try{let t=await Te(e);await A(),await be(),i(`/chat/${encodeURIComponent(t.sessionKey)}`)}catch(e){f({type:`error`,title:r.chatOpenFailedTitle,message:e instanceof Error?e.message:r.chatOpenFailedMessage})}finally{oe(!1)}},[A,be,i,e]),De=(0,j.useCallback)(async()=>{E(!0);try{await ke(e),await A(),f({type:`success`,title:r.catalysisDone})}catch(e){f({type:`error`,title:r.catalysisFailed,message:e instanceof Error?e.message:r.chatOpenFailedMessage})}finally{E(!1)}},[A,e]),Oe=(0,j.useMemo)(()=>(0,M.jsxs)(`div`,{className:O(`flex items-center gap-2`,w),children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>h(m===`breakdown`?null:`breakdown`),"aria-label":r.catalysisSectionTitle,className:O(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,m===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),r.catalyzeButton]}),(0,M.jsxs)(`button`,{type:`button`,onClick:Ee,disabled:ae,className:O(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,M.jsx)(se,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),ae?r.openingChat:r.openChatButton]}),(0,M.jsx)(KE,{mode:u,onModeChange:p,labels:{edit:r.modeEdit,source:r.modeSource,preview:r.modePreview}}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(m===`history`?null:`history`),"aria-label":r.history,className:O(`rounded-lg p-1.5 transition-colors`,m===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,M.jsx)(T,{className:`h-4 w-4`,"aria-hidden":!0})})]}),[ie,De,Ee,u,r.history,r.modeEdit,r.modePreview,r.modeSource,ae,m]);(0,j.useLayoutEffect)(()=>(pe({startExtra:Se,main:k?we:null,end:k?Oe:null}),()=>he()),[he,Oe,we,Se,k,pe]);let Ae=(0,j.useCallback)(t=>{e&&(le.current&&clearTimeout(le.current),le.current=setTimeout(async()=>{y(!0);try{await _e(e,{markdown:t}),await A(),n?.()}catch(e){f({type:`error`,title:r.saveFailed,message:e instanceof Error?e.message:r.saveFailedHint})}finally{y(!1)}},600))},[e,A,r.saveFailed,r.saveFailedHint,n]),je=(0,j.useCallback)(t=>{ge(e,t.timestamp).then(e=>{e&&_(e)})},[e]),Me=(0,j.useCallback)(()=>{h(null),_(null)},[]),Ne=(0,j.useCallback)(()=>{h(null),_(null),A(),n?.()},[A,n]);if(!k)return(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,M.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});let Pe=g!==null,Fe=Pe?g.title??``:b,Le=Pe?g.markdown??``:k.markdown??``;return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,M.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,M.jsx)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:Pe?(0,M.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Fe&&(0,M.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Fe}),Le?(0,M.jsx)(me,{noteId:e,content:Le,className:`opacity-80`}):(0,M.jsx)(`p`,{className:`italic text-fg-muted`,children:r.emptyPreview})]}):(0,M.jsxs)(M.Fragment,{children:[u===`wysiwyg`&&(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(`div`,{className:`shrink-0 px-6 pt-4`,children:(0,M.jsx)(`input`,{type:`text`,value:b,onChange:e=>Ce(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),(de.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:r.titlePlaceholder,className:`w-full border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`})}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,M.jsx)(RE,{initialContent:k.markdown??``,onChange:Ae,noteId:e},`wysiwyg-${e}`)})]}),u===`source`&&(0,M.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,M.jsx)(`div`,{className:`shrink-0 px-6 pt-4`,children:(0,M.jsx)(`input`,{type:`text`,value:b,onChange:e=>Ce(e.target.value),placeholder:r.titlePlaceholder,className:`w-full border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`})}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,M.jsx)(S,{initialContent:k.markdown??``,onChange:Ae,isDark:a},`source-${e}`)})]}),u===`preview`&&(0,M.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&o(t.currentSrc||t.src,t.alt)},children:[b&&(0,M.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:b}),k.markdown?(0,M.jsx)(me,{noteId:e,content:k.markdown,className:`[&_img]:cursor-zoom-in`}):(0,M.jsx)(`p`,{className:`italic text-fg-muted`,children:r.emptyPreview})]})]})})}),(0,M.jsx)(`div`,{className:O(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ne&&`transition-[width] duration-300 ease-in-out`),style:{width:m?ee:0},children:(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,style:{width:ee},children:[(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),re(!0);let n=e.clientX,r=ee,i=e.pointerId,a=e=>{let t=r-(e.clientX-n);te(Math.max(280,Math.min(600,t)))},o=()=>{try{t.releasePointerCapture(i)}catch{}re(!1),window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)},className:O(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,ne&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,M.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:m===`history`?(0,M.jsx)(VE,{noteId:e,activeTimestamp:g?.timestamp??null,onSelect:je,onClose:Me,onRestored:Ne}):m===`breakdown`?(0,M.jsx)(HE,{noteId:e,note:k??null,catalyzing:ie,onCatalyze:De,onClose:()=>h(null),noteThreads:ve,openingChat:ae,onOpenChat:Ee}):null})]})})]})}function XE(){let e=(0,qe.c)(5),{noteId:t}=E(),n=fe(),r;e[0]===n?r=e[1]:(r=()=>{n(`/notes`)},e[0]=n,e[1]=r);let i=r;if(!t)return null;let a;return e[2]!==i||e[3]!==t?(a=(0,M.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,M.jsx)(qE,{noteId:t,onBack:i})}),e[2]=i,e[3]=t,e[4]=a):a=e[4],a}export{XE as NoteDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./url-
|
|
1
|
+
import{a as e}from"./url-F3_D_6zZ.js";import{bt as t,yt as n}from"./index-0HmunJW9.js";var r={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},i=null,a=null,o=null,s=null;function c(){return i||(i=new Audio,i.addEventListener(`timeupdate`,()=>{u.setState({currentTime:i.currentTime})}),i.addEventListener(`loadedmetadata`,()=>{let e=i.duration;Number.isFinite(e)&&u.setState({duration:e})}),i.addEventListener(`ended`,()=>{u.setState({playing:!1,currentTime:0}),i.currentTime=0}),i.addEventListener(`pause`,()=>{u.setState({playing:!1})}),i.addEventListener(`play`,()=>{u.setState({playing:!0})})),i}function l(){o&&s&&t(o,s),a=null,o=null,s=null}var u=e()((e,t)=>({...r,play:async(r,i,u)=>{let d=c(),f=t();if(f.noteId===r&&f.attachmentId===i&&a){d.play();return}d.pause(),l(),e({noteId:r,attachmentId:i,playing:!1,currentTime:0,duration:u??0,loading:!0});try{let t=await n(r,i);a=t,o=r,s=i,d.src=t,await d.play(),e({loading:!1})}catch{e({loading:!1,playing:!1}),l()}},pause:()=>{c().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=c();n.currentTime=t,e({currentTime:t})},reset:()=>{c().pause(),c().src=``,l(),e(r)}})),d=6e4,f=36e5,p=864e5;function m(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function h(e,t,n){let r=t-e;if(r<d)return n.justNow;if(r<f){let e=Math.floor(r/d);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=m(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-p)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*p){let e=Math.floor(r/p);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function g(e,t,n){let r=m(t);if(e>=r)return n.today;if(e>=r-p)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 _(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}export{u as i,g as n,h as r,_ 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{i,o as a}from"./url-q28QhI7l.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-drJUxxKP.js";import{r as c}from"./toast-z0toXu32.js";import{Fa as l,Fi as u,Ga as d,Hr as f,Ji as p,Li as m,Lo as h,N as g,Ni as _,Oa as v,Sa as y,St as b,Wo as x,Yi as S,Zo as C,ct as w,da as T,di as E,do as D,dt as O,fa as k,ft as A,ht as j,la as M,ma as N,qa as P,rt as F,ut as I,vt as L,wi as R,zr as z}from"./index-WAyKAilR.js";import{i as B,n as V,r as ee,t as te}from"./note-time-FSOjchic.js";import{a as ne,i as re,n as H,o as ie,r as ae,t as oe}from"./dist-Dzy3Q0ZH.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=b(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=E(`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,W.jsx)(P,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=E(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,W.jsx)(L,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function G(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 le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=B(),f=B(q),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,y=_>0?Math.min(g/_*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=E(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===T?D=t[13]:(D=E(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,W.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,W.jsx)(N,{className:`h-3.5 w-3.5`}):(0,W.jsx)(M,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,W.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${y}%`,P;t[23]===j?P=t[24]:(P=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=P);let F;t[25]!==_||t[26]!==p||t[27]!==g?(F=G(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=F):F=t[28];let I;t[29]===F?I=t[30]:(I=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:F}),t[29]=F,t[30]=I);let L;t[31]!==P||t[32]!==I?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==w||t[36]!==A?(R=(0,W.jsxs)(`div`,{className:w,onClick:K,children:[A,L]}),t[34]=L,t[35]=w,t[36]=A,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:l,todo:m,voice:y,media:d,bookmark:h,mixed:l,task:m};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,u=ue[n.kind]||l,d;t[0]!==s||t[1]!==n?(d=de(n,s),t[0]=s,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,U.useState)(Y),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==c?(h=ee(n.createdAt,m,c),t[3]=n.createdAt,t[4]=m,t[5]=c,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==r?(_=()=>r(n.id),v=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=E(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(b=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=u,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=b):b=t[18];let S;t[19]===n.title?S=t[20]:(S=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=S);let C=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,w;t[21]===C?w=t[22]:(w=E(`text-sm line-clamp-3`,C),t[21]=C,t[22]=w);let O;t[23]!==f||t[24]!==w?(O=(0,W.jsx)(`p`,{className:w,children:f}),t[23]=f,t[24]=w,t[25]=O):O=t[25];let A;t[26]!==O||t[27]!==S?(A=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,O]}),t[26]=O,t[27]=S,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(M=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,W.jsx)(T,{className:`h-4 w-4`}):(0,W.jsx)(k,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?s.unpin:s.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,W.jsxs)(H,{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]!==a?(I=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=I):I=t[42];let L;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,W.jsx)(x,{className:`h-4 w-4`}),t[43]=L):L=t[43];let z;t[44]!==s.archive||t[45]!==I?(z=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,s.archive]}),t[44]=s.archive,t[45]=I,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(ne,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,W.jsx)(R,{className:`h-4 w-4`}),t[51]=te):te=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[te,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==F||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(re,{children:[j,(0,W.jsx)(ae,{children:(0,W.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:pe,children:[F,z,B,G]})})]}),t[55]=F,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==A||t[60]!==K||t[61]!==b?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,A,K]}),t[59]=A,t[60]=K,t[61]=b,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.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,W.jsx)(k,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===g?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[67]=g,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==_||t[76]!==v?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:y,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=_,t[76]=v,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,l]=(0,U.useState)(``),[f,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)([]),D=(0,U.useRef)(0),O=(0,U.useRef)(null),k=(0,U.useRef)(null),A=(0,U.useCallback)(()=>{O.current&&=(clearInterval(O.current),null),k.current&&=(clearTimeout(k.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),v(0)},[]);(0,U.useEffect)(()=>()=>A(),[A]);let j=(0,U.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-D.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(A(),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{x(!1)}return}x(!1)},[A,i]),M=(0,U.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],D.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),v(0),O.current=setInterval(()=>{v(Math.round((Date.now()-D.current)/1e3))},250),k.current=setTimeout(()=>{j()},X)}catch{A()}},[A,i,h,j,b]),N=(0,U.useCallback)(()=>{if(h){j();return}M()},[h,M,j]),P=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||f)){m(!0),l(``);try{await n(t,e)}catch{l(t)}finally{m(!1),S.current?.focus()}}},[c,f,n]),F=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),P({navigate:!1}))},[P]),I=f||b;return(0,W.jsxs)(`div`,{className:E(`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`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:I||o||h,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,W.jsx)(d,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:N,disabled:I||s||f,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,W.jsx)(u,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(y,{className:`h-4 w-4`})}),h?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,W.jsx)(`textarea`,{ref:S,value:c,onChange:e=>l(e.target.value),onKeyDown:F,placeholder:e,rows:1,disabled:I,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,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||I||h,onClick:e=>void P({navigate:!e.shiftKey}),"aria-label":t,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!I&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(p,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,l]=(0,U.useReducer)(g,he),[u]=(0,U.useState)(ye),d=C(),p;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(p=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=p):p=e[4];let m=p,h;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(h=()=>w({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=h):h=e[8];let v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={keepPreviousData:!0},e[9]=v):v=e[9];let{data:y,mutate:b,isLoading:x}=o(m,h,v),T=x&&!y,D;e[10]===y?.items?D=e[11]:(D=y?.items??[],e[10]=y?.items,e[11]=D);let k=D,M=y?.total??0,N=z(ve),P=z(_e),L=M>0?t.noteCount.replace(`{{count}}`,String(M)):null,R,B;e[12]!==P||e[13]!==n||e[14]!==t.title||e[15]!==L||e[16]!==N?(R=()=>n?(N({startExtra:null,main:(0,W.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,f),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),L?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:L}):null]}),end:null}),()=>P()):(P(),()=>P()),B=[P,n,t.title,L,N],e[12]=P,e[13]=n,e[14]=t.title,e[15]=L,e[16]=N,e[17]=R,e[18]=B):(R=e[17],B=e[18]),(0,U.useLayoutEffect)(R,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let ne=ee,re;e[25]!==b||e[26]!==d?(re=async(e,t)=>{let n=await I(e,`web`);await b(),t?.navigate!==!1&&d(`/notes/${n.id}`)},e[25]=b,e[26]=d,e[27]=re):re=e[27];let H=re,ie;e[28]!==b||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await O(n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=b,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==b||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await A(e,n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=b,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===b?G=e[37]:(G=async(e,t)=>{await j(e,{pinned:t}),await b()},e[36]=b,e[37]=G);let le=G,K;e[38]===b?K=e[39]:(K=async e=>{await j(e,{status:`archived`}),await b()},e[38]=b,e[39]=K);let q=K,ue;e[40]===b?ue=e[41]:(ue=async e=>{await F(e),await b()},e[40]=b,e[41]=ue);let de=ue,fe;e[42]===d?fe=e[43]:(fe=e=>{d(`/notes/${e}`)},e[42]=d,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(_,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===l?Y=e[49]:(Y=e=>l({type:`patch`,patch:{search:e.target.value}}),e[48]=l,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==l||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{statusFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=l,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==l||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{kindFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=l,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==k||e[92]!==u||e[93]!==T||e[94]!==ne?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:T?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):k.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(_,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:k.map((e,n)=>{let r=n>0?te(k[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[te(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:E(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,u,ne)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:ne,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=k,e[92]=u,e[93]=T,e[94]=ne,e[95]=De):De=e[95];let Oe;e[96]!==H||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:H,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=H,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,o as a}from"./url-F3_D_6zZ.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s}from"./fetch-CMoWY2Si.js";import{r as c}from"./toast-z0toXu32.js";import{Fa as l,Fi as u,Ga as d,Hr as f,Ji as p,Li as m,Lo as h,N as g,Ni as _,Oa as v,Sa as y,St as b,Wo as x,Yi as S,Zo as C,ct as w,da as T,di as E,do as D,dt as O,fa as k,ft as A,ht as j,la as M,ma as N,qa as P,rt as F,ut as I,vt as L,wi as R,zr as z}from"./index-0HmunJW9.js";import{i as B,n as V,r as ee,t as te}from"./note-time-CF3vf1jm.js";import{a as ne,i as re,n as H,o as ie,r as ae,t as oe}from"./dist-CWm8hTXZ.js";var se=n(),U=e(t(),1),W=r();function ce(e){let t=(0,se.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,U.useState)(!1),s;t[0]!==r||t[1]!==n?(s=b(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=E(`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,W.jsx)(P,{className:`h-4 w-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,W.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=E(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,W.jsx)(L,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function G(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 le(e){let t=(0,se.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=B(),f=B(q),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,y=_>0?Math.min(g/_*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(b=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=E(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===T?D=t[13]:(D=E(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=D);let O=m?`Pause`:`Play`,k;t[14]!==h||t[15]!==m?(k=h?(0,W.jsx)(v,{className:`h-3.5 w-3.5 animate-spin`}):m?(0,W.jsx)(N,{className:`h-3.5 w-3.5`}):(0,W.jsx)(M,{className:`h-3.5 w-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=k):k=t[16];let A;t[17]!==x||t[18]!==C||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,W.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:D,"aria-label":O,children:k}),t[17]=x,t[18]=C,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${y}%`,P;t[23]===j?P=t[24]:(P=(0,W.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=P);let F;t[25]!==_||t[26]!==p||t[27]!==g?(F=G(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=F):F=t[28];let I;t[29]===F?I=t[30]:(I=(0,W.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:F}),t[29]=F,t[30]=I);let L;t[31]!==P||t[32]!==I?(L=(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[P,I]}),t[31]=P,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==w||t[36]!==A?(R=(0,W.jsxs)(`div`,{className:w,onClick:K,children:[A,L]}),t[34]=L,t[35]=w,t[36]=A,t[37]=R):R=t[37],R}function K(e){return e.stopPropagation()}function q(e){return e.toggle}var ue={thought:l,todo:m,voice:y,media:d,bookmark:h,mixed:l,task:m};function de(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function J(e){let t=(0,se.c)(78),{note:n,onPress:r,onPin:i,onArchive:a,onDelete:o,labels:s,timeLabels:c}=e,u=ue[n.kind]||l,d;t[0]!==s||t[1]!==n?(d=de(n,s),t[0]=s,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,U.useState)(Y),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==c?(h=ee(n.createdAt,m,c),t[3]=n.createdAt,t[4]=m,t[5]=c,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==r?(_=()=>r(n.id),v=e=>{(e.key===`Enter`||e.key===` `)&&r(n.id)},t[7]=n.id,t[8]=r,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=E(`group relative flex cursor-pointer flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,`transition-colors duration-150 ease-out hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[11]=y):y=t[11];let b;t[12]!==u||t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(b=n.coverAttachmentId?(0,W.jsx)(ce,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,W.jsx)(le,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-32 shrink-0`}):(0,W.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-fg-muted`}),t[12]=u,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=b):b=t[18];let S;t[19]===n.title?S=t[20]:(S=n.title&&(0,W.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=S);let C=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,w;t[21]===C?w=t[22]:(w=E(`text-sm line-clamp-3`,C),t[21]=C,t[22]=w);let O;t[23]!==f||t[24]!==w?(O=(0,W.jsx)(`p`,{className:w,children:f}),t[23]=f,t[24]=w,t[25]=O):O=t[25];let A;t[26]!==O||t[27]!==S?(A=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,O]}),t[26]=O,t[27]=S,t[28]=A):A=t[28];let j;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,W.jsx)(ie,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,W.jsx)(D,{className:`h-4 w-4`})})}),t[29]=j):j=t[29];let M;t[30]!==n.id||t[31]!==n.pinned||t[32]!==i?(M=()=>i(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=i,t[33]=M):M=t[33];let N;t[34]===n.pinned?N=t[35]:(N=n.pinned?(0,W.jsx)(T,{className:`h-4 w-4`}):(0,W.jsx)(k,{className:`h-4 w-4`}),t[34]=n.pinned,t[35]=N);let P=n.pinned?s.unpin:s.pin,F;t[36]!==M||t[37]!==N||t[38]!==P?(F=(0,W.jsxs)(H,{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]!==a?(I=()=>a(n.id),t[40]=n.id,t[41]=a,t[42]=I):I=t[42];let L;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,W.jsx)(x,{className:`h-4 w-4`}),t[43]=L):L=t[43];let z;t[44]!==s.archive||t[45]!==I?(z=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,s.archive]}),t[44]=s.archive,t[45]=I,t[46]=z):z=t[46];let B;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,W.jsx)(ne,{className:`my-1 h-px bg-edge-subtle`}),t[47]=B):B=t[47];let V;t[48]!==n.id||t[49]!==o?(V=()=>o(n.id),t[48]=n.id,t[49]=o,t[50]=V):V=t[50];let te;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,W.jsx)(R,{className:`h-4 w-4`}),t[51]=te):te=t[51];let G;t[52]!==s.delete||t[53]!==V?(G=(0,W.jsxs)(H,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:V,children:[te,s.delete]}),t[52]=s.delete,t[53]=V,t[54]=G):G=t[54];let K;t[55]!==F||t[56]!==z||t[57]!==G?(K=(0,W.jsxs)(re,{children:[j,(0,W.jsx)(ae,{children:(0,W.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:pe,children:[F,z,B,G]})})]}),t[55]=F,t[56]=z,t[57]=G,t[58]=K):K=t[58];let q;t[59]!==A||t[60]!==K||t[61]!==b?(q=(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,A,K]}),t[59]=A,t[60]=K,t[61]=b,t[62]=q):q=t[62];let J;t[63]===n.pinned?J=t[64]:(J=n.pinned&&(0,W.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,W.jsx)(k,{className:`h-3 w-3`})}),t[63]=n.pinned,t[64]=J);let X;t[65]===n.tags?X=t[66]:(X=n.tags?.map(fe),t[65]=n.tags,t[66]=X);let Z;t[67]===g?Z=t[68]:(Z=(0,W.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[67]=g,t[68]=Z);let Q;t[69]!==J||t[70]!==X||t[71]!==Z?(Q=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[J,X,Z]}),t[69]=J,t[70]=X,t[71]=Z,t[72]=Q):Q=t[72];let he;return t[73]!==q||t[74]!==Q||t[75]!==_||t[76]!==v?(he=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:y,children:[q,Q]}),t[73]=q,t[74]=Q,t[75]=_,t[76]=v,t[77]=he):he=t[77],he}function fe(e){return(0,W.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function pe(e){return e.stopPropagation()}function me(e){return e.stopPropagation()}function Y(){return Date.now()}var X=3e4;function Z(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Q({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1}){let[c,l]=(0,U.useState)(``),[f,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(null),C=(0,U.useRef)(null),w=(0,U.useRef)(null),T=(0,U.useRef)([]),D=(0,U.useRef)(0),O=(0,U.useRef)(null),k=(0,U.useRef)(null),A=(0,U.useCallback)(()=>{O.current&&=(clearInterval(O.current),null),k.current&&=(clearTimeout(k.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),v(0)},[]);(0,U.useEffect)(()=>()=>A(),[A]);let j=(0,U.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-D.current)/1e3)),n=e.mimeType||Z()||`audio/webm`,r=new Blob(T.current,{type:n});if(A(),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{x(!1)}return}x(!1)},[A,i]),M=(0,U.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Z(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],D.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),v(0),O.current=setInterval(()=>{v(Math.round((Date.now()-D.current)/1e3))},250),k.current=setTimeout(()=>{j()},X)}catch{A()}},[A,i,h,j,b]),N=(0,U.useCallback)(()=>{if(h){j();return}M()},[h,M,j]),P=(0,U.useCallback)(async e=>{let t=c.trim();if(!(!t||f)){m(!0),l(``);try{await n(t,e)}catch{l(t)}finally{m(!1),S.current?.focus()}}},[c,f,n]),F=(0,U.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),P({navigate:!1}))},[P]),I=f||b;return(0,W.jsxs)(`div`,{className:E(`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`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,W.jsx)(`button`,{type:`button`,onClick:r,disabled:I||o||h,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,W.jsx)(d,{className:`h-4 w-4`})}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:N,disabled:I||s||f,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,W.jsx)(u,{className:`h-4 w-4 fill-current`}):(0,W.jsx)(y,{className:`h-4 w-4`})}),h?(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,W.jsx)(`textarea`,{ref:S,value:c,onChange:e=>l(e.target.value),onKeyDown:F,placeholder:e,rows:1,disabled:I,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,W.jsx)(`button`,{type:`button`,disabled:!c.trim()||I||h,onClick:e=>void P({navigate:!e.shiftKey}),"aria-label":t,className:E(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,c.trim()&&!I&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,W.jsx)(p,{className:`h-4 w-4`})})]})}var he={statusFilter:`all`,kindFilter:`all`,search:``};function $(){let e=(0,se.c)(107),t=a(i(xe)).notes,n=!!s(be),[r,l]=(0,U.useReducer)(g,he),[u]=(0,U.useState)(ye),d=C(),p;e[0]!==n||e[1]!==r.kindFilter||e[2]!==r.search||e[3]!==r.statusFilter?(p=n?[`notes-list`,r.statusFilter,r.kindFilter,r.search]:null,e[0]=n,e[1]=r.kindFilter,e[2]=r.search,e[3]=r.statusFilter,e[4]=p):p=e[4];let m=p,h;e[5]!==r.kindFilter||e[6]!==r.search||e[7]!==r.statusFilter?(h=()=>w({status:r.statusFilter===`all`?void 0:r.statusFilter,kind:r.kindFilter===`all`?void 0:r.kindFilter,search:r.search||void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),e[5]=r.kindFilter,e[6]=r.search,e[7]=r.statusFilter,e[8]=h):h=e[8];let v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={keepPreviousData:!0},e[9]=v):v=e[9];let{data:y,mutate:b,isLoading:x}=o(m,h,v),T=x&&!y,D;e[10]===y?.items?D=e[11]:(D=y?.items??[],e[10]=y?.items,e[11]=D);let k=D,M=y?.total??0,N=z(ve),P=z(_e),L=M>0?t.noteCount.replace(`{{count}}`,String(M)):null,R,B;e[12]!==P||e[13]!==n||e[14]!==t.title||e[15]!==L||e[16]!==N?(R=()=>n?(N({startExtra:null,main:(0,W.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2 px-3 sm:px-5 xl:px-6`,f),children:[(0,W.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),L?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:L}):null]}),end:null}),()=>P()):(P(),()=>P()),B=[P,n,t.title,L,N],e[12]=P,e[13]=n,e[14]=t.title,e[15]=L,e[16]=N,e[17]=R,e[18]=B):(R=e[17],B=e[18]),(0,U.useLayoutEffect)(R,B);let ee;e[19]!==t.daysAgo||e[20]!==t.justNow||e[21]!==t.minutesAgo||e[22]!==t.today||e[23]!==t.yesterday?(ee={justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo},e[19]=t.daysAgo,e[20]=t.justNow,e[21]=t.minutesAgo,e[22]=t.today,e[23]=t.yesterday,e[24]=ee):ee=e[24];let ne=ee,re;e[25]!==b||e[26]!==d?(re=async(e,t)=>{let n=await I(e,`web`);await b(),t?.navigate!==!1&&d(`/notes/${n.id}`)},e[25]=b,e[26]=d,e[27]=re):re=e[27];let H=re,ie;e[28]!==b||e[29]!==t.imageUploadFailed||e[30]!==t.imageUploadFailedHint?(ie=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let n=e.files?.[0];if(n)try{await O(n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.imageUploadFailed,message:n instanceof Error?n.message:t.imageUploadFailedHint})}},e.click()},e[28]=b,e[29]=t.imageUploadFailed,e[30]=t.imageUploadFailedHint,e[31]=ie):ie=e[31];let ae=ie,oe;e[32]!==b||e[33]!==t.voiceUploadFailed||e[34]!==t.voiceUploadFailedHint?(oe=async(e,n)=>{try{await A(e,n,`web`),await b()}catch(e){let n=e;c({type:`error`,title:t.voiceUploadFailed,message:n instanceof Error?n.message:t.voiceUploadFailedHint})}},e[32]=b,e[33]=t.voiceUploadFailed,e[34]=t.voiceUploadFailedHint,e[35]=oe):oe=e[35];let ce=oe,G;e[36]===b?G=e[37]:(G=async(e,t)=>{await j(e,{pinned:t}),await b()},e[36]=b,e[37]=G);let le=G,K;e[38]===b?K=e[39]:(K=async e=>{await j(e,{status:`archived`}),await b()},e[38]=b,e[39]=K);let q=K,ue;e[40]===b?ue=e[41]:(ue=async e=>{await F(e),await b()},e[40]=b,e[41]=ue);let de=ue,fe;e[42]===d?fe=e[43]:(fe=e=>{d(`/notes/${e}`)},e[42]=d,e[43]=fe);let pe=fe;if(!n){let n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(_,{className:`h-10 w-10 text-fg-muted`}),e[44]=n):n=e[44];let r;return e[45]===t.needToken?r=e[46]:(r=(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[n,(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.needToken})]}),e[45]=t.needToken,e[46]=r),r}let me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,W.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),e[47]=me):me=e[47];let Y;e[48]===l?Y=e[49]:(Y=e=>l({type:`patch`,patch:{search:e.target.value}}),e[48]=l,e[49]=Y);let X;e[50]!==t.searchPlaceholder||e[51]!==Y||e[52]!==r.search?(X=(0,W.jsxs)(`div`,{className:`relative`,children:[me,(0,W.jsx)(`input`,{type:`search`,value:r.search,onChange:Y,placeholder:t.searchPlaceholder,className:`w-full rounded-xl border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`})]}),e[50]=t.searchPlaceholder,e[51]=Y,e[52]=r.search,e[53]=X):X=e[53];let Z;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Z=[`all`,`inbox`,`processed`,`archived`],e[54]=Z):Z=e[54];let $;e[55]!==l||e[56]!==t.filterAll||e[57]!==t.filterArchived||e[58]!==t.filterInbox||e[59]!==t.filterProcessed||e[60]!==r.statusFilter?($=Z.map(e=>{let n=e===`all`?t.filterAll:e===`inbox`?t.filterInbox:e===`processed`?t.filterProcessed:t.filterArchived;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{statusFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.statusFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[55]=l,e[56]=t.filterAll,e[57]=t.filterArchived,e[58]=t.filterInbox,e[59]=t.filterProcessed,e[60]=r.statusFilter,e[61]=$):$=e[61];let Se,Ce;e[62]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,W.jsx)(`div`,{className:`mx-1 h-4 w-px bg-edge-subtle`}),Ce=[`all`,`thought`,`todo`,`voice`,`media`,`bookmark`],e[62]=Se,e[63]=Ce):(Se=e[62],Ce=e[63]);let we;e[64]!==l||e[65]!==t.kindAll||e[66]!==t.kindBookmark||e[67]!==t.kindMedia||e[68]!==t.kindThought||e[69]!==t.kindTodo||e[70]!==t.kindVoice||e[71]!==r.kindFilter?(we=Ce.map(e=>{let n=e===`all`?t.kindAll:e===`thought`?t.kindThought:e===`todo`?t.kindTodo:e===`voice`?t.kindVoice:e===`media`?t.kindMedia:t.kindBookmark;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>l({type:`patch`,patch:{kindFilter:e}}),className:E(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,r.kindFilter===e?`bg-accent text-white`:`bg-surface-hover text-fg-muted hover:text-fg`),children:n},e)}),e[64]=l,e[65]=t.kindAll,e[66]=t.kindBookmark,e[67]=t.kindMedia,e[68]=t.kindThought,e[69]=t.kindTodo,e[70]=t.kindVoice,e[71]=r.kindFilter,e[72]=we):we=e[72];let Te;e[73]!==$||e[74]!==we?(Te=(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[$,Se,we]}),e[73]=$,e[74]=we,e[75]=Te):Te=e[75];let Ee;e[76]!==X||e[77]!==Te?(Ee=(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 p-4 pb-2`,children:[X,Te]}),e[76]=X,e[77]=Te,e[78]=Ee):Ee=e[78];let De;e[79]!==q||e[80]!==de||e[81]!==pe||e[82]!==le||e[83]!==t.archive||e[84]!==t.delete||e[85]!==t.imageNote||e[86]!==t.noNotes||e[87]!==t.noNotesDescription||e[88]!==t.noText||e[89]!==t.pin||e[90]!==t.unpin||e[91]!==k||e[92]!==u||e[93]!==T||e[94]!==ne?(De=(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-3 pb-24 [scrollbar-gutter:stable]`,children:T?(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:[1,2,3].map(ge)}):k.length===0?(0,W.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 py-16 text-center`,children:[(0,W.jsx)(_,{className:`h-8 w-8 text-fg-muted`}),(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:t.noNotes}),(0,W.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.noNotesDescription})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-3`,children:k.map((e,n)=>{let r=n>0?te(k[n-1].createdAt):null;return(0,W.jsxs)(`div`,{children:[te(e.createdAt)!==r&&(0,W.jsx)(`div`,{className:E(`pb-2 text-xs font-medium text-fg-muted`,n>0&&`pt-2`),children:V(e.createdAt,u,ne)}),(0,W.jsx)(J,{note:e,onPress:pe,onPin:le,onArchive:q,onDelete:de,timeLabels:ne,labels:{pin:t.pin,unpin:t.unpin,archive:t.archive,delete:t.delete,imageNote:t.imageNote,noText:t.noText}})]},e.id)})})}),e[79]=q,e[80]=de,e[81]=pe,e[82]=le,e[83]=t.archive,e[84]=t.delete,e[85]=t.imageNote,e[86]=t.noNotes,e[87]=t.noNotesDescription,e[88]=t.noText,e[89]=t.pin,e[90]=t.unpin,e[91]=k,e[92]=u,e[93]=T,e[94]=ne,e[95]=De):De=e[95];let Oe;e[96]!==H||e[97]!==ae||e[98]!==ce||e[99]!==t.quickCapturePlaceholder||e[100]!==t.recording||e[101]!==t.send?(Oe=(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-surface-panel from-60% via-surface-panel/90 to-transparent px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-6`,children:(0,W.jsx)(`div`,{className:`pointer-events-auto`,children:(0,W.jsx)(Q,{placeholder:t.quickCapturePlaceholder,sendLabel:t.send,onCapture:H,onImagePick:ae,onVoiceCapture:ce,recordingLabel:t.recording})})}),e[96]=H,e[97]=ae,e[98]=ce,e[99]=t.quickCapturePlaceholder,e[100]=t.recording,e[101]=t.send,e[102]=Oe):Oe=e[102];let ke;return e[103]!==Ee||e[104]!==De||e[105]!==Oe?(ke=(0,W.jsxs)(`div`,{className:`relative mx-auto flex h-full min-h-0 w-full max-w-3xl flex-1 flex-col overflow-hidden`,children:[Ee,De,Oe]}),e[103]=Ee,e[104]=De,e[105]=Oe,e[106]=ke):ke=e[106],ke}function ge(e){return(0,W.jsx)(`div`,{className:`h-24 animate-pulse rounded-xl bg-surface-hover`},e)}function _e(e){return e.clearPageHeader}function ve(e){return e.setPageHeader}function ye(){return Date.now()}function be(e){return e.token}function xe(e){return e.language}export{$ as NotesPage};
|