vite-hub 0.0.4 → 0.1.0
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 +130 -3
- package/dist/_internal/agent/invocations.d.ts +2 -0
- package/dist/_internal/agent/invocations.js +88 -0
- package/dist/_internal/agent/operations.d.ts +1 -0
- package/dist/_internal/agent/operations.js +2 -0
- package/dist/_internal/agent/runtime/invocations-dev.d.ts +1 -0
- package/dist/_internal/agent/runtime/invocations-dev.js +2 -0
- package/dist/_internal/agent/runtime/process.d.ts +1 -0
- package/dist/_internal/agent/runtime/process.js +2 -0
- package/dist/_internal/agent/server/registry.d.ts +1 -0
- package/dist/_internal/agent/server/registry.js +2 -0
- package/dist/_internal/auth/runtime/console.d.ts +1 -0
- package/dist/_internal/auth/runtime/console.js +2 -0
- package/dist/_internal/blob/operations.d.ts +1 -0
- package/dist/_internal/blob/operations.js +2 -0
- package/dist/_internal/comments/operations.d.ts +1 -0
- package/dist/_internal/comments/operations.js +2 -0
- package/dist/_internal/comments/runtime/console.d.ts +1 -0
- package/dist/_internal/comments/runtime/console.js +2 -0
- package/dist/_internal/content/operations.d.ts +1 -0
- package/dist/_internal/content/operations.js +2 -0
- package/dist/_internal/content/runtime/console.d.ts +1 -0
- package/dist/_internal/content/runtime/console.js +2 -0
- package/dist/_internal/database/runtime/state.d.ts +4 -3
- package/dist/_internal/database/runtime/state.js +4 -2
- package/dist/_internal/email/operations.d.ts +1 -0
- package/dist/_internal/email/operations.js +2 -0
- package/dist/_internal/email/runtime/console.d.ts +1 -0
- package/dist/_internal/email/runtime/console.js +2 -0
- package/dist/_internal/kv/operations.d.ts +1 -0
- package/dist/_internal/kv/operations.js +2 -0
- package/dist/_internal/kv/runtime/disabled-upstash.d.ts +2 -3
- package/dist/_internal/kv/runtime/disabled-upstash.js +2 -1
- package/dist/_internal/queue/operations.d.ts +1 -0
- package/dist/_internal/queue/operations.js +2 -0
- package/dist/_internal/rate-limit/operations.d.ts +1 -0
- package/dist/_internal/rate-limit/operations.js +2 -0
- package/dist/_internal/sandbox/task/runtime/state.d.ts +1 -0
- package/dist/_internal/sandbox/task/runtime/state.js +2 -0
- package/dist/_internal/schedule/operations.d.ts +1 -0
- package/dist/_internal/schedule/operations.js +2 -0
- package/dist/_internal/schedule/runtime/kv.d.ts +1 -0
- package/dist/_internal/schedule/runtime/kv.js +2 -0
- package/dist/_internal/task/operations.d.ts +5 -0
- package/dist/_internal/task/operations.js +2 -0
- package/dist/_internal/workflow/operations.d.ts +1 -0
- package/dist/_internal/workflow/operations.js +2 -0
- package/dist/_internal/workspace/operations.d.ts +1 -0
- package/dist/_internal/workspace/operations.js +2 -0
- package/dist/access-BhTe9yuV.js +516 -0
- package/dist/access-CBqnsYdj.d.ts +130 -0
- package/dist/agent/capabilities.d.ts +12 -8
- package/dist/agent/capabilities.js +50 -1
- package/dist/agent/invocations/d1.d.ts +1 -0
- package/dist/agent/invocations/d1.js +2 -0
- package/dist/agent/invocations/database.d.ts +2 -0
- package/dist/agent/invocations/database.js +91 -0
- package/dist/agent/observability.d.ts +1 -0
- package/dist/agent/observability.js +2 -0
- package/dist/agent/process-host.d.ts +1 -0
- package/dist/agent/process-host.js +2 -0
- package/dist/agent/server/github.d.ts +1 -0
- package/dist/agent/server/github.js +2 -0
- package/dist/agent/vite.d.ts +1 -0
- package/dist/agent/vite.js +2 -0
- package/dist/agent-invocations.post-CFKMEy-h.js +432 -0
- package/dist/agent.d.ts +8 -3
- package/dist/agent.js +25 -7
- package/dist/agents-BNmuN4Qa.d.ts +99 -0
- package/dist/agents-CVehuMFA.js +118 -0
- package/dist/auth/console-runtime.d.ts +1 -0
- package/dist/auth/console-runtime.js +2 -0
- package/dist/auth/console.d.ts +1 -0
- package/dist/auth/console.js +2 -0
- package/dist/auth/presets.d.ts +1 -0
- package/dist/auth/presets.js +2 -0
- package/dist/auth-BSSM-qh0.js +700 -0
- package/dist/auth-CG8tmgH7.d.ts +106 -0
- package/dist/auth-cloudflare-access-CE8xUzhY.d.ts +50 -0
- package/dist/auth-inline-config--vlclzm3.js +18 -0
- package/dist/auth-inline-config-R6q_4Iwo.d.ts +30 -0
- package/dist/auth-path-B7Ssonj-.js +49 -0
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +300 -10
- package/dist/blob/client.d.ts +1 -0
- package/dist/blob/client.js +2 -0
- package/dist/blob/media.d.ts +1 -0
- package/dist/blob/media.js +2 -0
- package/dist/blob/vue.d.ts +1 -0
- package/dist/blob/vue.js +2 -0
- package/dist/blob-D9v5Djxw.d.ts +7 -0
- package/dist/cloudflare-env-CIZCKabz.js +70 -0
- package/dist/comments/anchor.d.ts +1 -0
- package/dist/comments/anchor.js +2 -0
- package/dist/comments/client.d.ts +1 -0
- package/dist/comments/client.js +2 -0
- package/dist/comments/database/postgres.d.ts +1 -0
- package/dist/comments/database/postgres.js +2 -0
- package/dist/comments/database.d.ts +1 -0
- package/dist/comments/database.js +2 -0
- package/dist/comments/realtime.d.ts +1 -0
- package/dist/comments/realtime.js +2 -0
- package/dist/comments/rpc.d.ts +1 -0
- package/dist/comments/rpc.js +2 -0
- package/dist/comments/runtime/auth.d.ts +1 -0
- package/dist/comments/runtime/auth.js +2 -0
- package/dist/comments/runtime.d.ts +1 -0
- package/dist/comments/runtime.js +2 -0
- package/dist/comments/server.d.ts +1 -0
- package/dist/comments/server.js +2 -0
- package/dist/comments-overlay/loader.BcGn0Hsk.js +1 -0
- package/dist/comments-overlay/overlay.D7vmaSrE.js +2 -0
- package/dist/comments.d.ts +1 -0
- package/dist/comments.js +2 -0
- package/dist/connections/agent.d.ts +1 -0
- package/dist/connections/agent.js +2 -0
- package/dist/connections/chatgpt.d.ts +1 -0
- package/dist/connections/chatgpt.js +2 -0
- package/dist/connections/google.d.ts +1 -0
- package/dist/connections/google.js +2 -0
- package/dist/connections/http.d.ts +1 -0
- package/dist/connections/http.js +2 -0
- package/dist/connections/server.d.ts +1 -0
- package/dist/connections/server.js +2 -0
- package/dist/connections.d.ts +1 -0
- package/dist/connections.js +2 -0
- package/dist/console/auth-client.d.ts +8 -0
- package/dist/console/auth-client.js +6 -0
- package/dist/console/auth-cloudflare-access.d.ts +2 -0
- package/dist/console/auth-cloudflare-access.js +116 -0
- package/dist/console/auth-inline.d.ts +6 -0
- package/dist/console/auth-inline.js +107 -0
- package/dist/console/auth.d.ts +2 -0
- package/dist/console/auth.js +2 -0
- package/dist/console/runtime/client/appearance.d.ts +62 -0
- package/dist/console/runtime/client/appearance.js +87 -0
- package/dist/console/runtime/client/auth-management.ts +81 -0
- package/dist/console/runtime/client/blob-media.d.ts +46 -0
- package/dist/console/runtime/client/blob-media.js +257 -0
- package/dist/console/runtime/client/build.d.ts +14 -0
- package/dist/console/runtime/client/build.js +68 -0
- package/dist/console/runtime/client/connections-management.d.ts +68 -0
- package/dist/console/runtime/client/connections-management.js +201 -0
- package/dist/console/runtime/client/documents.d.ts +430 -0
- package/dist/console/runtime/client/documents.js +501 -0
- package/dist/console/runtime/client/editor.d.ts +82 -0
- package/dist/console/runtime/client/editor.js +248 -0
- package/dist/console/runtime/client/env-groups.d.ts +28 -0
- package/dist/console/runtime/client/env-groups.js +39 -0
- package/dist/console/runtime/client/env-management.d.ts +20 -0
- package/dist/console/runtime/client/env-management.js +84 -0
- package/dist/console/runtime/client/env-status.d.ts +6 -0
- package/dist/console/runtime/client/env-status.js +10 -0
- package/dist/console/runtime/client/format.d.ts +32 -0
- package/dist/console/runtime/client/format.js +109 -0
- package/dist/console/runtime/client/invocation-deletion.d.ts +17 -0
- package/dist/console/runtime/client/invocation-deletion.js +25 -0
- package/dist/console/runtime/client/invocation.d.ts +28 -0
- package/dist/console/runtime/client/invocation.js +81 -0
- package/dist/console/runtime/client/live.d.ts +69 -0
- package/dist/console/runtime/client/live.js +165 -0
- package/dist/console/runtime/client/mcp.d.ts +9 -0
- package/dist/console/runtime/client/mcp.js +14 -0
- package/dist/console/runtime/client/media-library.d.ts +207 -0
- package/dist/console/runtime/client/media-library.js +243 -0
- package/dist/console/runtime/client/media-uploads.d.ts +33 -0
- package/dist/console/runtime/client/media-uploads.js +97 -0
- package/dist/console/runtime/client/media.d.ts +73 -0
- package/dist/console/runtime/client/media.js +13 -0
- package/dist/console/runtime/client/operation-view.d.ts +17 -0
- package/dist/console/runtime/client/operation-view.js +85 -0
- package/dist/console/runtime/client/presence.d.ts +102 -0
- package/dist/console/runtime/client/presence.js +269 -0
- package/dist/console/runtime/client/preview.d.ts +78 -0
- package/dist/console/runtime/client/preview.js +115 -0
- package/dist/console/runtime/client/problem.d.ts +19 -0
- package/dist/console/runtime/client/problem.js +59 -0
- package/dist/console/runtime/client/publish.d.ts +12 -0
- package/dist/console/runtime/client/publish.js +18 -0
- package/dist/console/runtime/client/rate-limit.d.ts +36 -0
- package/dist/console/runtime/client/rate-limit.js +96 -0
- package/dist/console/runtime/client/read-only.d.ts +9 -0
- package/dist/console/runtime/client/read-only.js +12 -0
- package/dist/console/runtime/client/request.d.ts +61 -8
- package/dist/console/runtime/client/request.js +394 -56
- package/dist/console/runtime/client/schedule-run.d.ts +13 -0
- package/dist/console/runtime/client/schedule-run.js +47 -0
- package/dist/console/runtime/client/schema-form.d.ts +2 -0
- package/dist/console/runtime/client/schema-form.js +296 -0
- package/dist/console/runtime/client/sections.d.ts +22 -8
- package/dist/console/runtime/client/sections.js +47 -4
- package/dist/console/runtime/client/sign-in.d.ts +21 -0
- package/dist/console/runtime/client/sign-in.js +16 -0
- package/dist/console/runtime/client/time.d.ts +29 -3
- package/dist/console/runtime/client/time.js +99 -1
- package/dist/console/runtime/client/toast.d.ts +39 -0
- package/dist/console/runtime/client/toast.js +35 -0
- package/dist/console/runtime/client/workflow.d.ts +20 -0
- package/dist/console/runtime/client/workflow.js +79 -0
- package/dist/console/runtime/components/console-agent-list.ts +61 -0
- package/dist/console/runtime/components/console-app.vue +768 -463
- package/dist/console/runtime/components/console-auth-action.vue +239 -0
- package/dist/console/runtime/components/console-auth-activity.vue +166 -0
- package/dist/console/runtime/components/console-auth-chart.vue +102 -0
- package/dist/console/runtime/components/console-auth-detail.vue +406 -0
- package/dist/console/runtime/components/console-auth-event-list.vue +79 -0
- package/dist/console/runtime/components/console-auth-event-setup.vue +39 -0
- package/dist/console/runtime/components/console-auth-overview.vue +107 -0
- package/dist/console/runtime/components/console-auth-user-events.vue +65 -0
- package/dist/console/runtime/components/console-auth.vue +649 -0
- package/dist/console/runtime/components/console-blob-detail.vue +93 -0
- package/dist/console/runtime/components/console-blob.vue +106 -301
- package/dist/console/runtime/components/console-comark-component.vue +108 -0
- package/dist/console/runtime/components/console-connect-agent.vue +59 -0
- package/dist/console/runtime/components/console-connection-state.vue +43 -0
- package/dist/console/runtime/components/console-connection.ts +18 -0
- package/dist/console/runtime/components/console-connections-activity.vue +76 -0
- package/dist/console/runtime/components/console-connections-approvals.vue +169 -0
- package/dist/console/runtime/components/console-connections-details.vue +295 -0
- package/dist/console/runtime/components/console-connections.vue +296 -0
- package/dist/console/runtime/components/console-database-model.ts +51 -6
- package/dist/console/runtime/components/console-database.vue +268 -335
- package/dist/console/runtime/components/console-definitions.vue +371 -305
- package/dist/console/runtime/components/console-document-dashboard.vue +492 -0
- package/dist/console/runtime/components/console-document-diff.vue +43 -0
- package/dist/console/runtime/components/console-document-editor.vue +2605 -0
- package/dist/console/runtime/components/console-document-history.vue +118 -0
- package/dist/console/runtime/components/console-document-list.vue +577 -0
- package/dist/console/runtime/components/console-document-preview.vue +422 -0
- package/dist/console/runtime/components/console-document-settings.vue +108 -0
- package/dist/console/runtime/components/console-documents.vue +480 -0
- package/dist/console/runtime/components/console-env-access.vue +151 -0
- package/dist/console/runtime/components/console-env-activity.vue +89 -0
- package/dist/console/runtime/components/console-env-details.vue +68 -0
- package/dist/console/runtime/components/console-env-managed.vue +203 -0
- package/dist/console/runtime/components/console-env.vue +301 -0
- package/dist/console/runtime/components/console-frame.vue +243 -1
- package/dist/console/runtime/components/console-home.vue +548 -152
- package/dist/console/runtime/components/console-invocation-composer.vue +159 -0
- package/dist/console/runtime/components/console-kv.vue +219 -223
- package/dist/console/runtime/components/console-loading.vue +28 -0
- package/dist/console/runtime/components/console-mark.vue +3 -8
- package/dist/console/runtime/components/console-markdown-editor.vue +705 -0
- package/dist/console/runtime/components/console-media-browser.vue +986 -0
- package/dist/console/runtime/components/console-media-crops.vue +167 -0
- package/dist/console/runtime/components/console-media-detail.vue +282 -0
- package/dist/console/runtime/components/console-media-dialog.vue +74 -0
- package/dist/console/runtime/components/console-media-field.vue +185 -0
- package/dist/console/runtime/components/console-media-focal.vue +137 -0
- package/dist/console/runtime/components/console-media-library.vue +125 -0
- package/dist/console/runtime/components/console-media-move.vue +160 -0
- package/dist/console/runtime/components/console-media-picker.vue +167 -0
- package/dist/console/runtime/components/console-media-uploads.vue +72 -0
- package/dist/console/runtime/components/console-new-chat.ts +27 -0
- package/dist/console/runtime/components/console-operation-view.vue +114 -0
- package/dist/console/runtime/components/console-page-header.vue +50 -0
- package/dist/console/runtime/components/console-page-toolbar.vue +28 -0
- package/dist/console/runtime/components/console-presence-avatars.vue +73 -0
- package/dist/console/runtime/components/console-property-list.vue +36 -0
- package/dist/console/runtime/components/console-property-row.vue +58 -0
- package/dist/console/runtime/components/console-rail.vue +392 -0
- package/dist/console/runtime/components/console-rate-limit.vue +167 -0
- package/dist/console/runtime/components/console-relative-time.vue +74 -0
- package/dist/console/runtime/components/console-schema-field.vue +504 -0
- package/dist/console/runtime/components/console-schema-form.vue +77 -0
- package/dist/console/runtime/components/console-schema-list.vue +158 -0
- package/dist/console/runtime/components/console-search.vue +473 -57
- package/dist/console/runtime/components/console-section-icon.vue +21 -0
- package/dist/console/runtime/components/console-seo-panel.vue +261 -0
- package/dist/console/runtime/components/console-session-actions.vue +160 -0
- package/dist/console/runtime/components/console-session-bootstrap.ts +3 -1
- package/dist/console/runtime/components/console-session-cancel.vue +90 -0
- package/dist/console/runtime/components/console-session-code-language.ts +32 -0
- package/dist/console/runtime/components/console-session-code-preview.vue +57 -39
- package/dist/console/runtime/components/console-session-inspector.vue +221 -184
- package/dist/console/runtime/components/console-session-loading.vue +7 -12
- package/dist/console/runtime/components/console-session-navbar.vue +70 -23
- package/dist/console/runtime/components/console-session-trace.vue +9 -11
- package/dist/console/runtime/components/console-session.css +353 -90
- package/dist/console/runtime/components/console-setup-hint.vue +20 -0
- package/dist/console/runtime/components/console-state.vue +165 -0
- package/dist/console/runtime/components/console-status.vue +25 -0
- package/dist/console/runtime/components/console-toaster.vue +66 -0
- package/dist/console/runtime/components/console-usage-chart.vue +208 -0
- package/dist/console/runtime/components/console-usage-model-detail.vue +144 -0
- package/dist/console/runtime/components/console-usage-model.ts +368 -0
- package/dist/console/runtime/components/console-usage-share-bar.vue +48 -0
- package/dist/console/runtime/components/console-usage.vue +781 -498
- package/dist/console/runtime/components/console-value.vue +35 -0
- package/dist/console/runtime/components/console-workflow-actions.vue +183 -0
- package/dist/console/runtime/components/console-workspace-file.ts +12 -0
- package/dist/console/runtime/components/console-workspace-history.vue +77 -0
- package/dist/console/runtime/components/console-wrap.ts +10 -0
- package/dist/console/runtime/components/invocation/agent-capability-inspector.ts +166 -0
- package/dist/console/runtime/components/invocation/agent-invocation-list.ts +276 -0
- package/dist/console/runtime/components/invocation/agent-invocation-timeline.ts +120 -0
- package/dist/console/runtime/components/invocation/agent-invocation.ts +1968 -0
- package/dist/console/runtime/components/invocation/index.ts +8 -0
- package/dist/console/runtime/components/invocation/internal/brand-icons.ts +65 -0
- package/dist/console/runtime/components/invocation/internal/channel-icon.ts +51 -0
- package/dist/console/runtime/components/invocation/internal/invocation-activity.ts +663 -0
- package/dist/console/runtime/components/invocation/internal/invocation-brand.ts +148 -0
- package/dist/console/runtime/components/invocation/internal/invocation-conversation.ts +162 -0
- package/dist/console/runtime/components/invocation/internal/payload-text.ts +29 -0
- package/dist/console/runtime/components/invocation/internal/runtime-type.ts +61 -0
- package/dist/console/runtime/components/invocation/internal/url.ts +8 -0
- package/dist/console/runtime/components/invocation/invocation-display.ts +56 -0
- package/dist/console/runtime/components/invocation/invocation.css +2748 -0
- package/dist/console/runtime/components/invocation/nuxt/AgentInvocation.ts +1 -0
- package/dist/console/runtime/components/invocation/nuxt/AgentInvocationInspector.ts +1 -0
- package/dist/console/runtime/components/invocation/nuxt/AgentInvocationList.ts +1 -0
- package/dist/console/runtime/components/invocation/types.ts +89 -0
- package/dist/console/runtime/console-route.d.ts +15 -9
- package/dist/console/runtime/console-route.js +36 -24
- package/dist/console/runtime/definitions.d.ts +2 -2
- package/dist/console/runtime/definitions.js +290 -11
- package/dist/console/runtime/page/loader.js +22 -0
- package/dist/console/runtime/public/console/assets/console-app-CUTwptGe.css +1 -0
- package/dist/console/runtime/public/console/assets/console-auth-B_XoOPaB.css +1 -0
- package/dist/console/runtime/public/console/assets/console-database-BbZ7J_Mh.css +1 -0
- package/dist/console/runtime/public/console/assets/console-documents-BV1adqXa.css +1 -0
- package/dist/console/runtime/public/console/assets/console-home-DYNL7OZH.css +1 -0
- package/dist/console/runtime/public/console/assets/console-logs-BJxR8DcR.css +1 -0
- package/dist/console/runtime/public/console/assets/console-media-browser-Dqm8kLKS.css +1 -0
- package/dist/console/runtime/public/console/assets/console-search-DnK-eWOO.css +1 -0
- package/dist/console/runtime/public/console/assets/katex-BztabbvB.css +1 -0
- package/dist/console/runtime/public/console/chunks/Alert-A44KLyli.js +111 -0
- package/dist/console/runtime/public/console/chunks/Button-B-5IVAVN.js +1 -0
- package/dist/console/runtime/public/console/chunks/Checkbox-B6MMrqB7.js +1 -0
- package/dist/console/runtime/public/console/chunks/DashboardSidebar-D1tMg0lD.js +1 -0
- package/dist/console/runtime/public/console/chunks/Empty-DSuwpzRi.js +1 -0
- package/dist/console/runtime/public/console/chunks/FormField-C1QuQLPv.js +1 -0
- package/dist/console/runtime/public/console/chunks/Icon-DDNuGxPl.js +1 -0
- package/dist/console/runtime/public/console/chunks/Modal-BCfHPiul.js +1 -0
- package/dist/console/runtime/public/console/chunks/Popover-BIzgqwDJ.js +1 -0
- package/dist/console/runtime/public/console/chunks/RovingFocusItem-BQiInss6.js +1 -0
- package/dist/console/runtime/public/console/chunks/Select-CLtjSqJ4.js +1 -0
- package/dist/console/runtime/public/console/chunks/Slideover-CHzYTMLO.js +1 -0
- package/dist/console/runtime/public/console/chunks/Switch-0VgVgteh.js +1 -0
- package/dist/console/runtime/public/console/chunks/Table-dr_6Rarq.js +4 -0
- package/dist/console/runtime/public/console/chunks/Tabs-BbKlHRNF.js +1 -0
- package/dist/console/runtime/public/console/chunks/Textarea-DEoHK30I.js +1 -0
- package/dist/console/runtime/public/console/chunks/actionscript-3-Cs6JJXT5.js +1 -0
- package/dist/console/runtime/public/console/chunks/ada-X3Y2mlq2.js +1 -0
- package/dist/console/runtime/public/console/chunks/ahk-DwADkxyd.js +1 -0
- package/dist/console/runtime/public/console/chunks/ahk2-_6rzW9BS.js +1 -0
- package/dist/console/runtime/public/console/chunks/angular-html-_r0QlJAV.js +1 -0
- package/dist/console/runtime/public/console/chunks/angular-ts-BdSNcv2x.js +1 -0
- package/dist/console/runtime/public/console/chunks/apex-KFGFyKwG.js +1 -0
- package/dist/console/runtime/public/console/chunks/apl-CD0B-dgl.js +1 -0
- package/dist/console/runtime/public/console/chunks/asciidoc-SCjQUq34.js +1 -0
- package/dist/console/runtime/public/console/chunks/astro-BuBCLsVb.js +1 -0
- package/dist/console/runtime/public/console/chunks/bat-qdxAdBWQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/beancount-C2IN4Vk8.js +1 -0
- package/dist/console/runtime/public/console/chunks/bird2-CYIUgYqB.js +1 -0
- package/dist/console/runtime/public/console/chunks/blade-3tdbLOEu.js +1 -0
- package/dist/console/runtime/public/console/chunks/bsl-_VjlB9mv.js +1 -0
- package/dist/console/runtime/public/console/chunks/c-C1MtNG6h.js +1 -0
- package/dist/console/runtime/public/console/chunks/c3-D0apG41V.js +1 -0
- package/dist/console/runtime/public/console/chunks/cairo-DLTphjLi.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-frappe-D20KODDN-C9Q5zVZY.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-latte-CtsyrtPq.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-latte-eGLVHIUJ-CtsyrtPq.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-bQGch4PY-R8nAf1vR.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-mocha-Bes8-0Mr-DjuaAJKi.js +1 -0
- package/dist/console/runtime/public/console/chunks/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/dist/console/runtime/public/console/chunks/chapel-BzgYECs1.js +1 -0
- package/dist/console/runtime/public/console/chunks/clarity-CtfBBspg.js +1 -0
- package/dist/console/runtime/public/console/chunks/cobol-DObdkphG.js +1 -0
- package/dist/console/runtime/public/console/chunks/code-view-J4OsgEdh-B89t0LaT.js +2 -0
- package/dist/console/runtime/public/console/chunks/coffee-C94_xO1a.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-app-C50IIheA.js +85 -0
- package/dist/console/runtime/public/console/chunks/console-auth-D4zc7Haw.js +2 -0
- package/dist/console/runtime/public/console/chunks/console-blob-CAJwJy4D.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-channels-DZQwinKY.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-connections-Buk5WGxr.js +6 -0
- package/dist/console/runtime/public/console/chunks/console-database-CKc8H8FN.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-definitions-NriWGCYI.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-documents-BnBRfM_7.js +314 -0
- package/dist/console/runtime/public/console/chunks/console-env-CLmYhbox.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-home-smb5yMSF.js +2 -0
- package/dist/console/runtime/public/console/chunks/console-kv-B1tLQHM9.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-logs-CjxEiek5.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-media-browser-o4BQu9KZ.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-operation-view-CGxpuMSQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-page-header-DDAcJBpl.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-page-toolbar-CvYwaKTR.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-property-list-96rL7wos.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-relative-time-RB6-yiul.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-search-D4EVLUeN.js +5 -0
- package/dist/console/runtime/public/console/chunks/console-setup-hint-8TRzgkby.js +1 -0
- package/dist/console/runtime/public/console/chunks/console-status-DH5NgNAQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/coq-CGaSfhwR.js +1 -0
- package/dist/console/runtime/public/console/chunks/core-CD3So4L1.js +12 -0
- package/dist/console/runtime/public/console/chunks/cpp-DMjdIJj9.js +1 -0
- package/dist/console/runtime/public/console/chunks/crystal-Czr8rWWf.js +1 -0
- package/dist/console/runtime/public/console/chunks/csharp-dmMxLVLW.js +1 -0
- package/dist/console/runtime/public/console/chunks/css-B6l3ejVl.js +1 -0
- package/dist/console/runtime/public/console/chunks/css-BDmUYLyz.js +1 -0
- package/dist/console/runtime/public/console/chunks/dart-CHZY9Xhz.js +1 -0
- package/dist/console/runtime/public/console/chunks/defu-DSJ9I3OW.js +1 -0
- package/dist/console/runtime/public/console/chunks/dist-Cfws9tG7.js +1 -0
- package/dist/console/runtime/public/console/chunks/docker-sj3NF4m5.js +1 -0
- package/dist/console/runtime/public/console/chunks/dockerfile-C147k2YT.js +1 -0
- package/dist/console/runtime/public/console/chunks/dotenv-CuH5my32.js +1 -0
- package/dist/console/runtime/public/console/chunks/edge-D8F7z1FE.js +1 -0
- package/dist/console/runtime/public/console/chunks/elixir-DH2VBix4.js +1 -0
- package/dist/console/runtime/public/console/chunks/elm-D2qVkg3B.js +1 -0
- package/dist/console/runtime/public/console/chunks/emacs-lisp-DR2vtWaj.js +1 -0
- package/dist/console/runtime/public/console/chunks/engine-compile-DS_05kfr.js +141 -0
- package/dist/console/runtime/public/console/chunks/engine-javascript-Dymre4AG.js +1 -0
- package/dist/console/runtime/public/console/chunks/env-management-CNydNlRX.js +1 -0
- package/dist/console/runtime/public/console/chunks/erb-B_-2w0Bg.js +1 -0
- package/dist/console/runtime/public/console/chunks/erlang-Cphh6RMH.js +1 -0
- package/dist/console/runtime/public/console/chunks/field-a8AvhnKh-Da49LBBi.js +1 -0
- package/dist/console/runtime/public/console/chunks/file-tree-2PXztdQ7.js +1266 -0
- package/dist/console/runtime/public/console/chunks/format-Bm0hCiYP.js +1 -0
- package/dist/console/runtime/public/console/chunks/fortran-fixed-form-DEKoE2YW.js +1 -0
- package/dist/console/runtime/public/console/chunks/fsharp-D13ZGOAj.js +1 -0
- package/dist/console/runtime/public/console/chunks/gdresource-xMC7jr7x.js +1 -0
- package/dist/console/runtime/public/console/chunks/gdscript-DYvRD3hg.js +1 -0
- package/dist/console/runtime/public/console/chunks/git-commit-BSykSTBG.js +1 -0
- package/dist/console/runtime/public/console/chunks/git-rebase-CNMiHM3o.js +1 -0
- package/dist/console/runtime/public/console/chunks/github-dark-default-Dk3Gj2bt.js +1 -0
- package/dist/console/runtime/public/console/chunks/github-light-default-CC-h3suv.js +1 -0
- package/dist/console/runtime/public/console/chunks/glimmer-js-CwoxQgjc.js +1 -0
- package/dist/console/runtime/public/console/chunks/glimmer-ts-DpQshMGP.js +1 -0
- package/dist/console/runtime/public/console/chunks/glsl-vvkIs2ij.js +1 -0
- package/dist/console/runtime/public/console/chunks/gn-CAXYAgV-.js +1 -0
- package/dist/console/runtime/public/console/chunks/graphql-ChhlowTj.js +1 -0
- package/dist/console/runtime/public/console/chunks/hack--5hWxtov.js +1 -0
- package/dist/console/runtime/public/console/chunks/haml-DOOWKVAn.js +1 -0
- package/dist/console/runtime/public/console/chunks/handlebars-CrRNKWA2.js +1 -0
- package/dist/console/runtime/public/console/chunks/haxe-C8oCnwJJ.js +1 -0
- package/dist/console/runtime/public/console/chunks/html-DrTLqG4V.js +1 -0
- package/dist/console/runtime/public/console/chunks/html-DwfkhSwv.js +1 -0
- package/dist/console/runtime/public/console/chunks/html-derivative-JoBPPO4R.js +1 -0
- package/dist/console/runtime/public/console/chunks/http-DKXz4J4h.js +1 -0
- package/dist/console/runtime/public/console/chunks/hurl-m2MDTJJI.js +1 -0
- package/dist/console/runtime/public/console/chunks/hxml-Dcm88srW.js +1 -0
- package/dist/console/runtime/public/console/chunks/icons-CDKEwnTx.js +1 -0
- package/dist/console/runtime/public/console/chunks/java-DJ6V61UG.js +1 -0
- package/dist/console/runtime/public/console/chunks/javascript-DOney_iy.js +1 -0
- package/dist/console/runtime/public/console/chunks/javascript-DhBmaPc1.js +1 -0
- package/dist/console/runtime/public/console/chunks/jinja-CywE_Am-.js +1 -0
- package/dist/console/runtime/public/console/chunks/jison-D8DWHhWo.js +1 -0
- package/dist/console/runtime/public/console/chunks/json-B6nR7qG1.js +1 -0
- package/dist/console/runtime/public/console/chunks/json-D0JmQrvp.js +1 -0
- package/dist/console/runtime/public/console/chunks/jsonc-D4AqO_oZ.js +1 -0
- package/dist/console/runtime/public/console/chunks/jsx-Dro3SMhn.js +1 -0
- package/dist/console/runtime/public/console/chunks/jsx-_Ptt0Qo0.js +1 -0
- package/dist/console/runtime/public/console/chunks/julia-CruTRp58.js +1 -0
- package/dist/console/runtime/public/console/chunks/just-aBPtXuIr.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-dragon-Bozd7klA.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-dragon-DgDvwi3B-Bozd7klA.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BgoQro20-BmuOG9ZW.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-wave-BML5mF2J.js +1 -0
- package/dist/console/runtime/public/console/chunks/kanagawa-wave-DgXEowHs-BML5mF2J.js +1 -0
- package/dist/console/runtime/public/console/chunks/katex-CF6MVAvO.js +257 -0
- package/dist/console/runtime/public/console/chunks/latex-DV9xWg1U.js +1 -0
- package/dist/console/runtime/public/console/chunks/liquid-B62JT9qD.js +1 -0
- package/dist/console/runtime/public/console/chunks/llvm-DqHOMS-s.js +1 -0
- package/dist/console/runtime/public/console/chunks/lua-939mH6Rk.js +1 -0
- package/dist/console/runtime/public/console/chunks/luau-VGWVLoqX.js +1 -0
- package/dist/console/runtime/public/console/chunks/make-PPdVpZzp.js +1 -0
- package/dist/console/runtime/public/console/chunks/markdown-BK4fiefF.js +1 -0
- package/dist/console/runtime/public/console/chunks/marko-BjHTe8yB.js +1 -0
- package/dist/console/runtime/public/console/chunks/mdc-Dsg_kn4_.js +1 -0
- package/dist/console/runtime/public/console/chunks/mdx-l4Hs_llf.js +1 -0
- package/dist/console/runtime/public/console/chunks/mermaid-BxpfTIzt.js +1 -0
- package/dist/console/runtime/public/console/chunks/mojo-fg40_ntQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/monokai-BscAjiQZ.js +1 -0
- package/dist/console/runtime/public/console/chunks/monokai-CfFRWUNl-BscAjiQZ.js +1 -0
- package/dist/console/runtime/public/console/chunks/moonbit-D9W784E_.js +1 -0
- package/dist/console/runtime/public/console/chunks/move-BYnGhZoM.js +1 -0
- package/dist/console/runtime/public/console/chunks/nextflow-CSgcYZcx.js +1 -0
- package/dist/console/runtime/public/console/chunks/nextflow-groovy-D7IRt6Pp.js +1 -0
- package/dist/console/runtime/public/console/chunks/nginx-H6FvQZhW.js +1 -0
- package/dist/console/runtime/public/console/chunks/nim-C7z2AtKH.js +1 -0
- package/dist/console/runtime/public/console/chunks/nsis-CjNLYCLg.js +1 -0
- package/dist/console/runtime/public/console/chunks/nushell--0fT3PI1.js +1 -0
- package/dist/console/runtime/public/console/chunks/one-dark-pro-C6YyR8OD.js +1 -0
- package/dist/console/runtime/public/console/chunks/one-dark-pro-zDovGosB-C6YyR8OD.js +1 -0
- package/dist/console/runtime/public/console/chunks/org-DYUOjVHR.js +1 -0
- package/dist/console/runtime/public/console/chunks/patch-diff-CD7Eu2gO.js +1 -0
- package/dist/console/runtime/public/console/chunks/perl-BAFITj1w.js +1 -0
- package/dist/console/runtime/public/console/chunks/php-C1opCiHJ.js +1 -0
- package/dist/console/runtime/public/console/chunks/pierre-code-view-T7V67hwT-XcPks0Ko.js +168 -0
- package/dist/console/runtime/public/console/chunks/powershell-QtSnmXcu.js +1 -0
- package/dist/console/runtime/public/console/chunks/preload-helper-uBIymjUX.js +1 -0
- package/dist/console/runtime/public/console/chunks/presence-BGvCcBvS.js +1 -0
- package/dist/console/runtime/public/console/chunks/prisma-DMgNhnYS.js +1 -0
- package/dist/console/runtime/public/console/chunks/pug-ChIfOLQs.js +1 -0
- package/dist/console/runtime/public/console/chunks/qml-BAjZcRJm.js +1 -0
- package/dist/console/runtime/public/console/chunks/r-CnJIyxn2.js +1 -0
- package/dist/console/runtime/public/console/chunks/razor-Bk3VGUqz.js +1 -0
- package/dist/console/runtime/public/console/chunks/rbs-C0MpOrj4.js +1 -0
- package/dist/console/runtime/public/console/chunks/read-only-DJWK7nHC.js +1 -0
- package/dist/console/runtime/public/console/chunks/red-CYlAq2b0.js +1 -0
- package/dist/console/runtime/public/console/chunks/red-VqZFRByZ-CYlAq2b0.js +1 -0
- package/dist/console/runtime/public/console/chunks/regexp-CF4aByxb.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-DiTkEueR-aMsaMD1D.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-aMsaMD1D.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-dawn-tfo5y2X0-8PwUyIlP.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-moon-C0gON9XN-DO-qXg-I.js +1 -0
- package/dist/console/runtime/public/console/chunks/rose-pine-moon-DO-qXg-I.js +1 -0
- package/dist/console/runtime/public/console/chunks/rst-D8R3YvuX.js +1 -0
- package/dist/console/runtime/public/console/chunks/ruby-BDvumEf2.js +1 -0
- package/dist/console/runtime/public/console/chunks/rust-DpiIf5JO.js +1 -0
- package/dist/console/runtime/public/console/chunks/sas-CDxiwfn1.js +1 -0
- package/dist/console/runtime/public/console/chunks/scala-BiFt_7mu.js +1 -0
- package/dist/console/runtime/public/console/chunks/scss-BPiS1nMZ.js +1 -0
- package/dist/console/runtime/public/console/chunks/scss-DuikUNMR.js +1 -0
- package/dist/console/runtime/public/console/chunks/sections-aIkyV8J9.js +8 -0
- package/dist/console/runtime/public/console/chunks/shaderlab-TOUzSsQk.js +1 -0
- package/dist/console/runtime/public/console/chunks/shellscript-CgLkv1T0.js +1 -0
- package/dist/console/runtime/public/console/chunks/shellscript-DStN_0YR.js +1 -0
- package/dist/console/runtime/public/console/chunks/shellsession-C_5QA7eC.js +1 -0
- package/dist/console/runtime/public/console/chunks/smalltalk-BHpQb5nM.js +1 -0
- package/dist/console/runtime/public/console/chunks/smithy-Dgaz7aur.js +1 -0
- package/dist/console/runtime/public/console/chunks/solarized-dark-B8nAdMfM-b97czJOk.js +1 -0
- package/dist/console/runtime/public/console/chunks/solarized-dark-b97czJOk.js +1 -0
- package/dist/console/runtime/public/console/chunks/solarized-light-B-3F1INj-DFPxpIYQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/solarized-light-DFPxpIYQ.js +1 -0
- package/dist/console/runtime/public/console/chunks/solidity-Bj7E1mRn.js +1 -0
- package/dist/console/runtime/public/console/chunks/soy-Drvj0-hN.js +1 -0
- package/dist/console/runtime/public/console/chunks/sparql-D_iOobhT.js +1 -0
- package/dist/console/runtime/public/console/chunks/sql-7uki0mN6.js +1 -0
- package/dist/console/runtime/public/console/chunks/sql-DvnUxQaA.js +1 -0
- package/dist/console/runtime/public/console/chunks/stata-5ekhIp_w.js +1 -0
- package/dist/console/runtime/public/console/chunks/surrealql-BggsF-oc.js +1 -0
- package/dist/console/runtime/public/console/chunks/svelte-BOzpv3zx.js +1 -0
- package/dist/console/runtime/public/console/chunks/swift-CyEgAFGc.js +1 -0
- package/dist/console/runtime/public/console/chunks/system-verilog-Dh5ihWbf.js +1 -0
- package/dist/console/runtime/public/console/chunks/templ-fdyF5dsr.js +1 -0
- package/dist/console/runtime/public/console/chunks/tex-DHA47n0s.js +1 -0
- package/dist/console/runtime/public/console/chunks/ts-tags-FylMzM_u.js +1 -0
- package/dist/console/runtime/public/console/chunks/tsx-B8qh6jDH.js +1 -0
- package/dist/console/runtime/public/console/chunks/tsx-Ge9e86uq.js +1 -0
- package/dist/console/runtime/public/console/chunks/twig-r9Dsv_Ri.js +1 -0
- package/dist/console/runtime/public/console/chunks/typescript-C2Eu6twH.js +1 -0
- package/dist/console/runtime/public/console/chunks/typescript-CiUCm0l2.js +1 -0
- package/dist/console/runtime/public/console/chunks/typespec-BGhR2SqG.js +1 -0
- package/dist/console/runtime/public/console/chunks/typst-BCkRs6d9.js +1 -0
- package/dist/console/runtime/public/console/chunks/url-uI6JSUZP.js +4 -0
- package/dist/console/runtime/public/console/chunks/useForwardScopeId-mJ8JPuYU.js +1 -0
- package/dist/console/runtime/public/console/chunks/usePortal-BqI7uIRp.js +3 -0
- package/dist/console/runtime/public/console/chunks/v-DBj4K9d_.js +1 -0
- package/dist/console/runtime/public/console/chunks/vb-DOwzaHZ0.js +1 -0
- package/dist/console/runtime/public/console/chunks/verilog-B2gwz-sJ.js +1 -0
- package/dist/console/runtime/public/console/chunks/vue-Bc1L0ruR.js +3 -0
- package/dist/console/runtime/public/console/chunks/vue-CGPRTtAM.js +1 -0
- package/dist/console/runtime/public/console/chunks/vue-CHGs_ru8.js +1 -0
- package/dist/console/runtime/public/console/chunks/vue-html-CU_0vU6P.js +1 -0
- package/dist/console/runtime/public/console/chunks/vue-vine-BrC7uwb8.js +1 -0
- package/dist/console/runtime/public/console/chunks/vueuse-DCpBt1pZ.js +4 -0
- package/dist/console/runtime/public/console/chunks/xml-Bx1i6T7B.js +1 -0
- package/dist/console/runtime/public/console/chunks/xsl-DR5M53i7.js +1 -0
- package/dist/console/runtime/public/console/chunks/yaml-CZmR-Icd.js +1 -0
- package/dist/console/runtime/public/console/chunks/yaml-a9wqVlBt.js +1 -0
- package/dist/console/runtime/public/console/console-QjK_HKoM.css +2 -0
- package/dist/console/runtime/public/console/console-j0_7kmR5.js +21 -0
- package/dist/console/runtime/public/console/page-tool-Cji0S8q-.js +1 -0
- package/dist/console/runtime/public/skills/index.json +46 -0
- package/dist/console/runtime/public/skills/vitehub/SKILL.md +88 -0
- package/dist/console/runtime/public/skills/vitehub/agents/openai.yaml +4 -0
- package/dist/console/runtime/public/skills/vitehub/references/agent-definitions.md +36 -0
- package/dist/console/runtime/public/skills/vitehub/references/capabilities-authority.md +30 -0
- package/dist/console/runtime/public/skills/vitehub/references/channels-triggers.md +26 -0
- package/dist/console/runtime/public/skills/vitehub/references/framework-composition.md +29 -0
- package/dist/console/runtime/public/skills/vitehub/references/preview-contract.md +36 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/auth.md +16 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/blob.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/browser.md +17 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/cache.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/connections.md +16 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/content.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/database.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/email.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/env.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/kv.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/markdown-template.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/queue.md +16 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/rate-limit.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/realtime.md +19 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox-task.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/schedule.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/shell.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/source.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/workflow.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/primitives/workspace.md +13 -0
- package/dist/console/runtime/public/skills/vitehub/references/project-patterns.md +19 -0
- package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +61 -0
- package/dist/console/runtime/public/skills/vitehub/references/proof-recovery.md +29 -0
- package/dist/console/runtime/public/skills/vitehub/references/sandboxes-hosts.md +17 -0
- package/dist/console/runtime/public/skills/vitehub/references/schedules-workflows-invocations.md +28 -0
- package/dist/console/runtime/public/skills/vitehub/references/server-primitives.md +39 -0
- package/dist/console/runtime/public/skills/vitehub/references/workspaces-sources-access.md +26 -0
- package/dist/console/runtime/rpc.d.ts +27 -26
- package/dist/console/runtime/rpc.js +2 -14
- package/dist/console/runtime/sections.d.ts +2 -2
- package/dist/console/runtime/sections.js +280 -55
- package/dist/console/runtime/server/agents.get.d.ts +11 -3
- package/dist/console/runtime/server/agents.get.js +18 -7
- package/dist/console/runtime/server/auth-manage.d.ts +7 -0
- package/dist/console/runtime/server/auth-manage.js +155 -0
- package/dist/console/runtime/server/blob.d.ts +1 -1
- package/dist/console/runtime/server/blob.js +3 -2
- package/dist/console/runtime/server/channel-replay.d.ts +11 -0
- package/dist/console/runtime/server/channel-replay.js +80 -0
- package/dist/console/runtime/server/client.get.d.ts +3 -0
- package/dist/console/runtime/server/client.get.js +11 -0
- package/dist/console/runtime/server/database.d.ts +1 -1
- package/dist/console/runtime/server/database.get.d.ts +23 -4
- package/dist/console/runtime/server/database.get.js +49 -18
- package/dist/console/runtime/server/database.js +3 -2
- package/dist/console/runtime/server/definitions.d.ts +2 -2
- package/dist/console/runtime/server/definitions.get.d.ts +9 -8
- package/dist/console/runtime/server/definitions.get.js +57 -10
- package/dist/console/runtime/server/definitions.js +87 -12
- package/dist/console/runtime/server/documents.d.ts +2 -0
- package/dist/console/runtime/server/documents.js +111 -0
- package/dist/console/runtime/server/env-manage.d.ts +5 -0
- package/dist/console/runtime/server/env-manage.js +10 -0
- package/dist/console/runtime/server/env.d.ts +18 -0
- package/dist/console/runtime/server/env.get.d.ts +9 -0
- package/dist/console/runtime/server/env.get.js +29 -0
- package/dist/console/runtime/server/env.js +42 -0
- package/dist/console/runtime/server/invocation-capabilities.get.d.ts +5 -3
- package/dist/console/runtime/server/invocation-capabilities.get.js +13 -5
- package/dist/console/runtime/server/invocation-workspace.get.d.ts +42 -0
- package/dist/console/runtime/server/invocation-workspace.get.js +243 -0
- package/dist/console/runtime/server/invocation.get.d.ts +36 -25
- package/dist/console/runtime/server/invocation.get.js +117 -10
- package/dist/console/runtime/server/invocations.get.d.ts +4 -3
- package/dist/console/runtime/server/invocations.get.js +30 -28
- package/dist/console/runtime/server/logs.get.d.ts +13 -0
- package/dist/console/runtime/server/logs.get.js +45 -0
- package/dist/console/runtime/server/mcp-authorization-server.d.ts +11 -0
- package/dist/console/runtime/server/mcp-authorization-server.js +71 -0
- package/dist/console/runtime/server/mcp-discovery.d.ts +7 -0
- package/dist/console/runtime/server/mcp-discovery.js +20 -0
- package/dist/console/runtime/server/mcp-metadata.d.ts +11 -0
- package/dist/console/runtime/server/mcp-metadata.js +54 -0
- package/dist/console/runtime/server/mcp.d.ts +16 -0
- package/dist/console/runtime/server/mcp.js +364 -0
- package/dist/console/runtime/server/page-session.d.ts +2 -0
- package/dist/console/runtime/server/page-session.js +5 -0
- package/dist/console/runtime/server/page.get.d.ts +3 -5
- package/dist/console/runtime/server/page.get.js +29 -13
- package/dist/console/runtime/server/rpc.d.ts +22 -0
- package/dist/console/runtime/server/rpc.js +215 -0
- package/dist/console/runtime/server/schedule-run.d.ts +36 -0
- package/dist/console/runtime/server/schedule-run.js +213 -0
- package/dist/console/runtime/server/search.get.d.ts +5 -4
- package/dist/console/runtime/server/search.get.js +103 -2
- package/dist/console/runtime/server/sections.d.ts +4 -2
- package/dist/console/runtime/server/sections.get.d.ts +17 -4
- package/dist/console/runtime/server/sections.get.js +22 -8
- package/dist/console/runtime/server/sections.js +4 -16
- package/dist/console/runtime/server/sign-in.d.ts +5 -0
- package/dist/console/runtime/server/sign-in.js +11 -0
- package/dist/console/runtime/server/status.get.d.ts +13 -0
- package/dist/console/runtime/server/status.get.js +40 -0
- package/dist/console/runtime/server/usage.get.d.ts +4 -3
- package/dist/console/runtime/server/usage.get.js +75 -20
- package/dist/console/server.d.ts +22 -7
- package/dist/console/server.js +23 -17
- package/dist/console/ui.d.ts +201 -0
- package/dist/console/ui.js +3215 -0
- package/dist/console.d.ts +3 -2
- package/dist/content/client.d.ts +1 -0
- package/dist/content/client.js +2 -0
- package/dist/content/database.d.ts +1 -0
- package/dist/content/database.js +2 -0
- package/dist/content/editor.d.ts +1 -0
- package/dist/content/editor.js +2 -0
- package/dist/content/presets/cms.d.ts +2 -0
- package/dist/content/presets/cms.js +2 -0
- package/dist/content/realtime.d.ts +1 -0
- package/dist/content/realtime.js +2 -0
- package/dist/content.d.ts +2 -0
- package/dist/content.js +3 -0
- package/dist/database/drizzle.d.ts +1 -16
- package/dist/database/drizzle.js +1 -8
- package/dist/database-DLPk6HVu.d.ts +7 -0
- package/dist/database-hyYo7JVD.d.ts +11 -0
- package/dist/definitions-BJGSpYGa.d.ts +209 -0
- package/dist/definitions-Y0pIwSQm.d.ts +19 -0
- package/dist/diagnostics-YTWM3K3t.js +74 -0
- package/dist/diagnostics-lT85pbVx.d.ts +6 -0
- package/dist/doctor.d.ts +8 -0
- package/dist/doctor.js +417 -0
- package/dist/document-metadata-nXusaMSq.js +6 -0
- package/dist/documents-BRt3-fIu.d.ts +72 -0
- package/dist/env/auth.d.ts +1 -0
- package/dist/env/auth.js +2 -0
- package/dist/env/bridge.d.ts +1 -0
- package/dist/env/bridge.js +2 -0
- package/dist/env/database.d.ts +1 -0
- package/dist/env/database.js +2 -0
- package/dist/env/http.d.ts +1 -0
- package/dist/env/http.js +2 -0
- package/dist/env/seal.d.ts +1 -0
- package/dist/env/seal.js +2 -0
- package/dist/error-diagnostics-n7V-_SPy.js +160 -0
- package/dist/error-diagnostics.ts +162 -0
- package/dist/gateways.d.ts +1 -0
- package/dist/gateways.js +2 -0
- package/dist/h3-v1-request-DDGXJ9E7.js +166 -0
- package/dist/index-CWk5rJOo.d.ts +247 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -2
- package/dist/internal-Ca7DYHpa.js +311 -0
- package/dist/internal-VvXn0bX4.d.ts +25 -0
- package/dist/invocations-DkjhdkpT.js +1151 -0
- package/dist/invocations-TvN9ux06.d.ts +47 -0
- package/dist/logs/host.d.ts +6 -0
- package/dist/logs/host.js +16 -0
- package/dist/logs/memory.d.ts +18 -0
- package/dist/logs/memory.js +85 -0
- package/dist/logs/source.d.ts +57 -0
- package/dist/logs/source.js +57 -0
- package/dist/logs.d.ts +4 -0
- package/dist/logs.js +4 -0
- package/dist/loopback-DAr1IFQP.js +43 -0
- package/dist/markdown-template/file.d.ts +1 -0
- package/dist/markdown-template/file.js +2 -0
- package/dist/media-BBybn3NP.js +512 -0
- package/dist/nuxt.d.ts +6 -57
- package/dist/nuxt.js +683 -232
- package/dist/operation-contributions-BXHKgT_w.d.ts +18 -0
- package/dist/operations-4uDh4zah.js +38 -0
- package/dist/operations-7RHOMAHT.js +455 -0
- package/dist/operations-Bgklf9hM.d.ts +149 -0
- package/dist/operations-CwqEItfA.js +468 -0
- package/dist/operations.d.ts +2 -0
- package/dist/operations.js +2 -0
- package/dist/owned-paths-BnjT0FhU.js +15 -0
- package/dist/package-BsfDnNm8.js +1119 -0
- package/dist/page-tools-B3g4CQ5c.js +402 -0
- package/dist/page-tools-C5dufxVz.d.ts +16 -0
- package/dist/page-tools-shared-D-amu6sx.js +53 -0
- package/dist/presets/babysitter/server.d.ts +1 -0
- package/dist/presets/babysitter/server.js +2 -0
- package/dist/presets/babysitter.d.ts +1 -0
- package/dist/presets/babysitter.js +2 -0
- package/dist/presets/labeller.d.ts +1 -0
- package/dist/presets/labeller.js +2 -0
- package/dist/presets/workspace.d.ts +2 -0
- package/dist/presets/workspace.js +2 -0
- package/dist/project-registry-BT7RcCcQ.js +39 -0
- package/dist/registry-dSdI2Oa3.js +142 -0
- package/dist/request-BT6g-Fwf.js +326 -0
- package/dist/request-DOvvVgpI.d.ts +52 -0
- package/dist/retention-DBXuVtQL.js +257 -0
- package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
- package/dist/runtime/h3.d.ts +2 -0
- package/dist/runtime/h3.js +2 -0
- package/dist/runtime-DPqC3MTX.js +60 -0
- package/dist/sandbox/ssh.d.ts +1 -0
- package/dist/sandbox/ssh.js +2 -0
- package/dist/sandbox/task.d.ts +1 -0
- package/dist/sandbox/task.js +2 -0
- package/dist/scan-module-TmHMoGKw.js +148 -0
- package/dist/schedule/runtime/kv.d.ts +1 -0
- package/dist/schedule/runtime/kv.js +2 -0
- package/dist/schema-form-C-fy3xaU.d.ts +79 -0
- package/dist/secret-DrgWMRms.js +47 -0
- package/dist/sections-BVtKNenQ.js +108 -0
- package/dist/sections-C985LlW2.d.ts +31 -0
- package/dist/sections-Drj-o4_z.d.ts +141 -0
- package/dist/source/files.d.ts +1 -0
- package/dist/source/files.js +2 -0
- package/dist/source/server.d.ts +1 -24
- package/dist/source/server.js +1 -24
- package/dist/source/vite.d.ts +4 -5
- package/dist/source/vite.js +3 -1
- package/dist/source.d.ts +1 -65
- package/dist/source.js +2 -103
- package/dist/src-CaqWiza-.js +7910 -0
- package/dist/task.d.ts +3 -0
- package/dist/task.js +2 -0
- package/dist/types-BsuwNk3q.js +256 -0
- package/dist/ui/attachment.d.ts +1 -0
- package/dist/ui/attachment.js +2 -0
- package/dist/ui/avatar-stack.d.ts +1 -0
- package/dist/ui/avatar-stack.js +2 -0
- package/dist/ui/bubble.d.ts +1 -0
- package/dist/ui/bubble.js +2 -0
- package/dist/ui/chat-message.d.ts +1 -0
- package/dist/ui/chat-message.js +2 -0
- package/dist/ui/chat-session.d.ts +1 -0
- package/dist/ui/chat-session.js +2 -0
- package/dist/ui/chat.d.ts +1 -0
- package/dist/ui/chat.js +2 -0
- package/dist/ui/code-block.d.ts +1 -0
- package/dist/ui/code-block.js +2 -0
- package/dist/ui/code-view.d.ts +1 -0
- package/dist/ui/code-view.js +2 -0
- package/dist/ui/comments.d.ts +1 -0
- package/dist/ui/comments.js +2 -0
- package/dist/ui/connection-status.d.ts +1 -0
- package/dist/ui/connection-status.js +2 -0
- package/dist/ui/file-diff.d.ts +1 -0
- package/dist/ui/file-diff.js +2 -0
- package/dist/ui/file-tree.d.ts +1 -0
- package/dist/ui/file-tree.js +2 -0
- package/dist/ui/file-view.d.ts +1 -0
- package/dist/ui/file-view.js +2 -0
- package/dist/ui/markdown.d.ts +1 -0
- package/dist/ui/markdown.js +2 -0
- package/dist/ui/marker.d.ts +1 -0
- package/dist/ui/marker.js +2 -0
- package/dist/ui/message-parts.d.ts +1 -0
- package/dist/ui/message-parts.js +2 -0
- package/dist/ui/message.d.ts +1 -0
- package/dist/ui/message.js +2 -0
- package/dist/ui/multi-file-diff.d.ts +1 -0
- package/dist/ui/multi-file-diff.js +2 -0
- package/dist/ui/patch-diff.d.ts +1 -0
- package/dist/ui/patch-diff.js +2 -0
- package/dist/ui/prompt-input.d.ts +1 -0
- package/dist/ui/prompt-input.js +2 -0
- package/dist/ui/styles.css +2134 -2034
- package/dist/ui/sync-status.d.ts +1 -0
- package/dist/ui/sync-status.js +2 -0
- package/dist/ui/tool-list.d.ts +1 -0
- package/dist/ui/tool-list.js +2 -0
- package/dist/ui/trace-run.d.ts +1 -0
- package/dist/ui/trace-run.js +2 -0
- package/dist/ui/trace.d.ts +1 -0
- package/dist/ui/trace.js +2 -0
- package/dist/ui/unresolved-file.d.ts +1 -0
- package/dist/ui/unresolved-file.js +2 -0
- package/dist/usage-CoQXs5nW.d.ts +22 -0
- package/dist/workspace/blob-database.d.ts +1 -0
- package/dist/workspace/blob-database.js +2 -0
- package/package.json +1326 -197
- package/dist/_internal/sandbox/runtime/state.d.ts +0 -1
- package/dist/_internal/sandbox/runtime/state.js +0 -2
- package/dist/_internal/schedule/runtime/driver.d.ts +0 -1
- package/dist/_internal/schedule/runtime/driver.js +0 -2
- package/dist/agents-DGL-2SS3.js +0 -53
- package/dist/blob-_CeYUuZh.d.ts +0 -8
- package/dist/box.d.ts +0 -1
- package/dist/box.js +0 -2
- package/dist/console/runtime/components/console-brand.vue +0 -37
- package/dist/console/runtime/components/console-health-model.ts +0 -54
- package/dist/console/runtime/components/console-health.vue +0 -236
- package/dist/console/runtime/components/console-primitive-switcher.vue +0 -69
- package/dist/console/runtime/components/console-provider.vue +0 -12
- package/dist/console/runtime/pages/agents.vue +0 -58
- package/dist/console/runtime/pages/blob.vue +0 -30
- package/dist/console/runtime/pages/databases.vue +0 -67
- package/dist/console/runtime/pages/index.vue +0 -29
- package/dist/console/runtime/pages/kv.vue +0 -68
- package/dist/console/runtime/pages/queues.vue +0 -30
- package/dist/console/runtime/pages/rate-limits.vue +0 -30
- package/dist/console/runtime/pages/sandboxes.vue +0 -27
- package/dist/console/runtime/pages/schedules.vue +0 -30
- package/dist/console/runtime/pages/workflows.vue +0 -30
- package/dist/console/runtime/pages/workspaces.vue +0 -30
- package/dist/console/runtime/public/console/chunks/ChatMessage-CVruGJWM.js +0 -1
- package/dist/console/runtime/public/console/chunks/ChatPrompt-BmTjPf5_.js +0 -1
- package/dist/console/runtime/public/console/chunks/ChatPromptSubmit-DcxguvaS.js +0 -1
- package/dist/console/runtime/public/console/chunks/ChatReasoning-DIMO2K2F.js +0 -1
- package/dist/console/runtime/public/console/chunks/ChatShimmer-C613EbHI.js +0 -1
- package/dist/console/runtime/public/console/chunks/ChatTool-DDmc-ZK6.js +0 -1
- package/dist/console/runtime/public/console/chunks/Collapsible-C0CXnWpw.js +0 -1
- package/dist/console/runtime/public/console/chunks/CollapsibleTrigger-CmJucLnT.js +0 -1
- package/dist/console/runtime/public/console/chunks/Icon-D-AnqCok.js +0 -1
- package/dist/console/runtime/public/console/chunks/actionscript-3-Czo0lKSf--17pq3dv.js +0 -1
- package/dist/console/runtime/public/console/chunks/ada-twHwrVWN-C5qYipkI.js +0 -1
- package/dist/console/runtime/public/console/chunks/angular-html-Ct-40ew8-D8X9MCxo.js +0 -1
- package/dist/console/runtime/public/console/chunks/angular-html-DTyieMYv.js +0 -1
- package/dist/console/runtime/public/console/chunks/angular-ts-D3gV1N-x.js +0 -1
- package/dist/console/runtime/public/console/chunks/angular-ts-D6akBVit-CAEqTior.js +0 -1
- package/dist/console/runtime/public/console/chunks/apex-BkQQFAhi-VAyPSnFM.js +0 -1
- package/dist/console/runtime/public/console/chunks/apl-Cxjn4xYu-QUZjoXcb.js +0 -1
- package/dist/console/runtime/public/console/chunks/asciidoc-Dsw6zvwf-DE70LPWp.js +0 -1
- package/dist/console/runtime/public/console/chunks/astro-BPVTb8uX-BMHg0UsI.js +0 -1
- package/dist/console/runtime/public/console/chunks/astro-CLAWI0Fn.js +0 -1
- package/dist/console/runtime/public/console/chunks/bat-hQslfzu--Bo4NYOV-.js +0 -1
- package/dist/console/runtime/public/console/chunks/beancount-CXtOQ8oS-D-usSTwE.js +0 -1
- package/dist/console/runtime/public/console/chunks/bird2-GLyzhwkD-C6vDhewU.js +0 -1
- package/dist/console/runtime/public/console/chunks/blade-0LMawyyw-CZBPwR53.js +0 -1
- package/dist/console/runtime/public/console/chunks/blade-CP_mgflB.js +0 -1
- package/dist/console/runtime/public/console/chunks/bsl-0NWGiiFE-mk7PqslV.js +0 -1
- package/dist/console/runtime/public/console/chunks/bundle-web-DTJmdyvB.js +0 -13
- package/dist/console/runtime/public/console/chunks/c-BhmuwSav.js +0 -1
- package/dist/console/runtime/public/console/chunks/c-Dc0_AVM6-CjS7AEt5.js +0 -1
- package/dist/console/runtime/public/console/chunks/c3-BLXk7BLN-BFHwR3_K.js +0 -1
- package/dist/console/runtime/public/console/chunks/cairo-DjG4M3vq-xb-J0v0e.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-frappe-3VR1Za6u.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-frappe-COUg_LSX-3VR1Za6u.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-latte-DwIHMF0Q.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-latte-r30LFfsa-DwIHMF0Q.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-D-EwZyPh-DYnBP6_5.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-DYnBP6_5.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-mocha-C6RD5yh3-DYhrFGRu.js +0 -1
- package/dist/console/runtime/public/console/chunks/catppuccin-mocha-DYhrFGRu.js +0 -1
- package/dist/console/runtime/public/console/chunks/clarity-2iIoRiLx-SemFz856.js +0 -1
- package/dist/console/runtime/public/console/chunks/cobol-CocL1RYn-DoHa8rFw.js +0 -1
- package/dist/console/runtime/public/console/chunks/coffee-DtqnQNu5-Ca3s2Keu.js +0 -1
- package/dist/console/runtime/public/console/chunks/coffee-PUiKoj8Q.js +0 -1
- package/dist/console/runtime/public/console/chunks/coq-Ds6Ye5el-BrsZFFmf.js +0 -1
- package/dist/console/runtime/public/console/chunks/cpp-CxycoGSa.js +0 -1
- package/dist/console/runtime/public/console/chunks/cpp-Mb4ikSI3-tLY9dtiu.js +0 -1
- package/dist/console/runtime/public/console/chunks/crystal-D4OMbAh_-C9omPlZ-.js +0 -1
- package/dist/console/runtime/public/console/chunks/csharp-CFKaLbHg-oqKa8noW.js +0 -1
- package/dist/console/runtime/public/console/chunks/css-DLlZbWMi.js +0 -1
- package/dist/console/runtime/public/console/chunks/css-DTzmO9U0-CbxoEllx.js +0 -1
- package/dist/console/runtime/public/console/chunks/csv-DqIVFkK7-Dx-8-gkx.js +0 -1
- package/dist/console/runtime/public/console/chunks/dart-C6DUdjib-CnvKMtbv.js +0 -1
- package/dist/console/runtime/public/console/chunks/docker-PC1tuYpa-IyjqRm3v.js +0 -1
- package/dist/console/runtime/public/console/chunks/dotenv-Dkdv7Sm2-_5a1GRtc.js +0 -1
- package/dist/console/runtime/public/console/chunks/edge-DrFNu-N9-BY3pzybO.js +0 -1
- package/dist/console/runtime/public/console/chunks/elixir-OpZyQ8Ht-CwWfuiQ1.js +0 -1
- package/dist/console/runtime/public/console/chunks/elm-CjX_545P-Dn-DqM39.js +0 -1
- package/dist/console/runtime/public/console/chunks/emacs-lisp-DxhFFVu_-B4R74twV.js +0 -1
- package/dist/console/runtime/public/console/chunks/erb-trZRdc47-DRBdWH-D.js +0 -1
- package/dist/console/runtime/public/console/chunks/erlang-BJeTH9QH-BfDtvnHZ.js +0 -1
- package/dist/console/runtime/public/console/chunks/fortran-fixed-form-B_eBTsj9-C2-rkbip.js +0 -1
- package/dist/console/runtime/public/console/chunks/fsharp-UvrT6oWG-LCdvSpj6.js +0 -1
- package/dist/console/runtime/public/console/chunks/gdresource-Dl9wvKCd-C3MGX-jo.js +0 -1
- package/dist/console/runtime/public/console/chunks/gdscript-jjgTGGzd-Cp2uCuqX.js +0 -1
- package/dist/console/runtime/public/console/chunks/git-commit-2LMniMoO-CfgJCLX7.js +0 -1
- package/dist/console/runtime/public/console/chunks/git-rebase-DUOURRPN-DbPsFIae.js +0 -1
- package/dist/console/runtime/public/console/chunks/glimmer-js-D_32hFh8-Dv_1Q6fk.js +0 -1
- package/dist/console/runtime/public/console/chunks/glimmer-ts-CVt002zd-PmMLyqBp.js +0 -1
- package/dist/console/runtime/public/console/chunks/glsl-8MDrjpMp.js +0 -1
- package/dist/console/runtime/public/console/chunks/glsl-pHhzolba-D3h1XPFw.js +0 -1
- package/dist/console/runtime/public/console/chunks/gn-DDjbVPF4-ilITqXS6.js +0 -1
- package/dist/console/runtime/public/console/chunks/graphql-BjqekQIR-CtUxCAnJ.js +0 -1
- package/dist/console/runtime/public/console/chunks/graphql-C4iAGs1_.js +0 -1
- package/dist/console/runtime/public/console/chunks/hack-BITNGzgt-BwY4KWmq.js +0 -1
- package/dist/console/runtime/public/console/chunks/haml-BJGeH8A5.js +0 -1
- package/dist/console/runtime/public/console/chunks/haml-DVwRP8W9-C4Ue42xj.js +0 -1
- package/dist/console/runtime/public/console/chunks/handlebars-OC1LcHwO.js +0 -1
- package/dist/console/runtime/public/console/chunks/handlebars-T3TJj8Il-BLQCwuJT.js +0 -1
- package/dist/console/runtime/public/console/chunks/haxe-B0odltAZ-OTjmBuCE.js +0 -1
- package/dist/console/runtime/public/console/chunks/html-CamevgpM-BbT95zHF.js +0 -1
- package/dist/console/runtime/public/console/chunks/html-Cs160JwT.js +0 -1
- package/dist/console/runtime/public/console/chunks/html-derivative-GiQ9zDJU.js +0 -1
- package/dist/console/runtime/public/console/chunks/html-derivative-jMOJf6rB-Kh3SdD3S.js +0 -1
- package/dist/console/runtime/public/console/chunks/http-BEHztmFP-BxphIJE7.js +0 -1
- package/dist/console/runtime/public/console/chunks/http-Cgwuv9UR.js +0 -1
- package/dist/console/runtime/public/console/chunks/hurl-DMKCZZMv.js +0 -1
- package/dist/console/runtime/public/console/chunks/hurl-LmFBxrwm-CGo4dqUD.js +0 -1
- package/dist/console/runtime/public/console/chunks/hxml-BQ4V4Tez-BaHUc7lX.js +0 -1
- package/dist/console/runtime/public/console/chunks/imba-96qKoJCa-DsUTQ-LC.js +0 -1
- package/dist/console/runtime/public/console/chunks/java-CUcXVav_.js +0 -1
- package/dist/console/runtime/public/console/chunks/java-Cfowl-Ex-BnGnzH2k.js +0 -1
- package/dist/console/runtime/public/console/chunks/javascript-C4sF7sej-B29qPxDa.js +0 -1
- package/dist/console/runtime/public/console/chunks/javascript-DrVpc-sp.js +0 -1
- package/dist/console/runtime/public/console/chunks/jinja-C17UUgXU.js +0 -1
- package/dist/console/runtime/public/console/chunks/jinja-CCAEwzP4-PaInFpq5.js +0 -1
- package/dist/console/runtime/public/console/chunks/jison-BKCoBkyT-BRL7eVgb.js +0 -1
- package/dist/console/runtime/public/console/chunks/jison-ByjIV4zh.js +0 -1
- package/dist/console/runtime/public/console/chunks/json-E4f3l6hr-DuNL0Aj9.js +0 -1
- package/dist/console/runtime/public/console/chunks/json-qhed-kSA.js +0 -1
- package/dist/console/runtime/public/console/chunks/json5-xULSgPQI-BR5RXkoi.js +0 -1
- package/dist/console/runtime/public/console/chunks/jsonc-Cu6rqcrJ-CYpm1nAK.js +0 -1
- package/dist/console/runtime/public/console/chunks/jsonl-Bp0qqr10-CmCQp5Yx.js +0 -1
- package/dist/console/runtime/public/console/chunks/jsx-BZjOirBP-Dga5sQe3.js +0 -1
- package/dist/console/runtime/public/console/chunks/jsx-C-HlKHLe.js +0 -1
- package/dist/console/runtime/public/console/chunks/julia-Ca_tGyZB.js +0 -1
- package/dist/console/runtime/public/console/chunks/julia-nEdJo0dp-CJRta6ZT.js +0 -1
- package/dist/console/runtime/public/console/chunks/just-Brtw3q7S-DmytbepJ.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-dragon-CXtmUGW6.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-dragon-DExkuQAs-CXtmUGW6.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BN08jTvb.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-lotus-qdYh7_RY-BN08jTvb.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-wave-CSW_hADG-CTweb8Dz.js +0 -1
- package/dist/console/runtime/public/console/chunks/kanagawa-wave-CTweb8Dz.js +0 -1
- package/dist/console/runtime/public/console/chunks/latex-QHQNiZDD-fcyJN6QK.js +0 -1
- package/dist/console/runtime/public/console/chunks/less-BzbdhFUi-DVTAwKKz.js +0 -1
- package/dist/console/runtime/public/console/chunks/liquid-DYQ7uW5u-JGNMHTpg.js +0 -1
- package/dist/console/runtime/public/console/chunks/llvm-uY68ROGz-Cm23YOpf.js +0 -1
- package/dist/console/runtime/public/console/chunks/lua-BhkUWs1q-CVcL4bwV.js +0 -1
- package/dist/console/runtime/public/console/chunks/luau-YC4aaMmR-FMPmPwt6.js +0 -1
- package/dist/console/runtime/public/console/chunks/markdown-CkmxmzqY-BYOwaDjH.js +0 -1
- package/dist/console/runtime/public/console/chunks/marko-BHWvxp04-U7nYXRKW.js +0 -1
- package/dist/console/runtime/public/console/chunks/marko-DmV4Eg2F.js +0 -1
- package/dist/console/runtime/public/console/chunks/mdc-BVkdQPZX.js +0 -1
- package/dist/console/runtime/public/console/chunks/mdc-Dg7VPYLa-CshLRYP7.js +0 -1
- package/dist/console/runtime/public/console/chunks/mdx-BK9ZufRc-DQZ5AkYe.js +0 -1
- package/dist/console/runtime/public/console/chunks/mermaid-r7OoIYpE-Bk4SNUv9.js +0 -1
- package/dist/console/runtime/public/console/chunks/mojo-YCzvCoMT-BgCJLMeH.js +0 -1
- package/dist/console/runtime/public/console/chunks/monokai-CREPpJ3k-CdkpiU2Y.js +0 -1
- package/dist/console/runtime/public/console/chunks/monokai-CdkpiU2Y.js +0 -1
- package/dist/console/runtime/public/console/chunks/moonbit-B_9L5rST-CaWjb8XO.js +0 -1
- package/dist/console/runtime/public/console/chunks/move-Dqi5fhOb-B1IS1UjX.js +0 -1
- package/dist/console/runtime/public/console/chunks/nextflow-CgUAk9iA-CTMUe4Ca.js +0 -1
- package/dist/console/runtime/public/console/chunks/nextflow-groovy-CdFFX-gF-DJMQeKeT.js +0 -1
- package/dist/console/runtime/public/console/chunks/nginx-Q-E8IJvs-DiQO9reH.js +0 -1
- package/dist/console/runtime/public/console/chunks/nim-CNcTuF14-W9Ucwkhx.js +0 -1
- package/dist/console/runtime/public/console/chunks/nushell-r7hBzeS_-DcLAeLz5.js +0 -1
- package/dist/console/runtime/public/console/chunks/one-dark-pro-CLwyXe_n.js +0 -1
- package/dist/console/runtime/public/console/chunks/one-dark-pro-Ev8UPkf4-CLwyXe_n.js +0 -1
- package/dist/console/runtime/public/console/chunks/perl-Bbgb6Twx-CHGXAzGq.js +0 -1
- package/dist/console/runtime/public/console/chunks/php-CBOR45_G-D5pyod9R.js +0 -1
- package/dist/console/runtime/public/console/chunks/php-J5BBb-PR.js +0 -1
- package/dist/console/runtime/public/console/chunks/pierre-code-view-DYpF5M8R-BiohFcCD.js +0 -1511
- package/dist/console/runtime/public/console/chunks/postcss-D1gKt4z_-BXeXVLqQ.js +0 -1
- package/dist/console/runtime/public/console/chunks/powershell-CpTLv_ai-DshXNtvi.js +0 -1
- package/dist/console/runtime/public/console/chunks/prisma-BWfa4-tI-BsRQq5mF.js +0 -1
- package/dist/console/runtime/public/console/chunks/pug-CfJcGJfh.js +0 -1
- package/dist/console/runtime/public/console/chunks/pug-Cn_U_o_I-Cw4zFEpZ.js +0 -1
- package/dist/console/runtime/public/console/chunks/python-BjnOIxPe-gzcpVVnB.js +0 -1
- package/dist/console/runtime/public/console/chunks/qml-DNlrbxJT-B_IzAFFX.js +0 -1
- package/dist/console/runtime/public/console/chunks/r-Dzep-lPg.js +0 -1
- package/dist/console/runtime/public/console/chunks/r-VqTZMNY_-EnO4GoeC.js +0 -1
- package/dist/console/runtime/public/console/chunks/razor-Bw2un3e8-CtGvw0jo.js +0 -1
- package/dist/console/runtime/public/console/chunks/red-CJ3rzSJv.js +0 -1
- package/dist/console/runtime/public/console/chunks/red-EHiRGXSv-CJ3rzSJv.js +0 -1
- package/dist/console/runtime/public/console/chunks/regexp-5HbFqwky-C3xQXL6t.js +0 -1
- package/dist/console/runtime/public/console/chunks/regexp-R83qIIH_.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-BthvhNj6.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-DTI-z1Qp-BthvhNj6.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-dawn-BIiGXpWs-Dg85fqjY.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-dawn-Dg85fqjY.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-moon-DU4wt90U-hon4tzzS.js +0 -1
- package/dist/console/runtime/public/console/chunks/rose-pine-moon-hon4tzzS.js +0 -1
- package/dist/console/runtime/public/console/chunks/rst-BZPDb03W-BDIwqmQR.js +0 -1
- package/dist/console/runtime/public/console/chunks/ruby-BbVp0_gQ-BUOn3oxT.js +0 -1
- package/dist/console/runtime/public/console/chunks/rust-COBzcmTx-Cfkwpbl8.js +0 -1
- package/dist/console/runtime/public/console/chunks/sas-DSkdG4wF-BE4zxtJ7.js +0 -1
- package/dist/console/runtime/public/console/chunks/sass-DI2zJwx7-DXrisJhu.js +0 -1
- package/dist/console/runtime/public/console/chunks/scala-CtSYTRYT-DKOlJaKm.js +0 -1
- package/dist/console/runtime/public/console/chunks/scss-BQ7uffpQ-D2aPazKS.js +0 -1
- package/dist/console/runtime/public/console/chunks/scss-DTeHeodw.js +0 -1
- package/dist/console/runtime/public/console/chunks/shaderlab-CWP9wBCf-C6U2tjWC.js +0 -1
- package/dist/console/runtime/public/console/chunks/shellscript-B42c0JAn-D5OxpxEd.js +0 -1
- package/dist/console/runtime/public/console/chunks/shellscript-CLZ0U2zV.js +0 -1
- package/dist/console/runtime/public/console/chunks/shellsession-Oc9-NqAv-C1K_F4Is.js +0 -1
- package/dist/console/runtime/public/console/chunks/smalltalk-BEQkVl4K-B16xEiuN.js +0 -1
- package/dist/console/runtime/public/console/chunks/solarized-dark-DV17i1UV.js +0 -1
- package/dist/console/runtime/public/console/chunks/solarized-dark-UHgjRWhr-DV17i1UV.js +0 -1
- package/dist/console/runtime/public/console/chunks/solarized-light-B-Zcwve2-DSh2HLQt.js +0 -1
- package/dist/console/runtime/public/console/chunks/solarized-light-DSh2HLQt.js +0 -1
- package/dist/console/runtime/public/console/chunks/solidity-lB9VjfB9-CKzVLygQ.js +0 -1
- package/dist/console/runtime/public/console/chunks/soy-tgh9u9aW-Cm_LtJoW.js +0 -1
- package/dist/console/runtime/public/console/chunks/sparql-B4t0ZbEe-CXgkFCv7.js +0 -1
- package/dist/console/runtime/public/console/chunks/sql-C7n9abzK.js +0 -1
- package/dist/console/runtime/public/console/chunks/sql-CrPlEQn4-COghB3-E.js +0 -1
- package/dist/console/runtime/public/console/chunks/stata-D_KqT8cj-oQQpG6t_.js +0 -1
- package/dist/console/runtime/public/console/chunks/stylus-ZZDn1yUO-B6D30XZt.js +0 -1
- package/dist/console/runtime/public/console/chunks/surrealql-C0KhgoyZ-DqXNFH_A.js +0 -1
- package/dist/console/runtime/public/console/chunks/svelte-CRpWSJAY.js +0 -1
- package/dist/console/runtime/public/console/chunks/svelte-DuHT0xxw-Bs0TxuUS.js +0 -1
- package/dist/console/runtime/public/console/chunks/swift-BTPQlRLK-DonLKvLd.js +0 -1
- package/dist/console/runtime/public/console/chunks/system-verilog-BEoxaBuU-DJ5XKQeo.js +0 -1
- package/dist/console/runtime/public/console/chunks/templ-DF54artD-BPb_zNLV.js +0 -1
- package/dist/console/runtime/public/console/chunks/tex-Bbhb8xAP-9R8lE_en.js +0 -1
- package/dist/console/runtime/public/console/chunks/ts-tags-DH1AB-Ri-CgEe3BFX.js +0 -1
- package/dist/console/runtime/public/console/chunks/ts-tags-DJjZLMnt.js +0 -1
- package/dist/console/runtime/public/console/chunks/tsx-B7QamQLF.js +0 -1
- package/dist/console/runtime/public/console/chunks/tsx-BR8s1Lhs-DiW36VFk.js +0 -1
- package/dist/console/runtime/public/console/chunks/tv-WsfYJXat.js +0 -1
- package/dist/console/runtime/public/console/chunks/twig-DziFF7iU-DLOFbR4k.js +0 -1
- package/dist/console/runtime/public/console/chunks/typescript-D8TR6ff2-CCKRkaRI.js +0 -1
- package/dist/console/runtime/public/console/chunks/typescript-DzLO-qqB.js +0 -1
- package/dist/console/runtime/public/console/chunks/typespec-C_R5TbvO-BRdr0IET.js +0 -1
- package/dist/console/runtime/public/console/chunks/typst-BV9w0z8--DI99ib-x.js +0 -1
- package/dist/console/runtime/public/console/chunks/v-DfbeXLo8-DETTlOr0.js +0 -1
- package/dist/console/runtime/public/console/chunks/vb-DU29mvss-Djn5o6TS.js +0 -1
- package/dist/console/runtime/public/console/chunks/verilog-BW5U03XW-CiiDBU1e.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-BRy8iDCZ-CL7P9CNz.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-CQQ6_PvN.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-html-B24bjO_3-BY2skbNe.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-html-Ce5SCNOK.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-vine-DKH1_YEZ.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue-vine-l7O7Mg81-CFWzX3HC.js +0 -1
- package/dist/console/runtime/public/console/chunks/vue.runtime.esm-bundler-COh-O3z7.js +0 -3
- package/dist/console/runtime/public/console/chunks/wasm-BRCjOXGL-BnjxR4X6.js +0 -1
- package/dist/console/runtime/public/console/chunks/wasm-gNIKwGlD-ByWQv1Qj.js +0 -1
- package/dist/console/runtime/public/console/chunks/wgsl-1s5rV5xS-BsKzXJz4.js +0 -1
- package/dist/console/runtime/public/console/chunks/wit-CeQiCbz_-DdvCle-K.js +0 -1
- package/dist/console/runtime/public/console/chunks/xml-CduVPlYa-BZCwbgEk.js +0 -1
- package/dist/console/runtime/public/console/chunks/xml-G-voesMw.js +0 -1
- package/dist/console/runtime/public/console/chunks/xsl-BeH_vLTK-DeKk-5KU.js +0 -1
- package/dist/console/runtime/public/console/chunks/yaml-Cb0uRU1q-CkSC4c4u.js +0 -1
- package/dist/console/runtime/public/console/chunks/yaml-rwi0_p6S.js +0 -1
- package/dist/console/runtime/public/console/console-Bwq3z75a.css +0 -3
- package/dist/console/runtime/public/console/console-Cl-xrMah.js +0 -1371
- package/dist/console/runtime/server/blob.get.d.ts +0 -25
- package/dist/console/runtime/server/blob.get.js +0 -74
- package/dist/console/runtime/server/devframe.d.ts +0 -13
- package/dist/console/runtime/server/devframe.js +0 -133
- package/dist/console/runtime/server/kv.d.ts +0 -2
- package/dist/console/runtime/server/kv.get.d.ts +0 -24
- package/dist/console/runtime/server/kv.get.js +0 -236
- package/dist/console/runtime/server/kv.js +0 -18
- package/dist/database-CW-WjW4u.d.ts +0 -8
- package/dist/definitions-BHmB22eM.d.ts +0 -7
- package/dist/definitions-CfSmoS5G.d.ts +0 -17
- package/dist/index-B072hyCd.d.ts +0 -59
- package/dist/internal-12r-XCbk.d.ts +0 -20
- package/dist/internal-DzLLx0iR.js +0 -304
- package/dist/invocations-qwMRTSy7.js +0 -364
- package/dist/kv-DLGscNQ_.d.ts +0 -8
- package/dist/request-DxBwxGnk.js +0 -72
- package/dist/request-NErg_P5m.d.ts +0 -43
- package/dist/schedule/runtime/driver.d.ts +0 -1
- package/dist/schedule/runtime/driver.js +0 -2
- package/dist/search.get-ClTCn-mh.js +0 -100
- package/dist/sections-7HoMOIGH.d.ts +0 -9
- package/dist/sections-DVsqeLAF.d.ts +0 -100
- package/dist/server-BFxDhCzA.d.ts +0 -78
- package/dist/shell/providers/cloudflare.d.ts +0 -1
- package/dist/shell/providers/cloudflare.js +0 -2
- package/dist/source/content/client.d.ts +0 -1
- package/dist/source/content/client.js +0 -2
- package/dist/source/content.d.ts +0 -1
- package/dist/source/content.js +0 -2
- package/dist/src-XEJGHDr9.js +0 -5247
- package/dist/types-BucGTJnk.js +0 -168
- package/dist/usage-CoZa_8fx.js +0 -361
- package/dist/workspace/collections/client.d.ts +0 -1
- package/dist/workspace/collections/client.js +0 -2
- package/dist/workspace/collections.d.ts +0 -1
- package/dist/workspace/collections.js +0 -2
- package/dist/workspace/publish.d.ts +0 -1
- package/dist/workspace/publish.js +0 -2
- /package/dist/console/runtime/public/console/chunks/{abap-LtYK6g-v-CLvhMVsD.js → abap-CLvhMVsD.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{andromeeda-DnSv6o6l-vGVdxbeo.js → andromeeda-BASpqCeJ-vGVdxbeo.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{apache-BIl2qPOf-U0d_L8uA.js → apache-U0d_L8uA.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{applescript-CJ80B5XJ-CCn79oCD.js → applescript-CCn79oCD.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ara-IxnQjO6j-4CJ0cIlV.js → ara-4CJ0cIlV.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{asm-wBDSgBbA-Cmm7eHzH.js → asm-Cmm7eHzH.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{aurora-x-XJ5I8rFc-CDeNXAV0.js → aurora-x-DugsLcii-CDeNXAV0.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{awk-D6dA05Ye-BWXHIvNe.js → awk-BWXHIvNe.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ayu-dark-CBRGL64--DluEY0Gj.js → ayu-dark-BT3qdi3o-DluEY0Gj.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ayu-light-BlrCS3Ih-C3h-C4tm.js → ayu-light-BVZyHoh9-C3h-C4tm.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ayu-mirage-CqpTmLcF-Bqwy1Gya.js → ayu-mirage-XFwUVZQZ-Bqwy1Gya.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ballerina-DIdXD2KH-B7ZEbQpA.js → ballerina-B7ZEbQpA.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{berry-CgA2ea0_-DKpUyyne.js → berry-DKpUyyne.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{bibtex-BzgdqG3s-Ci_nEsc7.js → bibtex-Ci_nEsc7.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{bicep-CZ338dSk-CUHmPFLl.js → bicep-CUHmPFLl.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{cadence-B1ELWULD-CQ2zXKGN.js → cadence-CQ2zXKGN.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{clojure-DDsQ0FaV-DqKBuwfJ.js → clojure-DqKBuwfJ.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{cmake-DPsCB_V6-Bj61d0ZC.js → cmake-Bj61d0ZC.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{codeowners-CxEKPWu0-C8r90Shi.js → codeowners-C8r90Shi.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{codeql-BwdvwJnv-oeQT6MSM.js → codeql-oeQT6MSM.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{common-lisp-DJtwvW4V-Cv5bFMCO.js → common-lisp-Cv5bFMCO.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{cue-B5KneM5p-CE9AQfxI.js → cue-CE9AQfxI.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{cypher-D8Bb8Cq2-ClKdZ_lG.js → cypher-ClKdZ_lG.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{d-BQY8TDgQ-qD-0Kul2.js → d-qD-0Kul2.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{dark-plus-BCxGtnt0-Cs2F2srj.js → dark-plus-BGuiqa1B-Cs2F2srj.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{dax-S-Noo-ku-BkyTk9wS.js → dax-BkyTk9wS.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{desktop-BgOb7Aj4-Dlh5hvp9.js → desktop-Dlh5hvp9.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{diff-Blb4MjsC-woXpYk--.js → diff-woXpYk--.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{dracula-fPErIccy-BHWKrbxM.js → dracula-0CVA2XY5-BHWKrbxM.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{dracula-soft-BrQbqXs8-5eyTD99u.js → dracula-soft-Dk9bpbVU-5eyTD99u.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{dream-maker-CngiPd8U-DW3nJb8Q.js → dream-maker-DW3nJb8Q.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{everforest-dark-gTeBQCos-sB-x3p7T.js → everforest-dark-CRjTbhh5-sB-x3p7T.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{everforest-light-DUjxsp-2-Df2xbC6M.js → everforest-light-CEeYFLn8-Df2xbC6M.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{fennel-B3wtZRne-DQxkIbk2.js → fennel-DQxkIbk2.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{fish-D7qAeWQz-BJitypiv.js → fish-BJitypiv.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{fluent-BjfpB34g-C03EYrpw.js → fluent-C03EYrpw.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{fortran-free-form-yxJ7igsv-CYNrtFtB.js → fortran-free-form-CYNrtFtB.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gdshader-D7JfdFV3-CBce3t8t.js → gdshader-CBce3t8t.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{genie-DnK2KWIP-CV2tkWYe.js → genie-CV2tkWYe.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gherkin-D6Lr12YQ-DExj1W_8.js → gherkin-DExj1W_8.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-dark-Dg1hl_QD-C-LZuMrd.js → github-dark-BXgKmOw_-C-LZuMrd.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-dark-default-Dym2P842-DXG-b-1a.js → github-dark-default-DzJQXksd-DXG-b-1a.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-dark-dimmed-7iDMx266-Bx1FflLF.js → github-dark-dimmed-B1pEmGtS-Bx1FflLF.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-dark-high-contrast-DkV2fyPG-B_tTalzw.js → github-dark-high-contrast-BkHIa6jc-B_tTalzw.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-light-BQKYgor9-EUqPIrTm.js → github-light-BKRlUbaB-EUqPIrTm.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-light-default-BZhIfzqQ-BXViO-2h.js → github-light-default-BU3eYkzs-BXViO-2h.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{github-light-high-contrast-C7zHfx4C-B68TUdTA.js → github-light-high-contrast-B3MumDcI-B68TUdTA.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gleam-CTllUdfC-CSRkHgEL.js → gleam-CSRkHgEL.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gnuplot-DgWvVXI8-7GGW24-e.js → gnuplot-7GGW24-e.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{go-aXtTCanQ-rLFTqkRN.js → go-rLFTqkRN.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{groovy-Bw2Ku4bU-CacY0gHj.js → groovy-CacY0gHj.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-dark-hard-CQiwpF03-C820rvS2.js → gruvbox-dark-hard-B0ecF443-C820rvS2.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-dark-medium-BKe6XKBS-BPjhmG05.js → gruvbox-dark-medium-BQnpC39k-BPjhmG05.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-dark-soft-Cz6U6pa4-MrdJrrXF.js → gruvbox-dark-soft-DFZUgESr-MrdJrrXF.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-light-hard-DgU_i19B-BC_s9l72.js → gruvbox-light-hard-CuB_LOJr-BC_s9l72.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-light-medium-D64I06ER-BAWPOn9u.js → gruvbox-light-medium-idDHgxjs-BAWPOn9u.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{gruvbox-light-soft-B-YxAs1L-BSMLrYjP.js → gruvbox-light-soft-CfWH49MY-BSMLrYjP.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{haskell-CfGsE1Cf-D8IpX4py.js → haskell-D8IpX4py.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{hcl-DHg_Osgo-Dh228itO.js → hcl-Dh228itO.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{hjson-Cuaphql8-CxZEssPk.js → hjson-CxZEssPk.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{hlsl-BJLUNfne-Cvrh5tZx.js → hlsl-Cvrh5tZx.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{horizon-bright-CPyV7XIA-DSNQnXHK.js → horizon-bright-Ba6M8QSV-DSNQnXHK.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{horizon-DYoumREk-CE9ld1lL.js → horizon-h92C5OlZ-CE9ld1lL.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{houston-B3NWfq0V-CsvMBhTu.js → houston-EQnPegWq-CsvMBhTu.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{hy-CJKxDzbh-CZbG8q4J.js → hy-CZbG8q4J.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ini-C24lZfdM-B5eOa1yu.js → ini-B5eOa1yu.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{jsonnet-BafgE6cE-CJTPZ8u_.js → jsonnet-CJTPZ8u_.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{jssm-Dx5A5sBR-DXw9l8Rf.js → jssm-DXw9l8Rf.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{kdl-DkTyxPcj-CsD5j6eV.js → kdl-CsD5j6eV.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{kotlin-BHE8CoV9-DhhofPvG.js → kotlin-DhhofPvG.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{kusto-6FdaWTzR-C7mF5XQf.js → kusto-C7mF5XQf.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{laserwave-DkfjiLxA-C_8bwKvT.js → laserwave-IxBH_3yW-C_8bwKvT.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{lean-BwOKScIt-CewbzKMR.js → lean-CewbzKMR.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{light-plus-DuO6rXxZ-DVQuIRkW.js → light-plus-S8JBx6is-DVQuIRkW.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{log-Dad54gsi-BNLmms1o.js → log-BNLmms1o.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{logo-DTXV8SKw-Cluzi2Zq.js → logo-Cluzi2Zq.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{make-B2ukzWs3-Dixweg8N.js → make-Dixweg8N.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{material-theme-C_YrwKEa-Bm3Qr25_.js → material-theme-D1f3HBq--Bm3Qr25_.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{material-theme-darker-DB3YVCla-2IIEA8gg.js → material-theme-darker-ExzYhT0j-2IIEA8gg.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{material-theme-lighter-D2fgNrBK-uhdI0v04.js → material-theme-lighter-D6gH9nnA-uhdI0v04.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{material-theme-ocean-DVy172Rs-CHQ94UKr.js → material-theme-ocean-D1w5BPAa-CHQ94UKr.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{material-theme-palenight-uMMwIfpG-B5W6OYN7.js → material-theme-palenight-CkqWmVpF-B5W6OYN7.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{matlab-CfRK6IMC-D7qyCx1q.js → matlab-D7qyCx1q.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{min-dark-C7Ec8I_2-BSWPekZh.js → min-dark-npsJH98j-BSWPekZh.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{min-light-Be6foA7m-DDpmG2fV.js → min-light-DUk1XsVt-DDpmG2fV.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{mipsasm-EL46Y4Xg-BMqwQI7S.js → mipsasm-BMqwQI7S.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{narrat-D9rrR0H5-_X_XdTYD.js → narrat-_X_XdTYD.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{night-owl-CqqbiLON-DhmEMT88.js → night-owl-BS7V-av_-DhmEMT88.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{night-owl-light-B9vYgGRt-eJ-hLW7d.js → night-owl-light-CZtRawYE-eJ-hLW7d.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{nix-Bm1Ax-Z3-IvuFDN5E.js → nix-IvuFDN5E.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{nord-BZ9DVmcN-Cb4Vim4T.js → nord-BFh54Nqz-Cb4Vim4T.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{objective-c-6dJF64Dt-D1A_Heim.js → objective-c-D1A_Heim.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{objective-cpp-_ooRQ-PY-BsSzOQcm.js → objective-cpp-BsSzOQcm.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ocaml-vm1Y8An6-O90oeIOV.js → ocaml-O90oeIOV.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{odin-vjOJSyfV-B1RWQWA5.js → odin-B1RWQWA5.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{one-light-CzxBC38_-D7Lr4KcI.js → one-light-gmHK3iK6-D7Lr4KcI.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{openscad-jn-f1Ocl-BUDT5pXO.js → openscad-BUDT5pXO.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{pascal-D8-gNZ2I-4ZHwLPI5.js → pascal-4ZHwLPI5.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{pkl-C7lWzykI-ot-7Btpt.js → pkl-ot-7Btpt.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{plastic-BGkJ2das-DQwYfKfQ.js → plastic-DtdaCjub-DQwYfKfQ.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{plsql-DCNXypXO-DGHpHOYJ.js → plsql-DGHpHOYJ.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{po-IjpR1yHO-BiJDBrnU.js → po-BiJDBrnU.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{poimandres-CpnMgZuc-DRFjx7u4.js → poimandres-Hdda6aHK-DRFjx7u4.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{polar-4pN1JrJ8-C7UOKdEL.js → polar-C7UOKdEL.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{powerquery-SrvS_NBM-DNMTfnFr.js → powerquery-DNMTfnFr.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{prolog-Bacii3Ue-iXnhIJG7.js → prolog-iXnhIJG7.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{proto-ClkOcAW0-DB4EqR-F.js → proto-DB4EqR-F.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{puppet-CQlPp728-CDv2pdJW.js → puppet-CDv2pdJW.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{purescript-CLpaGMbw-9MfHhQsQ.js → purescript-9MfHhQsQ.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{qmldir-Dz8ttxjf-DCQb3MpD.js → qmldir-DCQb3MpD.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{qss-Iltvkn1C-Fe1Jh2GI.js → qss-Fe1Jh2GI.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{racket-DRv7j6nv-DcIDlBhZ.js → racket-DcIDlBhZ.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{raku-DI9yGpeW-B3gFvitq.js → raku-B3gFvitq.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{reg-DpJf71oO-CRGYupPL.js → reg-CRGYupPL.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{rel-BT0iIKKw-BtDbiS_P.js → rel-BtDbiS_P.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{riscv-CvzikGLb-Ckw8ddFX.js → riscv-Ckw8ddFX.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{chunk-DK3Fl9T5.js → rolldown-runtime-DK3Fl9T5.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ron-DzAo6FTJ-VUp2lXgN.js → ron-VUp2lXgN.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{rosmsg-CyYq6XdT-CAekHB0j.js → rosmsg-CAekHB0j.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{scheme-D3A2QBtM-DQCgrYNe.js → scheme-DQCgrYNe.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{sdbl-CdQg5gu1-bTVj8UrX.js → sdbl-bTVj8UrX.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{slack-dark-BS2AOOdo-DnToyrRv.js → slack-dark-v8P_eXr6-DnToyrRv.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{slack-ochin-Nc7Cucwk-B2OO5cIa.js → slack-ochin-D8SyEdKz-B2OO5cIa.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{snazzy-light-C2ghKZXY-4G7pJPwS.js → snazzy-light-BtkQkvXb-4G7pJPwS.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{splunk-xP_ZjUH2-BC2Px7Mm.js → splunk-BC2Px7Mm.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{ssh-config-DXFPABYp-BgfXC-Er.js → ssh-config-BgfXC-Er.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{synthwave-84-CPtGYwOz-nFMaYfgc.js → synthwave-84-DcsXCF_c-nFMaYfgc.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{systemd-DFbUltlW-BxMlprV5.js → systemd-BxMlprV5.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{talonscript-CLxaFu-b-CohzipZa.js → talonscript-CohzipZa.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{tasl-_AAbKiWM-DMoTqEGO.js → tasl-DMoTqEGO.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{tcl-DLe0Tsfm-CZd0xW_V.js → tcl-CZd0xW_V.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{terraform-v0KN9QQh-DswuEJGm.js → terraform-DswuEJGm.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{tokyo-night-BKYoawWu-oM2G3aXe.js → tokyo-night-Bvpqduda-oM2G3aXe.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{toml-B7BHZIqX-CcmNWLt0.js → toml-CcmNWLt0.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{tsv-BorGVq2Z-sltzmVWM.js → tsv-sltzmVWM.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{turtle-BEG5g_eT-ByJddavk.js → turtle-ByJddavk.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vala-BnnASFsX-zf12oZj6.js → vala-zf12oZj6.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vesper-ClvmKzqD-DdrHHSXu.js → vesper-CfxmMOy3-DdrHHSXu.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vhdl-Co2XFKY7-BroJfC0k.js → vhdl-BroJfC0k.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{viml-BReTXeDA-DvXPmvsu.js → viml-DvXPmvsu.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vitesse-black-BY6Qtyq--fwtXNY1n.js → vitesse-black-D9-_1mjV-fwtXNY1n.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vitesse-dark-BT-v_EgR-BZCL-v6S.js → vitesse-dark-DlSMLlr9-BZCL-v6S.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vitesse-light-Box8ZFz6-VbXTXTou.js → vitesse-light-KRWWWztf-VbXTXTou.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{vyper-C6KGx0YU-CgoNMtux.js → vyper-CgoNMtux.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{wenyan-BeysbCrW-C8pVoKbM.js → wenyan-C8pVoKbM.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{wikitext-wjhjmmzD-ClFFjSW2.js → wikitext-ClFFjSW2.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{wolfram-CcZPfnLd-DLL8P-h_.js → wolfram-DLL8P-h_.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{zenscript-BoijL7rl-BnlCZFoB.js → zenscript-BnlCZFoB.js} +0 -0
- /package/dist/console/runtime/public/console/chunks/{zig-lTQvxhLD-CMLA9XwU.js → zig-CMLA9XwU.js} +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import{$ as e,$t as t,At as n,B as r,Bt as i,C as a,Dt as o,Et as s,Ft as c,Gt as l,H as u,Ht as d,It as f,J as p,Jt as m,Kt as h,Lt as g,Nt as _,Ot as v,Pt as y,Q as b,R as x,St as S,T as C,Tt as w,Ut as T,V as E,Vt as D,W as O,X as k,Xt as A,Y as j,Z as M,_ as N,_t as P,an as F,at as I,c as L,cn as R,en as ee,ft as z,h as te,i as B,it as V,kt as ne,ln as re,lt as ie,mt as ae,nn as oe,nt as H,ot as U,pt as W,qt as se,rn as ce,s as le,sn as G,st as ue,t as de,tn as fe,tt as K,un as q,w as pe,wt as J,x as me,xt as he}from"./vueuse-DCpBt1pZ.js";import{n as ge,r as _e}from"./Icon-DDNuGxPl.js";import{B as ve,E as ye,M as be,P as xe,Q as Se,Y as Ce,Z as we,b as Te,d as Ee,lt as De,m as Oe,ut as ke}from"./sections-aIkyV8J9.js";import{$ as Ae,$t as je,A as Me,An as Ne,At as Pe,Bt as Fe,C as Ie,Cn as Le,D as Re,Dn as ze,E as Be,En as Ve,Et as He,F as Ue,Ft as We,Gt as Ge,Ht as Ke,I as qe,It as Je,J as Ye,Jt as Xe,K as Ze,Kt as Qe,L as $e,Lt as et,M as tt,Mn as nt,Mt as rt,N as it,Nn as at,Nt as ot,O as st,On as ct,P as lt,Pn as ut,Pt as dt,Qt as ft,R as pt,Rt as mt,S as ht,Sn as gt,St as _t,T as vt,Tn as yt,Ut as bt,V as xt,Vt as St,Wt as Ct,Xt as wt,Yt as Tt,_ as Et,_n as Dt,_t as Ot,a as kt,an as At,b as jt,bn as Mt,bt as Nt,c as Pt,ct as Ft,d as It,dn as Lt,dt as Rt,en as zt,et as Bt,f as Vt,fn as Ht,ft as Ut,gn as Wt,gt as Gt,h as Kt,hn as qt,i as Jt,in as Yt,j as Xt,jn as Zt,jt as Qt,k as $t,kn as en,l as tn,ln as nn,m as rn,mn as an,mt as on,n as sn,nn as cn,o as ln,p as un,pn as dn,pt as fn,q as pn,qt as mn,r as hn,rn as gn,s as _n,t as vn,tn as yn,tt as bn,u as xn,ut as Sn,v as Cn,vn as wn,w as Tn,wn as En,wt as Dn,x as On,xn as kn,xt as An,y as jn,yn as Mn,yt as Nn,zt as Pn}from"./console-search-D4EVLUeN.js";import{t as Fn}from"./defu-DSJ9I3OW.js";import{_ as In,b as Ln,f as Rn,i as zn,n as Bn,p as Vn,r as Hn,v as Un}from"./usePortal-BqI7uIRp.js";import{A as Wn,B as Gn,F as Kn,I as qn,M as Jn,N as Yn,P as Xn,R as Zn,S as Qn,T as $n,V as er,W as tr,_ as nr,b as rr,d as ir,f as ar,g as or,h as sr,j as cr,k as lr,m as ur,n as dr,p as fr,u as pr,v as mr,y as hr,z as gr}from"./Button-B-5IVAVN.js";import{_ as _r,b as vr,d as yr,f as br,g as xr,h as Sr,i as Cr,m as wr,n as Tr,o as Er,t as Dr,v as Or,x as kr,y as Ar}from"./Alert-A44KLyli.js";import{t as jr}from"./code-view-J4OsgEdh-B89t0LaT.js";import{C as Mr,D as Nr,E as Pr,O as Fr,S as Ir,n as Lr}from"./Modal-BCfHPiul.js";import{t as Rr}from"./Checkbox-B6MMrqB7.js";import{t as zr}from"./Select-CLtjSqJ4.js";import{t as Br}from"./FormField-C1QuQLPv.js";import{t as Vr}from"./Switch-0VgVgteh.js";import{n as Hr,t as Ur}from"./Tabs-BbKlHRNF.js";import{t as Wr}from"../console-j0_7kmR5.js";import{n as Gr}from"./field-a8AvhnKh-Da49LBBi.js";import{t as Kr}from"./Slideover-CHzYTMLO.js";import{t as qr}from"./DashboardSidebar-D1tMg0lD.js";import{t as Jr}from"./Empty-DSuwpzRi.js";import{t as Yr}from"./Popover-BIzgqwDJ.js";import{t as Xr}from"./format-Bm0hCiYP.js";import{t as Zr}from"./console-page-toolbar-CvYwaKTR.js";import{t as Qr}from"./console-relative-time-RB6-yiul.js";import{t as $r}from"./console-setup-hint-8TRzgkby.js";import{_ as ei,a as ti,b as ni,c as ri,d as ii,f as ai,g as oi,h as si,i as ci,l as li,m as ui,n as di,o as fi,p as pi,r as mi,s as hi,t as gi,u as _i,v as vi,x as yi,y as bi}from"./console-media-browser-o4BQu9KZ.js";import{t as xi}from"./console-status-DH5NgNAQ.js";import{t as Si}from"./console-page-header-DDAcJBpl.js";import{a as Ci,c as wi,i as Ti,n as Ei,o as Di,r as Oi,s as ki,t as Ai}from"./presence-BGvCcBvS.js";import{t as ji}from"./Textarea-DEoHK30I.js";function Mi(e){let t=A(`inline`),n=A(!1),r=A(),i=p(()=>t.value===`popper`&&!n.value),a;At({suppressHighlightScroll:i,onHighlightScrollRequest(e){a=e}});function o(e,i){(r.value!==e||t.value!==i)&&(n.value=!1,a=void 0),r.value=e,t.value=i}function s(i){if(r.value!==i||t.value!==`popper`||n.value)return;n.value=!0;let o=a;a=void 0,e.value&&o?.()}function c(e){r.value===e&&(r.value=void 0,t.value=`inline`,n.value=!1,a=void 0)}return{onContentPositionChange:o,onContentPlaced:s,onContentUnmount:c}}var[Ni,Pi]=$n(`ComboboxRoot`),Fi=V({__name:`ComboboxRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},resetSearchTermOnBlur:{type:Boolean,required:!1,default:!0},resetSearchTermOnSelect:{type:Boolean,required:!1,default:!0},openOnFocus:{type:Boolean,required:!1,default:!1},openOnClick:{type:Boolean,required:!1,default:!1},ignoreFilter:{type:Boolean,required:!1},resetModelValueOnClear:{type:Boolean,required:!1,default:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},multiple:{type:Boolean,required:!1},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},highlightOnHover:{type:Boolean,required:!1,default:!0},by:{type:[String,Function],required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`highlight`,`update:open`],setup(e,{expose:t,emit:n}){let r=e,a=n,{primitiveElement:s,currentElement:c}=ke(),{multiple:u,disabled:d,ignoreFilter:f,resetSearchTermOnSelect:m,openOnFocus:h,openOnClick:g,dir:_,resetModelValueOnClear:v,highlightOnHover:y}=oe(r),b=Dt(_),x=te(r,`modelValue`,a,{defaultValue:r.defaultValue??(u.value?[]:void 0),passive:r.modelValue===void 0,deep:!0}),S=te(r,`open`,a,{defaultValue:r.defaultOpen,passive:r.open===void 0});async function C(e){S.value=e,ee.value=``,e?(await ae(),s.value?.highlightSelected(),T.value=!0,D.value?.focus()):(T.value=!1,setTimeout(()=>{!e&&r.resetSearchTermOnBlur&&w.trigger()},1))}let w=N(),T=A(!1),E=A(!1),D=A(),O=A(),j=p(()=>s.value?.highlightedElement??void 0),M=Mi(S),P=A(new Map),L=A(new Map),{contains:R}=Wt({sensitivity:`base`}),ee=A(``),z=p(e=>{if(!ee.value||r.ignoreFilter||E.value)return{count:P.value.size,items:e?.items??new Map,groups:e?.groups??new Set(L.value.keys())};let t=0,n=new Map,i=new Set;for(let[e,r]of P.value){let i=R(r,ee.value);n.set(e,+!!i),i&&t++}for(let[e,t]of L.value)for(let r of t)if(n.get(r)>0){i.add(e);break}return{count:t,items:n,groups:i}}),B=I();return he(()=>{B?.exposed&&(B.exposed.highlightItem=s.value?.highlightItem,B.exposed.highlightFirstItem=s.value?.highlightFirstItem,B.exposed.highlightSelected=s.value?.highlightSelected)}),t({filtered:z,highlightedElement:j,highlightItem:s.value?.highlightItem,highlightFirstItem:s.value?.highlightFirstItem,highlightSelected:s.value?.highlightSelected}),Pi({modelValue:x,multiple:u,disabled:d,open:S,onOpenChange:C,...M,contentId:``,isUserInputted:T,isVirtual:E,inputElement:D,highlightedElement:j,onInputElementChange:e=>D.value=e,triggerElement:O,onTriggerElementChange:e=>O.value=e,parentElement:c,resetSearchTermOnSelect:m,onResetSearchTerm:w.on,allItems:P,allGroups:L,filterSearch:ee,filterState:z,ignoreFilter:f,openOnFocus:h,openOnClick:g,resetModelValueOnClear:v}),(e,t)=>(J(),k(F(Tt),null,{default:i(()=>[H(F(gn),W({ref_key:`primitiveElement`,ref:s},e.$attrs,{modelValue:F(x),"onUpdate:modelValue":t[0]||=e=>l(x)?x.value=e:null,style:{pointerEvents:F(S)?`auto`:void 0},as:e.as,"as-child":e.asChild,dir:F(b),multiple:F(u),name:e.name,required:e.required,disabled:F(d),"highlight-on-hover":F(y),by:r.by,onHighlight:t[1]||=e=>a(`highlight`,e)}),{default:i(()=>[o(e.$slots,`default`,{open:F(S),modelValue:F(x)})]),_:3},16,[`modelValue`,`style`,`as`,`as-child`,`dir`,`multiple`,`name`,`required`,`disabled`,`highlight-on-hover`,`by`])]),_:3}))}}),Ii=V({__name:`ComboboxAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let{forwardRef:t}=Vn();return(e,n)=>(J(),k(F(Xe),{"as-child":``,reference:e.reference},{default:i(()=>[H(F(rr),W({ref:F(t),"as-child":e.asChild,as:e.as},e.$attrs),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`as-child`,`as`])]),_:3},8,[`reference`]))}}),[Li,Ri]=$n(`ComboboxContent`),zi=V({__name:`ComboboxContentImpl`,props:{position:{type:String,required:!1,default:`inline`},bodyLock:{type:Boolean,required:!1},hideWhenEmpty:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`],setup(e,{emit:t}){let r=e,a=t,{position:s}=oe(r),c=Ni(),l=Symbol(`ComboboxContent`);f(s,e=>c.onContentPositionChange(l,e),{immediate:!0});let d=p(()=>c.ignoreFilter.value?c.allItems.value.size===0:c.filterState.value.count===0),{forwardRef:m,currentElement:h}=Vn();Fr(r.bodyLock),qt(),Nr(c.parentElement);let g=p(()=>r.position===`popper`?r:{}),_=Qn(g.value),v={boxSizing:`border-box`,"--reka-combobox-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-combobox-content-available-width":`var(--reka-popper-available-width)`,"--reka-combobox-content-available-height":`var(--reka-popper-available-height)`,"--reka-combobox-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-combobox-trigger-height":`var(--reka-popper-anchor-height)`};Ri({position:s});let y=A(!1);he(()=>{c.inputElement.value&&(y.value=h.value.contains(c.inputElement.value),y.value&&c.inputElement.value.focus())}),S(()=>{c.onContentUnmount(l);let e=Un();y.value&&(!e||e===document.body)&&c.triggerElement.value?.focus()});function b(e){if(c.parentElement.value?.contains(e))return!0;let t=(e instanceof Element?e.closest(`label`):null)?.control;return!!t&&!!c.parentElement.value?.contains(t)}let x={placed:()=>c.onContentPlaced(l)};return(e,t)=>(J(),k(F(cn),{"as-child":``},{default:i(()=>[H(F(Ir),{"as-child":``,onMountAutoFocus:t[5]||=u(()=>{},[`prevent`]),onUnmountAutoFocus:t[6]||=u(()=>{},[`prevent`])},{default:i(()=>[H(F(Mr),{"as-child":``,"disable-outside-pointer-events":e.disableOutsidePointerEvents,onDismiss:t[0]||=e=>F(c).onOpenChange(!1),onFocusOutside:t[1]||=e=>{b(e.target)&&e.preventDefault(),a(`focusOutside`,e)},onInteractOutside:t[2]||=e=>a(`interactOutside`,e),onEscapeKeyDown:t[3]||=e=>a(`escapeKeyDown`,e),onPointerDownOutside:t[4]||=e=>{b(e.target)&&e.preventDefault(),a(`pointerDownOutside`,e)}},{default:i(()=>[(J(),k(ne(F(s)===`popper`?F(mt):F(rr)),W({...e.$attrs,...F(_)},{id:F(c).contentId,ref:F(m),"memo-dependencies":F(s)===`popper`?[F(c).filterSearch.value,F(c).filterState.value]:void 0,"data-state":F(c).open.value?`open`:`closed`,"data-empty":d.value?``:void 0,style:{display:r.hideWhenEmpty&&d.value?`none`:`flex`,flexDirection:`column`,outline:`none`,...F(s)===`popper`?v:{}}},n(F(s)===`popper`?x:{})),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`id`,`memo-dependencies`,`data-state`,`data-empty`,`style`]))]),_:3},8,[`disable-outside-pointer-events`])]),_:3})]),_:3}))}}),Bi=V({__name:`ComboboxArrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let t=e,n=Ni(),r=Li();return Vn(),(e,a)=>F(n).open.value&&F(r).position.value===`popper`?(J(),k(F(et),R(W({key:0},t)),{default:i(()=>[o(e.$slots,`default`)]),_:3},16)):M(`v-if`,!0)}}),Vi=V({__name:`ComboboxCancel`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Vn();let n=Ni();function r(){n.filterSearch.value=``,n.inputElement.value&&(n.inputElement.value.value=``,n.inputElement.value.focus()),n.resetModelValueOnClear?.value&&(n.modelValue.value=n.multiple.value?[]:null)}return(e,n)=>(J(),k(F(rr),W({type:e.as===`button`?`button`:void 0},t,{tabindex:`-1`,onClick:r}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`type`]))}}),Hi=V({__name:`ComboboxContent`,props:{forceMount:{type:Boolean,required:!1},position:{type:String,required:!1},bodyLock:{type:Boolean,required:!1},hideWhenEmpty:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`],setup(e,{emit:t}){let n=dn(e,t),{forwardRef:r}=Vn(),a=Ni();return a.contentId||=Pr(void 0,`reka-combobox-content`),(e,t)=>(J(),k(F(Rn),{present:e.forceMount||F(a).open.value},{default:i(()=>[H(zi,W({...F(n),...e.$attrs},{ref:F(r)}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16)]),_:3},8,[`present`]))}}),Ui=V({__name:`ComboboxEmpty`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=Ni(),r=p(()=>n.ignoreFilter.value?n.allItems.value.size===0:n.filterState.value.count===0);return(e,n)=>r.value?(J(),k(F(rr),R(W({key:0},t)),{default:i(()=>[o(e.$slots,`default`,{},()=>[n[0]||=K(`No options`)])]),_:3},16)):M(`v-if`,!0)}}),[Wi,Gi]=$n(`ComboboxGroup`),Ki=V({__name:`ComboboxGroup`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=Pr(void 0,`reka-combobox-group`),r=Ni(),a=p(()=>r.ignoreFilter.value?!0:!r.filterSearch.value||r.filterState.value.groups.has(n)),s=Gi({id:n,labelId:``});return he(()=>{r.allGroups.value.has(n)||r.allGroups.value.set(n,new Set)}),S(()=>{r.allGroups.value.delete(n)}),(e,r)=>(J(),k(F(zt),W({id:F(n),"aria-labelledby":F(s).labelId},t,{hidden:!a.value||void 0}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`id`,`aria-labelledby`,`hidden`]))}}),qi=V({__name:`ComboboxInput`,props:{displayValue:{type:Function,required:!1},modelValue:{type:String,required:!1},autoFocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`input`}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,a=Ni(),s=Yt(),{primitiveElement:c,currentElement:u}=ke(),d=te(n,`modelValue`,r,{passive:n.modelValue===void 0});he(()=>{u.value&&a.onInputElementChange(u.value)});let{isComposing:p,shouldDeferInput:m,handleCompositionStart:h,handleCompositionUpdate:g,handleCompositionEnd:_}=Zt(e=>{let t=e.target;t&&y(t.value)});function v(e){p.value||(e.preventDefault(),a.open.value||a.onOpenChange(!0))}function y(e){a.open.value?a.filterSearch.value=e:(a.onOpenChange(!0),ae(()=>{e&&(a.filterSearch.value=e,s.highlightFirstItem())}))}function b(e){m.value||y(e.target.value)}function x(){a.openOnFocus.value&&!a.open.value&&a.onOpenChange(!0)}function S(e){if(!a.open.value)return;let t=e.relatedTarget;if(!t)return;let n=a.parentElement.value?.contains(t),r=document.getElementById(a.contentId)?.contains(t);!n&&!r&&requestAnimationFrame(()=>{if(!a.open.value)return;let e=document.activeElement;!a.parentElement.value?.contains(e)&&!document.getElementById(a.contentId)?.contains(e)&&a.onOpenChange(!1)})}function C(){a.openOnClick.value&&!a.open.value&&a.onOpenChange(!0)}function w(){let e=a.modelValue.value;n.displayValue?d.value=n.displayValue(e):!a.multiple.value&&e&&!Array.isArray(e)?typeof e==`object`?d.value=``:d.value=e.toString():d.value=``,ae(()=>{d.value=d.value})}return a.onResetSearchTerm(()=>{w()}),f(a.modelValue,async()=>{!a.isUserInputted.value&&a.resetSearchTermOnSelect.value&&w()},{immediate:!0,deep:!0}),f(a.filterState,(e,t)=>{!a.isVirtual.value&&t.count===0&&s.highlightFirstItem()}),(e,t)=>(J(),k(F(yn),{ref_key:`primitiveElement`,ref:c,modelValue:F(d),"onUpdate:modelValue":t[0]||=e=>l(d)?d.value=e:null,as:e.as,"as-child":e.asChild,"auto-focus":e.autoFocus,disabled:e.disabled,"aria-expanded":F(a).open.value,"aria-controls":F(a).contentId,"aria-autocomplete":`list`,role:`combobox`,autocomplete:`off`,onClick:C,onInput:b,onKeydown:E(v,[`down`,`up`]),onFocus:x,onBlur:S,onCompositionstart:F(h),onCompositionupdate:F(g),onCompositionend:F(_)},{default:i(()=>[o(e.$slots,`default`)]),_:3},8,[`modelValue`,`as`,`as-child`,`auto-focus`,`disabled`,`aria-expanded`,`aria-controls`,`onCompositionstart`,`onCompositionupdate`,`onCompositionend`]))}}),Ji=V({__name:`ComboboxItem`,props:{textValue:{type:String,required:!1},value:{type:null,required:!0},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`select`],setup(e,{emit:t}){let n=e,r=t,a=Pr(void 0,`reka-combobox-item`),s=Ni(),c=Wi(null),{primitiveElement:l,currentElement:u}=ke();if(n.value===``)throw Error(`A <ComboboxItem /> must have a value prop that is not an empty string. This is because the Combobox value can be set to an empty string to clear the selection and show the placeholder.`);let f=p(()=>{if(s.isVirtual.value||s.ignoreFilter.value||!s.filterSearch.value)return!0;{let e=s.filterState.value.items.get(a);return e===void 0||e>0}});return he(()=>{s.allItems.value.set(a,n.textValue||u.value.textContent||u.value.innerText);let e=c?.id;e&&(s.allGroups.value.has(e)?s.allGroups.value.get(e)?.add(a):s.allGroups.value.set(e,new Set([a])))}),S(()=>{s.allItems.value.delete(a)}),(e,t)=>f.value?d([f.value,F(s).filterSearch.value,F(s).disabled.value,e.disabled,n.value,n.as,n.asChild,...Object.values(e.$attrs)],()=>(J(),k(F(je),W({key:0},n,{id:F(a),ref_key:`primitiveElement`,ref:l,disabled:F(s).disabled.value||e.disabled,onSelect:t[0]||=t=>{r(`select`,t),!t.defaultPrevented&&(!F(s).multiple.value&&!e.disabled&&!F(s).disabled.value?(t.preventDefault(),F(s).onOpenChange(!1),F(s).modelValue.value=n.value):F(s).multiple.value&&F(s).inputElement.value?.focus())}}),{default:i(()=>[o(e.$slots,`default`,{},()=>[K(q(e.value),1)])]),_:3},16,[`id`,`disabled`])),t,1):M(`v-if`,!0)}}),Yi=V({__name:`ComboboxItemIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let t=e;return(e,n)=>(J(),k(F(ft),R(U(t)),{default:i(()=>[o(e.$slots,`default`)]),_:3},16))}}),Xi=V({__name:`ComboboxLabel`,props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`div`}},setup(e){let t=e;Vn();let n=Wi({id:``,labelId:``});return n.labelId||=Pr(void 0,`reka-combobox-group-label`),(e,r)=>(J(),k(F(rr),W(t,{id:F(n).labelId}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`id`]))}}),Zi=V({__name:`ComboboxPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let t=e;return(e,n)=>(J(),k(F(zn),R(U(t)),{default:i(()=>[o(e.$slots,`default`)]),_:3},16))}}),Qi=V({__name:`ComboboxSeparator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return Vn(),(e,n)=>(J(),k(F(rr),W(t,{"aria-hidden":`true`}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16))}}),$i=V({__name:`ComboboxTrigger`,props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,{forwardRef:n,currentElement:r}=Vn(),a=Ni(),s=p(()=>t.disabled||a.disabled.value||!1);return he(()=>{r.value&&a.onTriggerElementChange(r.value)}),(e,r)=>(J(),k(F(rr),W(t,{ref:F(n),type:e.as===`button`?`button`:void 0,tabindex:`-1`,"aria-label":`Show popup`,"aria-haspopup":`listbox`,"aria-expanded":F(a).open.value,"aria-controls":F(a).contentId,"data-state":F(a).open.value?`open`:`closed`,disabled:s.value,"data-disabled":s.value?``:void 0,"aria-disabled":s.value??void 0,onClick:r[0]||=e=>F(a).onOpenChange(!F(a).open.value)}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`type`,`aria-expanded`,`aria-controls`,`data-state`,`disabled`,`data-disabled`,`aria-disabled`]))}}),ea=V({__name:`ComboboxVirtualizer`,props:{options:{type:Array,required:!0},overscan:{type:Number,required:!1},estimateSize:{type:[Number,Function],required:!1},textContent:{type:Function,required:!1}},setup(e){let t=e,n=Ni();return n.isVirtual.value=!0,(e,n)=>(J(),k(wt,R(U(t)),{default:i(t=>[o(e.$slots,`default`,R(U(t)))]),_:3},16))}}),ta=new Map,na=!1;try{na=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var ra=!1;try{ra=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var ia={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},aa=class{constructor(e,t={}){this.numberFormatter=oa(e,t),this.options=t}format(e){let t=``;if(t=!na&&this.options.signDisplay!=null?sa(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!ra){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=ia[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t<e)throw RangeError(`End date must be >= start date`);return`${this.format(e)} \u{2013} ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw RangeError(`End date must be >= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!na&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!ra&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}};function oa(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!ra){let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!ia[e]?.[n])throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let r=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(ta.has(r))return ta.get(r);let i=new Intl.NumberFormat(e,t);return ta.set(r,i),i}function sa(e,t,n){if(t===`auto`)return e.format(n);if(t===`never`)return e.format(Math.abs(n));{let r=!1;if(t===`always`?r=n>0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length!==1&&console.warn(`@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case`),t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}return e.format(n)}}var ca=RegExp(`^.*\\(.*\\).*$`),la=[`latn`,`arab`,`hanidec`,`deva`,`beng`,`fullwide`],ua=class{constructor(e,t={}){this.locale=e,this.options=t}parse(e){return fa(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return fa(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return fa(this.locale,this.options,e).options.numberingSystem}},da=new Map;function fa(e,t,n){let r=pa(e,t);if(!e.includes(`-nu-`)&&!r.isValidPartialNumber(n)){for(let i of la)if(i!==r.options.numberingSystem){let r=pa(e+(e.includes(`-u-`)?`-nu-`:`-u-nu-`)+i,t);if(r.isValidPartialNumber(n))return r}}return r}function pa(e,t){let n=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():``),r=da.get(n);return r||(r=new ma(e,t),da.set(n,r)),r}var ma=class{constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits??=t.maximumFractionDigits),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=_a(e,this.formatter,this.options,t),this.options.style===`percent`&&((this.options.minimumFractionDigits??0)>18||(this.options.maximumFractionDigits??0)>18)&&console.warn(`NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.`)}parse(e){let t=this.formatter.resolvedOptions().useGrouping,n=this.sanitize(e);if(!t&&this.symbols.group&&n.includes(this.symbols.group))return NaN;if(this.symbols.group&&(n=n.replaceAll(this.symbols.group,``)),this.symbols.decimal&&(n=n.replace(this.symbols.decimal,`.`)),this.symbols.minusSign&&(n=n.replace(this.symbols.minusSign,`-`)),n=n.replace(this.symbols.numeral,this.symbols.index),this.options.style===`percent`){let e=n.indexOf(`-`);n=n.replace(`-`,``),n=n.replace(`+`,``);let t=n.indexOf(`.`);t===-1&&(t=n.length),n=n.replace(`.`,``),n=t-2==0?`0.${n}`:t-2==-1?`0.0${n}`:t-2==-2?`0.00`:`${n.slice(0,t-2)}.${n.slice(t-2)}`,e>-1&&(n=`-${n}`)}let r=n?+n:NaN;if(isNaN(r))return NaN;if(this.options.style===`percent`){let e={...this.options,style:`decimal`,minimumFractionDigits:Math.min((this.options.minimumFractionDigits??0)+2,20),maximumFractionDigits:Math.min((this.options.maximumFractionDigits??0)+2,20)};return new ua(this.locale,e).parse(new aa(this.locale,e).format(r))}return this.options.currencySign===`accounting`&&ca.test(e)&&(r=-1*r),r}sanitize(e){let t=this.formatter.resolvedOptions().useGrouping;return this.symbols.noNumeralUnits.length>0&&this.symbols.noNumeralUnits.find(t=>t.unit===e)?this.symbols.noNumeralUnits.find(t=>t.unit===e).value.toString():(e=e.replace(this.symbols.literals,``),this.symbols.minusSign&&(e=e.replace(`-`,this.symbols.minusSign)),this.options.numberingSystem===`arab`&&(this.symbols.decimal&&(e=va(e,`,`,this.symbols.decimal),e=va(e,`،`,this.symbols.decimal)),this.symbols.group&&t&&(e=va(e,`.`,this.symbols.group))),this.symbols.group===`’`&&e.includes(`'`)&&t&&(e=va(e,`'`,this.symbols.group)),this.symbols.group===`'`&&e.includes(`’`)&&t&&(e=va(e,`’`,this.symbols.group)),this.options.locale===`fr-FR`&&this.symbols.group&&t&&(e=va(e,` `,this.symbols.group),e=va(e,/\u00A0/g,this.symbols.group)),e)}isValidPartialNumber(e,t=-1/0,n=1/0){let r=this.formatter.resolvedOptions().useGrouping;return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&r&&(e=va(e,this.symbols.group,``)),e=e.replace(this.symbols.numeral,``),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,``)),e.length===0)}},ha=new Set([`decimal`,`fraction`,`integer`,`minusSign`,`plusSign`,`group`]),ga=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function _a(e,t,n,r){let i=new Intl.NumberFormat(e,{...n,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:`auto`,roundingMode:`halfExpand`,useGrouping:!0}),a=i.formatToParts(-10000.111),o=i.formatToParts(10000.111),s=ga.map(e=>i.formatToParts(e)),c=s.map((e,t)=>{let n=e.find(e=>e.type===`unit`);return n&&!e.some(e=>e.type===`integer`||e.type===`fraction`)?{unit:n.value,value:ga[t]}:null}).filter(e=>!!e),l=a.find(e=>e.type===`minusSign`)?.value??`-`,u=o.find(e=>e.type===`plusSign`)?.value;!u&&(r?.signDisplay===`exceptZero`||r?.signDisplay===`always`)&&(u=`+`);let d=new Intl.NumberFormat(e,{...n,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(e=>e.type===`decimal`)?.value,f=a.find(e=>e.type===`group`)?.value,p=a.filter(e=>!ha.has(e.type)).map(e=>ya(e.value)),m=s.flatMap(e=>e.filter(e=>!ha.has(e.type)).map(e=>ya(e.value))),h=[...new Set([...p,...m])].sort((e,t)=>t.length-e.length),g=h.length===0?RegExp(`\\p{White_Space}|\\p{Cf}`,`gu`):RegExp(`${h.join(`|`)}|\\p{White_Space}|\\p{Cf}`,`gu`),_=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),v=new Map(_.map((e,t)=>[e,t])),y=RegExp(`[${_.join(``)}]`,`g`);return{minusSign:l,plusSign:u,decimal:d,group:f,literals:g,numeral:y,numerals:_,index:e=>String(v.get(e)),noNumeralUnits:c}}function va(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function ya(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var ba=400,xa=60,Sa=10;function Ca(e){let{disabled:t}=e,n=A(),r=N(),i=A(!1),a=p(()=>B(e.target)),o,s=``,c=0,l=0,u=!1,d=()=>{n.value!==void 0&&(window.clearTimeout(n.value),n.value=void 0)},f=()=>{d(),o=void 0,s=``,u=!1,i.value=!1},m=()=>t.value?(f(),!1):(r.trigger(),!0),h=e=>{d(),n.value=window.setTimeout(()=>{u=!0,m()&&h(xa)},e)};return me&&(le(a||window,`pointerdown`,e=>{if(!(e.button!==0||i.value||t.value)){if(e.preventDefault(),o=e.pointerId,s=e.pointerType,c=e.clientX,l=e.clientY,u=!1,i.value=!0,e.pointerType===`mouse`){u=!0,m()&&h(ba);return}h(ba)}}),le(window,`pointermove`,e=>{if(e.pointerId!==o||s===`mouse`)return;let t=e.clientX-c,n=e.clientY-l;t*t+n*n>Sa**2&&f()}),le(window,`pointerup`,e=>{if(e.pointerId!==o)return;let t=s!==`mouse`&&!u;f(),t&&m()}),le(window,`pointercancel`,e=>{e.pointerId===o&&f()})),se(f),{isPressed:i,onTrigger:r.on}}function wa(e,t=A({})){return a(()=>new aa(e.value,t.value))}function Ta(e,t=A({})){return a(()=>new ua(e.value,t.value))}function Ea(e,t,n){let r=e===`+`?t+n:t-n;if(t%1!=0||n%1!=0){let i=t.toString().split(`.`),a=n.toString().split(`.`),o=i[1]&&i[1].length||0,s=a[1]&&a[1].length||0,c=10**Math.max(o,s);t=Math.round(t*c),n=Math.round(n*c),r=e===`+`?t+n:t-n,r/=c}return r}var[Da,Oa]=$n(`NumberFieldRoot`),ka=V({inheritAttrs:!1,__name:`NumberFieldRoot`,props:{defaultValue:{type:Number,required:!1,default:void 0},modelValue:{type:[Number,null],required:!1},min:{type:Number,required:!1},max:{type:Number,required:!1},step:{type:Number,required:!1,default:1},stepSnapping:{type:Boolean,required:!1,default:!0},focusOnChange:{type:Boolean,required:!1,default:!0},formatOptions:{type:null,required:!1},locale:{type:String,required:!1},disabled:{type:Boolean,required:!1},readonly:{type:Boolean,required:!1},disableWheelChange:{type:Boolean,required:!1},invertWheelChange:{type:Boolean,required:!1},id:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`div`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{disabled:a,readonly:s,disableWheelChange:c,invertWheelChange:l,min:u,max:d,step:f,stepSnapping:m,formatOptions:h,id:g,locale:_}=oe(n),v=te(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:n.modelValue===void 0}),{primitiveElement:y,currentElement:b}=ke(),x=Lt(_),S=an(b),C=A(),w=p(()=>In(v.value)||isNaN(v.value)?!1:E(`decrease`,v.value)>=v.value),T=p(()=>In(v.value)||isNaN(v.value)?!1:E(`increase`,v.value)<=v.value);function E(e,t,n=1){let r=f.value??1,i=e===`increase`?`+`:`-`,a;if(m.value&&!isNaN(r)){let o=ut(t,u.value,d.value,r);if(o===t)a=Ea(i,t,r*n);else{let s=e===`increase`?o>t?o:Ea(`+`,o,r):o<t?o:Ea(`-`,o,r);a=n>1?Ea(i,s,r*(n-1)):s}}else a=Ea(i,t,r*n);return V(a)}function D(e,t=1){if(n.focusOnChange&&C.value?.focus(),n.disabled||n.readonly)return;let r=I.parse(C.value?.value??``);if(isNaN(r)){v.value=V(u.value??0);return}v.value=E(e,r,t)}function O(e=1){D(`increase`,e)}function j(e=1){D(`decrease`,e)}function N(e){e===`min`&&u.value!==void 0?v.value=V(u.value):e===`max`&&d.value!==void 0&&(v.value=V(d.value))}let P=wa(x,h),I=Ta(x,h),L=p(()=>P.resolvedOptions().maximumFractionDigits>0?`decimal`:`numeric`),R=wa(x,h),ee=p(()=>In(v.value)||isNaN(v.value)?``:R.format(v.value));function z(e){return I.isValidPartialNumber(e,u.value,d.value)}function B(e){C.value&&(C.value.value=e)}function V(e){let t;return t=f.value===void 0||isNaN(f.value)||!m.value?at(e,u.value,d.value):ut(e,u.value,d.value,f.value),t=I.parse(P.format(t)),t}function ne(e){let t=I.parse(e);return v.value=isNaN(t)?void 0:V(t),e.length?B(ee.value):B(e)}return Oa({modelValue:v,handleDecrease:j,handleIncrease:O,handleMinMaxValue:N,inputMode:L,inputEl:C,onInputElement:e=>C.value=e,textValue:ee,readonly:s,validate:z,applyInputValue:ne,disabled:a,disableWheelChange:c,invertWheelChange:l,max:d,min:u,isDecreaseDisabled:w,isIncreaseDisabled:T,id:g}),(e,t)=>(J(),k(F(rr),W(e.$attrs,{ref_key:`primitiveElement`,ref:y,role:`group`,as:e.as,"as-child":e.asChild,"data-disabled":F(a)?``:void 0,"data-readonly":F(s)?``:void 0}),{default:i(()=>[o(e.$slots,`default`,{modelValue:F(v),textValue:ee.value,readonly:F(s)}),F(S)&&e.name?(J(),k(F(nn),{key:0,type:`text`,value:F(v),name:e.name,disabled:F(a),readonly:F(s),required:e.required},null,8,[`value`,`name`,`disabled`,`readonly`,`required`])):M(`v-if`,!0)]),_:3},16,[`as`,`as-child`,`data-disabled`,`data-readonly`]))}}),Aa=V({__name:`NumberFieldDecrement`,props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=Da(),r=p(()=>n.disabled?.value||n.readonly.value||t.disabled||n.isDecreaseDisabled.value),{primitiveElement:a,currentElement:s}=ke(),{isPressed:c,onTrigger:l}=Ca({target:s,disabled:r});return l(()=>{n.handleDecrease()}),(e,n)=>(J(),k(F(rr),W(t,{ref_key:`primitiveElement`,ref:a,tabindex:`-1`,"aria-label":`Decrease`,type:e.as===`button`?`button`:void 0,style:{userSelect:F(c)?`none`:void 0},disabled:r.value?``:void 0,"data-disabled":r.value?``:void 0,"data-pressed":F(c)?`true`:void 0,onContextmenu:n[0]||=u(()=>{},[`prevent`])}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`type`,`style`,`disabled`,`data-disabled`,`data-pressed`]))}}),ja=V({__name:`NumberFieldIncrement`,props:{disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,n=Da(),r=p(()=>n.disabled?.value||n.readonly.value||t.disabled||n.isIncreaseDisabled.value),{primitiveElement:a,currentElement:s}=ke(),{isPressed:c,onTrigger:l}=Ca({target:s,disabled:r});return l(()=>{n.handleIncrease()}),(e,n)=>(J(),k(F(rr),W(t,{ref_key:`primitiveElement`,ref:a,tabindex:`-1`,"aria-label":`Increase`,type:e.as===`button`?`button`:void 0,style:{userSelect:F(c)?`none`:void 0},disabled:r.value?``:void 0,"data-disabled":r.value?``:void 0,"data-pressed":F(c)?`true`:void 0,onContextmenu:n[0]||=u(()=>{},[`prevent`])}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`type`,`style`,`disabled`,`data-disabled`,`data-pressed`]))}}),Ma=V({__name:`NumberFieldInput`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`input`}},setup(e){let t=e,{primitiveElement:n,currentElement:r}=ke(),a=Da(),s=Ht(),{isComposing:c,handleCompositionStart:l,handleCompositionEnd:u}=Zt();function d(e){if(!(c.value||e.isComposing))switch(e.key){case s.ARROW_UP:e.preventDefault(),a.handleIncrease();break;case s.ARROW_DOWN:e.preventDefault(),a.handleDecrease();break;case s.PAGE_UP:e.preventDefault(),a.handleIncrease(10);break;case s.PAGE_DOWN:e.preventDefault(),a.handleDecrease(10);break;case s.HOME:e.preventDefault(),a.handleMinMaxValue(`min`);break;case s.END:e.preventDefault(),a.handleMinMaxValue(`max`);break;case s.ENTER:a.applyInputValue(e.target?.value)}}function p(e){a.disableWheelChange.value||e.target===Un()&&(Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),e.deltaY>0?a.invertWheelChange.value?a.handleDecrease():a.handleIncrease():e.deltaY<0&&(a.invertWheelChange.value?a.handleIncrease():a.handleDecrease())))}he(()=>{a.onInputElement(r.value)});let m=A(a.textValue.value);f(()=>a.textValue.value,()=>{m.value=a.textValue.value},{immediate:!0,deep:!0});function h(){requestAnimationFrame(()=>{m.value=a.textValue.value})}return(e,r)=>(J(),k(F(rr),W(t,{id:F(a).id.value,ref_key:`primitiveElement`,ref:n,value:m.value,role:`spinbutton`,type:`text`,tabindex:`0`,inputmode:F(a).inputMode.value,disabled:F(a).disabled.value?``:void 0,"data-disabled":F(a).disabled.value?``:void 0,readonly:F(a).readonly.value?``:void 0,"data-readonly":F(a).readonly.value?``:void 0,autocomplete:`off`,autocorrect:`off`,spellcheck:`false`,"aria-roledescription":`Number field`,"aria-valuenow":F(a).modelValue.value,"aria-valuemin":F(a).min.value,"aria-valuemax":F(a).max.value,onKeydown:d,onWheel:p,onBeforeinput:r[0]||=e=>{if(e.isComposing||e.inputType.startsWith(`delete`)||e.inputType.startsWith(`history`))return;let t=e.target,n=t.value.slice(0,t.selectionStart??void 0)+(e.data??``)+t.value.slice(t.selectionEnd??void 0);F(a).validate(n)||e.preventDefault()},onInput:r[1]||=e=>{let t=e.target;m.value=t.value},onChange:h,onBlur:r[2]||=e=>F(a).applyInputValue(e.target?.value),onCompositionstart:F(l),onCompositionend:F(u)}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`id`,`value`,`inputmode`,`disabled`,`data-disabled`,`readonly`,`data-readonly`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`,`onCompositionstart`,`onCompositionend`]))}}),Na=V({__name:`BaseSeparator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,n=[`horizontal`,`vertical`];function r(e){return n.includes(e)}let a=p(()=>r(t.orientation)?t.orientation:`horizontal`),s=p(()=>a.value===`vertical`?t.orientation:void 0),c=p(()=>t.decorative?{role:`none`}:{"aria-orientation":s.value,role:`separator`});return(e,t)=>(J(),k(F(rr),W({as:e.as,"as-child":e.asChild,"data-orientation":a.value},c.value),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`data-orientation`]))}}),Pa=V({__name:`Separator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return(e,n)=>(J(),k(Na,R(U(t)),{default:i(()=>[o(e.$slots,`default`)]),_:3},16))}}),[Fa,Ia]=$n(`TagsInputRoot`),La=V({__name:`TagsInputRoot`,props:{modelValue:{type:[Array,null],required:!1},defaultValue:{type:Array,required:!1,default:()=>[]},addOnPaste:{type:Boolean,required:!1},addOnTab:{type:Boolean,required:!1},addOnBlur:{type:Boolean,required:!1},duplicate:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},delimiter:{type:null,required:!1,default:`,`},dir:{type:String,required:!1},max:{type:Number,required:!1,default:0},id:{type:String,required:!1},convertValue:{type:Function,required:!1},displayValue:{type:Function,required:!1,default:e=>e.toString()},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`invalid`,`addTag`,`removeTag`],setup(e,{emit:t}){let n=e,r=t,{addOnPaste:a,disabled:s,delimiter:c,max:l,id:u,dir:d,addOnBlur:f,addOnTab:m}=oe(n),h=Dt(d),g=te(n,`modelValue`,r,{defaultValue:n.defaultValue,passive:!0,deep:!0}),{forwardRef:_,currentElement:v}=Vn(),{focused:y}=L(v),b=an(v),{getItems:x,CollectionSlot:S}=De({isProvider:!0}),C=A(),w=A(!1),T=p(()=>Array.isArray(g.value)?[...g.value]:[]);function E(e){if(e!==-1){let t=g.value[e];g.value=g.value.filter((t,n)=>n!==e),r(`removeTag`,t)}}return Ia({modelValue:g,onAddValue:e=>{let t=[...T.value],i=t.length>0&&typeof t[0]==`object`,a=t.length>0&&typeof n.defaultValue[0]==`object`;if((i||a)&&typeof n.convertValue!=`function`)throw Error("You must provide a `convertValue` function when using objects as values.");let o=n.convertValue?n.convertValue(e):e;if(t.length>=l.value&&l.value)return r(`invalid`,o),!1;if(n.duplicate)return g.value=[...t,o],r(`addTag`,o),!0;if(t.includes(o))w.value=!0;else return g.value=[...t,o],r(`addTag`,o),!0;return r(`invalid`,o),!1},onRemoveValue:E,onInputKeydown:e=>{if(e.isComposing)return;let t=e.target,n=x().map(e=>e.ref).filter(e=>e.dataset.disabled!==``);if(!n.length)return;let r=n.at(-1);switch(e.key){case`Delete`:case`Backspace`:if(t.selectionStart!==0||t.selectionEnd!==0)break;if(C.value){let t=n.findIndex(e=>e===C.value),i=x().find(e=>e.ref===C.value);E(i?g.value.findIndex(e=>tr(e,i.value)):-1),C.value=C.value===r?n.at(t-1):n.at(t+1),e.preventDefault()}else e.key===`Backspace`&&(C.value=r,e.preventDefault());break;case`Home`:case`End`:case`ArrowRight`:case`ArrowLeft`:{let i=e.key===`ArrowRight`&&h.value===`ltr`||e.key===`ArrowLeft`&&h.value===`rtl`,a=!i;if(t.selectionStart!==0||t.selectionEnd!==0)break;if(a&&!C.value)C.value=r,e.preventDefault();else if(i&&r&&C.value===r)C.value=void 0,e.preventDefault();else if(C.value){let t=nt(e,C.value,void 0,{itemsArray:n,loop:!1,dir:h.value});t&&(C.value=t),e.preventDefault()}break}case`ArrowUp`:case`ArrowDown`:C.value&&e.preventDefault();break;default:C.value=void 0}},selectedElement:C,isInvalidInput:w,addOnPaste:a,addOnBlur:f,addOnTab:m,dir:h,disabled:s,delimiter:c,max:l,id:u,displayValue:n.displayValue}),(e,t)=>(J(),k(F(S),null,{default:i(()=>[H(F(rr),{ref:F(_),dir:F(h),as:e.as,"as-child":e.asChild,"data-invalid":w.value?``:void 0,"data-disabled":F(s)?``:void 0,"data-focused":F(y)?``:void 0},{default:i(()=>[o(e.$slots,`default`,{modelValue:F(g)}),F(b)&&e.name?(J(),k(F(nn),{key:0,name:e.name,value:F(g),required:e.required,disabled:F(s)},null,8,[`name`,`value`,`required`,`disabled`])):M(`v-if`,!0)]),_:3},8,[`dir`,`as`,`as-child`,`data-invalid`,`data-disabled`,`data-focused`])]),_:3}))}}),Ra=V({__name:`TagsInputInput`,props:{placeholder:{type:String,required:!1},autoFocus:{type:Boolean,required:!1},maxLength:{type:Number,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`input`}},setup(e){let t=e,n=Fa(),{forwardRef:r,currentElement:a}=Vn();function s(e){if(n.selectedElement.value=void 0,!n.addOnBlur.value)return;let t=e.target,r=e.relatedTarget,i=t.getAttribute(`aria-controls`);i&&r?.closest(`#${CSS.escape(i)}`)||t.value&&n.onAddValue(t.value)&&(t.value=``)}function c(e){n.addOnTab.value&&f(e)}let{isComposing:l,handleCompositionStart:u,handleCompositionEnd:d}=Zt();async function f(e){if(l.value||(await ae(),e.defaultPrevented))return;let t=e.target;t.value&&(n.onAddValue(t.value)&&(t.value=``),e.preventDefault())}function p(e){if(l.value||(n.isInvalidInput.value=!1,e.data===null))return;let t=n.delimiter.value;if(t===e.data||t instanceof RegExp&&t.test(e.data)){let r=e.target;if(r.value=r.value.replace(t,``),r.value.trim()===``){r.value=``;return}n.onAddValue(r.value)&&(r.value=``)}}function m(e){l.value||n.onInputKeydown(e)}function h(e){if(n.addOnPaste.value){e.preventDefault();let t=e.clipboardData;if(!t)return;let r=t.getData(`text`);n.delimiter.value?r.split(n.delimiter.value).forEach(e=>{n.onAddValue(e)}):n.onAddValue(r)}}return he(()=>{let e=a.value.nodeName===`INPUT`?a.value:a.value.querySelector(`input`);e&&setTimeout(()=>{t.autoFocus&&e?.focus()},1)}),(e,t)=>(J(),k(F(rr),{id:F(n).id?.value,ref:F(r),type:`text`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,as:e.as,"as-child":e.asChild,maxlength:e.maxLength,placeholder:e.placeholder,disabled:F(n).disabled.value,"data-invalid":F(n).isInvalidInput.value?``:void 0,onInput:p,onKeydown:[E(f,[`enter`]),E(c,[`tab`]),m],onBlur:s,onCompositionstart:F(u),onCompositionend:F(d),onPaste:h},{default:i(()=>[o(e.$slots,`default`)]),_:3},8,[`id`,`as`,`as-child`,`maxlength`,`placeholder`,`disabled`,`data-invalid`,`onCompositionstart`,`onCompositionend`]))}}),[za,Ba]=$n(`TagsInputItem`),Va=V({__name:`TagsInputItem`,props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,{value:n}=oe(t),r=Fa(),{forwardRef:a,currentElement:s}=Vn(),{CollectionItem:c}=De(),l=p(()=>r.selectedElement.value===s.value),u=p(()=>t.disabled||r.disabled.value),d=Ba({value:n,isSelected:l,disabled:u,textId:``,displayValue:p(()=>r.displayValue(n.value))});return(e,t)=>(J(),k(F(c),{value:F(n)},{default:i(()=>[H(F(rr),{ref:F(a),as:e.as,"as-child":e.asChild,"aria-labelledby":F(d).textId,"aria-current":l.value,"data-disabled":u.value?``:void 0,"data-state":l.value?`active`:`inactive`},{default:i(()=>[o(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-labelledby`,`aria-current`,`data-disabled`,`data-state`])]),_:3},8,[`value`]))}}),Ha=V({__name:`TagsInputItemDelete`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;Vn();let n=Fa(),r=za(),a=p(()=>r.disabled?.value||n.disabled.value);function s(){if(a.value)return;let e=n.modelValue.value.findIndex(e=>tr(e,r.value.value));n.onRemoveValue(e)}return(e,n)=>(J(),k(F(rr),W({tabindex:`-1`},t,{"aria-labelledby":F(r).textId,"aria-current":F(r).isSelected.value,"data-state":F(r).isSelected.value?`active`:`inactive`,"data-disabled":a.value?``:void 0,type:e.as===`button`?`button`:void 0,onClick:s}),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`aria-labelledby`,`aria-current`,`data-state`,`data-disabled`,`type`]))}}),Ua=V({__name:`TagsInputItemText`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let t=e,n=za();return Vn(),n.textId||=Pr(void 0,`reka-tags-input-item-text`),(e,r)=>(J(),k(F(rr),W(t,{id:F(n).textId}),{default:i(()=>[o(e.$slots,`default`,{},()=>[K(q(F(n).displayValue.value),1)])]),_:3},16,[`id`]))}}),[Wa,Ga]=$n(`TimeRangeFieldRoot`);function Ka(e,t=Ne(en())){return e&&`day`in e?e:ct(t,e)}var qa=V({inheritAttrs:!1,__name:`TimeRangeFieldRoot`,props:{defaultValue:{type:Object,required:!1,default:void 0},defaultPlaceholder:{type:Object,required:!1},placeholder:{type:Object,required:!1,default:void 0},modelValue:{type:[Object,null],required:!1},hourCycle:{type:null,required:!1},step:{type:Object,required:!1},granularity:{type:String,required:!1},hideTimeZone:{type:Boolean,required:!1},maxValue:{type:Object,required:!1},minValue:{type:Object,required:!1},locale:{type:String,required:!1},disabled:{type:Boolean,required:!1,default:!1},readonly:{type:Boolean,required:!1,default:!1},id:{type:String,required:!1},dir:{type:String,required:!1},isTimeUnavailable:{type:Function,required:!1,default:void 0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:placeholder`],setup(e,{expose:t,emit:n}){let r=e,a=n,{disabled:s,readonly:c,granularity:l,defaultValue:u,minValue:d,maxValue:m,dir:h,locale:g,isTimeUnavailable:_}=oe(r),v=Lt(g),y=Dt(h),b=wn(v.value,{hourCycle:kn(r.hourCycle)}),{primitiveElement:x,currentElement:S}=ke(),C=A(new Set),w=p(()=>Mt(r)),T=p(()=>d.value?Ka(d.value):void 0),D=p(()=>m.value?Ka(m.value):void 0);he(()=>{Qt(S.value).forEach(e=>C.value.add(e))});let O=te(r,`modelValue`,a,{defaultValue:u.value??{start:void 0,end:void 0},passive:r.modelValue===void 0}),j=p(()=>{if(!O.value?.start)return!1;let e=Ka(O.value.start);return!!(_.value?.(e)||T.value&&En(e,T.value)||D.value&&En(D.value,e))}),M=p(()=>{if(!O.value?.end)return!1;let e=Ka(O.value.end);return!!(_.value?.(e)||T.value&&En(e,T.value)||D.value&&En(D.value,e))}),N=p(()=>{if(j.value||M.value)return!0;if(!O.value?.start||!O.value?.end)return!1;let e={start:Ka(O.value.start),end:Ka(O.value.end)};return!yt(e.start,e.end)||_.value!==void 0&&!gt(e.start,e.end,_.value,void 0)}),P=A(O.value?.start?.copy()),I=A(O.value?.end?.copy());f([P,I],([e,t])=>{O.value={start:e?.copy(),end:t?.copy()}});let L=p({get(){return In(P.value)?P.value:Ka(P.value)},set(e){return e?P.value=P.value&&`day`in P.value?e:new Ve(e.hour,e.minute,e.second,P.value?.millisecond):P.value=e,e}}),R=p({get(){return In(I.value)?I.value:Ka(I.value)},set(e){return e?I.value=I.value&&`day`in I.value?e:new Ve(e.hour,e.minute,e.second,I.value?.millisecond):I.value=e,e}}),ee=p(()=>({start:L.value,end:R.value})),z=Le({defaultPlaceholder:r.placeholder,defaultValue:O.value?.start}),B=te(r,`placeholder`,a,{defaultValue:r.defaultPlaceholder??z.copy(),passive:r.placeholder===void 0}),V=p({get(){return Ka(B.value)},set(e){return e&&(B.value=`day`in B.value?e.copy():new Ve(e.hour,e.minute,e.second,B.value?.millisecond)),e}}),ne=p(()=>l.value?l.value:`minute`),re=dt(ne.value),ie=A(L.value?{...Je({value:L.value,formatter:b})}:{...re}),U=A(R.value?{...Je({value:R.value,formatter:b})}:{...re}),se=p(()=>ot({granularity:ne.value,dateRef:V.value,formatter:b,hideTimeZone:r.hideTimeZone,hourCycle:r.hourCycle,segmentValues:ie.value,locale:v,isTimeValue:!0})),ce=p(()=>ot({granularity:ne.value,dateRef:V.value,formatter:b,hideTimeZone:r.hideTimeZone,hourCycle:r.hourCycle,segmentValues:U.value,locale:v,isTimeValue:!0})),le=p(()=>({start:se.value.arr,end:ce.value.arr})),G=p(()=>({start:le.value.start.filter(({part:e})=>e!==`literal`),end:le.value.end.filter(({part:e})=>e!==`literal`)}));f(ee,e=>{(e?.start&&L.value?e.start.compare(L.value)!==0:e?.start!==L.value)&&(L.value=e?.start?.copy()),(e?.end&&R.value?e.end.compare(R.value)!==0:e?.end!==R.value)&&(R.value=e?.end?.copy())}),f([L,v],([e])=>{e===void 0?Object.values(ie.value).every(e=>e!==null)&&e===void 0&&(ie.value={...re}):ie.value={...We({value:e,formatter:b})}}),f(v,e=>{b.getLocale()!==e&&(b.setLocale(e),ae(()=>{C.value.clear(),Qt(S.value).forEach(e=>C.value.add(e))}))}),f(ee,e=>{e&&e.start!==void 0&&B.value.compare(e.start)!==0&&(B.value=e.start.copy())}),f([R,v],([e])=>{e===void 0?Object.values(U.value).every(e=>e!==null)&&e===void 0&&(U.value={...re}):U.value={...We({value:e,formatter:b})}});let ue=A(null),de=p(()=>Array.from(C.value).findIndex(e=>e.getAttribute(`data-reka-time-field-segment`)===ue.value?.getAttribute(`data-reka-time-field-segment`)&&e.getAttribute(`data-reka-time-range-field-segment-type`)===ue.value?.getAttribute(`data-reka-time-range-field-segment-type`))),fe=p(()=>{let e=y.value===`rtl`?-1:1;return(e<0?de.value<0:de.value>C.value.size-1)?null:Array.from(C.value)[de.value+e]}),K=p(()=>{let e=y.value===`rtl`?-1:1;return(e>0?de.value<0:de.value>C.value.size-1)?null:Array.from(C.value)[de.value-e]}),q=Ht();function pe(e){e.isComposing||rt(e.key)&&(e.key===q.ARROW_LEFT&&K.value?.focus(),e.key===q.ARROW_RIGHT&&fe.value?.focus())}function me(e){ue.value=e}return Ga({locale:v,startValue:L,endValue:R,placeholder:V,disabled:s,formatter:b,hourCycle:r.hourCycle,step:w,readonly:c,isInvalid:N,segmentValues:{start:ie,end:U},segmentContents:G,elements:C,setFocusedElement:me,focusNext(){Array.from(C.value)[de.value+1]?.focus()}}),t({setFocusedElement:me}),(e,t)=>(J(),k(F(rr),W(e.$attrs,{ref_key:`primitiveElement`,ref:x,role:`group`,"aria-disabled":F(s)?!0:void 0,"data-disabled":F(s)?``:void 0,"data-readonly":F(c)?``:void 0,"data-invalid":N.value?``:void 0,dir:F(y),onKeydown:E(pe,[`left`,`right`])}),{default:i(()=>[o(e.$slots,`default`,{modelValue:F(O),segments:le.value,isInvalid:N.value}),H(F(Hn),{id:e.id,as:`input`,feature:`focusable`,tabindex:`-1`,value:`${F(O)?.start?.toString()} - ${F(O)?.end?.toString()}`,name:e.name,disabled:F(s),required:e.required,onFocus:t[0]||=e=>Array.from(C.value)?.[0]?.focus()},null,8,[`id`,`value`,`name`,`disabled`,`required`])]),_:3},16,[`aria-disabled`,`data-disabled`,`data-readonly`,`data-invalid`,`dir`]))}}),Ja=V({__name:`TimeRangeFieldInput`,props:{part:{type:null,required:!0},type:{type:String,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e,r=Wa(),a=A(!0),s=A(!1),{handleSegmentClick:c,handleSegmentKeydown:l,handleSegmentBeforeInput:u,handleSegmentCompositionStart:d,handleSegmentCompositionEnd:f,attributes:m}=Pe({hasLeftFocus:a,lastKeyZero:s,placeholder:r.placeholder,hourCycle:r.hourCycle,step:r.step,segmentValues:r.segmentValues[t.type],formatter:r.formatter,part:t.part,disabled:r.disabled,readonly:r.readonly,focusNext:r.focusNext,modelValue:t.type===`start`?r.startValue:r.endValue}),h=p(()=>r.disabled.value),g=p(()=>r.readonly.value),_=p(()=>r.isInvalid.value);return(e,t)=>(J(),k(F(rr),W({as:e.as,"as-child":e.asChild},F(m),{contenteditable:h.value||g.value?!1:e.part!==`literal`,"data-reka-time-field-segment":e.part,"data-reka-time-range-field-segment-type":e.type,"aria-disabled":h.value?!0:void 0,"aria-readonly":g.value?!0:void 0,"data-disabled":h.value?``:void 0,"data-invalid":_.value?``:void 0,"aria-invalid":_.value?!0:void 0},n(e.part===`literal`?{}:{mousedown:F(c),keydown:F(l),beforeinput:F(u),compositionstart:F(d),compositionend:F(f),focusout:()=>{a.value=!0},focusin:e=>{F(r).setFocusedElement(e.target)}})),{default:i(()=>[o(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`contenteditable`,`data-reka-time-field-segment`,`data-reka-time-range-field-segment-type`,`aria-disabled`,`aria-readonly`,`data-disabled`,`data-invalid`,`aria-invalid`]))}});function Ya(e){let t=e.replace(/@.*/,``).trim().split(/[\s._-]+/).filter(Boolean);return((t[0]?.[0]??``)+(t.length>1?t.at(-1)[0]:t[0]?.[1]??``)).toUpperCase()||`?`}var Xa=V({name:`AvatarStack`,props:{people:{required:!0,type:Array},max:{default:3,type:[Number,null]},size:{default:`default`,type:String},variant:{default:`default`,type:String}},setup(e){let t=p(()=>{let t=new Set;return e.people.filter(e=>!t.has(e.id)&&t.add(e.id))}),n=p(()=>{let n=e.max===null?1/0:Math.max(2,e.max);return t.value.length>n?t.value.slice(0,n-1):t.value}),r=p(()=>t.value.slice(n.value.length));return()=>ue(`div`,{"aria-label":`${t.value.length} ${t.value.length===1?`person`:`people`}: ${t.value.map(e=>e.name).join(`, `)}`,"data-size":e.size,"data-slot":`avatar-stack`,"data-variant":e.variant,role:`group`},[...n.value.map(e=>ue(`span`,{"aria-hidden":`true`,"data-slot":`avatar-stack-item`,key:e.id,style:e.color?{"--vh-avatar-color":e.color}:void 0,title:e.name},e.image?ue(`img`,{alt:``,"data-slot":`avatar-stack-image`,src:e.image}):ue(`span`,{"data-slot":`avatar-stack-fallback`},Ya(e.name)))),r.value.length?ue(`span`,{"aria-hidden":`true`,"data-slot":`avatar-stack-count`,title:r.value.map(e=>e.name).join(`, `)},`+${r.value.length}`):null])}}),Za=Symbol(`ConnectionStatus`),Qa={connected:`Connected`,connecting:`Connecting`,reconnecting:`Reconnecting`},$a=V({name:`ConnectionStatus`,props:{status:{required:!0,type:String},delay:{default:1500,type:Number}},setup(e,{slots:t}){let n=A(e.status===`connected`),r=A(!1),i;f(()=>e.status,(t,a)=>{t===`connected`?(clearTimeout(i),n.value=!0,r.value=!1):a===`connected`&&(i=setTimeout(()=>r.value=!0,e.delay))}),P(()=>clearTimeout(i));let a=p(()=>n.value?r.value?`reconnecting`:`connected`:`connecting`);return w(Za,a),()=>ue(`div`,{"data-slot":`connection-status`,"data-status":a.value,role:`status`},t.default?.({state:a.value})??[ue(eo),ue(to)])}}),eo=V({name:`ConnectionStatusIndicator`,setup(){let e=ie(Za,A(`connecting`));return()=>ue(`span`,{"aria-hidden":`true`,"data-slot":`connection-status-indicator`,"data-status":e.value})}}),to=V({name:`ConnectionStatusLabel`,setup(e,{slots:t}){let n=ie(Za,A(`connecting`));return()=>ue(`span`,{"data-slot":`connection-status-label`,"data-status":n.value},t.default?.({state:n.value})??Qa[n.value])}}),no=8,ro=128,io=128,ao=1024,oo=16384,so=128,co=16384,lo=256,uo=new WeakMap;function fo(){throw Se.RUNTIME_R0006({message:`[vitehub] ViteHubError requires a valid public error contract.`})}function po(e){try{return Array.isArray(e)}catch{fo()}}function mo(e,t,n=!1){try{let r=Object.getOwnPropertyDescriptor(e,t);return r===void 0?void 0:((!(`value`in r)||n&&!r.enumerable)&&fo(),r.value)}catch{fo()}}function ho(e,t,n,r){if(t.nodes+=1,t.nodes>ao&&fo(),e===void 0&&r)return;if(e===null||typeof e==`boolean`||typeof e==`string`&&e.length<=oo||typeof e==`number`&&Number.isFinite(e))return e;(typeof e!=`object`||n>no||t.ancestors.has(e))&&fo();let i,a;try{i=Object.getPrototypeOf(e),a=Reflect.ownKeys(e)}catch{fo()}t.ancestors.add(e);try{if(po(e)){let r=mo(e,`length`);(!Number.isSafeInteger(r)||r<0||r>ro||a.length!==r+1||!a.includes(`length`))&&fo();let i=[];for(let o=0;o<r;o+=1){let r=String(o);a.includes(r)||fo(),i.push(ho(mo(e,r,!0),t,n+1,!1))}return Object.freeze(i)}i!==Object.prototype&&i!==null&&fo(),(a.length>ro||a.some(e=>typeof e!=`string`))&&fo();let r={};for(let i of a)(i.length===0||i.length>io)&&fo(),Object.defineProperty(r,i,{enumerable:!0,value:ho(mo(e,i,!0),t,n+1,!0),writable:!0});return Object.freeze(r)}finally{t.ancestors.delete(e)}}function go(e){if(e!==void 0)return(typeof e!=`object`||!e||po(e))&&fo(),ho(e,{ancestors:new Set,nodes:0},0,!1)}function _o(e,t,n){(typeof e!=`string`||e.length===0||e.length>so)&&fo(),(typeof t!=`string`||t.length===0||t.length>co)&&fo(),(typeof n!=`object`||!n||po(n))&&fo();let r=mo(n,`cause`),i=go(mo(n,`details`)),a=mo(n,`requestId`);return a!==void 0&&(typeof a!=`string`||a.length===0||a.length>lo)&&fo(),{cause:r,code:e,details:i,message:t,name:`ViteHubError`,requestId:a,shape:Object.freeze({code:e,...i===void 0?{}:{details:i},message:t,name:`ViteHubError`,...a===void 0?{}:{requestId:a}})}}var vo=class extends Error{code;details;requestId;constructor(e,t,n={}){let r=_o(e,t,n);super(r.message,r.cause===void 0?void 0:{cause:r.cause}),this.name=`ViteHubError`,this.code=r.code,this.details=r.details,this.requestId=r.requestId;let i=this.toJSON.bind(this);Object.defineProperties(this,{code:{configurable:!0,enumerable:!0,value:r.code,writable:!1},details:{configurable:!0,enumerable:!0,value:r.details,writable:!1},message:{configurable:!0,enumerable:!1,value:r.message,writable:!1},name:{configurable:!1,enumerable:!1,value:r.name,writable:!1},requestId:{configurable:!0,enumerable:!0,value:r.requestId,writable:!1},toJSON:{configurable:!1,enumerable:!1,value:i,writable:!1}}),uo.set(this,r.shape)}toJSON(){let e=uo.get(this);if(e)return e;let t=_o(mo(this,`code`),mo(this,`message`),{details:mo(this,`details`),requestId:mo(this,`requestId`)});return uo.set(this,t.shape),t.shape}},yo=`vitehub-content-preview`,bo=`vitehub-content-published`;function xo(e){return Array.isArray(e[0])}var So=Object.defineProperty,Co=(e,t)=>{let n={};for(var r in e)So(n,r,{get:e[r],enumerable:!0});return t||So(n,Symbol.toStringTag,{value:`Module`}),n};function wo(e){this.content=e}wo.prototype={constructor:wo,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 wo(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 wo(n)},addToStart:function(e,t){return new wo([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new wo(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 wo(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=wo.from(e),e.size?new wo(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=wo.from(e),e.size?new wo(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=wo.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}},wo.from=function(e){if(e instanceof wo)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new wo(t)};function To(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){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Oo(e.charCodeAt(r-1))&&Do(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=To(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Eo(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=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Oo(e.charCodeAt(i-1))&&Do(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Eo(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Do(e){return e>=56320&&e<57344}function Oo(e){return e>=55296&&e<56320}var Y=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 To(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Eo(this,e,t,n)}findIndex(e){if(e==0)return Ao(0,e);if(e==this.size)return Ao(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?Ao(t+1,i):Ao(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)`:``))}};Y.empty=new Y([],0);var ko={index:0,offset:0};function Ao(e,t){return ko.index=e,ko.offset=t,ko}function jo(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(!jo(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!jo(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Mo=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&&jo(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`);return n.create(t.attrs)}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}};Mo.none=[];var No=class extends Error{},X=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=Fo(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(Po(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(Y.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)}};X.empty=new X(Y.empty,0,0);function Po(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(Po(a.content,t-i-1,n-i-1)))}function Fo(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=Fo(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 Io(e,t,n){if(n.openStart>e.depth)throw new No(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new No(`Inconsistent open depths`);return Lo(e,t,n,0)}function Lo(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=Lo(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Ho(a,Wo(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ho(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Go(n,e);return Ho(a,Uo(e,i,o,t,r))}}function Ro(e,t){if(!t.type.compatibleContent(e.type))throw new No(`Cannot join `+t.type.name+` onto `+e.type.name)}function zo(e,t,n){let r=e.node(n);return Ro(r,t.node(n)),r}function Bo(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 Vo(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&&(Bo(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Bo(i.child(e),r);t&&t.depth==n&&t.textOffset&&Bo(t.nodeBefore,r)}function Ho(e,t){if(!e.type.validContent(t))throw new No(`Invalid content for node `+e.type.name);return e.copy(t)}function Uo(e,t,n,r,i){let a=e.depth>i&&zo(e,t,i+1),o=r.depth>i&&zo(n,r,i+1),s=[];return Vo(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ro(a,o),Bo(Ho(a,Uo(e,t,n,r,i+1)),s)):(a&&Bo(Ho(a,Wo(e,t,i+1)),s),Vo(t,n,i,s),o&&Bo(Ho(o,Wo(n,r,i+1)),s)),Vo(r,null,i,s),new Y(s)}function Wo(e,t,n){let r=[];return Vo(null,e,n,r),e.depth>n&&Bo(Ho(zo(e,t,n+1),Wo(e,t,n+1)),r),Vo(t,null,n,r),new Y(r)}function Go(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(Y.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ko=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 Mo.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 Xo(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=Yo.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 Yo.set(t,r=new qo);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Jo,i}},qo=class{constructor(){this.elts=[],this.i=0}},Jo=12,Yo=new WeakMap,Xo=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)}},Zo=Object.create(null),Qo=class e{constructor(e,t,n,r=Mo.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Y.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&&jo(this.attrs,t||e.defaultAttrs||Zo)&&Mo.sameSet(this.marks,n||Mo.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 X.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new X(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Io(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 Ko.resolveCached(this,e)}resolveNoCache(e){return Ko.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()+`)`),es(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=Y.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),ts(this.type.attrs,this.attrs,`node`,this.type.name);let e=Mo.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];ts(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!Mo.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=Y.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};Qo.prototype.text=void 0;var $o=class e extends Qo{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):es(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 es(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function ts(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var ns=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new rs(t,n);if(r.next==null)return e.empty;let i=is(r);r.next&&r.err(`Unexpected trailing text`);let a=hs(fs(i));return gs(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 Y.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
|
+
`)}};ns.empty=new ns(!0);var rs=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 is(e){let t=[];do t.push(as(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function as(e){let t=[];do t.push(ss(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ss(e){let t=ds(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=ls(e,t);else break;return t}function cs(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ls(e,t){let n=cs(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:cs(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function us(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 ds(e){if(e.eat(`(`)){let t=is(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=us(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 fs(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 ps(e,t){return t-e}function ms(e,t){let n=[];return r(t),n.sort(ps);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 hs(e){let t=Object.create(null);return n(ms(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]);ms(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ns(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(ps);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function gs(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 _s(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 vs(e,t){let n=Object.create(null);for(let r in e){let i=e[r],a=t&&t[r];if(a===void 0){if(i.hasDefault)a=i.default;else throw RangeError(`No value supplied for attribute `+r)}else i.validate&&i.validate(a);n[r]=a}return n}function ys(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ss(e,r,t[r]);return n}var bs=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=ys(e,n.attrs),this.defaultAttrs=_s(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==ns.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:vs(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Qo(this,this.computeAttrs(e),Y.from(t),Mo.setFrom(n))}createChecked(e=null,t,n){return t=Y.from(t),this.checkContent(t),new Qo(this,this.computeAttrs(e),t,Mo.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Y.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(Y.empty,!0);return i?new Qo(this,e,t.append(i),Mo.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){}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:Mo.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 xs(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 Ss=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?xs(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Cs=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ys(e,r.attrs),this.excluded=null;let i=_s(this.attrs);this.instance=i?new Mo(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Mo(this,vs(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]}excludes(e){return this.excluded.indexOf(e)>-1}},ws=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=wo.from(e.nodes),t.marks=wo.from(e.marks||{}),this.nodes=bs.compile(this.spec.nodes,this),this.marks=Cs.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]=ns.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?Ts(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==``?[]:Ts(this,n.split(` `))}this.nodeFromJSON=e=>Qo.fromJSON(this,e),this.markFromJSON=e=>Mo.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 bs))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 $o(n,n.defaultAttrs,e,Mo.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 Ts(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 Es(e){return e.tag!=null}function Ds(e){return e.style!=null}var Os=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Es(e))this.tags.push(e);else if(Ds(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 Ls(this,t,!1);return n.addAll(e,Mo.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ls(this,t,!0);return n.addAll(e,Mo.none,t.from,t.to),X.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(zs(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=Bs(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=Bs(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)))}},ks={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},As={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},js={ol:!0,ul:!0},Ms=1,Ns=2,Ps=4;function Fs(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Ms:0)|(t===`full`?Ns:0)}var Is=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=Mo.none,this.match=i||(a&Ps?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Y.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&Ms)){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=Y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Y.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&&!ks.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Ls=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=Fs(null,t.preserveWhitespace,0)|(n?Ps:0);i=r?new Is(r.type,r.attrs,Mo.none,!0,t.topMatch||r.type.contentMatch,a):n?new Is(null,null,Mo.none,!0,null,a):new Is(e.schema.topNodeType,null,Mo.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&Ns?`full`:this.localPreserveWS||(r.options&Ms)>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
|
+
`);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;js.hasOwnProperty(a)&&this.parser.normalizeLists&&Rs(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:As.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(ks.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
|
+
`),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=Mo.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Vs(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=Fs(e,i,a.options);a.options&Ps&&a.content.length==0&&(o|=Ps);let s=Mo.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):Vs(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new Is(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|=Ms);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}{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 Rs(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&js.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function zs(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Bs(e){let t={};for(let n in e)t[n]=e[n];return t}function Vs(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 Hs=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ws(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 Ws(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Js(Ws(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&&Js(Ws(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Js(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=Us(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Us(e.marks)}};function Us(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ws(e){return e.document||window.document}var Gs=new WeakMap;function Ks(e){let t=Gs.get(e);return t===void 0&&Gs.set(e,t=qs(e)),t}function qs(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 Js(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=Ks(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}}if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Js(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Ys=65535,Xs=2**16;function Zs(e,t){return e+t*Xs}function Qs(e){return e&Ys}function $s(e){return(e-(e&Ys))/Xs}var ec=1,tc=2,nc=4,rc=8,ic=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&rc)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&nc)>0}},ac=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=Qs(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+$s(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:Zs(o/3,e-s),f=0;return c&&(f|=e==s?tc:e==u?ec:nc,(t<0?e!=s:e!=u)&&(f|=rc)),new ic(a,f,d)}r+=l-c}return n?e+r:new ic(e+r,0,null)}touches(e,t){let n=0,r=Qs(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])}};ac.empty=new ac([]);var oc=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 ic(e,r,null)}},sc=Object.create(null),cc=class{getMap(){return ac.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=sc[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in sc)throw RangeError(`Duplicate use of step JSON ID `+e);return sc[e]=t,t.prototype.jsonID=e,t}},lc=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 No)return e.fail(t.message);throw t}}};function uc(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(uc(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Y.fromArray(r)}var dc=class e extends cc{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 X(uc(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 lc.fromReplace(e,this.from,this.to,i)}invert(){return new fc(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))}};cc.jsonID(`addMark`,dc);var fc=class e extends cc{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 X(uc(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return lc.fromReplace(e,this.from,this.to,n)}invert(){return new dc(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))}};cc.jsonID(`removeMark`,fc);var pc=class e extends cc{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lc.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return lc.fromReplace(e,this.pos,this.pos+1,new X(Y.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 mc(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))}};cc.jsonID(`addNodeMark`,pc);var mc=class e extends cc{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return lc.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return lc.fromReplace(e,this.pos,this.pos+1,new X(Y.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new pc(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))}};cc.jsonID(`removeNodeMark`,mc);var hc=class e extends cc{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&_c(e,this.from,this.to)?lc.fail(`Structure replace would overwrite content`):lc.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ac([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?X.empty:new X(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)}if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?X.empty:new X(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}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,X.fromJSON(t,n.slice),!!n.structure)}};hc.MAP_BIAS=1,cc.jsonID(`replace`,hc);var gc=class e extends cc{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&&(_c(e,this.from,this.gapFrom)||_c(e,this.gapTo,this.to)))return lc.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return lc.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?lc.fromReplace(e,this.from,this.to,n):lc.fail(`Content does not fit in gap`)}getMap(){return new ac([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,X.fromJSON(t,n.slice),n.insert,!!n.structure)}};cc.jsonID(`replaceAround`,gc);function _c(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 vc(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 fc(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new dc(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function yc(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 Cs){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 fc(t.from,t.to,t.style)))}function bc(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 hc(s,l,X.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new fc(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 X(Y.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new hc(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(Y.empty,!0);e.replace(s,s,new X(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function xc(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Sc(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||!xc(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Cc(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=Y.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Y.from(r.node(e).copy(u)),d++):c--;let f=Y.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=Y.from(i.node(e).copy(f)),p++):l++;e.step(new gc(c,l,o,s,new X(u.append(f),d,p),u.size-d,!0))}function wc(e,t,n=null,r=e){let i=Ec(e,t),a=i&&Dc(r,t);return a?i.map(Tc).concat({type:t,attrs:n}).concat(a.map(Tc)):null}function Tc(e){return{type:e,attrs:null}}function Ec(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 Dc(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 Oc(e,t,n){let r=Y.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=Y.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new gc(i,a,i,a,new X(r,0,0),n.length,!0))}function kc(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)&&Mc(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&&jc(e,t,n,a),bc(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 gc(c,l,c+1,l-1,new X(Y.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Ac(e,t,n,a),!1}})}function Ac(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 jc(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(`
|
|
5
|
+
`))}})}function Mc(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Nc(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new gc(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new X(Y.from(o),0,0),1,!0))}function Pc(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Fc(e,t,n=1,r){let i=e.doc.resolve(t),a=Y.empty,o=Y.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=Y.from(i.node(e).copy(a));let t=r&&r[s];o=Y.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new hc(t,t,new X(a.append(o),n,n),!0))}function Ic(e,t){let n=e.resolve(t),r=n.index();return Rc(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Lc(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Rc(e,t){return!!(e&&t&&!e.isLeaf&&Lc(e,t))}function zc(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Rc(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Bc(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);jc(e,r.node(),r.before(),s)}o.inlineContent&&bc(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new hc(l,c.map(t+n,-1),X.empty,!0)),r===!0){let t=e.doc.resolve(l);Ac(e,t.node(),t.before(),e.steps.length)}return e}function Vc(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Hc(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Uc(e,t,n=t,r=X.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Wc(i,a,r)?new hc(t,n,r):new Gc(i,a,r).fit()}function Wc(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Gc=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Y.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Y.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new X(i,a,o);return e>-1?new gc(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new hc(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Jc(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(Y.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return $c(e,-1)<=t?!1:(this.unplaced.size>1&&$c(e,1)>n&&n++,this.unplaced=new X(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Jc(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new X(Kc(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new X(Kc(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Yc(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=qc(this.placed,t,Y.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?X.empty:new X(Kc(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new X(Kc(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Xc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Xc(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Xc(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qc(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=qc(this.placed,this.depth,Y.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Y.empty,!0);e.childCount&&(this.placed=qc(this.placed,this.frontier.length,e))}};function Kc(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Kc(e.firstChild.content,t-1,n)))}function qc(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qc(e.lastChild.content,t-1,n)))}function Jc(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Yc(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Yc(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Y.empty,!0)))),e.copy(r)}function Xc(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Zc(n,a.content,o)?s:null}function Zc(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Qc(e){return e.spec.defining||e.spec.definingForContent}function $c(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function el(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Wc(i,a,r))return e.step(new hc(t,n,r));let o=il(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Qc(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new X(tl(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function tl(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(tl(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Y.empty,!0))}return e}function nl(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Vc(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new X(Y.from(r),0,0))}function rl(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=il(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function il(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var al=class e extends cc{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return lc.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return lc.fromReplace(e,this.pos,this.pos+1,new X(Y.from(r),0,+!t.isLeaf))}getMap(){return ac.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};cc.jsonID(`attr`,al);var ol=class e extends cc{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return lc.ok(n)}getMap(){return ac.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};cc.jsonID(`docAttr`,ol);var sl=class extends Error{};sl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},sl.prototype=Object.create(Error.prototype),sl.prototype.constructor=sl,sl.prototype.name=`TransformError`;var cl=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new sl(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=X.empty){let r=Uc(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new X(Y.from(n),0,0))}delete(e,t){return this.replace(e,t,X.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return el(this,e,t,n),this}replaceRangeWith(e,t,n){return nl(this,e,t,n),this}deleteRange(e,t){return rl(this,e,t),this}lift(e,t){return Cc(this,e,t),this}join(e,t=1){return Bc(this,e,t),this}wrap(e,t){return Oc(this,e,t),this}setBlockType(e,t=e,n,r=null){return kc(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Nc(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new al(e,t,n)),this}setDocAttribute(e,t){return this.step(new ol(e,t)),this}addNodeMark(e,t){return this.step(new pc(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof Mo)t.isInSet(n.marks)&&this.step(new mc(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new mc(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Fc(this,e,t,n),this}addMark(e,t,n){return vc(this,e,t,n),this}removeMark(e,t,n){return yc(this,e,t,n),this}clearIncompatible(e,t,n){return bc(this,e,t,n),this}},ll=Object.create(null),ul=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new dl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=X.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?X.empty:t),o==0&&bl(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),bl(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Z(e):yl(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?yl(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):yl(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new _l(e.node(0))}static atStart(e){return yl(e,e,0,0,1)||new _l(e)}static atEnd(e){return yl(e,e,e.content.size,e.childCount,-1)||new _l(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=ll[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ll)throw RangeError(`Duplicate use of selection JSON ID `+e);return ll[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Z.between(this.$anchor,this.$head).getBookmark()}};ul.prototype.visible=!0;var dl=class{constructor(e,t){this.$from=e,this.$to=t}},fl=!1;function pl(e){!fl&&!e.parent.inlineContent&&(fl=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Z=class e extends ul{constructor(e,t=e){pl(e),pl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return ul.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=X.empty){if(super.replace(e,t),t==X.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ml(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=ul.findFrom(n,r,!0)||ul.findFrom(n,-r,!0);if(e)n=e.$head;else return ul.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(ul.findFrom(t,-r,!0)||ul.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};ul.jsonID(`text`,Z);var ml=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return Z.between(e.resolve(this.anchor),e.resolve(this.head))}},hl=class e extends ul{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?ul.near(a):new e(a)}content(){return new X(Y.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new gl(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};hl.prototype.visible=!1,ul.jsonID(`node`,hl);var gl=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new ml(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&hl.isSelectable(n)?new hl(t):ul.near(t)}},_l=class e extends ul{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=X.empty){if(t==X.empty){e.delete(0,e.doc.content.size);let t=ul.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return vl}};ul.jsonID(`all`,_l);var vl={map(){return this},resolve(e){return new _l(e)}};function yl(e,t,n,r,i,a=!1){if(t.inlineContent)return Z.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=yl(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&hl.isSelectable(r))return hl.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function bl(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof hc||i instanceof gc))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(ul.near(e.doc.resolve(o),n))}var xl=1,Sl=2,Cl=4,wl=class extends cl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|xl)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&xl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Sl,this}ensureMarks(e){return Mo.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Sl)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Mo.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ul.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Cl,this}get scrolledIntoView(){return(this.updated&Cl)>0}};function Tl(e,t){return!t||!e?e:e.bind(t)}var El=class{constructor(e,t,n){this.name=e,this.init=Tl(t.init,n),this.apply=Tl(t.apply,n)}},Dl=[new El(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new El(`selection`,{init(e,t){return e.selection||ul.atStart(t.doc)},apply(e){return e.selection}}),new El(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new El(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Ol=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Dl.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new El(e.key,e.spec.state,e))})}},kl=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new wl(this)}static create(t){let n=new Ol(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Ol(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Ol(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Qo.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=ul.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Al(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Al(i,t,{})),n[r]=i}return n}var jl=class{constructor(e){this.spec=e,this.props={},e.props&&Al(e.props,this,this.props),this.key=e.key?e.key.key:Nl(`plugin`)}getState(e){return e[this.key]}},Ml=Object.create(null);function Nl(e){return e in Ml?e+`$`+ ++Ml[e]:(Ml[e]=0,e+`$`)}var Pl=class{constructor(e=`key`){this.key=Nl(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Fl=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Il(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Ll=(e,t,n)=>{let r=Il(e,n);if(!r)return!1;let i=Ul(r);if(!i){let n=r.blockRange(),i=n&&Sc(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(su(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Vl(a,`end`)||hl.isSelectable(a)))for(let n=r.depth;;n--){let o=Uc(e.doc,r.before(n),r.after(n),X.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Vl(a,`end`)?ul.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):hl.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Rl=(e,t,n)=>{let r=Il(e,n);if(!r)return!1;let i=Ul(r);return i?Bl(e,i,t):!1},zl=(e,t,n)=>{let r=Wl(e,n);if(!r)return!1;let i=ql(r);return i?Bl(e,i,t):!1};function Bl(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Uc(e.doc,i,o,X.empty);if(!s||s.from!=i||s instanceof hc&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(Z.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Vl(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Hl=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Ul(r)}let o=a&&a.nodeBefore;return!o||!hl.isSelectable(o)?!1:(t&&t(e.tr.setSelection(hl.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Ul(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Wl(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Gl=(e,t,n)=>{let r=Wl(e,n);if(!r)return!1;let i=ql(r);if(!i)return!1;let a=i.nodeAfter;if(su(e,i,t,1))return!0;if(r.parent.content.size==0&&(Vl(a,`start`)||hl.isSelectable(a))){let n=Uc(e.doc,r.before(),r.after(),X.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Vl(a,`start`)?ul.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):hl.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Kl=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=ql(r)}let o=a&&a.nodeAfter;return!o||!hl.isSelectable(o)?!1:(t&&t(e.tr.setSelection(hl.create(e.doc,a.pos)).scrollIntoView()),!0)};function ql(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Jl=(e,t)=>{let n=e.selection,r=n instanceof hl,i;if(r){if(n.node.isTextblock||!Ic(e.doc,n.from))return!1;i=n.from}else if(i=zc(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(hl.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Yl=(e,t)=>{let n=e.selection,r;if(n instanceof hl){if(n.node.isTextblock||!Ic(e.doc,n.to))return!1;r=n.to}else if(r=zc(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},Xl=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Sc(i);return a!=null&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Zl=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
6
|
+
`).scrollIntoView()),!0)};function Ql(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var $l=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=Ql(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(ul.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},eu=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof _l||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Ql(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(Z.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},tu=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Pc(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Sc(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function nu(e){return(t,n)=>{if(t.selection instanceof hl&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!Pc(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof Z||t.selection instanceof _l)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=Ql(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=Pc(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,Pc(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var ru=nu(),iu=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a!=0&&(i=n.before(a),t&&t(e.tr.setSelection(hl.create(e.doc,i))),!0)},au=(e,t)=>(t&&t(e.tr.setSelection(new _l(e.doc))),!0);function ou(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Ic(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function su(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&ou(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=Y.empty;for(let e=o.length-1;e>=0;e--)s=Y.from(o[e].create(null,s));s=Y.from(i.copy(s));let c=e.tr.step(new gc(t.pos-1,r,t.pos,r,new X(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Ic(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:ul.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Sc(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Vl(a,`start`,!0)&&Vl(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=Y.empty;for(let e=o.length-1;e>=0;e--)r=Y.from(o[e].copy(r));n(e.tr.step(new gc(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new X(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cu(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(Z.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var lu=cu(-1),uu=cu(1);function du(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&wc(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function fu(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function pu(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var mu=pu(Fl,Ll,Hl),hu=pu(Fl,Gl,Kl),gu={Enter:pu(Zl,eu,tu,ru),"Mod-Enter":$l,Backspace:mu,"Mod-Backspace":mu,"Shift-Backspace":mu,Delete:hu,"Mod-Delete":hu,"Mod-a":au},_u={"Ctrl-h":gu.Backspace,"Alt-Backspace":gu[`Mod-Backspace`],"Ctrl-d":gu.Delete,"Ctrl-Alt-Backspace":gu[`Mod-Delete`],"Alt-Delete":gu[`Mod-Delete`],"Alt-d":gu[`Mod-Delete`],"Ctrl-a":lu,"Ctrl-e":uu};for(let e in gu)_u[e]=gu[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function vu(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return yu(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function yu(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new Xo(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Xo(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=wc(a,n,r,t);return s?(e&&bu(e,t,s,i,n),!0):!1}function bu(e,t,n,r,i){let a=Y.empty;for(let e=n.length-1;e>=0;e--)a=Y.from(n[e].type.create(n[e].attrs,a));e.step(new gc(t.start-(r?2:0),t.end,t.start,t.end,new X(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Pc(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function xu(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Su(t,n,e,a):Cu(t,n,a):!0:!1}}function Su(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new gc(a-1,o,a,o,new X(Y.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Xo(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Sc(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Ic(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Cu(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?Y.empty:Y.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new gc(d-+!!s,f+ +!!c,d+1,f-1,new X((s?Y.empty:Y.from(i.copy(Y.empty))).append(c?Y.empty:Y.from(i.copy(Y.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function wu(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=Y.from(r?e.create():null),o=new X(Y.from(e.create(null,Y.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new gc(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var Tu=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Eu=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Du=null,Ou=function(e,t,n){let r=Du||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},ku=function(){Du=null},Au=function(e,t,n,r){return n&&(Mu(e,t,n,r,-1)||Mu(e,t,n,r,1))},ju=/^(img|br|input|textarea|hr)$/i;function Mu(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Nu(e))){let n=e.parentNode;if(!n||!Pu(n)||Bu(e)||ju.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Tu(e)+(i<0?0:1),e=n}else if(Pu(e)){let n=e.childNodes[t+(i<0?-1:0)];if(Pu(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?Nu(e):0}else return!1}}function Nu(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Pu(e){return e.nodeType==1}function Fu(e){return e.nodeType==3}function Iu(e,t){return t?e.contains(Pu(t)?t:t.parentNode):!1}function Lu(e,t){for(;;){if(Fu(e)&&t)return e;if(Pu(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Nu(e)}else if(e.parentNode&&!Bu(e))t=Tu(e),e=e.parentNode;else return null}}function Ru(e,t){for(;;){if(Fu(e)&&t<e.nodeValue.length)return e;if(Pu(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Bu(e))t=Tu(e)+1,e=e.parentNode;else return null}}function zu(e,t,n){for(let r=t==0,i=t==Nu(e);r||i;){if(e==n)return!0;let t=Tu(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Nu(e)}}function Bu(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Vu=function(e){return e.focusNode&&Au(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hu(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Uu(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Wu(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Nu(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Nu(r.startContainer),r.startOffset)}}}var Gu=typeof navigator<`u`?navigator:null,Ku=typeof document<`u`?document:null,qu=Gu&&Gu.userAgent||``,Ju=/Edge\/(\d+)/.exec(qu),Yu=/MSIE \d/.exec(qu),Xu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qu),Zu=!!(Yu||Xu||Ju),Qu=Yu?document.documentMode:Xu?+Xu[1]:Ju?+Ju[1]:0,$u=!Zu&&/gecko\/(\d+)/i.test(qu);$u&&+(/Firefox\/(\d+)/.exec(qu)||[0,0])[1];var ed=!Zu&&/Chrome\/(\d+)/.exec(qu),td=!!ed,nd=ed?+ed[1]:0,rd=!Zu&&!!Gu&&/Apple Computer/.test(Gu.vendor),id=rd&&(/Mobile\/\w+/.test(qu)||!!Gu&&Gu.maxTouchPoints>2),ad=id||(Gu?/Mac/.test(Gu.platform):!1),od=Gu?/Win/.test(Gu.platform):!1,sd=/Android \d/.test(qu),cd=!!Ku&&`webkitFontSmoothing`in Ku.documentElement.style,ld=cd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ud(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function dd(e,t){return typeof e==`number`?e:e[t]}function fd(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function pd(e,t,n){if(!Od(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!Pu(o)){o=Eu(o);continue}let e=o==a.body,n=e?ud(a):fd(o),s=0,c=0;if(t.top<n.top+dd(r,`top`)?c=-(n.top-t.top+dd(i,`top`)):t.bottom>n.bottom-dd(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+dd(i,`top`)-n.top:t.bottom-n.bottom+dd(i,`bottom`)),t.left<n.left+dd(r,`left`)?s=-(n.left-t.left+dd(i,`left`)):t.right>n.right-dd(r,`right`)&&(s=t.right-n.right+dd(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:Eu(o)}}function md(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:hd(e.dom)}}function hd(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Eu(r));return t}function gd({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_d(n,r==0?0:r-t)}function _d(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var vd=null;function yd(e){if(e.setActive)return e.setActive();if(vd)return e.focus(vd);let t=hd(e);e.focus(vd==null?{get preventScroll(){return vd={preventScroll:!0},!0}}:void 0),vd||(vd=!1,_d(t,0))}function bd(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(Pu(u))e=u.getClientRects();else if(Fu(u))e=Ou(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&Fu(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,Pu(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&Fu(n)?xd(n,i):!n||r?{node:e,offset:a}:bd(n,i)}function xd(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=kd(r,1);if(n.top!=n.bottom&&Sd(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Sd(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Cd(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function wd(e,t,n){let{node:r,offset:i}=bd(t,n),a=-1;if(Pu(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Td(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(Pu(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Ed(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(Pu(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Sd(t,i))return Ed(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Dd(e,t){let n=e.dom.ownerDocument,r,i=0,a=Wu(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!Sd(t,n)||(o=Ed(e.dom,t,n),!o))return null}if(rd)for(let e=o;r&&e;e=Eu(e))e.draggable&&(r=void 0);if(o=Cd(o,t),r){if($u&&Pu(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;cd&&i&&Pu(r)&&Pu(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&Pu(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!Pu(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=Td(e,r,i,t))}s??=wd(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Od(e){return e.top<e.bottom||e.left<e.right}function kd(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Od(e))return e}return Array.prototype.find.call(n,Od)||e.getBoundingClientRect()}var Ad=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jd(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=cd||$u;if(Fu(r)){if(o&&(Ad.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=kd(Ou(r,i,i),n);if($u&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=kd(Ou(r,i-1,i-1),-1);if(t.top==e.top){let n=kd(Ou(r,i,i+1),-1);if(n.top!=e.top)return Md(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Md(kd(Ou(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Nu(r))){let e=r.childNodes[i-1];if(Pu(e))return Nd(e.getBoundingClientRect(),!1)}if(a==null&&i<Nu(r)){let e=r.childNodes[i];if(Pu(e))return Nd(e.getBoundingClientRect(),!0)}return Nd(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Nu(r))){let e=r.childNodes[i-1],t=Fu(e)?Ou(e,Nu(e)-+!o):Pu(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Md(kd(t,1),!1)}if(a==null&&i<Nu(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?Fu(e)?Ou(e,0,+!o):Pu(e)?e:null:null;if(t)return Md(kd(t,-1),!0)}return Md(kd(Fu(r)?Ou(r):r,-n),n>=0)}function Md(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Nd(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Pd(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Fd(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Pd(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=jd(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(Pu(e))t=e.getClientRects();else if(Fu(e))t=Ou(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Id=/[\u0590-\u08ac]/;function Ld(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Id.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Pd(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!Iu(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Rd=null,zd=null,Bd=!1;function Vd(e,t,n){return Rd==t&&zd==n?Bd:(Rd=t,zd=n,Bd=n==`up`||n==`down`?Fd(e,t,n):Ld(e,t,n))}var Hd=0,Ud=1,Wd=2,Gd=3,Kd=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Hd,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&Iu(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Tu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(Pu(a)?Iu(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof $d||e instanceof qd&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Tu(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Tu(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Tu(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Tu(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!Pu(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if(($u||rd)&&e==t){let{node:e,offset:t}=o;if(Fu(e)){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
7
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Tu(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if($u&&l.focusNode&&l.focusNode!=s.node&&Pu(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&rd)&&Au(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Au(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&$u)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Wd:Ud,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Gd:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Wd:Gd}n=a}this.dirty=Wd}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Wd:Ud;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},qd=class extends Kd{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let e=Pu(a)?a:document.createElement(`span`);e!=a&&e.appendChild(a),e.hasAttribute(`contenteditable`)||(e.contentEditable=`false`),e.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Hd&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Jd=class extends Kd{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Yd=class e extends Kd{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Hs.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gd||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gd&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Hd){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Hd}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=_f(a,n,o,r)),t>0&&(a=_f(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Xd=class e extends Kd{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!Fu(u))throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Hs.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=cf(u,r,n),l?c=new ef(t,n,r,i,u,d||null,f,l):n.isText?new Qd(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>Pu(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>Y.empty}}return t}matchesNode(e,t,n){return this.dirty==Hd&&e.eq(this.node)&&lf(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new df(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;mf(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Mo.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,u,d)=>{s.syncToMarks(t.marks,n,e,d),l&&t.isAtom&&!t.isText&&s.addHackNode(`IMG`,s.top);let f;s.findNodeMatch(t,a,u,d)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(f=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,u,f,e)||s.updateNextNode(t,a,u,e,d,r)||s.addNode(t,a,u,e,r),r+=t.nodeSize,c&&(l=t.isAtom&&!t.isText)}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Wd)&&(a&&this.protectLocalComposition(e,a),tf(this.contentDOM,this.children,e),id&&hf(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Z)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=gf(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new Jd(this,i,t,r);e.input.compositionNodes.push(a),this.children=_f(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Gd||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Hd}updateOuterDeco(e){if(lf(e,this.outerDeco))return;let t=!Pu(this.nodeDOM),n=this.dom;this.dom=of(this.dom,this.nodeDOM,af(this.outerDeco,this.node,t),af(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Pu(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Pu(this.nodeDOM)&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Zd(e,t,n,r,i){cf(r,t,e);let a=new Xd(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Qd=class e extends Xd{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Gd||this.dirty!=Hd&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Hd||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Hd,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Gd)}get domAtom(){return!1}isText(e){return this.node.text==e}},$d=class extends Kd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Hd&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},ef=class extends Xd{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Gd)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function tf(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=uf(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Yd){let t=r?r.previousSibling:e.lastChild;tf(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=uf(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var nf=function(e){e&&(this.nodeName=e)};nf.prototype=Object.create(null);var rf=[new nf];function af(e,t,n){if(e.length==0)return rf;let r=n?rf[0]:new nf,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new nf(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new nf(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function of(e,t,n,r){if(n==rf&&r==rf)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=rf[0],i=t)}sf(i,o||rf[0],a)}return i}function sf(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function cf(e,t,n){return of(e,e,rf,af(t,n,!Pu(e)))}function lf(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function uf(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var df=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ff(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Hd,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof Yd&&t.dirty!=Gd&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Yd.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Gd&&a.dom==a.contentDOM&&(a.dirty=Wd),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Xd){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Gd&&lf(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Wd,u.updateChildren(r,a+1),u.dirty=Hd),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!lf(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Xd.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Xd.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new qd(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Yd;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Qd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((rd||td)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new $d(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Pu(e)&&e.contains(this.lock.parentNode))}};function ff(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Yd)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function pf(e,t){return e.type.side-t.type.side}function mf(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u){if(d){d.sort(pf);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c)}let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function hf(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function gf(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function _f(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function vf(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Vu(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&hl.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&zu(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new hl(o==e?s:r.resolve(e))}else if($u&&t==`key`&&o>e.state.selection.to&&Pu(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if(getComputedStyle(e).overflow!=`visible`){l=ul.findFrom(r.resolve(i.posAtStart),1);break}if(e==i.dom||e.nextSibling||!e.parentNode||!Pu(e.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=kf(e,u,s,n)}return l}function yf(e){return e.editable?e.hasFocus():jf(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function bf(e,t=!1){let n=e.state.selection;if(Df(e,n),!yf(e))return;let r=e.input.mouseDown;if(!t&&td&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Au(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Ef(e);else{let{anchor:r,head:i}=n,a,o;xf&&!(n instanceof Z)&&(n.$from.parent.inlineContent||(a=Sf(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Sf(e,n.to))),e.docView.setSelection(r,i,e,t),xf&&(a&&wf(a),o&&wf(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Tf(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var xf=rd||td&&nd<63;function Sf(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(rd&&i&&i.contentEditable==`false`)return Cf(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Cf(i);if(a)return Cf(a)}}function Cf(e){return e.contentEditable=`true`,rd&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function wf(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Tf(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!yf(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Ef(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Tu(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Zu&&Qu<=11&&(n.disabled=!0,n.disabled=!1)}function Df(e,t){if(t instanceof hl){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Of(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Of(e)}function Of(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function kf(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||Z.between(t,n,r)}function Af(e){return e.editable&&!e.hasFocus()?!1:jf(e)}function jf(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return Iu(e.dom,t.anchorNode)&&(e.editable||Iu(e.dom,t.focusNode))}catch{return!1}}function Mf(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Au(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Nf(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&ul.findFrom(a,t)}function Pf(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ff(e,t,n){let r=e.state.selection;if(r instanceof Z){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Pf(e,new Z(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Nf(e.state,t);return n&&n instanceof hl?Pf(e,n):!1}if(!(ad&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?hl.isSelectable(i)?Pf(e,new hl(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):Pf(e,new Z(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof hl&&r.node.isInline)return Pf(e,new Z(t>0?r.$to:r.$from));else{let n=Nf(e.state,t);return n?Pf(e,n):!1}}function If(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):Pu(e)&&e.contentEditable==`false`}function Lf(e,t){return t<0?Rf(e):zf(e)}function Rf(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for($u&&Pu(n)&&r<Nu(n)&&If(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!Pu(n))break;let e=n.childNodes[r-1];if(If(e,-1))i=n,a=--r;else if(Fu(e))n=e,r=n.nodeValue.length;else break}else if(Bf(n))break;else{let t=n.previousSibling;for(;t&&If(t,-1);)i=n.parentNode,a=Tu(t),t=t.previousSibling;if(t)n=t,r=Nu(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Uf(e,n,r):i&&Uf(e,i,a)}function zf(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Nu(n),a,o;for(;;)if(r<i){if(!Pu(n))break;let e=n.childNodes[r];if(If(e,1))a=n,o=++r;else break}else if(Bf(n))break;else{let t=n.nextSibling;for(;t&&If(t,1);)a=t.parentNode,o=Tu(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=Nu(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Uf(e,a,o)}function Bf(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Vf(e,t){for(;e&&t==e.childNodes.length&&!Bu(e);)t=Tu(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(Fu(n))return n;if(Pu(n)&&n.contentEditable==`false`)break;e=n,t=0}}function Hf(e,t){for(;e&&!t&&!Bu(e);)t=Tu(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(Fu(n))return n;if(Pu(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Uf(e,t,n){if(!Fu(t)){let e,r;(r=Vf(t,n))?(t=r,n=0):(e=Hf(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Vu(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&bf(e)},50)}function Wf(e,t){let n=e.state.doc.resolve(t);if(!(td||od)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Gf(e,t,n){let r=e.state.selection;if(r instanceof Z&&!r.empty||n.indexOf(`s`)>-1||ad&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Nf(e.state,t);if(n&&n instanceof hl)return Pf(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof _l?ul.near(n,t):ul.findFrom(n,t);return o?Pf(e,o):!1}return!1}function Kf(e,t){if(!(e.state.selection instanceof Z))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function qf(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Jf(e){if(!rd||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&Pu(t)&&n==0&&t.firstChild&&Pu(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;qf(e,n,`true`),setTimeout(()=>qf(e,n,`false`),20)}return!1}function Yf(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Xf(e,t){let n=t.keyCode,r=Yf(t);if(n==8||ad&&n==72&&r==`c`)return Kf(e,-1)||Lf(e,-1);if(n==46&&!t.shiftKey||ad&&n==68&&r==`c`)return Kf(e,1)||Lf(e,1);if(n==13||n==27)return!0;if(n==37||ad&&n==66&&r==`c`){let t=n==37?Wf(e,e.state.selection.from)==`ltr`?-1:1:-1;return Ff(e,t,r)||Lf(e,t)}if(n==39||ad&&n==70&&r==`c`){let t=n==39?Wf(e,e.state.selection.from)==`ltr`?1:-1:1;return Ff(e,t,r)||Lf(e,t)}return n==38||ad&&n==80&&r==`c`?Gf(e,-1,r)||Lf(e,-1):n==40||ad&&n==78&&r==`c`?Jf(e)||Gf(e,1,r)||Lf(e,1):!(r!=(ad?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function Zf(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Hs.fromSchema(e.state.schema),s=sp(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&Pu(l)&&(u=op[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&Pu(l)&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
8
|
+
|
|
9
|
+
`),slice:t}}function Qf(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new X(Y.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Hs.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=up(n),cd&&dp(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&!Pu(e);)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Os.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!$f.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=fp(ap(s,+u[1],+u[2]),u[4]);else if(s=X.maxOpen(ep(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=ap(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var $f=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ep(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&np(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=rp(a[a.length-1],i.length));let n=tp(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return Y.from(a)}return e}function tp(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Y.from(e));return e}function np(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=np(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Y.from(tp(n,e,i+1))))}}function rp(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,rp(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Y.empty,!0);return e.copy(n.append(r))}function ip(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=ip(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Y.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function ap(e,t,n){return t<e.openStart&&(e=new X(ip(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new X(ip(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var op={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function sp(){return document.implementation.createHTMLDocument(`title`)}var cp=null;function lp(e){let t=window.trustedTypes;if(!t)return e;if(!cp){if(cp=t.defaultPolicy)try{return cp.createHTML(e)}catch{}cp=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return cp.createHTML(e)}function up(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=sp(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&op[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=lp(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function dp(e){let t=e.querySelectorAll(td?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function fp(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{i=Y.from(t.create(r[e+1],i))}catch{break}a++,o++}return new X(i,a,o)}var pp={},mp={},hp={touchstart:!0,touchmove:!0},gp=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function _p(e){for(let t in pp){let n=pp[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Sp(e,t)&&!xp(e,t)&&(e.editable||!(t.type in mp))&&n(e,t)},hp[t]?{passive:!0}:void 0)}rd&&e.dom.addEventListener(`input`,()=>null),bp(e)}function vp(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function yp(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function bp(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>xp(e,t))})}function xp(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Sp(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Cp(e,t){!xp(e,t)&&pp[t.type]&&(e.editable||!(t.type in mp))&&pp[t.type](e,t)}mp.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Bp(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(sd&&td&&n.keyCode==13))){if(n.keyCode!=229&&e.domObserver.forceFlush(),id&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Hu(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Xf(e,n)?n.preventDefault():vp(e,`key`)}},mp.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},mp.keypress=(e,t)=>{let n=t;if(Bp(e)||!n.charCode||n.ctrlKey&&!n.altKey||ad&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Z)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function wp(e){return{left:e.clientX,top:e.clientY}}function Tp(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Ep(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Dp(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta(`pointer`,!0),e.dispatch(r)}function Op(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&hl.isSelectable(r)?(Dp(e,new hl(n)),!0):!1}function kp(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof hl&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(hl.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i!=null&&(Dp(e,hl.create(e.state.doc,i)),!0)}function Ap(e,t,n,r,i){return Ep(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?kp(e,n):Op(e,n))}function jp(e,t,n,r){return Ep(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Mp(e,t,n,r){return Ep(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Np(e,n,r)}function Np(e,t,n){if(n.button!=0)return!1;let r=Pp(e,t,!0),i=e.state.doc;return r?(Dp(e,r),r instanceof Z&&i.eq(e.state.doc)&&(e.input.mouseDown=new zp(e,r)),!0):!1}function Pp(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?Z.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return Z.create(r,a+1,a+1+t.content.size);if(n&&hl.isSelectable(t))return hl.create(r,a)}return null}function Fp(e){return Kp(e)}var Ip=ad?`metaKey`:`ctrlKey`;pp.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Fp(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Tp(n,e.input.lastClick)&&!n[Ip]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(wp(n));o&&(a==`singleClick`?e.input.mouseDown=new Rp(e,o,n,!!r):(a==`doubleClick`?jp:Mp)(e,o.pos,o.inside,n)?n.preventDefault():vp(e,`pointer`))};var Lp=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},Rp=class extends Lp{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Ip],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&Pu(s.nodeDOM)?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof hl&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!!(this.target&&$u&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),vp(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||bf(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(wp(e))),this.updateAllowDefault(e),this.allowDefault||!t?vp(this.view,`pointer`):Ap(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||rd&&this.mightDrag&&!this.mightDrag.node.isAtom||td&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Dp(this.view,ul.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):vp(this.view,`pointer`)}move(e){this.updateAllowDefault(e),vp(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},zp=class extends Lp{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),vp(this.view,`pointer`);let t=this.view.posAtCoords(wp(e)),n=t&&Pp(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];Dp(this.view,Z.create(r,a,o))}};pp.touchstart=e=>{e.input.lastTouch=Date.now(),Fp(e),vp(e,`pointer`)},pp.touchmove=e=>{e.input.lastTouch=Date.now(),vp(e,`pointer`)},pp.contextmenu=e=>Fp(e);function Bp(e,t){return e.composing?!0:rd&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Vp=sd?5e3:-1;mp.compositionstart=mp.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Z&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||td&&od&&Hp(e)))e.markCursor=e.state.storedMarks||n.marks(),Kp(e,!0),e.markCursor=null;else if(Kp(e,!t.selection.empty),$u&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&Pu(n)&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(Fu(t)){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Up(e,Vp)};function Hp(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!Pu(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return Pu(r)&&r.contentEditable==`false`}mp.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Up(e,20))};function Up(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Kp(e),t))}function Wp(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Gp(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Lu(t.focusNode,t.focusOffset),r=Ru(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function Kp(e,t=!1){if(!(sd&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Wp(e),t||e.docView&&e.docView.dirty){let n=vf(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function qp(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Jp=Zu&&Qu<15||id&&ld<604;pp.copy=mp.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Jp?null:n.clipboardData,{dom:o,text:s}=Zf(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):qp(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Yp(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Xp(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Zp(e,r.value,null,i,t):Zp(e,r.textContent,r.innerHTML,i,t)},50)}function Zp(e,t,n,r,i){let a=Qf(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||X.empty)))return!0;if(!a)return!1;let o=Yp(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Qp(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}mp.paste=(e,t)=>{let n=t;if(e.composing&&!sd)return;let r=Jp?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Zp(e,Qp(r),r.getData(`text/html`),i,n)?n.preventDefault():Xp(e,n)};var $p=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},em=ad?`altKey`:`ctrlKey`;function tm(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[em]:!n}pp.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(wp(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof hl?i.to-1:i.to))){if(r&&r.mightDrag)o=hl.create(e.state.doc,r.mightDrag.pos);else if(n.target&&Pu(n.target)){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=hl.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Zf(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!td||nd>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Jp?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Jp||n.dataTransfer.setData(`text/plain`,c),e.dragging=new $p(l,tm(e,n),o)},pp.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},mp.dragover=mp.dragenter=(e,t)=>t.preventDefault(),mp.drop=(e,t)=>{try{nm(e,t,e.dragging)}finally{e.dragging=null}};function nm(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(wp(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Qf(e,Qp(t.dataTransfer),Jp?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&tm(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||X.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Hc(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&hl.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new hl(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(kf(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}pp.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&bf(e)},20))},pp.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},pp.beforeinput=(e,t)=>{if(sd&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Hu(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in mp)pp[e]=mp[e];function rm(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var im=class e{constructor(e,t){this.toDOM=e,this.spec=t||lm,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new sm(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&rm(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},am=class e{constructor(e,t){this.attrs=e,this.spec=t||lm}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new sm(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&rm(this.attrs,t.attrs)&&rm(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},om=class e{constructor(e,t){this.attrs=e,this.spec=t||lm}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new sm(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&rm(this.attrs,t.attrs)&&rm(this.spec,t.spec)}destroy(){}},sm=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new im(n,r))}static inline(t,n,r,i){return new e(t,n,new am(r,i))}static node(t,n,r,i){return new e(t,n,new om(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof am}get widget(){return this.type instanceof im}},cm=[],lm={},um=class e{constructor(e,t){this.local=e.length?e:cm,this.children=t.length?t:cm}static create(e,t){return t.length?vm(t,e,0,lm):dm}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==dm||e.maps.length==0?this:this.mapInner(e,t,0,0,n||lm)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?pm(this.children,o||[],t,n,r,i,a):o?new e(o.sort(ym),cm):dm}add(t,n){return n.length?this==dm?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=gm(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,vm(s,e,o+1,lm)),a+=3}});let o=mm(a?_m(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(ym):this.local,i||this.children)}remove(e){return e.length==0||this==dm?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==dm?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):dm}forChild(t,n){if(this==dm)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof am){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(ym),cm);return r?new fm([t,r]):t}return r||dm}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return bm(this.localsInner(e))}localsInner(e){if(this==dm)return cm;if(e.inlineContent||!this.local.some(am.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof am||t.push(this.local[e]);return t}forEachSet(e){e(this)}};um.empty=new um([],[]),um.removeOverlap=bm;var dm=um.empty,fm=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,lm));return e.from(r)}forChild(t,n){if(n.isLeaf)return um.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=dm&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length){if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}}return t?bm(n?t:t.sort(ym)):cm}static from(t){switch(t.length){case 0:return dm;case 1:return t[0];default:return new e(t.every(e=>e instanceof um)?t:t.reduce((e,t)=>e.concat(t instanceof um?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function pm(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==dm?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=vm(hm(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new um(t.sort(ym),s)}function mm(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new sm(i.from+t,i.to+t,i.type))}return n}function hm(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function gm(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function _m(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function vm(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=gm(e,t,o+n);if(s){a=!0;let e=vm(s,t,n+o+1,r);e!=dm&&i.push(o,o+t.nodeSize,e)}});let o=mm(a?_m(e):e,-n).sort(ym);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new um(o,i):dm}function ym(e,t){return e.from-t.from||e.to-t.to}function bm(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),xm(t,i+1,a.copy(r.to,a.to)));continue}a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),xm(t,i,r.copy(a.from,r.to)));break}}return t}function xm(e,t,n){for(;t<e.length&&ym(n,e[t])>0;)t++;e.splice(t,0,n)}function Sm(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=dm&&t.push(r)}),e.cursorWrapper&&t.push(um.create(e.state.doc,[e.cursorWrapper.deco])),fm.from(t)}var Cm={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wm=Zu&&Qu<=11,Tm=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Em=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Tm,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Zu&&Qu<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():rd&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wm&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Cm)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Af(this.view)){if(this.suppressingSelectionUpdates)return bf(this.view);if(Zu&&Qu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Au(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Eu(n))t.add(n);for(let r=e.anchorNode;r;r=Eu(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:Fu(n)?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Af(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||td&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&Pu(t);){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if($u&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Mm(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vu(n)&&(c=vf(e))&&c.eq(ul.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bf(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),km(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Nm(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||bf(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),Fu(r)&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Zu&&Qu<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Tu(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Tu(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}return e.type==`attributes`?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Dm=new WeakMap,Om=!1;function km(e){if(!Dm.has(e)&&(Dm.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=$u,Om)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Om=!0}}function Am(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Au(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function jm(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Am(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Am(e,n):null}function Mm(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Nm(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||!Pu(e)||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Pm(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&Iu(e.dom,d)&&(u=[{node:d,offset:l.anchorOffset}],Vu(l)||u.push({node:l.focusNode,offset:l.focusOffset})),td&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||Os.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace!=`pre`||`full`,findPositions:u,ruleFromNode:Fm(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var Fm=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(rd&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}if(t.parentNode.lastChild==t||rd&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Im=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Lm(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=vf(e,t);if(n&&!e.state.selection.eq(n)){if(td&&sd&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Hu(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Pm(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Um(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(id&&e.input.lastIOSEnter>Date.now()-225||sd)&&i.some(e=>Pu(e)&&!Im.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Hu(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m){if(r&&c instanceof Z&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Rm(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Z&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Zu&&Qu<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((id&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&Vm(l.doc,h.pos,g.pos))&&e.someProp(`handleKeyDown`,t=>t(e,Hu(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Bm(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Hu(8,`Backspace`)))){sd&&td&&e.domObserver.suppressSelectionUpdates();return}td&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),sd&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Hu(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Rm(e,n.doc,l.sel);t&&!(td&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||Zu&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v){if(h.pos==g.pos){Zu&&Qu<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>bf(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=zm(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x())}else e.dispatch(x())}function Rm(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:kf(e,t.resolve(n.anchor),t.resolve(n.head))}function zm(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(Y.from(l).eq(e))return{mark:s,type:o}}function Bm(e,t,n,r,i){if(n-t<=i.pos-r.pos||Hm(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Hm(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Hm(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Vm(e,t,n){let r=0,i=0;return e.nodesBetween(t,n,(e,a)=>{e.isTextblock&&a>=t&&a<n?r++:(e.isText?/\S/.test(e.text.slice(Math.max(0,t-a),Math.min(e.nodeSize,n-a))):e.isLeaf)&&i++}),i==0&&r==1}function Hm(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Um(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Wm=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new gp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Zm),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=qm(this),Km(this),this.nodeViews=Ym(this),this.docView=Zd(this.state.doc,Gm(this),Sm(this),this.dom,this),this.domObserver=new Em(this,(e,t,n,r)=>Lm(this,e,t,n,r)),this.domObserver.start(),_p(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&bp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zm),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Wp(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Ym(this);Xm(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&bp(this),this.editable=qm(this),Km(this);let o=Sm(this),s=Gm(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&md(this);if(i){this.domObserver.stop();let t=l&&(Zu||td)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Jm(n.selection,e.selection);if(l){let n=td?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Gp(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Zd(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Mf(this)&&i.delaySelUpdate())?bf(this,t):(Df(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&gd(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&Iu(this.dom,e)&&!this.someProp(`handleScrollToSelection`,e=>e(this))){if(this.state.selection instanceof hl){let t=this.docView.domAfterPos(this.state.selection.from);Pu(t)&&pd(this,t.getBoundingClientRect(),e)}else pd(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new $p(e.slice,e.move,r<0?void 0:hl.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Zu){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&yd(this.dom),bf(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dd(this,e)}coordsAtPos(e,t=1){return jd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Vd(this,t||this.state,e)}pasteHTML(e,t){return Zp(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Zp(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Zf(this,e)}destroy(){this.docView&&(yp(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Sm(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ku())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Cp(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?rd&&this.root.nodeType===11&&Uu(this.dom.ownerDocument)==this.dom&&jm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Wm.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Gm(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[sm.node(0,e.state.doc.content.size,t)]}function Km(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:sm.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function qm(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Jm(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Ym(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Xm(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function Zm(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var Qm={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},$m={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},eh=typeof navigator<`u`&&/Mac/.test(navigator.platform),th=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),nh=0;nh<10;nh++)Qm[48+nh]=Qm[96+nh]=String(nh);for(var nh=1;nh<=24;nh++)Qm[nh+111]=`F`+nh;for(var nh=65;nh<=90;nh++)Qm[nh]=String.fromCharCode(nh+32),$m[nh]=String.fromCharCode(nh);for(var rh in Qm)$m.hasOwnProperty(rh)||($m[rh]=Qm[rh]);function ih(e){var t=!(eh&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||th&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?$m:Qm)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var ah=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),oh=typeof navigator<`u`&&/Win/.test(navigator.platform);function sh(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))ah?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function ch(e){let t=Object.create(null);for(let n in e)t[sh(n)]=e[n];return t}function lh(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function uh(e){return new jl({props:{handleKeyDown:dh(e)}})}function dh(e){let t=ch(e);return function(e,n){let r=ih(n),i,a=t[lh(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[lh(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(oh&&n.ctrlKey&&n.altKey)&&(i=Qm[n.keyCode])&&i!=r){let r=t[lh(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var fh=200,ph=function(){};ph.prototype.append=function(e){return e.length?(e=ph.from(e),!this.length&&e||e.length<fh&&this.leafAppend(e)||this.length<fh&&e.leafPrepend(this)||this.appendInner(e)):this},ph.prototype.prepend=function(e){return e.length?ph.from(e).append(this):this},ph.prototype.appendInner=function(e){return new hh(this,e)},ph.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ph.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},ph.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ph.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},ph.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},ph.from=function(e){return e instanceof ph?e:e&&e.length?new mh(e):ph.empty};var mh=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=fh)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=fh)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(ph);ph.empty=new mh([]);var hh=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(ph),gh=500,_h=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new yh(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new yh(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new yh(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>xh&&(s=vh(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new oc;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new yh(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],i=this.items.length-n,a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new yh(i,o,l))}else r.push(new yh(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new yh(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>gh&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new yh(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(ph.from(i.reverse()),a)}};_h.empty=new _h(ph.empty,0);function vh(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var yh=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},bh=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},xh=20;function Sh(e,t,n,r){let i=n.getMeta(jh),a;if(i)return i.historyState;n.getMeta(Mh)&&(e=new bh(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(jh))return o.getMeta(jh).redo?new bh(e.done.addTransform(n,void 0,r,kh(t)),e.undone,wh(n.mapping.maps),e.prevTime,e.prevComposition):new bh(e.done,e.undone.addTransform(n,void 0,r,kh(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Ch(n,e.prevRanges)),s=o?Th(e.prevRanges,n.mapping):wh(n.mapping.maps);return new bh(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,kh(t)),_h.empty,s,n.time,i??e.prevComposition)}return(a=n.getMeta(`rebased`))?new bh(e.done.rebased(n,a),e.undone.rebased(n,a),Th(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new bh(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Th(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Ch(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function wh(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function Th(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function Eh(e,t,n){let r=kh(t),i=jh.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new bh(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(jh,{redo:n,historyState:c})}var Dh=!1,Oh=null;function kh(e){let t=e.plugins;if(Oh!=t){Dh=!1,Oh=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Dh=!0;break}}return Dh}function Ah(e){return e.setMeta(Mh,!0)}var jh=new Pl(`history`),Mh=new Pl(`closeHistory`);function Nh(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new jl({key:jh,state:{init(){return new bh(_h.empty,_h.empty,null,0,-1)},apply(t,n,r){return Sh(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?Fh:n==`historyRedo`?Ih:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Ph(e,t){return(n,r)=>{let i=jh.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=Eh(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var Fh=Ph(!1,!0),Ih=Ph(!0,!0);function Lh(e){return e.getMeta(jh)!=null}function Rh(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var zh=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Rh({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},Bh=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Vh=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Hh=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Sc(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Uh=e=>t=>e(t),Wh=()=>({state:e,dispatch:t})=>eu(e,t),Gh=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new Z(r.doc.resolve(Math.max(o-1,0)))),!0},Kh=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function qh(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Jh=e=>({tr:t,state:n,dispatch:r})=>{let i=qh(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Yh=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},Xh=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Zh=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return Xh(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Qh=(e,t,n)=>({from:Zh(e,n,`left`),to:Zh(t,n,`right`)}),$h=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=Qh(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(Z.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},eg=()=>({commands:e})=>e.keyboardShortcut(`Enter`),tg=()=>({state:e,dispatch:t})=>$l(e,t);function ng(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function rg(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:ng(t[r])?t[r].test(e[r]):t[r]===e[r])}function ig(e,t,n={}){return e.find(e=>e.type===t&&rg(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ag(e,t,n={}){return!!ig(e,t,n)}function og(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!ig([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&ag([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&ag([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function sg(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var cg=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=sg(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=og(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=Z.create(o,e.from,e.to);n.setSelection(t)}}return!0},lg=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function ug(e){return e instanceof Z}function dg(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function fg(e,t=null){if(!t)return null;let n=ul.atStart(e),r=ul.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?Z.create(e,dg(0,i,a),dg(e.content.size,i,a)):Z.create(e,dg(t,i,a),dg(t,i,a))}function pg(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function mg(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function hg(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var gg=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(mg()||pg())&&r.dom.focus(),hg()&&!mg()&&!pg()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!ug(n.state.selection))return o(),!0;let s=fg(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},_g=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),vg=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),yg=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&yg(r)}return e};function bg(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return yg(n)}function xg(e){return typeof e?.nodesBetween==`function`}function Sg(e,t,n){if(xg(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return Y.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),Sg(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new ws({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Os.fromSchema(a).parseSlice(bg(e),n.parseOptions):Os.fromSchema(a).parse(bg(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Os.fromSchema(t);return n.slice?r.parseSlice(bg(e),n.parseOptions).content:r.parse(bg(e),n.parseOptions)}return Sg(``,t,n)}function Cg(e){return!(`type`in e)}function wg(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof hc||i instanceof gc))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(ul.near(e.doc.resolve(o),n))}var Tg=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Sg(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=Sg(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=Cg(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):xg(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=Y.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&wg(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function Eg(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Dg=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=Eg(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=Sg(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&wg(t,t.steps.length-1,-1)),!0):!1},Og=()=>({state:e,dispatch:t})=>Jl(e,t),kg=()=>({state:e,dispatch:t})=>Yl(e,t),Ag=()=>({state:e,dispatch:t})=>Ll(e,t),jg=()=>({state:e,dispatch:t})=>Gl(e,t),Mg=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},Ng=()=>({state:e,dispatch:t,tr:n})=>{try{let r=zc(e.doc,e.selection.$from.pos,-1);return r==null||!Mg(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Pg=()=>({state:e,dispatch:t,tr:n})=>{try{let r=zc(e.doc,e.selection.$from.pos,1);return r==null||!Mg(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Fg=()=>({state:e,dispatch:t})=>Rl(e,t),Ig=()=>({state:e,dispatch:t})=>zl(e,t);function Lg(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function Rg(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))mg()||Lg()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var zg=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Rg(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Bg(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?qh(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>rg(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Vg=(e,t={})=>({state:n,dispatch:r})=>Bg(n,qh(e,n.schema),t)?Xl(n,r):!1,Hg=()=>({state:e,dispatch:t})=>tu(e,t),Ug=e=>({state:t,dispatch:n})=>xu(qh(e,t.schema))(t,n),Wg=()=>({state:e,dispatch:t})=>Zl(e,t);function Gg(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Kg(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var qg=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Gg(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=qh(e,r.schema)),s===`mark`&&(o=sg(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Kg(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Kg(a.attrs,t))))})})}),c},Jg=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Yg=()=>({tr:e,dispatch:t})=>{if(t){let t=new _l(e.doc);e.setSelection(t)}return!0},Xg=()=>({state:e,dispatch:t})=>Hl(e,t),Zg=()=>({state:e,dispatch:t})=>Kl(e,t),Qg=()=>({state:e,dispatch:t})=>iu(e,t),$g=()=>({state:e,dispatch:t})=>uu(e,t),e_=()=>({state:e,dispatch:t})=>lu(e,t);function t_(e,t,n={},r={}){return Sg(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var n_=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=t_(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=Cg(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function r_(e,t){let n=sg(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function i_(e,t){let n=new cl(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function a_(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function o_(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function s_(e){return t=>o_(t.$from,e)}function Q(e,t,n){return e.config[t]===void 0&&e.parent?Q(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?Q(e.parent,t,n):null}):e.config[t]}function c_(e){return e.map(e=>{let t=Q(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...c_(t())]:e}).flat(10)}function l_(e,t){let n=Hs.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function u_(e){return typeof e==`function`}function d_(e,t=void 0,...n){return u_(e)?t?e.bind(t)(...n):e(...n):e}function f_(e={}){return Object.keys(e).length===0&&e.constructor===Object}function p_(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function m_(e){let t=[],{nodeExtensions:n,markExtensions:r}=p_(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=Q(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=Q(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function h_(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function g_(e){let t=[],n=h_(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function __(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...g_(n[e]),...g_(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function v_(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>__(e,t),{})}function y_(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function b_(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):y_(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function x_(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&f_(t)?!1:t!=null))}function S_(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function C_(e,t){let n=m_(e),{nodeExtensions:r,markExtensions:i}=p_(e),a=r.find(e=>Q(e,`topNode`))?.name;return new ws({topNode:a,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=x_({...e.reduce((e,t)=>{let n=Q(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:d_(Q(r,`content`,a)),marks:d_(Q(r,`marks`,a)),group:d_(Q(r,`group`,a)),inline:d_(Q(r,`inline`,a)),atom:d_(Q(r,`atom`,a)),selectable:d_(Q(r,`selectable`,a)),draggable:d_(Q(r,`draggable`,a)),code:d_(Q(r,`code`,a)),whitespace:d_(Q(r,`whitespace`,a)),linebreakReplacement:d_(Q(r,`linebreakReplacement`,a)),defining:d_(Q(r,`defining`,a)),isolating:d_(Q(r,`isolating`,a)),attrs:Object.fromEntries(i.map(S_))}),s=d_(Q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>b_(e,i)));let c=Q(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:v_(e,i)}));let l=Q(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=x_({...e.reduce((e,t)=>{let n=Q(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:d_(Q(r,`inclusive`,a)),excludes:d_(Q(r,`excludes`,a)),group:d_(Q(r,`group`,a)),spanning:d_(Q(r,`spanning`,a)),code:d_(Q(r,`code`,a)),attrs:Object.fromEntries(i.map(S_))}),s=d_(Q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>b_(e,i)));let c=Q(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:v_(e,i)})),[r.name,o]}))})}function w_(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function T_(e){return e.sort((e,t)=>{let n=Q(e,`priority`)||100,r=Q(t,`priority`)||100;return n>r?-1:+(n<r)})}function E_(e){let t=T_(c_(e)),n=w_(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function D_(e,t){return C_(E_(e),t)}function O_(e,t){let n=D_(t),r=bg(e);return Os.fromSchema(n).parse(r).toJSON()}function k_(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
11
|
+
|
|
12
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function A_(e,t){return k_(e,{from:0,to:e.content.size},t)}function j_(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function M_(e,t){let n=qh(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function N_(e,t){let n=Gg(typeof t==`string`?t:t.name,e.schema);return n===`node`?M_(e,t):n===`mark`?r_(e,t):{}}function P_(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function F_(e){let t=P_(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function I_(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),F_(r)}function L_(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=og(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&e?.nodeSize!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var R_=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},z_=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function B_(e,t){return t.nodes[e]||t.marks[e]||null}function V_(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var H_=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function U_(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?sg(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>rg(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>rg(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function W_(e,t,n={}){if(!t)return Bg(e,null,n)||U_(e,null,n);let r=Gg(t,e.schema);return r===`node`?Bg(e,t,n):r===`mark`&&U_(e,t,n)}var G_=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=s_(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},K_=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function q_(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function J_(e,t){let{nodeExtensions:n}=p_(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=d_(Q(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function Y_(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Y_(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function X_(e){return e instanceof hl}function Z_({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:a}=e;return!!(i<=t&&a>=t+n||r&&ug(e)&&i>t&&a<t+n)}var Q_=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function $_(e,t){let n=t.mapping.mapResult(e.position);return{position:new Q_(n.pos),mapResult:n}}function ev(e){return new Q_(e)}function tv(e,t,n){let r=e.state.doc.content.size,i=dg(t,0,r),a=dg(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function nv(e,t,n){let{selection:r}=t,i=null;if(ug(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var rv=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=sg(e,r.schema);if(i){if(o){let e=r_(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return nv(r,n,c)},iv=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),av=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=qh(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>fu(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>fu(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},ov=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=dg(e,0,n.content.size),i=hl.create(n,r);t.setSelection(i)}return!0},sv=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},cv=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=Z.atStart(n).from,o=Z.atEnd(n).to,s=dg(r,a,o),c=dg(i,a,o),l=Z.create(n,s,c);t.setSelection(l)}return!0},lv=e=>({state:t,dispatch:n})=>wu(qh(e,t.schema))(t,n);function uv(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var dv=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=V_(l,s.node().type.name,s.node().attrs);if(a instanceof hl&&a.node.isBlock)return!s.parentOffset||!Pc(o,s.pos)?!1:(r&&(e&&uv(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:Eg(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof Z&&!a.empty?kl.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=Pc(h,g,1,p);if(!p&&!_&&Pc(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof Z&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&uv(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},fv=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=qh(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=Y.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=Y.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...V_(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(Y.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new X(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(Z.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...V_(d,u.type.name,u.attrs),...t},m={...V_(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!Pc(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function pv(e){return!e||e===`1`?null:e}function mv(e,t){return pv(e)===pv(t)}var hv=(e,t)=>{let n=s_(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ic(e.doc,n.pos))||!mv(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},gv=(e,t)=>{let n=s_(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Ic(e.doc,r))||!mv(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function _v(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return Z.between(r,i)}var vv=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=qh(e,o.schema),m=qh(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=s_(e=>J_(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&J_(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=_v(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(J_(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>hv(a,p)).command(()=>gv(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>hv(a,p)).command(()=>gv(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>hv(a,p)).command(()=>gv(a,p)).run()},yv=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=sg(e,r.schema);return U_(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},bv=(e,t,n={})=>({state:r,commands:i})=>{let a=qh(e,r.schema),o=qh(t,r.schema),s=Bg(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},xv=(e,t={})=>({state:n,commands:r})=>{let i=qh(e,n.schema);return Bg(n,i,t)?r.lift(i):r.wrapIn(i,t)},Sv=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},Cv=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},wv=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=sg(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=og(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Tv=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Ev=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Gg(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=qh(e,r.schema)),s===`mark`&&(o=sg(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},Dv=new Pl(`__tiptap_decorations__`),Ov=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(Dv,{type:`force`,name:e}),!0),kv=(e,t={})=>({state:n,dispatch:r})=>du(qh(e,n.schema),t)(n,r),Av=(e,t={})=>({state:n,dispatch:r})=>vu(qh(e,n.schema),t)(n,r),jv=Co({blur:()=>Bh,clearContent:()=>Vh,clearNodes:()=>Hh,command:()=>Uh,createParagraphNear:()=>Wh,cut:()=>Gh,deleteCurrentNode:()=>Kh,deleteNode:()=>Jh,deleteRange:()=>Yh,deleteSelection:()=>$h,enter:()=>eg,exitCode:()=>tg,extendMarkRange:()=>cg,first:()=>lg,focus:()=>gg,forEach:()=>_g,insertContent:()=>vg,insertContentAt:()=>Tg,insertDefaultBlock:()=>Dg,joinBackward:()=>Ag,joinDown:()=>kg,joinForward:()=>jg,joinItemBackward:()=>Ng,joinItemForward:()=>Pg,joinTextblockBackward:()=>Fg,joinTextblockForward:()=>Ig,joinUp:()=>Og,keyboardShortcut:()=>zg,lift:()=>Vg,liftEmptyBlock:()=>Hg,liftListItem:()=>Ug,newlineInCode:()=>Wg,resetAttributes:()=>qg,scrollIntoView:()=>Jg,selectAll:()=>Yg,selectNodeBackward:()=>Xg,selectNodeForward:()=>Zg,selectParentNode:()=>Qg,selectTextblockEnd:()=>$g,selectTextblockStart:()=>e_,setContent:()=>n_,setMark:()=>rv,setMeta:()=>iv,setNode:()=>av,setNodeSelection:()=>ov,setTextDirection:()=>sv,setTextSelection:()=>cv,sinkListItem:()=>lv,splitBlock:()=>dv,splitListItem:()=>fv,toggleList:()=>vv,toggleMark:()=>yv,toggleNode:()=>bv,toggleWrap:()=>xv,undoInputRule:()=>Sv,unsetAllMarks:()=>Cv,unsetMark:()=>wv,unsetTextDirection:()=>Tv,updateAttributes:()=>Ev,updateDecorations:()=>Ov,wrapIn:()=>kv,wrapInList:()=>Av}),Mv=new WeakMap;function Nv(e,t){Mv.set(e,(Mv.get(e)??0)+1);try{return t()}finally{let t=(Mv.get(e)??1)-1;t>0?Mv.set(e,t):Mv.delete(e)}}function Pv(e){return Mv.has(e)}var Fv=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Iv=typeof process<`u`&&!1;function Lv(e){return e.kind===`widget`}function Rv(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&Lv(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function zv(e,t,n){let{decorations:r,widgetKeys:i}=Rv(t,n);return{set:um.create(e,r),widgetKeys:i}}function Bv({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n||e===n&&n===r}function Vv({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>Bv({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function Hv(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function Uv(e){let t=new Map,n=new Map;for(let r of e.find()){let e=Hv(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function Wv(e){return e.jsonID===`attr`}function Gv(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||Wv(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function Kv(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function qv(e,t){if(e.steps.some(e=>!Gv(e)))return{type:`full`};let n=I_(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!Wv(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=Kv(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function Jv(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function Yv(e,t,n){let r=t.decorationSetsByExtension[e]??um.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:Jv(r,n.mapping,n.doc,i),widgetKeys:i}}function Xv(e,t){let n=Object.values(t).flatMap(e=>e.find());return um.create(e,n)}function Zv(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function Qv(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function $v(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var ey=new Set,ty=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=Dv.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>Qv(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return Dv.getState(this.editor.state)?.widgetKeys??ey}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new jl({key:Dv,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:Zv(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(Dv),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return Nv(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!$v(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=Yv(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:Zv(u)}}},props:{decorations(e){return Dv.getState(e)?.mergedDecorationSet??um.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=qv(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??um.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=Jv(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>Bv({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=Hv(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=Rv(Vv({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return zv(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!Iv)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=Uv(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:Xv(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):Xv(n.doc,r)}};function ny(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n]))}function ry(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof hl){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function iy(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function ay(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}var oy={lt:`<`,gt:`>`,quot:`"`,amp:`&`};function sy(e){return e.replace(/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g,(e,t,n,r)=>t===void 0?n===void 0?oy[r]:ly(parseInt(n,16)):ly(Number(t)))}var cy=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function ly(e){return e===0||e>1114111||e>=55296&&e<=57343?`�`:String.fromCodePoint(cy.get(e)??e)}function uy(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function dy(){return typeof navigator<`u`&&/Firefox/.test(navigator.userAgent)}function fy(e){return typeof e==`number`}function py(e){return Object.prototype.toString.call(e).slice(8,-1)}function my(e){return py(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function hy(e){return typeof e==`string`&&e.trim().length>0&&!/[;{}]/.test(e)}function gy(e,t,n){let r=e.split(`
|
|
13
|
+
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
|
|
14
|
+
`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}var _y=4;function vy(e){let t=0;for(let n of e)t=n===` `?t+_y-t%_y:t+1;return t}function yy(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=vy(a);return(vy(n)>=r?n:` `.repeat(r))+e},o=r.split(`
|
|
15
|
+
`).map(e=>n(e||``)).join(`
|
|
16
|
+
`);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function by(e){return typeof e.type==`string`?e.type:e.type.name}function xy(e,t){if(e.length!==t.length)return!1;let n=Array.from({length:t.length},()=>!1);return e.every(e=>{let r=by(e),i=t.findIndex((t,i)=>!n[i]&&r===by(t)&&ny(e.attrs,t.attrs));return i!==-1&&(n[i]=!0,!0)})}function Sy(e,t){let n={...e};return my(e)&&my(t)&&Object.keys(t).forEach(r=>{my(t[r])&&my(e[r])?n[r]=Sy(e[r],t[r]):n[r]=t[r]}),n}function Cy(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var wy=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Ty=(e,t)=>{if(ng(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Ey(e){let{editor:t,from:n,to:r,text:i,insertText:a}=e;if(!a)return{inputTransaction:null,tr:t.view.state.tr};let o=t.view.state.tr.insertText(i,n,r);return{inputTransaction:o,tr:kl.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function Dy(e){let{editor:t,from:n,to:r,text:i,rule:a,match:o,plugin:s,insertText:c}=e,{view:l}=t,{inputTransaction:u,tr:d}=Ey({editor:t,from:n,to:r,text:i,insertText:c}),f=u?n+i.length:r,p=Rh({state:l.state,transaction:d}),m={from:n-(o[0].length-i.length),to:f},{commands:h,chain:g,can:_}=new zh({editor:t,state:p});return a.handler({state:p,range:m,match:o,commands:h,chain:g,can:_})===null||!d.steps.length?!1:u&&(l.dispatch(u),!l.state.doc.eq(u.doc))?!0:(Ah(d),d.setMeta(`inputRule`,!0),a.undoable&&d.setMeta(s,{transform:d,from:n,to:f,text:i}),l.dispatch(d),!0)}function Oy(e,t,n){let r=t[0].length-n.length;if(r<=0)return!0;let i=e.parentOffset-r;return i>=0&&e.parent.textBetween(i,e.parentOffset)===t[0].slice(0,r)}function ky(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o,insertText:s}=e,{view:c}=t;if(c.composing)return!1;let l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let u=H_(l)+i;for(let e of a){let a=Ty(u,e.find);if(a&&Oy(l,a,i)&&Dy({editor:t,from:n,to:r,text:i,rule:e,match:a,plugin:o,insertText:s}))return!0}return!1}function Ay(e){let{editor:t,rules:n}=e,r=new jl({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:l_(Y.from(e),a.schema);let{from:i}=s,o=i+e.length;ky({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return ky({editor:t,from:i,to:a,text:o,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&ky({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?ky({editor:t,from:a.pos,to:a.pos,text:`
|
|
17
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var jy=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...d_(Q(this,`addOptions`,{name:this.name}))}}get storage(){return{...d_(Q(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Sy(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},My=class e extends jy{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Ny=class{constructor(e){this.find=e.find,this.handler=e.handler}},Py=(e,t,n)=>{if(ng(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function Fy(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new zh({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);m>=h||Py(e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var Iy=null,Ly=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Ry(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=Rh({state:e,transaction:c});if(Fy({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{Iy===t&&(Iy=null)}),n.map(e=>new jl({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Iy=t)},i=()=>{Iy&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Iy;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:l_(Y.from(t),r.schema);let{from:n}=d,i=n+t.length,a=Ly(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(fy(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var zy=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=E_(e),this.schema=C_(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=Q(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:B_(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=T_([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:B_(t.name,this.schema)},r=[],i=Q(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&Q(t,`exitable`,n)&&(a.ArrowRight=()=>My.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=uh(a);r.push(o);let s=Q(t,`addInputRules`,n);if(q_(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Ay({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=Q(t,`addPasteRules`,n);if(q_(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=Ry({editor:e,rules:t});r.push(...n)}}let l=Q(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=Q(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:B_(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new ty({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return m_(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=p_(this.extensions);return Object.fromEntries(t.filter(e=>!!Q(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Q(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:qh(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=v_(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return T_([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:B_(n.name,this.schema)},i=Q(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return T_([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:B_(n.name,this.schema)},i=Q(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=p_(this.extensions);return Object.fromEntries(t.filter(e=>!!Q(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Q(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:sg(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=v_(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{Cy(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:B_(e.name,this.schema)};e.type===`mark`&&((d_(Q(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(d_(Q(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=Q(e,`onBeforeCreate`,t),r=Q(e,`onCreate`,t),i=Q(e,`onUpdate`,t),a=Q(e,`onSelectionUpdate`,t),o=Q(e,`onTransaction`,t),s=Q(e,`onFocus`,t),c=Q(e,`onBlur`,t),l=Q(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};zy.resolve=E_,zy.sort=T_,zy.flatten=c_;var By=class e extends jy{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Vy=By.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new jl({key:new Pl(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=j_(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>k_(r,{from:e.pos,to:t.pos},s)).join(o??`
|
|
18
|
+
|
|
19
|
+
`)}}})]}}),Hy=By.create({name:`commands`,addCommands(){return{...jv}}}),Uy=By.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=i_(e.before,[e,...t]);I_(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof fc){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),Wy=By.create({name:`drop`,addProseMirrorPlugins(){return[new jl({key:new Pl(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Gy=By.create({name:`editable`,addProseMirrorPlugins(){return[new jl({key:new Pl(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Ky=new Pl(`focusEvents`),qy=By.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new jl({key:Ky,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Jy=By.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:ul.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return mg()||Lg()?i:r},addProseMirrorPlugins(){return[new jl({key:new Pl(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=ul.atStart(t.doc).from,l=ul.atEnd(t.doc).to;if(a||o!==c||s!==l||!Y_(n.doc))return;let u=n.tr,d=Rh({state:n,transaction:u}),{commands:f}=new zh({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),Yy=By.create({name:`paste`,addProseMirrorPlugins(){return[new jl({key:new Pl(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Xy=By.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new jl({key:new Pl(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),Zy=By.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=p_(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new jl({key:new Pl(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Qy=!1;function $y(e){if(Qy)return;Qy=!0;let t;try{t=hc.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof Y||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var eb=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},tb=`.ProseMirror {
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ProseMirror {
|
|
24
|
+
word-wrap: break-word;
|
|
25
|
+
white-space: pre-wrap;
|
|
26
|
+
white-space: break-spaces;
|
|
27
|
+
-webkit-font-variant-ligatures: none;
|
|
28
|
+
font-variant-ligatures: none;
|
|
29
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ProseMirror [contenteditable="false"] {
|
|
33
|
+
white-space: normal;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
37
|
+
white-space: pre-wrap;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ProseMirror pre {
|
|
41
|
+
white-space: pre-wrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
img.ProseMirror-separator {
|
|
45
|
+
display: inline !important;
|
|
46
|
+
border: none !important;
|
|
47
|
+
margin: 0 !important;
|
|
48
|
+
width: 0 !important;
|
|
49
|
+
height: 0 !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ProseMirror-gapcursor {
|
|
53
|
+
display: none;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
position: absolute;
|
|
56
|
+
margin: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ProseMirror-gapcursor:after {
|
|
60
|
+
content: "";
|
|
61
|
+
display: block;
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: -2px;
|
|
64
|
+
width: 20px;
|
|
65
|
+
border-top: 1px solid black;
|
|
66
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@keyframes ProseMirror-cursor-blink {
|
|
70
|
+
to {
|
|
71
|
+
visibility: hidden;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ProseMirror-hideselection *::selection {
|
|
76
|
+
background: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
80
|
+
background: transparent;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ProseMirror-hideselection * {
|
|
84
|
+
caret-color: transparent;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
88
|
+
display: block;
|
|
89
|
+
}`,nb=class extends Fv{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:$_,createMappablePosition:ev},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=fg(t,this.options.autofocus);this.editorState=kl.create({doc:t,schema:this.schema,selection:e||void 0})}$y(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():zh.createFakeChain()}can(){return this.commandManager?this.commandManager.can():zh.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=iy(tb,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return Iv&&!this.hasWarnedStaleDecorationRead&&Pv(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=u_(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[Gy,Vy.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Hy,qy,Jy,Xy.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),Wy,Yy,Uy,Zy.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new zy(n,this)}createCommandManager(){this.commandManager=new zh({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=t_(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=t_(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=kl.create({doc:t,schema:this.schema,selection:fg(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return u_(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new Wm(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return N_(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return W_(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return l_(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
90
|
+
|
|
91
|
+
`,textSerializers:n={}}=e||{};return A_(this.state.doc,{blockSeparator:t,textSerializers:{...j_(this.schema),...n}})}get isEmpty(){return Y_(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new eb(t,this,!1,n)}get $doc(){return this.$pos(0)}};function rb(e){return new wy({find:e.find,handler:({state:t,range:n,match:r})=>{let i=d_(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(L_(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function ib(e){return new wy({find:e.find,handler:({state:t,range:n,match:r})=>{let i=d_(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function ab(e){return new wy({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=d_(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function ob(e){return new wy({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=d_(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&wc(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Ic(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var sb=e=>`touches`in e,cb=class{constructor(e){var t;this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e!=null&&(t=e.options)!=null&&t.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,sb(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},lb=class e extends jy{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},ub=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){let{view:t}=this.editor,n=e.target,r=n.nodeType===3?n.parentElement?.closest(`[data-drag-handle]`):n.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(n)||!r)return;let i=0,a=0;if(this.dom!==r){let t=this.dom.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;i=n.x-t.x+o,a=n.y-t.y+s}let o=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();o.style.width=`${Math.round(e.width)}px`,o.style.height=`${Math.round(e.height)}px`,o.style.boxSizing=`border-box`,o.style.pointerEvents=`none`}catch{}let s=null;try{var c;s=document.createElement(`div`),s.style.position=`absolute`,s.style.top=`-9999px`,s.style.left=`-9999px`,s.style.pointerEvents=`none`,s.appendChild(o),document.body.appendChild(s),(c=e.dataTransfer)==null||c.setDragImage(o,i,a)}finally{s&&setTimeout(()=>{try{s?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=hl.create(t.state.doc,l),d=t.state.tr.setSelection(u);t.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!this.dom.contains(t)||this.contentDOM?.contains(t))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=hl.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return this.dom?this.contentDOM?typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(mg()||pg())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target):e.type!==`selection`:!0}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function db(e){return new Ny({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=d_(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(L_(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}function fb(e){return T((t,n)=>({get(){return t(),e},set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var pb=class extends nb{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=fb(this.view.state),this.reactiveExtensionStorage=fb(this.extensionStorage),this.on(`beforeTransaction`,({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),h(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){let n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){let t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},mb=V({name:`EditorContent`,props:{editor:{default:null,type:Object}},setup(e){let t=A(),n=I();return g(()=>{let r=e.editor;r&&r.options.element&&t.value&&ae(()=>{if(!t.value||!r.view.dom?.parentNode)return;let e=F(t.value);t.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:e}),r.createNodeViews()})}),P(()=>{let t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:t}},render(){return ue(`div`,{ref:e=>{this.rootEl=e}})}}),hb=V({name:`NodeViewContent`,props:{as:{type:String,default:`div`}},render(){return ue(this.as,{style:{whiteSpace:`pre-wrap`},"data-node-view-content":``})}}),gb=V({name:`NodeViewWrapper`,props:{as:{type:String,default:`div`}},inject:[`onDragStart`,`decorationClasses`],render(){var e;return ue(this.as,{class:this.decorationClasses,style:{whiteSpace:`normal`},"data-node-view-wrapper":``,onDragstart:this.onDragStart},(e=this.$slots).default?.call(e))}}),_b=class{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=h(e),this.el=document.createElement(`div`),this.props=m(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){return this.renderedComponent.vNode?.component?.exposed?this.renderedComponent.vNode.component.exposed:this.renderedComponent.vNode?.component?.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=ue(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<`u`&&this.el&&x(e,this.el),{vNode:e,destroy:()=>{this.el&&x(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};V({name:`MarkViewContent`,props:{as:{type:String,default:`span`}},render(){return ue(this.as,{style:{whiteSpace:`inherit`},"data-mark-view-content":``})}});var vb={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}},yb=class extends ub{constructor(e,t,n){super(e,t,n),this.cachedExtensionWithSyncedStorage=null,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e==`number`&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}))},this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode()},t=e,n=this.onDragStart.bind(this);this.decorationClasses=A(this.getDecorationClasses());let r=V({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:e=>{var t;return w(`onDragStart`,n),w(`decorationClasses`,this.decorationClasses),(t=this.component).setup?.call(t,e,{expose:()=>void 0})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.currentPos=this.getPos(),this.renderer=new _b(r,{editor:this.editor,props:t})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector(`[data-node-view-content]`)}handleSelectionUpdate(){let e=this.getPos();if(typeof e==`number`){if(Z_({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}}update(e,t,n){let r=e=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(e)};if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e.type!==this.node.type)return!1;if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,this.decorationClasses.value=this.getDecorationClasses(),!0;this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos();let i={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),r(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove(`ProseMirror-selectednode`)}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(` `)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate)}};function bb(e,t){return n=>n.editor.contentComponent?new yb(typeof e==`function`&&`__vccOpts`in e?e.__vccOpts:e,n,t):{}}function xb(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=ay(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 Sb(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,`
|
|
92
|
+
`);return/\s/.test(n)}):!1}var Cb=new Pl(`suggestion`);function wb({pluginKey:e=Cb,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=xb,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&&!Sb(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 jl({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),um.create(e.doc,[sm.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var Tb=wb;function Eb(e,t){if(!t?.schema)return!1;let n=typeof e==`string`?e:e.name;return t.schema.spec.marks.get(n)!==void 0}function Db(e,t){if(!e)return!1;let{selection:n}=e.state,{$from:r,to:i}=n;return t.some(t=>e.state.doc.nodesBetween(r.pos,i,e=>e.type.name===t))}function Ob(e,t){return e?e.extensionManager.extensions.some(e=>e.name===t):!1}function kb(e){let t=`toggle${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>Db(e,[`image`])||e.isActive(`code`)}}function Ab(e){let t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>Db(e,[`image`])||e.isActive(`code`)}}function jb(e){return{canExecute:t=>t.can()[e](),execute:t=>t.chain()[e](),isActive:()=>!1,isDisabled:void 0}}function Mb(){return{canExecute:(e,t)=>e.can().toggleMark(t.mark),execute:(e,t)=>e.chain().focus().toggleMark(t.mark),isActive:(e,t)=>e.isActive(t.mark),isDisabled:(e,t)=>!Eb(t.mark,e)||Db(e,[`image`])}}function Nb(){return{canExecute:(e,t)=>e.can().setTextAlign(t.align),execute:(e,t)=>e.chain().focus().setTextAlign(t.align),isActive:(e,t)=>e.isActive({textAlign:t.align}),isDisabled:e=>!Ob(e,`textAlign`)||Db(e,[`image`,`horizontalRule`])}}function Pb(){return{canExecute:(e,t)=>e.can().toggleHeading({level:t.level}),execute:(e,t)=>e.chain().focus().toggleHeading({level:t.level}),isActive:(e,t)=>e.isActive(`heading`,{level:t.level}),isDisabled:e=>Db(e,[`image`])||e.isActive(`code`)}}function Fb(){return{canExecute:e=>e.can().setLink({href:``})||e.can().unsetLink(),execute:(e,t)=>{let n=e.chain(),r=e.getAttributes(`link`).href,i=e.isActive(`code`);if(r)return n.focus().unsetLink();let a=t?.href||prompt(`Enter the URL:`);return a?i?n.focus().extendMarkRange(`code`).setLink({href:a}):n.focus().setLink({href:a}):n},isActive:e=>e.isActive(`link`),isDisabled:e=>{if(!Ob(e,`link`)||Db(e,[`image`]))return!0;let{selection:t}=e.state;return t.empty&&!e.isActive(`link`)}}}function Ib(){return{canExecute:e=>e.can().setImage({src:``}),execute:(e,t)=>{let n=e.chain().focus();if(t?.src)return n.setImage({src:t.src});let r=prompt(`Enter the image URL:`);return r?n.setImage({src:r}):n},isActive:e=>e.isActive(`image`),isDisabled:e=>!Ob(e,`image`)}}function Lb(e){let t={bulletList:`toggleBulletList`,orderedList:`toggleOrderedList`,taskList:`toggleTaskList`}[e],n=e===`taskList`?`taskItem`:`listItem`,r=[`bulletList`,`orderedList`,`taskList`];return{canExecute:e=>e.can()[t]()||e.isActive(`listItem`)||r.some(t=>Ob(e,t)&&e.isActive(t)),execute:i=>{let{state:a}=i,{selection:o}=a,s=i.chain().focus();if(o.node){let e=o.node,t=e.firstChild?.firstChild,n=e.lastChild?.lastChild,r=t?o.from+t.nodeSize:o.from+1,i=n?o.to-n.nodeSize:o.to-1;s=s.setTextSelection({from:r,to:i}).clearNodes()}if(i.isActive(e)){let e=s.liftListItem(n);for(let t of r)Ob(i,t)&&(e=e.lift(t));return e.selectTextblockEnd()}if(r.some(e=>Ob(i,e)&&i.isActive(e))){let e=i.isActive(`taskList`)?`taskItem`:`listItem`,n=s.liftListItem(e);for(let e of r)Ob(i,e)&&(n=n.lift(e));return n[t]().selectTextblockEnd()}return s[t]().selectTextblockEnd()},isActive:t=>t.isActive(e),isDisabled:t=>!Ob(t,e)||Db(t,[`image`])||t.isActive(`code`)}}function Rb(e){return{canExecute:(t,n)=>{if(n?.pos==null||!t.state.doc.nodeAt(n.pos))return!1;let r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();return e===`up`?a>0:a<i.childCount-1},execute:(t,n)=>{if(n?.pos==null)return t.chain();let r=t.state.doc.nodeAt(n.pos);if(!r)return t.chain();let i=t.state.doc.resolve(n.pos),a=i.parent,o=i.index();if(e===`up`&&o>0){let e=a.child(o-1),i=n.pos-e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}if(e===`down`&&o<a.childCount-1){let e=a.child(o+1),i=n.pos+e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}return t.chain()},isActive:()=>!1,isDisabled:void 0}}function zb(){return{mark:Mb(),textAlign:Nb(),heading:Pb(),link:Fb(),image:Ib(),blockquote:kb(`blockquote`),bulletList:Lb(`bulletList`),orderedList:Lb(`orderedList`),taskList:Lb(`taskList`),codeBlock:kb(`codeBlock`),horizontalRule:Ab(`horizontalRule`),paragraph:Ab(`paragraph`),undo:jb(`undo`),redo:jb(`redo`),clearFormatting:{canExecute:(e,t)=>t?.pos==null?e.can().clearNodes()||e.can().unsetAllMarks():!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos!=null){let n=e.state.doc.nodeAt(t.pos);if(!n)return e.chain();let r=t.pos+1,i=t.pos+n.nodeSize-1;return e.chain().focus().setTextSelection({from:r,to:i}).clearNodes().unsetAllMarks()}return e.chain().focus().clearNodes().unsetAllMarks()},isActive:()=>!1,isDisabled:void 0},duplicate:{canExecute:(e,t)=>t?.pos!=null&&!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().insertContentAt(t.pos+n.nodeSize,n.toJSON()):e.chain()},isActive:()=>!1,isDisabled:void 0},delete:{canExecute:(e,t)=>t?.pos!=null&&!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().deleteRange({from:t.pos,to:t.pos+n.nodeSize}):e.chain()},isActive:()=>!1,isDisabled:void 0},moveUp:Rb(`up`),moveDown:Rb(`down`),suggestion:{canExecute:()=>!0,execute:(e,t)=>{let{state:n}=e,{selection:r}=n,{$from:i}=r;if(t?.pos!==void 0){let r=n.doc.nodeAt(t.pos);if(r){let n=t.pos+r.nodeSize;return e.chain().focus().insertContentAt(n,{type:`paragraph`,content:[{type:`text`,text:`/`}]})}}let a=i.node(i.depth),o=i.before(i.depth)+a.nodeSize;return e.chain().focus().insertContentAt(o,{type:`paragraph`,content:[{type:`text`,text:`/`}]})},isActive:()=>!1,isDisabled:void 0},mention:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` @`:`@`)},isActive:()=>!1,isDisabled:void 0},emoji:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` :`:`:`)},isActive:()=>!1,isDisabled:void 0}}}function Bb(e,t,n){let r={...zb(),...n};return xo(t)?t.map(t=>Bb(e,t,n)):t.filter(Boolean).map(t=>{if(`type`in t)return t;let{kind:i,children:a,...o}=t,s=a?.length?Bb(e,a,n):void 0;if(i){let n=r[i];return n?{...o,children:s,disabled:n.isDisabled?.(e,t)||!n.canExecute(e,t),active:n.isActive(e,t),onSelect:()=>n.execute(e,t).run()}:{...o,children:s}}return{...o,children:s}})}var Vb={base:`hidden lg:flex`,variants:{side:{left:``,right:``}}},Hb={__name:`DashboardSidebarCollapse`,props:{color:{type:null,required:!1,default:`neutral`},variant:{type:null,required:!1,default:`ghost`},side:{type:String,required:!1,default:`left`},ui:{type:Object,required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},class:{type:null,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},setup(e){let t=hr(`dashboardSidebarCollapse`,e),n=mr(pe(t,`icon`,`side`,`class`)),{t:r}=Ln(),i=_e(),{sidebarCollapsed:a,collapseSidebar:o}=He({sidebarCollapsed:A(!1),collapseSidebar:()=>{}}),s=p(()=>nr({extend:Vb,...i.ui?.dashboardSidebarCollapse||{}}));return(e,c)=>(J(),k(dr,W({...F(n),icon:F(t).icon||(F(a)?F(i).ui.icons.panelOpen:F(i).ui.icons.panelClose),"aria-label":F(a)?F(r)(`dashboardSidebarCollapse.expand`):F(r)(`dashboardSidebarCollapse.collapse`),...e.$attrs},{class:s.value({class:[F(t).ui?.base,F(t).class],side:F(t).side}),onClick:c[0]||=e=>F(o)?.(!F(a))}),null,16,[`class`]))}},Ub=Symbol(`vitehub-console-media-picker`);function Wb(e){w(Ub,e)}function Gb(){return ie(Ub,void 0)}var Kb=[`aria-label`],qb=V({__name:`console-presence-avatars`,props:{sessions:{},user:{default:null},variant:{default:`header`}},setup(e){let t=e,n=p(()=>{let e=new Map;for(let n of t.sessions){if(t.variant===`row`&&t.user&&n.user.id===t.user.id&&n.kind===`view`)continue;let r=e.get(n.user.id);(!r||r.kind===`view`&&n.kind===`edit`)&&e.set(n.user.id,n)}let n=e=>e.kind===`live`?0:e.kind===`edit`?1:2;return[...e.values()].sort((e,t)=>n(e)-n(t))}),r=p(()=>n.value.slice(0,t.variant===`row`?1:3)),a=p(()=>n.value.slice(r.value.length));function o(e){return t.user&&e.user.id===t.user.id?`You`:e.user.name}function c(e){if(e.kind===`live`)return Ti(e);let n=o(e),r=n===`You`;return t.variant===`row`?r?e.kind===`edit`?`You're editing this in another tab`:`You have this open in another tab`:e.kind===`edit`?`${n} is editing`:`${n} is viewing`:`${n} · ${e.kind===`edit`?`Editing`:`Viewing`}${r?` in another tab`:``}`}let l=p(()=>n.value.map(c).join(`, `));return(t,o)=>{let u=sr,d=Ft;return n.value.length?(J(),b(`span`,{key:0,class:`flex shrink-0 items-center`,role:`img`,"aria-label":l.value},[(J(!0),b(O,null,s(r.value,(t,n)=>(J(),k(d,{key:t.user.id,text:c(t),content:{side:`bottom`}},{default:i(()=>[j(`span`,{class:G([`relative inline-flex rounded-full ring-2 ring-(--ui-bg)`,[n?`-ms-1.5`:``,t.kind===`view`?`opacity-60`:``]]),style:re({zIndex:r.value.length-n})},[t.kind===`live`?(J(),k(u,{key:0,icon:`i-lucide-users`,alt:c(t),size:e.variant===`row`?`2xs`:`xs`},null,8,[`alt`,`size`])):(J(),k(u,{key:1,src:t.user.image,text:F(Ei)(t.user.name),alt:t.user.name,size:e.variant===`row`?`2xs`:`xs`},null,8,[`src`,`text`,`alt`,`size`]))],6)]),_:2},1032,[`text`]))),128)),a.value.length?(J(),k(d,{key:0,text:a.value.map(c).join(`, `),content:{side:`bottom`}},{default:i(()=>[j(`span`,{class:G([`relative -ms-1.5 inline-flex items-center justify-center rounded-full bg-elevated px-1.5 text-xs/none font-medium text-muted tabular-nums ring-2 ring-(--ui-bg)`,e.variant===`row`?`h-5 min-w-5`:`h-6 min-w-6`])},`+`+q(a.value.length),3)]),_:1},8,[`text`])):M(``,!0)],8,Kb)):M(``,!0)}}}),Jb={class:`tabular-nums opacity-70`},Yb={class:`grid max-w-72 gap-3 p-3`},Xb={class:`text-[13px] text-muted`},Zb={class:`flex justify-end gap-2`},Qb=[`aria-busy`],$b={class:`mx-auto grid max-w-5xl gap-8 px-4 py-6 sm:px-6`},ex={"aria-label":`Documents by state`,class:`grid grid-cols-2 overflow-hidden rounded-lg border border-default sm:grid-cols-4`},tx={class:`grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)]`},nx={class:`grid gap-8`},rx={key:0,"aria-labelledby":`open-now`,class:`grid gap-2`},ix={id:`open-now`,class:`text-[13px] font-medium text-highlighted`},ax={class:`ms-1 font-normal text-dimmed tabular-nums`},ox={class:`divide-y divide-default overflow-hidden rounded-lg border border-default`},sx={class:`min-w-0 flex-1 truncate text-sm text-highlighted`},cx={class:`hidden truncate text-xs text-dimmed sm:inline`},lx={"aria-labelledby":`needs-publishing`,class:`grid gap-2`},ux={class:`flex items-baseline justify-between gap-3`},dx={id:`needs-publishing`,class:`text-[13px] font-medium text-highlighted`},fx={key:0,class:`ms-1 font-normal text-dimmed tabular-nums`},px={key:0,class:`text-xs text-dimmed`},mx={key:0,class:`grid gap-px`},hx={key:1,class:`grid gap-0.5 py-1`},gx={class:`text-xs text-muted`},_x={key:2,class:`flex items-center gap-2 py-1 text-[13px] text-muted`},vx={key:3,class:`divide-y divide-default overflow-hidden rounded-lg border border-default`},yx={class:`vitehub-dashboard-row__title flex items-center gap-2`},bx={class:`vitehub-dashboard-row__meta flex items-center gap-2`},xx={class:`vitehub-dashboard-row__time`},Sx={key:1,"aria-hidden":`true`},Cx={key:4,class:`text-xs text-dimmed tabular-nums`},wx={key:1,"aria-labelledby":`scheduled`,class:`grid gap-2`},Tx={id:`scheduled`,class:`text-[13px] font-medium text-highlighted`},Ex={class:`ms-1 font-normal text-dimmed tabular-nums`},Dx={key:0,class:`text-xs text-muted`},Ox={class:`divide-y divide-default overflow-hidden rounded-lg border border-default`},kx={class:`vitehub-dashboard-row__title flex items-center gap-2`},Ax={class:`truncate`},jx={class:`vitehub-dashboard-row__meta`},Mx=[`datetime`],Nx={key:1,class:`text-xs text-dimmed tabular-nums`},Px={"aria-labelledby":`collections`,class:`grid gap-2`},Fx={key:0,class:`grid gap-px`},Ix={key:1,class:`text-xs text-muted`},Lx={key:2,class:`divide-y divide-default overflow-hidden rounded-lg border border-default`},Rx={class:`truncate text-sm font-medium text-highlighted`},zx={class:`hidden truncate font-mono text-xs text-dimmed sm:inline`},Bx={class:`flex shrink-0 items-center gap-3 text-xs text-muted tabular-nums`},Vx={key:0,class:`flex h-11 items-center gap-3 px-3`},Hx={class:`hidden truncate text-xs text-dimmed sm:inline`},Ux={class:`flex shrink-0 items-center gap-3 text-xs text-muted tabular-nums`},Wx={key:3,class:`text-xs text-dimmed`},Gx={"aria-labelledby":`recent-activity`,class:`grid gap-2`},Kx={key:0,class:`grid gap-3`},qx={key:1,class:`text-xs text-muted`},Jx={key:2,class:`grid`},Yx=[`title`],Xx={key:1,class:`text-highlighted`},Zx={key:1,class:`text-highlighted`},Qx={class:`text-xs whitespace-nowrap text-dimmed tabular-nums`},$x=[`aria-expanded`],eS=8,tS=V({__name:`console-document-dashboard`,props:{client:{},collections:{},error:{},label:{},loading:{type:Boolean},overview:{},section:{},setup:{}},emits:[`changed`,`reload`],setup(e,{emit:t}){let n=e,r=t,a=cr(),o=Jn(),c=Ye(),l=A(!1),u=A(!1),d=A(new Set);f(()=>n.overview,()=>{d.value=new Set});let m=p(()=>new Map(n.collections.map(e=>[e.name,e]))),{sessions:h,of:g,user:_}=wi({client:n.client}),y=p(()=>{let e=new Map;for(let t of n.overview?.collections??[]){for(let n of t.changes)e.set(`${t.name}/${n.id}`,n.title);for(let n of t.scheduled)e.set(`${t.name}/${n.id}`,n.title)}let t=new Map;for(let n of h.value){let r=m.value.get(n.collection),i=`${n.collection}/${n.id}`;n.self||!r||t.has(i)||t.set(i,{collection:r,id:n.id,title:e.get(i)??(r.kind===`singleton`?r.label:n.id)})}return[...t.values()]}),x=p(()=>{let e={draft:0,changed:0,published:0,deleted:0};for(let t of n.overview?.collections??[])for(let n of It)e[n]+=t.states[n];return e}),S=p(()=>[`draft`,`changed`,`published`,`deleted`].map(e=>({count:x.value[e],label:{changed:`Changed`,deleted:`Deleted`,draft:`Drafts`,published:`Published`}[e],state:e}))),C=p(()=>(n.overview?.collections??[]).flatMap(e=>e.changes.map(t=>({change:t,collection:m.value.get(e.name)}))).filter(e=>!!e.collection&&!d.value.has(ie(e.collection.name,e.change.id))).sort((e,t)=>(t.change.updatedAt??``).localeCompare(e.change.updatedAt??``))),w=p(()=>(n.overview?.collections??[]).flatMap(e=>(e.scheduled??[]).map(t=>({item:t,collection:m.value.get(e.name)}))).filter(e=>!!e.collection).sort((e,t)=>e.item.schedule.at.localeCompare(t.item.schedule.at))),T={failed:`Failed`,overdue:`Overdue`,pending:`Scheduled`};function E(e){return new Date(e).toLocaleString(void 0,{day:`numeric`,hour:`2-digit`,hour12:!1,minute:`2-digit`,month:`short`})}let D=p(()=>C.value.filter(e=>e.collection.access.publish&&!e.change.issues)),N=p(()=>C.value.filter(e=>e.collection.access.publish&&e.change.issues).length),P=p(()=>n.collections.some(e=>e.access.publish)),I=p(()=>n.collections.filter(e=>e.kind!==`singleton`)),L=p(()=>n.collections.filter(e=>e.kind===`singleton`)),R=p(()=>{let e=be(n.section,`settings`);return o.hasRoute(e)?{name:e}:void 0});function ee(e){let t={draft:0,changed:0,published:0,deleted:0};for(let r of n.overview?.collections??[])if(e.includes(r.name))for(let e of It)t[e]+=r.states[e];return t}function z(e){let t=ee(e);return[...t.draft?[{label:t.draft===1?`1 draft`:`${t.draft} drafts`,state:`draft`}]:[],...t.changed?[{label:`${t.changed} changed`,state:`changed`}]:[]]}let te=A(!1),B=p(()=>{let e=n.overview?.activity??[];return te.value?e:e.slice(0,eS)}),V=p(()=>I.value.filter(e=>e.access.write)),ne=p(()=>n.loading&&!n.overview),re=p(()=>n.collections.length?void 0:n.setup?.access);function ie(e,t){return`${e}\u0000${t}`}function ae(){return Ce(a.name,xe(n.section))}function oe(e,t){return{name:ae(),params:{collection:e,document:t.split(`/`)},query:{}}}function U(e){return{name:ae(),params:{collection:e,document:[]},query:{}}}function W(e){return{name:ae(),params:{collection:e,document:[]},query:{new:`1`}}}let se=new Map([[`publish`,`published`],[`remove`,`deleted`],[`restore`,`restored`],[`save`,`edited`]]);function ce(e){return se.get(e.action)??`changed`}function le(e){return m.value.get(e)?.label??e}async function ue(){let e=D.value;if(l.value||!e.length)return;u.value=!1,l.value=!0;let t=d.value;d.value=new Set([...t,...e.map(e=>ie(e.collection.name,e.change.id))]);try{let t=await sn(n.client,e.map(e=>({collection:e.collection.name,change:e.change})));t&&c.show({title:t===1?`Change published`:`${t} changes published`}),r(`changed`)}catch(e){d.value=t;let n=Tn(e),i=vt(e);i?.length?c.error(`${i.length===1?`1 document`:`${i.length} documents`} also changed on the site. Open ${i.length===1?`it`:`each one`} to compare, then publish again.`):n?c.error(n.length===1?`A draft changed after this page loaded. Refresh and publish again.`:`${n.length} drafts changed after this page loaded. Refresh and publish again.`,{label:`Refresh`,onClick:()=>r(`reload`)}):c.error(`Couldn't publish. ${un(e,`Try again.`)}`,{label:`Retry`,onClick:ue}),r(`changed`)}finally{l.value=!1}}return(t,n)=>{let a=dr,o=Yr,c=Dr,d=ye,f=v(`RouterLink`),p=ge,m=Ft;return J(),b(O,null,[H(Si,{title:e.label},{right:i(()=>[P.value&&D.value.length?(J(),k(o,{key:0,open:u.value,"onUpdate:open":n[1]||=e=>u.value=e},{content:i(()=>[j(`div`,Yb,[j(`p`,Xb,[K(` Publish the `+q(D.value.length===1?`change`:`${D.value.length} changes`)+` listed under Needs publishing, exactly as they are now. `,1),N.value?(J(),b(O,{key:0},[K(q(N.value===1?`1 draft with field issues stays`:`${N.value} drafts with field issues stay`)+` unpublished.`,1)],64)):M(``,!0)]),j(`div`,Zb,[H(a,{variant:`ghost`,size:`sm`,label:`Cancel`,onClick:n[0]||=e=>u.value=!1}),H(a,{size:`sm`,label:`Publish all`,loading:l.value,onClick:ue},null,8,[`loading`])])])]),default:i(()=>[H(a,{size:`sm`,label:`Publish`,loading:l.value,"aria-label":`Publish ${D.value.length} ${D.value.length===1?`change`:`changes`}`},{trailing:i(()=>[j(`span`,Jb,q(D.value.length),1)]),_:1},8,[`loading`,`aria-label`])]),_:1},8,[`open`])):M(``,!0)]),_:1},8,[`title`]),j(`div`,{class:`min-h-0 flex-1 overflow-y-auto`,"aria-busy":e.loading},[j(`div`,$b,[e.error&&!e.overview?(J(),k(c,{key:0,color:`error`,variant:`subtle`,icon:`i-lucide-cloud-off`,title:`Couldn't load the dashboard`,description:F(un)(e.error),actions:[{label:`Try again`,icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,onClick:()=>r(`reload`)}]},null,8,[`description`,`actions`])):M(``,!0),j(`section`,ex,[(J(!0),b(O,null,s(S.value,(e,t)=>(J(),b(`div`,{key:e.state,class:G([`grid gap-1 px-4 py-3`,[t%2?`border-s border-default`:``,t>1?`border-t border-default sm:border-t-0`:``,t===2?`sm:border-s`:``]])},[H(xi,{tone:F(tn)(e.state),label:e.label},null,8,[`tone`,`label`]),ne.value?(J(),k(d,{key:0,class:`h-7 w-10 rounded`})):(J(),b(`span`,{key:1,class:G([`text-2xl font-semibold tracking-tight tabular-nums`,e.count?`text-highlighted`:`text-dimmed`])},q(e.count),3))],2))),128))]),j(`div`,tx,[j(`div`,nx,[y.value.length?(J(),b(`section`,rx,[j(`h2`,ix,[n[3]||=K(` Open now `,-1),j(`span`,ax,q(y.value.length),1)]),j(`ul`,ox,[(J(!0),b(O,null,s(y.value.slice(0,12),e=>(J(),b(`li`,{key:`${e.collection.name}/${e.id}`},[H(f,{to:oe(e.collection.name,e.id),class:`flex h-11 items-center gap-3 px-3 hover:bg-elevated/60 focus-visible:outline-2 focus-visible:-outline-offset-2`},{default:i(()=>[j(`span`,sx,q(e.title),1),j(`span`,cx,q(e.collection.label),1),H(qb,{sessions:F(g)(e.collection.name,e.id),user:F(_)},null,8,[`sessions`,`user`])]),_:2},1032,[`to`])]))),128))])])):M(``,!0),j(`section`,lx,[j(`header`,ux,[j(`h2`,dx,[n[4]||=K(` Needs publishing `,-1),C.value.length?(J(),b(`span`,fx,q(C.value.length),1)):M(``,!0)]),C.value.length&&!P.value?(J(),b(`p`,px,`An editor publishes these.`)):M(``,!0)]),ne.value?(J(),b(`div`,mx,[(J(),b(O,null,s(3,e=>H(d,{key:e,class:`h-11 rounded-md`})),64))])):!C.value.length&&re.value?(J(),b(`div`,hx,[n[5]||=j(`p`,{class:`text-[13px] text-highlighted`},`No one can read documents yet`,-1),j(`p`,gx,[H($r,{hint:re.value},null,8,[`hint`])])])):C.value.length?(J(),b(`ul`,vx,[(J(!0),b(O,null,s(C.value.slice(0,12),e=>(J(),b(`li`,{key:`${e.collection.name}/${e.change.id}`},[H(f,{to:e.change.state===`deleted`?U(e.collection.name):oe(e.collection.name,e.change.id),class:`vitehub-dashboard-row`},{default:i(()=>[H(xi,{class:`vitehub-dashboard-row__status`,tone:F(tn)(e.change.state),label:F(xn)(e.change.state)},null,8,[`tone`,`label`]),j(`span`,yx,[j(`span`,{class:G([`truncate`,{"text-muted line-through decoration-(--ui-text-dimmed)":e.change.state===`deleted`}])},q(e.change.title),3),H(qb,{sessions:F(g)(e.collection.name,e.change.id),user:F(_),variant:`row`},null,8,[`sessions`,`user`])]),j(`span`,bx,[e.change.issues?(J(),k(m,{key:0,text:F(Kt)(e.change.issues)},{default:i(()=>[H(xi,{tone:`error`,label:e.change.issues===1?`1 issue`:`${e.change.issues} issues`},null,8,[`label`])]),_:2},1032,[`text`])):M(``,!0),K(` `+q(e.collection.label),1)]),j(`span`,xx,[e.change.updatedAt?(J(),k(Qr,{key:0,value:e.change.updatedAt},null,8,[`value`])):(J(),b(`span`,Sx,`—`))])]),_:2},1032,[`to`])]))),128))])):(J(),b(`p`,_x,[H(p,{name:`i-lucide-circle-check`,class:`size-4 shrink-0 text-success`,"aria-hidden":`true`}),n[6]||=K(` Everything is published. Drafts and edits show here until someone publishes them. `,-1)])),C.value.length>12?(J(),b(`p`,Cx,`And `+q(C.value.length-12)+` more. Each collection lists all of its changes.`,1)):M(``,!0)]),w.value.length?(J(),b(`section`,wx,[j(`h2`,Tx,[n[7]||=K(` Scheduled `,-1),j(`span`,Ex,q(w.value.length),1)]),e.setup?.schedule?(J(),b(`p`,Dx,[H($r,{hint:e.setup.schedule},null,8,[`hint`])])):M(``,!0),j(`ul`,Ox,[(J(!0),b(O,null,s(w.value.slice(0,12),t=>(J(),b(`li`,{key:`${t.collection.name}/${t.item.id}`},[H(f,{to:oe(t.collection.name,t.item.id),class:`vitehub-dashboard-row`,title:F(kt)(t.item.schedule,e.setup)},{default:i(()=>[H(xi,{class:`vitehub-dashboard-row__status`,tone:F(_n)(t.item.schedule),label:T[t.item.schedule.status]},null,8,[`tone`,`label`]),j(`span`,kx,[j(`span`,Ax,q(t.item.title),1),H(qb,{sessions:F(g)(t.collection.name,t.item.id),user:F(_),variant:`row`},null,8,[`sessions`,`user`])]),j(`span`,jx,q(t.collection.label),1),j(`time`,{class:`vitehub-dashboard-row__time`,datetime:t.item.schedule.at},q(E(t.item.schedule.at)),9,Mx)]),_:2},1032,[`to`,`title`])]))),128))]),w.value.length>12?(J(),b(`p`,Nx,`And `+q(w.value.length-12)+` more. Each collection's Scheduled tab lists all of them.`,1)):M(``,!0)])):M(``,!0),j(`section`,Px,[n[9]||=j(`h2`,{id:`collections`,class:`text-[13px] font-medium text-highlighted`},`Collections`,-1),ne.value&&!I.value.length?(J(),b(`div`,Fx,[(J(),b(O,null,s(2,e=>H(d,{key:e,class:`h-11 rounded-md`})),64))])):!I.value.length&&!L.value.length?(J(),b(`p`,Ix,`No collections you can read.`)):(J(),b(`ul`,Lx,[(J(!0),b(O,null,s(I.value,e=>(J(),b(`li`,{key:e.name,class:`flex h-11 items-center gap-3 px-3`},[H(f,{to:U(e.name),class:`flex min-w-0 flex-1 items-baseline gap-2 rounded-sm hover:text-highlighted focus-visible:outline-2 focus-visible:outline-offset-2`},{default:i(()=>[j(`span`,Rx,q(e.label),1),j(`span`,zx,q(e.path),1)]),_:2},1032,[`to`]),j(`span`,Bx,[(J(!0),b(O,null,s(z([e.name]),e=>(J(),k(xi,{key:e.state,class:`hidden sm:inline-flex`,tone:F(tn)(e.state),label:e.label},null,8,[`tone`,`label`]))),128)),j(`span`,null,q(ee([e.name]).published)+` published`,1)]),e.access.write?(J(),k(a,{key:0,to:W(e.name),size:`xs`,variant:`outline`,icon:`i-lucide-plus`,label:F(Me)(e),"aria-label":`New ${F(Me)(e).toLowerCase()}`},null,8,[`to`,`label`,`aria-label`])):M(``,!0)]))),128)),L.value.length&&R.value?(J(),b(`li`,Vx,[H(f,{to:R.value,class:`flex min-w-0 flex-1 items-baseline gap-2 rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2`},{default:i(()=>[n[8]||=j(`span`,{class:`truncate text-sm font-medium text-highlighted`},`Settings`,-1),j(`span`,Hx,q(L.value.length===1?`1 singleton`:`${L.value.length} singletons`),1)]),_:1},8,[`to`]),j(`span`,Ux,[(J(!0),b(O,null,s(z(L.value.map(e=>e.name)),e=>(J(),k(xi,{key:e.state,class:`hidden sm:inline-flex`,tone:F(tn)(e.state),label:e.label},null,8,[`tone`,`label`]))),128)),j(`span`,null,q(ee(L.value.map(e=>e.name)).published)+` published`,1)])])):M(``,!0)])),I.value.length&&!V.value.length?(J(),b(`p`,Wx,`You can read these collections but not edit them.`)):M(``,!0)])]),j(`section`,Gx,[n[10]||=j(`h2`,{id:`recent-activity`,class:`text-[13px] font-medium text-highlighted`},`Recent activity`,-1),ne.value?(J(),b(`div`,Kx,[(J(),b(O,null,s(5,e=>H(d,{key:e,class:`h-9 rounded-md`})),64))])):e.overview?.activity.length?(J(),b(`ol`,Jx,[(J(!0),b(O,null,s(B.value,e=>(J(),b(`li`,{key:e.id,class:`grid min-h-9 grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3 py-1`},[j(`p`,{class:`min-w-0 truncate text-[13px] text-muted`,title:e.documents.length===1?le(e.documents[0].collection):e.documents.map(e=>e.title).join(`, `)},[j(`span`,{class:G(e.author?`font-medium text-highlighted`:``)},q(e.author??`Someone`),3),K(` `+q(ce(e))+` `,1),e.documents.length===1?(J(),b(O,{key:0},[e.action===`remove`?(J(),b(`span`,Xx,q(e.documents[0].title),1)):(J(),k(f,{key:0,to:oe(e.documents[0].collection,e.documents[0].id),class:`text-highlighted underline decoration-(--ui-border-accented) underline-offset-2 hover:decoration-(--ui-text-muted)`},{default:i(()=>[K(q(e.documents[0].title),1)]),_:2},1032,[`to`]))],64)):(J(),b(`span`,Zx,q(e.documents.length)+` documents`,1))],8,Yx),j(`span`,Qx,[H(Qr,{value:e.createdAt},null,8,[`value`])])]))),128))])):(J(),b(`p`,qx,`Saves and publishes show here.`)),(e.overview?.activity.length??0)>eS?(J(),b(`button`,{key:3,type:`button`,class:`w-fit rounded-sm text-xs text-dimmed hover:text-highlighted focus-visible:outline-2 focus-visible:outline-offset-2`,"aria-expanded":te.value,onClick:n[2]||=e=>te.value=!te.value},q(te.value?`Show less`:`Show all ${e.overview?.activity.length}`),9,$x)):M(``,!0)])])])],8,Qb)],64)}}}),nS={slots:{base:[`group relative inline-flex items-center rounded-md select-none`,`transition-colors`],leading:`absolute inset-y-0 start-0 flex items-center`,leadingIcon:`shrink-0 text-dimmed`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailing:`absolute inset-y-0 end-0 flex items-center`,trailingIcon:`shrink-0 text-dimmed`,segment:[`rounded-sm text-center outline-hidden data-placeholder:text-dimmed data-[segment=literal]:text-muted data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75`,`transition-colors`],separatorIcon:`shrink-0 size-4 text-muted`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},size:{xs:{base:[`px-2 py-1 text-sm/4 gap-1`,`gap-0.25`],leading:`ps-2`,trailing:`pe-2`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,segment:`not-data-[segment=literal]:w-8`},sm:{base:[`px-2.5 py-1.5 text-sm/4 gap-1.5`,`gap-0.5`],leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,segment:`not-data-[segment=literal]:w-8`},md:{base:[`px-2.5 py-1.5 text-base/5 gap-1.5`,`gap-0.5`],leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,segment:`not-data-[segment=literal]:w-9`},lg:{base:[`px-3 py-2 text-base/5 gap-2`,`gap-0.75`],leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,segment:`not-data-[segment=literal]:w-9`},xl:{base:[`px-3 py-2 text-base gap-2`,`gap-0.75`],leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-6`,leadingAvatarSize:`xs`,trailingIcon:`size-6`,segment:`not-data-[segment=literal]:w-10`}},variant:{outline:`text-highlighted bg-default ring ring-inset ring-accented`,soft:`text-highlighted bg-elevated/50 hover:bg-elevated has-focus:bg-elevated disabled:bg-elevated/50`,subtle:`text-highlighted bg-elevated ring ring-inset ring-accented`,ghost:`text-highlighted bg-transparent hover:bg-elevated has-focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent`,none:`text-highlighted bg-transparent has-focus:outline-none`},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},leading:{true:``},trailing:{true:``},loading:{true:``},highlight:{true:``},fixed:{false:``},type:{file:`file:me-1.5 file:font-medium file:text-muted file:outline-none`}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:`outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`},{color:`secondary`,variant:[`outline`,`subtle`],class:`outline-secondary/25 has-focus-visible:outline-3 has-focus-visible:ring-secondary`},{color:`success`,variant:[`outline`,`subtle`],class:`outline-success/25 has-focus-visible:outline-3 has-focus-visible:ring-success`},{color:`info`,variant:[`outline`,`subtle`],class:`outline-info/25 has-focus-visible:outline-3 has-focus-visible:ring-info`},{color:`warning`,variant:[`outline`,`subtle`],class:`outline-warning/25 has-focus-visible:outline-3 has-focus-visible:ring-warning`},{color:`error`,variant:[`outline`,`subtle`],class:`outline-error/25 has-focus-visible:outline-3 has-focus-visible:ring-error`},{color:`primary`,variant:[`soft`,`ghost`],class:`outline-primary/25 has-focus-visible:outline-3`},{color:`secondary`,variant:[`soft`,`ghost`],class:`outline-secondary/25 has-focus-visible:outline-3`},{color:`success`,variant:[`soft`,`ghost`],class:`outline-success/25 has-focus-visible:outline-3`},{color:`info`,variant:[`soft`,`ghost`],class:`outline-info/25 has-focus-visible:outline-3`},{color:`warning`,variant:[`soft`,`ghost`],class:`outline-warning/25 has-focus-visible:outline-3`},{color:`error`,variant:[`soft`,`ghost`],class:`outline-error/25 has-focus-visible:outline-3`},{color:`primary`,highlight:!0,class:`ring ring-inset ring-primary`},{color:`secondary`,highlight:!0,class:`ring ring-inset ring-secondary`},{color:`success`,highlight:!0,class:`ring ring-inset ring-success`},{color:`info`,highlight:!0,class:`ring ring-inset ring-info`},{color:`warning`,highlight:!0,class:`ring ring-inset ring-warning`},{color:`error`,highlight:!0,class:`ring ring-inset ring-error`},{color:`neutral`,variant:[`outline`,`subtle`],class:`outline-inverted/25 has-focus-visible:outline-3 has-focus-visible:ring-inverted`},{color:`neutral`,variant:[`soft`,`ghost`],class:`outline-inverted/25 has-focus-visible:outline-3`},{color:`neutral`,highlight:!0,class:`ring ring-inset ring-inverted`},{leading:!0,size:`xs`,class:`ps-7`},{leading:!0,size:`sm`,class:`ps-8`},{leading:!0,size:`md`,class:`ps-9`},{leading:!0,size:`lg`,class:`ps-10`},{leading:!0,size:`xl`,class:`ps-11`},{trailing:!0,size:`xs`,class:`pe-7`},{trailing:!0,size:`sm`,class:`pe-8`},{trailing:!0,size:`md`,class:`pe-9`},{trailing:!0,size:`lg`,class:`pe-10`},{trailing:!0,size:`xl`,class:`pe-11`},{loading:!0,leading:!0,class:{leadingIcon:`animate-spin`}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:`animate-spin`}},{fixed:!1,size:`xs`,class:`md:text-xs`},{fixed:!1,size:`sm`,class:`md:text-xs`},{fixed:!1,size:`md`,class:`md:text-sm`},{fixed:!1,size:`lg`,class:`md:text-sm`},{variant:`outline`,class:{segment:`focus:bg-elevated`}},{variant:`soft`,class:{segment:`focus:bg-accented/50 group-hover:focus:bg-accented`}},{variant:`subtle`,class:{segment:`focus:bg-accented`}},{variant:`ghost`,class:{segment:`focus:bg-elevated group-hover:focus:bg-accented`}},{variant:`none`,class:{segment:`focus:bg-elevated`}}],defaultVariants:{size:`md`,color:`primary`,variant:`outline`}},rS=Object.assign({inheritAttrs:!1},{__name:`InputTime`,props:{as:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},separatorIcon:{type:null,required:!1},range:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},defaultPlaceholder:{type:Object,required:!1},placeholder:{type:Object,required:!1},hourCycle:{type:null,required:!1},step:{type:Object,required:!1},stepSnapping:{type:Boolean,required:!1},granularity:{type:String,required:!1},hideTimeZone:{type:Boolean,required:!1},maxValue:{type:Object,required:!1},minValue:{type:Object,required:!1},locale:{type:String,required:!1},disabled:{type:Boolean,required:!1},readonly:{type:Boolean,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},isTimeUnavailable:{type:Function,required:!1}},emits:[`update:modelValue`,`change`,`blur`,`focus`,`update:placeholder`],setup(e,{expose:t,emit:n}){let r=e,a=n,c=y(),l=hr(`inputTime`,r),u=_e(),d=mr(pe(l,`id`,`name`,`range`,`modelValue`,`defaultValue`,`color`,`variant`,`size`,`highlight`,`fixed`,`disabled`,`autofocus`,`autofocusDelay`,`icon`,`avatar`,`leading`,`leadingIcon`,`trailing`,`trailingIcon`,`loading`,`loadingIcon`,`separatorIcon`,`class`,`ui`),a),{emitFormBlur:f,emitFormFocus:m,emitFormChange:h,emitFormInput:g,id:_,color:v,size:x,name:S,highlight:C,disabled:w,ariaAttrs:T}=pr(r),{orientation:E,size:D}=fr(r),{isLeading:j,isTrailing:N,leadingIconName:P,trailingIconName:I}=ur(l),L=p(()=>v.value??l.color),R=p(()=>C.value??l.highlight),ee=p(()=>D.value??x.value??l.size),z=p(()=>w.value??l.disabled),te=p(()=>nr({extend:nS,...u.ui?.inputTime||{}})({color:L.value,variant:l.variant,size:ee.value,loading:l.loading,highlight:R.value,fixed:l.fixed,leading:j.value||!!l.avatar||!!c.leading,trailing:N.value||!!c.trailing,fieldGroup:E.value})),[B,V]=de(),ne=A([]),re={Root:qa,Input:Ja},ie=p(()=>l.range?re:Nt);function ae(e,t){ne.value[e]=t}function oe(e){let t=new Event(`change`,{target:{value:e}});a(`change`,t),h(),g()}function U(e){e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||(a(`blur`,e),f())}function ce(e){e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||(a(`focus`,e),m())}function le(){l.autofocus&&ne.value[0]?.$el?.focus()}let ue;return he(()=>{ue=setTimeout(()=>{le()},l.autofocusDelay)}),se(()=>clearTimeout(ue)),t({inputsRef:ne}),(e,t)=>(J(),b(O,null,[H(F(B),null,{default:i(({segments:e,type:t})=>[(J(!0),b(O,null,s(e,(e,n)=>(J(),k(F(ie).Input,{key:`${e.part}-${n}`,ref_for:!0,ref:e=>ae(n,e),type:t,part:e.part,"data-slot":`segment`,class:G(te.value.segment({class:F(l).ui?.segment})),"data-segment":e.part},{default:i(()=>[K(q(e.value.trim()),1)]),_:2},1032,[`type`,`part`,`class`,`data-segment`]))),128))]),_:1}),H(F(ie).Root,W({id:F(_),"data-slot":`base`},{...F(d),...e.$attrs,...F(T)},{name:F(S),disabled:z.value,"model-value":F(l).modelValue,"default-value":F(l).defaultValue,class:te.value.base({class:[F(l).ui?.base,F(l).class]}),"onUpdate:modelValue":oe,onFocusout:U,onFocusin:ce}),{default:i(({segments:t})=>[Array.isArray(t)?(J(),k(F(V),{key:0,segments:t},null,8,[`segments`])):(J(),b(O,{key:1},[H(F(V),{segments:t.start,type:`start`},null,8,[`segments`]),o(e.$slots,`separator`,{ui:te.value},()=>[H(ge,{name:F(l).separatorIcon||F(u).ui.icons.minus,"data-slot":`separatorIcon`,class:G(te.value.separatorIcon({class:F(l).ui?.separatorIcon}))},null,8,[`name`,`class`])]),H(F(V),{segments:t.end,type:`end`},null,8,[`segments`])],64)),o(e.$slots,`default`,{ui:te.value}),F(j)||F(l).avatar||c.leading?(J(),b(`span`,{key:2,"data-slot":`leading`,class:G(te.value.leading({class:F(l).ui?.leading}))},[o(e.$slots,`leading`,{ui:te.value},()=>[F(j)&&F(P)?(J(),k(ge,{key:0,name:F(P),"data-slot":`leadingIcon`,class:G(te.value.leadingIcon({class:F(l).ui?.leadingIcon}))},null,8,[`name`,`class`])):F(l).avatar?(J(),k(sr,W({key:1,size:F(l).ui?.leadingAvatarSize||te.value.leadingAvatarSize()},F(l).avatar,{"data-slot":`leadingAvatar`,class:te.value.leadingAvatar({class:F(l).ui?.leadingAvatar})}),null,16,[`size`,`class`])):M(``,!0)])],2)):M(``,!0),F(N)||c.trailing?(J(),b(`span`,{key:3,"data-slot":`trailing`,class:G(te.value.trailing({class:F(l).ui?.trailing}))},[o(e.$slots,`trailing`,{ui:te.value},()=>[F(I)?(J(),k(ge,{key:0,name:F(I),"data-slot":`trailingIcon`,class:G(te.value.trailingIcon({class:F(l).ui?.trailingIcon}))},null,8,[`name`,`class`])):M(``,!0)])],2)):M(``,!0)]),_:3},16,[`id`,`name`,`disabled`,`model-value`,`default-value`,`class`])],64))}}),iS={slots:{base:[`group relative inline-flex items-center rounded-md select-none`,`transition-colors`],leading:`absolute inset-y-0 start-0 flex items-center`,leadingIcon:`shrink-0 text-dimmed`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailing:`absolute inset-y-0 end-0 flex items-center`,trailingIcon:`shrink-0 text-dimmed`,segment:[`rounded-sm text-center outline-hidden data-placeholder:text-dimmed data-[segment=literal]:text-muted data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75`,`transition-colors`],separatorIcon:`shrink-0 size-4 text-muted`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},size:{xs:{base:[`px-2 py-1 text-sm/4 gap-1`,`gap-0.25`],leading:`ps-2`,trailing:`pe-2`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,segment:`data-[segment=day]:w-8 data-[segment=month]:w-8 data-[segment=year]:w-10`},sm:{base:[`px-2.5 py-1.5 text-sm/4 gap-1.5`,`gap-0.5`],leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,segment:`data-[segment=day]:w-8 data-[segment=month]:w-8 data-[segment=year]:w-10`},md:{base:[`px-2.5 py-1.5 text-base/5 gap-1.5`,`gap-0.5`],leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,segment:`data-[segment=day]:w-9 data-[segment=month]:w-9 data-[segment=year]:w-11`},lg:{base:[`px-3 py-2 text-base/5 gap-2`,`gap-0.75`],leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,segment:`data-[segment=day]:w-9 data-[segment=month]:w-9 data-[segment=year]:w-11`},xl:{base:[`px-3 py-2 text-base gap-2`,`gap-0.75`],leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-6`,leadingAvatarSize:`xs`,trailingIcon:`size-6`,segment:`data-[segment=day]:w-10 data-[segment=month]:w-10 data-[segment=year]:w-12`}},variant:{outline:`text-highlighted bg-default ring ring-inset ring-accented`,soft:`text-highlighted bg-elevated/50 hover:bg-elevated has-focus:bg-elevated disabled:bg-elevated/50`,subtle:`text-highlighted bg-elevated ring ring-inset ring-accented`,ghost:`text-highlighted bg-transparent hover:bg-elevated has-focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent`,none:`text-highlighted bg-transparent has-focus:outline-none`},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},leading:{true:``},trailing:{true:``},loading:{true:``},highlight:{true:``},fixed:{false:``},type:{file:`file:me-1.5 file:font-medium file:text-muted file:outline-none`}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:`outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`},{color:`secondary`,variant:[`outline`,`subtle`],class:`outline-secondary/25 has-focus-visible:outline-3 has-focus-visible:ring-secondary`},{color:`success`,variant:[`outline`,`subtle`],class:`outline-success/25 has-focus-visible:outline-3 has-focus-visible:ring-success`},{color:`info`,variant:[`outline`,`subtle`],class:`outline-info/25 has-focus-visible:outline-3 has-focus-visible:ring-info`},{color:`warning`,variant:[`outline`,`subtle`],class:`outline-warning/25 has-focus-visible:outline-3 has-focus-visible:ring-warning`},{color:`error`,variant:[`outline`,`subtle`],class:`outline-error/25 has-focus-visible:outline-3 has-focus-visible:ring-error`},{color:`primary`,variant:[`soft`,`ghost`],class:`outline-primary/25 has-focus-visible:outline-3`},{color:`secondary`,variant:[`soft`,`ghost`],class:`outline-secondary/25 has-focus-visible:outline-3`},{color:`success`,variant:[`soft`,`ghost`],class:`outline-success/25 has-focus-visible:outline-3`},{color:`info`,variant:[`soft`,`ghost`],class:`outline-info/25 has-focus-visible:outline-3`},{color:`warning`,variant:[`soft`,`ghost`],class:`outline-warning/25 has-focus-visible:outline-3`},{color:`error`,variant:[`soft`,`ghost`],class:`outline-error/25 has-focus-visible:outline-3`},{color:`primary`,highlight:!0,class:`ring ring-inset ring-primary`},{color:`secondary`,highlight:!0,class:`ring ring-inset ring-secondary`},{color:`success`,highlight:!0,class:`ring ring-inset ring-success`},{color:`info`,highlight:!0,class:`ring ring-inset ring-info`},{color:`warning`,highlight:!0,class:`ring ring-inset ring-warning`},{color:`error`,highlight:!0,class:`ring ring-inset ring-error`},{color:`neutral`,variant:[`outline`,`subtle`],class:`outline-inverted/25 has-focus-visible:outline-3 has-focus-visible:ring-inverted`},{color:`neutral`,variant:[`soft`,`ghost`],class:`outline-inverted/25 has-focus-visible:outline-3`},{color:`neutral`,highlight:!0,class:`ring ring-inset ring-inverted`},{leading:!0,size:`xs`,class:`ps-7`},{leading:!0,size:`sm`,class:`ps-8`},{leading:!0,size:`md`,class:`ps-9`},{leading:!0,size:`lg`,class:`ps-10`},{leading:!0,size:`xl`,class:`ps-11`},{trailing:!0,size:`xs`,class:`pe-7`},{trailing:!0,size:`sm`,class:`pe-8`},{trailing:!0,size:`md`,class:`pe-9`},{trailing:!0,size:`lg`,class:`pe-10`},{trailing:!0,size:`xl`,class:`pe-11`},{loading:!0,leading:!0,class:{leadingIcon:`animate-spin`}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:`animate-spin`}},{fixed:!1,size:`xs`,class:`md:text-xs`},{fixed:!1,size:`sm`,class:`md:text-xs`},{fixed:!1,size:`md`,class:`md:text-sm`},{fixed:!1,size:`lg`,class:`md:text-sm`},{variant:`outline`,class:{segment:`focus:bg-elevated`}},{variant:`soft`,class:{segment:`focus:bg-accented/50 group-hover:focus:bg-accented`}},{variant:`subtle`,class:{segment:`focus:bg-accented`}},{variant:`ghost`,class:{segment:`focus:bg-elevated group-hover:focus:bg-accented`}},{variant:`none`,class:{segment:`focus:bg-elevated`}}],defaultVariants:{size:`md`,color:`primary`,variant:`outline`}},aS=Object.assign({inheritAttrs:!1},{__name:`InputDate`,props:{as:{type:null,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},separatorIcon:{type:null,required:!1},range:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},defaultPlaceholder:{type:Object,required:!1},placeholder:{type:Object,required:!1},hourCycle:{type:null,required:!1},step:{type:Object,required:!1},stepSnapping:{type:Boolean,required:!1},granularity:{type:String,required:!1},hideTimeZone:{type:Boolean,required:!1},maxValue:{type:Object,required:!1},minValue:{type:Object,required:!1},locale:{type:String,required:!1},disabled:{type:Boolean,required:!1},readonly:{type:Boolean,required:!1},isDateUnavailable:{type:Function,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`change`,`blur`,`focus`,`update:placeholder`],setup(e,{expose:t,emit:n}){let r=e,a=n,c=y(),l=hr(`inputDate`,r),u=_e(),d=mr(pe(l,`id`,`name`,`range`,`modelValue`,`defaultValue`,`color`,`variant`,`size`,`highlight`,`fixed`,`disabled`,`autofocus`,`autofocusDelay`,`icon`,`avatar`,`leading`,`leadingIcon`,`trailing`,`trailingIcon`,`loading`,`loadingIcon`,`separatorIcon`,`class`,`ui`),a),{emitFormBlur:f,emitFormFocus:m,emitFormChange:h,emitFormInput:g,size:_,color:v,id:x,name:S,highlight:C,disabled:w,ariaAttrs:T}=pr(r),{orientation:E,size:D}=fr(r),{isLeading:j,isTrailing:N,leadingIconName:P,trailingIconName:I}=ur(l),[L,R]=de(),ee=p(()=>v.value??l.color),z=p(()=>C.value??l.highlight),te=p(()=>D.value??_.value??l.size),B=p(()=>w.value??l.disabled),V=p(()=>nr({extend:iS,...u.ui?.inputDate||{}})({color:ee.value,variant:l.variant,size:te.value,highlight:z.value,fixed:l.fixed,loading:l.loading,leading:j.value||!!l.avatar||!!c.leading,trailing:N.value||!!c.trailing,fieldGroup:E.value})),ne=A([]);function re(e,t){ne.value[e]=t}function ie(e){let t=new Event(`change`,{target:{value:e}});a(`change`,t),h(),g()}function ae(e){e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||(a(`blur`,e),f())}function oe(e){e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||(a(`focus`,e),m())}function U(){l.autofocus&&ne.value[0]?.$el?.focus()}let ce;he(()=>{ce=setTimeout(()=>{U()},l.autofocusDelay)}),se(()=>clearTimeout(ce));let le=p(()=>l.range?on:fn);return t({inputsRef:ne}),(e,t)=>(J(),b(O,null,[H(F(L),null,{default:i(({segments:e,type:t})=>[(J(!0),b(O,null,s(e,(e,n)=>(J(),k(F(le).Input,{key:`${e.part}-${n}`,ref_for:!0,ref:e=>re(n,e),type:t,part:e.part,"data-slot":`segment`,class:G(V.value.segment({class:F(l).ui?.segment})),"data-segment":e.part},{default:i(()=>[K(q(e.value.trim()),1)]),_:2},1032,[`type`,`part`,`class`,`data-segment`]))),128))]),_:1}),H(F(le).Root,W({id:F(x),"data-slot":`base`},{...F(d),...e.$attrs,...F(T)},{"model-value":F(l).modelValue,"default-value":F(l).defaultValue,name:F(S),disabled:B.value,class:V.value.base({class:[F(l).ui?.base,F(l).class]}),"onUpdate:modelValue":ie,onFocusout:ae,onFocusin:oe}),{default:i(({segments:t})=>[Array.isArray(t)?(J(),k(F(R),{key:0,segments:t},null,8,[`segments`])):(J(),b(O,{key:1},[H(F(R),{segments:t.start,type:`start`},null,8,[`segments`]),o(e.$slots,`separator`,{ui:V.value},()=>[H(ge,{name:F(l).separatorIcon||F(u).ui.icons.minus,"data-slot":`separatorIcon`,class:G(V.value.separatorIcon({class:F(l).ui?.separatorIcon}))},null,8,[`name`,`class`])]),H(F(R),{segments:t.end,type:`end`},null,8,[`segments`])],64)),o(e.$slots,`default`,{ui:V.value}),F(j)||F(l).avatar||c.leading?(J(),b(`span`,{key:2,"data-slot":`leading`,class:G(V.value.leading({class:F(l).ui?.leading}))},[o(e.$slots,`leading`,{ui:V.value},()=>[F(j)&&F(P)?(J(),k(ge,{key:0,name:F(P),"data-slot":`leadingIcon`,class:G(V.value.leadingIcon({class:F(l).ui?.leadingIcon}))},null,8,[`name`,`class`])):F(l).avatar?(J(),k(sr,W({key:1,size:F(l).ui?.leadingAvatarSize||V.value.leadingAvatarSize()},F(l).avatar,{"data-slot":`leadingAvatar`,class:V.value.leadingAvatar({class:F(l).ui?.leadingAvatar})}),null,16,[`size`,`class`])):M(``,!0)])],2)):M(``,!0),F(N)||c.trailing?(J(),b(`span`,{key:3,"data-slot":`trailing`,class:G(V.value.trailing({class:F(l).ui?.trailing}))},[o(e.$slots,`trailing`,{ui:V.value},()=>[F(I)?(J(),k(ge,{key:0,name:F(I),"data-slot":`trailingIcon`,class:G(V.value.trailingIcon({class:F(l).ui?.trailingIcon}))},null,8,[`name`,`class`])):M(``,!0)])],2)):M(``,!0)]),_:3},16,[`id`,`model-value`,`default-value`,`name`,`disabled`,`class`])],64))}}),oS={base:`relative`,variants:{size:{xs:``,sm:``,md:``,lg:``,xl:``},orientation:{horizontal:`inline-flex -space-x-px`,vertical:`flex flex-col -space-y-px`}},defaultVariants:{size:`md`}},sS={__name:`FieldGroup`,props:{as:{type:null,required:!1},size:{type:null,required:!1},orientation:{type:null,required:!1,default:`horizontal`},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(e){let t=hr(`fieldGroup`,e),n=_e(),r=p(()=>nr({extend:oS,...n.ui?.fieldGroup||{}}));return w(ar,p(()=>({orientation:t.orientation,size:t.size}))),(e,n)=>(J(),k(F(rr),{as:F(t).as,"data-orientation":F(t).orientation,class:G(r.value({orientation:F(t).orientation,class:[F(t).ui?.base,F(t).class]}))},{default:i(()=>[o(e.$slots,`default`)]),_:3},8,[`as`,`data-orientation`,`class`]))}};function cS(e){let t={};for(let n of e){let e=[n.field,...n.path].filter(e=>e!==void 0).join(`.`)||``;(t[e]??=[]).push(n.message)}return t}function lS(e){return e instanceof Object&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):void 0}function uS(e){let t=e.type;return String(t)===t?[t]:Array.isArray(t)?t.filter(e=>String(e)===e):[]}function dS(e){for(let t of[`anyOf`,`oneOf`]){let n=Array.isArray(e[t])?e[t].map(lS).filter(e=>e!==void 0):[],r=n.filter(e=>!uS(e).every(e=>e===`null`));if(!n.length||r.length!==1)continue;let i={...r[0]};return e.description&&(i.description=e.description),e.title&&(i.title=e.title),i}return e}function fS(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).trim().toLowerCase();return t?`${t[0].toUpperCase()}${t.slice(1)}`:e}function pS(e){if(lS(e[`x-vitehub-blob`]))return`blob`;if(Array.isArray(e.enum)&&e.enum.length&&e.enum.every(e=>String(e)===e||Number.isFinite(e)))return`enum`;let t=uS(e).filter(e=>e!==`null`),n=t.length===1?t[0]:void 0;if(n===`string`)return e.format===`date`?`date`:e.format===`date-time`?`date-time`:Number(e.maxLength)>200?`text`:`string`;if(n===`number`)return`number`;if(n===`integer`)return`integer`;if(n===`boolean`)return`boolean`;if(n===`array`){let t=lS(e.items),n=t?uS(t):[],r=t?.format===void 0||[`email`,`uri`,`url`].includes(String(t.format));return t&&n.length===1&&n[0]===`string`&&!t.enum&&r?`string-list`:t&&pS(dS(t))!==`json`?`list`:`json`}return n===`object`&&lS(e.properties)?`object`:`json`}function mS(e,t,n,r){let i=dS(lS(t)??{}),a=pS(i),o={kind:a,label:String(i.title)===i.title&&i.title?i.title:r??fS(e),name:e,required:n,schema:i};String(i.description)===i.description&&(o.description=i.description),String(i.format)===i.format&&(o.format=i.format),a===`enum`&&Array.isArray(i.enum)&&(o.enum=i.enum.filter(e=>String(e)===e||Number.isFinite(e)));for(let e of[`minimum`,`maximum`,`maxLength`]){let t=Number(i[e]);i[e]!==void 0&&Number.isFinite(t)&&(o[e]=t)}if(a===`object`){o.fields=hS(i);let e=e=>o.fields.find(t=>t.name===e&&(t.kind===`string`||t.kind===`text`)),t=e(`src`);t&&e(`alt`)&&(o.image={alt:`alt`,src:t.name})}return a===`list`&&(o.item=mS(e,i.items,!0,`Item`)),o}function hS(e){let t=lS(e.properties)??{},n=new Set(Array.isArray(e.required)?e.required.filter(e=>String(e)===e):[]);return Object.entries(t).map(([e,t])=>mS(e,t,n.has(e)))}function gS(e){if(e.schema.default!==void 0)return JSON.parse(JSON.stringify(e.schema.default));if(e.kind===`object`)return bS(e.schema);if(e.kind===`list`||e.kind===`string-list`)return[];if(e.kind===`boolean`)return!1;if(e.kind===`enum`)return e.enum?.[0];if(e.kind===`number`||e.kind===`integer`)return e.minimum??0;if(e.kind===`string`||e.kind===`text`||e.kind===`date`||e.kind===`date-time`)return``}var _S=[`label`,`title`,`name`,`heading`,`question`,`value`];function vS(e,t){let n=lS(t);if(e.kind!==`object`||!e.fields||!n)return{title:SS(e.kind===`boolean`?void 0:e,t)};let r=e.fields.filter(e=>e.kind===`string`||e.kind===`text`||e.kind===`enum`||e.kind===`date`||e.kind===`date-time`).map(e=>({name:e.name,text:SS(e,n[e.name])})).filter(e=>e.text),i=_S.map(e=>r.find(t=>t.name===e)).find(e=>e!==void 0)??r[0],a=r.find(e=>e!==i),o={title:i?.text??SS(e,t)},s=e.fields.flatMap(e=>{let t=n[e.name];return(e.kind===`list`||e.kind===`string-list`)&&Array.isArray(t)&&t.length?[`${e.label} ${t.length}`]:[]});return a?o.detail=a.text:s[0]&&(o.detail=s[0]),o}function yS(e,t){let n=lS(t);return!n||!e.fields?[]:e.fields.flatMap(e=>{let t=n[e.name];if(e.kind===`list`||e.kind===`json`)return!Array.isArray(t)||!t.length?[]:[{label:e.label,text:t.length===1?`1 item`:`${t.length} items`}];if(e.kind===`boolean`)return t===!0?[{label:e.label,text:``}]:[];let r=SS(e,t);return r?[{label:e.label,text:r}]:[]})}function bS(e){let t={};for(let n of hS(e))n.schema.default===void 0?n.kind===`boolean`&&n.required?t[n.name]=!1:n.kind===`object`&&n.required&&(t[n.name]=bS(n.schema)):t[n.name]=JSON.parse(JSON.stringify(n.schema.default));return t}function xS(e,t){let n={...t};for(let t of e){let e=n[t.name];if(t.kind===`object`&&t.fields&&lS(e)){let r=xS(t.fields,lS(e));Object.values(r).every(e=>e===``||e==null)&&!t.required?delete n[t.name]:n[t.name]=r;continue}if(t.kind===`list`&&t.item?.kind===`object`&&t.item.fields&&Array.isArray(e)){let r=t.item;n[t.name]=e.map(e=>lS(e)?xS(r.fields,lS(e)):e)}t.required||(e===``||e==null)&&delete n[t.name]}return n}function SS(e,t,n=!1){if(t==null)return``;if(String(t)===t)return t.trim();if(Number.isFinite(t))return String(t);if(t===!0||t===!1)return t&&e?e.label:t?`Yes`:``;if(Array.isArray(t))return t.map(e=>SS(void 0,e,!0)).filter(Boolean).join(`, `);let r=lS(t);if(!r)return``;let i=r.pathname;return e?.kind===`blob`||String(i)===i&&i?String(i)===i?i.slice(i.lastIndexOf(`/`)+1):``:(e?.fields?e.fields.map(e=>SS(e,r[e.name],!0)):Object.values(r).map(e=>SS(void 0,e,!0))).filter(Boolean).join(n?`, `:` · `)}function CS(e,t){let n=t.trim();if(/received (undefined|null)\b|^required\b|\bis required\b|^invalid input$/i.test(n))return`${e} is required.`;let r=/(<=?|>=?)\s*(\d+(?:\.\d+)?)/.exec(n);if(r&&/too big|too small|invalid (length|size|value)|maximum|minimum/i.test(n)){let t=/\bstrings?\b|characters?/i.test(n)?` characters`:/\barrays?\b|items?|elements?/i.test(n)?` items`:``;return`${e} must be ${{"<":`less than`,"<=":`at most`,">":`more than`,">=":`at least`}[r[1]]} ${r[2]}${t}.`}if(/\burl\b/i.test(n))return`${e} must be a valid URL.`;if(/\bemail\b/i.test(n))return`${e} must be a valid email address.`;if(/\b(date|datetime|iso)\b/i.test(n))return`${e} must be a valid date.`;if(/invalid option|expected one of|invalid enum/i.test(n))return`${e} must be one of the listed options.`;let i=/expected (string|number|boolean|array|object|integer)/i.exec(n);return i?`${e} must be ${{array:`a list`,boolean:`on or off`,integer:`a whole number`,number:`a number`,object:`a group of fields`,string:`text`}[i[1].toLowerCase()]}.`:/[.!?]$/.test(n)?n:`${n}.`}function wS(e,t){return t.map(t=>{let n=[t.field,...t.path].filter(e=>e!==void 0&&String(e)===e),r=e,i=[];for(let e of n){let t=r?.find(t=>t.name===e);if(!t)break;i.push(t.label),r=t.fields}if(!i.length)return t;let a=i.length>1?`${i.at(-2)} ${i.at(-1).toLowerCase()}`:i[0];return{...t,message:CS(a,t.message)}})}function TS(e){return e==null||String(e)===e&&!e.trim()||Array.isArray(e)&&!e.length}function ES(e,t){if(e.kind!==`object`&&e.kind!==`blob`&&e.kind!==`json`&&e.kind!==`list`){if(TS(t))return e.required&&e.kind!==`boolean`?`${e.label} is required.`:void 0;if((e.kind===`string`||e.kind===`text`)&&String(t)===t){if(e.maxLength!==void 0&&t.length>e.maxLength)return`${e.label} must be at most ${e.maxLength} characters.`;let n=Number(e.schema.minLength);if(Number.isFinite(n)&&t.length<n)return`${e.label} must be at least ${n} characters.`;if(e.format===`uri`||e.format===`url`)try{new URL(t)}catch{return`${e.label} must be a valid URL.`}if(e.format===`email`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return`${e.label} must be a valid email address.`}if((e.kind===`number`||e.kind===`integer`)&&Number(t)===t){if(e.kind===`integer`&&!Number.isInteger(t))return`${e.label} must be a whole number.`;if(e.minimum!==void 0&&t<e.minimum)return`${e.label} must be at least ${e.minimum}.`;if(e.maximum!==void 0&&t>e.maximum)return`${e.label} must be at most ${e.maximum}.`}}}function DS(e,t){let[n,r]=e,i=Object.keys(r).length>0?xr(r):``,a=Sr(e),o=a.includes("`")?"``":"`";return`${o}${a}${o}${i}`}function OS(e,t){let[n,r,...i]=e,a=i[0]?.[1]?.class,o=r.language||a?.split(` `).find(e=>e.startsWith(`language-`))?.slice(9)||``,s=r.filename?` [`+String(r.filename).split(`]`).join(`\\\\]`)+`]`:``,c=r.highlights?` {`+kS(r.highlights)+`}`:``,l=r.meta?` `+r.meta:``,u=String(e[1]?.code||Sr(e)).trimEnd(),d=kr(u),f=d+o+s+c+l+`
|
|
93
|
+
`+u+`
|
|
94
|
+
`+d,p=xr(vr(`pre`,r));return p?`::pre${p}\n${f}\n::`+t.context.blockSeparator:f+t.context.blockSeparator}function kS(e){if(e.length===0)return``;let t=[...e].sort((e,t)=>e-t),n=[],r=t[0],i=t[0];for(let e=1;e<=t.length;e++)e<t.length&&t[e]===i+1?i=t[e]:(r===i?n.push(String(r)):n.push(r+`-`+i),e<t.length&&(r=t[e],i=t[e]));return n.join(`,`)}function AS(e,t,n){return n?.[0]===`p`?`:hr`:`---`+t.context.blockSeparator}async function jS(e,t){let[n]=e,r=Number(n.slice(1)),i=await t.flow(e,t),{id:a,...o}=e[1],s=xr(o),c=s?` ${s}`:``;return`#`.repeat(r)+` `+i+c+t.context.blockSeparator}async function MS(e,t,n){let r=e.slice(2),i=``;for(let n of r)i+=await t.one(n,t,e,i===``||i.endsWith(`
|
|
95
|
+
`));let a=xr(e[1]);return a&&(i=`${i.replace(/[ \t]+$/,``)} ${a}`),n?.[0]===`li`?i:i+t.context.blockSeparator}async function NS(e,t){let[n,r]=e,{href:i,...a}=r,o=Object.keys(a).length>0?xr(a):``,s=await t.flow(e,t);return s===i&&!o?`<${i}>`:`[${s}](${i})${o}`}async function PS(e,t){let n=e.slice(2),r=t.applyContext({list:!0,order:!1,listIndent:2}),i=``;for(let e of n)i+=await t.one(e,t);i=i.trim(),t.applyContext(r);let a=xr(vr(`ul`,e[1]));return a?r.list?`
|
|
96
|
+
`+br(`::ul${a}\n${i}\n::`,{width:r.listIndent||2}):`::ul${a}\n${i}\n::`+t.context.blockSeparator:(r.list?i=`
|
|
97
|
+
`+br(i,{width:r.listIndent||2}):i+=t.context.blockSeparator,i)}async function FS(e,t){let n=e.slice(2),r=Number(e[1].start),i=Number.isInteger(r)&&r>=1?r:1,a=t.applyContext({list:!0,order:i,listIndent:3}),o=``;for(let e of n)o+=await t.one(e,t);o=o.trim(),t.applyContext(a);let s=xr(vr(`ol`,e[1]));return s?a.list?`
|
|
98
|
+
`+br(`::ol${s}\n${o}\n::`,{width:a.listIndent||2}):`::ol${s}\n${o}\n::`+t.context.blockSeparator:(a.list?o=`
|
|
99
|
+
`+br(o,{width:a.listIndent||2}):o+=t.context.blockSeparator,o)}var IS=new Set([`pre`,`blockquote`,`table`]);async function LS(e,t){let n=e.slice(2),r=t.context.order,i=r?`${r}. `:`- `;if((e[1].className&&Array.isArray(e[1].className)?e[1].className.join(` `):String(e[1].className||e[1].class)).includes(`task-list-item`)){let e=n.shift();i+=e[1].checked||e[1][`:checked`]?`[x] `:`[ ] `}let a=i.length,o=n.some(e=>typeof e==`string`),s=``;for(let r of n){if(Array.isArray(r)){let n=r[0];if(s&&IS.has(n)){let n=br(await t.one(r,t,e),{width:a});s=s.trimEnd()+`
|
|
100
|
+
`+n.trimEnd()+`
|
|
101
|
+
`;continue}if(s&&n===`p`){let n=br(await t.one(r,t,e),{width:a});s=s.trimEnd()+`
|
|
102
|
+
|
|
103
|
+
`+n.trimEnd()+`
|
|
104
|
+
`;continue}if(!o&&!(n in t.handlers)){let e=br(await t.one(r,t),{width:a,ignoreFirstLine:!s});s=s?s.trimEnd()+`
|
|
105
|
+
`+e.trimEnd()+`
|
|
106
|
+
`:e.trimEnd()+`
|
|
107
|
+
`;continue}}s+=await t.one(r,t,e,s===``||s.endsWith(`
|
|
108
|
+
`))}s=s.trim();let c=xr(vr(`li`,e[1])),l=c?` ${c}`:``;return r&&t.applyContext({order:r+1}),`${i}${s}${l}\n`}var RS=new Set([`p`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`td`,`th`]),zS=new Set([`br`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),BS=new Set([`strong`,`em`,`del`,`code`,`a`,`br`,`span`,`img`]),VS=new Set([`p`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`ul`,`ol`,`blockquote`,`hr`,`table`,`td`,`th`]);async function HS(e,t,n){let[r,i,...a]=e,{$:o={},...s}=i,c=Object.keys(s).length>0,l=t.context.html&&c?t.renderData.props:s,u=a.every(e=>typeof e==`string`||BS.has(String(e?.[0]))),d=a.some(e=>typeof e==`string`),f=RS.has(String(r)),p=BS.has(String(r))&&o.block===0,m=f&&u;!m&&BS.has(String(r))&&u&&(m=!0),r===`pre`&&(m=!0),(n?.[0]===`p`||t.context.inline)&&(m=!0),o.block===0&&(m=!0);let h=zS.has(String(r)),g=t.applyContext({inline:m}),_=[];for(let n of a)_.push(await t.one(n,t,e));let v=t.context.html?t.context.blockSeparator:m?``:`
|
|
109
|
+
`,y=``,b=!0;for(let e=0;e<a.length;e++){let t=_[e],n=a[e],r=typeof n!=`string`&&(VS.has(String(n?.[0]))||!BS.has(String(n?.[0]))&&!d);e>0&&!b&&r&&(y+=v),y+=t,b=r,r&&e<a.length-1&&(y+=v)}g&&t.applyContext(g);let x=Object.keys(l).length>0?` ${Or(l)}`:``;return h?`<${r}${x}>`+(!n&&!p?t.context.blockSeparator:``):(!m&&y&&(y=`
|
|
110
|
+
`+WS(y,t,String(r)).trimEnd()+`
|
|
111
|
+
`),`<${r}${x}>${y}</${r}>`+(!n&&!p?t.context.blockSeparator:``))}var US=new Set([`code`,`kbd`,`pre`,`samp`,`script`,`style`,`textarea`,`var`]);function WS(e,t,n){return t.context.html?US.has(n.toLowerCase())?e:br(e):(e.trim().startsWith(`<`),``+e+(e.trim().endsWith(`>`),``))}async function GS(e,t){let[n,r,...i]=e,a=``;for(let n of i)a+=await t.one(n,t,e);a=a.trim();let o=Object.keys(r).length>0?xr(r):``;return`**${a}**${o}`}async function KS(e,t){let[n,r,...i]=e,a=``;for(let n of i)a+=await t.one(n,t,e);a=a.trim();let o=Object.keys(r).length>0?xr(r):``;return`*${a}*${o}`}async function qS(e,t){let n=e.slice(2),r=``;for(let i of n)r+=await t.one(i,t,e,r===``||r.endsWith(`
|
|
112
|
+
`));let i=vr(`blockquote`,e[1]),a=xr(i),o=n.some(e=>Array.isArray(e));if(a&&o)return`::blockquote${a}\n${r.trim().split(`
|
|
113
|
+
`).map(e=>e?`> ${e}`:`>`).join(`
|
|
114
|
+
`)}\n::`+t.context.blockSeparator;a&&(r=`${r.replace(/[ \t]+$/,``)} ${a}`);let s=r.trim().split(`
|
|
115
|
+
`).map(e=>e?`> ${e}`:`>`).join(`
|
|
116
|
+
`);return e[1].as?`> [!${String(e[1].as).toUpperCase()}]\n`+s+t.context.blockSeparator:s+t.context.blockSeparator}function JS(e,t){let[n,r]=e,{title:i,src:a,alt:o=``,...s}=r,c=Object.keys(s).length>0?xr(s):``;return`${i?``:``}${c}`}async function YS(e,t){let[n,r,...i]=e,a=``;for(let n of i)a+=await t.one(n,t,e);a=a.trim();let o=Object.keys(r).length>0?xr(r):``;return`~~${a}~~${o}`}var XS=new Set([`a`,`strong`,`em`,`span`]);async function ZS(e,t,n){let[r,i,...a]=e,{$:o,...s}=i;if(r===`table`)return HS(e,t);let c=Object.entries(s),l=c.some(([,e])=>typeof e==`object`),u=n?.some((e,t)=>t>1&&typeof e==`string`)??!1,d=n!==void 0&&XS.has(String(n[0])),f=u||d||t.context.inline===!0;l&&(f=!1);let p=f?t.applyContext({inline:!0}):void 0,m=``,h={...t,nodeDepthInTree:(t.nodeDepthInTree||0)+1};for(let n of a)m+=await t.one(n,h,e);m=m.trimEnd(),p&&t.applyContext(p);let g=c.length>0?xr(s):``;if(r===`span`)return!g&&n?.[0]==`a`&&(g||=`{}`),`[${m}]${g}`+(f?``:t.context.blockSeparator);let _=`:`.repeat((t.nodeDepthInTree||0)+2),v=`:${r}${m&&`[${m}]`}${g}`+(n?``:t.context.blockSeparator);if(!f){let e=t.context.maxInlineAttributes??3;v=l||e===0||c.length>e?`${_}${r}\n${_r(s,t.context.blockAttributesStyle)}${m?`\n${m}`:``}\n${_}`+t.context.blockSeparator:`${_}${r}${g}${m?`\n${m}`:``}\n${_}`+t.context.blockSeparator}return f?v:br(v,{level:+!!n})}function QS(e,t){return`
|
|
117
|
+
`}async function $S(e,t,n){let[r,i]=e,a=(await t.flow(e,t)).trimEnd();if(i.name==="default"&&(n?n.slice(2):[]).filter(e=>Array.isArray(e)&&e[0]===`template`).length===1)return a+t.context.blockSeparator;let{name:o,$:s,...c}=i,l=xr(c);return`#${i.name}${l}\n${a}`+t.context.blockSeparator}function eC(e){let t=e.style;if(typeof t!=`string`)return null;let n=t.toLowerCase().split(` `).join(``).split(` `).join(``);return n.includes(`text-align:left`)?`left`:n.includes(`text-align:center`)?`center`:n.includes(`text-align:right`)?`right`:null}async function tC(e,t){if(typeof e==`string`)return nC(e);let[,,...n]=e,r=``;for(let i of n)r+=typeof i==`string`?i:await t.one(i,t,e);return nC(r.trim())}function nC(e){return e.split(`
|
|
118
|
+
`).join(` `).split(`|`).join(`\\|`)}function rC(e){if(typeof e==`string`)return[];let[t,,...n]=e;return t===`tr`?[e]:t===`thead`||t===`tbody`?n.filter(e=>typeof e!=`string`&&e[0]===`tr`):[]}function iC(e){let[,,...t]=e;return t.filter(e=>typeof e!=`string`&&(e[0]===`th`||e[0]===`td`))}async function aC(e,t){let[,,...n]=e,r=[],i=[];for(let e of n){if(typeof e==`string`)continue;let[t]=e;if(t===`thead`)r=rC(e);else if(t===`tbody`)i=rC(e);else if(t===`tr`){let t=iC(e);t.length>0&&t[0][0]===`th`?r.push(e):i.push(e)}}if(r.length===0&&i.length>0){let e=i[0];r=[[`tr`,{},...iC(e).map((e,t)=>[`th`,{},`Column ${t+1}`])]]}if(r.length===0)return``;let a=r[0],o=iC(a),s=[];for(let e of o)s.push(await tC(e,t));let c=o.map(e=>{let[,t]=e;return eC(t)}),l=s.map(e=>Math.max(3,e.length));for(let e of i){let n=iC(e);for(let e=0;e<n.length;e++)if(e<l.length){let r=await tC(n[e],t);l[e]=Math.max(l[e],r.length)}}let u=`| `;u+=s.map((e,t)=>e.padEnd(l[t])).join(` | `),u+=` |
|
|
119
|
+
`,u+=`| `,u+=l.map((e,t)=>{let n=c[t];return n===`left`?`:`+`-`.repeat(e-1):n===`center`?`:`+`-`.repeat(e-2)+`:`:n===`right`?`-`.repeat(e-1)+`:`:`-`.repeat(e)}).join(` | `),u+=` |
|
|
120
|
+
`;for(let e of i){let n=iC(e),r=[];for(let e=0;e<n.length;e++){let i=await tC(n[e],t);r.push(i.padEnd(l[e]||0))}for(;r.length<l.length;)r.push(``.padEnd(l[r.length]));u+=`| `+r.join(` | `)+` |
|
|
121
|
+
`}let d=xr(vr(`table`,e[1]));return d?`::table${d}\n${u.trimEnd()}\n::\n\n`:u+`
|
|
122
|
+
`}function oC(e,t){return``}function sC(e,t){return``}function cC(e,t){return``}function lC(e,t){return``}function uC(e,t){return``}function dC(e,t){return e[0]===null?`<!--${e[2]}-->`+t.context.blockSeparator:``}function fC(e,t,n){let r=Sr(e),i=e[1].class,a=typeof i==`string`?i.split(` `):[],o=a.includes(`inline`),s=a.includes(`block`),c=n?.some((e,t)=>t>1&&typeof e==`string`)??!1;return o||!s&&c?`$${r}$`:`$$\n${r}\n$$${t.context.blockSeparator}`}function pC(e,t){let[n,r]=e,{content:i,...a}=r,o=xr(a),s=String(i??``).replace(/\n$/,``),c=kr(s);return`${c}mermaid${o?` ${o}`:``}\n${s}\n${c}${t.context.blockSeparator}`}var mC={code:DS,pre:OS,hr:AS,br:QS,h1:jS,h2:jS,h3:jS,h4:jS,h5:jS,h6:jS,p:MS,a:NS,ul:PS,ol:FS,li:LS,html:HS,strong:GS,em:KS,blockquote:qS,img:JS,del:YS,mdc:ZS,template:$S,table:aC,thead:oC,tbody:sC,tr:cC,th:lC,td:uC,comment:dC,math:fC,mermaid:pC};function hC(e,t){let n=t[0],r=(Object.hasOwn(e.handlers,n)?e.handlers[n]:void 0)||(Object.hasOwn(e.handlers,wr(n))?e.handlers[wr(n)]:void 0);if(typeof r==`function`)return r;for(let n of e.conditionalHandlers)if(n?.match(t))return n.handler;return r}async function gC(e,t,n,r=!1){if(typeof e==`string`)return t.context.html?yr(e,{"&":void 0,'"':void 0}):n?.[1].$?.html===1&&n[1].$?.block===1?e:xC(e,r);if(e[0]===null)return await t.handlers.comment(e,t);let i=t.renderData;if(t.renderData&&e[1]){let n=Ar(e[1],i);Object.keys(n).length>0&&(t.renderData={...i,props:n})}try{let r=hC(t.context,e);if(r)return await r(e,t,n);if(t.context.html||e[1].$?.html===1)return await t.handlers.html(e,t,n);let i=e[0],a=Object.hasOwn(t.handlers,i)?t.handlers[i]:void 0;return a?await a(e,t,n):t.context.format===`markdown/comark`?await t.handlers.mdc(e,t,n):await t.handlers.html(e,t,n)}finally{t.renderData=i}}async function _C(e,t,n){let r=e.slice(2),i=``;for(let a of r)i+=await gC(a,t,n||e);return i}function vC(e={}){let t=[],n={};for(let[r,i]of Object.entries(e.handlers||{}))typeof i==`function`?n[r]=i:t.push(i);let r={...e,blockSeparator:e.blockSeparator||`
|
|
123
|
+
|
|
124
|
+
`,format:e.format||`markdown/comark`,handlers:n,conditionalHandlers:t,blockAttributesStyle:e.blockAttributesStyle||`codeblock`,html:e.format===`text/html`},i=e.tree,a={frontmatter:i?.frontmatter||{},meta:i?.meta||{},data:e.data||{},props:{}},o={handlers:mC,context:r,one:gC,flow:_C,data:e.data||{},renderData:a,render:async e=>{if(Array.isArray(e)&&typeof e[0]==`string`&&e.length>1)return o.one(e,o);let t=``;for(let n of e)t+=await o.one(n,o,void 0,t===``||t.endsWith(`
|
|
125
|
+
`));return t},applyContext:e=>{let t={};for(let[n,i]of Object.entries(e))t[n]=r[n],r[n]=i;return t}};return o}var yC=/[\\`*_<&~[\]{:]/g,bC=new Set([` `,` `,`
|
|
126
|
+
`,`*`,`_`,`[`]);function xC(e,t=!1){let n=wC(e);return!t&&!n.includes(`
|
|
127
|
+
`)?n:n.split(`
|
|
128
|
+
`).map((e,n)=>n>0||t?TC(e):e).join(`
|
|
129
|
+
`)}function SC(e){return e!==void 0&&/[a-zA-Z0-9]/.test(e)}function CC(e,t){let n=new Int32Array(e.length+1),r=-1;n[e.length]=-1;for(let i=e.length-1;i>=0;i--)e.charCodeAt(i)===t&&(r=i),n[i]=r;return n}function wC(e){let t;return e.replace(yC,(e,n,r)=>{if(e===`_`&&SC(r[n-1])&&SC(r[n+1]))return e;if(e===`<`){let i=r.charCodeAt(n+1);return!(i>=65&&i<=90||i>=97&&i<=122||i===33||i===63||i===47)||(t??=CC(r,62),t[n+1]===-1)?e:`\\${e}`}if(e===`&`&&!/^&#?[a-zA-Z0-9]+;/.test(r.slice(n)))return e;if(e===`:`){let t=r[n-1],i=t===void 0||bC.has(t),a=r[n+1];return i&&a!==void 0&&/[a-zA-Z$]/.test(a)?`\\${e}`:e}if(e===`{`){let t=r[n-1];return t===`{`||t===`$`?e:/^\{[ \t]{0,3}[.#:a-zA-Z_]/.test(r.slice(n,n+6))?`\\${e}`:e}return`\\${e}`})}function TC(e){if(/^#{1,6}([ \t]|$)/.test(e)||e[0]===`>`)return`\\${e}`;let t=/^(\d{1,9})[.)]([ \t]|$)/.exec(e);return t?`${t[1]}\\${e.slice(t[1].length)}`:/^-([ \t-]|$)/.test(e)||/^\+([ \t]|$)/.test(e)||/^=+[ \t]*$/.test(e)||e[0]===`:`?`\\${e}`:e}async function EC(e,t={}){let n=vC({...t,tree:e,handlers:t.components}),r=``;for(let t of e.nodes)r+=await gC(t,n);return r.trim()+`
|
|
130
|
+
`}async function DC(e,t){let n=await EC(e,{format:`markdown/comark`,...t});return Er(e.frontmatter||{},n,t?.frontmatterOptions)}function OC(e){return!!e&&typeof e==`object`&&`nodes`in e&&Array.isArray(e.nodes)}var kC=`comarkModelApply`;function AC(e,t,n,r={}){let i={emitUpdate:r.emitUpdate??!0,errorOnInvalidContent:r.errorOnInvalidContent,transactionMeta:r.transactionMeta};switch(n){case`ast`:e.commands.setComarkAst(t,i);return;case`markdown`:typeof t==`string`?e.commands.setComarkMarkdown(t,i):e.commands.setContent(t,i);return;case`html`:e.commands.setContent(t,{...i,contentType:`html`});return;case`json`:e.commands.setContent(t,{...i,contentType:`json`});return}}function jC(e,t){switch(t){case`ast`:return e.storage.comark.getAst();case`html`:return e.getHTML();case`json`:return e.getJSON();case`markdown`:return null}}function MC(){let e=!1,t=0;return{bump:()=>{t++},schedule:t=>{e||(e=!0,queueMicrotask(()=>{e=!1,t()}))},capture:()=>t,isCurrent:e=>e===t}}function NC(e){try{return JSON.stringify(e)}catch{return``}}var PC,FC;if(typeof WeakMap<`u`){let e=new WeakMap;PC=t=>e.get(t),FC=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;PC=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},FC=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var IC=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return PC(e)||FC(e,LC(e))}};function LC(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=RC(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new IC(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&zC(s,o,e),s}function RC(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function zC(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=BC(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function BC(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function VC(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var HC=new Pl(`selectingCells`);function UC(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function WC(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function GC(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function KC(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=UC(t.$head)||qC(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function qC(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function JC(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function YC(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function XC(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function ZC(e,t,n){let r=e.node(-1),i=IC.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function QC(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function $C(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function ew(e,t,n){let r=VC(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var tw=class e extends ul{constructor(e,t=e){let n=e.node(-1),r=IC.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new dl(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(JC(r)&&JC(i)&&XC(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Z.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=IC.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=QC(e,0,l)),u>0&&(e=QC(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(Y.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new X(Y.from(o),1,1)}replace(e,t=X.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?X.empty:t)}let i=ul.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new X(Y.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=IC.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=IC.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=IC.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=IC.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new nw(this.$anchorCell.pos,this.$headCell.pos)}};tw.prototype.visible=!1,ul.jsonID(`cell`,tw);var nw=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&XC(t,n)?new tw(t,n):ul.near(n,1)}};function rw(e){if(!(e.selection instanceof tw))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(sm.node(n,n+e.nodeSize,{class:`selectedCell`}))}),um.create(e.doc,t)}function iw({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function aw({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function ow(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof hl&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=tw.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=tw.rowSelection(e,e)}else if(!n){let e=IC.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=tw.create(i,t+1,n)}}else r instanceof Z&&iw(r)?a=Z.create(i,r.from):r instanceof Z&&aw(r)&&(a=Z.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var sw=new Pl(`fix-tables`);function cw(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?cw(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function lw(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=uw(e,t,r,n))};return t?t.doc!=e.doc&&cw(t.doc,e.doc,0,r):e.doc.descendants(r),n}function uw(e,t,n,r){let i=IC.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,QC(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=VC(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(sw,{fixTables:!0})}function dw(e){let t=e.selection,n=KC(e),r=n.node(-1),i=n.start(-1),a=IC.get(r);return{...t instanceof tw?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function fw(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;ew(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,$C(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?VC(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function pw(e,t){if(!GC(e))return!1;if(t){let n=dw(e);t(fw(e.tr,n,n.left))}return!0}function mw(e,t){if(!GC(e))return!1;if(t){let n=dw(e);t(fw(e.tr,n,n.right))}return!0}function hw(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,QC(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function gw(e,t){if(!GC(e))return!1;if(t){let n=dw(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;hw(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=IC.get(e)}t(r)}return!0}function _w(e,t,n){let r=VC(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function vw(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;_w(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?VC(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,VC(r.type.schema).row.create(null,o)),e}function yw(e,t){if(!GC(e))return!1;if(t){let n=dw(e);t(vw(e.tr,n,n.top))}return!0}function bw(e,t){if(!GC(e))return!1;if(t){let n=dw(e);t(vw(e.tr,n,n.bottom))}return!0}function xw(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Sw(e,t){if(!GC(e))return!1;if(t){let n=dw(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;xw(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=IC.get(n.table)}t(r)}return!0}function Cw(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function ww({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function Tw(e,t){let n=e.selection;if(!(n instanceof tw)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=dw(e),{map:i}=r;if(ww(i,r))return!1;if(t){let n=e.tr,a={},o=Y.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{Cw(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...$C(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Cw(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new tw(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Ew(e,t){let n=VC(e.schema);return Dw(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Dw(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof tw){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=WC(r.$from),!i)return!1;a=UC(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=dw(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof tw&&u.setSelection(new tw(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Ow(e,t){return function(n,r){if(!GC(n))return!1;let i=KC(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof tw?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function kw(e){return function(t,n){if(!GC(t))return!1;if(n){let r=VC(t.schema),i=dw(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Aw(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function jw(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?kw(e):function(t,n){if(!GC(t))return!1;if(n){let r=VC(t.schema),i=dw(t),a=t.tr,o=Aw(`row`,i,r),s=Aw(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}jw(`row`,{useDeprecatedLogic:!0}),jw(`column`,{useDeprecatedLogic:!0});var Mw=jw(`cell`,{useDeprecatedLogic:!0});function Nw(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Pw(e){return function(t,n){if(!GC(t))return!1;let r=Nw(KC(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Z.between(e,YC(e))).scrollIntoView())}return!0}}function Fw(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Iw(e,t){let n=e.selection;if(!(n instanceof tw))return!1;if(t){let r=e.tr,i=VC(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new X(i,0,0))}),r.docChanged&&t(r)}return!0}function Lw(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=zw(VC(o).row,new X(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?zw(VC(o).row,new X(t,n,r)).content:t);else return null;return Rw(o,s)}function Rw(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(Y.empty),n[i]<r){let a=VC(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(Y.from(o))}return{height:t.length,width:r,rows:t}}function zw(e,t){let n=e.createAndFill();return new cl(n).replace(0,n.content.size,t).doc}function Bw({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(QC(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(Y.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(Y.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Vw(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=VC(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,Y.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Hw(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function Uw(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,QC(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(QC(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Ww(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=IC.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=IC.get(a),f=d.mapping.maps.length}Vw(d,o,a,n,l,u,f)&&p(),Hw(d,o,a,n,c,l,s,f)&&p(),Hw(d,o,a,n,c,l,u,f)&&p(),Uw(d,o,a,n,s,u,c,f)&&p(),Uw(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new X(i.rows[e-s],0,0))}p(),d.setSelection(new tw(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Gw=dh({ArrowLeft:qw(`horiz`,-1),ArrowRight:qw(`horiz`,1),ArrowUp:qw(`vert`,-1),ArrowDown:qw(`vert`,1),"Shift-ArrowLeft":Jw(`horiz`,-1),"Shift-ArrowRight":Jw(`horiz`,1),"Shift-ArrowUp":Jw(`vert`,-1),"Shift-ArrowDown":Jw(`vert`,1),Backspace:Iw,"Mod-Backspace":Iw,Delete:Iw,"Mod-Delete":Iw});function Kw(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function qw(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof tw)return Kw(n,r,ul.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Qw(i,e,t);if(o==null)return!1;if(e==`horiz`)return Kw(n,r,ul.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=ZC(i,e,t),s;return s=a?ul.near(a,1):t<0?ul.near(n.doc.resolve(i.before(-1)),-1):ul.near(n.doc.resolve(i.after(-1)),1),Kw(n,r,s)}}}function Jw(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof tw)o=a;else{let r=Qw(i,e,t);if(r==null)return!1;o=new tw(n.doc.resolve(r))}let s=ZC(o.$headCell,e,t);return s?Kw(n,r,new tw(o.$anchorCell,s)):!1}}function Yw(e,t){let n=e.state.doc,r=UC(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new tw(r))),!0):!1}function Xw(e,t,n){if(!GC(e.state))return!1;let r=Lw(n),i=e.state.selection;if(i instanceof tw){r||={width:1,height:1,rows:[Y.from(zw(VC(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=IC.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Bw(r,o.right-o.left,o.bottom-o.top),Ww(e.state,e.dispatch,a,o,r),!0}if(r){let t=KC(e.state),n=t.start(-1);return Ww(e.state,e.dispatch,n,IC.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function Zw(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=$w(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof tw)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=UC(e.state.selection.$anchor))!=null&&eT(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=eT(e,n),i=HC.getState(e.state)==null;if(!r||!XC(t,r)){if(i)r=t;else return}let a=new tw(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(HC,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),HC.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(HC,-1))}function o(r){let o=r,s=HC.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if($w(e,o.target)!=n&&(c=eT(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Qw(e,t,n){if(!(e.state.selection instanceof Z))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function $w(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function eT(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&UC(e.state.doc.resolve(r))||UC(e.state.doc.resolve(i))}var tT=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),nT(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,nT(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function nT(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var rT=new Pl(`tableColumnResizing`);function iT({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=tT,lastColumnResizable:i=!0}={}){let a=new jl({key:rT,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=VC(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new aT(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=rT.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{oT(t,n,e,i)},mouseleave:e=>{sT(e)},mousedown:(e,r)=>{cT(e,r,t,n)}},decorations:e=>{let t=rT.getState(e);if(t&&t.activeHandle>-1)return _T(e,t.activeHandle)},nodeViews:{}}});return a}var aT=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(rT);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return JC(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function oT(e,t,n,r){if(!e.editable)return;let i=rT.getState(e.state);if(i&&!i.dragging){let a=uT(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=dT(e,t,`left`,n):i-t.clientX<=n&&(o=dT(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=IC.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}pT(e,o)}}}function sT(e){if(!e.editable)return;let t=rT.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&pT(e,-1)}function cT(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=rT.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=lT(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(rT,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=rT.getState(e.state);r?.dragging&&(mT(e,r.activeHandle,fT(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(rT,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=rT.getState(e.state);if(i&&i.dragging){let a=fT(i.dragging,t,n);hT(e,i.activeHandle,a,r)}}return hT(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function lT(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function uT(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function dT(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=UC(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=IC.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function fT(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function pT(e,t){e.dispatch(e.state.tr.setMeta(rT,{setHandle:t}))}function mT(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=IC.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():gT(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function hT(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=IC.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&nT(a,c.firstChild,c,r,s,n)}function gT(e){return Array(e).fill(0)}function _T(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return um.empty;let a=IC.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,rT.getState(e)?.dragging&&n.push(sm.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(sm.widget(s,c))}}return um.create(e.doc,n)}function vT({allowTableNodeSelection:e=!1}={}){return new jl({key:HC,state:{init(){return null},apply(e,t){let n=e.getMeta(HC);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:rw,handleDOMEvents:{mousedown:Zw},createSelectionBetween(e){return HC.getState(e.state)==null?null:e.state.selection},handleTripleClick:Yw,handleKeyDown:Gw,handlePaste:Xw},appendTransaction(t,n,r){return ow(r,lw(r,n),e)}})}function yT(e){return e===`left`||e===`right`||e===`center`?e:null}function bT(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return yT(t||n)}function xT(e){return yT(e?.align)}function ST(){return{default:null,parseHTML:e=>bT(e),renderHTML:e=>{let t=yT(e.align);return hy(t)?{style:`text-align: ${t}`}:{}}}}function CT(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function wT(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):CT(e)}var TT=/[ \t\r\n\f]+/g;function ET(e){return e.children.length>0?!1:(e.textContent??``).replace(TT,``)===``}function DT(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}function OT(e,t,n){if(!(n in t))return;let r=t[n];(r===1||r===`1`||r==null)&&delete e[n]}var kT=lb.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:wT},align:ST()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>ET(e)?{}:!1,getContent:(e,t)=>DT(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){let t=__(this.options.HTMLAttributes,e);return OT(t,e,`colspan`),OT(t,e,`rowspan`),[`td`,t,0]}}),AT=lb.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:wT},align:ST()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>ET(e)?{}:!1,getContent:(e,t)=>DT(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){let t=__(this.options.HTMLAttributes,e);return OT(t,e,`colspan`),OT(t,e,`rowspan`),[`th`,t,0]}}),jT=lb.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,__(this.options.HTMLAttributes,e),0]}});function MT(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function NT(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=MT(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=MT(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var PT=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),NT(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type&&(this.node=e,NT(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||e.type!==`attributes`&&e.type!==`childList`&&e.type!==`characterData`)}};function FT(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=MT(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function IT(e,t){return t?e.createChecked(null,t):e.createAndFill()}function LT(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function RT(e,t,n,r,i){let a=LT(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=IT(a.cell,i);if(e&&s.push(e),r){let e=IT(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function zT(e){return e instanceof tw}var BT=({editor:e})=>{let{selection:t}=e.state;if(!zT(t))return!1;let n=0;return o_(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function VT(e,t){let n=e.mapping.map(t);if(o_(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(Z.near(e.doc.resolve(i),-1))}function HT(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function UT(e){return e.split(`
|
|
131
|
+
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:HT(e)).join(`
|
|
132
|
+
`)}function WT(e){return(e||``).replaceAll(``,` `).replace(/\s+/g,` `).trim()}function GT(e,t){return t?e.split(t).join(`
|
|
133
|
+
`):e}function KT(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function qT(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content&&e.content.forEach(e=>{let r=``;r=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>GT(t.renderChildren(e),n.cellLineSeparator)).join(`
|
|
134
|
+
`):GT(e.content?t.renderChildren(e.content):``,n.cellLineSeparator);let a=KT(WT(r.replace(/[ \t]*\r?\n[ \t]*/g,`<br>`))),o=e.type===`tableHeader`,s=xT(e.attrs);i.push({text:a,isHeader:o,align:s})}),r.push(i)});let i=r.reduce((e,t)=>Math.max(e,t.length),0);if(i===0)return``;let a=Array.from({length:i}).fill(0);r.forEach(e=>{for(let t=0;t<i;t+=1){let n=(e[t]?.text||``).length;n>a[t]&&(a[t]=n),a[t]<3&&(a[t]=3)}});let o=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),s=r[0],c=s.some(e=>e.isHeader),l=Array.from({length:i}).fill(null);r.forEach(e=>{for(let t=0;t<i;t+=1)!l[t]&&e[t]?.align&&(l[t]=e[t].align)});let u=`
|
|
135
|
+
`,d=Array.from({length:i}).map((e,t)=>c&&s[t]&&s[t].text||``);return u+=`| ${d.map((e,t)=>o(e,a[t])).join(` | `)} |\n`,u+=`| ${a.map((e,t)=>{let n=Math.max(3,e),r=l[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(c?r.slice(1):r).forEach(e=>{u+=`| ${Array.from({length:i}).fill(0).map((t,n)=>o(e[n]&&e[n].text||``,a[n])).join(` | `)} |\n`}),u}var JT=new Pl(`preserveCellSelectionOnContextMenu`);function YT(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(n)return n.pos;if(!(t.target instanceof Node))return null;try{return e.posAtDOM(t.target,0)}catch{return null}}function XT(e,t){let n=!1;return e.forEachCell((e,r)=>{t>=r&&t<r+e.nodeSize&&(n=!0)}),n}function ZT(){return new jl({key:JT,props:{handleDOMEvents:{mousedown(e,t){if(t.button!==2)return!1;let{selection:n}=e.state;if(!zT(n)||n.ranges.length<2)return!1;let r=YT(e,t);return r==null||!XT(n,r)?!1:(t.preventDefault(),!0)}}}})}var QT=lb.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:PT,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=FT(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,__(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=yT(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=yT(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>qT(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
|
|
136
|
+
`);if(t.length<2)return-1;let n=t[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes(`|`)?-1:t[0].includes(`|`)?0:-1},tokenize(e,t,n){let r=e.indexOf(`
|
|
137
|
+
|
|
138
|
+
`),i=r>=0?e.slice(0,r):e,a=i.split(`
|
|
139
|
+
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=UT(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
|
|
140
|
+
`).length,u=e.split(`
|
|
141
|
+
`).slice(0,l).join(`
|
|
142
|
+
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=RT(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Z.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>pw(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>mw(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=o_(e.selection.$from,e=>e.type.name===`table`);return gw(e,t&&(e=>{n&&VT(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>yw(e,t),addRowAfter:()=>({state:e,dispatch:t})=>bw(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=o_(e.selection.$from,e=>e.type.name===`table`);return Sw(e,t&&(e=>{n&&VT(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>Fw(e,t),mergeCells:()=>({state:e,dispatch:t})=>Tw(e,t),splitCell:()=>({state:e,dispatch:t})=>Ew(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>jw(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>jw(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>Mw(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>Tw(e,t)?!0:Ew(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Ow(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>Pw(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>Pw(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&lw(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=tw.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:BT,"Mod-Backspace":BT,Delete:BT,"Mod-Delete":BT}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[iT({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],vT({allowTableNodeSelection:this.options.allowTableNodeSelection}),ZT()]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=__(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:d_(Q(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),$T=By.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(QT.configure(this.options.table)),this.options.tableCell!==!1&&e.push(kT.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(AT.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(jT.configure(this.options.tableRow)),e}}),eE=new WeakSet,tE=new WeakSet;function nE(e){let t=e;return eE.add(t),t}function rE(e){return Array.isArray(e)&&eE.has(e)}function iE(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&tE.has(e)&&!rE(e)?iE(e):[e])}function aE(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!rE(n)&&!tE.has(n)?nE(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(rE(n))return nE([e,r,n]);if(n.length===0)return nE([e,r]);let t=iE(n);return t.length===0?nE([e,r]):nE([e,r,...t])}return nE(n==null?[e,r]:[e,r,n])}var oE=(e,t)=>aE(e,t),sE=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new X(n,0,0);return e.replace(l,i.after(),r),e.setSelection(Z.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},cE=/^\s*>\s$/,lE=lb.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return oE(`blockquote`,{...__(this.options.HTMLAttributes,e),children:oE(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
143
|
+
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
144
|
+
`))}),n.join(`
|
|
145
|
+
>
|
|
146
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>sE(this.editor,this.type)}},addInputRules(){return[ob({find:cE,type:this.type})]}}),uE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,pE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mE=My.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return oE(`strong`,{...__(this.options.HTMLAttributes,e),children:oE(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[rb({find:uE,type:this.type}),rb({find:fE,type:this.type})]},addPasteRules(){return[db({find:dE,type:this.type}),db({find:pE,type:this.type})]}}),hE=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},gE=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function _E(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var vE=My.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,__(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(_E(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rb({find:hE,type:this.type})]},addPasteRules(){return[db({find:gE,type:this.type})]}}),yE=4,bE=/^```([a-z]+)?[\s\n]$/,xE=/^~~~([a-z]+)?[\s\n]$/,SE=lb.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:yE,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,__(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
147
|
+
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??yE,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
148
|
+
`,`
|
|
149
|
+
`).split(`
|
|
150
|
+
`).map(e=>o+e).join(`
|
|
151
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??yE,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
152
|
+
`,`
|
|
153
|
+
`).split(`
|
|
154
|
+
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(Z.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
155
|
+
`,`
|
|
156
|
+
`).split(`
|
|
157
|
+
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
158
|
+
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
159
|
+
|
|
160
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(ul.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[ab({find:bE,type:this.type,getAttributes:e=>({language:e[1]})}),ab({find:xE,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new jl({key:new Pl(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
161
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(Z.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),CE=lb.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
162
|
+
|
|
163
|
+
`):``}),wE=CE,TE=lb.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,__(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
164
|
+
`},renderMarkdown:()=>`
|
|
165
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),EE=lb.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,__(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>ab({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),DE=lb.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,__(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!ry(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return X_(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Z.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(hl.create(t.doc,n.pos)):t.setSelection(Z.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(Z.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ib({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),OE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,kE=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,AE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,jE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ME=My.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,__(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[rb({find:OE,type:this.type}),rb({find:AE,type:this.type})]},addPasteRules(){return[db({find:kE,type:this.type}),db({find:jE,type:this.type})]}}),NE=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,PE=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,FE=`numeric`,IE=`ascii`,LE=`alpha`,RE=`asciinumeric`,zE=`alphanumeric`,BE=`domain`,VE=`emoji`,HE=`scheme`,UE=`slashscheme`,WE=`whitespace`;function GE(e,t){return e in t||(t[e]=[]),t[e]}function KE(e,t,n){t[FE]&&(t[RE]=!0,t[zE]=!0),t[IE]&&(t[RE]=!0,t[LE]=!0),t[RE]&&(t[zE]=!0),t[LE]&&(t[zE]=!0),t[zE]&&(t[BE]=!0),t[VE]&&(t[BE]=!0);for(let r in t){let t=GE(r,n);t.indexOf(e)<0&&t.push(e)}}function qE(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function JE(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}JE.groups={},JE.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=JE.groups;let i;return t&&t.j?i=t:(i=new JE(t),n&&r&&KE(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=JE.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new JE,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new JE,a&&(r&&(o.t&&typeof o.t==`string`?KE(a,Object.assign(qE(o.t,r),n),r):n&&KE(a,n,r)),o.t=a),i.j[e]=o,o}};var YE=(e,t,n,r,i)=>e.ta(t,n,r,i),XE=(e,t,n,r,i)=>e.tr(t,n,r,i),ZE=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),QE=`WORD`,$E=`UWORD`,eD=`ASCIINUMERICAL`,tD=`ALPHANUMERICAL`,nD=`LOCALHOST`,rD=`TLD`,iD=`UTLD`,aD=`SCHEME`,oD=`SLASH_SCHEME`,sD=`NUM`,cD=`WS`,lD=`NL`,uD=`OPENBRACE`,dD=`CLOSEBRACE`,fD=`OPENBRACKET`,pD=`CLOSEBRACKET`,mD=`OPENPAREN`,hD=`CLOSEPAREN`,gD=`OPENANGLEBRACKET`,_D=`CLOSEANGLEBRACKET`,vD=`FULLWIDTHLEFTPAREN`,yD=`FULLWIDTHRIGHTPAREN`,bD=`LEFTCORNERBRACKET`,xD=`RIGHTCORNERBRACKET`,SD=`LEFTWHITECORNERBRACKET`,CD=`RIGHTWHITECORNERBRACKET`,wD=`FULLWIDTHLESSTHAN`,TD=`FULLWIDTHGREATERTHAN`,ED=`AMPERSAND`,DD=`APOSTROPHE`,OD=`ASTERISK`,kD=`AT`,AD=`BACKSLASH`,jD=`BACKTICK`,MD=`CARET`,ND=`COLON`,PD=`COMMA`,FD=`DOLLAR`,ID=`DOT`,LD=`EQUALS`,RD=`EXCLAMATION`,zD=`HYPHEN`,BD=`PERCENT`,VD=`PIPE`,HD=`PLUS`,UD=`POUND`,WD=`QUERY`,GD=`QUOTE`,KD=`FULLWIDTHMIDDLEDOT`,qD=`SEMI`,JD=`SLASH`,YD=`TILDE`,XD=`UNDERSCORE`,ZD=`EMOJI`,QD=`SYM`,$D=Object.freeze({__proto__:null,ALPHANUMERICAL:tD,AMPERSAND:ED,APOSTROPHE:DD,ASCIINUMERICAL:eD,ASTERISK:OD,AT:kD,BACKSLASH:AD,BACKTICK:jD,CARET:MD,CLOSEANGLEBRACKET:_D,CLOSEBRACE:dD,CLOSEBRACKET:pD,CLOSEPAREN:hD,COLON:ND,COMMA:PD,DOLLAR:FD,DOT:ID,EMOJI:ZD,EQUALS:LD,EXCLAMATION:RD,FULLWIDTHGREATERTHAN:TD,FULLWIDTHLEFTPAREN:vD,FULLWIDTHLESSTHAN:wD,FULLWIDTHMIDDLEDOT:KD,FULLWIDTHRIGHTPAREN:yD,HYPHEN:zD,LEFTCORNERBRACKET:bD,LEFTWHITECORNERBRACKET:SD,LOCALHOST:nD,NL:lD,NUM:sD,OPENANGLEBRACKET:gD,OPENBRACE:uD,OPENBRACKET:fD,OPENPAREN:mD,PERCENT:BD,PIPE:VD,PLUS:HD,POUND:UD,QUERY:WD,QUOTE:GD,RIGHTCORNERBRACKET:xD,RIGHTWHITECORNERBRACKET:CD,SCHEME:aD,SEMI:qD,SLASH:JD,SLASH_SCHEME:oD,SYM:QD,TILDE:YD,TLD:rD,UNDERSCORE:XD,UTLD:iD,UWORD:$E,WORD:QE,WS:cD}),eO=/[a-z]/,tO=/\p{L}/u,nO=/\p{Emoji}/u,rO=/\d/,iO=/\s/,aO=`\r`,oO=`
|
|
166
|
+
`,sO=`️`,cO=``,lO=``,uO=null,dO=null;function fO(e=[]){let t={};JE.groups=t;let n=new JE;uO??=gO(NE),dO??=gO(PE),$(n,`'`,DD),$(n,`{`,uD),$(n,`}`,dD),$(n,`[`,fD),$(n,`]`,pD),$(n,`(`,mD),$(n,`)`,hD),$(n,`<`,gD),$(n,`>`,_D),$(n,`(`,vD),$(n,`)`,yD),$(n,`「`,bD),$(n,`」`,xD),$(n,`『`,SD),$(n,`』`,CD),$(n,`<`,wD),$(n,`>`,TD),$(n,`&`,ED),$(n,`*`,OD),$(n,`@`,kD),$(n,"`",jD),$(n,`^`,MD),$(n,`:`,ND),$(n,`,`,PD),$(n,`$`,FD),$(n,`.`,ID),$(n,`=`,LD),$(n,`!`,RD),$(n,`-`,zD),$(n,`%`,BD),$(n,`|`,VD),$(n,`+`,HD),$(n,`#`,UD),$(n,`?`,WD),$(n,`"`,GD),$(n,`/`,JD),$(n,`;`,qD),$(n,`~`,YD),$(n,`_`,XD),$(n,`\\`,AD),$(n,`・`,KD);let r=XE(n,rO,sD,{[FE]:!0});XE(r,rO,r);let i=XE(r,eO,eD,{[RE]:!0}),a=XE(r,tO,tD,{[zE]:!0}),o=XE(n,eO,QE,{[IE]:!0});XE(o,rO,i),XE(o,eO,o),XE(i,rO,i),XE(i,eO,i);let s=XE(n,tO,$E,{[LE]:!0});XE(s,eO),XE(s,rO,a),XE(s,tO,s),XE(a,rO,a),XE(a,eO),XE(a,tO,a);let c=$(n,oO,lD,{[WE]:!0}),l=$(n,aO,cD,{[WE]:!0}),u=XE(n,iO,cD,{[WE]:!0});$(n,lO,u),$(l,oO,c),$(l,lO,u),XE(l,iO,u),$(u,aO),$(u,oO),XE(u,iO,u),$(u,lO,u);let d=XE(n,nO,ZD,{[VE]:!0});$(d,`#`),XE(d,nO,d),$(d,sO,d);let f=$(d,cO);$(f,`#`),XE(f,nO,d);let p=[[eO,o],[rO,i]],m=[[eO,null],[tO,s],[rO,a]];for(let e=0;e<uO.length;e++)hO(n,uO[e],rD,QE,p);for(let e=0;e<dO.length;e++)hO(n,dO[e],iD,$E,m);KE(rD,{tld:!0,ascii:!0},t),KE(iD,{utld:!0,alpha:!0},t),hO(n,`file`,aD,QE,p),hO(n,`mailto`,aD,QE,p),hO(n,`http`,oD,QE,p),hO(n,`https`,oD,QE,p),hO(n,`ftp`,oD,QE,p),hO(n,`ftps`,oD,QE,p),KE(aD,{scheme:!0,ascii:!0},t),KE(oD,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[HE]:!0}:{[UE]:!0};r.indexOf(`-`)>=0?i[BE]=!0:eO.test(r)?rO.test(r)?i[RE]=!0:i[IE]=!0:i[FE]=!0,ZE(n,r,r,i)}return ZE(n,`localhost`,nD,{ascii:!0}),n.jd=new JE(QD),{start:n,tokens:Object.assign({groups:t},$D)}}function pO(e,t){let n=mO(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function mO(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function hO(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new JE(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new JE(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function gO(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var _O={defaultProtocol:`http`,events:null,format:yO,formatHref:yO,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vO(e,t=null){let n=Object.assign({},_O);e&&(n=Object.assign(n,e instanceof vO?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}vO.prototype={o:_O,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:_O[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function yO(e){return e}function bO(e,t){this.t=`token`,this.v=e,this.tk=t}bO.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=_O.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function xO(e,t){class n extends bO{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var SO=xO(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),CO=xO(`text`),wO=xO(`nl`),TO=xO(`url`,{isLink:!0,toHref(e=_O.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==nD&&e[1].t===ND}}),EO=e=>new JE(e);function DO({groups:e}){let t=e.domain.concat([ED,OD,kD,AD,jD,MD,FD,LD,zD,sD,BD,VD,HD,UD,JD,QD,YD,XD]),n=[DD,ND,PD,ID,RD,BD,WD,GD,qD,gD,_D,uD,dD,pD,fD,mD,hD,vD,yD,bD,xD,SD,CD,wD,TD],r=[ED,DD,OD,AD,jD,MD,FD,LD,zD,uD,dD,BD,VD,HD,UD,WD,JD,QD,YD,XD],i=EO(),a=$(i,YD);YE(a,r,a),YE(a,e.domain,a);let o=EO(),s=EO(),c=EO();YE(i,e.domain,o),YE(i,e.scheme,s),YE(i,e.slashscheme,c),YE(o,r,a),YE(o,e.domain,o);let l=$(o,kD);$(a,kD,l),$(s,kD,l),$(c,kD,l);let u=$(a,ID);YE(u,r,a),YE(u,e.domain,a);let d=EO();YE(l,e.domain,d),YE(d,e.domain,d);let f=$(d,ID);YE(f,e.domain,d);let p=EO(SO);YE(f,e.tld,p),YE(f,e.utld,p),$(l,nD,p);let m=$(d,zD);$(m,zD,m),YE(m,e.domain,d),YE(p,e.domain,d),$(p,ID,f),$(p,zD,m);let h=$(o,zD),g=$(o,ID);$(h,zD,h),YE(h,e.domain,o),YE(g,r,a),YE(g,e.domain,o);let _=EO(TO);YE(g,e.tld,_),YE(g,e.utld,_),YE(_,e.domain,o),YE(_,r,a),$(_,ID,g),$(_,zD,h),$(_,kD,l);let v=$(_,ND),y=EO(TO);YE(v,e.numeric,y);let b=EO(TO),x=EO();YE(b,t,b),YE(b,n,x),YE(x,t,b),YE(x,n,x),$(_,JD,b),$(y,JD,b);let S=$(s,ND),C=$($($(c,ND),JD),JD);YE(s,e.domain,o),$(s,ID,g),$(s,zD,h),YE(c,e.domain,o),$(c,ID,g),$(c,zD,h),YE(S,e.domain,b),$(S,JD,b),$(S,WD,b),YE(C,e.domain,b),YE(C,t,b),$(C,JD,b);let w=[[uD,dD],[fD,pD],[mD,hD],[gD,_D],[vD,yD],[bD,xD],[SD,CD],[wD,TD]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a);let o=EO(TO);YE(a,t,o);let s=EO();YE(a,n,s),$(a,i,b),YE(o,t,o),YE(o,n,s),YE(s,t,o),YE(s,n,s),$(o,i,b),$(s,i,b)}return $(i,nD,_),$(i,lD,wO),{start:i,tokens:$D}}function OO(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(kO(CO,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(kO(e,t,r))}}return o.length>0&&a.push(kO(CO,t,o)),a}function kO(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var AO=typeof console<`u`&&console&&console.warn||(()=>{}),jO=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,MO={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function NO(){return JE.groups={},MO.scanner=null,MO.parser=null,MO.tokenQueue=[],MO.pluginQueue=[],MO.customSchemes=[],MO.initialized=!1,MO}function PO(e,t=!1){if(MO.initialized&&AO(`linkifyjs: already initialized - will not register custom scheme "${e}" ${jO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
167
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
168
|
+
2. Cannot start or end with "-"
|
|
169
|
+
3. "-" cannot repeat`);MO.customSchemes.push([e,t])}function FO(){MO.scanner=fO(MO.customSchemes);for(let e=0;e<MO.tokenQueue.length;e++)MO.tokenQueue[e][1]({scanner:MO.scanner});MO.parser=DO(MO.scanner.tokens);for(let e=0;e<MO.pluginQueue.length;e++)MO.pluginQueue[e][1]({scanner:MO.scanner,parser:MO.parser});return MO.initialized=!0,MO}function IO(e){return MO.initialized||FO(),OO(MO.parser.start,e,pO(MO.scanner.start,e))}IO.scan=pO;function LO(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new vO(n),i=IO(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var RO=`[\0- \xA0 -\u2029 ]`,zO=new RegExp(RO),BO=RegExp(`${RO}$`),VO=RegExp(`${RO}+$`),HO=new RegExp(RO,`g`);function UO(e,t,n){let r=e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i=e.doc.textBetween(t.from,t.to,``,``).match(VO)?.[0];if(!i)return;let a=t.to-i.length,o=L_(a,t.to,e.doc).filter(e=>e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return;let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty&&e.selection.from===t.to&&e.removeStoredMark(n)}function WO(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function GO(e){return new jl({key:new Pl(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r,s=i_(n.doc,[...t]);if(!t.some(Lh)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof hc)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>UO(o,t,e.type))}if(I_(s).forEach(({newRange:t})=>{let n=a_(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!BO.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(zO).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=IO(n).map(t=>t.toObject(e.defaultProtocol));if(!WO(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{L_(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function KO(e){return new jl({key:new Pl(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=N_(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var qO=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,JO=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function YO(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function XO(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"){r+=1;continue}if(n===0&&YO(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function ZO(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||YO(e,t.index??0)||XO(e,t.index??0)?!1:!!r.trim()&&n(i)}function QO(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function $O(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function ek(e){return{href:e.data?.href,title:e.data?.title??null}}function tk(e){let t=rb({find:t=>{let n=qO.exec(t);return!n||!ZO(t,n,e.isAllowedHref)?null:QO(n)},type:e.type,getAttributes:ek});return new wy({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function nk(e){let t=db({find:t=>{let n=[];for(let r of t.matchAll(JO))ZO(t,r,e.isAllowedHref)&&n.push(QO(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>$O(t,e)));return[...n,...r]},type:e.type,getAttributes:ek});return new Ny({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function rk(e){return new jl({key:new Pl(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=LO(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function ik(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(HO,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var ak=My.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){PO(e);return}PO(e.scheme,e.optionalSlashes)})},onDestroy(){NO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!ik(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,__(this.options.HTMLAttributes,e),0]:[`a`,__(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[tk({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;LO(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!ik(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[nk({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!ik(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[db({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(GO({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!ik(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(KO({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(rk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),ok=`listItem`,sk=`textStyle`,ck=/^\s*([-+*])\s$/,lk=lb.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,__(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
170
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ok,this.editor.getAttributes(sk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=ob({find:ck,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ob({find:ck,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(sk),editor:this.editor})),[e]}}),uk=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},dk=(e,t,n,r)=>{let i=uk(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,Y.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},fk=(e,t,n)=>dk(e.state,e.view.dispatch,t,n),pk=(e,t)=>By.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>fk(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),mk=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],hk=`abcdefghijklmnopqrstuvwxyz`,gk=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function _k(e){let t=e,n=``;for(let[e,r]of mk)for(;t>=e;)n+=r,t-=e;return n}function vk(e){return _k(e).toUpperCase()}function yk(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of mk)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function bk(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=yk(e);return t<=0?!1:(e===e.toLowerCase()?_k(t):vk(t))===e}function xk(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function Sk(e){if(e<=26)return hk[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?hk[n]:hk[t]+hk[n]}function Ck(e){if(e&&!/^\d+$/.test(e)){if(bk(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function wk(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=Ck(e);if(t===`i`||t===`I`)return yk(e);if(t===`a`||t===`A`){let t=xk(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function Tk(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return Sk(t);case`A`:return Sk(t).toUpperCase();case`i`:return _k(t);case`I`:return vk(t);default:return String(t)}}function Ek(e){if(e.length===0)return!1;let t=Ck(e[0])??`numeric`,n=wk(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=Tk(t,n+r);if(e[r]!==i)return!1}return!0}function Dk(e){return{type:Ck(e),start:wk(e)}}function Ok(e){let{type:t,start:n}=Dk(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function kk(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${Sk(r)}${n}`;case`A`:return`${Sk(r).toUpperCase()}${n}`;case`i`:return`${_k(r)}${n}`;case`I`:return`${vk(r)}${n}`;default:return`${r}${n}`}}function Ak(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function jk(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var Mk=lb.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,__(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Ak(e))return{type:`listItem`,content:[{type:`paragraph`,content:jk(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>yy(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return kk((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[pk(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Nk=(e,t)=>{let{$from:n}=t.selection,r=qh(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},Pk=(e,t)=>{let n=Nk(e,t);if(!n)return!1;let[,r]=R_(t,e,n.$pos.pos+4);return r},Fk=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},Ik=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Bg(e.state,t)&&Fk(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!Bg(e.state,t)||!K_(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},Lk=(e,t)=>{let n=Pk(e,t),r=Nk(e,t);return!r||!n?!1:n>r.depth},Rk=(e,t)=>{let n=Pk(e,t),r=Nk(e,t);return!r||!n?!1:n<r.depth},zk=(e,t)=>{if(!Bg(e.state,t)||!G_(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Lk(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Rk(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},Bk=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||Bg(r,t))return!1;let o=z_(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,Y.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,Y.from(c)),e.setSelection(Z.create(e.doc,d+1)),e.scrollIntoView()),!0))},Vk=By.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&zk(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&zk(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Ik(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&Ik(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&Bk(e,t,n))return!0;return!1}}}}),Hk=RegExp(`^(\\s*)(${gk})([.)])\\s+(.*)$`),Uk=/^\s/,Wk={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function Gk(e){return Hk.test(e.trimStart())}function Kk(e){let t=e.trimStart();return Wk.bulletItem.test(t)||Gk(t)||Wk.heading.test(t)||Wk.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||Wk.codeFence.test(t)||Wk.blockMath.test(t)}function qk(e){return Object.values(Wk).some(t=>t.test(e))}function Jk(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&Kk(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function Yk(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(Hk);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?Ck(s):void 0,p=isNaN(d)?wk(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(Hk))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(Uk)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||qk(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
|
|
171
|
+
`).trim(),contentLines:m,raw:g.join(`
|
|
172
|
+
`)}),r=h,n=h}return[t,r]}var Xk=RegExp(`^(${gk})([.)])\\s+(.+)$`);function Zk(e){let t=e.split(`
|
|
173
|
+
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(Xk);if(!t)return null;n.push({marker:t[1],content:t[3]})}return Ek(n.map(e=>e.marker))?{type:`orderedList`,attrs:Ok(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function Qk(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=Jk(a.contentLines),c=o.join(`
|
|
174
|
+
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
175
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=Qk(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
|
|
176
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function $k(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var eA=64;function tA(e,t){let n=[],r=0;for(;n.length<t;){let t=e.indexOf(`
|
|
177
|
+
`,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function nA(e){let t=e.indexOf(`
|
|
178
|
+
`),n=t===-1?e:e.slice(0,t);if(!Hk.test(n))return[[],0,[]];let r=eA,i=tA(e,r),a=Yk(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=tA(e,r),a=Yk(i);return[a[0],a[1],i]}var rA=`listItem`,iA=`textStyle`,aA=/^(\d+)\.\s$/;function oA(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var sA=lb.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=oA(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=oA(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=__(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?$k(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
179
|
+
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=nA(e);if(r.length===0)return;let o=Qk(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
|
|
180
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(rA,this.editor.getAttributes(iA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new jl({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Zk(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=ob({find:aA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ob({find:aA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(iA)}),joinPredicate:e,editor:this.editor})),[t]}}),cA=/^\s*(\[([( |x])?\])\s$/,lA=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,uA=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},dA=lb.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,__(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>yy(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[pk(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=lA;let l=e=>{let t=uA(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=v_(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[ob({find:cA,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),fA=lb.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,__(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
181
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=gy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=gy(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});By.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(lk.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Mk.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Vk.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(sA.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(dA.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(fA.configure(this.options.taskList)),e}});var pA=` `,mA=`\xA0`,hA=lb.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,__(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===pA||n[0].text===pA||n[0].raw===mA||n[0].text===mA)&&r.length===1&&r[0].type===`text`&&(r[0].text===pA||r[0].text===mA)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?pA:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),gA=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,_A=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vA=My.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,__(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rb({find:gA,type:this.type})]},addPasteRules(){return[db({find:_A,type:this.type})]}}),yA=lb.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),bA=My.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,__(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function xA(e={}){return new jl({view(t){return new SA(t,e)}})}var SA=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Hc(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},CA=class e extends ul{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):ul.near(r)}content(){return X.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new wA(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!EA(e)||!DA(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!hl.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};CA.prototype.visible=!1,CA.findFrom=CA.findGapCursorFrom,ul.jsonID(`gapcursor`,CA);var wA=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return CA.valid(t)?new CA(t):ul.near(t)}};function TA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function EA(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||TA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function DA(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||TA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function OA(){return new jl({props:{decorations:NA,createSelectionBetween(e,t,n){return t.pos==n.pos&&CA.valid(n)?new CA(n):null},handleClick:jA,handleKeyDown:kA,handleDOMEvents:{beforeinput:MA}}})}var kA=dh({ArrowLeft:AA(`horiz`,-1),ArrowRight:AA(`horiz`,1),ArrowUp:AA(`vert`,-1),ArrowDown:AA(`vert`,1)});function AA(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Z){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=CA.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new CA(c))),!0):!1}}function jA(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!CA.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&hl.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new CA(r))),!0)}function MA(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof CA))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Y.empty;for(let e=r.length-1;e>=0;e--)i=Y.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new X(i,0,0));return a.setSelection(Z.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function NA(e){if(!(e.selection instanceof CA))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,um.create(e.doc,[sm.widget(e.selection.head,t,{key:`gapcursor`})])}By.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new jl({key:new Pl(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var PA=By.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[xA(this.options)]}});By.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new jl({key:new Pl(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return um.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(sm.node(t,t+e.nodeSize,{class:this.options.className}))}),um.create(e,a)}}})]}});var FA=By.create({name:`gapCursor`,addProseMirrorPlugins(){return[OA()]},extendNodeSchema(e){return{allowGapCursor:d_(Q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),IA=`placeholder`,LA=new Pl(`tiptap__placeholder`);function RA(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),sm.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function zA(e,t){return typeof e==`function`?e(t):e}function BA({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&Y_(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(RA({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zA(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function VA({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Y_(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(RA({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:zA(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...BA({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return um.create(r,o)}function HA(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function UA(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function WA(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function GA(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function KA(e,t){let n=WA(e,t.from,t.to);return n.push(UA(e,HA(e,t.from))),t.to>t.from?n.push(UA(e,HA(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(UA(e,HA(e,Math.min(t.from+1,e.content.size)))),n}function qA(e,t,n){let r=[];if(e.docChanged){let t=I_(e);for(let e of t)r.push(...KA(n.doc,e.newRange))}return e.selectionSet&&(r.push(UA(n.doc,HA(n.doc,e.mapping.map(t.selection.anchor)))),r.push(UA(n.doc,HA(n.doc,n.selection.anchor)))),GA(r)}function JA(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function YA({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=JA(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=BA({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function XA({editor:e,options:t,dataAttribute:n}){return{init(r,i){return VA({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??um.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:YA({decorations:i.map(r.mapping,r.doc),ranges:qA(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function ZA(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function QA({editor:e,options:t}){let n=t.dataAttribute?`data-${ZA(t.dataAttribute)}`:`data-${IA}`,r=t.showOnlyCurrent&&!t.includeChildren;return new jl({key:LA,...r?{}:{state:XA({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>VA({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?um.empty:LA.getState(n)??um.empty}})}var $A=By.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:IA,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[QA({editor:this.editor,options:this.options})]}});function ej(e,t){return!e.selection.empty&&!X_(e.selection)&&t.isEditable}function tj(e,t){return ej(e,t)&&!t.isFocused&&!t.view.dragging}function nj(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function rj(e){e.focus()}By.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new jl({key:new Pl(`selection`),props:{decorations(n){return tj(n,e)?um.create(n.doc,[sm.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return ej(t.state,e)&&nj(),!1},focus(t){return ej(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&rj(t)}),!1}}}})]}});function ij({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var aj=By.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Pl(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new jl({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!ij({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!ij({node:r,types:n})}}})]}}),oj=By.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Fh(e,t),redo:()=>({state:e,dispatch:t})=>Ih(e,t)}},addProseMirrorPlugins(){return[Nh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),sj=By.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(mE.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(lE.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(lk.configure(this.options.bulletList)),this.options.code!==!1&&e.push(vE.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(SE.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(CE.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(PA.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(FA.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(TE.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(EE.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(oj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(DE.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(ME.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Mk.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Vk.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(ak.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(sA.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(hA.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(vA.configure(this.options.strike)),this.options.text!==!1&&e.push(yA.configure(this.options.text)),this.options.underline!==!1&&e.push(bA.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(aj.configure(this.options?.trailingNode)),e}}),cj=sj,lj=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uj=lb.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`,__(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,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=__(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{if(typeof e==`string`&&e!==``){l.getAttribute(`src`)!==e&&(l.src=e);return}l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``)};f(s.src);let p=new cb({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=v_(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ib({find:lj,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),dj=uj,fj=[`data-pm-`,`data-prosemirror-`,`pm-`,`data-node-view-`,`data-comark-`],pj=new Set([`contenteditable`,`draggable`,`spellcheck`]);function mj(e){if(pj.has(e))return!0;for(let t of fj)if(e.startsWith(t))return!0;return!1}function hj(e,t){let n={};for(let r of Array.from(e.attributes))t?.has(r.name)||mj(r.name)||(n[r.name]=r.value);return n}function gj(e={}){let t=new Set(e.reserved??[]);return{htmlAttrs:{default:{},parseHTML:e=>{let n=hj(e,t);return Object.keys(n).length>0?n:null},renderHTML:e=>{let t=e.htmlAttrs;if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))r!=null&&(typeof r==`string`?n[e]=r:(typeof r==`number`||typeof r==`boolean`||typeof r==`bigint`)&&(n[e]=String(r)));return n}}}}var _j=[`paragraph`,`heading`,`blockquote`,`bulletList`,`listItem`,`hardBreak`,`horizontalRule`,`bold`,`italic`,`strike`,`comarkComment`,`picture`],vj=[[[`orderedList`],[`start`,`type`]],[[`link`],[`href`,`title`,`target`,`rel`,`class`]],[[`code`],[]],[[`codeBlock`],[`language`]],[[`image`],[`src`,`alt`,`title`,`srcset`,`width`,`height`]],[[`tableCell`,`tableHeader`],[`colspan`,`rowspan`,`colwidth`,`align`,`style`]],[[`table`],[`style`]],[[`tableRow`],[]],[[`comarkTemplate`],[`name`]]],yj=By.create({name:`comarkAttrs`,addGlobalAttributes(){let e=[{types:[..._j],attributes:{...gj()}}];for(let[t,n]of vj)e.push({types:[...t],attributes:{...gj({reserved:n})}});return e}}),bj=SE.extend({addAttributes(){return{...this.parent?.(),filename:{default:null,renderHTML:()=>({})},highlights:{default:null,renderHTML:()=>({})},meta:{default:null,renderHTML:()=>({})},codeHtmlAttrs:{default:null,renderHTML:()=>({})}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`,getAttrs(e){if(!(e instanceof HTMLElement))return!1;let t=e.querySelector(`code`);if(!t)return null;let n=(()=>{let e=t.getAttribute(`class`)??``,n=/language-(\S+)/.exec(e);return n?n[1]:null})(),r={};for(let e of Array.from(t.attributes))e.name===`class`&&n&&e.value===`language-${n}`||e.name.startsWith(`data-pm-`)||e.name.startsWith(`data-comark-`)||(r[e.name]=e.value);return Object.keys(r).length>0?{codeHtmlAttrs:r}:null}}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.language,r=e.attrs.codeHtmlAttrs??null,i={};if(r)for(let[e,t]of Object.entries(r))t!=null&&(typeof t==`string`?i[e]=t:(typeof t==`number`||typeof t==`boolean`||typeof t==`bigint`)&&(i[e]=String(t)));return n&&(i.class=`language-${n}`),[`pre`,__(t),[`code`,i,0]]}}),xj=lb.create({name:`comarkComment`,group:`block`,atom:!0,selectable:!0,addAttributes(){return{text:{default:``,parseHTML:e=>e.getAttribute(`data-comark-comment`)??``,renderHTML:e=>({"data-comark-comment":typeof e.text==`string`?e.text:``})}}},parseHTML(){return[{tag:`div[data-comark-comment]`}]},renderHTML({HTMLAttributes:e}){return[`div`,__(e)]}});function Sj(e,t){let n={},r={};if(!e)return{semantic:n,htmlAttrs:r};for(let[i,a]of Object.entries(e))i!==`$`&&a!=null&&(t.includes(i)?n[i]=a:r[i]=a);return{semantic:n,htmlAttrs:r}}function Cj(e,t){let n={};if(t)for(let[e,r]of Object.entries(t))r!=null&&(n[e]=r);for(let[t,r]of Object.entries(e))r!=null&&(n[t]=r);return n}function wj(e){let t=e?.attrs?.htmlAttrs;return t&&typeof t==`object`?t:{}}function Tj(e){return Object.keys(wj(e)).length===0}function Ej(e,t){let n=e??[];return n.length===1&&n[0]?.type===`paragraph`&&Tj(n[0])?t.serializeInlines(n[0]?.content):t.serializeBlocks(n)}function Dj(e,t,n){if(!Tj(e)||e.content?.length!==1||t.length!==1)return null;let r=t[0],i=n.getNodeSpec(e.content[0]?.type??``);return i?.context===`inline-block`&&Array.isArray(r)&&typeof r[0]==`string`&&i.tags.includes(r[0])?r:null}function Oj(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?String(e):null}function kj(e,t){if(t!=null)switch(e){case`string`:return Oj(t)??void 0;case`number`:{let e=Oj(t);if(e===null)return;let n=Number(e);return Number.isFinite(n)?n:void 0}case`boolean`:return typeof t==`boolean`?t:t===`true`||t!==`false`&&void 0;case`json`:if(typeof t==`object`)return t;if(typeof t!=`string`)return;try{return JSON.parse(t)}catch{return}}}function Aj(e,t){if(t==null)return null;switch(e){case`string`:{let e=Oj(t);return e===null?null:{key:``,raw:e}}case`number`:{let e=Oj(t);return e===null?null:{key:`:`,raw:e}}case`boolean`:return{key:`:`,raw:String(!!t)};case`json`:return{key:`:`,raw:JSON.stringify(t)}}}function jj(e,t){let n={},r={};if(!e){for(let[e,r]of Object.entries(t))r.default!==void 0&&(n[e]=r.default);return{props:n,htmlAttrs:r}}let i=new Set;for(let[a,o]of Object.entries(e)){if(a===`$`||o==null)continue;let e=a.startsWith(`:`)?a.slice(1):a,s=t[e];if(s){let t=kj(s.type,o);t!==void 0&&(n[e]=t,i.add(e))}else r[a]=o}for(let[e,r]of Object.entries(t))!i.has(e)&&r.default!==void 0&&(n[e]=r.default);return{props:n,htmlAttrs:r}}function Mj(e,t,n){let r={};for(let[e,n]of Object.entries(t))n!=null&&(r[e]=n);for(let[t,i]of Object.entries(e)){let e=n[t];if(!e){i!=null&&(r[t]=i);continue}let a=Aj(e.type,i);a&&(r[`${a.key}${t}`]=a.raw)}return r}function Nj(e){let t=e.props??{},n=e.kind===`inline`,r={pmName:e.name,tags:[e.name],context:n?`inline`:`block`,toComark(r,i){let a={};for(let e of Object.keys(t))r.attrs&&e in r.attrs&&(a[e]=r.attrs[e]);let o=Mj(a,wj(r),t),s=n?i.serializeInlines(r.content):Ej(r.content,i);return[e.name,o,...s]},fromComark(r,i){let[,a,...o]=r,{props:s,htmlAttrs:c}=jj(a,t),l={...s};Object.keys(c).length>0&&(l.htmlAttrs=c);let u=n?i.parseInlines(o):i.parseBlocks(o),d={type:e.name};return Object.keys(l).length>0&&(d.attrs=l),u.length>0?d.content=u:n||(d.content=[{type:`paragraph`}]),d}},i={};for(let[e,n]of Object.entries(t))i[e]={default:n.default??null};return{extension:lb.create({name:e.name,group:n?`inline`:`block`,inline:n,content:n?`inline*`:`block+`,defining:!n,selectable:!0,draggable:!n,addAttributes(){return{...i,...gj({reserved:Object.keys(t)})}},parseHTML(){return[{tag:`${n?`span`:`div`}[data-comark-component="${e.name}"]`}]},renderHTML({HTMLAttributes:t}){return[n?`span`:`div`,__(t,{"data-comark-component":e.name}),0]}}),spec:r,definition:e}}function Pj(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&(e.charAt(n)===`,`||/\s/.test(e.charAt(n)));)n++;if(n>=e.length)break;let r=n;for(;n<e.length&&!/\s/.test(e.charAt(n));)n++;let i=e.slice(r,n),a=``;if(i.endsWith(`,`))i=i.replace(/,+$/,``);else{for(;n<e.length&&/\s/.test(e.charAt(n));)n++;for(r=n;n<e.length&&e.charAt(n)!==`,`;)n++;a=e.slice(r,n).trim(),n++}i.length>0&&t.push({url:i,descriptor:a})}return t}function Fj(e,t){let n=Pj(e);return n.length===0?e:n.map(({url:e,descriptor:n})=>{let r=t(e)??e;return n?`${r} ${n}`:r}).join(`, `)}var Ij=`data-comark-src`,Lj=`data-comark-srcset`;function Rj(e,t,n,r){if(!r)return{[e]:t};let i=e===`src`?r(t,{attr:e,node:n})??t:Fj(t,t=>r(t,{attr:e,node:n}));return i===t?{[e]:t}:{[e]:i,[e===`src`?Ij:Lj]:t}}var zj=uj.extend({addOptions(){return{...this.parent?.()??{},resolveSrc:void 0}},addAttributes(){return{...this.parent?.(),src:{default:null,parseHTML:e=>e.getAttribute(`data-comark-src`)??e.getAttribute(`src`),renderHTML:e=>{let t=e.src;return t==null?{}:typeof t==`string`?Rj(`src`,t,`image`,this.options.resolveSrc):{src:t}}},srcset:{default:null,parseHTML:e=>e.getAttribute(`data-comark-srcset`)??e.getAttribute(`srcset`),renderHTML:e=>{let t=e.srcset;return t==null?{}:typeof t==`string`?Rj(`srcset`,t,`image`,this.options.resolveSrc):{srcset:t}}}}}});function Bj(e){let t=hj(e),n=e.getAttribute(Ij),r=e.getAttribute(Lj);return n!=null&&(t.src=n),r!=null&&(t.srcset=r),t}function Vj(e,t){let n={};for(let[t,r]of Object.entries(e))r!=null&&(typeof r==`string`?n[t]=r:(typeof r==`number`||typeof r==`boolean`||typeof r==`bigint`)&&(n[t]=String(r)));return n.src!=null&&Object.assign(n,Rj(`src`,n.src,`picture`,t)),n.srcset!=null&&Object.assign(n,Rj(`srcset`,n.srcset,`picture`,t)),n}var Hj=lb.create({name:`picture`,inline:!0,group:`inline`,atom:!0,selectable:!0,draggable:!0,addOptions(){return{resolveSrc:void 0}},addAttributes(){return{sources:{default:[],parseHTML:e=>Array.from(e.querySelectorAll(`source`)).map(Bj),renderHTML:()=>({})},img:{default:null,parseHTML:e=>{let t=e.querySelector(`img`);return t?Bj(t):null},renderHTML:()=>({})}}},parseHTML(){return[{tag:`picture`}]},renderHTML({node:e,HTMLAttributes:t}){let n=this.options.resolveSrc,r=(e.attrs.sources??[]).map(e=>[`source`,Vj(e,n)]),i=e.attrs.img;return[`picture`,__(t),...r,...i?[[`img`,Vj(i,n)]]:[]]}}),Uj=lb.create({name:`comarkTemplate`,group:`block`,content:`block+`,defining:!0,selectable:!0,draggable:!1,addAttributes(){return{name:{default:null,parseHTML:e=>e.getAttribute(`data-slot`),renderHTML:e=>e.name?{"data-slot":e.name}:{}}}},parseHTML(){return[{tag:`div[data-comark-template]`}]},renderHTML({HTMLAttributes:e}){return[`div`,__(e,{"data-comark-template":``}),0]}});function Wj(e){let{editor:t,storage:n}=e,r=Tr({...e.parserOptions,autoClose:e.streamAutoClose,headingIds:!1});n.streamBaselineEditable===null&&(n.streamBaselineEditable=t.isEditable),t.setEditable(!1,!1);let i=!0,a=null,o=null,s=!1,c=null,l=0,u=Promise.resolve();function d(){s||(s=!0,typeof requestAnimationFrame==`function`?c=requestAnimationFrame(f):queueMicrotask(f))}function f(){s=!1,c=null,u=u.then(m)}function p(){c!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(c),s=!1,c=null}async function m(){if(!i||a===null||a===o)return;o=a;let n=++l;try{let e=await r(o,{streaming:!0});if(n!==l||!i||t.isDestroyed)return;h(e)}catch(t){e.report(t)}}function h(r){g(t.schema.nodeFromJSON(e.toPmDoc(r))),n.frontmatter={...r.frontmatter},n.meta={...r.meta}}function g(e){let n=t.state.doc;if(n.eq(e))return;let r=Math.min(n.childCount,e.childCount),i=0,a=0;for(;i<r&&n.child(i).eq(e.child(i));)a+=n.child(i).nodeSize,i++;if(i===e.childCount&&n.childCount===e.childCount+1&&n.child(i).isTextblock&&n.child(i).content.size===0)return;let o=[];for(let t=i;t<e.childCount;t++)o.push(e.child(t));let s=t.state.tr.replaceWith(a,n.content.size,o);s.setMeta(kC,!0),s.setMeta(`addToHistory`,!1),t.view.dispatch(s)}function _(){t.isDestroyed||n.streamSession===b&&(t.setEditable(n.streamBaselineEditable??!0,!1),n.streamBaselineEditable=null,n.streamSession=null)}async function v(){if(i){i=!1,p(),l++;try{if(a!==null&&!t.isDestroyed){let n=await Cr(a,e.canonicalOptions);t.isDestroyed||h(n)}}catch(t){e.report(t)}_()}}function y(){i&&(i=!1,p(),l++,_())}let b={set(e){i&&(a=e,d())},end:v,abort:y,get active(){return i&&!t.isDestroyed}};return b}var Gj=`[data-comark-comment]:not([data-node-view-wrapper]) {
|
|
182
|
+
display: block;
|
|
183
|
+
padding: 0.25em 0.5em;
|
|
184
|
+
margin: 0.5em 0;
|
|
185
|
+
border-left: 3px solid currentColor;
|
|
186
|
+
opacity: 0.6;
|
|
187
|
+
font-style: italic;
|
|
188
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
189
|
+
font-size: 0.875em;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[data-comark-comment]:not([data-node-view-wrapper])::before {
|
|
193
|
+
content: "// " attr(data-comark-comment);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
[data-comark-template]:not([data-node-view-wrapper]) {
|
|
197
|
+
display: block;
|
|
198
|
+
position: relative;
|
|
199
|
+
padding: 0.5em;
|
|
200
|
+
margin: 0.5em 0;
|
|
201
|
+
border: 1px dashed currentColor;
|
|
202
|
+
opacity: 0.85;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
[data-comark-template]:not([data-node-view-wrapper])[data-slot]::before {
|
|
206
|
+
content: "#" attr(data-slot);
|
|
207
|
+
display: block;
|
|
208
|
+
margin-bottom: 0.25em;
|
|
209
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
210
|
+
font-size: 0.75em;
|
|
211
|
+
opacity: 0.65;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
div[data-comark-component]:not([data-node-view-wrapper]) {
|
|
215
|
+
display: block;
|
|
216
|
+
position: relative;
|
|
217
|
+
padding: 0.5em;
|
|
218
|
+
margin: 0.5em 0;
|
|
219
|
+
border: 1px solid currentColor;
|
|
220
|
+
opacity: 0.85;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
div[data-comark-component]:not([data-node-view-wrapper])::before {
|
|
224
|
+
content: "::" attr(data-comark-component);
|
|
225
|
+
display: block;
|
|
226
|
+
margin-bottom: 0.25em;
|
|
227
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
228
|
+
font-size: 0.75em;
|
|
229
|
+
opacity: 0.65;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
span[data-comark-component]:not([data-node-view-wrapper]) {
|
|
233
|
+
display: inline;
|
|
234
|
+
padding: 0 0.25em;
|
|
235
|
+
border: 1px solid currentColor;
|
|
236
|
+
border-radius: 0.25em;
|
|
237
|
+
opacity: 0.85;
|
|
238
|
+
}
|
|
239
|
+
`,Kj=`data-comark-style`;function qj(e){if(typeof document>`u`)return null;let t=document.querySelector(`style[${Kj}]`);if(t)return t;let n=document.createElement(`style`);return n.setAttribute(Kj,``),e&&n.setAttribute(`nonce`,e),n.textContent=Gj,document.head.appendChild(n),n}var{setContent:Jj,insertContent:Yj,insertContentAt:Xj}=jv,Zj=`text`,Qj=`doc`,$j=`code`,eM={autoClose:!1,headingIds:!1};function tM(e){return{...e,...eM}}var nM=e=>typeof e==`string`,rM=e=>Array.isArray(e)&&e[0]===null,iM=e=>Array.isArray(e)&&typeof e[0]==`string`;function aM(e){let t=new Map,n=new Map,r=new Map,i=new Map;for(let r of e.nodes){t.set(r.pmName,r);for(let e of r.tags){let t=n.get(e)??[];t.push(r),n.set(e,t)}}for(let t of e.marks){r.set(t.pmName,t);for(let e of t.tags){let n=i.get(e)??[];n.push(t),i.set(e,n)}}function a(e){let t=n.get(e[0]);if(t)return t.length===1?t[0]:t.find(t=>!t.matches||t.matches(e))??t[0]}function o(e){let t=i.get(e[0]);if(t)return t[0]}function s(e){if(o(e))return!0;let t=a(e);return t?.context===`inline`||t?.context===`inline-block`}function c(e){return!o(e)&&a(e)?.context===`inline-block`}function l(e){if(!e)return[];let n=[];for(let r of e){if(!r.type)continue;let e=t.get(r.type);if(!e)continue;let i=e.toComark(r,g);i!=null&&n.push(i)}return n}function u(e){return(e??[]).filter(e=>e&&r.has(e.type)).map((e,t)=>[e,t]).sort(([e,t],[n,r])=>+(e.type===$j)-(n.type===$j)||t-r).map(([e])=>e)}function d(e,t){return e.type===t.type&&JSON.stringify(e.attrs??{})===JSON.stringify(t.attrs??{})}function f(e,t){let n=[],i=0;for(;i<e.length;){let a=e[i],o=a.marks[t];if(!o){n.push(a.base),i++;continue}let s=i+1;for(;s<e.length;){let n=e[s].marks[t];if(!n||!d(n,o))break;s++}let c=f(e.slice(i,s),t+1),l=r.get(o.type);l?n.push(l.toComark(o,c)):n.push(...c),i=s}return n}function p(e){if(!e)return[];let n=[];for(let r of e){if(!r.type)continue;if(r.type===Zj){let e=r.text??``;if(e.length===0)continue;n.push({marks:u(r.marks),base:e});continue}let e=t.get(r.type);if(!e)continue;let i=e.toComark(r,g);i!=null&&n.push({marks:u(r.marks),base:i})}return f(n,0)}function m(e){let n=[],r=[],i=()=>{if(r.length===0)return;let e=h(r);e.length>0&&n.push({type:`paragraph`,content:e}),r=[]};for(let o=0;o<e.length;o++){let l=e[o];if(nM(l)){if(l.length===0)continue;r.push(l);continue}if(rM(l)){i();let e=t.get(`comarkComment`);if(e){let t=e.fromComark(l,g);t&&n.push(t)}continue}if(!iM(l))continue;if(s(l)){if(r.length===0&&c(l)){let t=e[o+1];if(!(t!==void 0&&(nM(t)&&t.length>0||iM(t)&&s(t)&&!c(t)))){let e=h([l]);e.length>0&&n.push({type:`paragraph`,content:e});continue}}r.push(l);continue}i();let u=a(l);if(!u){n.push(...m(l.slice(2)));continue}let d=u.fromComark(l,g);d&&n.push(d)}return i(),n}function h(e){let t=[];for(let n of e){if(nM(n)){if(n.length===0)continue;t.push({type:`text`,text:n});continue}if(rM(n)||!iM(n))continue;let e=o(n);if(e){let r=e.fromComark(n);if(!r)continue;let i=h(n.slice(2));for(let e of i){let n=e.marks??[];t.push({...e,marks:[r,...n]})}continue}let r=a(n);if(!r){let e=n.slice(2);t.push(...h(e));continue}let i=r.fromComark(n,g);i&&t.push(i)}return t}let g={getNodeSpec:e=>t.get(e),serializeBlocks:l,serializeInlines:p,parseBlocks:m,parseInlines:h,nodeSpecs:e.nodes,markSpecs:e.marks};return g}function oM(e,t,n={}){if(e.type!==Qj)throw Error(`Expected PM doc node, got "${e.type}"`);return{nodes:t.serializeBlocks(e.content),frontmatter:{...n.frontmatter},meta:{...n.meta}}}function sM(e,t){let n=t.parseBlocks(e.nodes);return{type:Qj,content:n.length>0?n:[{type:`paragraph`}]}}var cM=aM({nodes:[],marks:[]});function lM(e,t,n){e?e(t,n):typeof console<`u`&&console.warn(`[comark] ${n.phase} failed:`,t)}function uM(e,t){if(t)for(let[n,r]of Object.entries(t))e.setMeta(n,r)}var dM=By.create({name:`comark`,addOptions(){return{specs:{nodes:[],marks:[]},injectStyles:!0,injectNonce:void 0,onError:void 0,parserOptions:void 0,streamAutoClose:void 0}},addStorage(){let e=this.options;return{helpers:cM,frontmatter:{},meta:{},editor:null,onError:void 0,astCache:null,markdownCache:null,streamSession:null,streamBaselineEditable:null,getAst(){if(!this.editor)throw Error(`[comark] editor not yet attached`);let e=this.editor.state.doc,t=this.astCache;if(t&&t.doc===e&&t.frontmatter===this.frontmatter&&t.meta===this.meta)return t.ast;let n=oM(this.editor.getJSON(),this.helpers,{frontmatter:this.frontmatter,meta:this.meta});return this.astCache={doc:e,frontmatter:this.frontmatter,meta:this.meta,ast:n},n},async getMarkdown(){let e=this.getAst();if(this.markdownCache?.ast===e)return this.markdownCache.markdown;let t=await DC(e);return this.markdownCache={ast:e,markdown:t},t},stream(){let t=this.editor;if(!t)throw Error(`[comark] editor not yet attached`);return this.streamSession?.abort(),this.streamSession=Wj({editor:t,storage:this,parserOptions:e.parserOptions,streamAutoClose:e.streamAutoClose,canonicalOptions:tM(e.parserOptions),toPmDoc:e=>mM(sM(e,this.helpers),t.schema,this.onError,`stream`),report:e=>lM(this.onError,e,{phase:`stream`})}),this.streamSession}}},onBeforeCreate(){this.storage.editor=this.editor,this.storage.helpers=aM(this.options.specs),this.storage.onError=this.options.onError;let e=this.editor.options;if(typeof e.content==`string`&&e.content!==``){if(e.contentType!==`html`){if(e.contentType===`json`){let t=fM(e.content,this.options.onError,`construct`);e.content=t===void 0?``:t}else{let t=e.content;e.content=``,Cr(t,tM(this.options.parserOptions)).then(e=>{this.editor.isDestroyed||this.editor.commands.setComarkAst(e,{emitUpdate:!0})}).catch(e=>{lM(this.options.onError,e,{phase:`construct`})})}}}else if(OC(e.content)){let t=e.content;e.content=null,queueMicrotask(()=>{this.editor.isDestroyed||this.editor.commands.setComarkAst(t,{emitUpdate:!1})})}this.options.injectStyles&&qj(this.options.injectNonce)},onDestroy(){this.storage.streamSession?.abort(),this.storage.streamSession=null,this.storage.streamBaselineEditable=null},addCommands(){return{setComarkAst:(e,t)=>({commands:n})=>{let r;if(typeof e==`string`){let t=fM(e,this.options.onError,`setComarkAst`);if(t===void 0||!OC(t))return t!==void 0&&lM(this.options.onError,Error("setComarkAst: input is not a Comark AST (missing `nodes` array)"),{phase:`setComarkAst`}),!1;r=t}else r=e;this.storage.frontmatter={...r.frontmatter},this.storage.meta={...r.meta};let i=mM(sM(r,this.storage.helpers),this.editor.schema,this.options.onError,`setComarkAst`);return n.setContent(i,{emitUpdate:t?.emitUpdate??!0,errorOnInvalidContent:t?.errorOnInvalidContent,transactionMeta:t?.transactionMeta})},setComarkMarkdown:(e,t)=>({editor:n})=>(Cr(e,tM(this.options.parserOptions)).then(e=>{n.isDestroyed||n.commands.setComarkAst(e,t)}).catch(e=>{lM(this.options.onError,e,{phase:`setComarkMarkdown`})}),!0),setContent:(e,t)=>n=>{if(uM(n.tr,t?.transactionMeta),OC(e))return this.storage.frontmatter={...e.frontmatter},this.storage.meta={...e.meta},Jj(mM(sM(e,this.storage.helpers),n.editor.schema,this.options.onError,`setContent`),t)(n);if(typeof e!=`string`||e===``||t?.contentType===`html`)return Jj(e,t)(n);if(t?.contentType===`json`){let r=fM(e,this.options.onError,`setContent`);return r!==void 0&&Jj(r,t)(n)}return Cr(e,tM(this.options.parserOptions)).then(e=>{n.editor.isDestroyed||n.editor.commands.setComarkAst(e,{emitUpdate:t?.emitUpdate??!0,errorOnInvalidContent:t?.errorOnInvalidContent,transactionMeta:t?.transactionMeta})}).catch(e=>{lM(this.options.onError,e,{phase:`setContent`})}),!0},insertContent:(e,t)=>n=>{if(uM(n.tr,t?.transactionMeta),OC(e))return Yj(hM(e,this.storage.helpers,t?.inline,n.editor.schema,this.options.onError,`insertContent`),t)(n);if(typeof e!=`string`||e===``||t?.contentType===`html`)return Yj(e,t)(n);if(t?.contentType===`json`){let r=fM(e,this.options.onError,`insertContent`);return r!==void 0&&Yj(r,t)(n)}return Cr(e,tM(this.options.parserOptions)).then(e=>{if(n.editor.isDestroyed)return;let r=hM(e,this.storage.helpers,t?.inline,n.editor.schema,this.options.onError,`insertContent`);n.editor.commands.insertContent(r,t)}).catch(e=>{lM(this.options.onError,e,{phase:`insertContent`})}),!0},insertContentAt:(e,t,n)=>r=>{if(uM(r.tr,n?.transactionMeta),OC(t))return Xj(e,hM(t,this.storage.helpers,n?.inline,r.editor.schema,this.options.onError,`insertContentAt`),n)(r);if(typeof t!=`string`||t===``||n?.contentType===`html`)return Xj(e,t,n)(r);if(n?.contentType===`json`){let i=fM(t,this.options.onError,`insertContentAt`);return i!==void 0&&Xj(e,i,n)(r)}return Cr(t,tM(this.options.parserOptions)).then(t=>{if(r.editor.isDestroyed)return;let i=hM(t,this.storage.helpers,n?.inline,r.editor.schema,this.options.onError,`insertContentAt`);r.editor.commands.insertContentAt(e,i,n)}).catch(e=>{lM(this.options.onError,e,{phase:`insertContentAt`})}),!0}}}});function fM(e,t,n){try{return JSON.parse(e)}catch(e){lM(t,e,{phase:n});return}}function pM(e,t,n,r){if(e.type&&e.type!==Zj&&!t.nodes[e.type])return lM(n,Error(`dropped AST node for disabled type "${e.type}"`),{phase:r}),null;let i={...e};return i.marks&&=i.marks.filter(e=>t.marks[e.type]?!0:(lM(n,Error(`dropped mark for disabled type "${e.type}"`),{phase:r}),!1)),i.content&&=i.content.map(e=>pM(e,t,n,r)).filter(e=>e!==null),i}function mM(e,t,n,r){return pM(e,t,n,r)??{type:Qj}}function hM(e,t,n,r,i,a){let o=mM(sM(e,t),r,i,a);return n?gM(o):o.content??[]}function gM(e){let t=e.content??[],n=[];for(let e of t){let t=e?.content??[];t.length!==0&&(n.length>0&&n.push({type:`hardBreak`}),n.push(...t))}return n}var _M={pmName:`blockquote`,tags:[`blockquote`],toComark(e,t){return[`blockquote`,Cj({},wj(e)),...Ej(e.content,t)]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a=t.parseBlocks(r),o={type:`blockquote`,content:a.length>0?a:[{type:`paragraph`}]};return Object.keys(i).length>0&&(o.attrs={htmlAttrs:i}),o}},vM=[`language`,`filename`,`highlights`,`meta`],yM={pmName:`codeBlock`,tags:[`pre`],toComark(e){let t={};e.attrs?.language&&(t.language=e.attrs.language),e.attrs?.filename!=null&&(t.filename=e.attrs.filename),Array.isArray(e.attrs?.highlights)&&e.attrs.highlights.length>0&&(t.highlights=e.attrs.highlights),e.attrs?.meta!=null&&(t.meta=e.attrs.meta);let n=Cj(t,wj(e)),r=(e.content??[]).map(e=>e.type===`text`?e.text??``:``).join(``),i={};e.attrs?.language&&(i.class=`language-${e.attrs.language}`);let a=e.attrs?.codeHtmlAttrs;if(a)for(let[e,t]of Object.entries(a))t!=null&&(e!==`class`||t!==i.class)&&(i[e]=t);return[`pre`,n,[`code`,i,r]]},fromComark(e,t){let[,n,...r]=e,i=r.find(e=>Array.isArray(e)&&e[0]===`code`),a=``,o;if(i){o=i[1];for(let e of i.slice(2))typeof e==`string`&&(a+=e)}else for(let e of r)typeof e==`string`&&(a+=e);let{semantic:s,htmlAttrs:c}=Sj(n,vM),l={};if(typeof s.language==`string`&&(l.language=s.language),typeof s.filename==`string`&&(l.filename=s.filename),Array.isArray(s.highlights)&&(l.highlights=s.highlights),s.meta!=null&&(l.meta=s.meta),Object.keys(c).length>0&&(l.htmlAttrs=c),o){let e={},t=typeof l.language==`string`?l.language:``;for(let[n,r]of Object.entries(o))n!==`$`&&r!=null&&(n===`class`&&t&&r===`language-${t}`||(e[n]=r));Object.keys(e).length>0&&(l.codeHtmlAttrs=e)}let u={type:`codeBlock`};return Object.keys(l).length>0&&(u.attrs=l),a.length>0&&(u.content=[{type:`text`,text:a}]),u}},bM=[`text`],xM={pmName:`comarkComment`,tags:[],toComark(e){let t=e.attrs?.text??``;return[null,Cj({},wj(e)),t]},fromComark(e){let t=e[2]??``,{htmlAttrs:n}=Sj(e[1],bM),r={text:t};return Object.keys(n).length>0&&(r.htmlAttrs=n),{type:`comarkComment`,attrs:r}}};function SM(e,t,n=`block`){return{pmName:e,tags:[t],context:n,toComark(e){return[t,Cj({},wj(e))]},fromComark(t){let{htmlAttrs:n}=Sj(t[1],[]),r={type:e};return Object.keys(n).length>0&&(r.attrs={htmlAttrs:n}),r}}}function CM(e,t,n=[]){return{pmName:e,tags:[t,...n],toComark(e,n){return[t,Cj({},wj(e)),...n]},fromComark(t){let{htmlAttrs:n}=Sj(t[1],[]);return Object.keys(n).length>0?{type:e,attrs:{htmlAttrs:n}}:{type:e}}}}var wM=SM(`hardBreak`,`br`,`inline`),TM=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`];function EM(e){return Number.isFinite(e)?Math.min(6,Math.max(1,Math.floor(e))):1}var DM={pmName:`heading`,tags:TM,toComark(e,t){let n=EM(Number(e.attrs?.level??1)),r=Cj({},wj(e));return[`h${n}`,r,...t.serializeInlines(e.content)]},fromComark(e,t){let[n,r,...i]=e,a=EM(Number(n.slice(1))),{htmlAttrs:o}=Sj(r,[]),s={level:a};return Object.keys(o).length>0&&(s.htmlAttrs=o),{type:`heading`,attrs:s,content:t.parseInlines(i)}}},OM=SM(`horizontalRule`,`hr`),kM=[`src`,`alt`,`title`,`srcset`,`width`,`height`],AM={pmName:`image`,tags:[`img`],context:`inline`,toComark(e){let t={};return e.attrs?.src!=null&&(t.src=e.attrs.src),e.attrs?.alt!=null&&(t.alt=e.attrs.alt),e.attrs?.title!=null&&(t.title=e.attrs.title),e.attrs?.srcset!=null&&(t.srcset=e.attrs.srcset),e.attrs?.width!=null&&(t.width=String(e.attrs.width)),e.attrs?.height!=null&&(t.height=String(e.attrs.height)),[`img`,Cj(t,wj(e))]},fromComark(e){let{semantic:t,htmlAttrs:n}=Sj(e[1],kM),r={src:t.src??null,alt:t.alt??null,title:t.title??null};return t.srcset!=null&&(r.srcset=t.srcset),t.width!=null&&(r.width=t.width),t.height!=null&&(r.height=t.height),Object.keys(n).length>0&&(r.htmlAttrs=n),{type:`image`,attrs:r}}},jM=()=>({type:`listItem`,content:[{type:`paragraph`}]}),MM={pmName:`listItem`,tags:[`li`],toComark(e,t){return[`li`,Cj({},wj(e)),...Ej(e.content,t)]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a=t.parseBlocks(r);a.length===0&&a.push({type:`paragraph`});let o={type:`listItem`,content:a};return Object.keys(i).length>0&&(o.attrs={htmlAttrs:i}),o}},NM={pmName:`bulletList`,tags:[`ul`],toComark(e,t){return[`ul`,Cj({},wj(e)),...t.serializeBlocks(e.content)]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a=t.parseBlocks(r).filter(e=>e.type===`listItem`),o={type:`bulletList`,content:a.length>0?a:[jM()]};return Object.keys(i).length>0&&(o.attrs={htmlAttrs:i}),o}},PM=[`start`],FM={pmName:`orderedList`,tags:[`ol`],toComark(e,t){let n={},r=e.attrs?.start;return r!=null&&String(r)!==`1`&&(n.start=String(r)),[`ol`,Cj(n,wj(e)),...t.serializeBlocks(e.content)]},fromComark(e,t){let[,n,...r]=e,{semantic:i,htmlAttrs:a}=Sj(n,PM),o={};if(i.start!=null){let e=Number(i.start);Number.isFinite(e)&&(o.start=e)}Object.keys(a).length>0&&(o.htmlAttrs=a);let s=t.parseBlocks(r).filter(e=>e.type===`listItem`),c={type:`orderedList`,content:s.length>0?s:[jM()]};return Object.keys(o).length>0&&(c.attrs=o),c}},IM=CM(`bold`,`strong`,[`b`]),LM=CM(`italic`,`em`,[`i`]),RM=CM(`strike`,`del`,[`s`,`strike`]),zM=CM(`code`,`code`),BM=[`href`,`title`,`target`,`rel`,`class`],VM={pmName:`link`,tags:[`a`],toComark(e,t){let n={href:e.attrs?.href??``};return e.attrs?.title!=null&&e.attrs.title!==``&&(n.title=e.attrs.title),e.attrs?.target!=null&&e.attrs.target!==``&&(n.target=e.attrs.target),e.attrs?.rel!=null&&e.attrs.rel!==``&&(n.rel=e.attrs.rel),e.attrs?.class!=null&&e.attrs.class!==``&&(n.class=e.attrs.class),[`a`,Cj(n,wj(e)),...t]},fromComark(e){let{semantic:t,htmlAttrs:n}=Sj(e[1],BM),r={href:t.href??``,title:t.title??null};return t.target!=null&&(r.target=t.target),t.rel!=null&&(r.rel=t.rel),t.class!=null&&(r.class=t.class),Object.keys(n).length>0&&(r.htmlAttrs=n),{type:`link`,attrs:r}}},HM={pmName:`paragraph`,tags:[`p`],toComark(e,t){let n=Cj({},wj(e)),r=t.serializeInlines(e.content);return Dj(e,r,t)??[`p`,n,...r]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a={type:`paragraph`,content:t.parseInlines(r)};return Object.keys(i).length>0&&(a.attrs={htmlAttrs:i}),a}},UM={pmName:`picture`,tags:[`picture`],context:`inline-block`,toComark(e){let t=Cj({},wj(e)),n=e.attrs?.sources??[],r=e.attrs?.img,i=n.map(e=>[`source`,Sj(e,[]).htmlAttrs]);return r&&i.push([`img`,Sj(r,[]).htmlAttrs]),[`picture`,t,...i]},fromComark(e){let[,t,...n]=e,r=Sj(t,[]).htmlAttrs,i=[],a=null,o=e=>{for(let t of e){if(!Array.isArray(t)||typeof t[0]!=`string`)continue;let[e,n,...r]=t;e===`source`?i.push(Sj(n,[]).htmlAttrs):e===`img`&&a===null?a=Sj(n,[]).htmlAttrs:e===`p`&&o(r)}};o(n);let s={sources:i,img:a};return Object.keys(r).length>0&&(s.htmlAttrs=r),{type:`picture`,attrs:s}}},WM={pmName:`table`,tags:[`table`],toComark(e,t){let n=Cj({},wj(e)),r=(e.content??[]).filter(e=>e.type===`tableRow`),i=e=>(e.content?.length??0)>0&&(e.content??[]).every(e=>e.type===`tableHeader`),a=0;for(;a<r.length&&i(r[a]);)a++;let o=e=>{let n=[];for(let r of e){let e=t.serializeBlocks([r])[0];e&&n.push(e)}return n},s=o(r.slice(0,a)),c=o(r.slice(a)),l=[];return s.length>0&&l.push([`thead`,{},...s]),c.length>0&&l.push([`tbody`,{},...c]),[`table`,n,...l]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a=[];for(let e of r){if(!Array.isArray(e)||e[0]===null)continue;let n=e[0];if(n===`thead`||n===`tbody`){for(let n of e.slice(2))if(Array.isArray(n)&&n[0]===`tr`){let e=t.parseBlocks([n])[0];e&&a.push(e)}}else if(n===`tr`){let n=t.parseBlocks([e])[0];n&&a.push(n)}}let o={type:`table`,content:a.length>0?a:[{type:`tableRow`,content:[{type:`tableCell`,content:[{type:`paragraph`}]}]}]};return Object.keys(i).length>0&&(o.attrs={htmlAttrs:i}),o}},GM={pmName:`tableRow`,tags:[`tr`],toComark(e,t){return[`tr`,Cj({},wj(e)),...t.serializeBlocks(e.content)]},fromComark(e,t){let[,n,...r]=e,{htmlAttrs:i}=Sj(n,[]),a={type:`tableRow`,content:r.map(e=>Array.isArray(e)?t.parseBlocks([e])[0]:null).filter(e=>e!=null)};return Object.keys(i).length>0&&(a.attrs={htmlAttrs:i}),a}},KM=[`colspan`,`rowspan`,`colwidth`,`align`];function qM(e){let t,n=[];for(let r of e.split(`;`)){let e=r.trim();if(e===``)continue;let i=/^text-align\s*:\s*(\S+)/i.exec(e)?.[1];i?t=i.toLowerCase():n.push(e)}return{align:t,rest:n.join(`; `)}}function JM(e,t){let n=typeof e==`string`?qM(e).rest:``,r=`text-align:${t}`;return n?`${r}; ${n}`:r}function YM(e,t){return{pmName:e,tags:[t],toComark(e,n){let r={},i=e.attrs?.colspan,a=e.attrs?.rowspan,o=e.attrs?.colwidth,s=e.attrs?.align;i!=null&&Number(i)!==1&&(r.colspan=Number(i)),a!=null&&Number(a)!==1&&(r.rowspan=Number(a)),o!=null&&(r.colwidth=o);let c={...wj(e)};return typeof s==`string`&&s.length>0&&(c.style=JM(c.style,s)),[t,Cj(r,c),...Ej(e.content,n)]},fromComark(t,n){let[,r,...i]=t,{semantic:a,htmlAttrs:o}=Sj(r,KM),s={};if(a.colspan!=null&&Number(a.colspan)!==1&&(s.colspan=Number(a.colspan)),a.rowspan!=null&&Number(a.rowspan)!==1&&(s.rowspan=Number(a.rowspan)),Array.isArray(a.colwidth)){let e=a.colwidth.map(e=>Number(e)).filter(e=>Number.isFinite(e));e.length>0&&(s.colwidth=e)}let c=typeof a.align==`string`&&a.align.length>0?a.align:void 0;if(typeof o.style==`string`){let{align:e,rest:t}=qM(o.style);e&&!c&&(c=e),t?o.style=t:delete o.style}c&&(s.align=c),Object.keys(o).length>0&&(s.htmlAttrs=o);let l=i.some(e=>Array.isArray(e)&&XM(e[0])),u;if(l)u=n.parseBlocks(i);else{let e=n.parseInlines(i);u=e.length>0?[{type:`paragraph`,content:e}]:[{type:`paragraph`}]}let d={type:e,content:u};return Object.keys(s).length>0&&(d.attrs=s),d}}}function XM(e){return typeof e==`string`?e===`p`||e===`blockquote`||e===`ul`||e===`ol`||e===`pre`||e===`hr`||e===`table`||e===`picture`||e.match(/^h[1-6]$/)!==null:!1}var ZM=YM(`tableHeader`,`th`),QM=YM(`tableCell`,`td`),$M=[`name`],eN={nodes:[HM,DM,_M,NM,FM,MM,yM,OM,AM,UM,WM,GM,ZM,QM,{pmName:`comarkTemplate`,tags:[`template`],toComark(e,t){let n={};return e.attrs?.name!=null&&(n.name=e.attrs.name),[`template`,Cj(n,wj(e)),...Ej(e.content,t)]},fromComark(e,t){let[,n,...r]=e,{semantic:i,htmlAttrs:a}=Sj(n,$M),o={};i.name!=null&&(o.name=i.name),Object.keys(a).length>0&&(o.htmlAttrs=a);let s=t.parseBlocks(r);return{type:`comarkTemplate`,attrs:o,content:s.length>0?s:[{type:`paragraph`}]}}},xM,wM],marks:[IM,LM,RM,zM,VM]},tN=By.create({name:`comarkKit`,addOptions(){return{starterKit:{},table:{},image:{},picture:{},resolveSrc:void 0,components:[],serializer:{injectStyles:!0,injectNonce:void 0},comment:{},template:{}}},addExtensions(){let e=[];if(this.options.starterKit!==!1){let t=this.options.starterKit,n=t.link,r=n!==!1&&{...n,HTMLAttributes:{target:null,rel:null,class:null,...n?.HTMLAttributes}};e.push(sj.configure({codeBlock:!1,underline:!1,...t,link:r}),bj)}this.options.table!==!1&&e.push($T.configure(this.options.table)),this.options.image!==!1&&e.push(zj.configure({inline:!0,resolveSrc:this.options.resolveSrc,...this.options.image})),this.options.picture!==!1&&e.push(Hj.configure({resolveSrc:this.options.resolveSrc,...this.options.picture})),this.options.comment!==!1&&e.push(xj),this.options.template!==!1&&e.push(Uj),e.push(yj);for(let t of this.options.components)e.push(t.extension);return e.push(dM.configure({specs:{nodes:[...eN.nodes,...this.options.components.map(e=>e.spec)],marks:eN.marks},injectStyles:this.options.serializer?.injectStyles??!0,injectNonce:this.options.serializer?.injectNonce,onError:this.options.serializer?.onError,parserOptions:this.options.serializer?.parserOptions,streamAutoClose:this.options.serializer?.streamAutoClose})),e}}),nN=new Set([`blockquote`,`comment`,`doc`,`heading`,`image`,`paragraph`,`picture`,`table`,`template`,`text`]),rN=/^[a-z][a-z0-9-]*$/,iN={autoClose:!1,headingIds:!1};function aN(e,t=e=>Nj(e)){return Object.entries(e??{}).filter(([e])=>rN.test(e)&&!nN.has(e)).map(([e,n])=>t({kind:n.kind??`block`,name:e,props:Object.fromEntries(Object.entries(n.props??{}).map(([e,t])=>[e,t.default===void 0?{type:t.type}:{default:t.default,type:t.type}]))}))}var oN=Object.freeze({starterKit:Object.freeze({undoRedo:!1})});function sN(e){return e!==null&&Object(e)===e&&!Array.isArray(e)}function cN(e){return Array.isArray(e)?`[${e.map(cN).join(`,`)}]`:sN(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${cN(e[t])}`).join(`,`)}}`:JSON.stringify(e??null)}function lN(e,t,n){if(Object.hasOwn(e,t)){let r=e[t];return n===`string`||String(r)!==r?r:n===`number`?Number(r):n===`boolean`?r===``||r===`true`:r}if(!Object.hasOwn(e,`:${t}`))return;let r=e[`:${t}`];if(String(r)!==r)return r;try{return JSON.parse(r)}catch{return r}}function uN(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=r.startsWith(`:`)?r.slice(1):r;t.props?.[e]||(n[r]=i)}for(let[r,i]of Object.entries(t.props??{})){let t=lN(e,r,i.type),a=t===void 0?i.default:t;a!==void 0&&(n[r]=a)}return n}var dN=[`a`,`strong`,`em`,`del`,`code`];function fN(e){let t=[],n=e;for(;Array.isArray(n)&&dN.includes(String(n[0]))&&n.length===3;)t.push([String(n[0]),sN(n[1])?n[1]:{}]),n=n[2];return t.length<2?e:(t.sort(([e],[t])=>dN.indexOf(e)-dN.indexOf(t)),t.reduceRight((e,[t,n])=>[t,n,e],n))}function pN(e,t){let n=[];for(let r of e){if(String(r)===r){let e=n.at(-1);String(e)===e?n[n.length-1]=e+r:n.push(r);continue}if(!Array.isArray(r))continue;let[e,i,...a]=r,o=sN(i)?i:{};if(e===`component`&&!a.length&&!Object.keys(o).length)continue;let s=String(e)===e&&Object.hasOwn(t,e)?t[e]:void 0;n.push(fN([e,s?uN(o,s):o,...pN(a,t)]))}return n}function mN(e,t,n=!0){for(let r of e){if(!Array.isArray(r))continue;let[e,i,...a]=r;String(e)===e&&!t.has(e)&&t.set(e,{block:n,empty:!a.length&&!(sN(i)&&Object.keys(i).length)}),mN(a,t,!1)}}var hN=new Set(`abbr.aside.audio.bdi.bdo.button.cite.data.details.dfn.div.figcaption.figure.form.iframe.ins.kbd.mark.q.samp.section.small.source.sub.summary.sup.time.track.u.var.video.wbr`.split(`.`));function gN(e,t){return e===`input`?`task lists`:e===`span`?`[text]{.class} spans and footnotes`:hN.has(e)?`<${e}> HTML`:t.block?`the ::${e} component`:t.empty?`:${e}:`:`the :${e} component`}function _N(e){return Array.isArray(e)&&String(e[0])===e[0]?e[0]:void 0}function vN(e,t,n){if(e.length!==t.length){let r=_N(e[e.findIndex((e,n)=>cN(e)!==cN(t[n]))]);return r===`ul`||r===`ol`?`lists that follow each other with different markers`:n?`the structure of <${n}>`:r?`the blocks around <${r}>`:`the block structure`}for(let r=0;r<e.length;r++){let i=e[r],a=t[r];if(cN(i)===cN(a))continue;if(!Array.isArray(i)||!Array.isArray(a))return n?`text inside <${n}>`:`text`;let[o,s,...c]=i,[,l,...u]=a;if(o!==a[0])return`<${String(o)}>`;if(cN(s)!==cN(l)){let e=sN(s)?s.id:void 0;return/^h[1-6]$/.test(String(o))&&String(e)===e?`heading ids such as {#${e}}`:`attributes on <${String(o)}>`}return vN(c,u,String(o))}}function yN(e,t,n={}){let r=n.components??{},i=pN(e,r),a=pN(t,r);if(cN(i)===cN(a))return;let o=new Map;mN(a,o);let s=new Map;mN(i,s);let c=[...s.keys()].filter(e=>!o.has(e)),l=[...new Set(c.map(e=>gN(e,s.get(e))))];return l.length||l.push(vN(i,a,void 0)??`the block structure`),{lost:c,constructs:l}}async function bN(e,t,n={}){if(e===t)return;let[r,i]=await Promise.all([Cr(e,iN),Cr(t,iN)]),a=yN(r.nodes,i.nodes,n);return cN(r.frontmatter??{})===cN(i.frontmatter??{})?a:{lost:a?.lost??[],constructs:[`a frontmatter block at the start of the body`,...a?.constructs??[]]}}function xN(e){return`The editor cannot keep ${e.constructs.length>1?`${e.constructs.slice(0,-1).join(`, `)} and ${e.constructs.at(-1)}`:e.constructs[0]}. Edit this body in Source.`}function SN(e,t){return t.endsWith(`
|
|
240
|
+
`)&&!e.endsWith(`
|
|
241
|
+
`)?`${e}\n`:e}function CN(e){let t=aN(e.components),n=()=>[tN.configure({components:t,...oN,serializer:{injectStyles:!1}})],r,i=()=>r??=aM({nodes:[...eN.nodes,...t.map(e=>e.spec)],marks:eN.marks}),a;async function o(e){let t=sM(await Cr(e,iN),i());return a??=D_(n()),a.nodeFromJSON(t.content?.length?t:{type:`doc`,content:[{type:`paragraph`}]}).toJSON()}async function s(e){return await DC(oM(e,i()))}return{extensions:n,fromMarkdown:o,toMarkdown:s,async verify(t){let n=SN(await s(await o(t)),t);if(n===t)return{writable:!0};let r=await bN(t,n,e);return r?{writable:!1,issues:[{field:`body`,message:xN(r),path:[`body`]}]}:{canonical:n,writable:!0}}}}function wN(e){return Object.fromEntries((e??[]).map(e=>[e.name,{kind:e.kind,props:e.props}]))}function TN(e){let t=new Set(aN(wN(e),e=>e.name));return(e??[]).filter(e=>t.has(e.name))}function EN(e){return Object.fromEntries(Object.entries(e.props).flatMap(([e,t])=>t.default===void 0?[]:[[e,t.default]]))}function DN(e){let t=[[{label:`Basic blocks`,type:`label`},{icon:`i-lucide-pilcrow`,keywords:[`paragraph`,`plain`,`p`],kind:`paragraph`,label:`Text`},{description:`#`,icon:`i-lucide-heading-1`,keywords:[`h1`,`title`,`big`],kind:`heading`,label:`Heading 1`,level:1},{description:`##`,icon:`i-lucide-heading-2`,keywords:[`h2`,`subtitle`,`section`],kind:`heading`,label:`Heading 2`,level:2},{description:`###`,icon:`i-lucide-heading-3`,keywords:[`h3`,`subheading`,`small`],kind:`heading`,label:`Heading 3`,level:3},{description:`-`,icon:`i-lucide-list`,keywords:[`ul`,`unordered`,`bullet`,`list`],kind:`bulletList`,label:`Bulleted list`},{description:`1.`,icon:`i-lucide-list-ordered`,keywords:[`ol`,`ordered`,`number`,`list`],kind:`orderedList`,label:`Numbered list`},{description:`>`,icon:`i-lucide-text-quote`,keywords:[`blockquote`,`citation`],kind:`blockquote`,label:`Quote`},{description:"```",icon:`i-lucide-square-code`,keywords:[`code block`,`snippet`,`pre`,`fence`],kind:`codeBlock`,label:`Code`},{description:`---`,icon:`i-lucide-minus`,keywords:[`hr`,`separator`,`line`,`rule`,`horizontal`],kind:`horizontalRule`,label:`Divider`},{icon:`i-lucide-table`,keywords:[`grid`,`rows`,`columns`,`spreadsheet`],kind:`table`,label:`Table`}],[{label:`Media`,type:`label`},{icon:`i-lucide-image`,keywords:[`picture`,`photo`,`img`,`media`,`blob`,`upload`],kind:`image`,label:`Image…`}]];return e.length&&t.push([{label:`Components`,type:`label`},...e.map(e=>({component:e.name,description:e.kind===`inline`?`:${e.name}`:`::${e.name}`,icon:e.kind===`inline`?`i-lucide-text-cursor-input`:`i-lucide-component`,keywords:[e.name,`component`,`mdc`,...e.description?.toLowerCase().split(/\W+/).filter(Boolean)??[]],kind:`component`,label:e.label}))]),t}var ON=[{icon:`i-lucide-pilcrow`,kind:`paragraph`,label:`Text`},{icon:`i-lucide-heading-1`,kind:`heading`,label:`Heading 1`,level:1},{icon:`i-lucide-heading-2`,kind:`heading`,label:`Heading 2`,level:2},{icon:`i-lucide-heading-3`,kind:`heading`,label:`Heading 3`,level:3},{icon:`i-lucide-list`,kind:`bulletList`,label:`Bulleted list`},{icon:`i-lucide-list-ordered`,kind:`orderedList`,label:`Numbered list`},{icon:`i-lucide-text-quote`,kind:`blockquote`,label:`Quote`},{icon:`i-lucide-square-code`,kind:`codeBlock`,label:`Code`}],kN=new Set([`blockquote`,`bulletList`,`codeBlock`,`heading`,`listItem`,`orderedList`,`paragraph`]);function AN(e){let t=/^---\r?\n(?:[\s\S]*?\r?\n)?---(?:\r?\n|$)/.exec(e);return t?{body:e.slice(t[0].length),frontmatter:t[0]}:{body:e,frontmatter:``}}function jN(e){return e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function MN(e,t=typeof __VITEHUB_APP_BASE_URL__>`u`?`/`:__VITEHUB_APP_BASE_URL__){return t===`/`?e:`${t.replace(/\/+$/,``)}${e}`}var NN=we({docs:`https://vitehub.dev/docs/realtime/limits-and-errors`,codes:{REALTIME_DISABLED:{why:({action:e})=>`Realtime is disabled, so \`${e}()\` cannot run.`,fix:"Set `enabled` to `true` on `useRealtimeTiptap()` before you call the method."},REALTIME_DISCONNECTED:{why:({action:e})=>`The realtime document disconnected or changed during \`${e}()\`.`,fix:"Call the method again after the new document connects. Read `synced` to know when it is ready."},REALTIME_INVALID_RESPONSE:{why:({action:e})=>`The realtime server answered \`${e}()\` with a response that the client cannot use.`,fix:"Use the same `@vite-hub/realtime` version on the client and the server, and build again."},REALTIME_MISSING_DOCUMENT:{why:({action:e})=>`\`${e}()\` needs a document, and \`documentId\` is empty.`,fix:"Pass a document path to `useRealtimeTiptap(definition, documentId)` before you call the method."},REALTIME_REQUEST_FAILED:{why:({action:e,message:t,status:n})=>`The realtime \`${e}()\` request failed${n===void 0?``:` with HTTP ${n}`}${t?`: ${t}`:`.`}`,fix:"Read `error.why` for the server message, and `error.cause` for a network error. Retry when the server is available again."},REALTIME_AWARENESS_OWNERSHIP_CONFLICT:{why:`A realtime awareness client id belongs to another peer.`,fix:`Let each editor tab use its own Yjs awareness client. Do not reuse a client id on two connections.`},REALTIME_AWARENESS_TOO_LARGE:{why:`Realtime awareness state exceeds the 8 MiB room quota.`,fix:`Keep less data in awareness state. Store large values in the document or in Workspace.`},REALTIME_DOCUMENT_TOO_LARGE:{why:`The realtime document exceeds the 8 MiB room quota.`,fix:`Split the document into smaller documents, or keep large assets in Workspace or Blob.`},REALTIME_INVALID_AWARENESS:{why:`A realtime awareness update has a state that is not a plain object.`,fix:"Set awareness state to a plain object, for example `awareness.setLocalStateField('user', { name })`."},REALTIME_TOO_MANY_AWARENESS_CLIENTS:{why:`One realtime peer sent more than 1,024 awareness clients.`,fix:`Use one awareness client for each editor tab.`},REALTIME_DOCUMENT_CONFLICT:{why:({problem:e})=>e??`The stored document changed since the realtime room loaded it.`,fix:"Realtime re-seeds the room from the stored document. Listen to `onReset()` to recover text that the room did not save."},REALTIME_INVALID_PERSISTENCE:{why:({name:e,reason:t})=>t===`below-debounce`?"Realtime `persistence.maxWait` must be at least `persistence.debounce`.":`Realtime \`persistence.${e}\` must be a non-negative number of milliseconds.`,fix:"Set `persistence: { debounce: 2_000, maxWait: 10_000 }`, or remove the option to use these defaults."},REALTIME_INVALID_USER:{why:"The realtime identity needs a user `id` that is a non-empty string of at most 256 characters.",fix:"Return a user with an `id` from the Auth session or from `authorize()`."},REALTIME_MISSING_DIGEST:{why:({operation:e})=>e===`save`?`Realtime saves need Workspace file digests, and the Workspace Store did not return one.`:`Realtime checkpoints need a stored document, and the save returned no digest.`,fix:"Use a Workspace Store that returns file digests, or return `digest` from the document adapter `save()`."},REALTIME_AUTHORITY_CONFLICT:{why:({authority:e,preset:t})=>e===`memory`?`Realtime authority "memory" is single-process only, and the ${t} deployment preset runs more than one process.`:`Realtime authority "cloudflare" does not work with the ${t} deployment preset.`,fix:'Set `realtime.authority` to "cloudflare" with a Cloudflare preset, or to "memory" for one Node.js process.'},REALTIME_MISSING_AUTHORITY:{why:`Realtime production builds need one room authority, and ViteHub cannot select one for this deployment.`,fix:'Deploy with a Cloudflare preset to use Durable Objects, or set `realtime.authority` to "memory" for one Node.js process.'}}}),PN=1<<29,FN=Math.floor,IN=Math.abs,LN=(e,t)=>e<t?e:t,RN=(e,t)=>e>t?e:t;Number.isNaN;var zN=Math.pow,BN=e=>e===0?1/e<0:e<0,VN=2**53-1,HN=-(2**53-1),UN=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&FN(e)===e);Number.isNaN,Number.parseInt;var WN=()=>new Set,GN=e=>e[e.length-1],KN=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},qN=Array.from,JN=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},YN=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},XN=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},ZN=Array.isArray,QN=String.fromCharCode;String.fromCodePoint,QN(65535);var $N=e=>e.toLowerCase(),eP=/^\s*/g,tP=e=>e.replace(eP,``),nP=/([A-Z])/g,rP=(e,t)=>tP(e.replace(nP,e=>`${t}${$N(e)}`)),iP=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},aP=typeof TextEncoder<`u`?new TextEncoder:null,oP=aP?e=>aP.encode(e):iP,sP=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});sP&&sP.decode(new Uint8Array).length===1&&(sP=null);var cP=(e,t)=>XN(t,()=>e).join(``),lP=e=>Error(e),uP=()=>{throw lP(`Method unimplemented`)},dP=()=>{throw lP(`Unexpected case`)},fP=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},pP=()=>new fP,mP=e=>{let t=pP();return e(t),gP(t)},hP=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},gP=e=>{let t=new Uint8Array(hP(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},_P=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(RN(n,t)*2),e.cpos=0)},vP=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},yP=vP,bP=(e,t)=>{for(;t>127;)vP(e,128|127&t),t=FN(t/128);vP(e,127&t)},xP=(e,t)=>{let n=BN(t);for(n&&(t=-t),vP(e,(t>63?128:0)|(n?64:0)|63&t),t=FN(t/64);t>0;)vP(e,(t>127?128:0)|127&t),t=FN(t/128)},SP=new Uint8Array(3e4),CP=SP.length/3,wP=aP&&aP.encodeInto?(e,t)=>{if(t.length<CP){let n=aP.encodeInto(t,SP).written||0;bP(e,n);for(let t=0;t<n;t++)vP(e,SP[t])}else EP(e,oP(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;bP(e,r);for(let t=0;t<r;t++)vP(e,n.codePointAt(t))},TP=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=LN(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(RN(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},EP=(e,t)=>{bP(e,t.byteLength),TP(e,t)},DP=(e,t)=>{_P(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},OP=(e,t)=>DP(e,4).setFloat32(0,t,!1),kP=(e,t)=>DP(e,8).setFloat64(0,t,!1),AP=(e,t)=>DP(e,8).setBigInt64(0,t,!1),jP=new DataView(new ArrayBuffer(4)),MP=e=>(jP.setFloat32(0,e),jP.getFloat32(0)===e),NP=(e,t)=>{switch(typeof t){case`string`:vP(e,119),wP(e,t);break;case`number`:UN(t)&&IN(t)<=2147483647?(vP(e,125),xP(e,t)):MP(t)?(vP(e,124),OP(e,t)):(vP(e,123),kP(e,t));break;case`bigint`:vP(e,122),AP(e,t);break;case`object`:if(t===null)vP(e,126);else if(ZN(t)){vP(e,117),bP(e,t.length);for(let n=0;n<t.length;n++)NP(e,t[n])}else if(t instanceof Uint8Array)vP(e,116),EP(e,t);else{vP(e,118);let n=Object.keys(t);bP(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];wP(e,i),NP(e,t[i])}}break;case`boolean`:vP(e,t?120:121);break;default:vP(e,127)}},PP=class extends fP{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&bP(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},FP=e=>{e.count>0&&(xP(e.encoder,e.count===1?e.s:-e.s),e.count>1&&bP(e.encoder,e.count-2))},IP=class{constructor(){this.encoder=new fP,this.s=0,this.count=0}write(e){this.s===e?this.count++:(FP(this),this.count=1,this.s=e)}toUint8Array(){return FP(this),gP(this.encoder)}},LP=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);xP(e.encoder,t),e.count>1&&bP(e.encoder,e.count-2)}},RP=class{constructor(){this.encoder=new fP,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(LP(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return LP(this),gP(this.encoder)}},zP=class{constructor(){this.sarr=[],this.s=``,this.lensE=new IP}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new fP;return this.sarr.push(this.s),this.s=``,wP(e,this.sarr.join(``)),TP(e,this.lensE.toUint8Array()),gP(e)}},BP=lP(`Unexpected end of array`),VP=lP(`Integer out of Range`),HP=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw BP;return new Uint8Array(e.buffer,e.byteOffset+t,n)},UP=(e,t,n)=>{if(t<0||n<0||t+n>e.length)throw BP;return new DataView(e.buffer,e.byteOffset+t,n)},WP=class{constructor(e){this.arr=e,this.pos=0}},GP=e=>new WP(e),KP=e=>e.pos!==e.arr.length,qP=(e,t)=>{let n=HP(e.arr,e.pos,t);return e.pos+=t,n},JP=e=>qP(e,XP(e)),YP=e=>e.arr[e.pos++],XP=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>VN)throw VP}throw BP},ZP=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>VN)throw VP}throw BP},QP=sP?e=>sP.decode(JP(e)):e=>{let t=XP(e);if(t===0)return``;{let n=String.fromCodePoint(YP(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(YP(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},$P=(e,t)=>{let n=UP(e.arr,e.pos,t);return e.pos+=t,n},eF=[e=>void 0,e=>null,ZP,e=>$P(e,4).getFloat32(0,!1),e=>$P(e,8).getFloat64(0,!1),e=>$P(e,8).getBigInt64(0,!1),e=>!1,e=>!0,QP,e=>{let t=XP(e),n={};for(let r=0;r<t;r++){let t=QP(e);n[t]=tF(e)}return n},e=>{let t=XP(e),n=[];for(let r=0;r<t;r++)n.push(tF(e));return n},JP],tF=e=>eF[127-YP(e)](e),nF=class extends WP{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),this.count=KP(this)?XP(this)+1:-1),this.count--,this.s}},rF=class extends WP{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=ZP(this);let e=BN(this.s);this.count=1,e&&(this.s=-this.s,this.count=XP(this)+2)}return this.count--,this.s}},iF=class extends WP{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=ZP(this),t=e&1;this.diff=FN(e/2),this.count=1,t&&(this.count=XP(this)+2)}return this.s+=this.diff,this.count--,this.s}},aF=class{constructor(e){this.decoder=new rF(e),this.str=QP(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};function oF(e){let t=e.slice(0,4096);return new vo(`WORKSPACE_PATH_INVALID`,`[vitehub] Workspace path escapes the workspace root: ${JSON.stringify(t)}.`,{details:{path:t}})}function sF(e){let t=e.toLowerCase().split(`:`,1)[0];return{normalized:t.replace(/[ .]+$/,``),isTraversal:/^(?:\.(?: +[. ]*)?|\.\.(?: +[. ]*)?)$/.test(t)}}function cF(e=``,t={}){let n=e.replace(/\\/g,`/`),r=n.replace(/^\/+/,``).replace(/\/+$/,``),i=r.split(`/`).filter(Boolean);if(!t.allowEmpty&&!r||n.startsWith(`/`)||/^[a-z]:/i.test(n)||n.includes(`\0`)||i.some((e,n)=>{let r=e.toLowerCase(),i=sF(e),a=i.normalized===`.git`||/^git~\d+$/.test(i.normalized)||n===0&&i.normalized===`.vitehub`||n===0&&/^vitehu~\d+$/.test(i.normalized),o=(i.normalized===`.git`||n===0&&i.normalized===`.vitehub`)&&r===i.normalized;return i.isTraversal||a&&(!t.allowReserved||!o)}))throw oF(e);return r}function lF(e){return e===null||Object(e)!==e||Array.isArray(e)?!1:typeof e==`object`}var uF=[`#E11D48`,`#D97706`,`#059669`,`#0891B2`,`#2563EB`,`#7C3AED`,`#C026D3`];function dF(e){try{return String(e)===e}catch{return!1}}function fF(e){if(!dF(e.id)||!e.id||e.id.length>256)throw NN.REALTIME_INVALID_USER();let t=0;for(let n=0;n<e.id.length;n++)t=Math.imul(31,t)+e.id.charCodeAt(n)|0;let n=(dF(e.name)&&e.name||dF(e.email)&&e.email||`Anonymous`).slice(0,256),r={color:uF[Math.abs(t)%uF.length],id:e.id,name:n};return dF(e.image)&&e.image&&e.image.length<=2048&&(r.image=e.image),r}function pF(e){return lF(e)?dF(e.id)&&e.id.length>0&&e.id.length<=256&&dF(e.name)&&e.name.length>0&&e.name.length<=256&&dF(e.color)&&/^#[\da-f]{6}$/i.test(e.color)&&(e.image===void 0||dF(e.image)&&e.image.length<=2048):!1}function mF(e){let t=[];for(let[n,r]of e)if(pF(r.user)){let{color:e,id:i,image:a,name:o}=r.user,s={color:e,id:i,name:o,clientId:n};a!==void 0&&(s.image=a),t.push(s)}return t}var hF=`@workspace`,gF=`REALTIME_SYNC_PENDING`;function _F(e){return e===gF}function vF(e){try{let t=JSON.parse(QP(e));if(!t||typeof t!=`object`||!(`epoch`in t)||!(`type`in t)||typeof t.epoch!=`string`||!t.epoch)return;if(t.type===`session`&&`access`in t&&(t.access===`read`||t.access===`write`))return t.access===`read`&&`reason`in t&&(t.reason===`access`||t.reason===`document`)?{type:`session`,access:t.access,epoch:t.epoch,reason:t.reason}:{type:`session`,access:t.access,epoch:t.epoch};if(t.type===`reset`&&`reason`in t&&(t.reason===`source-changed`||t.reason===`stale`))return{type:`reset`,epoch:t.epoch,reason:t.reason}}catch{}}function yF(e){if(typeof e!=`string`||e.length===0||e.length>4096||e.includes(`\0`)||e.startsWith(`/`)||e.endsWith(`/`)||e.includes(`\\`)||e.includes(`//`)||/^[a-z]:/i.test(e))return!1;try{return cF(e)===e}catch{return!1}}function bF(e){try{let t=JSON.parse(QP(e));if((t.operation===`create`||t.operation===`delete`||t.operation===`update`)&&yF(t.path))return{operation:t.operation,path:t.path};if(t.operation===`move`&&yF(t.from)&&yF(t.to))return{operation:t.operation,from:t.from,to:t.to}}catch{}}function xF(e){let t=pP();return bP(t,4),wP(t,JSON.stringify(e)),gP(t)}function SF(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var CF=SF();function wF(e){CF=e}var TF={exec:()=>null};function EF(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(OF.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var DF=(()=>{try{return!0}catch{return!1}})(),OF={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},kF=/^(?:[ \t]*(?:\n|$))+/,AF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,MF=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,NF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,PF=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,FF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,IF=EF(FF).replace(/bull/g,PF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),LF=EF(FF).replace(/bull/g,PF).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),RF=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,zF=/^[^\n]+/,BF=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,VF=EF(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,BF).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),HF=EF(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,PF).getRegex(),UF=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,WF=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,GF=EF(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,WF).replace(`tag`,UF).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),KF=EF(RF).replace(`hr`,MF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UF).getRegex(),qF={blockquote:EF(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,KF).getRegex(),code:AF,def:VF,fences:jF,heading:NF,hr:MF,html:GF,lheading:IF,list:HF,newline:kF,paragraph:KF,table:TF,text:zF},JF=EF(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,MF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UF).getRegex(),YF={...qF,lheading:LF,table:JF,paragraph:EF(RF).replace(`hr`,MF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,JF).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,UF).getRegex()},XF={...qF,html:EF(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,WF).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:TF,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:EF(RF).replace(`hr`,MF).replace(`heading`,` *#{1,6} *[^
|
|
242
|
+
]`).replace(`lheading`,IF).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ZF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,QF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$F=/^( {2,}|\\)\n(?!\s*$)/,eI=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tI=/[\p{P}\p{S}]/u,nI=/[\s\p{P}\p{S}]/u,rI=/[^\s\p{P}\p{S}]/u,iI=EF(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,nI).getRegex(),aI=/(?!~)[\p{P}\p{S}]/u,oI=/(?!~)[\s\p{P}\p{S}]/u,sI=/(?:[^\s\p{P}\p{S}]|~)/u,cI=EF(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,DF?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),lI=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,uI=EF(lI,`u`).replace(/punct/g,tI).getRegex(),dI=EF(lI,`u`).replace(/punct/g,aI).getRegex(),fI=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,pI=EF(fI,`gu`).replace(/notPunctSpace/g,rI).replace(/punctSpace/g,nI).replace(/punct/g,tI).getRegex(),mI=EF(fI,`gu`).replace(/notPunctSpace/g,sI).replace(/punctSpace/g,oI).replace(/punct/g,aI).getRegex(),hI=EF(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,rI).replace(/punctSpace/g,nI).replace(/punct/g,tI).getRegex(),gI=EF(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,tI).getRegex(),_I=EF(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,rI).replace(/punctSpace/g,nI).replace(/punct/g,tI).getRegex(),vI=EF(/\\(punct)/,`gu`).replace(/punct/g,tI).getRegex(),yI=EF(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),bI=EF(WF).replace(`(?:-->|$)`,`-->`).getRegex(),xI=EF(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,bI).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),SI=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,CI=EF(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,SI).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wI=EF(/^!?\[(label)\]\[(ref)\]/).replace(`label`,SI).replace(`ref`,BF).getRegex(),TI=EF(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,BF).getRegex(),EI=EF(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,wI).replace(`nolink`,TI).getRegex(),DI=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,OI={_backpedal:TF,anyPunctuation:vI,autolink:yI,blockSkip:cI,br:$F,code:QF,del:TF,delLDelim:TF,delRDelim:TF,emStrongLDelim:uI,emStrongRDelimAst:pI,emStrongRDelimUnd:hI,escape:ZF,link:CI,nolink:TI,punctuation:iI,reflink:wI,reflinkSearch:EI,tag:xI,text:eI,url:TF},kI={...OI,link:EF(/^!?\[(label)\]\((.*?)\)/).replace(`label`,SI).getRegex(),reflink:EF(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,SI).getRegex()},AI={...OI,emStrongRDelimAst:mI,emStrongLDelim:dI,delLDelim:gI,delRDelim:_I,url:EF(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,DI).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:EF(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,DI).getRegex()},jI={...AI,br:EF($F).replace(`{2,}`,`*`).getRegex(),text:EF(AI.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},MI={normal:qF,gfm:YF,pedantic:XF},NI={normal:OI,gfm:AI,breaks:jI,pedantic:kI},PI={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},FI=e=>PI[e];function II(e,t){if(t){if(OF.escapeTest.test(e))return e.replace(OF.escapeReplace,FI)}else if(OF.escapeTestNoEncode.test(e))return e.replace(OF.escapeReplaceNoEncode,FI);return e}function LI(e){try{e=encodeURI(e).replace(OF.percentDecode,`%`)}catch{return null}return e}function RI(e,t){let n=e.replace(OF.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(OF.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(OF.slashPipe,`|`);return n}function zI(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function BI(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function VI(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function HI(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function UI(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
243
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
244
|
+
`)}var WI=class{options;rules;lexer;constructor(e){this.options=e||CF}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:zI(e,`
|
|
245
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=UI(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=zI(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:zI(t[0],`
|
|
246
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=zI(t[0],`
|
|
247
|
+
`).split(`
|
|
248
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
249
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
250
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
251
|
+
${s}`:s,r=r?`${r}
|
|
252
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
253
|
+
`+e.join(`
|
|
254
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
255
|
+
`+e.join(`
|
|
256
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
257
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=VI(t[2].split(`
|
|
258
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
259
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
260
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
261
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
262
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
263
|
+
`+l}u=!l.trim(),r+=p+`
|
|
264
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=RI(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
265
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(RI(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
266
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=zI(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=BI(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),HI(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return HI(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},GI=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||CF,this.options.tokenizer=this.options.tokenizer||new WI,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:OF,block:MI.normal,inline:NI.normal};this.options.pedantic?(t.block=MI.pedantic,t.inline=NI.pedantic):this.options.gfm&&(t.block=MI.gfm,t.inline=this.options.breaks?NI.breaks:NI.gfm),this.tokenizer.rules=t}static get rules(){return{block:MI,inline:NI}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(OF.carriageReturn,`
|
|
267
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(OF.tabCharGlobal,` `).replace(OF.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
268
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
269
|
+
`)?``:`
|
|
270
|
+
`)+r.raw,n.text+=`
|
|
271
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
272
|
+
`)?``:`
|
|
273
|
+
`)+r.raw,n.text+=`
|
|
274
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
275
|
+
`)?``:`
|
|
276
|
+
`)+r.raw,a.text+=`
|
|
277
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
278
|
+
`)?``:`
|
|
279
|
+
`)+r.raw,n.text+=`
|
|
280
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},KI=class{options;parser;constructor(e){this.options=e||CF}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(OF.notSpaceStart)?.[0],i=e.replace(OF.endingNewline,``)+`
|
|
281
|
+
`;return r?`<pre><code class="language-`+II(r)+`">`+(n?i:II(i,!0))+`</code></pre>
|
|
282
|
+
`:`<pre><code>`+(n?i:II(i,!0))+`</code></pre>
|
|
283
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
284
|
+
${this.parser.parse(e)}</blockquote>
|
|
285
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
286
|
+
`}hr(e){return`<hr>
|
|
287
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
288
|
+
`+r+`</`+i+`>
|
|
289
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
290
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
291
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
292
|
+
<thead>
|
|
293
|
+
`+t+`</thead>
|
|
294
|
+
`+r+`</table>
|
|
295
|
+
`}tablerow({text:e}){return`<tr>
|
|
296
|
+
${e}</tr>
|
|
297
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
298
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${II(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=LI(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+II(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=LI(e);if(i===null)return II(n);e=i;let a=`<img src="${e}" alt="${II(n)}"`;return t&&(a+=` title="${II(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:II(e.text)}},qI=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},JI=class e{options;renderer;textRenderer;constructor(e){this.options=e||CF,this.options.renderer=this.options.renderer||new KI,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qI}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},YI=class{options;block;constructor(e){this.options=e||CF}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?GI.lex:GI.lexInline}provideParser(e=this.block){return e?JI.parse:JI.parseInline}},XI=class{defaults=SF();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=JI;Renderer=KI;TextRenderer=qI;Lexer=GI;Tokenizer=WI;Hooks=YI;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new KI(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new WI(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new YI;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=YI.passThroughHooks.has(n)?e=>{if(this.defaults.async&&YI.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return GI.lex(e,t??this.defaults)}parser(e,t){return JI.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?GI.lex:GI.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?JI.parse:JI.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?GI.lex:GI.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?JI.parse:JI.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
299
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+II(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},ZI=new XI;function QI(e,t){return ZI.parse(e,t)}QI.options=QI.setOptions=function(e){return ZI.setOptions(e),QI.defaults=ZI.defaults,wF(QI.defaults),QI},QI.getDefaults=SF,QI.defaults=CF,QI.use=function(...e){return ZI.use(...e),QI.defaults=ZI.defaults,wF(QI.defaults),QI},QI.walkTokens=function(e,t){return ZI.walkTokens(e,t)},QI.parseInline=ZI.parseInline,QI.Parser=JI,QI.parser=JI.parse,QI.Renderer=KI,QI.TextRenderer=qI,QI.Lexer=GI,QI.lexer=GI.lex,QI.Tokenizer=WI,QI.Hooks=YI,QI.parse=QI,QI.options,QI.setOptions,QI.use,QI.walkTokens,QI.parseInline,JI.parse,GI.lex;var $I=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function eL(e){return e.flatMap((t,n)=>{if(t.type===`space`||e[n+1]?.type===`space`)return[t];let r=(t.raw||``).match($I);return r?[{...t,raw:(t.raw||``).slice(0,-r[0].length)},{type:`space`,raw:r[0]}]:[t]})}function tL(e,t){let n=t.split(`
|
|
300
|
+
`).flatMap(e=>[e,``]).map(t=>`${e}${t}`).join(`
|
|
301
|
+
`);return n.slice(0,n.length-1)}function nL(e,t){let n=[];return Array.from(e.entries()).forEach(([e,r])=>{if(!t){n.push(e);return}(t.marks||[]).find(t=>t.type===e&&ny(t.attrs,r.attrs))||n.push(e)}),n}function rL(e,t){let n=[];return Array.from(t.entries()).forEach(([t,r])=>{let i=e.get(t);(!i||!ny(i.attrs,r.attrs))&&n.push({type:t,mark:r})}),n}function iL(e,t,n,r){let i=!n,a=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(t,new Map(n.marks.map(e=>[e.type,e]))),s=[];return(i||a||o)&&(n&&n.marks?Array.from(e.entries()).reverse().forEach(([e,t])=>{n.marks.find(n=>n.type===e&&ny(n.attrs,t.attrs))||s.push(e)}):(i||a)&&s.push(...Array.from(e.keys()).reverse())),s}function aL(e,t){let n=``;return Array.from(e.keys()).reverse().forEach(r=>{let i=t(r,e.get(r));i&&(n=i+n)}),e.clear(),n}function oL(e,t,n){let r=``;return Array.from(e.entries()).forEach(([e,i])=>{let a=n(e,i);a&&(r+=a),t.set(e,i)}),r}function sL(e){let t=(e.raw||e.text||``).match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return t?{isTask:!0,checked:t[2].toLowerCase()===`x`,indentLevel:t[1].length}:{isTask:!1,indentLevel:0}}function cL(e,t){return typeof e==`string`?t:`json`}function lL(e){let t=e.map(()=>new Map),n=new Map,r=e=>{let r=n.get(e);r&&(r.indexes.forEach(n=>t[n].set(e,r.text)),n.delete(e))};return e.forEach((e,t)=>{if(e.type!==`text`){Array.from(n.keys()).forEach(r);return}let i=new Set((e.marks||[]).map(e=>e.type));Array.from(n.keys()).filter(e=>!i.has(e)).forEach(r),i.forEach(r=>{let i=n.get(r)||{indexes:[],text:``};i.indexes.push(t),i.text+=e.text||``,n.set(r,i)})}),Array.from(n.keys()).forEach(r),t}var uL=new Set(`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.link.main.map.mark.menu.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.param.picture.pre.progress.q.rp.rt.ruby.s.samp.script.search.section.select.slot.small.source.span.strong.style.sub.summary.sup.svg.circle.clippath.defs.ellipse.foreignobject.g.image.line.lineargradient.mask.path.polygon.polyline.radialgradient.rect.stop.switch.symbol.textpath.tspan.use.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`)),dL=/<\/?([a-zA-Z][\w-]*)/g;function fL(e){let t=[],n;for(;(n=dL.exec(e))!==null;)t.push(n[1].toLowerCase());return t}function pL(e){let t=e.toLowerCase();return!t.includes(`-`)&&!uL.has(t)}function mL(e,t){return fL(e).some(e=>pL(e)?!t.has(e):!1)}var hL=class{constructor(e){var t,n;this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.inlineNodeTypesCache=null,this.lastParseResult=null,this.markedInstance=e?.marked??QI,this.indentStyle=(e==null||(t=e.indentation)==null?void 0:t.style)??`space`,this.indentSize=(e==null||(n=e.indentation)==null?void 0:n.size)??2,this.baseExtensions=e?.extensions||[],e?.markedOptions&&typeof this.markedInstance.setOptions==`function`&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e?.extensions&&(this.baseExtensions=e.extensions,T_(c_(e.extensions)).forEach(e=>this.registerExtension(e)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle===`space`?` `:` `}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e){this.extensions.push(e);let t=d_(Q(e,`code`)),n=e.name,r={name:n,options:e.options,storage:e.storage};t&&this.codeTypes.add(n),this.extensionRanks.has(n)||this.extensionRanks.set(n,this.extensionRanks.size);let i=Q(e,`markdownTokenName`,r)||n,a=Q(e,`parseMarkdown`,r),o=Q(e,`renderMarkdown`,r),s=Q(e,`markdownTokenizer`,r),c=Q(e,`markdownOptions`,r)??null,l={tokenName:i,nodeName:n,parseMarkdown:a,renderMarkdown:o,isIndenting:c?.indentsContent??!1,htmlReopen:c?.htmlReopen,tokenizer:s};if(i&&a){let e=this.registry.get(i)||[];e.push(l),this.registry.set(i,e)}if(o){let e=this.nodeTypeRegistry.get(n)||[];e.push(l),this.nodeTypeRegistry.set(n,e)}s&&this.hasMarked()&&this.registerTokenizer(s)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(e){return{inlineTokens:t=>e.inlineTokens(t),blockTokens:t=>e.blockTokens(t)}}tokenizeInline(e){return(this.activeParseLexer??this.createLexer()).inlineTokens(e)}registerTokenizer(e){if(!this.hasMarked())return;let{name:t,start:n,level:r=`inline`,tokenize:i}=e,a=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this),s;s=n?typeof n==`function`?n:e=>e.indexOf(n):e=>{let t=i(e,[],this.createTokenizerHelpers(this.createLexer()));return t&&t.raw?e.indexOf(t.raw):-1};let c={name:t,level:r,start:s,tokenizer(e,n){let r=this.lexer?a(this.lexer):a(o()),s=i(e,n,r);if(s&&s.type)return{...s,type:s.type||t,raw:s.raw||``,tokens:s.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[c]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){let t=this.getHandlersForToken(e);if(t.length>0)return t[0];let n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){if(!e)return``;let t=this.renderNodes(e,e);return this.isEmptyOutput(t)?``:t}isEmptyOutput(e){return!e||e.trim()===``||e.replace(/ /g,``).replace(/\u00A0/g,``).trim()===``}parse(e){if(!this.hasMarked())throw Error(`No marked instance available for parsing`);let t=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{let t=n.lex(e);return{type:`doc`,content:this.parseTokens(t,!0)}}finally{this.activeParseLexer=t}}parseTokens(e,t=!1){let n=t?eL(e):e,r=n.reduce((e,t,n)=>(t.type!==`space`&&e.push(n),e),[]),i=-1,a=0;return n.flatMap((e,n)=>{for(;a<r.length&&r[a]<n;)i=r[a],a+=1;if(t&&e.type===`space`){let t=r[a]??-1;return this.createImplicitEmptyParagraphsFromSpace(e,i,t)}let o=this.parseToken(e,t);return o===null?[]:Array.isArray(o)?o:[o]})}createImplicitEmptyParagraphsFromSpace(e,t,n){let r=this.countParagraphSeparators(e.raw||``);if(r===0)return[];let i=Math.max(r-(t===-1||n===-1?0:1),0);return Array.from({length:i},()=>({type:`paragraph`,content:[]}))}countParagraphSeparators(e){return(e.replace(/\r\n/g,`
|
|
302
|
+
`).match(/\n\n/g)||[]).length}parseToken(e,t=!1){if(!e.type)return null;if(e.type===`list`)return this.parseListToken(e);let n=this.getHandlersForToken(e.type),r=this.createParseHelpers();if(n.find(t=>{if(!t.parseMarkdown)return!1;let n=t.parseMarkdown(e,r),i=this.normalizeParseResult(n);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e,t)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);let t=e.items.some(e=>sL(e).isTask),n=e.items.some(e=>!sL(e).isTask);if(!t||!n||this.getHandlersForToken(`taskList`).length===0)return this.parseTokenWithHandlers(e);let r=[],i=[],a=null;for(let t=0;t<e.items.length;t+=1){let n=e.items[t],{isTask:o,checked:s,indentLevel:c}=sL(n),l=n;if(o){let e=(n.raw||n.text||``).split(`
|
|
303
|
+
`),t=e[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),r=t?t[2]:``,i=[];if(e.length>1&&e.slice(1).join(`
|
|
304
|
+
`).trim()){let t=e.slice(1),n=t.filter(e=>e.trim());if(n.length>0){let e=Math.min(...n.map(e=>e.length-e.trimStart().length)),r=t.map(t=>t.trim()?t.slice(e):``).join(`
|
|
305
|
+
`).trim();r&&(i=this.markedInstance.lexer(`${r}\n`))}}l={type:`taskItem`,raw:``,mainContent:r,indentLevel:c,checked:s??!1,text:r,tokens:this.tokenizeInline(r),nestedTokens:i}}let u=o?`taskList`:`list`;a===u?i.push(l):(i.length>0&&r.push({type:a,items:i}),i=[l],a=u)}i.length>0&&r.push({type:a,items:i});let o=[];for(let t=0;t<r.length;t+=1){let n=r[t],i={...e,type:n.type,items:n.items},a=this.parseToken(i);a&&(Array.isArray(a)?o.push(...a):o.push(a))}return o.length>0?o:null}parseTokenWithHandlers(e){if(!e.type)return null;let t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(t=>{if(!t.parseMarkdown)return!1;let r=t.parseMarkdown(e,n),i=this.normalizeParseResult(r);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),tokenizeInline:e=>this.tokenizeInline(e),parseChildren:e=>this.parseTokens(e),parseBlockChildren:e=>this.parseTokens(e,!0),createTextNode:(e,t)=>({type:`text`,text:e,marks:t||void 0}),createNode:(e,t,n)=>{let r={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete r.attrs,r},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}parseInlineTokens(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r.type===`text`)t.push({type:`text`,text:sy(r.text||``)});else if(r.type===`escape`)t.push({type:`text`,text:r.text||``});else if(r.type===`html`){let i=(r.raw??r.text??``).toString(),a=/^<\/[\s]*[\w-]+/i.test(i),o=i.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!a&&o&&!/\/>$/.test(i)){let r=o[1],a=this.escapeRegex(r),s=RegExp(`^<\\/\\s*${a}\\b`,`i`),c=-1,l=[i];for(let t=n+1;t<e.length;t+=1){let n=e[t],r=(n.raw??n.text??``).toString();if(l.push(r),n.type===`html`&&s.test(r)){c=t;break}}if(c!==-1){let e=l.join(``),r={type:`html`,raw:e,text:e,block:!1},i=this.parseHTMLToken(r);if(i){let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}n=c;continue}}let s=this.parseHTMLToken(r);if(s){let e=this.normalizeParseResult(s);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else if(r.type){let e=this.getHandlerForToken(r.type);if(e&&e.parseMarkdown){let n=this.createParseHelpers(),i=e.parseMarkdown(r,n);if(this.isMarkResult(i)){let e=this.applyMarkToContent(i.mark,i.content,i.attrs);t.push(...e)}else{let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else r.tokens&&t.push(...this.parseInlineTokens(r.tokens))}}for(let e=t.length-1;e>0;--e){let n=t[e],r=t[e-1];n.type===`text`&&r.type===`text`&&xy(n.marks||[],r.marks||[])&&(r.text=(r.text||``)+(n.text||``),t.splice(e,1))}return t}applyMarkToContent(e,t,n){return t.map(t=>{if(t.type===`text`){let r=t.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...t,marks:[...r,i]}}return{...t,content:t.content?this.applyMarkToContent(e,t.content,n):void 0}})}isMarkResult(e){return e&&typeof e==`object`&&`mark`in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e,t=!1){switch(e.type){case`paragraph`:return{type:`paragraph`,content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`heading`:return{type:`heading`,attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`text`:return{type:`text`,text:sy(e.text||``)};case`html`:return this.parseHTMLToken(e);case`escape`:return{type:`text`,text:e.text||``};case`space`:return null;default:return e.tokens?this.parseTokens(e.tokens,t):null}}parseHTMLToken(e){let t=e.text||e.raw||``;if(!t.trim())return null;if(this.isUnrecognizedHtml(t)||typeof window>`u`||window.DOMParser===void 0)return this.htmlAsLiteralText(t,!!e.block);try{let n=O_(t,this.baseExtensions);if(n.type===`doc`&&n.content){if(e.block)return n.content;let t=this.toInlineContent(n.content);return t.length>0?t:null}return n}catch(e){throw Error(`Failed to parse HTML in markdown: ${e}`)}}toInlineContent(e){let t=this.getInlineNodeTypes();return e.flatMap(e=>e.type&&t.has(e.type)?[e]:e.content?this.toInlineContent(e.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;let e=new Set([`text`]);try{let t=D_(this.baseExtensions);Object.values(t.nodes).forEach(t=>{t.isInline&&e.add(t.name)})}catch{}return this.inlineNodeTypesCache=e,e}isUnrecognizedHtml(e){return mL(e,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;let e=new Set;try{let t=D_(this.baseExtensions),n=t=>{let n=t?.parseDOM;Array.isArray(n)&&n.forEach(t=>{if(typeof t?.tag==`string`){let n=t.tag.match(/^[a-zA-Z][\w-]*/);n&&e.add(n[0].toLowerCase())}})};Object.values(t.nodes).forEach(e=>n(e.spec)),Object.values(t.marks).forEach(e=>n(e.spec))}catch{}return this.schemaParseDomTagsCache=e,e}htmlAsLiteralText(e,t){let n=e.replace(/\s+$/,``);return n?t?{type:`paragraph`,content:[{type:`text`,text:n}]}:{type:`text`,text:n}:null}encodeTextForMarkdown(e,t,n){return n?.type!=null&&this.codeTypes.has(n.type)||(t.marks||[]).some(e=>this.codeTypes.has(typeof e==`string`?e:e.type))?e:this.escapeMarkdownSyntax(uy(e))}escapeMarkdownSyntax(e){return e.replace(/([\\`*_[\]~])/g,`\\$1`)}renderNodeToMarkdown(e,t,n=0,r=0,i={}){if(e.type===`text`)return this.encodeTextForMarkdown(e.text||``,e,t);if(!e.type)return``;let a=this.getHandlerForToken(e.type);if(!a)return``;let o=Array.isArray(t?.content)&&n>0?t.content[n-1]:void 0,s={renderChildren:(t,i)=>{let o=a.isIndenting?r+1:r;return!Array.isArray(t)&&t.content?this.renderNodes(t.content,e,i||``,n,o):this.renderNodes(t,e,i||``,n,o)},renderChild:(t,n)=>{let i=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(t,e,n,i)},indent:e=>this.indentString+e,wrapInBlock:tL},c={index:n,level:r,parentType:t?.type,previousNode:o,meta:{parentAttrs:t?.attrs,...i}};return a.renderMarkdown?.call(a,e,s,c)||``}renderNodes(e,t,n=``,r=0,i=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,i):e.type?this.renderNodeToMarkdown(e,t,r,i):``}renderNodesWithMarkBoundaries(e,t,n=``,r=0){let i=[],a=new Map,o=new Set,s=new Map,c=lL(e);return e.forEach((n,l)=>{let u=l<e.length-1?e[l+1]:null;if(n.type){if(n.type===`text`){let e=this.encodeTextForMarkdown(n.text||``,n,t),r=new Map((n.marks||[]).map(e=>[e.type,e])),d=this.getMarksToOpenForSerialization(a,r,u),f=nL(r,u);if(e.length>0&&e.trim().length===0&&r.size>0){let e=new Set(f.filter(e=>!a.has(e)));e.size>0&&(r=new Map(Array.from(r).filter(([t])=>!e.has(t))),d=this.getMarksToOpenForSerialization(a,r,u),f=nL(r,u))}let p=f.filter(e=>a.has(e)),m=p.length>0&&d.length>0,h=``;if(f.length>0&&!m){let t=e.match(/(\s+)$/);t&&(h=t[1],e=e.slice(0,-h.length))}m||f.slice().reverse().forEach(t=>{if(!a.has(t))return;let n=r.get(t),i=this.getMarkClosing(t,n,s.get(t),c[l]?.get(t));i&&(e+=i),a.has(t)&&(a.delete(t),s.delete(t))});let g=``;if(d.length>0){let t=e.match(/^(\s+)/);t&&(g=t[1],e=e.slice(g.length))}d.forEach(({type:t,mark:n})=>{let r=o.has(t)?`html`:`markdown`,i=this.getMarkOpening(t,n,r,c[l]?.get(t));i&&(e=i+e),s.set(t,r),o.delete(t)}),m||d.slice().reverse().forEach(({type:e,mark:t})=>{a.set(e,t)}),e=g+e;let _;if(m){let e=new Set((u?.marks||[]).map(e=>e.type));d.forEach(({type:t})=>{e.has(t)&&this.getHtmlReopenTags(t)&&o.add(t)});let t=Array.from(a.keys()),n=p.slice().sort((e,n)=>t.indexOf(n)-t.indexOf(e));_=[...d.map(e=>e.type),...n]}else _=iL(a,r,u,this.markSetsEqual.bind(this));let v=``;if(_.length>0){let t=e.match(/(\s+)$/);t&&(v=t[1],e=e.slice(0,-v.length))}_.forEach(t=>{let n=a.get(t)??r.get(t),i=this.getMarkClosing(t,n,s.get(t),c[l]?.get(t));i&&(e+=i),a.delete(t),s.delete(t)}),e+=v,e+=h,i.push(e)}else{let e=new Set((n.marks||[]).map(e=>e.type)),o=new Map,u=new Map;a.forEach((t,n)=>{e.has(n)&&(o.set(n,t),u.set(n,s.get(n)??`markdown`))});let d=aL(a,(e,t)=>this.getMarkClosing(e,t,s.get(e),c[l-1]?.get(e)));s.clear();let f=this.renderNodeToMarkdown(n,t,l,r),p=n.type===`hardBreak`?``:oL(o,a,(e,t)=>{let n=u.get(e)??`markdown`;return s.set(e,n),this.getMarkOpening(e,t,n,c[l+1]?.get(e))});i.push(d+f+p)}}}),i.join(n)}getMarkOpening(e,t,n=`markdown`,r){if(n===`html`)return this.getHtmlReopenTags(e)?.open||``;let i=this.getHandlersForNodeType(e),a=i.length>0?i[0]:void 0;if(!a||!a.renderMarkdown)return``;let o=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,s={type:e,attrs:t.attrs||{},content:[{type:`text`,text:o}]};try{let e=a.renderMarkdown(s,{renderChildren:()=>o,renderChild:()=>o,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{markText:r}}),t=e.indexOf(o);return t>=0?e.substring(0,t):``}catch(t){throw Error(`Failed to get mark opening for ${e}: ${t}`)}}getMarkClosing(e,t,n=`markdown`,r){if(n===`html`)return this.getHtmlReopenTags(e)?.close||``;let i=this.getHandlersForNodeType(e),a=i.length>0?i[0]:void 0;if(!a||!a.renderMarkdown)return``;let o=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,s={type:e,attrs:t.attrs||{},content:[{type:`text`,text:o}]};try{let e=a.renderMarkdown(s,{renderChildren:()=>o,renderChild:()=>o,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{markText:r}}),t=e.indexOf(o),n=t+33;return t>=0?e.substring(n):``}catch(t){throw Error(`Failed to get mark closing for ${e}: ${t}`)}}getHtmlReopenTags(e){let t=this.getHandlersForNodeType(e);return(t.length>0?t[0]:void 0)?.htmlReopen}markSetsEqual(e,t){return e.size===t.size&&Array.from(e.entries()).every(([e,n])=>{let r=t.get(e);return r&&ny(n.attrs,r.attrs)})}getMarksToOpenForSerialization(e,t,n){let r=rL(e,t);if(r.length<=1)return r;let i=n?.marks||[],a=(e,t)=>i.some(n=>n.type===e&&ny(n.attrs,t)),o=(e,t)=>{let n=this.extensionRanks.get(e.type)??2**53-1,r=this.extensionRanks.get(t.type)??2**53-1;return n===r?e.type.localeCompare(t.type):r-n},s=r.filter(e=>!a(e.type,e.mark.attrs)).sort(o),c=r.filter(e=>a(e.type,e.mark.attrs)).sort(o);return[...s,...c]}},gL=By.create({name:`markdown`,addOptions(){return{indentation:{style:`space`,size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!t?.contentType||cL(e,t?.contentType)!==`markdown`||!this.editor.markdown)return jv.setContent(e,t);let n=this.editor.markdown.parse(e);return jv.setContent(n,t)},insertContent:(e,t)=>{if(!t?.contentType||cL(e,t?.contentType)!==`markdown`||!this.editor.markdown)return jv.insertContent(e,t);let n=this.editor.markdown.parse(e);return jv.insertContent(n,t)},insertContentAt:(e,t,n)=>{if(!n?.contentType||cL(t,n?.contentType)!==`markdown`||!this.editor.markdown)return jv.insertContentAt(e,t,n);let r=this.editor.markdown.parse(t);return jv.insertContentAt(e,r,n)}}},addStorage(){return{manager:new hL({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new hL({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||cL(this.editor.options.content,this.editor.options.contentType)!==`markdown`)return;if(!this.editor.markdown)throw Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!=`string`)throw Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');let e=this.editor.markdown.parse(this.editor.options.content);e.content?.length&&(this.editor.options.content=e)}}),_L=/^---\r?\n(?:---(?:\r?\n|$)|([\s\S]*?)\r?\n---(?:\r?\n|$))/,vL=lb.create({name:`frontmatter`,priority:1e3,atom:!0,selectable:!1,addAttributes(){return{value:{default:null}}},parseHTML(){return[{tag:`pre[data-frontmatter]`,getAttrs:e=>({value:e.hasAttribute(`data-frontmatter-empty`)?null:e.getAttribute(`data-frontmatter-value`)||``})}]},renderHTML({node:e}){return[`pre`,{"data-frontmatter":``,"data-frontmatter-empty":e.attrs.value===null?``:void 0,"data-frontmatter-value":e.attrs.value??void 0,contenteditable:`false`},e.attrs.value??``]},markdownTokenName:`frontmatter`,markdownTokenizer:{name:`frontmatter`,level:`block`,start:e=>_L.test(e)?0:-1,tokenize(e,t){if(t.length)return;let n=_L.exec(e);if(n)return{type:`frontmatter`,raw:n[0],text:n[1]}}},parseMarkdown(e,t){return t.createNode(`frontmatter`,{value:e.text??null})},renderMarkdown(e){return e.attrs?.value===null?`---
|
|
306
|
+
---`:`---\n${e.attrs?.value||``}\n---`}}),yL=wE.extend({content:`frontmatter? block+`});function bL(){return new XI}function xL(e={}){return[cj.configure({document:!1,trailingNode:e.collaborative!==!0&&void 0,undoRedo:!1}),yL,dj,$T,vL,gL.configure({marked:bL()})]}var SL=Object.freeze({body:`body`,fields:`fields`,status:`status`});function CL(e){return typeof e==`string`?e:null}function wL(e){let t=e.getMap(SL.status),n=t.get(`issues`),r=t.get(`savedBy`),i={issues:Array.isArray(n)?n:[],savedBy:r&&!Array.isArray(r)&&r instanceof Object?r:null};return{digest:CL(t.get(`digest`)),error:CL(t.get(`error`)),issues:i.issues,savedAt:CL(t.get(`savedAt`)),savedBy:i.savedBy}}var TL=Date.now,EL=()=>new Map,DL=e=>{let t=EL();return e.forEach((e,n)=>{t.set(n,e)}),t},OL=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},kL=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},AL=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},jL=class{constructor(){this._observers=EL()}on(e,t){return OL(this._observers,e,WN).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return qN((this._observers.get(e)||EL()).values()).forEach(e=>e(...t))}destroy(){this._observers=EL()}},ML=class{constructor(){this._observers=EL()}on(e,t){OL(this._observers,e,WN).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return qN((this._observers.get(e)||EL()).values()).forEach(e=>e(...t))}destroy(){this._observers=EL()}},NL=Symbol(`Equality`),PL=(e,t)=>e===t||!!e?.[NL]?.(t)||!1,FL=e=>typeof e==`object`,IL=Object.assign,LL=Object.keys,RL=(e,t)=>{for(let n in e)t(e[n],n)},zL=(e,t)=>{let n=[];for(let r in e)n.push(t(e[r],r));return n},BL=e=>LL(e).length,VL=e=>{for(let t in e)return!1;return!0},HL=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},UL=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),WL=(e,t)=>e===t||BL(e)===BL(t)&&HL(e,(e,n)=>(e!==void 0||UL(t,n))&&PL(t[n],e)),GL=Object.freeze,KL=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&KL(e[t])}return GL(e)},qL=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&qL(e,t,n+1)}},JL=e=>e,YL=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[NL]!=null)return e[NL](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!YL(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(BL(e)!==BL(t))return!1;for(let n in e)if(!UL(e,n)||!YL(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!YL(e[n],t[n]))return!1;break;default:return!1}return!0},XL=(e,t)=>t.includes(e);crypto.subtle;var ZL=crypto.getRandomValues.bind(crypto),QL=Math.random,$L=()=>ZL(new Uint32Array(1))[0],eR=e=>e[FN(QL()*e.length)],tR=`10000000-1000-4000-8000-100000000000`,nR=()=>tR.replace(/[018]/g,e=>(e^$L()&15>>e/4).toString(16)),rR=e=>new Promise(e);Promise.all.bind(Promise);var iR=e=>e===void 0?null:e,aR=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},oR=!0;try{typeof localStorage<`u`&&localStorage&&(aR=localStorage,oR=!1)}catch{}var sR=aR,cR=e=>oR||addEventListener(`storage`,e),lR=e=>oR||removeEventListener(`storage`,e),uR=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,dR=typeof window<`u`&&typeof document<`u`&&!uR;typeof navigator<`u`&&/Mac/.test(navigator.platform);var fR,pR=[],mR=()=>{if(fR===void 0){if(uR){fR=EL();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&fR.set(t,``),t=r):t===null?pR.push(r):(fR.set(t,r),t=null)}t!==null&&fR.set(t,``)}else typeof location==`object`?(fR=EL(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);fR.set(`--${rP(t,`-`)}`,n),fR.set(`-${rP(t,`-`)}`,n)}})):fR=EL()}return fR},hR=e=>mR().has(e),gR=e=>iR(uR?{}[e.toUpperCase().replaceAll(`-`,`_`)]:sR.getItem(e)),_R=e=>hR(`--`+e)||gR(e)!==null,vR=_R(`production`),yR=uR&&XL({}.FORCE_COLOR,[`true`,`1`,`2`])||!hR(`--no-colors`)&&!_R(`no-color`)&&(!uR||process.stdout.isTTY)&&(!uR||hR(`--color`)||gR(`COLORTERM`)!==null||(gR(`TERM`)||``).includes(`color`)),bR=e=>new Uint8Array(e),xR=e=>new Uint8Array(e),SR=e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=QN(e[n]);return btoa(t)},CR=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),wR=e=>{let t=atob(e),n=bR(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},TR=e=>new Uint8Array(Buffer.from(e,`base64`)),ER=dR?SR:CR,DR=dR?wR:TR,OR=e=>{let t=bR(e.byteLength);return t.set(e),t},kR=e=>mP(t=>NP(t,e)),AR=class{constructor(e,t){this.left=e,this.right=t}},jR=(e,t)=>new AR(e,t),MR=e=>e.next()>=.5,NR=(e,t,n)=>FN(e.next()*(n+1-t)+t),PR=(e,t,n)=>FN(e.next()*(n+1-t)+t),FR=(e,t,n)=>PR(e,t,n),IR=e=>QN(FR(e,97,122)),LR=(e,t=0,n=20)=>{let r=FR(e,t,n),i=``;for(let t=0;t<r;t++)i+=IR(e);return i},RR=(e,t)=>t[FR(e,0,t.length-1)],zR=Symbol(`0schema`),BR=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(cP(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
307
|
+
`)}},VR=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[NL]?PL(e,t):ZN(e)?JN(e,e=>YN(t,t=>VR(e,t))):FL(e)?HL(e,(e,n)=>VR(e,t[n])):!1,HR=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),VR(t,n)}equals(e){return this.constructor===e.constructor&&YL(this.shape,e.shape)}[zR](){return!0}[NL](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){uP()}get nullable(){return xz(this,Iz)}get optional(){return new $R(this)}cast(e){return Bz(e,this),e}expect(e){return Bz(e,this),e}},UR=class extends HR{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},WR=(e,t=null)=>new UR(e,t);WR(UR);var GR=class extends HR{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},KR=e=>new GR(e);WR(GR);var qR=class extends HR{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},JR=(...e)=>new qR(e),YR=WR(qR),XR=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),ZR=e=>{if(jz.check(e))return[XR(e)];if(YR.check(e))return e.shape.map(e=>e+``);if(Az.check(e))return[`[+-]?\\d+.?\\d*`];if(Mz.check(e))return[`.*`];if(Sz.check(e))return e.shape.map(ZR).flat(1);dP()};WR(class extends HR{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(ZR).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var QR=Symbol(`optional`),$R=class extends HR{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[QR](){return!0}},ez=WR($R),tz=class extends HR{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new tz,WR(tz);var nz=class e extends HR{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):HL(this.shape,(n,r)=>{let i=this._isPartial&&!UL(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},rz=e=>new nz(e),iz=WR(nz),az=KR(e=>e!=null&&(e.constructor===Object||e.constructor==null)),oz=class extends HR{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&HL(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},sz=(e,t)=>new oz(e,t),cz=WR(oz),lz=class extends HR{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&HL(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},uz=(...e)=>new lz(e);WR(lz);var dz=class extends HR{constructor(e){super(),this.shape=e.length===1?e[0]:new bz(e)}check(e,t){let n=ZN(e)&&JN(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},fz=(...e)=>new dz(e),pz=WR(dz),mz=KR(e=>ZN(e)),hz=class extends HR{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},gz=(e,t=null)=>new hz(e,t);WR(hz);var _z=gz(HR),vz=WR(class extends HR{constructor(e){super(),this.len=e.length-1,this.args=uz(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),yz=KR(e=>typeof e==`function`);WR(class extends HR{constructor(e){super(),this.shape=e}check(e,t){let n=JN(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var bz=class extends HR{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=YN(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},xz=(...e)=>e.findIndex(e=>Sz.check(e))>=0?xz(...e.map(e=>zz(e)).map(e=>Sz.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new bz(e),Sz=WR(bz),Cz=()=>!0,wz=KR(Cz),Tz=WR(GR,e=>e.shape===Cz),Ez=KR(e=>typeof e==`bigint`),Dz=KR(e=>e===Ez),Oz=KR(e=>typeof e==`symbol`);KR(e=>e===Oz);var kz=KR(e=>typeof e==`number`),Az=KR(e=>e===kz),jz=KR(e=>typeof e==`string`),Mz=KR(e=>e===jz),Nz=KR(e=>typeof e==`boolean`),Pz=KR(e=>e===Nz),Fz=JR(void 0);WR(qR,e=>e.shape.length===1&&e.shape[0]===void 0),JR(void 0);var Iz=JR(null),Lz=WR(qR,e=>e.shape.length===1&&e.shape[0]===null);WR(Uint8Array),WR(UR,e=>e.shape===Uint8Array);var Rz=xz(kz,jz,Iz,Fz,Ez,Nz,Oz);(()=>{let e=fz(wz),t=sz(jz,wz),n=xz(kz,jz,Iz,Nz,e,t);return e.shape=n,t.shape.values=n,n})();var zz=e=>{if(_z.check(e))return e;if(az.check(e)){let t={};for(let n in e)t[n]=zz(e[n]);return rz(t)}if(mz.check(e))return xz(...e.map(zz));if(Rz.check(e))return JR(e);if(yz.check(e))return WR(e);dP()},Bz=vR?()=>{}:(e,t)=>{let n=new BR;if(!t.check(e,n))throw lP(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Vz=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:zz(e),h:t}),this}else(e){return this.if(wz,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw lP(`Unhandled pattern`)}}},Hz=(e=>new Vz(e))(wz).if(Az,(e,t)=>NR(t,HN,VN)).if(Mz,(e,t)=>LR(t)).if(Pz,(e,t)=>MR(t)).if(Dz,(e,t)=>BigInt(NR(t,HN,VN))).if(Sz,(e,t)=>Uz(t,RR(t,e.shape))).if(iz,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(ez.check(i)){if(MR(t))continue;i=i.shape}n[r]=Hz(i,t)}return n}).if(pz,(e,t)=>{let n=[],r=PR(t,0,42);for(let i=0;i<r;i++)n.push(Uz(t,e.shape));return n}).if(YR,(e,t)=>RR(t,e.shape)).if(Lz,(e,t)=>null).if(vz,(e,t)=>{let n=Uz(t,e.res);return()=>n}).if(Tz,(e,t)=>Uz(t,RR(t,[kz,jz,Iz,Fz,Ez,Nz,fz(kz),sz(xz(`a`,`b`,`c`),kz)]))).if(cz,(e,t)=>{let n={},r=NR(t,0,3);for(let i=0;i<r;i++){let r=Uz(t,e.shape.keys);n[r]=Uz(t,e.shape.values)}return n}).done(),Uz=(e,t)=>Hz(zz(t),e),Wz=typeof document<`u`?document:{};KR(e=>e.nodeType===Yz),typeof DOMParser<`u`&&new DOMParser,KR(e=>e.nodeType===Kz),KR(e=>e.nodeType===qz);var Gz=e=>kL(e,(e,t)=>`${t}:${e};`).join(``),Kz=Wz.ELEMENT_NODE,qz=Wz.TEXT_NODE;Wz.CDATA_SECTION_NODE,Wz.COMMENT_NODE;var Jz=Wz.DOCUMENT_NODE;Wz.DOCUMENT_TYPE_NODE;var Yz=Wz.DOCUMENT_FRAGMENT_NODE;KR(e=>e.nodeType===Jz);var Xz=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),Zz=(e,t)=>new Xz(setTimeout(t,e)),Qz=Symbol,$z=Qz(),eB=Qz(),tB=Qz(),nB=Qz(),rB=Qz(),iB=Qz(),aB=Qz(),oB=Qz(),sB=Qz(),cB=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};TL();var lB={[$z]:jR(`font-weight`,`bold`),[eB]:jR(`font-weight`,`normal`),[tB]:jR(`color`,`blue`),[rB]:jR(`color`,`green`),[nB]:jR(`color`,`grey`),[iB]:jR(`color`,`red`),[aB]:jR(`color`,`purple`),[oB]:jR(`color`,`orange`),[sB]:jR(`color`,`black`)},uB=yR?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=EL(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=lB[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=Gz(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:cB,dB=(...e)=>{console.log(...uB(e)),pB.forEach(t=>t.print(e))},fB=(...e)=>{console.warn(...uB(e)),e.unshift(oB),pB.forEach(t=>t.print(e))},pB=WN(),mB=e=>({[Symbol.iterator](){return this},next:e}),hB=(e,t)=>mB(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),gB=(e,t)=>mB(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),_B=class{constructor(e,t){this.clock=e,this.len=t}},vB=class{constructor(){this.clients=new Map}},yB=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])LV(e,i,o.clock,o.len,n)}}),bB=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=FN((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},xB=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&bB(n,t.clock)!==null},SB=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new _B(r.clock,RN(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},CB=e=>{let t=new vB;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)KN(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return SB(t),t},wB=(e,t,n,r)=>{OL(e.clients,t,()=>[]).push(new _B(n,r))},TB=()=>new vB,EB=e=>{let t=TB();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new _B(i,a))}}r.length>0&&t.clients.set(n,r)}),t},DB=(e,t)=>{bP(e.restEncoder,t.clients.size),qN(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),bP(e.restEncoder,t);let r=n.length;bP(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},OB=e=>{let t=new vB,n=XP(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=XP(e.restDecoder),r=XP(e.restDecoder);if(r>0){let i=OL(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new _B(e.readDsClock(),e.readDsLen()))}}return t},kB=(e,t,n)=>{let r=new vB,i=XP(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=XP(e.restDecoder),a=XP(e.restDecoder),o=n.clients.get(i)||[],s=kV(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&wB(r,i,s,a-s);let e=jV(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,eW(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,eW(t,c,a-c.id.clock)),c.delete(t))}else wB(r,i,n,a-n)}}if(r.clients.size>0){let e=new zB;return bP(e.restEncoder,0),DB(e,r),e.toUint8Array()}return null},AB=$L,jB=class e extends jL{constructor({guid:e=nR(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=AB(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new DV,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=rR(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>rR(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&GV(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(qN(this.subdocs).map(e=>e.guid))}transact(e,t=null){return GV(this,e,t)}get(e,t=xH){let n=OL(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==xH&&r!==t){if(r===xH){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}throw Error(`Type with the name ${e} has already been defined with a different constructor`)}return n}getArray(e=``){return this.get(e,HH)}getText(e=``){return this.get(e,lU)}getMap(e=``){return this.get(e,GH)}getXmlElement(e=``){return this.get(e,mU)}getXmlFragment(e=``){return this.get(e,fU)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,qN(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,GV(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},MB=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return XP(this.restDecoder)}readDsLen(){return XP(this.restDecoder)}},NB=class extends MB{readLeftID(){return uV(XP(this.restDecoder),XP(this.restDecoder))}readRightID(){return uV(XP(this.restDecoder),XP(this.restDecoder))}readClient(){return XP(this.restDecoder)}readInfo(){return YP(this.restDecoder)}readString(){return QP(this.restDecoder)}readParentInfo(){return XP(this.restDecoder)===1}readTypeRef(){return XP(this.restDecoder)}readLen(){return XP(this.restDecoder)}readAny(){return tF(this.restDecoder)}readBuf(){return OR(JP(this.restDecoder))}readJSON(){return JSON.parse(QP(this.restDecoder))}readKey(){return QP(this.restDecoder)}},PB=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=XP(this.restDecoder),this.dsCurrVal}readDsLen(){let e=XP(this.restDecoder)+1;return this.dsCurrVal+=e,e}},FB=class extends PB{constructor(e){super(e),this.keys=[],XP(e),this.keyClockDecoder=new iF(JP(e)),this.clientDecoder=new rF(JP(e)),this.leftClockDecoder=new iF(JP(e)),this.rightClockDecoder=new iF(JP(e)),this.infoDecoder=new nF(JP(e),YP),this.stringDecoder=new aF(JP(e)),this.parentInfoDecoder=new nF(JP(e),YP),this.typeRefDecoder=new rF(JP(e)),this.lenDecoder=new rF(JP(e))}readLeftID(){return new cV(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new cV(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return tF(this.restDecoder)}readBuf(){return JP(this.restDecoder)}readJSON(){return tF(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},IB=class{constructor(){this.restEncoder=pP()}toUint8Array(){return gP(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){bP(this.restEncoder,e)}writeDsLen(e){bP(this.restEncoder,e)}},LB=class extends IB{writeLeftID(e){bP(this.restEncoder,e.client),bP(this.restEncoder,e.clock)}writeRightID(e){bP(this.restEncoder,e.client),bP(this.restEncoder,e.clock)}writeClient(e){bP(this.restEncoder,e)}writeInfo(e){yP(this.restEncoder,e)}writeString(e){wP(this.restEncoder,e)}writeParentInfo(e){bP(this.restEncoder,+!!e)}writeTypeRef(e){bP(this.restEncoder,e)}writeLen(e){bP(this.restEncoder,e)}writeAny(e){NP(this.restEncoder,e)}writeBuf(e){EP(this.restEncoder,e)}writeJSON(e){wP(this.restEncoder,JSON.stringify(e))}writeKey(e){wP(this.restEncoder,e)}},RB=class{constructor(){this.restEncoder=pP(),this.dsCurrVal=0}toUint8Array(){return gP(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,bP(this.restEncoder,t)}writeDsLen(e){e===0&&dP(),bP(this.restEncoder,e-1),this.dsCurrVal+=e}},zB=class extends RB{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new RP,this.clientEncoder=new IP,this.leftClockEncoder=new RP,this.rightClockEncoder=new RP,this.infoEncoder=new PP(yP),this.stringEncoder=new zP,this.parentInfoEncoder=new PP(yP),this.typeRefEncoder=new IP,this.lenEncoder=new IP}toUint8Array(){let e=pP();return bP(e,0),EP(e,this.keyClockEncoder.toUint8Array()),EP(e,this.clientEncoder.toUint8Array()),EP(e,this.leftClockEncoder.toUint8Array()),EP(e,this.rightClockEncoder.toUint8Array()),EP(e,gP(this.infoEncoder)),EP(e,this.stringEncoder.toUint8Array()),EP(e,gP(this.parentInfoEncoder)),EP(e,this.typeRefEncoder.toUint8Array()),EP(e,this.lenEncoder.toUint8Array()),TP(e,gP(this.restEncoder)),gP(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(+!!e)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){NP(this.restEncoder,e)}writeBuf(e){EP(this.restEncoder,e)}writeJSON(e){NP(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},BB=(e,t,n,r)=>{r=RN(r,t[0].id.clock);let i=jV(t,r);bP(e.restEncoder,t.length-i),e.writeClient(n),bP(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},VB=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{kV(t,n)>e&&r.set(n,e)}),OV(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),bP(e.restEncoder,r.size),qN(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{BB(e,t.clients.get(n),n,r)})},HB=(e,t)=>{let n=EL(),r=XP(e.restDecoder);for(let i=0;i<r;i++){let r=XP(e.restDecoder),i=Array(r),a=e.readClient(),o=XP(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new CU(uV(a,o),t),o+=t;break}case 10:{let t=XP(e.restDecoder);i[n]=new sW(uV(a,o),t),o+=t;break}default:{let s=!(r&192),c=new rW(uV(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,iW(e,r));i[n]=c,o+=c.length}}}}return n},UB=(e,t,n)=>{let r=[],i=qN(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new DV,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==sW){let i=OL(d,u.id.client,()=>kV(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,kV(t,a)),f();else{u=e.refs[e.i++];continue}}else(i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new zB;return VB(e,s,new Map),bP(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},WB=(e,t)=>VB(e,t.doc.store,t.beforeState),GB=(e,t,n,r=new FB(e))=>GV(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=UB(e,i,HB(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<kV(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=tH([o.update,a.update])}}else i.pendingStructs=a;let s=kB(r,e,i);if(i.pendingDs){let t=new FB(GP(i.pendingDs));XP(t.restDecoder);let n=kB(t,e,i);i.pendingDs=s&&n?tH([s,n]):s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,KB(e.doc,t)}},n,!1),KB=(e,t,n,r=FB)=>{let i=GP(t);GB(i,e,n,new r(i))},qB=(e,t,n)=>KB(e,t,n,NB),JB=(e,t,n=new Map)=>{VB(e,t.store,n),DB(e,EB(t.store))},YB=(e,t=new Uint8Array([0]),n=new zB)=>{JB(n,e,QB(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(nH(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===LB)return $V(r.map((e,t)=>t===0?e:sH(e)));if(n.constructor===zB)return tH(r)}return r[0]},XB=(e,t)=>YB(e,t,new LB),ZB=e=>{let t=new Map,n=XP(e.restDecoder);for(let r=0;r<n;r++){let n=XP(e.restDecoder),r=XP(e.restDecoder);t.set(n,r)}return t},QB=e=>ZB(new MB(GP(e))),$B=(e,t)=>(bP(e.restEncoder,t.size),qN(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{bP(e.restEncoder,t),bP(e.restEncoder,n)}),e),eV=(e,t)=>$B(e,OV(t.store)),tV=(e,t=new RB)=>(e instanceof Map?$B(t,e):eV(t,e),t.toUint8Array()),nV=e=>tV(e,new IB),rV=class{constructor(){this.l=[]}},iV=()=>new rV,aV=(e,t)=>e.l.push(t),oV=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},sV=(e,t,n)=>qL(e.l,[t,n]),cV=class{constructor(e,t){this.client=e,this.clock=t}},lV=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,uV=(e,t)=>new cV(e,t),dV=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw dP()},fV=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},pV=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},mV=e=>new pV(e.type==null?null:uV(e.type.client,e.type.clock),e.tname??null,e.item==null?null:uV(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),hV=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},gV=(e,t,n=0)=>new hV(e,t,n),_V=(e,t,n)=>{let r=null,i=null;return e._item===null?i=dV(e):r=uV(e._item.id.client,e._item.id.clock),new pV(r,i,t,n)},vV=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return _V(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return _V(e,uV(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return _V(e,r.lastId,n);r=r.right}return _V(e,null,n)},yV=(e,t)=>{let n=MV(e,t);return{item:n,diff:t.clock-n.id.clock}},bV=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(kV(r,i.client)<=i.clock)return null;let e=n?QU(r,i):yV(r,i),t=e.item;if(!(t instanceof rW))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(kV(r,a.client)<=a.clock)return null;let{item:e}=n?QU(r,a):{item:MV(r,a)};if(e instanceof rW&&e.content instanceof XU)c=e.content.type;else return null}else throw dP();l=s>=0?c._length:0}return gV(c,l,e.assoc)},xV=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&lV(e.item,t.item)&&lV(e.type,t.type)&&e.assoc===t.assoc,SV=class{constructor(e,t){this.ds=e,this.sv=t}},CV=(e,t)=>new SV(e,t);CV(TB(),new Map);var wV=e=>CV(EB(e.store),OV(e.store)),TV=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!xB(t.ds,e.id),EV=(e,t)=>{let n=OL(e.meta,EV,WN),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<kV(r,n)&&PV(e,uV(n,t))}),yB(e,t.ds,e=>{}),n.add(t))},DV=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},OV=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},kV=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},AV=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw dP()}n.push(t)},jV=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=FN(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=FN((n+r)/2)}throw dP()},MV=(e,t)=>{let n=e.clients.get(t.client);return n[jV(n,t.clock)]},NV=(e,t,n)=>{let r=jV(t,n),i=t[r];return i.id.clock<n&&i instanceof rW?(t.splice(r+1,0,eW(e,i,n-i.id.clock)),r+1):r},PV=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[NV(e,n,t.clock)]},FV=(e,t,n)=>{let r=t.clients.get(n.client),i=jV(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==CU&&r.splice(i+1,0,eW(e,a,n.clock-a.id.clock+1)),a},IV=(e,t,n)=>{let r=e.clients.get(t.id.client);r[jV(r,t.id.clock)]=n},LV=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=NV(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&NV(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},RV=class{constructor(e,t,n){this.doc=e,this.deleteSet=new vB,this.beforeState=OV(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},zV=(e,t)=>t.deleteSet.clients.size===0&&!AL(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(SB(t.deleteSet),WB(e,t),DB(e,t.deleteSet),!0),BV=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&OL(e.changed,t,WN).add(n)},VV=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof rW&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},HV=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=jV(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof rW&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},UV=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=LN(r.length-1,1+jV(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+VV(r,e)}})},WV=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{SB(a),n.afterState=OV(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&e.push(()=>{t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),sV(r._dEH,t,n)})}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&oU(n)})}),qL(e,[])}finally{r.gc&&HV(a,i,r.gcFilter),UV(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=RN(jV(e,r),1);for(let t=e.length-1;t>=n;)t-=1+VV(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=jV(r,n);a+1<r.length&&VV(r,a+1)>1||a>0&&VV(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(dB(oB,$z,`[yjs] `,eB,iB,`Changed the client-id because another client seems to be using it.`),r.clientID=AB()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new LB;zV(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new zB;zV(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):WV(e,t+1)}}},GV=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new RV(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&WV(i,0)}}return o},KV=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},qV=(e,t,n)=>{yB(e,n.deletions,n=>{n instanceof rW&&t.scope.some(t=>t===e.doc||fV(t,n))&&$U(n,!1)})},JV=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;GV(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;yB(n,o.insertions,e=>{if(e instanceof rW){if(e.redone!==null){let{item:t,diff:i}=QU(r,e.id);i>0&&(t=PV(n,uV(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||fV(t,e))&&c.push(e)}}),yB(n,o.deletions,e=>{e instanceof rW&&a.some(t=>t===n.doc||fV(t,e))&&!xB(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=nW(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},YV=class extends jL{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=ZN(e)?e[0].doc:e instanceof jB?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new vB;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&wB(i,n,r,a)});let a=TL(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=CB([t.deletions,e.deleteSet]),t.insertions=CB([t.insertions,i])}else r.push(new KV(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),yB(e,e.deleteSet,t=>{t instanceof rW&&this.scope.some(n=>n===e.doc||fV(n,t))&&$U(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.destroy=this.destroy.bind(this),this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,this.destroy)}addToScope(e){let t=new Set(this.scope);e=ZN(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof xH?e.doc!==this.doc:e!==this.doc)&&fB(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>qV(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>qV(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=JV(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=JV(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),this.doc.off(`destroy`,this.destroy),super.destroy()}};function*XV(e){let t=XP(e.restDecoder);for(let n=0;n<t;n++){let t=XP(e.restDecoder),n=e.readClient(),r=XP(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=XP(e.restDecoder);yield new sW(uV(n,r),t),r+=t}else if(31&t){let i=!(t&192),a=new rW(uV(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,iW(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new CU(uV(n,r),t),r+=t}}}}var ZV=class{constructor(e,t){this.gen=XV(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===sW);return this.curr}},QV=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},$V=e=>tH(e,NB,LB),eH=(e,t)=>{if(e.constructor===CU){let{client:n,clock:r}=e.id;return new CU(uV(n,r+t),e.length-t)}if(e.constructor===sW){let{client:n,clock:r}=e.id;return new sW(uV(n,r+t),e.length-t)}{let n=e,{client:r,clock:i}=n.id;return new rW(uV(r,i+t),null,uV(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},tH=(e,t=FB,n=zB)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(GP(e))),i=r.map(e=>new ZV(e,!0)),a=null,o=new n,s=new QV(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===sW?1:-1:n}return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)iH(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock){if(a.struct.constructor===sW)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{iH(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new sW(uV(t,a.struct.id.clock+a.struct.length),e),offset:0}}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===sW?a.struct.length-=t:n=eH(n,t)),a.struct.mergeWith(n)||(iH(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==sW;n=e.next())iH(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(iH(s,a.struct,a.offset),a=null),aH(s),DB(o,CB(r.map(e=>OB(e)))),o.toUint8Array()},nH=(e,t,n=FB,r=zB)=>{let i=QB(t),a=new r,o=new QV(a),s=new n(GP(e)),c=new ZV(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===sW){c.next();continue}if(e.id.clock+e.length>n)for(iH(o,e,RN(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)iH(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return aH(o),DB(a,OB(s)),a.toUint8Array()},rH=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:gP(e.encoder.restEncoder)}),e.encoder.restEncoder=pP(),e.written=0)},iH=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&rH(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),bP(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},aH=e=>{rH(e);let t=e.encoder.restEncoder;bP(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];bP(t,r.written),TP(t,r.restEncoder)}},oH=(e,t,n,r)=>{let i=new n(GP(e)),a=new ZV(i,!1),o=new r,s=new QV(o);for(let e=a.curr;e!==null;e=a.next())iH(s,t(e),0);return aH(s),DB(o,OB(i)),o.toUint8Array()},sH=e=>oH(e,JL,FB,LB),cH=`You must not compute changes after the event-handler fired.`,lH=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||=uH(this.currentTarget,this.target)}deletes(e){return xB(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw lP(cH);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r)){if(e!==null&&this.deletes(e))i=`delete`,a=GN(e.content.getContent());else return}else e!==null&&this.deletes(e)?(i=`update`,a=GN(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=GN(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw lP(cH);let t=this.target,n=WN(),r=WN(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},uH=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},dH=()=>{fB(`Invalid access: Add Yjs type to a document before reading data.`)},fH=80,pH=0,mH=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=pH++}},hH=e=>{e.timestamp=pH++},gH=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=pH++},_H=(e,t,n)=>{if(e.length>=fH){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return gH(r,t,n),r}{let r=new mH(t,n);return e.push(r),r}},vH=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>IN(t-e.index)<IN(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,hH(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&IN(n.index-i)<r.parent.length/fH?(gH(n,r,i),n):_H(e._searchMarker,r,i)},yH=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=RN(t,i.index+n))}},bH=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;OL(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;sV(r._eH,n,t)},xH=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=iV(),this._dEH=iV(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw uP()}clone(){throw uP()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){aV(this._eH,e)}observeDeep(e){aV(this._dEH,e)}unobserve(e){oV(this._eH,e)}unobserveDeep(e){oV(this._dEH,e)}toJSON(){}},SH=(e,t,n)=>{e.doc??dH(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},CH=e=>{e.doc??dH();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},wH=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&TV(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},TH=(e,t)=>{let n=0,r=e._start;for(e.doc??dH();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},EH=(e,t)=>{let n=[];return TH(e,(r,i)=>{n.push(t(r,i,e))}),n},DH=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},OH=(e,t)=>{e.doc??dH();let n=vH(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},kH=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new rW(uV(o,kV(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new RU(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new rW(uV(o,kV(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new wU(new Uint8Array(n))),i.integrate(e,0);break;case jB:i=new rW(uV(o,kV(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new kU(n)),i.integrate(e,0);break;default:if(n instanceof xH)i=new rW(uV(o,kV(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new XU(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},AH=()=>lP(`Length exceeded!`),jH=(e,t,n,r)=>{if(n>t._length)throw AH();if(n===0)return t._searchMarker&&yH(t._searchMarker,n,r.length),kH(e,t,null,r);let i=n,a=vH(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&PV(e,uV(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&yH(t._searchMarker,i,r.length),kH(e,t,o,r)},MH=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return kH(e,t,r,n)},NH=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=vH(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&PV(e,uV(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&PV(e,uV(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw AH();t._searchMarker&&yH(t._searchMarker,i,-a+r)},PH=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},FH=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new RU([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new RU([r]);break;case Uint8Array:s=new wU(r);break;case jB:s=new kU(r);break;default:if(r instanceof xH)s=new XU(r);else throw Error(`Unexpected content type`)}new rW(uV(o,kV(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},IH=(e,t)=>{e.doc??dH();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},LH=e=>{let t={};return e.doc??dH(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},RH=(e,t)=>{e.doc??dH();let n=e._map.get(t);return n!==void 0&&!n.deleted},zH=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&TV(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},BH=e=>(e.doc??dH(),hB(e._map.entries(),e=>!e[1].deleted)),VH=class extends lH{},HH=class e extends xH{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof xH?e.clone():e)),t}get length(){return this.doc??dH(),this._length}_callObserver(e,t){super._callObserver(e,t),bH(this,e,new VH(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):GV(this.doc,n=>{jH(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):GV(this.doc,t=>{MH(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):GV(this.doc,n=>{NH(n,this,e,t)})}get(e){return OH(this,e)}toArray(){return CH(this)}slice(e=0,t=this.length){return SH(this,e,t)}toJSON(){return this.map(e=>e instanceof xH?e.toJSON():e)}map(e){return EH(this,e)}forEach(e){TH(this,e)}[Symbol.iterator](){return DH(this)}_write(e){e.writeTypeRef(UU)}},UH=e=>new HH,WH=class extends lH{constructor(e,t,n){super(e,t),this.keysChanged=n}},GH=class e extends xH{constructor(e){super(),this._prelimContent=null,this._prelimContent=e===void 0?new Map:new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof xH?e.clone():e)}),t}_callObserver(e,t){bH(this,e,new WH(this,e,t))}toJSON(){this.doc??dH();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof xH?r.toJSON():r}}),e}get size(){return[...BH(this)].length}keys(){return gB(BH(this),e=>e[0])}values(){return gB(BH(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return gB(BH(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??dH(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):GV(this.doc,t=>{PH(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):GV(this.doc,n=>{FH(n,this,e,t)}),t}get(e){return IH(this,e)}has(e){return RH(this,e)}clear(){this.doc===null?this._prelimContent.clear():GV(this.doc,e=>{this.forEach(function(t,n,r){PH(e,r,n)})})}_write(e){e.writeTypeRef(WU)}},KH=e=>new GH,qH=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&WL(e,t),JH=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&dP(),this.right.content.constructor){case NU:this.right.deleted||QH(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length)}this.left=this.right,this.right=this.right.right}},YH=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case NU:t.right.deleted||QH(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&PV(e,uV(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length)}t.left=t.right,t.right=t.right.right}return t},XH=(e,t,n,r)=>{let i=new Map,a=r?vH(t,n):null;return a?YH(e,new JH(a.p.left,a.p,a.index,i),n-a.index):YH(e,new JH(null,t._start,0,i),n)},ZH=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===NU&&qH(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new rW(uV(a,kV(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new NU(o,r));l.integrate(e,0),n.right=l,n.forward()})},QH=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},$H=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===NU&&qH(t[e.right.content.key]??null,e.right.content.value));)e.forward()},eU=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!qH(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new rW(uV(a,kV(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new NU(s,c)),n.right.integrate(e,0),n.forward()}}return o},tU=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;$H(n,i);let s=eU(e,t,n,i),c=r.constructor===String?new BU(r):r instanceof xH?new XU(r):new jU(r),{left:l,right:u,index:d}=n;t._searchMarker&&yH(t._searchMarker,n.index,c.getLength()),u=new rW(uV(o,kV(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),ZH(e,t,n,s)},nU=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;$H(n,i);let s=eU(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===NU));){if(!n.right.deleted)switch(n.right.content.constructor){case NU:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(qH(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&PV(e,uV(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
|
|
308
|
+
`;n.right=new rW(uV(o,kV(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new BU(i)),n.right.integrate(e,0),n.forward()}ZH(e,t,n,s)},rU=(e,t,n,r,i)=>{let a=t,o=EL();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===NU){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case NU:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&QH(i,n);break}}}t=t.right}return s},iU=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===NU){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},aU=e=>{let t=0;return GV(e.doc,n=>{let r=e._start,i=e._start,a=EL(),o=DL(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case NU:QH(o,i.content);break;default:t+=rU(n,r,i,a,o),a=DL(o),r=i}i=i.right}}),t},oU=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&LV(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===NU&&e.constructor!==CU&&t.add(e.parent)})}GV(n,n=>{yB(e,e.deleteSet,e=>{if(e instanceof CU||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===NU?t.add(r):iU(n,e)});for(let e of t)aU(e)})},sU=(e,t,n)=>{let r=n,i=DL(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case XU:case jU:case BU:n<t.right.length&&PV(e,uV(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e)}t.forward()}a&&rU(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&yH(o._searchMarker,t.index,-r+n),t},cU=class extends lH{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];GV(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},VL(o)||(e.attributes=IL({},o))),c=0}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case XU:case jU:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case BU:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case NU:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(qH(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),qH(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;qH(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(qH(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),QH(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},lU=class e extends xH{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??dH(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new cU(this,e,t);bH(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??dH();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===BU&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):GV(this.doc,n=>{let r=new JH(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
309
|
+
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&tU(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&sU(n,r,a.delete):nU(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??dH();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(TV(s,e)||t!==void 0&&TV(s,t))switch(s.content.constructor){case BU:{let r=i.get(`ychange`);e!==void 0&&!TV(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!TV(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case XU:case jU:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case NU:TV(s,e)&&(c(),QH(i,s.content))}s=s.right}c()};return e||t?GV(a,n=>{e&&EV(n,e),t&&EV(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):GV(r,r=>{let i=XH(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),tU(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):GV(r,r=>{let i=XH(r,this,e,!n);tU(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):GV(n,n=>{sU(n,XH(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):GV(r,r=>{let i=XH(r,this,e,!1);i.right!==null&&nU(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):GV(this.doc,t=>{PH(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):GV(this.doc,n=>{FH(n,this,e,t)})}getAttribute(e){return IH(this,e)}getAttributes(){return LH(this)}_write(e){e.writeTypeRef(GU)}},uU=e=>new lU,dU=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??dH()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===mU||t.constructor===fU)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},fU=class e extends xH{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof xH?e.clone():e)),t}get length(){return this.doc??dH(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new dU(this,e)}querySelector(e){e=e.toUpperCase();let t=new dU(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),qN(new dU(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){bH(this,e,new gU(this,t,e))}toString(){return EH(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),TH(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):GV(this.doc,n=>{jH(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)GV(this.doc,n=>{let r=e&&e instanceof xH?e._item:e;kH(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw lP(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):GV(this.doc,n=>{NH(n,this,e,t)})}toArray(){return CH(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return OH(this,e)}slice(e=0,t=this.length){return SH(this,e,t)}forEach(e){TH(this,e)}_write(e){e.writeTypeRef(qU)}},pU=e=>new fU,mU=class e extends fU{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return RL(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof xH?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):GV(this.doc,t=>{PH(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):GV(this.doc,n=>{FH(n,this,e,t)})}getAttribute(e){return IH(this,e)}hasAttribute(e){return RH(this,e)}getAttributes(e){return e?zH(this,e):LH(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return TH(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(KU),e.writeKey(this.nodeName)}},hU=e=>new mU(e.readKey()),gU=class extends lH{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},_U=class e extends GH{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(JU),e.writeKey(this.hookName)}},vU=e=>new _U(e.readKey()),yU=class e extends lU{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(YU)}},bU=e=>new yU,xU=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw uP()}mergeWith(e){return!1}write(e,t,n){throw uP()}integrate(e,t){throw uP()}},SU=0,CU=class extends xU{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),AV(e.doc.store,this)}write(e,t){e.writeInfo(SU),e.writeLen(this.length-t)}getMissing(e,t){return null}},wU=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw uP()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},TU=e=>new wU(e.readBuf()),EU=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){wB(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}},DU=e=>new EU(e.readLen()),OU=(e,t)=>new jB({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),kU=class e{constructor(e){e._item&&console.error(`This document was already integrated as a sub-document. You should create a second instance instead with the same guid.`),this.doc=e;let t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new e(OU(this.doc.guid,this.opts))}splice(e){throw uP()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},AU=e=>new kU(OU(e.readString(),e.readAny())),jU=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw uP()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},MU=e=>new jU(e.readJSON()),NU=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw uP()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},PU=e=>new NU(e.readKey(),e.readJSON()),FU=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},IU=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new FU(n)},LU=gR(`node_env`)===`development`,RU=class e{constructor(e){this.arr=e,LU&&KL(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},zU=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new RU(n)},BU=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}},VU=e=>new BU(e.readString()),HU=[UH,KH,uU,hU,pU,vU,bU],UU=0,WU=1,GU=2,KU=3,qU=4,JU=5,YU=6,XU=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw uP()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},ZU=e=>new XU(HU[e.readTypeRef()](e)),QU=(e,t)=>{let n=t,r=0,i;do r>0&&(n=uV(n.client,n.clock+r)),i=MV(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof rW);return{item:i,diff:r}},$U=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},eW=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new rW(uV(r,i+n),t,uV(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=uV(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},tW=(e,t)=>YN(e,e=>xB(e.deletions,t)),nW=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return PV(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||nW(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=PV(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:PV(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:PV(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||xB(r,d.right.id)||tW(a.undoStack,d.right.id)||tW(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=PV(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=p._map.get(t.parentSub)||null)}let m=uV(c,kV(s,c)),h=new rW(m,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=m,$U(h,!0),h.integrate(e,0),h},rW=class e extends xU{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=kV(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=kV(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===cV&&this.id.client!==this.parent.client&&this.parent.clock>=kV(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=FV(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=PV(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===CU||this.right&&this.right.constructor===CU)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===cV){let e=MV(n,this.parent);this.parent=e.constructor===CU?null:e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=FV(e,e.doc.store,uV(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),lV(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(lV(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(MV(e.doc.store,n.origin)))r.has(MV(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null){let e=this.left.right;this.right=e,this.left.right=this}else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),AV(e.doc.store,this),this.content.integrate(e,this),BV(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new CU(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:uV(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&lV(e.origin,this.lastId)&&this.right===e&&lV(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),wB(e.deleteSet,this.id.client,this.id.clock,this.length),BV(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw dP();this.content.gc(e),t?IV(e,this,new CU(this.id,this.length)):this.content=new EU(this.length)}write(e,t){let n=t>0?uV(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=dV(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===cV?(e.writeParentInfo(!1),e.writeLeftID(t)):dP();i!==null&&e.writeString(i)}this.content.write(e,t)}},iW=(e,t)=>aW[t&31](e),aW=[()=>{dP()},DU,IU,TU,VU,MU,PU,ZU,zU,AU,()=>{dP()}],oW=10,sW=class extends xU{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor&&(this.length+=e.length,!0)}integrate(e,t){dP()}write(e,t){e.writeInfo(oW),bP(e.restEncoder,this.length-t)}getMissing(e,t){return null}},cW=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},lW=`__ $YJS$ __`;cW[lW]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),cW[lW]=!0;var uW=3e4,dW=class extends ML{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=TL();this.getLocalState()!==null&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&3e4<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&fW(this,t,`timeout`)},FN(uW/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:TL()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),YL(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},fW=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:TL()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},pW=(e,t,n=e.states)=>{let r=t.length,i=pP();bP(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;bP(i,r),bP(i,s),wP(i,JSON.stringify(o))}return gP(i)},mW=(e,t,n)=>{let r=GP(t),i=TL(),a=[],o=[],s=[],c=[],l=XP(r);for(let t=0;t<l;t++){let t=XP(r),n=XP(r),l=JSON.parse(QP(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(YL(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},hW=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},gW=/[\uD800-\uDBFF]/,_W=/[\uDC00-\uDFFF]/,vW=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&gW.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&_W.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},yW=(e,t)=>e>>>t|e<<32-t,bW=e=>yW(e,2)^yW(e,13)^yW(e,22),xW=e=>yW(e,6)^yW(e,11)^yW(e,25),SW=e=>yW(e,7)^yW(e,18)^e>>>3,CW=e=>yW(e,17)^yW(e,19)^e>>>10,wW=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),TW=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),EW=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(TW),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,t=this._W;for(let e=16;e<64;e++)t[e]=CW(t[e-2])+t[e-7]+SW(t[e-15])+t[e-16];let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7];for(let e=0,u,d;e<64;e++)u=l+xW(o)+(o&s^~o&c)+wW[e]+t[e]>>>0,d=bW(n)+(n&r^n&i^r&i)>>>0,l=c,c=s,s=o,o=a+u>>>0,a=i,i=r,r=n,n=u+d>>>0;e[0]+=n,e[1]+=r,e[2]+=i,e[3]+=a,e[4]+=o,e[5]+=s,e[6]+=c,e[7]+=l}digest(e){let t=0;for(;t+56<=e.length;){let n=0;for(;n<16&&t+3<e.length;n++)this._W[n]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!=0){for(this._W.fill(0,n,16);t<e.length;)this._W[n]|=e[t]<<(3-t%4)*8,t++;this._W[n]|=128<<(3-t%4)*8}this._updateHash()}let n=t%64!=0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let n=3;n>=0&&t<e.length;n--)this._W[r]|=e[t++]<<n*8;n||(this._W[r-(t%4==0?0:1)]|=128<<(3-t%4)*8),this._W[14]=e.byteLength/PN,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let e=0;e<this._H.length;e++)for(let t=0;t<4;t++)i[e*4+t]=this._H[e]>>>(3-t)*8;return i}},DW=e=>new EW().digest(e),OW=new Pl(`y-sync`),kW=new Pl(`y-undo`),AW=new Pl(`yjs-cursor`),jW=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},MW=e=>ER(jW(DW(kR(e)))),NW=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!xB(t.ds,e.id),PW=[{light:`#ecd44433`,dark:`#ecd444`}],FW=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=WN();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,eR(t))}return e.get(n)},IW=(e,{colors:t=PW,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new HW(e,a),c=new jl({props:{editable:e=>{let t=OW.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:OW,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(OW);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return e.docChanged&&(t.addToHistory=e.getMeta(`addToHistory`)!==!1),t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&Zz(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=kW.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},OW)})}},destroy:()=>{s.destroy()}})});return c},LW=(e,t,n,r)=>{if(n==null||!(r===null||n>1&&r<=1||AG(t,e,n,r)))return r;let i=OG(t,e,n);return i===null?r:i},RW=(e,t,n,r)=>{if(t!==null&&t.anchor!==null&&t.head!==null){if(t.type===`all`)e.setSelection(new _l(e.doc));else if(t.type===`node`){let r=wG(n.doc,n.type,t.anchor,n.mapping);r!==null&&e.setSelection(zW(e,r))}else if(t.type===`nodeRange`){let r=BW(e,wG(n.doc,n.type,t.anchor,n.mapping),wG(n.doc,n.type,t.head,n.mapping),t.depth);r!==null&&e.setSelection(r)}else{let i=wG(n.doc,n.type,t.anchor,n.mapping),a=wG(n.doc,n.type,t.head,n.mapping);r!=null&&(i=LW(e.doc,r,t.absAnchor,i),a=LW(e.doc,r,t.absHead,a)),i===null&&(i=a),a===null&&(a=i),i!==null&&a!==null&&e.setSelection(Z.between(e.doc.resolve(i),e.doc.resolve(a)))}}},zW=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?hl.create(e.doc,t):Z.near(n)},BW=(e,t,n,r)=>{if(t===null||n===null)return null;let i=Math.min(Math.max(t,0),e.doc.content.size),a=Math.min(Math.max(n,0),e.doc.content.size);try{let t=ul.fromJSON(e.doc,{type:`nodeRange`,anchor:i,head:a,depth:r});return t.ranges.length?t:Z.near(e.doc.resolve(i))}catch{return Z.near(e.doc.resolve(i))}},VW=(e,t)=>{let n=t.selection.jsonID;return{type:n,depth:n===`nodeRange`?t.selection.depth:void 0,anchor:xG(t.selection.anchor,e.type,e.mapping),head:xG(t.selection.head,e.type,e.mapping),absAnchor:t.selection.anchor,absHead:t.selection.head}},HW=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=hW(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=VW(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(dR&&this._domSelectionInView===null&&(Zz(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=Wz.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=CV(TB(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(OW,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>WW(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(e),0,0));t.setMeta(OW,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>WW(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(t),0,0));if(e){let t=LN(RN(e.anchor,0),n.doc.content.size),r=LN(RN(e.head,0),n.doc.content.size);n.setSelection(Z.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(OW,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=wV(this.doc),e instanceof Uint8Array||t instanceof Uint8Array){if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&dP(),r=new jB({gc:!1}),KB(r,t),t=wV(r),KB(r,e),e=wV(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[jV(e,i._item.id.clock)].content.type}}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{yB(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:FW(n.colorMapping,n.colors,r)}},s=wH(i,new SV(t.ds,e.sv)).map(n=>!n._item.deleted||NW(n._item,e)||NW(n._item,t)?WW(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(OW,{isChangeOrigin:!0}))},OW)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=OW.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);yB(t,t.deleteSet,e=>{if(e.constructor===rW){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e),this.mapping.clear();let n=this.type.toArray().map(e=>UW(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this.prosemirrorView.state.doc,i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(n),0,0));RW(i,this.beforeTransactionSelection,this,r),i=i.setMeta(OW,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof YV}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)})}_prosemirrorChanged(e){this.doc.transact(()=>{mG(this.doc,this.type,e,this),this.beforeTransactionSelection=VW(this,this.prosemirrorView.state)},OW)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},UW=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof mU)return WW(e,t,n,r,i,a);throw uP()}return o},WW=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof mU){let s=UW(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof lU&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=GW(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):wH(e,new SV(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(NW(e._item,r)?NW(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=t.node(e.nodeName,s,o);return n.mapping.set(e,c),c}catch{return e.doc.transact(t=>{e._item.delete(t)},OW),n.mapping.delete(e),null}},GW=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,fG(n.attributes,t)))}}catch{return e.doc.transact(t=>{e._item.delete(t)},OW),null}return o},KW=(e,t)=>{let n=new yU,r=e.map(e=>({insert:e.text,attributes:pG(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},qW=(e,t)=>{let n=new mU(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}return n.insert(0,ZW(e).map(e=>JW(e,t))),t.mapping.set(n,e),n},JW=(e,t)=>e instanceof Array?KW(e,t):qW(e,t),YW=e=>typeof e==`object`&&!!e,XW=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||YW(o)&&YW(s)&&XW(o,s)}return r},ZW=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},QW=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&LL(e.attributes||{}).length===t[n].marks.length&&HL(e.attributes,(e,r)=>{let i=dG(r),a=t[n].marks;return a.find(e=>e.type.name===i)?XW(e,a.find(e=>e.type.name===i)?.attrs):!1}))},$W=(e,t)=>{if(e instanceof mU&&!(t instanceof Array)&&hG(e,t)){let n=ZW(t);return e._length===n.length&&XW(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>$W(e,n[t]))}return e instanceof yU&&t instanceof Array&&QW(e,t)},eG=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),tG=(e,t,n)=>{let r=new Map;t.forEach((e,t)=>{r.has(e)||r.set(e,t)});let i=[];if(e.forEach((e,a)=>{let o=n.mapping.get(e),s=r.get(o);s!==void 0&&eG(o,t[s])&&i.push({yIndex:a,pIndex:s,yChild:e})}),i.length===0)return[];let a=Array(i.length),o=[];for(let e=0;e<i.length;e++){let t=0,n=o.length;for(;t<n;){let r=t+n>>1;i[o[r]].pIndex<i[e].pIndex?t=r+1:n=r}a[e]=t>0?o[t-1]:-1,o[t]=e}let s=[];for(let e=o[o.length-1];e!==-1;e=a[e])s.push(i[e]);return s.reverse()},nG=(e,t,n,r)=>{n>0&&(e.slice(t,t+n).forEach(e=>r.mapping.delete(e)),e.delete(t,n))},rG=(e,t,n,r,i,a)=>{if(r<i){let o=[];for(let e=r;e<i;e++)o.push(JW(n[e],a));e.insert(t,o)}},iG=(e,t,n,r)=>t instanceof yU&&n instanceof Array?(QW(t,n)?r.mapping.set(t,n):lG(t,n,r),!0):t instanceof mU&&!(n instanceof Array)&&hG(t,n)?($W(t,n)?r.mapping.set(t,n):mG(e,t,n,r),!0):!1,aG=(e,t,n,r,i,a,o,s,c)=>{let l=LN(a-i,s-o);for(let a=0;a<l;a++){let s=r[i+a],l=n[o+a];iG(e,s,l,c)||(nG(t,o+a,1,c),rG(t,o+a,n,o+a,o+a+1,c))}nG(t,o+l,a-i-l,c),rG(t,o+l,n,o+l,s,c)},oG=(e,t,n,r,i)=>{let a=tG(r,n,i);if(a.length<2||!a.some(e=>e.yIndex!==e.pIndex)||a.some(e=>{let t=n[e.pIndex];return!(e.yChild instanceof yU&&t instanceof Array||e.yChild instanceof mU&&!(t instanceof Array))}))return!1;let o=0,s=0;for(let c of a){aG(e,t,n,r,o,c.yIndex,s,c.pIndex,i);let a=n[c.pIndex];iG(e,c.yChild,a,i),o=c.yIndex+1,s=c.pIndex+1}return aG(e,t,n,r,o,r.length,s,n.length,i),!0},sG=(e,t,n)=>{let r=e.toArray(),i=ZW(t),a=i.length,o=r.length,s=LN(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(eG(n.mapping.get(e),t))u=!0;else if(!$W(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(eG(n.mapping.get(e),t))u=!0;else if(!$W(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},cG=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof BU?t+=n.content.str:n.content instanceof NU&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},lG=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=cG(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,pG(e.marks,n))})),{insert:o,remove:s,index:c}=vW(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},uG=/(.*)(--[a-zA-Z0-9+/=]{8})$/,dG=e=>uG.exec(e)?.[1]??e,fG=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(dG(r),e[r]));return n},pG=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=OL(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${MW(e.toJSON())}`:e.type.name]=e.attrs}}),n},mG=(e,t,n,r)=>{if(t instanceof mU&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof mU){let e=t.getAttributes(),r=n.attrs;for(let n in r)r[n]===null?t.removeAttribute(n):e[n]!==r[n]&&n!==`ychange`&&t.setAttribute(n,r[n]);for(let n in e)r[n]===void 0&&t.removeAttribute(n)}let i=ZW(n),a=i.length,o=t.toArray(),s=o.length,c=LN(a,s);if(oG(e,t,i,o,r))return;let l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!eG(r.mapping.get(e),t)){if($W(e,t))r.mapping.set(e,t);else break}}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!eG(r.mapping.get(e),t)){if($W(e,t))r.mapping.set(e,t);else break}}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof yU&&c instanceof Array)QW(n,c)||lG(n,c,r),l+=1;else{let i=n instanceof mU&&hG(n,c),a=d instanceof mU&&hG(d,f);if(i&&a){let e=sG(n,c,r),t=sG(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(mG(e,n,c,r),l+=1):a?(mG(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[JW(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof yU?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(JW(i[t],r));t.insert(l,e)}},OW)},hG=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,gG=null,_G=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=OW.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},vG=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=gG;gG=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new _G(t,r,e))})}),new e(n)}},yG=(e=vG.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||Zz(0,()=>yG(e,!0));return}throw r}n=!1,e.dequeueFirst()}},bG=(e,t,n)=>{gG||(gG=new Map,Zz(0,yG)),OL(gG,e,EL).set(t,n)},xG=(e,t,n)=>{if(e===0)return vV(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof yU){if(r._length>=e)return vV(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new pV(r._item===null?null:r._item.id,r._item===null?dV(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new pV(r._item===null?null:r._item.id,r._item===null?dV(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw dP();if(e===0&&r.constructor!==yU&&r!==t)return CG(r._item.parent,r._item)}return vV(t,t._length,-1)},SG=(e,t,n)=>{if(n===null)return!1;let r=bV(t,e);return r!==null&&r.type instanceof yU&&t.item!==null&&n<=1},CG=(e,t)=>{let n=null,r=null;return e._item===null?r=dV(e):n=uV(e._item.id.client,e._item.id.clock),new pV(n,r,t.id)},wG=(e,t,n,r)=>{let i=bV(n,e);if(i===null||i.type!==t&&!fV(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===yU)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;if(t++,n instanceof yU)o+=n._length;else{let e=r.get(n);if(e==null)return null;o+=e.nodeSize}}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;if(!t.deleted){if(e instanceof yU)o+=e._length;else{let t=r.get(e);if(t==null)return null;o+=t.nodeSize}}t=t.right}}a=e}let s=o-1;return SG(e,n,s)?null:s},TG=(e,t)=>{if(e===t)return!0;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])},EG=e=>{let t=e.type.spec.attrs||{};return Object.keys(e.attrs).some(n=>{let r=t[n];return r==null||!Object.prototype.hasOwnProperty.call(r,`default`)||r.default!==e.attrs[n]})},DG=(e,t,n)=>{let r=t+1,i=n;for(let t=1;t<e.depth;t++){let n=e.index(t);if(n>=i.childCount)return null;for(let e=0;e<n;e++)r+=i.child(e).nodeSize;if(r+=1,i=i.child(n),i.type!==e.node(t+1).type)return null}return i.isTextblock?r+Math.min(e.parentOffset,i.content.size):null},OG=(e,t,n)=>{let r=0,i=0;for(;i<e.childCount;i++){let t=e.child(i);if(r+t.nodeSize>n)break;r+=t.nodeSize}if(i>=e.childCount)return null;let a=e.child(i),o=e.resolve(n),s=(e,t)=>{if(o.depth===0){let i=e+(n-r),a=e+1,o=e+t.nodeSize-1;return Math.max(a,Math.min(i,o))}return DG(o,e,t)},c=(n,r=!1)=>{let a=0;for(let t=0;t<=i;t++)n(e.child(t))&&a++;let o=0,c=-1,l=null,u=0;for(let e=0;e<t.childCount;e++){let r=t.child(e);n(r)&&(o++,o===a&&(c=u,l=r)),u+=r.nodeSize}return l===null||r&&(a!==1||o!==1)?null:s(c,l)},l=e=>e.type===a.type&&TG(e.attrs,a.attrs),u=a.textContent,d=c(e=>l(e)&&e.textContent===u);if(d!==null)return d;let f=c(e=>e.type===a.type&&e.textContent===u);if(f!==null)return f;if(EG(a)){let e=c(l,!0);if(e!==null)return e}return c(e=>l(e)&&u!==``&&e.textContent!==``&&(u.startsWith(e.textContent)||e.textContent.startsWith(u)),!0)},kG=(e,t)=>{if(!e.docChanged)return!1;if(e.doc.childCount!==t.childCount)return!0;for(let n of e.steps)if(n instanceof hc){if(n.from===0&&n.to===t.content.size)return!0;if(n.slice.content.size>0){let e=!1;if(n.slice.content.forEach(t=>{t.isBlock&&(e=!0)}),e)return!0}else if(n.to>n.from){let e=t.resolve(n.from),r=t.resolve(n.to);if(e.depth===0&&r.depth===0&&e.index()!==r.index())return!0}}return!1},AG=(e,t,n,r)=>{if(r===null)return!1;let i=e.resolve(n),a=t.resolve(r);if(!i.parent.isTextblock)return!1;if(!a.parent.isTextblock||i.parent.textContent!==a.parent.textContent||i.parentOffset!==0&&a.parentOffset===0)return!0;let o=i.parentOffset===0&&a.parentOffset===0,s=i.parentOffset!==a.parentOffset||i.parent.type!==a.parent.type||!TG(i.parent.attrs,a.parent.attrs);if(o||s){let i=OG(e,t,n);return i!==null&&i!==r}return!1};function jG(e){let t=e.toArray(),n=e=>{let t;if(e instanceof yU)t=e.toDelta().map(e=>{let t={type:`text`,text:e.insert};return e.attributes&&(t.marks=Object.keys(e.attributes).map(t=>{let n=e.attributes[t],r={type:dG(t)};return Object.keys(n)&&(r.attrs=n),r})),t});else if(e instanceof mU){t={type:e.nodeName};let r=e.getAttributes();Object.keys(r).length&&(t.attrs=r);let i=e.toArray();i.length&&(t.content=i.map(n).flat())}else dP();return t};return{type:`doc`,content:t.map(n)}}var MG=(e,t,n)=>e!==t,NG=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(``),i=document.createTextNode(``);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},PG=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),FG=/^#[0-9a-fA-F]{6}$/,IG=(e,t,n,r,i)=>{let a=OW.getState(e);if(a==null||a.doc==null||a.binding==null)return um.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?um.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:FG.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=wG(o,a.type,mV(t.cursor.anchor),a.binding.mapping),u=wG(o,a.type,mV(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=RN(e.doc.content.size-1,0);l=LN(l,t),u=LN(u,t),s.push(sm.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=LN(l,u),o=RN(l,u);s.push(sm.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),um.create(e.doc,s))},LG=(e,{awarenessStateFilter:t=MG,cursorBuilder:n=NG,selectionBuilder:r=PG,getSelection:i=e=>e.selection}={},a=`cursor`)=>new jl({key:AW,state:{init(i,a){return IG(a,e,t,n,r)},apply(i,a,o,s){let c=OW.getState(s),l=i.getMeta(AW),u=c&&c.isChangeOrigin;return i.docChanged&&!u&&kG(i,o.doc)?um.empty:u||l&&l.awarenessUpdated?IG(s,e,t,n,r):i.docChanged?a.map(i.mapping,i.doc):a}},props:{decorations:e=>AW.getState(e)},view:t=>{let n=()=>{t.docView&&bG(t,AW,{awarenessUpdated:!0})},r=(t,n={})=>{let r=OW.getState(t.state);if(!r||!r.binding)return;let o=e.getLocalState()||{};if(t.hasFocus()){let s=i(t.state),c=xG(s.anchor,r.type,r.binding.mapping),l=xG(s.head,r.type,r.binding.mapping);(n.force||o.cursor==null||!xV(mV(o.cursor.anchor),c)||!xV(mV(o.cursor.head),l))&&e.setLocalStateField(a,{anchor:c,head:l})}else o.cursor!=null&&wG(r.doc,r.type,mV(o.cursor.anchor),r.binding.mapping)!==null&&e.setLocalStateField(a,null)},o=()=>r(t);return e.on(`change`,n),t.dom.addEventListener(`focusin`,o),t.dom.addEventListener(`focusout`,o),{update:(e,t)=>{let n=!!(OW.getState(e.state)?.isChangeOrigin&&t?.doc&&!t.doc.eq(e.state.doc));r(e,{force:n})},destroy:()=>{t.dom.removeEventListener(`focusin`,o),t.dom.removeEventListener(`focusout`,o),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),RG=e=>{let t=kW.getState(e).undoManager;if(t!=null)return t.undo(),!0},zG=e=>{let t=kW.getState(e).undoManager;if(t!=null)return t.redo(),!0},BG=new Set([`paragraph`]),VG=(e,t)=>!(e instanceof rW)||!(e.content instanceof XU)||!(e.content.type instanceof lU||e.content.type instanceof mU&&t.has(e.content.type.nodeName))||e.content.type._length===0,HG=({protectedNodes:e=BG,trackedOrigins:t=[],undoManager:n=null}={})=>new jl({key:kW,state:{init:(r,i)=>{let a=OW.getState(i),o=n;if(!o){let n=a.doc,r=new Set(n?n._observers.get(`destroy`):[]);o=new YV(a.type,{trackedOrigins:new Set([OW].concat(t)),deleteFilter:t=>VG(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});let i=n?n._observers.get(`destroy`):new Set;o._yTiptapDocDestroyListeners=Array.from(i||[]).filter(e=>!r.has(e))}return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=OW.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:VW(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=OW.getState(e.state),n=kW.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,kW.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy();let e=n._yTiptapDocDestroyListeners;e&&n.doc&&(e.forEach(e=>n.doc.off(`destroy`,e)),n._yTiptapDocDestroyListeners=null)}}}});function UG(e){return e.getMap(SL.fields).toJSON()}async function WG(e,t){let n=jG(t.getXmlFragment(SL.body)),r=UG(t);return{body:await e.toMarkdown(n),fields:r}}var GG=new Map,KG=class{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:DR(t.newValue||``)}),cR(this._onChange)}postMessage(e){sR.setItem(this.room,ER(xR(e)))}close(){lR(this._onChange)}},qG=typeof BroadcastChannel>`u`?KG:BroadcastChannel,JG=e=>OL(GG,e,()=>{let t=WN(),n=new qG(e);return n.onmessage=e=>t.forEach(t=>t(e.data,`broadcastchannel`)),{bc:n,subs:t}}),YG=(e,t)=>(JG(e).subs.add(t),t),XG=(e,t)=>{let n=JG(e),r=n.subs.delete(t);return r&&n.subs.size===0&&(n.bc.close(),GG.delete(e)),r},ZG=(e,t,n=null)=>{let r=JG(e);r.bc.postMessage(t),r.subs.forEach(e=>e(t,n))},QG=(e,t)=>{bP(e,0),EP(e,nV(t))},$G=(e,t,n)=>{bP(e,1),EP(e,XB(t,n))},eK=(e,t,n)=>$G(t,n,JP(e)),tK=(e,t,n,r)=>{try{qB(t,JP(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},nK=(e,t)=>{bP(e,2),EP(e,t)},rK=tK,iK=(e,t,n,r,i)=>{let a=XP(e);switch(a){case 0:eK(e,t,n);break;case 1:tK(e,n,r,i);break;case 2:rK(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},aK=(e,t,n)=>{XP(e)===0&&n(t,QP(e))},oK=e=>zL(e,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join(`&`),sK=[];sK[0]=(e,t,n,r,i)=>{bP(e,0);let a=iK(t,e,n.doc,n);r&&a===1&&!n.synced&&(n.synced=!0)},sK[3]=(e,t,n,r,i)=>{bP(e,1),EP(e,pW(n.awareness,Array.from(n.awareness.getStates().keys())))},sK[1]=(e,t,n,r,i)=>{mW(n.awareness,JP(t),n)},sK[2]=(e,t,n,r,i)=>{aK(t,n.doc,(e,t)=>lK(n,t))};var cK=3e4,lK=(e,t)=>console.warn(`Permission denied to access ${e.url}.\n${t}`),uK=(e,t,n)=>{let r=GP(t),i=pP(),a=XP(r),o=e.messageHandlers[a];return o?o(i,r,e,n,a):console.error(`Unable to compute message`),i},dK=e=>!(e.code>=4400&&e.code<4500),fK=(e,t,n)=>{if(t!==null&&t===e.ws){e.emit(`connection-close`,[n,e]),e.ws=null,t.onmessage=null,t.onopen=null,t.onclose=null,t.onerror=()=>{},t.close(),e.wsconnecting=!1,e.wsconnected&&(e.wsconnected=!1,e.synced=!1,fW(e.awareness,Array.from(e.awareness.getStates().keys()).filter(t=>t!==e.doc.clientID),e),e.emit(`status`,[{status:`disconnected`}])),e.wsUnsuccessfulReconnects++;let r=null;n!=null&&!e.shouldReconnect(n,e)&&(e.shouldConnect=!1,r={code:n.code,reason:n.reason}),setTimeout(pK,LN(zN(2,e.wsUnsuccessfulReconnects)*100,e.maxBackoffTime),e),r!==null&&e.emit(`closed`,[r,e])}},pK=e=>{if(e.shouldConnect&&e.ws===null){let t=new e._WS(e.url,e.protocols);t.binaryType=`arraybuffer`,e.ws=t,e.wsconnecting=!0,e.wsconnected=!1,e.synced=!1,t.onmessage=n=>{if(e.ws!==t)return;e.wsLastMessageReceived=TL();let r=uK(e,new Uint8Array(n.data),!0);hP(r)>1&&t.send(gP(r))},t.onerror=n=>{e.ws===t&&e.emit(`connection-error`,[n,e])},t.onclose=n=>{fK(e,t,n)},t.onopen=()=>{if(e.ws!==t)return;e.wsLastMessageReceived=TL(),e.wsconnecting=!1,e.wsconnected=!0,e.emit(`status`,[{status:`connected`}]);let n=pP();if(bP(n,0),QG(n,e.doc),t.send(gP(n)),e.awareness.getLocalState()!==null){let n=pP();bP(n,1),EP(n,pW(e.awareness,[e.doc.clientID])),t.send(gP(n))}},e.emit(`status`,[{status:`connecting`}])}},mK=(e,t)=>{let n=e.ws;e.wsconnected&&n&&n.readyState===n.OPEN&&n.send(t),e.bcconnected&&ZG(e.bcChannel,t,e)},hK=class extends jL{constructor(e,t,n,{connect:r=!0,awareness:i=new dW(n),params:a={},protocols:o=[],WebSocketPolyfill:s=WebSocket,resyncInterval:c=-1,maxBackoffTime:l=2500,disableBc:u=!1,shouldReconnect:d=dK}={}){for(super();e[e.length-1]===`/`;)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+`/`+t,this.maxBackoffTime=l,this.shouldReconnect=d,this.params=a,this.protocols=o,this.roomname=t,this.doc=n,this._WS=s,this.awareness=i,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=u,this.wsUnsuccessfulReconnects=0,this.messageHandlers=sK.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=r,this._resyncInterval=0,c>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){let e=pP();bP(e,0),QG(e,n),this.ws.send(gP(e))}},c)),this._bcSubscriber=(e,t)=>{if(t!==this){let t=uK(this,new Uint8Array(e),!1);hP(t)>1&&ZG(this.bcChannel,gP(t),this)}},this._updateHandler=(e,t)=>{if(t!==this){let t=pP();bP(t,0),nK(t,e),mK(this,gP(t))}},this.doc.on(`update`,this._updateHandler),this._awarenessUpdateHandler=({added:e,updated:t,removed:n},r)=>{let a=e.concat(t).concat(n),o=pP();bP(o,1),EP(o,pW(i,a)),mK(this,gP(o))},this._exitHandler=()=>{fW(this.awareness,[n.clientID],`app closed`)},uR&&typeof process<`u`&&process.on(`exit`,this._exitHandler),i.on(`update`,this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&cK<TL()-this.wsLastMessageReceived&&fK(this,this.ws,null)},cK/10),r&&this.connect()}get url(){let e=oK(this.params);return this.serverUrl+`/`+this.roomname+(e.length===0?``:`?`+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,e&&(this.wsUnsuccessfulReconnects=0),this.emit(`synced`,[e]),this.emit(`sync`,[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),uR&&typeof process<`u`&&process.off(`exit`,this._exitHandler),this.awareness.off(`update`,this._awarenessUpdateHandler),this.doc.off(`update`,this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||=(YG(this.bcChannel,this._bcSubscriber),!0);let e=pP();bP(e,0),QG(e,this.doc),ZG(this.bcChannel,gP(e),this);let t=pP();bP(t,0),$G(t,this.doc),ZG(this.bcChannel,gP(t),this);let n=pP();bP(n,3),ZG(this.bcChannel,gP(n),this);let r=pP();bP(r,1),EP(r,pW(this.awareness,[this.doc.clientID])),ZG(this.bcChannel,gP(r),this)}disconnectBc(){let e=pP();bP(e,1),EP(e,pW(this.awareness,[this.doc.clientID],new Map)),mK(this,gP(e)),this.bcconnected&&=(XG(this.bcChannel,this._bcSubscriber),!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&fK(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(pK(this),this.connectBc())}};function gK(e){return!!e.getMeta(OW)}function _K(e,t){let n=OW.getState(e);return wG(n.doc,n.type,t,n.binding.mapping)||0}function vK(e,t){let n=OW.getState(e);return xG(t,n.type,n.binding.mapping)}var yK=class e extends Q_{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function bK(e,t){return new yK(e,vK(t,e))}function xK(e,t,n){let r=e instanceof yK?e.yRelativePosition:null;if(gK(t)&&r)return{position:new yK(_K(n,r),r),mapResult:null};let i=$_(e,t),a=i.position.position;return{position:new yK(a,r??vK(n,a)),mapResult:i.mapResult}}var SK=By.create({name:`collaboration`,priority:1e3,addOptions(){return{document:null,field:`default`,fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(e=>e.name===`undoRedo`)&&console.warn(`[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".`)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>xK(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>bK(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),kW.getState(t).undoManager.undoStack.length===0?!1:!n||RG(t)),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),kW.getState(t).undoManager.redoStack.length===0?!1:!n||zG(t))}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=HG(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=kW.getState(e.state);t.restore&&=(t.restore(),()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on(`afterTransaction`,t.afterTransactionHandler),t._observers=n},r?.destroy&&r.destroy()}}},[IW(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,new jl({filterTransaction:(e,t)=>(e.getMeta(`inputRule`)&&kW.getState(t).undoManager.stopCapturing(),!0)}),this.editor.options.enableContentCheck&&new jl({key:new Pl(`filterInvalidContent`),filterTransaction:t=>{if(!gK(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit(`contentError`,{error:t,editor:this.editor,disableCollaboration:()=>{var t;(t=e.doc)==null||t.destroy()}}),!0}}})].filter(Boolean)}}),CK=/^#[0-9a-f]{6}$/i,wK=By.create({name:`collaborationCaret`,priority:999,addOptions(){return{awareness:null,render:e=>{let t=document.createElement(`span`);t.classList.add(`collaboration-carets__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-carets__label`),n.style.backgroundColor=e.color,n.append(document.createTextNode(e.name)),t.append(n),t},selectionRender:e=>PG(e)}},addProseMirrorPlugins(){let{awareness:e,render:t,selectionRender:n}=this.options;if(!e)return[];let r=e=>({...e,color:typeof e.color==`string`&&CK.test(e.color)?e.color:`transparent`,name:typeof e.name==`string`?e.name:``});return[LG(e,{cursorBuilder:e=>t(r(e)),selectionBuilder:e=>{let t=r(e);return t.color===`transparent`?{}:n(t)}})]}}),TK=11;function EK(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function DK(e){return typeof e==`string`}function OK(e){return!EK(e)||!EK(e.document)||!DK(e.document.body)||e.document.fields!==void 0&&!EK(e.document.fields)||e.digest!==null&&!DK(e.digest)||e.savedAt!==null&&!DK(e.savedAt)||e.error!==null&&!DK(e.error)?!1:Array.isArray(e.issues)&&(e.savedBy===null||EK(e.savedBy))}function kK(e){if(!OK(e)||!DK(e.digest))return!1;let t=`snapshot`in e?e.snapshot:void 0;return!EK(t)||typeof t.id!=`string`||typeof t.createdAt!=`string`||t.name!==void 0&&!DK(t.name)||!EK(t.entries)?!1:Object.values(t.entries).every(e=>!(!EK(e)||e.type!==`file`&&e.type!==`directory`||e.digest!==void 0&&!DK(e.digest)||e.metadata!==void 0&&!EK(e.metadata)||e.size!==void 0&&(typeof e.size!=`number`||!Number.isFinite(e.size))))}function AK(e){return EK(e)&&(e.digest===null||DK(e.digest))&&typeof e.reseeded==`boolean`}function jK(e,n,r={}){let i=r.identity===void 0?Ae().user:void 0,a=()=>r.identity===void 0?i?.value:ce(r.identity),o=()=>r.editor?r.editor.extensions():xL({collaborative:!0}),s=e=>{if(r.carets===!1)return[];let{render:t,selectionRender:n}=typeof r.carets==`object`?r.carets:{};return[h(wK.configure({awareness:h(e),...t?{render:t}:{},...n?{selectionRender:n}:{}}))]},c=t(),l=t(),u=t(),d=t(),m=t([]),g=t(),_=A(`disconnected`),v=A(!1),y=A(null),b=A(0),x=A(0),S=[],C=new Set,w=new Set,T=new Set;r.onReset&&T.add(r.onReset);let E,D,O=()=>r.enabled===void 0||ce(r.enabled);function k(e=!1,t=!1){for(let e of C)(!t||!w.has(e))&&e.abort();if(t)for(let e of C)w.has(e)||C.delete(e);else C.clear(),w.clear();E=void 0,l.value?.destroy(),e||c.value?.destroy(),l.value=void 0,c.value=void 0,m.value=[],g.value=void 0,_.value=`disconnected`,v.value=!1,y.value=null}function j(e){let t=a(),n=DK(t?.id)&&t.id?t.id:`guest:${e}`;return fF({...t,id:n})}function M(e){m.value=mF(e.awareness.getStates())}function N(){if(D)return;let e=u.value,t=e?.ws;if(!e?.wsconnected||!t||t.readyState!==t.OPEN)return;let n=S[0];n&&(t.send(Uint8Array.from(xF(n))),S.shift(),S.length&&(D=setTimeout(()=>{D=void 0,N()},TK)))}function P(e){O()&&(S.push(e),N())}function F(){k(),u.value?.destroy(),u.value?.doc.destroy(),u.value=void 0,D&&clearTimeout(D),D=void 0,S.length=0}function I(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${MN(`/api/_vitehub/realtime/${encodeURIComponent(e)}`)}`}if(typeof window<`u`){let e=h(new jB),t=new hK(I(),encodeURIComponent(hF),e,{connect:!1,disableBc:!0,params:{workspace:`events`}});t.awareness.setLocalState(null),t.messageHandlers[4]=(e,t)=>{let n=bF(t);n&&(d.value=n)},t.on(`status`,e=>{e.status===`connected`&&N()}),u.value=t}function L(e){let t=h(new jB),n=e.split(`/`).map(encodeURIComponent).join(`/`),r=new hK(I(),n,t,{disableBc:!0,params:{}});r.messageHandlers[5]=(t,n)=>{if(l.value!==r)return;let i=vF(n);if(i){if(i.type===`session`){r.params.epoch=i.epoch,y.value=i.access===`read`?i.reason??`access`:null;return}R(e,i.reason,i.epoch)}},r.awareness.off(`update`,r._awarenessUpdateHandler),r.awareness.on(`update`,({added:e,removed:n,updated:i})=>{let a=[...e,...i,...n].filter(e=>e===t.clientID),o=r.ws;if(!a.length||!r.wsconnected||!o||o.readyState!==o.OPEN)return;let s=pP();bP(s,1),EP(s,pW(r.awareness,a)),o.send(gP(s))}),r.awareness.setLocalStateField(`user`,j(t.clientID)),r.awareness.on(`change`,()=>{l.value===r&&M(r)}),M(r),t.getMap(SL.status).observe(()=>{c.value===t&&(g.value=wL(t))}),r.on(`status`,e=>{l.value===r&&(_.value=e.status)}),r.on(`sync`,e=>{l.value===r&&(v.value=e,e&&(g.value=wL(t)))}),E=e,c.value=t,l.value=r,_.value=`connecting`}function R(e,t,r){let i=c.value;if(k(!0,!0),i)try{for(let e of T)e({epoch:r,previous:i,reason:t})}finally{i.destroy()}O()&&ce(n)===e&&L(e)}function ee(e){return T.add(e),()=>T.delete(e)}async function z(t){let r=()=>[NN.REALTIME_DISCONNECTED({action:t}),void 0],i=new AbortController;C.add(i),t===`refresh`&&w.add(i);try{let a=ce(n);if(!a)return[NN.REALTIME_MISSING_DOCUMENT({action:t}),void 0];let o=a.split(`/`).map(encodeURIComponent).join(`/`),s=c.value,l=t===`checkpoint`?`history=checkpoint`:`document=${t}`,u=()=>!i.signal.aborted&&!!s&&E===a&&c.value===s&&ce(n)===a&&O();for(let n=0;;n++){if(t!==`refresh`&&!u())return r();let a;try{a=await fetch(MN(`/api/_vitehub/realtime/${encodeURIComponent(e)}/${o}?${l}`),{body:t===`refresh`?void 0:Uint8Array.from(XB(s)).buffer,method:`POST`,signal:i.signal})}catch(e){return i.signal.aborted?r():[NN.REALTIME_REQUEST_FAILED({action:t,cause:e}),void 0]}let c;try{c=await a.json()}catch{if(i.signal.aborted)return r()}if(t!==`refresh`&&!u())return r();if(a.ok)return[void 0,c];let d=EK(c)?c:void 0,f=EK(d?.data)?d.data:void 0,p=DK(d?.statusMessage)&&d.statusMessage?d.statusMessage:DK(d?.message)?d.message:void 0;if(a.status===409&&_F(DK(f?.code)?f.code:void 0)&&n<20){await new Promise(e=>setTimeout(e,50));continue}return[NN.REALTIME_REQUEST_FAILED({action:t,message:p,status:a.status}),void 0]}}finally{C.delete(i),w.delete(i)}}async function te(e,t){if(!O())return[NN.REALTIME_DISABLED({action:e}),void 0];let[n,r]=await z(e);return n?[n,void 0]:t(r)?[void 0,r]:[NN.REALTIME_INVALID_RESPONSE({action:e}),void 0]}async function B(){if(!O())return[NN.REALTIME_DISABLED({action:`save`}),void 0];x.value++;try{return await te(`save`,OK)}finally{x.value--}}async function V(){if(!O())return[NN.REALTIME_DISABLED({action:`checkpoint`}),void 0];b.value++;try{return await te(`checkpoint`,kK)}finally{b.value--}}async function ne(){return await te(`refresh`,AK)}return f([()=>ce(n),O],([e,t])=>{k(),t&&e&&typeof window<`u`&&L(e)},{immediate:!0}),f(O,e=>{let t=u.value;t&&(e?t.connect():(t.disconnect(),S.length=0))},{immediate:!0}),f(a,()=>{let e=l.value;e&&(e.awareness.setLocalStateField(`user`,j(e.doc.clientID)),M(e))}),se(F),{document:c,extensions:p(()=>c.value&&l.value?[...o(),h(SK.configure({fragment:h(c.value.getXmlFragment(SL.body))})),...s(l.value.awareness)]:[]),fields:p(()=>c.value?.getMap(SL.fields)),people:m,provider:l,readOnly:p(()=>y.value!==null),readOnlyReason:y,refresh:ne,onReset:ee,save:B,saveStatus:g,saving:p(()=>x.value>0),status:_,synced:v,history:{checkpoint:V,pending:p(()=>b.value>0)},workspace:{change:d,notify:P},destroy:F}}function MK(e){return Object.fromEntries((e??[]).map(e=>[e.name,{kind:e.kind,props:e.props}]))}function NK(e){if(Array.isArray(e))return`[${e.map(NK).join(`,`)}]`;if(e!==null&&Object(e)===e){let t=Object(e);return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${NK(t[e])}`).join(`,`)}}`}return JSON.stringify(e??null)}function PK(e){return JSON.parse(JSON.stringify(e??null))}function FK(e){let n=CN({components:MK(e.components())}),r=!1,i=jK(e.definition,e.room,{editor:n,enabled:()=>e.room()!==void 0,identity:()=>{let t=e.user();if(!t)return null;let n={id:t.id,name:t.name};return t.image&&(n.image=t.image),n},onReset:t=>{let i=r;if(r=!1,!i){e.onReset({reason:t.reason});return}let a=t.previous.getMap(`fields`).toJSON();WG(n,t.previous).then(n=>e.onReset({reason:t.reason,unsaved:{body:n.body,fields:a}}),()=>e.onReset({reason:t.reason}))}}),a=t(),o=t(new Map);f([i.fields,i.synced],([e,t],n,r)=>{if(!e||!t){a.value=void 0;return}let i=()=>{a.value=PK(e.toJSON())};e.observe(i),i(),r(()=>e.unobserve(i))},{immediate:!0}),f(i.document,(e,t,n)=>{if(!e)return;let i=(e,t,n,i)=>{i.local&&(r=!0)};e.on(`update`,i),n(()=>e.off(`update`,i))},{immediate:!0}),f(()=>i.saveStatus.value?.savedAt,(e,t)=>{e&&e!==t&&(r=!1)}),f(i.provider,(e,t,n)=>{if(!e){o.value=new Map;return}let r=()=>{o.value=new Map(e.awareness.getStates())};e.awareness.on(`change`,r),r(),n(()=>e.awareness.off(`change`,r))},{immediate:!0});let s=p(()=>{let e=i.document.value?.clientID,t=new Map;for(let n of i.people.value){if(n.clientId===e)continue;let r=o.value.get(n.clientId)?.focus,i=t.get(n.id),a={clientId:n.clientId,color:n.color,id:n.id,name:n.name};n.image&&(a.image=n.image),String(r)===r&&r&&(a.focus=r),(!i||!i.focus&&a.focus)&&t.set(n.id,a)}return[...t.values()]}),c=p(()=>{let e=i.document.value?.clientID,t=i.people.value.find(t=>t.clientId===e);return t?{color:t.color,id:t.id,name:t.name}:void 0});function l(e){let t=i.fields.value,n=i.document.value;if(!t||!n||i.readOnly.value||!i.synced.value)return;let r=PK(t.toJSON()),a=Object.keys(e).filter(t=>NK(r[t])!==NK(e[t])),o=Object.keys(r).filter(t=>!Object.hasOwn(e,t));(a.length||o.length)&&n.transact(()=>{for(let e of o)t.delete(e);for(let n of a)t.set(n,PK(e[n]))})}function u(e){i.provider.value?.awareness.setLocalStateField(`focus`,e??null)}async function d(){let[e,t]=await i.save();if(e)throw e;return t.digest}return P(()=>u(void 0)),{document:i.document,provider:i.provider,fields:a,writeFields:l,others:s,focus:u,ready:p(()=>!!(i.document.value&&i.synced.value)),status:i.status,readOnlyReason:i.readOnlyReason,saveStatus:i.saveStatus,issues:p(()=>i.saveStatus.value?.issues??[]),save:d,identity:c}}function IK(e,t){if(e)try{let n=new URL(e,t);return n.origin===t&&(n.protocol===`http:`||n.protocol===`https:`)?n:void 0}catch{return}}function LK(e,t){let n=new URL(e);return n.searchParams.set(t,``),n.href}function RK(e){let t=new URL(e);return t.searchParams.set(bo,``),t.href}function zK(e){let t=new URLSearchParams(e.search);t.delete(yo),t.delete(bo);let n=t.toString();return n?`${e.pathname}?${n}`:e.pathname}function BK(e){return e.querySelector(`meta[name="vitehub-content-preview-error"]`)?.getAttribute(`content`)??void 0}function VK(e,t){return JSON.stringify({token:e,document:t})}function HK(e,t,n){if(e===null)return;let r=Gr(e);if(!r||r.collection!==t.name||(t.kind===`documents`||r.id!==void 0)&&r.id!==n)return;let[i]=r.field.split(`.`);return{field:i,nested:r.field.includes(`.`)}}function UK(e,t){let n=Math.max(320,t-420);return Math.round(Math.min(Math.max(e,320),n))}function WK(e,t){return`vitehub:console:local:${e}/${t}`}function GK(e){if(!(e instanceof Object)||Array.isArray(e))return!1;let t=Reflect.get(e,`body`),n=Reflect.get(e,`data`);return String(t)===t&&n instanceof Object&&!Array.isArray(n)}function KK(e,t,n){let r;try{r=JSON.parse(e.getItem(WK(t,n))??`null`)}catch{return}if(!(r instanceof Object)||Array.isArray(r))return;let i=Reflect.get(r,`base`),a=Reflect.get(r,`start`),o=Reflect.get(r,`version`);if((i===null||String(i)===i)&&GK(a)&&GK(o))return{base:i,start:a,version:o}}function qK(e,t,n,r){try{return e.setItem(WK(t,n),JSON.stringify(r)),!0}catch{return!1}}function JK(e,t,n){try{e.removeItem(WK(t,n))}catch{}}var YK={key:0,class:`rounded-md border border-default px-3 py-2 text-xs text-muted`},XK=V({__name:`console-document-diff`,props:{after:{},before:{},format:{},name:{}},setup(e){let t=e;function n(e){if(e===null)return``;if(!(e instanceof Object))return e;let n=Object.fromEntries(Object.entries(e.data).sort(([e],[t])=>e.localeCompare(t)));return Vt({body:e.body,data:n},t.format)}let r=p(()=>({contents:n(t.before),name:t.name})),i=p(()=>({contents:n(t.after),name:t.name})),a=p(()=>r.value.contents===i.value.contents);return(e,t)=>a.value?(J(),b(`p`,YK,`Both versions are the same.`)):(J(),k(F(jr),{key:1,class:`overflow-hidden rounded-md border border-default text-xs tabular-nums`,"old-file":r.value,"new-file":i.value,options:{diffStyle:`unified`,disableFileHeader:!0,overflow:`wrap`}},null,8,[`old-file`,`new-file`]))}}),ZK={class:`grid gap-4`},QK={key:1,class:`grid gap-1`},$K={key:2,class:`px-2 text-xs text-muted`},eq=[`aria-label`],tq={class:`px-2 pb-1 text-xs font-medium text-muted`},nq={class:`grid`},rq=[`onClick`],iq={class:`grid min-w-0 gap-0.5`},aq={class:`flex min-w-0 items-center gap-1.5`},oq={key:0,class:`shrink-0 text-xs text-muted tabular-nums`},sq={key:0,class:`flex min-w-0 items-center gap-1.5 text-xs text-muted`},cq={class:`truncate`},lq={class:`text-xs text-muted`},uq={key:0,class:`ms-4 grid border-s border-default ps-2`},dq=[`onClick`],fq={class:`font-mono`},pq=V({__name:`console-document-history`,props:{cursor:{},error:{},loadedAt:{},loading:{type:Boolean},revisions:{},selected:{}},emits:[`more`,`open`],setup(e,{emit:t}){let n=e,r=t,i=A(new Set),a=p(()=>{let e=[];for(let t of it(n.revisions)){let r=xt(t.revisions[0].createdAt,n.loadedAt)??`Unknown date`,i=e.at(-1);i?.label===r?i.runs.push(t):e.push({label:r,runs:[t]})}return e});function o(e){return`${e.ref}:${e.id}`}function c(e){let t=o(e.revisions[0]),n=new Set(i.value);n.has(t)?n.delete(t):n.add(t),i.value=n}function l(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)||`?`}return(t,n)=>{let u=Dr,d=ye,f=sr,p=dr;return J(),b(`div`,ZK,[e.error?(J(),k(u,{key:0,color:`error`,variant:`subtle`,title:`Couldn't load history`,description:F(un)(e.error)},null,8,[`description`])):e.loading&&!e.revisions.length?(J(),b(`div`,QK,[(J(),b(O,null,s(4,e=>H(d,{key:e,class:`h-10 rounded-md`})),64))])):e.revisions.length?(J(!0),b(O,{key:3},s(a.value,t=>(J(),b(`section`,{key:t.label,"aria-label":t.label},[j(`h3`,tq,q(t.label),1),j(`ol`,nq,[(J(!0),b(O,null,s(t.runs,t=>(J(),b(`li`,{key:o(t.revisions[0])},[j(`div`,{class:G([`group flex items-center rounded-md`,e.selected===t.revisions[0].id?`bg-elevated`:`hover:bg-elevated/60`])},[j(`button`,{type:`button`,class:`grid min-h-10 min-w-0 flex-1 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 rounded-md px-2 py-1.5 text-left focus-visible:outline-2`,onClick:e=>r(`open`,t.revisions[0])},[j(`span`,iq,[j(`span`,aq,[H(xi,{label:F(Be)(t.revisions[0]),tone:F(Re)(t.revisions[0]),class:`text-[13px] text-highlighted`},null,8,[`label`,`tone`]),t.revisions.length>1?(J(),b(`span`,oq,`· `+q(t.revisions.length)+` edits`,1)):M(``,!0)]),t.revisions[0].author?(J(),b(`span`,sq,[H(f,{text:l(t.revisions[0].author),alt:t.revisions[0].author,size:`3xs`,class:`shrink-0`},null,8,[`text`,`alt`]),j(`span`,cq,q(t.revisions[0].author),1)])):M(``,!0)]),j(`span`,lq,[H(Qr,{value:t.revisions[0].createdAt},null,8,[`value`])])],8,rq),t.revisions.length>1?(J(),k(p,{key:0,variant:`ghost`,size:`xs`,class:`me-1`,icon:i.value.has(o(t.revisions[0]))?`i-lucide-chevron-up`:`i-lucide-chevron-down`,"aria-label":i.value.has(o(t.revisions[0]))?`Hide each save`:`Show each of ${t.revisions.length} saves`,"aria-expanded":i.value.has(o(t.revisions[0])),onClick:e=>c(t)},null,8,[`icon`,`aria-label`,`aria-expanded`,`onClick`])):M(``,!0)],2),i.value.has(o(t.revisions[0]))?(J(),b(`ol`,uq,[(J(!0),b(O,null,s(t.revisions,t=>(J(),b(`li`,{key:o(t)},[j(`button`,{type:`button`,class:G([`flex h-8 w-full items-center justify-between gap-3 rounded-md px-2 text-left text-xs text-muted hover:bg-elevated/60 focus-visible:outline-2`,e.selected===t.id?`bg-elevated text-highlighted`:``]),onClick:e=>r(`open`,t)},[j(`span`,fq,q(t.id.slice(0,7)),1),H(Qr,{value:t.createdAt},null,8,[`value`])],10,dq)]))),128))])):M(``,!0)]))),128))])],8,eq))),128)):(J(),b(`p`,$K,`No versions yet.`)),e.cursor?(J(),k(p,{key:4,class:`justify-self-start`,variant:`outline`,size:`xs`,label:`Older versions`,loading:e.loading,onClick:n[0]||=e=>r(`more`)},null,8,[`loading`])):M(``,!0)])}}}),mq={class:`flex min-h-0 min-w-0 flex-col bg-default`,"aria-label":`Page preview`},hq={class:`flex h-11 shrink-0 items-center gap-1.5 border-b border-default px-2 sm:px-3`},gq={class:`flex h-7 min-w-0 flex-1 items-center gap-2 rounded-md bg-elevated/60 px-2.5 ring-1 ring-default ring-inset`},_q=[`title`],vq={class:`flex items-center rounded-md p-0.5 ring-1 ring-default ring-inset`,role:`radiogroup`,"aria-label":`Preview`},yq=[`aria-checked`,`tabindex`,`onClick`],bq={class:`hidden items-center rounded-md p-0.5 ring-1 ring-default ring-inset sm:flex`,role:`radiogroup`,"aria-label":`Viewport`},xq=[`aria-checked`,`aria-label`,`tabindex`,`onClick`],Sq={key:0,class:`grid justify-items-start gap-3 p-6`,role:`alert`},Cq={class:`text-sm text-muted`},wq=[`name`,`src`,`title`,`aria-hidden`,`tabindex`,`onLoad`],Tq=350,Eq=`data-vitehub-preview-highlight`,Dq=V({__name:`console-document-preview`,props:z({client:{},collection:{},documentId:{},url:{},document:{},textFields:{},local:{type:Boolean},highlight:{},reloads:{},overlay:{type:Boolean}},{view:{required:!0},viewModifiers:{},viewport:{required:!0},viewportModifiers:{}}),emits:z([`close`,`edit`,`select`],[`update:view`,`update:viewport`]),setup(e,{emit:t}){let n=e,r=_(e,`view`),a=_(e,`viewport`),o=t,c=A([]),l=A(),u=A(n.url.pathname),d=A(),m=A(!1),h=A(),g=0,v=0,y,x,S,C=!1,w=e=>`vitehub-preview-${n.collection.name}-${e}`.replace(/[^\w-]/g,`-`),T=p(()=>r.value===`draft`),E=p(()=>r.value===`published`?`Published`:n.local?`Local draft`:`Draft`);async function D(){let e=JSON.stringify([n.collection.name,n.documentId]);if(x?.document===e&&Date.parse(x.value.expiresAt)-Date.now()>6e4)return x.value;let t=await n.client.preview(n.collection.name,n.documentId);return x={document:e,value:t},t}async function N(){if(clearTimeout(y),S){C=!0;return}C=!1;let e=++v;d.value=void 0,m.value=!0;let t;if(T.value)try{let r=await D();if(e!==v)return;t={action:LK(n.url,r.parameter),field:r.parameter,value:VK(r.token,n.document)}}catch(t){if(e!==v)return;m.value=!1,d.value=un(t,`The Console could not open the preview.`);return}let r=++g,i=w(r);if(c.value=[...c.value.filter(e=>e.key===l.value),t?{key:r,name:i}:{key:r,name:i,src:RK(n.url)}],!t||(await ae(),e!==v||!h.value?.querySelector(`iframe[name="${i}"]`)))return;let a=document.createElement(`form`);a.method=`post`,a.action=t.action,a.target=i,a.hidden=!0;let o=document.createElement(`input`);o.type=`hidden`,o.name=t.field,o.value=t.value,a.append(o),document.body.append(a),a.submit(),a.remove()}function I(){clearTimeout(y),y=setTimeout(()=>void N(),Tq)}function L(e){try{let t=e.contentWindow?.location;return!t||t.origin!==window.location.origin?void 0:e.contentDocument??void 0}catch{return}}function R(e,t){let n=t.target;if(!(n instanceof HTMLIFrameElement))return;let r;try{r=n.contentWindow?.location.href}catch{}if(r===`about:blank`||e.key!==g)return;let i=h.value?.querySelector(`iframe[name="${w(l.value??-1)}"]`),a=i?L(i)?.defaultView?.scrollY:void 0;l.value=e.key,m.value=!1,c.value=c.value.filter(t=>t.key===e.key);let o=L(n);if(!o){u.value=``;return}u.value=zK(o.location);let s=T.value?BK(o):void 0;if(s){d.value=s;return}a&&o.defaultView?.scrollTo(0,a),ee(o)}function ee(e){let t=e.createElement(`style`);t.textContent=`
|
|
310
|
+
[data-content-field] { cursor: ${T.value?`pointer`:`default`}; }
|
|
311
|
+
${T.value?`[data-content-field]:hover { outline: 1px dashed color-mix(in oklab, #3b82f6 70%, transparent); outline-offset: 3px; }`:``}
|
|
312
|
+
[${Eq}] { outline: 2px solid #3b82f6 !important; outline-offset: 3px; }
|
|
313
|
+
[contenteditable] { outline: 2px solid #3b82f6 !important; outline-offset: 3px; cursor: text; }
|
|
314
|
+
`,e.head.append(t),e.addEventListener(`click`,t=>B(e,t),!0),ie(e)}function z(e,t){let n=e.defaultView?.Element;return n&&t instanceof n?t:void 0}function te(e,t){let r=z(e,t)?.closest(`[data-content-field]`);if(!r)return;let i=HK(r.getAttribute(`data-content-field`),n.collection,n.documentId);return i?{element:r,...i}:void 0}function B(e,t){let r=te(e,t.target),i=z(e,t.target)?.closest(`a[href]`);T.value&&(i||r)&&t.preventDefault(),r&&T.value&&r.element!==S&&(t.stopPropagation(),o(`select`,r.field),!r.nested&&n.textFields.includes(r.field)&&V(e,r.element,r.field))}function V(e,t,r){let i=t.textContent??``,a=n.document.data[r],s=String(a)===a?a:i;S=t,t.textContent=s,t.setAttribute(`contenteditable`,`plaintext-only`),t.setAttribute(`aria-label`,`Edit ${r}`),t.focus();let c=e.getSelection();c?.selectAllChildren(t),c?.collapseToEnd();let l=()=>o(`edit`,r,(t.textContent??``).replace(/\s*\n\s*/g,` `)),u=e=>{e.key===`Enter`&&!e.isComposing&&(e.preventDefault(),t.blur()),e.key===`Escape`&&(t.textContent=i,o(`edit`,r,s),t.blur())};t.addEventListener(`input`,l),t.addEventListener(`keydown`,u),t.addEventListener(`blur`,()=>{t.textContent===s&&(t.textContent=i),t.removeEventListener(`input`,l),t.removeEventListener(`keydown`,u),t.removeAttribute(`contenteditable`),t.removeAttribute(`aria-label`),S=void 0,C&&I()},{once:!0})}function ne(){let e=h.value?.querySelector(`iframe[name="${w(l.value??-1)}"]`);return e?L(e):void 0}function ie(e=ne()){if(!e)return;for(let t of e.querySelectorAll(`[${Eq}]`))t.removeAttribute(Eq);if(!n.highlight)return;let t;for(let r of e.querySelectorAll(`[data-content-field]`))HK(r.getAttribute(`data-content-field`),n.collection,n.documentId)?.field===n.highlight&&(r.setAttribute(Eq,``),t??=r);t?.scrollIntoView({block:`nearest`})}async function oe(){if(!T.value){window.open(RK(n.url),`_blank`,`noopener`);return}try{let e=await D(),t=document.createElement(`form`);t.method=`post`,t.action=LK(n.url,e.parameter),t.target=`_blank`,t.rel=`noopener`,t.hidden=!0;let r=document.createElement(`input`);r.type=`hidden`,r.name=e.parameter,r.value=VK(e.token,n.document),t.append(r),document.body.append(t),t.submit(),t.remove()}catch(e){d.value=un(e,`The Console could not open the preview.`)}}function U(e,t){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault(),t(e.key===`Home`?`first`:e.key===`End`?`last`:`other`);let n=e.currentTarget instanceof Element?e.currentTarget.closest(`[role="radiogroup"]`):null;ae(()=>n?.querySelector(`[aria-checked="true"]`)?.focus())}return f([r,()=>n.url.href,()=>n.reloads],()=>void N(),{immediate:!0}),f(()=>JSON.stringify(n.document),()=>{T.value&&I()}),f(()=>n.highlight,()=>ie()),P(()=>{v++,clearTimeout(y)}),(t,n)=>{let f=dr,p=Ft,g=ge;return J(),b(`section`,mq,[j(`div`,hq,[e.overlay?(J(),k(f,{key:0,variant:`ghost`,size:`sm`,icon:`i-lucide-arrow-left`,label:`Editor`,onClick:n[0]||=e=>o(`close`)})):M(``,!0),H(p,{text:`Reload`,content:{side:`bottom`}},{default:i(()=>[H(f,{variant:`ghost`,size:`sm`,icon:`i-lucide-rotate-cw`,"aria-label":`Reload the preview`,loading:m.value,onClick:N},null,8,[`loading`])]),_:1}),j(`div`,gq,[H(g,{name:r.value===`published`?`i-lucide-globe`:`i-lucide-eye`,class:`size-3.5 shrink-0 text-dimmed`,"aria-hidden":`true`},null,8,[`name`]),j(`span`,{class:`truncate font-mono text-xs text-muted`,title:u.value},q(u.value||e.url.pathname),9,_q),j(`span`,{class:G([`ms-auto shrink-0 rounded-sm px-1.5 py-0.5 text-[11px]/none font-medium`,r.value===`published`?`bg-success/10 text-success`:e.local?`bg-warning/10 text-warning`:`bg-info/10 text-info`]),role:`status`},q(E.value),3)]),j(`div`,vq,[(J(),b(O,null,s([{label:`Draft`,value:`draft`},{label:`Published`,value:`published`}],e=>j(`button`,{key:e.value,type:`button`,role:`radio`,class:G([`h-6 rounded-[4px] px-2 text-xs focus-visible:outline-2`,r.value===e.value?`bg-elevated text-highlighted`:`text-muted hover:text-highlighted`]),"aria-checked":r.value===e.value,tabindex:r.value===e.value?0:-1,onClick:t=>r.value=e.value,onKeydown:n[1]||=e=>U(e,e=>r.value=e===`first`?`draft`:e===`last`||r.value===`draft`?`published`:`draft`)},q(e.label),43,yq)),64))]),j(`div`,bq,[(J(),b(O,null,s([{label:`Desktop`,value:`desktop`,icon:`i-lucide-monitor`},{label:`Mobile`,value:`mobile`,icon:`i-lucide-smartphone`}],e=>H(p,{key:e.value,text:e.label,content:{side:`bottom`}},{default:i(()=>[j(`button`,{type:`button`,role:`radio`,class:G([`grid size-6 place-items-center rounded-[4px] focus-visible:outline-2`,a.value===e.value?`bg-elevated text-highlighted`:`text-muted hover:text-highlighted`]),"aria-checked":a.value===e.value,"aria-label":e.label,tabindex:a.value===e.value?0:-1,onClick:t=>a.value=e.value,onKeydown:n[2]||=e=>U(e,e=>a.value=e===`first`?`desktop`:e===`last`||a.value===`desktop`?`mobile`:`desktop`)},[H(g,{name:e.icon,class:`size-3.5`,"aria-hidden":`true`},null,8,[`name`])],42,xq)]),_:2},1032,[`text`])),64))]),H(p,{text:`Open in a new tab`,content:{side:`bottom`}},{default:i(()=>[H(f,{variant:`ghost`,size:`sm`,icon:`i-lucide-external-link`,"aria-label":`Open the preview in a new tab`,onClick:oe})]),_:1}),e.overlay?M(``,!0):(J(),k(p,{key:1,text:`Close the preview`,content:{side:`bottom`}},{default:i(()=>[H(f,{variant:`ghost`,size:`sm`,icon:`i-lucide-x`,"aria-label":`Close the preview`,onClick:n[3]||=e=>o(`close`)})]),_:1}))]),j(`div`,{class:G([`relative min-h-0 flex-1 overflow-auto`,a.value===`mobile`?`bg-elevated/40 px-4 py-5`:``])},[d.value?(J(),b(`div`,Sq,[j(`p`,Cq,q(d.value),1),H(f,{variant:`outline`,size:`sm`,label:`Retry`,onClick:N})])):(J(),b(`div`,{key:1,ref_key:`frameStack`,ref:h,class:G([`relative mx-auto h-full bg-white`,a.value===`mobile`?`overflow-hidden rounded-[1.25rem] shadow-sm ring-1 ring-default`:`w-full`]),style:re(a.value===`mobile`?{width:`${F(390)}px`,maxWidth:`100%`}:void 0)},[(J(!0),b(O,null,s(c.value,t=>(J(),b(`iframe`,{key:t.key,name:w(t.key),src:t.src,title:`${E.value} preview of ${u.value||e.url.pathname}`,referrerpolicy:`same-origin`,class:G([`absolute inset-0 size-full border-0`,t.key===l.value?``:`invisible`]),"aria-hidden":t.key===l.value?void 0:`true`,tabindex:t.key===l.value?void 0:-1,onLoad:e=>R(t,e)},null,42,wq))),128))],6))],2)])}}}),Oq={slots:{root:[`relative inline-flex items-center`,`flex-wrap`],base:[`rounded-md`,`transition-colors`],leading:`absolute inset-y-0 start-0 flex items-center`,leadingIcon:`shrink-0 text-dimmed`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailing:`absolute inset-y-0 end-0 flex items-center`,trailingIcon:`shrink-0 text-dimmed`,item:`px-1.5 py-0.5 rounded-sm font-medium inline-flex items-center gap-0.5 ring ring-inset ring-accented bg-elevated text-default data-disabled:cursor-not-allowed data-disabled:opacity-75 wrap-anywhere data-[state=active]:bg-accented`,itemText:``,itemDelete:[`inline-flex items-center rounded-xs text-dimmed hover:text-default hover:bg-accented/75 disabled:pointer-events-none`,`transition-colors`],itemDeleteIcon:`shrink-0`,input:`flex-1 border-0 bg-transparent placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},size:{xs:{base:`px-2 py-1 text-sm/4 gap-1`,leading:`ps-2`,trailing:`pe-2`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,item:`text-[10px]/3`,itemDeleteIcon:`size-3`},sm:{base:`px-2.5 py-1.5 text-sm/4 gap-1.5`,leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,item:`text-[10px]/3`,itemDeleteIcon:`size-3`},md:{base:`px-2.5 py-1.5 text-base/5 gap-1.5`,leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,item:`text-xs`,itemDeleteIcon:`size-3.5`},lg:{base:`px-3 py-2 text-base/5 gap-2`,leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,item:`text-xs`,itemDeleteIcon:`size-3.5`},xl:{base:`px-3 py-2 text-base gap-2`,leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-6`,leadingAvatarSize:`xs`,trailingIcon:`size-6`,item:`text-sm`,itemDeleteIcon:`size-4`}},variant:{outline:`text-highlighted bg-default ring ring-inset ring-accented`,soft:`text-highlighted bg-elevated/50 hover:bg-elevated has-focus:bg-elevated disabled:bg-elevated/50`,subtle:`text-highlighted bg-elevated ring ring-inset ring-accented`,ghost:`text-highlighted bg-transparent hover:bg-elevated has-focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent`,none:`text-highlighted bg-transparent has-focus:outline-none`},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},leading:{true:``},trailing:{true:``},loading:{true:``},highlight:{true:``},fixed:{false:``},type:{file:`file:me-1.5 file:font-medium file:text-muted file:outline-none`}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:`outline-primary/25 has-focus-visible:outline-3 has-focus-visible:ring-primary`},{color:`secondary`,variant:[`outline`,`subtle`],class:`outline-secondary/25 has-focus-visible:outline-3 has-focus-visible:ring-secondary`},{color:`success`,variant:[`outline`,`subtle`],class:`outline-success/25 has-focus-visible:outline-3 has-focus-visible:ring-success`},{color:`info`,variant:[`outline`,`subtle`],class:`outline-info/25 has-focus-visible:outline-3 has-focus-visible:ring-info`},{color:`warning`,variant:[`outline`,`subtle`],class:`outline-warning/25 has-focus-visible:outline-3 has-focus-visible:ring-warning`},{color:`error`,variant:[`outline`,`subtle`],class:`outline-error/25 has-focus-visible:outline-3 has-focus-visible:ring-error`},{color:`primary`,variant:[`soft`,`ghost`],class:`outline-primary/25 has-focus-visible:outline-3`},{color:`secondary`,variant:[`soft`,`ghost`],class:`outline-secondary/25 has-focus-visible:outline-3`},{color:`success`,variant:[`soft`,`ghost`],class:`outline-success/25 has-focus-visible:outline-3`},{color:`info`,variant:[`soft`,`ghost`],class:`outline-info/25 has-focus-visible:outline-3`},{color:`warning`,variant:[`soft`,`ghost`],class:`outline-warning/25 has-focus-visible:outline-3`},{color:`error`,variant:[`soft`,`ghost`],class:`outline-error/25 has-focus-visible:outline-3`},{color:`primary`,highlight:!0,class:`ring ring-inset ring-primary`},{color:`secondary`,highlight:!0,class:`ring ring-inset ring-secondary`},{color:`success`,highlight:!0,class:`ring ring-inset ring-success`},{color:`info`,highlight:!0,class:`ring ring-inset ring-info`},{color:`warning`,highlight:!0,class:`ring ring-inset ring-warning`},{color:`error`,highlight:!0,class:`ring ring-inset ring-error`},{color:`neutral`,variant:[`outline`,`subtle`],class:`outline-inverted/25 has-focus-visible:outline-3 has-focus-visible:ring-inverted`},{color:`neutral`,variant:[`soft`,`ghost`],class:`outline-inverted/25 has-focus-visible:outline-3`},{color:`neutral`,highlight:!0,class:`ring ring-inset ring-inverted`},{leading:!0,size:`xs`,class:`ps-7`},{leading:!0,size:`sm`,class:`ps-8`},{leading:!0,size:`md`,class:`ps-9`},{leading:!0,size:`lg`,class:`ps-10`},{leading:!0,size:`xl`,class:`ps-11`},{trailing:!0,size:`xs`,class:`pe-7`},{trailing:!0,size:`sm`,class:`pe-8`},{trailing:!0,size:`md`,class:`pe-9`},{trailing:!0,size:`lg`,class:`pe-10`},{trailing:!0,size:`xl`,class:`pe-11`},{loading:!0,leading:!0,class:{leadingIcon:`animate-spin`}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:`animate-spin`}},{fixed:!1,size:`xs`,class:`md:text-xs`},{fixed:!1,size:`sm`,class:`md:text-xs`},{fixed:!1,size:`md`,class:`md:text-sm`},{fixed:!1,size:`lg`,class:`md:text-sm`}],defaultVariants:{size:`md`,color:`primary`,variant:`outline`}},kq=Object.assign({inheritAttrs:!1},{__name:`InputTags`,props:{as:{type:null,required:!1},placeholder:{type:String,required:!1},maxLength:{type:Number,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},deleteIcon:{type:null,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},modelValue:{type:[Array,null],required:!1},defaultValue:{type:Array,required:!1},addOnPaste:{type:Boolean,required:!1},addOnTab:{type:Boolean,required:!1},addOnBlur:{type:Boolean,required:!1},duplicate:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},delimiter:{type:null,required:!1},max:{type:Number,required:!1},id:{type:String,required:!1},convertValue:{type:Function,required:!1},displayValue:{type:Function,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:[`change`,`blur`,`focus`,`update:modelValue`,`invalid`,`addTag`,`removeTag`],setup(e,{expose:t,emit:n}){let r=e,a=n,l=y(),u=hr(`inputTags`,r),d=_e(),f=mr(C(u,`as`,`addOnPaste`,`addOnTab`,`addOnBlur`,`duplicate`,`delimiter`,`max`,`convertValue`,`displayValue`,`required`),a),{emitFormBlur:m,emitFormFocus:h,emitFormChange:g,emitFormInput:_,size:v,color:x,id:S,name:w,highlight:T,disabled:E,ariaAttrs:D}=pr(r),{orientation:A,size:j}=fr(r),{isLeading:N,isTrailing:P,leadingIconName:I,trailingIconName:L}=ur(u),R=p(()=>x.value??u.color),z=p(()=>T.value??u.highlight),te=p(()=>j.value??v.value??u.size),B=p(()=>E.value??u.disabled),V=p(()=>nr({extend:Oq,...d.ui?.inputTags||{}})({color:R.value,variant:u.variant,size:te.value,loading:u.loading,highlight:z.value,fixed:u.fixed,leading:N.value||!!u.avatar||!!l.leading,trailing:P.value||!!l.trailing,fieldGroup:A.value})),ne=c(`inputRef`);function re(){u.autofocus&&ne.value?.$el?.focus()}let ie;he(()=>{ie=setTimeout(()=>{re()},u.autofocusDelay)}),se(()=>clearTimeout(ie));function ae(e){if(ee(u.modelValue)===e)return;let t=new Event(`change`,{target:{value:e}});a(`change`,t),g(),_()}function oe(e){a(`blur`,e),m()}function U(e){a(`focus`,e),h()}return t({inputRef:fe(()=>ne.value?.$el)}),(e,t)=>(J(),k(F(La),W({id:F(S),"model-value":F(u).modelValue,"default-value":F(u).defaultValue,"data-slot":e.$attrs[`data-slot`]??`root`,class:V.value.root({class:[V.value.base({class:F(u).ui?.base}),F(u).ui?.root,F(u).class]})},F(f),{name:F(w),disabled:B.value,"onUpdate:modelValue":ae}),{default:i(({modelValue:t})=>[(J(!0),b(O,null,s(t,(t,n)=>(J(),k(F(Va),{key:n,value:t,"data-slot":`item`,class:G(V.value.item({class:[F(u).ui?.item]}))},{default:i(()=>[H(F(Ua),{"data-slot":`itemText`,class:G(V.value.itemText({class:[F(u).ui?.itemText]}))},{default:i(()=>[l[`item-text`]?o(e.$slots,`item-text`,{item:t,index:n,ui:V.value},void 0,void 0,0):M(``,!0)]),_:2},1032,[`class`]),H(F(Ha),{"data-slot":`itemDelete`,class:G(V.value.itemDelete({class:[F(u).ui?.itemDelete]})),disabled:B.value},{default:i(()=>[o(e.$slots,`item-delete`,{item:t,index:n,ui:V.value},()=>[H(ge,{name:F(u).deleteIcon||F(d).ui.icons.close,"data-slot":`itemDeleteIcon`,class:G(V.value.itemDeleteIcon({class:[F(u).ui?.itemDeleteIcon]}))},null,8,[`name`,`class`])])]),_:2},1032,[`class`,`disabled`])]),_:2},1032,[`value`,`class`]))),128)),H(F(Ra),W({ref_key:`inputRef`,ref:ne},{...e.$attrs,...F(D)},{placeholder:F(u).placeholder,"max-length":F(u).maxLength,"data-slot":`input`,class:V.value.input({class:F(u).ui?.input}),onBlur:oe,onFocus:U}),null,16,[`placeholder`,`max-length`,`class`]),o(e.$slots,`default`,{ui:V.value}),F(N)||F(u).avatar||l.leading?(J(),b(`span`,{key:0,"data-slot":`leading`,class:G(V.value.leading({class:F(u).ui?.leading}))},[o(e.$slots,`leading`,{ui:V.value},()=>[F(N)&&F(I)?(J(),k(ge,{key:0,name:F(I),"data-slot":`leadingIcon`,class:G(V.value.leadingIcon({class:F(u).ui?.leadingIcon}))},null,8,[`name`,`class`])):F(u).avatar?(J(),k(sr,W({key:1,size:F(u).ui?.leadingAvatarSize||V.value.leadingAvatarSize()},F(u).avatar,{"data-slot":`leadingAvatar`,class:V.value.leadingAvatar({class:F(u).ui?.leadingAvatar})}),null,16,[`size`,`class`])):M(``,!0)])],2)):M(``,!0),F(P)||l.trailing?(J(),b(`span`,{key:1,"data-slot":`trailing`,class:G(V.value.trailing({class:F(u).ui?.trailing}))},[o(e.$slots,`trailing`,{ui:V.value},()=>[F(L)?(J(),k(ge,{key:0,name:F(L),"data-slot":`trailingIcon`,class:G(V.value.trailingIcon({class:F(u).ui?.trailingIcon}))},null,8,[`name`,`class`])):M(``,!0)])],2)):M(``,!0)]),_:3},16,[`id`,`model-value`,`default-value`,`data-slot`,`class`,`name`,`disabled`]))}}),Aq={slots:{root:``,header:`flex items-center justify-between`,body:`flex flex-col space-y-4 pt-4 sm:flex-row sm:space-x-4 sm:space-y-0`,heading:`flex-1 min-w-0 text-center`,headingLabel:`font-medium block truncate p-1.5`,grid:`w-full border-collapse select-none space-y-1 focus:outline-none`,gridRow:`grid`,gridWeekDaysRow:`mb-1 grid w-full grid-cols-7`,gridBody:`grid`,headCell:`rounded-md`,headCellWeek:`rounded-md text-muted`,cell:`relative text-center`,cellTrigger:[`m-0.5 relative flex items-center justify-center whitespace-nowrap focus-visible:outline-3 data-disabled:text-muted data-unavailable:line-through data-unavailable:text-muted data-unavailable:pointer-events-none data-today:font-semibold`,`transition`],cellWeek:`relative text-center text-muted`},variants:{color:{primary:{headCell:`text-primary`,cellTrigger:`outline-primary/25`},secondary:{headCell:`text-secondary`,cellTrigger:`outline-secondary/25`},success:{headCell:`text-success`,cellTrigger:`outline-success/25`},info:{headCell:`text-info`,cellTrigger:`outline-info/25`},warning:{headCell:`text-warning`,cellTrigger:`outline-warning/25`},error:{headCell:`text-error`,cellTrigger:`outline-error/25`},neutral:{headCell:`text-highlighted`,cellTrigger:`outline-inverted/25`}},variant:{solid:``,outline:``,soft:``,subtle:``},size:{xs:{headingLabel:`text-xs`,cell:`text-xs`,cellWeek:`text-xs`,headCell:`text-[10px]`,headCellWeek:`text-[10px]`,body:`space-y-2 pt-2`},sm:{headingLabel:`text-xs`,headCell:`text-xs`,headCellWeek:`text-xs`,cellWeek:`text-xs`,cell:`text-xs`},md:{headingLabel:`text-sm`,headCell:`text-xs`,headCellWeek:`text-xs`,cellWeek:`text-xs`,cell:`text-sm`},lg:{headingLabel:`text-base`,headCell:`text-base`,headCellWeek:`text-base`,cellWeek:`text-base`,cell:`text-base`},xl:{headingLabel:`text-lg`,headCell:`text-lg`,headCellWeek:`text-lg`,cellWeek:`text-lg`,cell:`text-lg`}},view:{day:{gridRow:`grid-cols-7 place-items-center`,cellTrigger:`rounded-full data-outside-view:text-muted`},month:{gridRow:`grid-cols-4`,cellTrigger:`rounded-md`},year:{gridRow:`grid-cols-4`,cellTrigger:`rounded-md`}},weekNumbers:{true:``}},compoundVariants:[{color:`primary`,variant:`solid`,class:{cellTrigger:`data-selected:bg-primary data-selected:text-inverted data-today:not-data-selected:text-primary data-highlighted:bg-primary/20 hover:not-data-selected:bg-primary/20`}},{color:`secondary`,variant:`solid`,class:{cellTrigger:`data-selected:bg-secondary data-selected:text-inverted data-today:not-data-selected:text-secondary data-highlighted:bg-secondary/20 hover:not-data-selected:bg-secondary/20`}},{color:`success`,variant:`solid`,class:{cellTrigger:`data-selected:bg-success data-selected:text-inverted data-today:not-data-selected:text-success data-highlighted:bg-success/20 hover:not-data-selected:bg-success/20`}},{color:`info`,variant:`solid`,class:{cellTrigger:`data-selected:bg-info data-selected:text-inverted data-today:not-data-selected:text-info data-highlighted:bg-info/20 hover:not-data-selected:bg-info/20`}},{color:`warning`,variant:`solid`,class:{cellTrigger:`data-selected:bg-warning data-selected:text-inverted data-today:not-data-selected:text-warning data-highlighted:bg-warning/20 hover:not-data-selected:bg-warning/20`}},{color:`error`,variant:`solid`,class:{cellTrigger:`data-selected:bg-error data-selected:text-inverted data-today:not-data-selected:text-error data-highlighted:bg-error/20 hover:not-data-selected:bg-error/20`}},{color:`primary`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-primary/50 data-selected:text-primary data-selected:focus-visible:ring-primary data-today:not-data-selected:text-primary data-highlighted:bg-primary/10 hover:not-data-selected:bg-primary/10`}},{color:`secondary`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-secondary/50 data-selected:text-secondary data-selected:focus-visible:ring-secondary data-today:not-data-selected:text-secondary data-highlighted:bg-secondary/10 hover:not-data-selected:bg-secondary/10`}},{color:`success`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-success/50 data-selected:text-success data-selected:focus-visible:ring-success data-today:not-data-selected:text-success data-highlighted:bg-success/10 hover:not-data-selected:bg-success/10`}},{color:`info`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-info/50 data-selected:text-info data-selected:focus-visible:ring-info data-today:not-data-selected:text-info data-highlighted:bg-info/10 hover:not-data-selected:bg-info/10`}},{color:`warning`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-warning/50 data-selected:text-warning data-selected:focus-visible:ring-warning data-today:not-data-selected:text-warning data-highlighted:bg-warning/10 hover:not-data-selected:bg-warning/10`}},{color:`error`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-error/50 data-selected:text-error data-selected:focus-visible:ring-error data-today:not-data-selected:text-error data-highlighted:bg-error/10 hover:not-data-selected:bg-error/10`}},{color:`primary`,variant:`soft`,class:{cellTrigger:`data-selected:bg-primary/10 data-selected:text-primary data-today:not-data-selected:text-primary data-highlighted:bg-primary/20 hover:not-data-selected:bg-primary/20`}},{color:`secondary`,variant:`soft`,class:{cellTrigger:`data-selected:bg-secondary/10 data-selected:text-secondary data-today:not-data-selected:text-secondary data-highlighted:bg-secondary/20 hover:not-data-selected:bg-secondary/20`}},{color:`success`,variant:`soft`,class:{cellTrigger:`data-selected:bg-success/10 data-selected:text-success data-today:not-data-selected:text-success data-highlighted:bg-success/20 hover:not-data-selected:bg-success/20`}},{color:`info`,variant:`soft`,class:{cellTrigger:`data-selected:bg-info/10 data-selected:text-info data-today:not-data-selected:text-info data-highlighted:bg-info/20 hover:not-data-selected:bg-info/20`}},{color:`warning`,variant:`soft`,class:{cellTrigger:`data-selected:bg-warning/10 data-selected:text-warning data-today:not-data-selected:text-warning data-highlighted:bg-warning/20 hover:not-data-selected:bg-warning/20`}},{color:`error`,variant:`soft`,class:{cellTrigger:`data-selected:bg-error/10 data-selected:text-error data-today:not-data-selected:text-error data-highlighted:bg-error/20 hover:not-data-selected:bg-error/20`}},{color:`primary`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-primary/10 data-selected:text-primary data-selected:ring data-selected:ring-inset data-selected:ring-primary/25 data-selected:focus-visible:ring-primary data-today:not-data-selected:text-primary data-highlighted:bg-primary/20 hover:not-data-selected:bg-primary/20`}},{color:`secondary`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-secondary/10 data-selected:text-secondary data-selected:ring data-selected:ring-inset data-selected:ring-secondary/25 data-selected:focus-visible:ring-secondary data-today:not-data-selected:text-secondary data-highlighted:bg-secondary/20 hover:not-data-selected:bg-secondary/20`}},{color:`success`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-success/10 data-selected:text-success data-selected:ring data-selected:ring-inset data-selected:ring-success/25 data-selected:focus-visible:ring-success data-today:not-data-selected:text-success data-highlighted:bg-success/20 hover:not-data-selected:bg-success/20`}},{color:`info`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-info/10 data-selected:text-info data-selected:ring data-selected:ring-inset data-selected:ring-info/25 data-selected:focus-visible:ring-info data-today:not-data-selected:text-info data-highlighted:bg-info/20 hover:not-data-selected:bg-info/20`}},{color:`warning`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-warning/10 data-selected:text-warning data-selected:ring data-selected:ring-inset data-selected:ring-warning/25 data-selected:focus-visible:ring-warning data-today:not-data-selected:text-warning data-highlighted:bg-warning/20 hover:not-data-selected:bg-warning/20`}},{color:`error`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-error/10 data-selected:text-error data-selected:ring data-selected:ring-inset data-selected:ring-error/25 data-selected:focus-visible:ring-error data-today:not-data-selected:text-error data-highlighted:bg-error/20 hover:not-data-selected:bg-error/20`}},{color:`neutral`,variant:`solid`,class:{cellTrigger:`data-selected:bg-inverted data-selected:text-inverted data-today:not-data-selected:text-highlighted data-highlighted:bg-inverted/20 hover:not-data-selected:bg-inverted/10`}},{color:`neutral`,variant:`outline`,class:{cellTrigger:`data-selected:ring data-selected:ring-inset data-selected:ring-accented data-selected:text-default data-selected:bg-default data-selected:focus-visible:ring-inverted data-today:not-data-selected:text-highlighted data-highlighted:bg-inverted/10 hover:not-data-selected:bg-inverted/10`}},{color:`neutral`,variant:`soft`,class:{cellTrigger:`data-selected:bg-elevated data-selected:text-default data-today:not-data-selected:text-highlighted data-highlighted:bg-inverted/20 hover:not-data-selected:bg-inverted/10`}},{color:`neutral`,variant:`subtle`,class:{cellTrigger:`data-selected:bg-elevated data-selected:text-default data-selected:ring data-selected:ring-inset data-selected:ring-accented data-selected:focus-visible:ring-inverted data-today:not-data-selected:text-highlighted data-highlighted:bg-inverted/20 hover:not-data-selected:bg-inverted/10`}},{size:`xs`,view:`day`,class:{cellTrigger:`size-6`}},{size:`sm`,view:`day`,class:{cellTrigger:`size-7`}},{size:`md`,view:`day`,class:{cellTrigger:`size-8`}},{size:`lg`,view:`day`,class:{cellTrigger:`size-9`}},{size:`xl`,view:`day`,class:{cellTrigger:`size-10`}},{size:`xs`,view:[`month`,`year`],class:{cellTrigger:`h-6 px-2`}},{size:`sm`,view:[`month`,`year`],class:{cellTrigger:`h-7 px-2`}},{size:`md`,view:[`month`,`year`],class:{cellTrigger:`h-8 px-3`}},{size:`lg`,view:[`month`,`year`],class:{cellTrigger:`h-9 px-4`}},{size:`xl`,view:[`month`,`year`],class:{cellTrigger:`h-10 px-5`}},{view:`day`,weekNumbers:!0,class:{gridRow:`grid-cols-8`,gridWeekDaysRow:`grid-cols-8 [&>*:first-child]:col-start-2`}}],defaultVariants:{size:`md`,color:`primary`,variant:`solid`,view:`day`}},jq={__name:`Calendar`,props:{as:{type:null,required:!1},type:{type:String,required:!1,default:`date`},nextYearIcon:{type:null,required:!1},nextYear:{type:Object,required:!1},nextMonthIcon:{type:null,required:!1},nextMonth:{type:Object,required:!1},prevYearIcon:{type:null,required:!1},prevYear:{type:Object,required:!1},prevMonthIcon:{type:null,required:!1},prevMonth:{type:Object,required:!1},viewControl:{type:[Boolean,Object],required:!1,default:!0},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},range:{type:Boolean,required:!1},multiple:{type:Boolean,required:!1},monthControls:{type:Boolean,required:!1,default:!0},yearControls:{type:Boolean,required:!1,default:!0},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},weekNumbers:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},defaultPlaceholder:{type:Object,required:!1},placeholder:{type:Object,required:!1},allowNonContiguousRanges:{type:Boolean,required:!1},pagedNavigation:{type:Boolean,required:!1},preventDeselect:{type:Boolean,required:!1},maximumDays:{type:Number,required:!1},weekStartsOn:{type:Number,required:!1},weekdayFormat:{type:String,required:!1},fixedWeeks:{type:Boolean,required:!1,default:!0},maxValue:{type:Object,required:!1},minValue:{type:Object,required:!1},locale:{type:String,required:!1},numberOfMonths:{type:Number,required:!1},disabled:{type:Boolean,required:!1},readonly:{type:Boolean,required:!1},initialFocus:{type:Boolean,required:!1},isDateDisabled:{type:Function,required:!1},isDateUnavailable:{type:Function,required:!1},isDateHighlightable:{type:Function,required:!1},nextPage:{type:Function,required:!1},prevPage:{type:Function,required:!1},disableDaysOutsideCurrentView:{type:Boolean,required:!1},fixedDate:{type:String,required:!1},isMonthDisabled:{type:Function,required:!1},isMonthUnavailable:{type:Function,required:!1},isYearDisabled:{type:Function,required:!1},isYearUnavailable:{type:Function,required:!1}},emits:[`update:modelValue`,`update:placeholder`,`update:startValue`,`update:validModelValue`],setup(e,{emit:n}){let r=e,a=n,c=hr(`calendar`,r),{dir:l,t:u,locale:d}=Ln(),m=_e(),h=[`day`,`month`,`year`],g=p(()=>c.type===`year`?`year`:c.type===`month`?`month`:`day`),_=`year`,v=A(g.value);f(()=>c.type,()=>{v.value=g.value});let y=p(()=>g.value!==_),x=p(()=>v.value===g.value);function S(e){let t=h.indexOf(g.value),n=h.indexOf(_);return h[Math.min(Math.max(h.indexOf(e),t),n)]}function C(e){v.value=S(e)}function w(){let e=h.indexOf(_),t=h.indexOf(v.value)>=e?g.value:h[h.indexOf(v.value)+1];v.value=t}function T(e){if(Array.isArray(e))return e[0];if(e){if(`start`in e||`end`in e){let t=e;return t.start??t.end??void 0}return e}}let E=t(c.placeholder??T(c.modelValue)??T(c.defaultValue)??Ne(en()));f(()=>c.placeholder,e=>{e&&(E.value=e)});function D(e){E.value=e,a(`update:placeholder`,e)}function N(e){if(x.value){a(`update:modelValue`,e);return}let t=T(e);t&&D(t),C(h[h.indexOf(v.value)-1])}function P(e,t){return t===-1?e.subtract({years:1}):e.add({years:1})}let I=p(()=>{let e=c.range&&x.value;return v.value===`year`?e?_t:An:v.value===`month`?e?Ot:Gt:c.range?Nn:Ut}),L=[`type`,`placeholder`,`range`,`modelValue`,`defaultValue`,`color`,`variant`,`size`,`monthControls`,`yearControls`,`viewControl`,`class`,`ui`],R=[`pagedNavigation`,`weekStartsOn`,`weekdayFormat`,`fixedWeeks`,`numberOfMonths`,`isDateDisabled`,`isDateUnavailable`,`isDateHighlightable`,`disableDaysOutsideCurrentView`,`maximumDays`],ee=[`isMonthDisabled`,`isMonthUnavailable`],z=[`isYearDisabled`,`isYearUnavailable`],te=[`allowNonContiguousRanges`,`fixedDate`],B=mr(pe(c,(e,t)=>L.includes(t)||v.value!==`day`&&R.includes(t)||v.value!==`month`&&ee.includes(t)||v.value!==`year`&&z.includes(t)||!x.value&&te.includes(t)));function V(e,t){return v.value===`month`?{month:e}:v.value===`year`?{year:e}:{day:e,month:t}}let ne=p(()=>c.nextYearIcon||(l.value===`rtl`?m.ui.icons.chevronDoubleLeft:m.ui.icons.chevronDoubleRight)),re=p(()=>c.nextMonthIcon||(l.value===`rtl`?m.ui.icons.chevronLeft:m.ui.icons.chevronRight)),ie=p(()=>c.prevYearIcon||(l.value===`rtl`?m.ui.icons.chevronDoubleRight:m.ui.icons.chevronDoubleLeft)),ae=p(()=>c.prevMonthIcon||(l.value===`rtl`?m.ui.icons.chevronRight:m.ui.icons.chevronLeft)),oe=p(()=>v.value===`day`?u(`calendar.prevMonth`):u(`calendar.prevYear`)),U=p(()=>v.value===`day`?u(`calendar.nextMonth`):u(`calendar.nextYear`)),se=p(()=>nr({extend:Aq,...m.ui?.calendar||{}})({color:c.color,size:c.size,variant:c.variant,weekNumbers:c.weekNumbers,view:v.value}));return(e,t)=>(J(),k(F(I).Root,W(F(B),{"model-value":x.value?F(c).modelValue:void 0,"default-value":x.value?F(c).defaultValue:void 0,placeholder:E.value,"data-slot":`root`,class:se.value.root({class:[F(c).ui?.root,F(c).class]}),"onUpdate:placeholder":D,"onUpdate:modelValue":N,"onUpdate:startValue":t[0]||=e=>a(`update:startValue`,e),"onUpdate:validModelValue":t[1]||=e=>a(`update:validModelValue`,e)}),{default:i(({weekDays:t,grid:n,date:r})=>[H(F(I).Header,{"data-slot":`header`,class:G(se.value.header({class:F(c).ui?.header}))},{default:i(()=>[v.value===`day`&&F(c).yearControls?(J(),k(F(I).Prev,{key:0,"prev-page":e=>P(e,-1),"aria-label":F(u)(`calendar.prevYear`),"as-child":``},{default:i(()=>[H(dr,W({icon:ie.value,size:F(c).size,color:`neutral`,variant:`ghost`},F(c).prevYear),null,16,[`icon`,`size`])]),_:1},8,[`prev-page`,`aria-label`])):M(``,!0),v.value!==`day`||F(c).monthControls?(J(),k(F(I).Prev,{key:1,"aria-label":oe.value,"as-child":``},{default:i(()=>[H(dr,W({icon:ae.value,size:F(c).size,color:`neutral`,variant:`ghost`},F(c).prevMonth),null,16,[`icon`,`size`])]),_:1},8,[`aria-label`])):M(``,!0),H(F(I).Heading,{"data-slot":`heading`,class:G(se.value.heading({class:F(c).ui?.heading}))},{default:i(({headingValue:t})=>[o(e.$slots,`heading`,{value:t,view:v.value,date:r,setView:C,setPlaceholder:D},()=>[y.value&&F(c).viewControl?(J(),k(dr,W({key:0,label:t,size:F(c).size,color:`neutral`,variant:`ghost`,block:``},typeof F(c).viewControl==`object`?F(c).viewControl:{},{onClick:w}),null,16,[`label`,`size`])):(J(),b(`span`,{key:1,"data-slot":`headingLabel`,class:G(se.value.headingLabel({class:F(c).ui?.headingLabel}))},q(t),3))])]),_:2},1032,[`class`]),v.value!==`day`||F(c).monthControls?(J(),k(F(I).Next,{key:2,"aria-label":U.value,"as-child":``},{default:i(()=>[H(dr,W({icon:re.value,size:F(c).size,color:`neutral`,variant:`ghost`},F(c).nextMonth),null,16,[`icon`,`size`])]),_:1},8,[`aria-label`])):M(``,!0),v.value===`day`&&F(c).yearControls?(J(),k(F(I).Next,{key:3,"next-page":e=>P(e,1),"aria-label":F(u)(`calendar.nextYear`),"as-child":``},{default:i(()=>[H(dr,W({icon:ne.value,size:F(c).size,color:`neutral`,variant:`ghost`},F(c).nextYear),null,16,[`icon`,`size`])]),_:1},8,[`next-page`,`aria-label`])):M(``,!0)]),_:2},1032,[`class`]),j(`div`,{"data-slot":`body`,class:G(se.value.body({class:F(c).ui?.body}))},[(J(!0),b(O,null,s(Array.isArray(n)?n:[n],n=>(J(),k(F(I).Grid,{key:n.value.toString(),"data-slot":`grid`,class:G(se.value.grid({class:F(c).ui?.grid}))},{default:i(()=>[`GridHead`in I.value?(J(),k(F(I).GridHead,{key:0},{default:i(()=>[H(F(I).GridRow,{"data-slot":`gridWeekDaysRow`,class:G(se.value.gridWeekDaysRow({class:F(c).ui?.gridWeekDaysRow}))},{default:i(()=>[(J(!0),b(O,null,s(t,t=>(J(),k(F(I).HeadCell,{key:t,"data-slot":`headCell`,class:G(se.value.headCell({class:F(c).ui?.headCell}))},{default:i(()=>[o(e.$slots,`week-day`,{day:t},()=>[K(q(t),1)])]),_:2},1032,[`class`]))),128))]),_:2},1032,[`class`])]),_:2},1024)):M(``,!0),H(F(I).GridBody,{"data-slot":`gridBody`,class:G(se.value.gridBody({class:F(c).ui?.gridBody}))},{default:i(()=>[(J(!0),b(O,null,s(n.rows,(t,r)=>(J(),k(F(I).GridRow,{key:`row-${r}`,"data-slot":`gridRow`,class:G(se.value.gridRow({class:F(c).ui?.gridRow}))},{default:i(()=>[v.value===`day`&&F(c).weekNumbers&&t[0]?(J(),b(`td`,{key:0,role:`gridcell`,"data-slot":`cellWeek`,class:G(se.value.cellWeek({class:F(c).ui?.cellWeek}))},q(F(Mn)(t[0],F(c).locale??F(d).code)),3)):M(``,!0),(J(!0),b(O,null,s(t,t=>(J(),k(F(I).Cell,{key:t.toString(),date:t,"data-slot":`cell`,class:G(se.value.cell({class:F(c).ui?.cell}))},{default:i(()=>[H(F(I).CellTrigger,W({ref_for:!0},V(t,n.value),{"data-slot":`cellTrigger`,class:se.value.cellTrigger({class:F(c).ui?.cellTrigger})}),{default:i(n=>[v.value===`day`?o(e.$slots,`day`,{day:t},()=>[K(q(t.day),1)],void 0,0):v.value===`month`?o(e.$slots,`month-cell`,{month:t,selected:n.selected,disabled:n.disabled},()=>[K(q(n.monthValue),1)],void 0,1):o(e.$slots,`year-cell`,{year:t,selected:n.selected,disabled:n.disabled},()=>[K(q(n.yearValue),1)],void 0,2)]),_:2},1040,[`class`])]),_:2},1032,[`date`,`class`]))),128))]),_:2},1032,[`class`]))),128))]),_:2},1032,[`class`])]),_:2},1032,[`class`]))),128))],2)]),_:3},16,[`model-value`,`default-value`,`placeholder`,`class`]))}},Mq={slots:{root:`relative inline-flex items-center`,base:[`w-full rounded-md border-0 placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],increment:`absolute flex items-center`,decrement:`absolute flex items-center`},variants:{fieldGroup:{horizontal:{root:`group has-focus-visible:z-[1]`,base:`group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none`},vertical:{root:`group has-focus-visible:z-[1]`,base:`group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none`}},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},size:{xs:`px-2 py-1 text-sm/4 gap-1`,sm:`px-2.5 py-1.5 text-sm/4 gap-1.5`,md:`px-2.5 py-1.5 text-base/5 gap-1.5`,lg:`px-3 py-2 text-base/5 gap-2`,xl:`px-3 py-2 text-base gap-2`},variant:{outline:`text-highlighted bg-default ring ring-inset ring-accented`,soft:`text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50`,subtle:`text-highlighted bg-elevated ring ring-inset ring-accented`,ghost:`text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent`,none:`text-highlighted bg-transparent focus:outline-none`},disabled:{true:{increment:`opacity-75 cursor-not-allowed`,decrement:`opacity-75 cursor-not-allowed`}},orientation:{horizontal:{base:`text-center`,increment:`inset-y-0 end-0 pe-1`,decrement:`inset-y-0 start-0 ps-1`},vertical:{increment:`top-0 end-0 pe-1 [&>button]:py-0 scale-80`,decrement:`bottom-0 end-0 pe-1 [&>button]:py-0 scale-80`}},highlight:{true:``},fixed:{false:``},increment:{false:``},decrement:{false:``}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:`outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary`},{color:`secondary`,variant:[`outline`,`subtle`],class:`outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary`},{color:`success`,variant:[`outline`,`subtle`],class:`outline-success/25 focus-visible:outline-3 focus-visible:ring-success`},{color:`info`,variant:[`outline`,`subtle`],class:`outline-info/25 focus-visible:outline-3 focus-visible:ring-info`},{color:`warning`,variant:[`outline`,`subtle`],class:`outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning`},{color:`error`,variant:[`outline`,`subtle`],class:`outline-error/25 focus-visible:outline-3 focus-visible:ring-error`},{color:`primary`,variant:[`soft`,`ghost`],class:`outline-primary/25 focus-visible:outline-3`},{color:`secondary`,variant:[`soft`,`ghost`],class:`outline-secondary/25 focus-visible:outline-3`},{color:`success`,variant:[`soft`,`ghost`],class:`outline-success/25 focus-visible:outline-3`},{color:`info`,variant:[`soft`,`ghost`],class:`outline-info/25 focus-visible:outline-3`},{color:`warning`,variant:[`soft`,`ghost`],class:`outline-warning/25 focus-visible:outline-3`},{color:`error`,variant:[`soft`,`ghost`],class:`outline-error/25 focus-visible:outline-3`},{color:`primary`,highlight:!0,class:`ring ring-inset ring-primary`},{color:`secondary`,highlight:!0,class:`ring ring-inset ring-secondary`},{color:`success`,highlight:!0,class:`ring ring-inset ring-success`},{color:`info`,highlight:!0,class:`ring ring-inset ring-info`},{color:`warning`,highlight:!0,class:`ring ring-inset ring-warning`},{color:`error`,highlight:!0,class:`ring ring-inset ring-error`},{color:`neutral`,variant:[`outline`,`subtle`],class:`outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted`},{color:`neutral`,variant:[`soft`,`ghost`],class:`outline-inverted/25 focus-visible:outline-3`},{color:`neutral`,highlight:!0,class:`ring ring-inset ring-inverted`},{orientation:`horizontal`,decrement:!1,class:`text-start`},{decrement:!0,size:`xs`,class:`ps-7`},{decrement:!0,size:`sm`,class:`ps-8`},{decrement:!0,size:`md`,class:`ps-9`},{decrement:!0,size:`lg`,class:`ps-10`},{decrement:!0,size:`xl`,class:`ps-11`},{increment:!0,size:`xs`,class:`pe-7`},{increment:!0,size:`sm`,class:`pe-8`},{increment:!0,size:`md`,class:`pe-9`},{increment:!0,size:`lg`,class:`pe-10`},{increment:!0,size:`xl`,class:`pe-11`},{fixed:!1,size:`xs`,class:`md:text-xs`},{fixed:!1,size:`sm`,class:`md:text-xs`},{fixed:!1,size:`md`,class:`md:text-sm`},{fixed:!1,size:`lg`,class:`md:text-sm`}],defaultVariants:{size:`md`,color:`primary`,variant:`outline`}},Nq=Object.assign({inheritAttrs:!1},{__name:`InputNumber`,props:{as:{type:null,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},orientation:{type:null,required:!1,default:`horizontal`},increment:{type:[Boolean,Object],required:!1,default:!0},incrementIcon:{type:null,required:!1},incrementDisabled:{type:Boolean,required:!1},decrement:{type:[Boolean,Object],required:!1,default:!0},decrementIcon:{type:null,required:!1},decrementDisabled:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},min:{type:Number,required:!1},max:{type:Number,required:!1},step:{type:Number,required:!1},stepSnapping:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},required:{type:Boolean,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},formatOptions:{type:null,required:!1},disableWheelChange:{type:Boolean,required:!1},invertWheelChange:{type:Boolean,required:!1},readonly:{type:Boolean,required:!1},focusOnChange:{type:Boolean,required:!1},locale:{type:String,required:!1}},emits:[`update:modelValue`,`blur`,`change`],setup(e,{expose:t,emit:n}){let r=e,a=n,s=hr(`inputNumber`,r),{t:l}=Ln(),u=_e(),d=mr(C(s,`as`,`stepSnapping`,`formatOptions`,`disableWheelChange`,`invertWheelChange`,`required`,`readonly`,`focusOnChange`,`locale`)),{emitFormBlur:f,emitFormFocus:m,emitFormChange:h,emitFormInput:g,id:_,color:v,size:y,name:x,highlight:S,disabled:w,ariaAttrs:T}=pr(r),{orientation:E,size:D}=fr(r),O=p(()=>v.value??s.color),A=p(()=>S.value??s.highlight),j=p(()=>D.value??y.value??s.size),N=p(()=>w.value??s.disabled),P=p(()=>nr({extend:Mq,...u.ui?.inputNumber||{}})({color:O.value,variant:s.variant,size:j.value,highlight:A.value,fixed:s.fixed,orientation:s.orientation,fieldGroup:E.value,increment:s.orientation===`vertical`?!!s.increment||!!s.decrement:!!s.increment,decrement:s.orientation!==`vertical`&&!!s.decrement})),I=p(()=>s.incrementIcon||(s.orientation===`horizontal`?u.ui.icons.plus:u.ui.icons.chevronUp)),L=p(()=>s.decrementIcon||(s.orientation===`horizontal`?u.ui.icons.minus:u.ui.icons.chevronDown)),R=c(`inputRef`);function ee(e){if(s.modelModifiers?.optional&&(e??=void 0),e===s.modelValue||e==null&&s.modelValue==null)return;a(`update:modelValue`,e);let t=new Event(`change`,{target:{value:e}});a(`change`,t),h(),g()}function z(e){f(),a(`blur`,e)}function te(){s.autofocus&&R.value?.$el?.focus()}let B;return he(()=>{B=setTimeout(()=>{te()},s.autofocusDelay)}),se(()=>clearTimeout(B)),t({inputRef:fe(()=>R.value?.$el)}),(e,t)=>(J(),k(F(ka),W(F(d),{id:F(_),"default-value":F(s).defaultValue,"model-value":F(s).modelValue,min:F(s).min,max:F(s).max,step:F(s).step,"data-slot":e.$attrs[`data-slot`]??`root`,class:P.value.root({class:[F(s).ui?.root,F(s).class]}),name:F(x),disabled:N.value,"onUpdate:modelValue":t[0]||=e=>ee(e)}),{default:i(()=>[H(F(Ma),W({...e.$attrs,...F(T)},{ref_key:`inputRef`,ref:R,placeholder:F(s).placeholder,required:F(s).required,"data-slot":`base`,class:P.value.base({class:F(s).ui?.base}),onBlur:z,onFocus:F(m)}),null,16,[`placeholder`,`required`,`class`,`onFocus`]),F(s).increment?(J(),b(`div`,{key:0,"data-slot":`increment`,class:G(P.value.increment({class:F(s).ui?.increment}))},[H(F(ja),{"as-child":``,disabled:N.value||F(s).incrementDisabled},{default:i(()=>[o(e.$slots,`increment`,{},()=>[H(dr,W({icon:I.value,color:O.value,size:j.value,variant:`link`,"aria-label":F(l)(`inputNumber.increment`)},typeof F(s).increment==`object`?F(s).increment:void 0),null,16,[`icon`,`color`,`size`,`aria-label`])])]),_:3},8,[`disabled`])],2)):M(``,!0),F(s).decrement?(J(),b(`div`,{key:1,"data-slot":`decrement`,class:G(P.value.decrement({class:F(s).ui?.decrement}))},[H(F(Aa),{"as-child":``,disabled:N.value||F(s).decrementDisabled},{default:i(()=>[o(e.$slots,`decrement`,{},()=>[H(dr,W({icon:L.value,color:O.value,size:j.value,variant:`link`,"aria-label":F(l)(`inputNumber.decrement`)},typeof F(s).decrement==`object`?F(s).decrement:void 0),null,16,[`icon`,`color`,`size`,`aria-label`])])]),_:3},8,[`disabled`])],2)):M(``,!0)]),_:3},16,[`id`,`default-value`,`model-value`,`min`,`max`,`step`,`data-slot`,`class`,`name`,`disabled`]))}}),Pq={key:0,class:`flex h-8 min-w-0 items-center gap-2 px-2.5 text-base md:text-sm`},Fq={key:0,class:`truncate font-mono text-xs text-highlighted`},Iq={key:1,class:`text-dimmed`},Lq={key:2,class:`truncate text-xs text-dimmed`},Rq=[`id`,`disabled`],zq={key:2,class:`grid gap-1 py-1`},Bq={class:`group flex min-w-0 items-center gap-2.5 rounded-md px-2.5 py-1 hover:bg-elevated/50`},Vq=[`src`,`alt`],Hq={class:`grid min-w-0 flex-1`},Uq=[`title`],Wq={key:0,class:`flex shrink-0 gap-0.5 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`},Gq=V({__name:`console-media-field`,props:z({accept:{},disabled:{type:Boolean},inputId:{},kind:{},label:{},store:{}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let n=e,r=_(e,`modelValue`),i=Gb(),a=Ye();function o(e){return e instanceof Object&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}let s=p(()=>{let e=o(r.value);if(String(e.pathname)!==e.pathname||!e.pathname)return;let t={pathname:e.pathname};return String(e.contentType)===e.contentType&&(t.contentType=e.contentType),Number.isFinite(e.size)&&(t.size=Number(e.size)),t}),c=p(()=>s.value?.pathname.slice(s.value.pathname.lastIndexOf(`/`)+1)??``),l=t(),d=A(!1),m=A(``),h=A(``),g=A(!1);f(()=>s.value?.pathname,async e=>{if(l.value=void 0,d.value=!1,m.value=``,h.value=``,e&&i?.describe&&s.value)try{let t=await i.describe(s.value);if(e!==s.value?.pathname)return;l.value=t,d.value=!t,m.value=t?.alt??``,h.value=m.value}catch{}},{immediate:!0});async function v(){if(i&&!n.disabled){g.value=!0;try{let[e]=await i.pick({accept:n.accept??(n.kind===`image`?[`image/*`]:void 0),files:[],kind:n.kind,multiple:!1,store:n.store}),t=e?.reference;if(!t)return;let a={pathname:t.pathname};t.contentType&&(a.contentType=t.contentType),t.size!==void 0&&(a.size=t.size),r.value=a}finally{g.value=!1}}}async function y(){let e=m.value.trim();if(s.value&&i?.updateAlt&&e!==h.value)try{await i.updateAlt(s.value,e),h.value=e}catch{a.error(`Couldn't save the alt text. Try again.`)}}let x=p(()=>d.value?`Missing from the library`:l.value?.width&&l.value.height?`${l.value.width} × ${l.value.height}`:s.value?.contentType??``);return(t,n)=>{let a=ge,o=dr,f=Sn;return F(i)?s.value?(J(),b(`div`,zq,[j(`div`,Bq,[j(`span`,{class:`vitehub-media-field__thumb`,style:re({background:l.value?.color})},[l.value?.thumbnail&&e.kind===`image`?(J(),b(`img`,{key:0,src:l.value.thumbnail,alt:m.value,class:`size-full object-cover`,style:re({objectPosition:F(ti)(l.value.focal,l.value,1)})},null,12,Vq)):(J(),k(a,{key:1,name:d.value?`i-lucide-triangle-alert`:e.kind===`image`?`i-lucide-image`:`i-lucide-file`,class:G([`size-4`,d.value?`text-warning`:`text-dimmed`]),"aria-hidden":`true`},null,8,[`name`,`class`]))],4),j(`span`,Hq,[j(`span`,{class:`truncate text-sm text-highlighted`,title:s.value.pathname},q(c.value),9,Uq),j(`span`,{class:G([`truncate text-xs tabular-nums`,d.value?`text-warning`:`text-dimmed`])},q(x.value),3)]),e.disabled?M(``,!0):(J(),b(`span`,Wq,[H(o,{id:e.inputId,variant:`ghost`,size:`xs`,label:`Replace`,loading:g.value,onClick:v},null,8,[`id`,`loading`]),H(o,{variant:`ghost`,size:`xs`,icon:`i-lucide-x`,"aria-label":`Remove ${e.label.toLowerCase()}`,onClick:n[0]||=e=>r.value=void 0},null,8,[`aria-label`])]))]),e.kind===`image`&&F(i).updateAlt&&!d.value?(J(),k(f,{key:0,modelValue:m.value,"onUpdate:modelValue":n[1]||=e=>m.value=e,size:`sm`,variant:`ghost`,class:`w-full`,disabled:e.disabled,placeholder:`Alt text`,"aria-label":`${e.label} alt text`,ui:{base:`bg-transparent hover:bg-transparent focus:bg-transparent ring-0 hover:ring-1 hover:ring-inset hover:ring-(--ui-border) focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-(--ui-border-accented) text-xs ps-2.5`},onBlur:y,onKeydown:E(u(y,[`prevent`]),[`enter`])},null,8,[`modelValue`,`disabled`,`aria-label`,`onKeydown`])):M(``,!0)])):(J(),b(`button`,{key:1,id:e.inputId,type:`button`,class:`vitehub-media-field__empty`,disabled:e.disabled,onClick:v},[H(a,{name:g.value?`i-lucide-loader-circle`:e.kind===`image`?`i-lucide-image-plus`:`i-lucide-paperclip`,class:G([`size-4 shrink-0`,g.value?`animate-spin`:``]),"aria-hidden":`true`},null,8,[`name`,`class`]),j(`span`,null,q(e.disabled?`Empty`:e.kind===`image`?`Choose an image…`:`Choose a file…`),1)],8,Rq)):(J(),b(`div`,Pq,[s.value?(J(),b(`span`,Fq,q(s.value.pathname),1)):(J(),b(`span`,Iq,`Empty`)),s.value?.contentType?(J(),b(`span`,Lq,q(s.value.contentType),1)):M(``,!0)]))}}}),Kq=[`data-vitehub-field`],qq=[`for`,`title`],Jq={class:`truncate`},Yq={key:0,class:`size-1.5 shrink-0 rounded-full bg-error`,"aria-hidden":`true`},Xq={key:1,class:`sr-only`},Zq=[`aria-label`],Qq={class:`min-w-0`},$q=[`id`],eJ=V({__name:`console-property-row`,props:{description:{},error:{},control:{},depth:{},icon:{},label:{},missing:{type:Boolean}},setup(e){let t=e,n=ie(`vitehubFieldPeople`,void 0),r=p(()=>t.control?n?.value[t.control]??[]:[]);return(t,n)=>{let i=ge;return J(),b(`div`,{class:`grid min-h-8 grid-cols-1 items-start gap-x-1 pb-2 sm:pb-0 sm:grid-cols-[minmax(0,var(--vh-property-label))_minmax(0,1fr)]`,style:re({"--vh-property-label":`calc(10rem - ${e.depth??0} * 1.5rem)`}),"data-vitehub-field":e.control},[j(`label`,{for:e.control,class:G([`flex h-7 min-w-0 items-center gap-2 rounded-md px-1.5 text-[13px] text-muted sm:h-8`,e.error?`text-error`:``]),title:e.description},[H(i,{name:e.icon,class:`size-4 shrink-0 opacity-70`,"aria-hidden":`true`},null,8,[`name`]),j(`span`,Jq,q(e.label),1),e.missing?(J(),b(`span`,Yq)):M(``,!0),e.missing?(J(),b(`span`,Xq,`(required)`)):M(``,!0),r.value.length?(J(),b(`span`,{key:2,class:`ms-auto`,role:`img`,"aria-label":r.value.map(e=>`${e.name} is editing this field`).join(`, `)},[H(F(Xa),{"aria-hidden":`true`,style:{"--vh-avatar-size":`1rem`},people:r.value,variant:`outline`},null,8,[`people`])],8,Zq)):M(``,!0)],10,qq),j(`div`,Qq,[o(t.$slots,`default`),e.error?(J(),b(`p`,{key:0,id:e.control?`${e.control}-error`:void 0,class:`px-2.5 pt-0.5 pb-1.5 text-xs text-error`},q(e.error),9,$q)):M(``,!0)])],12,Kq)}}}),tJ={class:`grid grid-cols-1 ms-3 border-s border-default ps-[calc(0.75rem-1px)]`},nJ=[`aria-label`],rJ=[`id`],iJ={class:`flex min-h-8 items-start gap-1`},aJ=[`aria-expanded`,`aria-controls`,`onClick`],oJ={class:`truncate text-highlighted`},sJ={key:0,class:`min-w-0 truncate text-dimmed`},cJ={key:1,class:`min-w-0 flex-1`},lJ={key:2,class:`flex h-8 shrink-0 items-center opacity-0 group-hover/item:opacity-100 group-focus-within/item:opacity-100 max-sm:opacity-100`},uJ=[`id`],dJ=`size-6 justify-center text-dimmed hover:text-highlighted`,fJ=V({__name:`console-schema-list`,props:z({disabled:{type:Boolean},depth:{},field:{},inputId:{}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=_(e,`modelValue`),r=p(()=>Array.isArray(n.value)?n.value:[]),i=p(()=>t.field.item.kind===`object`),a=p(()=>t.field.item.label.toLowerCase()),c=0,l=A([]);f(()=>r.value.length,e=>{l.value.length!==e&&(l.value=Array.from({length:e},()=>c++))},{immediate:!0});let u=A(new Set);function d(e){return`${t.inputId}-${l.value[e]??e}`}function m(e,n){let r=vS(t.field.item,e);return r.title?r:{...r,title:`${t.field.item.label} ${n+1}`}}function h(e,t){l.value=t,n.value=e}function g(e,t){let i=[...r.value];i[e]=t,n.value=i}async function v(e){for(let t=0;t<3;t++){await ae();let t=e();if(t){t.focus();return}await new Promise(e=>requestAnimationFrame(e))}}function y(e,t){let n=e+t;if(n<0||n>=r.value.length)return;let i=[...r.value],a=[...l.value];[i[e],i[n]]=[i[n],i[e]],[a[e],a[n]]=[a[n],a[e]],h(i,a),v(()=>document.getElementById(`${d(n)}-${t<0?`up`:`down`}`))}function x(e){let n=l.value[e],i=r.value.filter((t,n)=>n!==e);h(i,l.value.filter((t,n)=>n!==e));let a=new Set(u.value);a.delete(n),u.value=a,v(()=>document.getElementById(i.length?`${d(Math.min(e,i.length-1))}-remove`:`${t.inputId}-add`))}async function S(){let e=c++;h([...r.value,gS(t.field.item)],[...l.value,e]),i.value&&(u.value=new Set(u.value).add(e));let n=i.value?`input, textarea, button[role=combobox]`:`input, textarea, button[role=combobox], button[role=switch]`;await v(()=>document.getElementById(i.value?`${t.inputId}-${e}-fields`:`${t.inputId}-${e}`)?.querySelector(n))}function C(e){let t=l.value[e],n=new Set(u.value);n.has(t)?n.delete(t):n.add(t),u.value=n}return(t,n)=>{let c=ge,f=dr;return J(),b(`div`,tJ,[j(`ol`,{class:`grid grid-cols-1`,"aria-label":e.field.label},[(J(!0),b(O,null,s(r.value,(n,a)=>(J(),b(`li`,{id:d(a),key:l.value[a],class:`group/item grid grid-cols-1`},[j(`div`,iJ,[i.value?(J(),b(`button`,{key:0,type:`button`,class:`flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 text-left text-base hover:bg-elevated/70 focus-visible:outline-2 md:text-sm`,"aria-expanded":u.value.has(l.value[a]),"aria-controls":`${d(a)}-fields`,onClick:e=>C(a)},[H(c,{name:`i-lucide-chevron-right`,class:G([`size-3.5 shrink-0 text-dimmed`,u.value.has(l.value[a])?`rotate-90`:``]),"aria-hidden":`true`},null,8,[`class`]),j(`span`,oJ,q(m(n,a).title),1),m(n,a).detail?(J(),b(`span`,sJ,q(m(n,a).detail),1)):M(``,!0)],8,aJ)):(J(),b(`div`,cJ,[o(t.$slots,`item`,{id:d(a),depth:e.depth+1,index:a,value:n,update:e=>g(a,e)})])),e.disabled?M(``,!0):(J(),b(`div`,lJ,[H(f,{id:`${d(a)}-up`,icon:`i-lucide-arrow-up`,size:`xs`,variant:`ghost`,color:`neutral`,class:G(dJ),disabled:a===0,"aria-label":`Move ${m(n,a).title} up`,onClick:e=>y(a,-1)},null,8,[`id`,`disabled`,`aria-label`,`onClick`]),H(f,{id:`${d(a)}-down`,icon:`i-lucide-arrow-down`,size:`xs`,variant:`ghost`,color:`neutral`,class:G(dJ),disabled:a===r.value.length-1,"aria-label":`Move ${m(n,a).title} down`,onClick:e=>y(a,1)},null,8,[`id`,`disabled`,`aria-label`,`onClick`]),H(f,{id:`${d(a)}-remove`,icon:`i-lucide-x`,size:`xs`,variant:`ghost`,color:`neutral`,class:G(dJ),"aria-label":`Remove ${m(n,a).title}`,onClick:e=>x(a)},null,8,[`id`,`aria-label`,`onClick`])]))]),i.value&&u.value.has(l.value[a])?(J(),b(`div`,{key:0,id:`${d(a)}-fields`,class:`grid grid-cols-1 ms-3 border-s border-default ps-[calc(0.75rem-1px)]`},[o(t.$slots,`item`,{id:d(a),depth:e.depth+2,index:a,value:n,update:e=>g(a,e)})],8,uJ)):M(``,!0)],8,rJ))),128))],8,nJ),e.disabled?M(``,!0):(J(),k(f,{key:0,id:`${e.inputId}-add`,icon:`i-lucide-plus`,size:`sm`,variant:`ghost`,color:`neutral`,class:`w-fit px-1.5 text-[13px] font-normal text-dimmed hover:text-highlighted`,label:`Add ${a.value}`,onClick:S},null,8,[`id`,`label`]))])}}}),pJ={key:0,class:`grid grid-cols-1`},mJ=[`id`,`aria-expanded`,`aria-controls`],hJ={key:0,class:`vitehub-image-backdrop grid h-5 w-8 shrink-0 place-items-center overflow-hidden rounded-sm p-0.5 outline outline-black/10 -outline-offset-1 dark:outline-white/10`},gJ=[`src`],_J={key:1,class:`min-w-0 truncate`},vJ={class:`text-highlighted`},yJ={key:0,class:`ms-2 text-dimmed`},bJ={key:2,class:`min-w-0 truncate`},xJ={key:0,class:`ms-1.5 text-highlighted`},SJ=[`id`],CJ={class:`px-2.5 py-1.5`},wJ=[`src`,`alt`],TJ={key:1,class:`grid grid-cols-1`},EJ={class:`flex h-8 items-center px-2.5 text-base text-dimmed tabular-nums md:text-sm`},DJ={key:3,class:`flex h-8 items-center px-2.5`},OJ={key:5,class:`flex min-w-0 flex-wrap items-center gap-x-1`},kJ=`px-0.5 tabular-nums data-[segment=day]:w-auto data-[segment=month]:w-auto data-[segment=year]:w-auto data-[segment=hour]:w-auto data-[segment=minute]:w-auto data-[segment=literal]:px-0`,AJ=`bg-transparent hover:bg-elevated/70 focus:bg-transparent disabled:bg-transparent ring-0 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-(--ui-border-accented) aria-invalid:ring-1 aria-invalid:ring-error/60 text-base md:text-sm`,jJ=V({name:`ConsoleSchemaField`,__name:`console-schema-field`,props:z({depth:{},disabled:{type:Boolean},errors:{},field:{},parent:{},parentLabel:{},parentOptional:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:z([`submit`],[`update:modelValue`]),setup(e,{emit:t}){let n=e,r=t,a=_(e,`modelValue`),o=p(()=>n.parent?`${n.parent}.${n.field.name}`:n.field.name),c=p(()=>`field-${o.value.replace(/[^a-zA-Z0-9_-]/g,`-`)}`),l=p(()=>{let e=n.errors[o.value]??[],t=n.field.kind===`object`?[]:Object.entries(n.errors).filter(([e])=>e.startsWith(`${o.value}.`)).flatMap(([,e])=>e),r=[...e,...t];return r.length?r.join(` `):x.value??B.value}),u=p(()=>Object.keys(n.errors).some(e=>e.startsWith(`${o.value}.`))),d=p(()=>n.field.required&&!n.parentOptional&&n.field.kind!==`boolean`&&n.field.kind!==`object`&&(a.value===void 0||a.value===null||a.value===``||Array.isArray(a.value)&&!a.value.length)),m={blob:`i-lucide-image`,boolean:`i-lucide-square-check`,date:`i-lucide-calendar`,"date-time":`i-lucide-calendar-clock`,enum:`i-lucide-circle-chevron-down`,integer:`i-lucide-hash`,json:`i-lucide-braces`,list:`i-lucide-list`,number:`i-lucide-hash`,object:`i-lucide-list-tree`,string:`i-lucide-type`,"string-list":`i-lucide-tags`,text:`i-lucide-align-left`},h=p(()=>n.field.kind===`blob`&&w(n.field.schema[`x-vitehub-blob`]).kind!==`image`?`i-lucide-paperclip`:n.field.image?`i-lucide-image`:m[n.field.kind]),g=p(()=>n.depth??0),y=p(()=>[`integer`,`number`,`string`,`string-list`,`text`].includes(n.field.kind)),x=A(),S=p(()=>n.parentLabel?{...n.field,label:`${n.parentLabel} ${n.field.label.toLowerCase()}`}:n.field);function C(){if(!y.value)return;let e=n.parentOptional?{...S.value,required:!1}:S.value;x.value=ES(e,a.value)}f(a,e=>{x.value&&!ES(n.parentOptional?{...S.value,required:!1}:S.value,e)&&(x.value=void 0)});function w(e){return e instanceof Object&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}function T(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r(`submit`))}let E=p({get:()=>String(a.value)===a.value?a.value:a.value===void 0||a.value===null?``:String(a.value),set:e=>{a.value=e}}),D=p({get:()=>Number(a.value)===a.value&&Number.isFinite(a.value)?a.value:null,set:e=>{a.value=e==null||Number.isNaN(e)?void 0:e}}),N=p({get:()=>a.value===!0,set:e=>{a.value=e}}),P=p({get:()=>Array.isArray(a.value)?a.value.map(String):[],set:e=>{a.value=e}}),F=p(()=>(n.field.enum??[]).map(e=>({label:String(e),value:e}))),I=p({get:()=>String(a.value)===a.value||Number(a.value)===a.value?a.value:void 0,set:e=>{a.value=e}});function L(){return String(a.value)===a.value?a.value:``}let R=p({get:()=>{try{return L().length>=10?ze(L().slice(0,10)):void 0}catch{return}},set:e=>{if(!e){a.value=void 0;return}let t=e.toString();a.value=n.field.kind===`date`?t:`${t}T${(ee.value??new Ve(0,0)).toString().slice(0,5)}:00.000Z`}}),ee=p({get:()=>{let e=/T(\d{2}):(\d{2})/.exec(L());return e?new Ve(Number(e[1]),Number(e[2])):void 0},set:e=>{R.value&&(a.value=`${R.value.toString()}T${(e??new Ve(0,0)).toString().slice(0,5)}:00.000Z`)}}),z=A(!1),te=A(``),B=A();f(()=>a.value,e=>{if(n.field.kind===`json`){try{if(JSON.stringify(JSON.parse(te.value||`null`))===JSON.stringify(e??null))return}catch{}te.value=e===void 0?``:JSON.stringify(e,null,2),B.value=void 0}},{immediate:!0});function V(e){if(te.value=e,!e.trim()){a.value=void 0,B.value=void 0;return}try{a.value=JSON.parse(e),B.value=void 0}catch{B.value=`Enter valid JSON.`}}let ne=p(()=>{let e=w(n.field.schema[`x-vitehub-blob`]);return{accept:Array.isArray(e.accept)?e.accept.filter(e=>String(e)===e):void 0,kind:e.kind===`image`?`image`:`file`,store:String(e.store)===e.store?e.store:void 0}}),re=A(!1);f(u,e=>{e&&(re.value=!0)},{immediate:!0});let ie=p(()=>yS(n.field,a.value)),ae=p(()=>SS(n.field,a.value)),oe=p(()=>{let e=n.field.image?w(a.value)[n.field.image.src]:void 0;return String(e)===e&&e.trim()?e.trim():void 0}),U=p(()=>{let e=n.field.image?.alt?w(a.value)[n.field.image.alt]:void 0;return String(e)===e?e:``}),W=A(!1);f(oe,()=>{W.value=!1});let se=p(()=>n.field.kind===`list`&&n.field.item?{...n.field,item:n.field.item}:void 0),ce=p(()=>{let e=Array.isArray(a.value)?a.value.length:0;return e===1?`1 item`:`${e} items`});function le(e){return w(a.value)[e]}function ue(e,t,n){let r={...w(e)};return n===void 0?delete r[t]:r[t]=n,r}function de(e,t){a.value=ue(a.value,e,t)}return(t,n)=>{let u=ge,f=v(`ConsoleSchemaField`,!0),p=Sn,m=ji,_=Nq,y=Vr,x=zr,S=dr,A=jq,L=Yr,B=aS,fe=rS,K=kq;return e.field.kind===`object`?(J(),b(`div`,pJ,[H(eJ,{icon:h.value,label:e.field.label,description:e.field.description,control:c.value,depth:g.value,error:e.errors[o.value]?.join(` `)},{default:i(()=>[j(`button`,{id:c.value,type:`button`,class:`flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-2.5 text-left text-base hover:bg-elevated/70 focus-visible:ring-1 focus-visible:ring-(--ui-border-accented) focus-visible:ring-inset focus-visible:outline-none md:text-sm`,"aria-expanded":re.value,"aria-controls":`${c.value}-fields`,onClick:n[1]||=e=>re.value=!re.value},[e.field.image?(J(),b(`span`,hJ,[oe.value&&!W.value?(J(),b(`img`,{key:0,src:oe.value,alt:``,class:`size-full object-contain`,onError:n[0]||=e=>W.value=!0},null,40,gJ)):(J(),k(u,{key:1,name:`i-lucide-image`,class:`size-3 text-dimmed`,"aria-hidden":`true`}))])):M(``,!0),e.field.image&&(U.value||oe.value)?(J(),b(`span`,_J,[j(`span`,vJ,q(U.value||`No alt text`),1),oe.value?(J(),b(`span`,yJ,q(oe.value),1)):M(``,!0)])):ie.value.length?(J(),b(`span`,bJ,[(J(!0),b(O,null,s(ie.value,(e,t)=>(J(),b(O,{key:e.label},[j(`span`,{class:G([`text-dimmed`,t?`ms-3`:``])},q(e.label),3),e.text?(J(),b(`span`,xJ,q(e.text),1)):M(``,!0)],64))),128))])):(J(),b(`span`,{key:3,class:G([`truncate`,ae.value?`text-highlighted`:`text-dimmed`])},q(ae.value||`Empty`),3)),H(u,{name:`i-lucide-chevron-right`,class:G([`ms-auto size-3.5 shrink-0 text-dimmed`,re.value?`rotate-90`:``]),"aria-hidden":`true`},null,8,[`class`])],8,mJ)]),_:1},8,[`icon`,`label`,`description`,`control`,`depth`,`error`]),re.value?(J(),b(`div`,{key:0,id:`${c.value}-fields`,class:`grid grid-cols-1 ms-3 border-s border-default ps-[calc(0.75rem-1px)]`},[e.field.image&&oe.value&&!W.value?(J(),k(eJ,{key:0,icon:`i-lucide-eye`,label:`Preview`,depth:g.value+1},{default:i(()=>[j(`div`,CJ,[j(`img`,{src:oe.value,alt:U.value,class:`vitehub-image-backdrop max-h-24 max-w-full rounded-md object-contain p-2 outline outline-black/10 -outline-offset-1 dark:outline-white/10`,onError:n[2]||=e=>W.value=!0},null,40,wJ)])]),_:1},8,[`depth`])):M(``,!0),(J(!0),b(O,null,s(e.field.fields,t=>(J(),k(f,{key:t.name,depth:g.value+1,disabled:e.disabled,errors:e.errors,field:t,"model-value":le(t.name),parent:o.value,"parent-label":e.field.label,"parent-optional":!e.field.required,"onUpdate:modelValue":e=>de(t.name,e),onSubmit:n[3]||=e=>r(`submit`)},null,8,[`depth`,`disabled`,`errors`,`field`,`model-value`,`parent`,`parent-label`,`parent-optional`,`onUpdate:modelValue`]))),128))],8,SJ)):M(``,!0)])):se.value?(J(),b(`div`,TJ,[H(eJ,{icon:h.value,label:e.field.label,description:e.field.description,depth:g.value,error:l.value,missing:d.value&&!l.value},{default:i(()=>[j(`p`,EJ,q(ce.value),1)]),_:1},8,[`icon`,`label`,`description`,`depth`,`error`,`missing`]),H(fJ,{modelValue:a.value,"onUpdate:modelValue":n[6]||=e=>a.value=e,field:se.value,depth:g.value,"input-id":c.value,disabled:e.disabled},{item:i(({depth:t,index:i,update:a,value:c})=>[se.value.item.kind===`object`?(J(!0),b(O,{key:0},s(se.value.item.fields,s=>(J(),k(f,{key:s.name,depth:t,disabled:e.disabled,errors:e.errors,field:s,"model-value":w(c)[s.name],parent:`${o.value}.${i}`,"parent-label":e.field.label,"onUpdate:modelValue":e=>a(ue(c,s.name,e)),onSubmit:n[4]||=e=>r(`submit`)},null,8,[`depth`,`disabled`,`errors`,`field`,`model-value`,`parent`,`parent-label`,`onUpdate:modelValue`]))),128)):(J(),k(f,{key:1,depth:t,disabled:e.disabled,errors:e.errors,field:{...se.value.item,name:String(i),label:String(i+1)},"model-value":c,parent:o.value,"parent-label":e.field.label,"onUpdate:modelValue":e=>a(e),onSubmit:n[5]||=e=>r(`submit`)},null,8,[`depth`,`disabled`,`errors`,`field`,`model-value`,`parent`,`parent-label`,`onUpdate:modelValue`]))]),_:1},8,[`modelValue`,`field`,`depth`,`input-id`,`disabled`])])):(J(),k(eJ,{key:2,icon:h.value,label:e.field.label,description:e.field.description,control:c.value,depth:g.value,error:l.value,missing:d.value&&!l.value,onFocusout:C},{default:i(()=>[e.field.kind===`string`?(J(),k(p,{key:0,id:c.value,modelValue:E.value,"onUpdate:modelValue":n[7]||=e=>E.value=e,class:`w-full`,variant:`ghost`,placeholder:`Empty`,ui:{base:AJ},disabled:e.disabled,maxlength:e.field.maxLength,"aria-invalid":l.value?`true`:void 0,"aria-describedby":l.value?`${c.value}-error`:void 0},null,8,[`id`,`modelValue`,`ui`,`disabled`,`maxlength`,`aria-invalid`,`aria-describedby`])):e.field.kind===`text`?(J(),k(m,{key:1,id:c.value,modelValue:E.value,"onUpdate:modelValue":n[8]||=e=>E.value=e,class:`w-full`,variant:`ghost`,autoresize:``,rows:1,placeholder:`Empty`,ui:{base:`${AJ} leading-5`},disabled:e.disabled,maxlength:e.field.maxLength,"aria-invalid":l.value?`true`:void 0,"aria-describedby":l.value?`${c.value}-error`:void 0,onKeydown:T},null,8,[`id`,`modelValue`,`ui`,`disabled`,`maxlength`,`aria-invalid`,`aria-describedby`])):e.field.kind===`number`||e.field.kind===`integer`?(J(),k(_,{key:2,id:c.value,modelValue:D.value,"onUpdate:modelValue":n[9]||=e=>D.value=e,class:`w-full max-w-48`,variant:`ghost`,placeholder:`Empty`,orientation:`vertical`,ui:{root:`group/number`,base:`${AJ} tabular-nums`},disabled:e.disabled,min:e.field.minimum,max:e.field.maximum,step:e.field.kind===`integer`?1:.01,increment:{color:`neutral`,variant:`link`,size:`xs`,class:`opacity-0 group-hover/number:opacity-100 group-focus-within/number:opacity-100`},decrement:{color:`neutral`,variant:`link`,size:`xs`,class:`opacity-0 group-hover/number:opacity-100 group-focus-within/number:opacity-100`},"aria-invalid":l.value?`true`:void 0},null,8,[`id`,`modelValue`,`ui`,`disabled`,`min`,`max`,`step`,`aria-invalid`])):e.field.kind===`boolean`?(J(),b(`div`,DJ,[H(y,{id:c.value,modelValue:N.value,"onUpdate:modelValue":n[10]||=e=>N.value=e,size:`sm`,disabled:e.disabled},null,8,[`id`,`modelValue`,`disabled`])])):e.field.kind===`enum`?(J(),k(x,{key:4,id:c.value,modelValue:I.value,"onUpdate:modelValue":n[11]||=e=>I.value=e,class:`w-full max-w-64`,variant:`ghost`,items:F.value,ui:{base:`${AJ} group/select`,trailingIcon:`opacity-0 group-hover/select:opacity-75 group-focus-visible/select:opacity-75 group-data-[state=open]/select:opacity-75`},disabled:e.disabled,placeholder:e.field.required?`Choose…`:`None`,"aria-invalid":l.value?`true`:void 0},null,8,[`id`,`modelValue`,`items`,`ui`,`disabled`,`placeholder`,`aria-invalid`])):e.field.kind===`date`||e.field.kind===`date-time`?(J(),b(`div`,OJ,[H(B,{id:c.value,modelValue:R.value,"onUpdate:modelValue":n[15]||=e=>R.value=e,variant:`ghost`,ui:{base:`${AJ} gap-0`,segment:kJ},disabled:e.disabled,"aria-label":e.field.kind===`date-time`?`${e.field.label} date`:e.field.label,"aria-invalid":l.value?`true`:void 0},{trailing:i(()=>[H(L,{open:z.value,"onUpdate:open":n[14]||=e=>z.value=e,content:{align:`start`}},{content:i(()=>[H(A,{modelValue:R.value,"onUpdate:modelValue":[n[12]||=e=>R.value=e,n[13]||=e=>z.value=!1],class:`p-2`,ui:{cellTrigger:`tabular-nums`}},null,8,[`modelValue`])]),default:i(()=>[H(S,{variant:`link`,size:`xs`,icon:`i-lucide-calendar`,"aria-label":`Pick ${e.field.label.toLowerCase()} from a calendar`,class:`px-0 text-dimmed hover:text-highlighted`,disabled:e.disabled},null,8,[`aria-label`,`disabled`])]),_:1},8,[`open`])]),_:1},8,[`id`,`modelValue`,`ui`,`disabled`,`aria-label`,`aria-invalid`]),e.field.kind===`date-time`?(J(),b(O,{key:0},[H(fe,{modelValue:ee.value,"onUpdate:modelValue":n[16]||=e=>ee.value=e,variant:`ghost`,"hour-cycle":24,ui:{base:`${AJ} gap-0`,segment:kJ},disabled:e.disabled||!R.value,"aria-label":`${e.field.label} time, UTC`},null,8,[`modelValue`,`ui`,`disabled`,`aria-label`]),n[20]||=j(`span`,{class:`text-xs text-dimmed`},`UTC`,-1)],64)):M(``,!0)])):e.field.kind===`string-list`?(J(),k(K,{key:6,id:c.value,modelValue:P.value,"onUpdate:modelValue":n[17]||=e=>P.value=e,class:`w-full`,variant:`ghost`,ui:{base:AJ,item:`text-xs`},disabled:e.disabled,placeholder:P.value.length?e.disabled?void 0:`Add…`:`Empty`,"aria-invalid":l.value?`true`:void 0},null,8,[`id`,`modelValue`,`ui`,`disabled`,`placeholder`,`aria-invalid`])):e.field.kind===`blob`?(J(),k(Gq,{key:7,modelValue:a.value,"onUpdate:modelValue":n[18]||=e=>a.value=e,"input-id":c.value,kind:ne.value.kind,accept:ne.value.accept,store:ne.value.store,label:e.field.label,disabled:e.disabled},null,8,[`modelValue`,`input-id`,`kind`,`accept`,`store`,`label`,`disabled`])):(J(),k(m,{key:8,id:c.value,"model-value":te.value,class:`w-full`,variant:`ghost`,ui:{base:`${AJ} font-mono text-xs leading-5`},autoresize:``,rows:1,disabled:e.disabled,placeholder:`JSON value`,"aria-invalid":l.value?`true`:void 0,"onUpdate:modelValue":n[19]||=e=>V(String(e??``)),onKeydown:T},null,8,[`id`,`model-value`,`ui`,`disabled`,`aria-invalid`]))]),_:1},8,[`icon`,`label`,`description`,`control`,`depth`,`error`,`missing`]))}}}),MJ={class:`grid grid-cols-1 gap-px`,role:`group`,"aria-label":`Properties`},NJ=[`aria-expanded`],PJ=V({__name:`console-schema-form`,props:z({disabled:{type:Boolean},errors:{},exclude:{},schema:{},unfolded:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:z([`submit`],[`update:modelValue`]),setup(e,{emit:t}){let n=e,r=t,i=_(e,`modelValue`),a=A(!1),c=A(new Set),l=p(()=>hS(n.schema).filter(e=>!n.exclude?.includes(e.name))),u=p(()=>n.errors??{});function d(e){return e==null||e===``?!0:Array.isArray(e)?!e.length:e instanceof Object&&Object.values(e).every(d)}let f=p(()=>n.unfolded?[]:l.value.filter(e=>!e.required&&e.kind!==`boolean`&&!c.value.has(e.name)&&d(i.value[e.name])&&!Object.keys(u.value).some(t=>t===e.name||t.startsWith(`${e.name}.`)))),m=p(()=>a.value?l.value:l.value.filter(e=>!f.value.includes(e)));function h(e,t){c.value.has(e)||(c.value=new Set(c.value).add(e));let n={...i.value};t===void 0?delete n[e]:n[e]=t,i.value=n}return(t,n)=>{let c=ge;return J(),b(`div`,MJ,[o(t.$slots,`default`),(J(!0),b(O,null,s(m.value,t=>(J(),k(jJ,{key:t.name,disabled:e.disabled,errors:u.value,field:t,"model-value":i.value[t.name],"onUpdate:modelValue":e=>h(t.name,e),onSubmit:n[0]||=e=>r(`submit`)},null,8,[`disabled`,`errors`,`field`,`model-value`,`onUpdate:modelValue`]))),128)),f.value.length?(J(),b(`button`,{key:0,type:`button`,class:`flex h-8 w-fit items-center gap-2 rounded-md px-1.5 text-[13px] text-dimmed hover:text-highlighted focus-visible:outline-2`,"aria-expanded":a.value,onClick:n[1]||=e=>a.value=!a.value},[H(c,{name:a.value?`i-lucide-chevron-up`:`i-lucide-chevron-down`,class:`size-4 opacity-70`,"aria-hidden":`true`},null,8,[`name`]),K(` `+q(a.value?`Hide ${f.value.length} empty`:`Show ${f.value.length} more`),1)],8,NJ)):M(``,!0)])}}}),FJ=new Pl(`y-sync`),IJ=new Pl(`y-undo`),LJ=new Pl(`yjs-cursor`),RJ=e=>{for(let t=6;t<e.length;t++)e[t%6]=e[t%6]^e[t];return e.slice(0,6)},zJ=e=>ER(RJ(DW(kR(e)))),BJ=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!xB(t.ds,e.id),VJ=[{light:`#ecd44433`,dark:`#ecd444`}],HJ=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){let n=WN();e.forEach(e=>n.add(e)),t=t.filter(e=>!n.has(e))}e.set(n,eR(t))}return e.get(n)},UJ=(e,{colors:t=VJ,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:a}={})=>{let o=!1,s=new YJ(e,a),c=new jl({props:{editable:e=>{let t=FJ.getState(e);return t.snapshot==null&&t.prevSnapshot==null}},key:FJ,state:{init:(i,a)=>({type:e,doc:e.doc,binding:s,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(e,t)=>{let n=e.getMeta(FJ);if(n!==void 0){t=Object.assign({},t);for(let e in n)t[e]=n[e]}return e.docChanged&&(t.addToHistory=e.getMeta(`addToHistory`)!==!1),t.isChangeOrigin=n!==void 0&&!!n.isChangeOrigin,t.isUndoRedoOperation=n!==void 0&&!!n.isChangeOrigin&&!!n.isUndoRedoOperation,s.prosemirrorView!==null&&n!==void 0&&(n.snapshot!=null||n.prevSnapshot!=null)&&Zz(0,()=>{s.prosemirrorView!=null&&(n.restore==null?s._renderSnapshot(n.snapshot,n.prevSnapshot,t):(s._renderSnapshot(n.snapshot,n.snapshot,t),delete t.restore,delete t.snapshot,delete t.prevSnapshot,s.mux(()=>{s._prosemirrorChanged(s.prosemirrorView.state.doc)})))}),t}},view:e=>(s.initView(e),a??s._forceRerender(),i(),{update:()=>{let t=c.getState(e.state);if(t.snapshot==null&&t.prevSnapshot==null&&(o||e.state.doc.content.findDiffStart(e.state.doc.type.createAndFill().content)!==null)){if(o=!0,t.addToHistory===!1&&!t.isChangeOrigin){let t=IJ.getState(e.state),n=t&&t.undoManager;n&&n.stopCapturing()}s.mux(()=>{t.doc.transact(n=>{n.meta.set(`addToHistory`,t.addToHistory),s._prosemirrorChanged(e.state.doc)},FJ)})}},destroy:()=>{s.destroy()}})});return c},WJ=(e,t,n,r)=>{if(n==null||!(r===null||n>1&&r<=1||LY(t,e,n,r)))return r;let i=FY(t,e,n);return i===null?r:i},GJ=(e,t,n,r)=>{if(t!==null&&t.anchor!==null&&t.head!==null){if(t.type===`all`)e.setSelection(new _l(e.doc));else if(t.type===`node`){let r=jY(n.doc,n.type,t.anchor,n.mapping);r!==null&&e.setSelection(KJ(e,r))}else if(t.type===`nodeRange`){let r=qJ(e,jY(n.doc,n.type,t.anchor,n.mapping),jY(n.doc,n.type,t.head,n.mapping),t.depth);r!==null&&e.setSelection(r)}else{let i=jY(n.doc,n.type,t.anchor,n.mapping),a=jY(n.doc,n.type,t.head,n.mapping);r!=null&&(i=WJ(e.doc,r,t.absAnchor,i),a=WJ(e.doc,r,t.absHead,a)),i===null&&(i=a),a===null&&(a=i),i!==null&&a!==null&&e.setSelection(Z.between(e.doc.resolve(i),e.doc.resolve(a)))}}},KJ=(e,t)=>{let n=e.doc.resolve(t);return n.nodeAfter?hl.create(e.doc,t):Z.near(n)},qJ=(e,t,n,r)=>{if(t===null||n===null)return null;let i=Math.min(Math.max(t,0),e.doc.content.size),a=Math.min(Math.max(n,0),e.doc.content.size);try{let t=ul.fromJSON(e.doc,{type:`nodeRange`,anchor:i,head:a,depth:r});return t.ranges.length?t:Z.near(e.doc.resolve(i))}catch{return Z.near(e.doc.resolve(i))}},JJ=(e,t)=>{let n=t.selection.jsonID;return{type:n,depth:n===`nodeRange`?t.selection.depth:void 0,anchor:OY(t.selection.anchor,e.type,e.mapping),head:OY(t.selection.head,e.type,e.mapping),absAnchor:t.selection.anchor,absHead:t.selection.head}},YJ=class{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=hW(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=JJ(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta(`addToHistory`,!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(dR&&this._domSelectionInView===null&&(Zz(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);let n=t.getBoundingClientRect(),r=Wz.documentElement;return n.bottom>=0&&n.right>=0&&n.left<=(window.innerWidth||r.clientWidth||0)&&n.top<=(window.innerHeight||r.clientHeight||0)}renderSnapshot(e,t){t||=CV(TB(),new Map),this.prosemirrorView.dispatch(this._tr.setMeta(FJ,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(e=>ZJ(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(e),0,0));t.setMeta(FJ,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection===null?this.prosemirrorView.state.selection:null,t=this.type.toArray().map(e=>ZJ(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(t),0,0));if(e){let t=LN(RN(e.anchor,0),n.doc.content.size),r=LN(RN(e.head,0),n.doc.content.size);n.setSelection(Z.create(n.doc,t,r))}this.prosemirrorView.dispatch(n.setMeta(FJ,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,n){let r=this.doc,i=this.type;if(e||=wV(this.doc),e instanceof Uint8Array||t instanceof Uint8Array){if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&dP(),r=new jB({gc:!1}),KB(r,t),t=wV(r),KB(r,e),e=wV(r),i._item===null){let e=Array.from(this.doc.share.keys()).find(e=>this.doc.share.get(e)===this.type);i=r.getXmlFragment(e)}else{let e=r.store.clients.get(i._item.id.client)??[];i=e[jV(e,i._item.id.clock)].content.type}}this.mapping.clear(),this.mux(()=>{r.transact(r=>{let a=n.permanentUserData;a&&a.dss.forEach(e=>{yB(r,e,e=>{})});let o=(e,t)=>{let r=e===`added`?a.getUserByClientId(t.client):a.getUserByDeletedId(t);return{user:r,type:e,color:HJ(n.colorMapping,n.colors,r)}},s=wH(i,new SV(t.ds,e.sv)).map(n=>!n._item.deleted||BJ(n._item,e)||BJ(n._item,t)?ZJ(n,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,o):null).filter(e=>e!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(s),0,0));this.prosemirrorView.dispatch(c.setMeta(FJ,{isChangeOrigin:!0}))},FJ)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;let n=FJ.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let e=(e,t)=>this.mapping.delete(t);yB(t,t.deleteSet,e=>{if(e.constructor===rW){let t=e.content.type;t&&this.mapping.delete(t)}}),t.changed.forEach(e),t.changedParentTypes.forEach(e),this.mapping.clear();let n=this.type.toArray().map(e=>XJ(e,this.prosemirrorView.state.schema,this)).filter(e=>e!==null),r=this.prosemirrorView.state.doc,i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new X(Y.from(n),0,0));GJ(i,this.beforeTransactionSelection,this,r),i=i.setMeta(FJ,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof YV}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)})}_prosemirrorChanged(e){this.doc.transact(()=>{xY(this.doc,this.type,e,this),this.beforeTransactionSelection=JJ(this,this.prosemirrorView.state)},FJ)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.on(`afterAllTransactions`,this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off(`beforeAllTransactions`,this.beforeAllTransactions),this.doc.off(`afterAllTransactions`,this.afterAllTransactions))}},XJ=(e,t,n,r,i,a)=>{let o=n.mapping.get(e);if(o===void 0){if(e instanceof mU)return ZJ(e,t,n,r,i,a);throw uP()}return o},ZJ=(e,t,n,r,i,a)=>{let o=[],s=e=>{if(e instanceof mU){let s=XJ(e,t,n,r,i,a);s!==null&&o.push(s)}else{let s=e._item.right?.content?.type;s instanceof lU&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(e.applyDelta([{retain:e.length},...s.toDelta()]),s.doc.transact(e=>{s._item.delete(e)}));let c=QJ(e,t,n,r,i,a);c!==null&&c.forEach(e=>{e!==null&&o.push(e)})}};r===void 0||i===void 0?e.toArray().forEach(s):wH(e,new SV(i.ds,r.sv)).forEach(s);try{let s=e.getAttributes(r);r!==void 0&&(BJ(e._item,r)?BJ(e._item,i)||(s.ychange=a?a(`added`,e._item.id):{type:`added`}):s.ychange=a?a(`removed`,e._item.id):{type:`removed`});let c=t.node(e.nodeName,s,o);return n.mapping.set(e,c),c}catch{return e.doc.transact(t=>{e._item.delete(t)},FJ),n.mapping.delete(e),null}},QJ=(e,t,n,r,i,a)=>{let o=[],s=e.toDelta(r,i,a);try{for(let e=0;e<s.length;e++){let n=s[e];o.push(t.text(n.insert,yY(n.attributes,t)))}}catch{return e.doc.transact(t=>{e._item.delete(t)},FJ),null}return o},$J=(e,t)=>{let n=new yU,r=e.map(e=>({insert:e.text,attributes:bY(e.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},eY=(e,t)=>{let n=new mU(e.type.name);for(let t in e.attrs){let r=e.attrs[t];r!==null&&t!==`ychange`&&n.setAttribute(t,r)}return n.insert(0,iY(e).map(e=>tY(e,t))),t.mapping.set(n,e),n},tY=(e,t)=>e instanceof Array?$J(e,t):eY(e,t),nY=e=>typeof e==`object`&&!!e,rY=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==null),r=n.length===Object.keys(t).filter(e=>t[e]!==null).length;for(let i=0;i<n.length&&r;i++){let a=n[i],o=e[a],s=t[a];r=a===`ychange`||o===s||nY(o)&&nY(s)&&rY(o,s)}return r},iY=e=>{let t=e.content.content,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.isText){let r=[];for(let n=t[e];e<t.length&&n.isText;n=t[++e])r.push(n);e--,n.push(r)}else n.push(r)}return n},aY=(e,t)=>{let n=e.toDelta();return n.length===t.length&&n.every((e,n)=>e.insert===t[n].text&&LL(e.attributes||{}).length===t[n].marks.length&&HL(e.attributes,(e,r)=>{let i=vY(r),a=t[n].marks;return a.find(e=>e.type.name===i)?rY(e,a.find(e=>e.type.name===i)?.attrs):!1}))},oY=(e,t)=>{if(e instanceof mU&&!(t instanceof Array)&&SY(e,t)){let n=iY(t);return e._length===n.length&&rY(e.getAttributes(),t.attrs)&&e.toArray().every((e,t)=>oY(e,n[t]))}return e instanceof yU&&t instanceof Array&&aY(e,t)},sY=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((e,n)=>t[n]===e),cY=(e,t,n)=>{let r=new Map;t.forEach((e,t)=>{r.has(e)||r.set(e,t)});let i=[];if(e.forEach((e,a)=>{let o=n.mapping.get(e),s=r.get(o);s!==void 0&&sY(o,t[s])&&i.push({yIndex:a,pIndex:s,yChild:e})}),i.length===0)return[];let a=Array(i.length),o=[];for(let e=0;e<i.length;e++){let t=0,n=o.length;for(;t<n;){let r=t+n>>1;i[o[r]].pIndex<i[e].pIndex?t=r+1:n=r}a[e]=t>0?o[t-1]:-1,o[t]=e}let s=[];for(let e=o[o.length-1];e!==-1;e=a[e])s.push(i[e]);return s.reverse()},lY=(e,t,n,r)=>{n>0&&(e.slice(t,t+n).forEach(e=>r.mapping.delete(e)),e.delete(t,n))},uY=(e,t,n,r,i,a)=>{if(r<i){let o=[];for(let e=r;e<i;e++)o.push(tY(n[e],a));e.insert(t,o)}},dY=(e,t,n,r)=>t instanceof yU&&n instanceof Array?(aY(t,n)?r.mapping.set(t,n):gY(t,n,r),!0):t instanceof mU&&!(n instanceof Array)&&SY(t,n)?(oY(t,n)?r.mapping.set(t,n):xY(e,t,n,r),!0):!1,fY=(e,t,n,r,i,a,o,s,c)=>{let l=LN(a-i,s-o);for(let a=0;a<l;a++){let s=r[i+a],l=n[o+a];dY(e,s,l,c)||(lY(t,o+a,1,c),uY(t,o+a,n,o+a,o+a+1,c))}lY(t,o+l,a-i-l,c),uY(t,o+l,n,o+l,s,c)},pY=(e,t,n,r,i)=>{let a=cY(r,n,i);if(a.length<2||!a.some(e=>e.yIndex!==e.pIndex)||a.some(e=>{let t=n[e.pIndex];return!(e.yChild instanceof yU&&t instanceof Array||e.yChild instanceof mU&&!(t instanceof Array))}))return!1;let o=0,s=0;for(let c of a){fY(e,t,n,r,o,c.yIndex,s,c.pIndex,i);let a=n[c.pIndex];dY(e,c.yChild,a,i),o=c.yIndex+1,s=c.pIndex+1}return fY(e,t,n,r,o,r.length,s,n.length,i),!0},mY=(e,t,n)=>{let r=e.toArray(),i=iY(t),a=i.length,o=r.length,s=LN(o,a),c=0,l=0,u=!1;for(;c<s;c++){let e=r[c],t=i[c];if(sY(n.mapping.get(e),t))u=!0;else if(!oY(e,t))break}for(;c+l<s;l++){let e=r[o-l-1],t=i[a-l-1];if(sY(n.mapping.get(e),t))u=!0;else if(!oY(e,t))break}return{equalityFactor:c+l,foundMappedChild:u}},hY=e=>{let t=``,n=e._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof BU?t+=n.content.str:n.content instanceof NU&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},gY=(e,t,n)=>{n.mapping.set(e,t);let{nAttrs:r,str:i}=hY(e),a=t.map(e=>({insert:e.text,attributes:Object.assign({},r,bY(e.marks,n))})),{insert:o,remove:s,index:c}=vW(i,a.map(e=>e.insert).join(``));e.delete(c,s),e.insert(c,o),e.applyDelta(a.map(e=>({retain:e.insert.length,attributes:e.attributes})))},_Y=/(.*)(--[a-zA-Z0-9+/=]{8})$/,vY=e=>_Y.exec(e)?.[1]??e,yY=(e,t)=>{let n=[];for(let r in e)n.push(t.mark(vY(r),e[r]));return n},bY=(e,t)=>{let n={};return e.forEach(e=>{if(e.type.name!==`ychange`){let r=OL(t.isOMark,e.type,()=>!e.type.excludes(e.type));n[r?`${e.type.name}--${zJ(e.toJSON())}`:e.type.name]=e.attrs}}),n},xY=(e,t,n,r)=>{if(t instanceof mU&&t.nodeName!==n.type.name)throw Error(`node name mismatch!`);if(r.mapping.set(t,n),t instanceof mU){let e=t.getAttributes(),r=n.attrs;for(let n in r)r[n]===null?t.removeAttribute(n):e[n]!==r[n]&&n!==`ychange`&&t.setAttribute(n,r[n]);for(let n in e)r[n]===void 0&&t.removeAttribute(n)}let i=iY(n),a=i.length,o=t.toArray(),s=o.length,c=LN(a,s);if(pY(e,t,i,o,r))return;let l=0,u=0;for(;l<c;l++){let e=o[l],t=i[l];if(!sY(r.mapping.get(e),t)){if(oY(e,t))r.mapping.set(e,t);else break}}for(;u+l+1<c;u++){let e=o[s-u-1],t=i[a-u-1];if(!sY(r.mapping.get(e),t)){if(oY(e,t))r.mapping.set(e,t);else break}}e.transact(()=>{for(;s-l-u>0&&a-l-u>0;){let n=o[l],c=i[l],d=o[s-u-1],f=i[a-u-1];if(n instanceof yU&&c instanceof Array)aY(n,c)||gY(n,c,r),l+=1;else{let i=n instanceof mU&&SY(n,c),a=d instanceof mU&&SY(d,f);if(i&&a){let e=mY(n,c,r),t=mY(d,f,r);e.foundMappedChild&&!t.foundMappedChild?a=!1:!e.foundMappedChild&&t.foundMappedChild||e.equalityFactor<t.equalityFactor?i=!1:a=!1}i?(xY(e,n,c,r),l+=1):a?(xY(e,d,f,r),u+=1):(r.mapping.delete(t.get(l)),t.delete(l,1),t.insert(l,[tY(c,r)]),l+=1)}}let n=s-l-u;if(s===1&&a===0&&o[0]instanceof yU?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):n>0&&(t.slice(l,l+n).forEach(e=>r.mapping.delete(e)),t.delete(l,n)),l+u<a){let e=[];for(let t=l;t<a-u;t++)e.push(tY(i[t],r));t.insert(l,e)}},FJ)},SY=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,CY=null,wY=class{constructor(e,t,n){this.view=e,this.key=t,this.value=n}apply(){let e=FJ.getState(this.view.state);if(e&&e.binding&&!e.binding.isDestroyed){let e=this.view.state.tr;e.setMeta(this.key,this.value),this.view.dispatch(e)}}},TY=class e{constructor(e=[]){this.entries=e}getFirst(){return this.entries[0]}dequeueFirst(){return this.entries.shift()}isEmpty(){return this.entries.length===0}static fromViewsToUpdate(){let t=CY;CY=null;let n=[];return t.forEach((e,t)=>{e.forEach((e,r)=>{n.push(new wY(t,r,e))})}),new e(n)}},EY=(e=TY.fromViewsToUpdate(),t=!1)=>{let n=!0;for(;!e.isEmpty();){let r=e.getFirst();try{r.apply()}catch(r){if(r instanceof RangeError){t&&n&&e.dequeueFirst(),e.isEmpty()||Zz(0,()=>EY(e,!0));return}throw r}n=!1,e.dequeueFirst()}},DY=(e,t,n)=>{CY||(CY=new Map,Zz(0,EY)),OL(CY,e,EL).set(t,n)},OY=(e,t,n)=>{if(e===0)return vV(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof yU){if(r._length>=e)return vV(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{let i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new pV(r._item===null?null:r._item.id,r._item===null?dV(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new pV(r._item===null?null:r._item.id,r._item===null?dV(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw dP();if(e===0&&r.constructor!==yU&&r!==t)return AY(r._item.parent,r._item)}return vV(t,t._length,-1)},kY=(e,t,n)=>{if(n===null)return!1;let r=bV(t,e);return r!==null&&r.type instanceof yU&&t.item!==null&&n<=1},AY=(e,t)=>{let n=null,r=null;return e._item===null?r=dV(e):n=uV(e._item.id.client,e._item.id.clock),new pV(n,r,t.id)},jY=(e,t,n,r)=>{let i=bV(n,e);if(i===null||i.type!==t&&!fV(t,i.type._item))return null;let a=i.type,o=0;if(a.constructor===yU)o=i.index;else if(a._item===null||!a._item.deleted){let e=a._first,t=0;for(;t<a._length&&t<i.index&&e!==null;){if(!e.deleted){let n=e.content.type;if(t++,n instanceof yU)o+=n._length;else{let e=r.get(n);if(e==null)return null;o+=e.nodeSize}}e=e.right}o+=1}for(;a!==t&&a._item!==null;){let e=a._item.parent;if(e._item===null||!e._item.deleted){o+=1;let t=e._first;for(;t!==null;){let e=t.content.type;if(e===a)break;if(!t.deleted){if(e instanceof yU)o+=e._length;else{let t=r.get(e);if(t==null)return null;o+=t.nodeSize}}t=t.right}}a=e}let s=o-1;return kY(e,n,s)?null:s},MY=(e,t)=>{if(e===t)return!0;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])},NY=e=>{let t=e.type.spec.attrs||{};return Object.keys(e.attrs).some(n=>{let r=t[n];return r==null||!Object.prototype.hasOwnProperty.call(r,`default`)||r.default!==e.attrs[n]})},PY=(e,t,n)=>{let r=t+1,i=n;for(let t=1;t<e.depth;t++){let n=e.index(t);if(n>=i.childCount)return null;for(let e=0;e<n;e++)r+=i.child(e).nodeSize;if(r+=1,i=i.child(n),i.type!==e.node(t+1).type)return null}return i.isTextblock?r+Math.min(e.parentOffset,i.content.size):null},FY=(e,t,n)=>{let r=0,i=0;for(;i<e.childCount;i++){let t=e.child(i);if(r+t.nodeSize>n)break;r+=t.nodeSize}if(i>=e.childCount)return null;let a=e.child(i),o=e.resolve(n),s=(e,t)=>{if(o.depth===0){let i=e+(n-r),a=e+1,o=e+t.nodeSize-1;return Math.max(a,Math.min(i,o))}return PY(o,e,t)},c=(n,r=!1)=>{let a=0;for(let t=0;t<=i;t++)n(e.child(t))&&a++;let o=0,c=-1,l=null,u=0;for(let e=0;e<t.childCount;e++){let r=t.child(e);n(r)&&(o++,o===a&&(c=u,l=r)),u+=r.nodeSize}return l===null||r&&(a!==1||o!==1)?null:s(c,l)},l=e=>e.type===a.type&&MY(e.attrs,a.attrs),u=a.textContent,d=c(e=>l(e)&&e.textContent===u);if(d!==null)return d;let f=c(e=>e.type===a.type&&e.textContent===u);if(f!==null)return f;if(NY(a)){let e=c(l,!0);if(e!==null)return e}return c(e=>l(e)&&u!==``&&e.textContent!==``&&(u.startsWith(e.textContent)||e.textContent.startsWith(u)),!0)},IY=(e,t)=>{if(!e.docChanged)return!1;if(e.doc.childCount!==t.childCount)return!0;for(let n of e.steps)if(n instanceof hc){if(n.from===0&&n.to===t.content.size)return!0;if(n.slice.content.size>0){let e=!1;if(n.slice.content.forEach(t=>{t.isBlock&&(e=!0)}),e)return!0}else if(n.to>n.from){let e=t.resolve(n.from),r=t.resolve(n.to);if(e.depth===0&&r.depth===0&&e.index()!==r.index())return!0}}return!1},LY=(e,t,n,r)=>{if(r===null)return!1;let i=e.resolve(n),a=t.resolve(r);if(!i.parent.isTextblock)return!1;if(!a.parent.isTextblock||i.parent.textContent!==a.parent.textContent||i.parentOffset!==0&&a.parentOffset===0)return!0;let o=i.parentOffset===0&&a.parentOffset===0,s=i.parentOffset!==a.parentOffset||i.parent.type!==a.parent.type||!MY(i.parent.attrs,a.parent.attrs);if(o||s){let i=FY(e,t,n);return i!==null&&i!==r}return!1},RY=(e,t,n)=>e!==t,zY=e=>{let t=document.createElement(`span`);t.classList.add(`ProseMirror-yjs-cursor`),t.setAttribute(`style`,`border-color: ${e.color}`);let n=document.createElement(`div`);n.setAttribute(`style`,`background-color: ${e.color}`),n.insertBefore(document.createTextNode(e.name),null);let r=document.createTextNode(``),i=document.createTextNode(``);return t.insertBefore(r,null),t.insertBefore(n,null),t.insertBefore(i,null),t},BY=e=>({style:`background-color: ${e.color}70`,class:`ProseMirror-yjs-selection`}),VY=/^#[0-9a-fA-F]{6}$/,HY=(e,t,n,r,i)=>{let a=FJ.getState(e);if(a==null||a.doc==null||a.binding==null)return um.create(e.doc,[]);let o=a.doc,s=[];return a.snapshot!=null||a.prevSnapshot!=null||a.binding.mapping.size===0?um.create(e.doc,[]):(t.getStates().forEach((t,c)=>{if(n(o.clientID,c,t)&&t&&t.cursor!=null){let n=t.user||{};n.color==null?n.color=`#ffa500`:VY.test(n.color)||console.warn(`A user uses an unsupported color format`,n),n.name??=`User: ${c}`;let l=jY(o,a.type,mV(t.cursor.anchor),a.binding.mapping),u=jY(o,a.type,mV(t.cursor.head),a.binding.mapping);if(l!==null&&u!==null){let t=RN(e.doc.content.size-1,0);l=LN(l,t),u=LN(u,t),s.push(sm.widget(u,()=>r(n,c),{key:c+``,side:10}));let a=LN(l,u),o=RN(l,u);s.push(sm.inline(a,o,i(n,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),um.create(e.doc,s))},UY=(e,{awarenessStateFilter:t=RY,cursorBuilder:n=zY,selectionBuilder:r=BY,getSelection:i=e=>e.selection}={},a=`cursor`)=>new jl({key:LJ,state:{init(i,a){return HY(a,e,t,n,r)},apply(i,a,o,s){let c=FJ.getState(s),l=i.getMeta(LJ),u=c&&c.isChangeOrigin;return i.docChanged&&!u&&IY(i,o.doc)?um.empty:u||l&&l.awarenessUpdated?HY(s,e,t,n,r):i.docChanged?a.map(i.mapping,i.doc):a}},props:{decorations:e=>LJ.getState(e)},view:t=>{let n=()=>{t.docView&&DY(t,LJ,{awarenessUpdated:!0})},r=(t,n={})=>{let r=FJ.getState(t.state);if(!r||!r.binding)return;let o=e.getLocalState()||{};if(t.hasFocus()){let s=i(t.state),c=OY(s.anchor,r.type,r.binding.mapping),l=OY(s.head,r.type,r.binding.mapping);(n.force||o.cursor==null||!xV(mV(o.cursor.anchor),c)||!xV(mV(o.cursor.head),l))&&e.setLocalStateField(a,{anchor:c,head:l})}else o.cursor!=null&&jY(r.doc,r.type,mV(o.cursor.anchor),r.binding.mapping)!==null&&e.setLocalStateField(a,null)},o=()=>r(t);return e.on(`change`,n),t.dom.addEventListener(`focusin`,o),t.dom.addEventListener(`focusout`,o),{update:(e,t)=>{let n=!!(FJ.getState(e.state)?.isChangeOrigin&&t?.doc&&!t.doc.eq(e.state.doc));r(e,{force:n})},destroy:()=>{t.dom.removeEventListener(`focusin`,o),t.dom.removeEventListener(`focusout`,o),e.off(`change`,n),e.setLocalStateField(a,null)}}}}),WY=e=>{let t=IJ.getState(e).undoManager;if(t!=null)return t.undo(),!0},GY=e=>{let t=IJ.getState(e).undoManager;if(t!=null)return t.redo(),!0},KY=new Set([`paragraph`]),qY=(e,t)=>!(e instanceof rW)||!(e.content instanceof XU)||!(e.content.type instanceof lU||e.content.type instanceof mU&&t.has(e.content.type.nodeName))||e.content.type._length===0,JY=({protectedNodes:e=KY,trackedOrigins:t=[],undoManager:n=null}={})=>new jl({key:IJ,state:{init:(r,i)=>{let a=FJ.getState(i),o=n;if(!o){let n=a.doc,r=new Set(n?n._observers.get(`destroy`):[]);o=new YV(a.type,{trackedOrigins:new Set([FJ].concat(t)),deleteFilter:t=>qY(t,e),captureTransaction:e=>e.meta.get(`addToHistory`)!==!1});let i=n?n._observers.get(`destroy`):new Set;o._yTiptapDocDestroyListeners=Array.from(i||[]).filter(e=>!r.has(e))}return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(e,t,n,r)=>{let i=FJ.getState(r).binding,a=t.undoManager,o=a.undoStack.length>0,s=a.redoStack.length>0;return i?{undoManager:a,prevSel:JJ(i,n),hasUndoOps:o,hasRedoOps:s}:o!==t.hasUndoOps||s!==t.hasRedoOps?Object.assign({},t,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):t}},view:e=>{let t=FJ.getState(e.state),n=IJ.getState(e.state).undoManager;return n.on(`stack-item-added`,({stackItem:n})=>{let r=t.binding;r&&n.meta.set(r,IJ.getState(e.state).prevSel)}),n.on(`stack-item-popped`,({stackItem:e})=>{let n=t.binding;n&&(n.beforeTransactionSelection=e.meta.get(n)||n.beforeTransactionSelection)}),{destroy:()=>{n.destroy();let e=n._yTiptapDocDestroyListeners;e&&n.doc&&(e.forEach(e=>n.doc.off(`destroy`,e)),n._yTiptapDocDestroyListeners=null)}}}});function YY(e){return!!e.getMeta(FJ)}function XY(e,t){let n=FJ.getState(e);return jY(n.doc,n.type,t,n.binding.mapping)||0}function ZY(e,t){let n=FJ.getState(e);return OY(t,n.type,n.binding.mapping)}var QY=class e extends Q_{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(t){return new e(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function $Y(e,t){return new QY(e,ZY(t,e))}function eX(e,t,n){let r=e instanceof QY?e.yRelativePosition:null;if(YY(t)&&r)return{position:new QY(XY(n,r),r),mapResult:null};let i=$_(e,t),a=i.position.position;return{position:new QY(a,r??ZY(n,a)),mapResult:i.mapResult}}var tX=By.create({name:`collaboration`,priority:1e3,addOptions(){return{document:null,field:`default`,fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(e=>e.name===`undoRedo`)&&console.warn(`[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".`)},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>eX(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>$Y(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),IJ.getState(t).undoManager.undoStack.length===0?!1:!n||WY(t)),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta(`preventDispatch`,!0),IJ.getState(t).undoManager.redoStack.length===0?!1:!n||GY(t))}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=JY(this.options.yUndoOptions),n=t.spec.view;return t.spec.view=e=>{let{undoManager:t}=IJ.getState(e.state);t.restore&&=(t.restore(),()=>{});let r=n?n(e):void 0;return{destroy:()=>{let e=t.trackedOrigins.has(t),n=t._observers;t.restore=()=>{e&&t.trackedOrigins.add(t),t.doc.on(`afterTransaction`,t.afterTransactionHandler),t._observers=n},r?.destroy&&r.destroy()}}},[UJ(e,{...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender}),t,new jl({filterTransaction:(e,t)=>(e.getMeta(`inputRule`)&&IJ.getState(t).undoManager.stopCapturing(),!0)}),this.editor.options.enableContentCheck&&new jl({key:new Pl(`filterInvalidContent`),filterTransaction:t=>{if(!YY(t))return!0;if(this.storage.isDisabled)return!1;if(!t.docChanged)return!0;try{return t.doc.check(),!0}catch(t){return this.storage.isDisabled=!0,this.editor.emit(`contentError`,{error:t,editor:this.editor,disableCollaboration:()=>{var t;(t=e.doc)==null||t.destroy()}}),!0}}})].filter(Boolean)}});function nX(e){if(!e.length)return um.empty;let t=[],n=e[0].$from.node(0);return e.forEach(e=>{let n=e.$from.pos,r=e.$from.nodeAfter;r&&t.push(sm.node(n,n+r.nodeSize,{class:`ProseMirror-selectednoderange`}))}),um.create(n,t)}function rX(e,t,n){let r=n.isText||n.isAtom?0:1;return{start:e+r,end:e+t-r}}function iX(e,t,n,r={}){let i=[],a=e.node(0),{extendOnBoundaryOverlap:o=!0}=r;typeof n==`number`&&n>=0||(n=e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos));let s=new Xo(e,t,n),c=s.depth===0?0:a.resolve(s.start).posAtIndex(0);return s.parent.forEach((n,r)=>{let l=c+r,u=l+n.nodeSize,d=rX(l,n.nodeSize,n),f=o?t.pos>=d.start&&e.pos<=d.end:t.pos>d.start&&e.pos<d.end;if(l<s.start||l>=s.end||!f)return;let p=new dl(a.resolve(l),a.resolve(u));i.push(p)}),i}var aX=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return new oX(e.resolve(this.anchor),e.resolve(this.head))}},oX=class e extends ul{constructor(e,t,n,r=1){let{doc:i}=e,a=e===t,o=e.pos===i.content.size&&t.pos===i.content.size,s=a&&!o?i.resolve(t.pos+(r>0?1:-1)):t,c=a&&o?i.resolve(e.pos-(r>0?1:-1)):e,l=iX(c.min(s),c.max(s),n),u=s.pos>=e.pos?l[0].$from:l[l.length-1].$to,d=s.pos>=e.pos?l[l.length-1].$to:l[0].$from;super(u,d,l),this.depth=n}get $to(){return this.ranges[this.ranges.length-1].$to}eq(t){return t instanceof e&&t.$from.pos===this.$from.pos&&t.$to.pos===this.$to.pos}map(t,n){let r=t.resolve(n.map(this.anchor)),i=t.resolve(n.map(this.head));return new e(r,i)}toJSON(){return{type:`nodeRange`,anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){let{doc:t}=this.$from;if(this.isForwards&&this.ranges.length>1){let t=this.ranges.slice(0,-1),n=t[0].$from,r=t[t.length-1].$to;return new e(n,r,this.depth)}let n=this.ranges[0],r=t.resolve(Math.max(0,n.$from.pos-1));return new e(this.$anchor,r,this.depth)}extendForwards(){let{doc:t}=this.$from;if(this.isBackwards&&this.ranges.length>1){let t=this.ranges.slice(1),n=t[0].$from,r=t[t.length-1].$to;return new e(r,n,this.depth)}let n=this.ranges[this.ranges.length-1],r=t.resolve(Math.min(t.content.size,n.$to.pos+1));return new e(this.$anchor,r,this.depth)}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n,r,i=1){return new this(e.resolve(t),e.resolve(n),r,i)}getBookmark(){return new aX(this.anchor,this.head)}};oX.prototype.visible=!1;function sX(e){return e instanceof oX}By.create({name:`nodeRange`,addOptions(){return{depth:void 0,key:`Mod`}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!sX(a)){let e=oX.create(i,s,c,t,-1);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendBackwards();return o.setSelection(l),n.dispatch(o),!0},"Shift-ArrowDown":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:a,tr:o}=r,{anchor:s,head:c}=a;if(!sX(a)){let e=oX.create(i,s,c,t);return o.setSelection(e),n.dispatch(o),!0}let l=a.extendForwards();return o.setSelection(l),n.dispatch(o),!0},"Mod-a":({editor:e})=>{let{depth:t}=this.options,{view:n,state:r}=e,{doc:i,tr:a}=r,o=oX.create(i,0,i.content.size,t);return a.setSelection(o),n.dispatch(a),!0}}},onSelectionUpdate(){let{selection:e}=this.editor.state;sX(e)&&this.editor.view.dom.classList.add(`ProseMirror-noderangeselection`)},addProseMirrorPlugins(){let e=!1,t=!1;return[new jl({key:new Pl(`nodeRange`),props:{attributes:()=>e?{class:`ProseMirror-noderangeselection`}:{class:``},handleDOMEvents:{mousedown:(e,n)=>{let{key:r}=this.options,i=/Mac/.test(navigator.platform),a=!!n.shiftKey,o=!!n.ctrlKey,s=!!n.altKey,c=!!n.metaKey;return(r==null||r===`Shift`&&a||r===`Control`&&o||r===`Alt`&&s||r===`Meta`&&c||r===`Mod`&&(i?c:o))&&(t=!0),t&&document.addEventListener(`mouseup`,()=>{t=!1;let{state:n}=e,{doc:r,selection:i,tr:a}=n,{$anchor:o,$head:s}=i;if(o.sameParent(s))return;let c=oX.create(r,o.pos,s.pos,this.options.depth);a.setSelection(c),e.dispatch(a)},{once:!0}),!1}},decorations:n=>{let{selection:r}=n,i=sX(r);if(e=!1,!t)return i?(e=!0,nX(r.ranges)):null;let{$from:a,$to:o}=r;if(!i&&a.sameParent(o))return null;let s=iX(a,o,this.options.depth);return s.length?(e=!0,nX(s)):null}}})]}});function cX(e,t){let n=getComputedStyle(e);if(t)return t.filter(e=>e.trim().length>0).map(e=>`${e}:${n.getPropertyValue(e)};`).join(``);let r=``;for(let e=0;e<n.length;e+=1)r+=`${n[e]}:${n.getPropertyValue(n[e])};`;return r}function lX(e,t){let n=e.cloneNode(!0),r=[e,...Array.from(e.getElementsByTagName(`*`))],i=[n,...Array.from(n.getElementsByTagName(`*`))];return r.forEach((e,n)=>{i[n].style.cssText=cX(e,t)}),n}var uX=[{id:`listItemFirstChild`,evaluate:({parent:e,isFirst:t})=>t&&e&&[`listItem`,`taskItem`].includes(e.type.name)?1e3:0},{id:`listWrapperDeprioritize`,evaluate:({node:e})=>{let t=[`listItem`,`taskItem`],n=e.firstChild;return n&&t.includes(n.type.name)?1e3:0}},{id:`tableStructure`,evaluate:({node:e,parent:t})=>[`tableRow`,`tableCell`,`tableHeader`].includes(e.type.name)||t&&t.type.name===`tableHeader`?1e3:0},{id:`inlineContent`,evaluate:({node:e})=>e.isInline||e.isText?1e3:0}],dX={edges:[`left`,`top`],threshold:12,strength:500};function fX(e){return e===void 0||e===`left`?{...dX}:e===`right`?{edges:[`right`,`top`],threshold:12,strength:500}:e===`both`?{edges:[`left`,`right`,`top`],threshold:12,strength:500}:e===`none`?{edges:[],threshold:0,strength:0}:{...dX,...e}}function pX(e,t,n){if(n.edges.length===0)return!1;let r=t.getBoundingClientRect(),{threshold:i,edges:a}=n;return a.some(t=>t===`left`?e.x-r.left<i:t===`right`?r.right-e.x<i:t===`top`?e.y-r.top<i:t===`bottom`&&r.bottom-e.y<i)}function mX(e,t,n,r){return!t||n.edges.length===0?0:pX(e,t,n)?n.strength*r:0}var hX=1e3;function gX(e,t,n,r){let i=hX,a=!1;if(t.every(t=>{let n=t.evaluate(e);return i-=n,i<=0?(a=!0,!1):!0}),a)return-1;let o=e.view.nodeDOM(e.pos);return i-=mX(r,o,n,e.depth),i<=0?-1:i}function _X(e,t,n){return Array.from({length:t},(e,n)=>t-1-n).some(t=>n.includes(e.node(t).type.name))}function vX(e,t,n){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return null;let r=e.posAtCoords({left:t.x,top:t.y});if(!r)return null;let{doc:i}=e.state,a=i.resolve(r.pos),o=[];n.defaultRules&&o.push(...uX),o.push(...n.rules);let s=Array.from({length:a.depth},(e,t)=>a.depth-t).map(r=>{let i=a.node(r),s=a.before(r);if(n.allowedContainers&&r>0&&!_X(a,r,n.allowedContainers))return null;let c=r>0?a.node(r-1):null,l=r>0?a.index(r-1):0,u=c?c.childCount:1,d=gX({node:i,pos:s,depth:r,parent:c,index:l,isFirst:l===0,isLast:l===u-1,$pos:a,view:e},o,n.edgeDetection,t);return d<0?null:{node:i,pos:s,depth:r,score:d,dom:e.nodeDOM(s)}}).filter(e=>e!==null),c=a.nodeAfter;if(c&&c.isAtom&&!c.isInline){let i=r.pos,l=a.depth+1,u=a.parent,d=a.index(),f=u.childCount,p=!0;if(n.allowedContainers&&(p=_X(a,l,n.allowedContainers)),p){let r=gX({node:c,pos:i,depth:l,parent:u,index:d,isFirst:d===0,isLast:d===f-1,$pos:a,view:e},o,n.edgeDetection,t);if(r>=0){let t=e.nodeDOM(i);t&&s.push({node:c,pos:i,depth:l,score:r,dom:t})}}}if(s.length===0)return null;s.sort((e,t)=>t.score===e.score?t.depth-e.depth:t.score-e.score);let l=s[0];return l.dom?{node:l.node,pos:l.pos,dom:l.dom}:null}function yX(e,t){let n=e;for(;n?.parentElement&&n.parentElement!==t.dom;)n=n.parentElement;return n?.parentElement===t.dom?n:void 0}function bX(e){return Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&e.width>0&&e.height>0}function xX(e,t,n,r=5){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let i=e.dom,a=i.firstElementChild,o=i.lastElementChild;if(!a||!o)return null;let s=a.getBoundingClientRect(),c=o.getBoundingClientRect();if(!bX(s)||!bX(c))return null;let l=Math.min(Math.max(s.top+r,n),c.bottom-r),u=.5,d=Math.abs(s.left-c.left)<u,f=Math.abs(s.right-c.right)<u,p=s;d&&f&&(p=s);let m=Math.min(Math.max(p.left+r,t),p.right-r);return!Number.isFinite(m)||!Number.isFinite(l)?null:{x:m,y:l}}var SX=e=>{let{x:t,y:n,editor:r,nestedOptions:i}=e,{view:a,state:o}=r,s=xX(a,t,n,5);if(!s)return{resultElement:null,resultNode:null,pos:null};let{x:c,y:l}=s;if(i?.enabled){let e=vX(a,{x:c,y:l},i);return e?{resultElement:e.dom,resultNode:e.node,pos:e.pos}:{resultElement:null,resultNode:null,pos:null}}let u=a.root.elementsFromPoint(c,l),d;if(Array.prototype.some.call(u,e=>{if(!a.dom.contains(e))return!1;let t=yX(e,a);return t?(d=t,!0):!1}),!d){let e=a.posAtCoords({left:c,top:l});if(e){let t=o.doc.resolve(e.pos),n=Math.min(t.depth,1),r=n>0?t.before(n):t.pos,i=o.doc.nodeAt(r);if(i){let e=a.nodeDOM(r);return{resultElement:e instanceof HTMLElement?e:null,resultNode:i,pos:r}}}return{resultElement:null,resultNode:null,pos:null}}let f;try{f=a.posAtDOM(d,0)}catch{return{resultElement:null,resultNode:null,pos:null}}let p=o.doc.nodeAt(f);if(!p){let e=o.doc.resolve(f),t=e.parent;return{resultElement:d,resultNode:t,pos:e.start()}}return{resultElement:d,resultNode:p,pos:f}};function CX(e,t){let n=e.nodeDOM(t);if(n instanceof Element&&n!==e.dom)return n;let{node:r,offset:i}=e.domAtPos(t),a=r.childNodes[i];return a instanceof Element?a:r instanceof Element?r:r.nodeType===Node.TEXT_NODE&&r.parentElement?r.parentElement:null}function wX(e,t){let n=CX(e,t);return(n?getComputedStyle(n).direction:getComputedStyle(e.dom).direction)||`ltr`}function TX(e){var t;(t=e.parentNode)==null||t.removeChild(e)}function EX(e,t){return e===`rtl`?t:0}function DX(e,t,n,r){let{doc:i}=t.view.state;if(n?.enabled&&r?.node&&r.pos>=0){let e=r.pos,t=r.pos+r.node.nodeSize;return[{$from:i.resolve(e),$to:i.resolve(t)}]}let a=SX({editor:t,x:e.clientX,y:e.clientY,direction:`right`,nestedOptions:n});if(!a.resultNode||a.pos===null)return[];let o=a.resultNode.isText||a.resultNode.isAtom?0:-1;return iX(i.resolve(a.pos),i.resolve(a.pos+a.resultNode.nodeSize+o),0,{extendOnBoundaryOverlap:!1})}function OX(e,t,n,r,i){let{view:a}=t;if(!e.dataTransfer)return;let{empty:o,$from:s,$to:c}=a.state.selection,l=DX(e,t,n,r),u=iX(s,c,0,{extendOnBoundaryOverlap:!1}),d=u.some(e=>l.find(t=>t.$from===e.$from&&t.$to===e.$to)),f=o||!d?l:u;if(!f.length)return;let{tr:p}=a.state,m=document.createElement(`div`),h=f[0].$from.pos,g=f[f.length-1].$to.pos,_=wX(a,h);m.setAttribute(`dir`,_);let v=n?.enabled&&r?.node,y,b;v?(y=a.state.doc.slice(h,g),b=hl.create(a.state.doc,h)):(b=oX.create(a.state.doc,h,g),y=b.content()),f.forEach(e=>{let t=CX(a,e.$from.pos);if(!t)return;let n=lX(t,i);n.style.margin=`0`,m.append(n)}),m.style.position=`absolute`,m.style.top=`-10000px`,document.body.append(m),e.dataTransfer.clearData();let x=EX(_,m.getBoundingClientRect().width);e.dataTransfer.setDragImage(m,x,0);let S=!1,C=()=>{S||(S=!0,TX(m),document.removeEventListener(`drop`,C),document.removeEventListener(`dragend`,C))},w=b instanceof hl?b:void 0;a.dragging={slice:y,move:!0,node:w},p.setSelection(b),a.dispatch(p),document.addEventListener(`drop`,C),document.addEventListener(`dragend`,C)}var kX=(e,t)=>{let n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},AX=(e,t)=>{let n=e.nodeAt(t),r=e.resolve(t),{depth:i}=r,a=n;for(;i>0;){let e=r.node(i);--i,i===0&&(a=e)}return a},jX=(e,t)=>{let n=FJ.getState(e);return n?OY(t,n.type,n.binding.mapping):null},MX=(e,t)=>{let n=FJ.getState(e);return n?jY(n.doc,n.type,t,n.binding.mapping)||0:-1},NX=(e,t)=>{let n=t;for(;n?.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},PX=new Pl(`dragHandle`),FX=({pluginKey:e=PX,element:t,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:a,onElementDragStart:o,onElementDragEnd:s,nestedOptions:c,dragImageProperties:l})=>{let u=document.createElement(`div`),d=!1,f=null,p=-1,m,h=null,g=null;function _(){t&&(t.style.visibility=`hidden`,t.style.pointerEvents=`none`)}function v(){if(t){if(!n.isEditable){_();return}t.style.visibility=``,t.style.pointerEvents=`auto`}}function y(e){let n=i?.()||{getBoundingClientRect:()=>e.getBoundingClientRect()};St(n,t,r).then(e=>{Object.assign(t.style,{position:e.strategy,left:`${e.x}px`,top:`${e.y}px`})})}function b(e){o?.(e),OX(e,n,c,{node:f,pos:p},l),t&&(t.dataset.dragging=`true`),setTimeout(()=>{t&&(t.style.pointerEvents=`none`)},0)}function x(e){s?.(e),_(),t&&(t.style.pointerEvents=`auto`,t.dataset.dragging=`false`)}function S(){if(dy()){let e=n.view.dom;requestAnimationFrame(()=>{e.isContentEditable&&(e.contentEditable=`false`,e.contentEditable=`true`)})}}return u.appendChild(t),{unbind(){t.removeEventListener(`dragstart`,b),t.removeEventListener(`dragend`,x),document.removeEventListener(`drop`,S),h&&(cancelAnimationFrame(h),h=null,g=null)},plugin:new jl({key:typeof e==`string`?new Pl(e):e,state:{init(){return{locked:!1}},apply(e,r,i,o){let s=e.getMeta(`lockDragHandle`),c=e.getMeta(`hideDragHandle`);if(s!==void 0&&(d=s),c)return _(),d=!1,f=null,p=-1,a?.({editor:n,node:null,pos:-1}),r;if(e.docChanged&&p!==-1&&t){if(YY(e)){let e=MX(o,m);e!==p&&(p=e)}else{let t=e.mapping.map(p);t!==p&&(p=t,m=jX(o,p))}}return r}},view:e=>{var r;return t.draggable=!0,t.style.pointerEvents=`auto`,t.dataset.dragging=`false`,(r=n.view.dom.parentElement)==null||r.appendChild(u),u.style.pointerEvents=`none`,u.style.position=`absolute`,u.style.top=`0`,u.style.left=`0`,t.addEventListener(`dragstart`,b),t.addEventListener(`dragend`,x),document.addEventListener(`drop`,S),{update(r,i){if(!t)return;if(!n.isEditable){_();return}if(t.draggable=!d,e.state.doc.eq(i.doc)||p===-1)return;let o=e.nodeDOM(p);if(o=NX(e,o),o===e.dom||o?.nodeType!==1)return;let s=e.posAtDOM(o,0),c=AX(n.state.doc,s),l=kX(n.state.doc,s);f=c,p=l,m=jX(e.state,p),a?.({editor:n,node:f,pos:p}),y(o)},destroy(){t.removeEventListener(`dragstart`,b),t.removeEventListener(`dragend`,x),document.removeEventListener(`drop`,S),h&&(cancelAnimationFrame(h),h=null,g=null),t&&TX(u)}}},props:{handleDOMEvents:{keydown(e){return!t||d?!1:e.hasFocus()?(_(),f=null,p=-1,a?.({editor:n,node:null,pos:-1}),!1):!1},mouseleave(e,t){return d||t.target&&!u.contains(t.relatedTarget)&&(_(),f=null,p=-1,a?.({editor:n,node:null,pos:-1})),!1},mousemove(e,r){return!t||d||(g={x:r.clientX,y:r.clientY},h)||(h=requestAnimationFrame(()=>{if(h=null,!g)return;let{x:t,y:r}=g;g=null;let i=SX({x:t,y:r,direction:`right`,editor:n,nestedOptions:c});if(!i.resultElement)return;let o=i.resultElement,s=i.resultNode,l=i.pos;if(!c?.enabled){if(o=NX(e,o),o===e.dom||o?.nodeType!==1)return;let t=e.posAtDOM(o,0);s=AX(n.state.doc,t),l=kX(n.state.doc,t)}s!==f&&(f=s,p=l??-1,m=jX(e.state,p),a?.({editor:n,node:f,pos:p}),y(o),v())})),!1}}}})}};function IX(e){return e===!1||e===void 0?{enabled:!1,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:fX(`none`)}:e===!0?{enabled:!0,rules:[],defaultRules:!0,allowedContainers:void 0,edgeDetection:fX(`left`)}:{enabled:!0,rules:e.rules??[],defaultRules:e.defaultRules??!0,allowedContainers:e.allowedContainers,edgeDetection:fX(e.edgeDetection)}}var LX={placement:`left-start`,strategy:`absolute`};By.create({name:`dragHandle`,addOptions(){return{render(){let e=document.createElement(`div`);return e.classList.add(`drag-handle`),e},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0,nested:!1,dragImageProperties:void 0}},addCommands(){return{lockDragHandle:()=>({editor:e})=>(this.options.locked=!0,e.commands.setMeta(`lockDragHandle`,this.options.locked)),unlockDragHandle:()=>({editor:e})=>(this.options.locked=!1,e.commands.setMeta(`lockDragHandle`,this.options.locked)),toggleDragHandle:()=>({editor:e})=>(this.options.locked=!this.options.locked,e.commands.setMeta(`lockDragHandle`,this.options.locked))}},addProseMirrorPlugins(){let e=this.options.render(),t=IX(this.options.nested);return[FX({computePositionConfig:{...LX,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:e,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd,nestedOptions:t,dragImageProperties:this.options.dragImageProperties}).plugin]}});var RX=V({name:`DragHandleVue`,props:{pluginKey:{type:[String,Object],default:PX},editor:{type:Object,required:!0},computePositionConfig:{type:Object,default:()=>({})},onNodeChange:{type:Function,default:null},onElementDragStart:{type:Function,default:null},onElementDragEnd:{type:Function,default:null},class:{type:String,default:`drag-handle`},nested:{type:[Boolean,Object],default:!1}},setup(e,{slots:n}){let r=A(null),i=t(null),a=()=>{let{editor:t,pluginKey:n,onNodeChange:a,onElementDragEnd:o,onElementDragStart:s,computePositionConfig:c,nested:l}=e;if(!r.value||!e.editor||e.editor.isDestroyed)return;r.value.style.visibility=`hidden`;let u=IX(l),d=FX({editor:t,element:r.value,pluginKey:n,computePositionConfig:{...LX,...c},onNodeChange:a,onElementDragStart:s,onElementDragEnd:o,nestedOptions:u});i.value=d,e.editor.registerPlugin(d.plugin)},o=()=>{var t,n;i.value&&=(e.editor&&!e.editor.isDestroyed&&e.editor.unregisterPlugin(e.pluginKey),(n=(t=i.value).unbind)==null||n.call(t),null)};return he(async()=>{await ae(),a()}),f(()=>e.nested,()=>{o(),a()},{deep:!0}),P(()=>{o()}),()=>ue(`div`,{ref:r,class:e.class,style:{position:`absolute`},"data-dragging":`false`},n.default?.call(n))}});function zX(e,t){if(!t?.schema)return!1;let n=typeof e==`string`?e:e.name;return t.schema.spec.marks.get(n)!==void 0}function BX(e,t){if(!e)return!1;let{selection:n}=e.state,{$from:r,to:i}=n;return t.some(t=>e.state.doc.nodesBetween(r.pos,i,e=>e.type.name===t))}function VX(e,t){return e?e.extensionManager.extensions.some(e=>e.name===t):!1}function HX(e){let t=`toggle${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>BX(e,[`image`])||e.isActive(`code`)}}function UX(e){let t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:e=>e.can()[t](),execute:e=>e.chain().focus()[t](),isActive:t=>t.isActive(e),isDisabled:e=>BX(e,[`image`])||e.isActive(`code`)}}function WX(e){return{canExecute:t=>t.can()[e](),execute:t=>t.chain()[e](),isActive:()=>!1,isDisabled:void 0}}function GX(){return{canExecute:(e,t)=>e.can().toggleMark(t.mark),execute:(e,t)=>e.chain().focus().toggleMark(t.mark),isActive:(e,t)=>e.isActive(t.mark),isDisabled:(e,t)=>!zX(t.mark,e)||BX(e,[`image`])}}function KX(){return{canExecute:(e,t)=>e.can().setTextAlign(t.align),execute:(e,t)=>e.chain().focus().setTextAlign(t.align),isActive:(e,t)=>e.isActive({textAlign:t.align}),isDisabled:e=>!VX(e,`textAlign`)||BX(e,[`image`,`horizontalRule`])}}function qX(){return{canExecute:(e,t)=>e.can().toggleHeading({level:t.level}),execute:(e,t)=>e.chain().focus().toggleHeading({level:t.level}),isActive:(e,t)=>e.isActive(`heading`,{level:t.level}),isDisabled:e=>BX(e,[`image`])||e.isActive(`code`)}}function JX(){return{canExecute:e=>e.can().setLink({href:``})||e.can().unsetLink(),execute:(e,t)=>{let n=e.chain(),r=e.getAttributes(`link`).href,i=e.isActive(`code`);if(r)return n.focus().unsetLink();let a=t?.href||prompt(`Enter the URL:`);return a?i?n.focus().extendMarkRange(`code`).setLink({href:a}):n.focus().setLink({href:a}):n},isActive:e=>e.isActive(`link`),isDisabled:e=>{if(!VX(e,`link`)||BX(e,[`image`]))return!0;let{selection:t}=e.state;return t.empty&&!e.isActive(`link`)}}}function YX(){return{canExecute:e=>e.can().setImage({src:``}),execute:(e,t)=>{let n=e.chain().focus();if(t?.src)return n.setImage({src:t.src});let r=prompt(`Enter the image URL:`);return r?n.setImage({src:r}):n},isActive:e=>e.isActive(`image`),isDisabled:e=>!VX(e,`image`)}}function XX(e){let t={bulletList:`toggleBulletList`,orderedList:`toggleOrderedList`,taskList:`toggleTaskList`}[e],n=e===`taskList`?`taskItem`:`listItem`,r=[`bulletList`,`orderedList`,`taskList`];return{canExecute:e=>e.can()[t]()||e.isActive(`listItem`)||r.some(t=>VX(e,t)&&e.isActive(t)),execute:i=>{let{state:a}=i,{selection:o}=a,s=i.chain().focus();if(o.node){let e=o.node,t=e.firstChild?.firstChild,n=e.lastChild?.lastChild,r=t?o.from+t.nodeSize:o.from+1,i=n?o.to-n.nodeSize:o.to-1;s=s.setTextSelection({from:r,to:i}).clearNodes()}if(i.isActive(e)){let e=s.liftListItem(n);for(let t of r)VX(i,t)&&(e=e.lift(t));return e.selectTextblockEnd()}if(r.some(e=>VX(i,e)&&i.isActive(e))){let e=i.isActive(`taskList`)?`taskItem`:`listItem`,n=s.liftListItem(e);for(let e of r)VX(i,e)&&(n=n.lift(e));return n[t]().selectTextblockEnd()}return s[t]().selectTextblockEnd()},isActive:t=>t.isActive(e),isDisabled:t=>!VX(t,e)||BX(t,[`image`])||t.isActive(`code`)}}function ZX(e){return{canExecute:(t,n)=>{if(n?.pos==null||!t.state.doc.nodeAt(n.pos))return!1;let r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();return e===`up`?a>0:a<i.childCount-1},execute:(t,n)=>{if(n?.pos==null)return t.chain();let r=t.state.doc.nodeAt(n.pos);if(!r)return t.chain();let i=t.state.doc.resolve(n.pos),a=i.parent,o=i.index();if(e===`up`&&o>0){let e=a.child(o-1),i=n.pos-e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}if(e===`down`&&o<a.childCount-1){let e=a.child(o+1),i=n.pos+e.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+r.nodeSize}).insertContentAt(i,r.toJSON())}return t.chain()},isActive:()=>!1,isDisabled:void 0}}function QX(){return{mark:GX(),textAlign:KX(),heading:qX(),link:JX(),image:YX(),blockquote:HX(`blockquote`),bulletList:XX(`bulletList`),orderedList:XX(`orderedList`),taskList:XX(`taskList`),codeBlock:HX(`codeBlock`),horizontalRule:UX(`horizontalRule`),paragraph:UX(`paragraph`),undo:WX(`undo`),redo:WX(`redo`),clearFormatting:{canExecute:(e,t)=>t?.pos==null?e.can().clearNodes()||e.can().unsetAllMarks():!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos!=null){let n=e.state.doc.nodeAt(t.pos);if(!n)return e.chain();let r=t.pos+1,i=t.pos+n.nodeSize-1;return e.chain().focus().setTextSelection({from:r,to:i}).clearNodes().unsetAllMarks()}return e.chain().focus().clearNodes().unsetAllMarks()},isActive:()=>!1,isDisabled:void 0},duplicate:{canExecute:(e,t)=>t?.pos!=null&&!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().insertContentAt(t.pos+n.nodeSize,n.toJSON()):e.chain()},isActive:()=>!1,isDisabled:void 0},delete:{canExecute:(e,t)=>t?.pos!=null&&!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();let n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().deleteRange({from:t.pos,to:t.pos+n.nodeSize}):e.chain()},isActive:()=>!1,isDisabled:void 0},moveUp:ZX(`up`),moveDown:ZX(`down`),suggestion:{canExecute:()=>!0,execute:(e,t)=>{let{state:n}=e,{selection:r}=n,{$from:i}=r;if(t?.pos!==void 0){let r=n.doc.nodeAt(t.pos);if(r){let n=t.pos+r.nodeSize;return e.chain().focus().insertContentAt(n,{type:`paragraph`,content:[{type:`text`,text:`/`}]})}}let a=i.node(i.depth),o=i.before(i.depth)+a.nodeSize;return e.chain().focus().insertContentAt(o,{type:`paragraph`,content:[{type:`text`,text:`/`}]})},isActive:()=>!1,isDisabled:void 0},mention:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` @`:`@`)},isActive:()=>!1,isDisabled:void 0},emoji:{canExecute:()=>!0,execute:e=>{let{state:t}=e,{selection:n}=t,{$from:r}=n,i=r.parent.textBetween(Math.max(0,r.parentOffset-1),r.parentOffset,void 0,` `),a=i&&i!==` `;return e.chain().focus().insertContent(a?` :`:`:`)},isActive:()=>!1,isDisabled:void 0}}}function $X(e){let t=[];return e.offset&&t.push(Ge(typeof e.offset==`boolean`?void 0:e.offset)),e.flip&&t.push(Ke(typeof e.flip==`boolean`?void 0:e.flip)),e.shift&&t.push(Qe(typeof e.shift==`boolean`?void 0:e.shift)),e.size&&t.push(mn(typeof e.size==`boolean`?void 0:e.size)),e.autoPlacement&&t.push(Fe(typeof e.autoPlacement==`boolean`?void 0:e.autoPlacement)),e.hide&&t.push(bt(typeof e.hide==`boolean`?void 0:e.hide)),e.inline&&t.push(Ct(typeof e.inline==`boolean`?void 0:e.inline)),t}var eZ={slots:{root:`hidden sm:flex items-center justify-center transition-[top,left] duration-200 ease-out motion-reduce:transition-none`,handle:`cursor-grab px-1`}},tZ=Object.assign({inheritAttrs:!1},{__name:`EditorDragHandle`,props:{icon:{type:null,required:!1},color:{type:null,required:!1,default:`neutral`},variant:{type:null,required:!1,default:`ghost`},options:{type:Object,required:!1},editor:{type:Object,required:!0},ui:{type:Object,required:!1},pluginKey:{type:[Object,String],required:!1},nestedOptions:{type:Object,required:!1},onElementDragStart:{type:Function,required:!1},onElementDragEnd:{type:Function,required:!1},getReferencedVirtualElement:{type:Function,required:!1},dragImageProperties:{type:Array,required:!1},nested:{type:[Boolean,Object],required:!1},label:{type:String,required:!1},activeColor:{type:null,required:!1},activeVariant:{type:null,required:!1},size:{type:null,required:!1,default:`sm`},square:{type:Boolean,required:!1},block:{type:Boolean,required:!1},loadingAuto:{type:Boolean,required:!1},onClick:{type:[Function,Array],required:!1},class:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},as:{type:null,required:!1},type:{type:null,required:!1},disabled:{type:Boolean,required:!1},exactActiveClass:{type:String,required:!1},viewTransition:{type:Boolean,required:!1}},emits:[`nodeChange`,`hover`],setup(e,{emit:t}){let n=e,r=t,a=hr(`editorDragHandle`,n),s=mr(C(a,`pluginKey`,`nested`,`nestedOptions`,`onElementDragEnd`,`onElementDragStart`,`getReferencedVirtualElement`)),c=mr(pe(a,`icon`,`options`,`editor`,`pluginKey`,`nested`,`nestedOptions`,`onElementDragEnd`,`onElementDragStart`,`getReferencedVirtualElement`,`class`,`ui`)),l=_e(),u=p(()=>nr({extend:eZ,...l.ui?.editorDragHandle||{}})()),d=p(()=>Fn(a.options,{strategy:`absolute`,placement:`left-start`,offset:({rects:e})=>{let t=e.reference.height,n=e.floating.height;return t>40?{alignmentAxis:0,mainAxis:8}:{alignmentAxis:(t-n)/2,mainAxis:8}},flip:{},shift:{},size:!1,autoPlacement:!1,hide:!1,inline:!1})),f=p(()=>$X(d.value)),m=p(()=>({placement:d.value.placement,strategy:d.value.strategy,middleware:f.value})),h=A();function g({pos:e}){if(h.value=e,e==null||e<0)return;let t=a.editor.state.doc.nodeAt(e);t&&r(`hover`,{node:t.toJSON(),pos:e})}function _(){if(!a.editor)return;let e=h.value;if(e==null||e<0)return;let t=a.editor.state.doc.nodeAt(e);if(t){let n={node:t.toJSON(),pos:e};return r(`nodeChange`,n),a.editor.chain().setNodeSelection(e).run(),n}}return(e,t)=>(J(),k(F(RX),W(F(s),{"compute-position-config":m.value,editor:F(a).editor,"on-node-change":g,"data-slot":e.$attrs[`data-slot`]??`root`,class:u.value.root({class:[F(a).ui?.root,F(a).class]}),onClick:_}),{default:i(()=>[o(e.$slots,`default`,{ui:u.value,onClick:_},()=>[H(dr,W({...F(c),icon:F(a).icon||F(l).ui.icons.drag,...e.$attrs},{"data-slot":`handle`,class:u.value.handle({class:[F(a).ui?.handle,F(a).class]}),ui:F(er)(u.value,F(a).ui)}),null,16,[`class`,`ui`])])]),_:3},16,[`compute-position-config`,`editor`,`data-slot`,`class`]))}});function nZ(e){let t=A([]),n=A(0),r=A(`closed`),i=e.searchTerm??A(``),a=null,o=null,s=null,c=null,l=null,u=null,d=null,m=null,h=null,g=null,_=null,{score:v}=bn(),y=()=>{r.value!==`closed`&&(r.value=`closed`,u&&=(document.removeEventListener(`keydown`,u,!0),null),d&&=(e.editor.view.dom.removeEventListener(`blur`,d),null),g&&=(window.removeEventListener(`scroll`,g,!0),null),o&&s&&(o.removeEventListener(`mousedown`,s),s=null),a&&=(a.destroy(),null),o&&=(o.remove(),null))},b=e.filterFields??[`label`],x=e.filter||((e,t)=>{if(!t)return e;let n=[];for(let r of e){let e=null;for(let n of b){let i=Xn(r,n);if(i==null)continue;let a=Array.isArray(i)?i.map(String):[String(i)];for(let n of a){let r=n.replace(/[\s_-]/g,``),i=Math.min(v(n,t)??3,v(r,t)??3);if((e===null||i<e)&&(e=i),e===0)break}if(e===0)break}e!==null&&e<3&&n.push({item:r,score:e})}return n.sort((e,t)=>e.score-t.score),n.map(({item:e})=>e)}),S=e.limit??42,C=typeof e.pluginKey==`string`?new Pl(e.pluginKey):e.pluginKey,w=p(()=>{let t=F(e.items);return t?.length?qn(t)?t:[t]:[]}),T=p(()=>w.value.flatMap(e=>e)),E=p(()=>t.value.length?e.ignoreFilter?[t.value]:w.value.map(e=>{let n=e.filter(e=>t.value.includes(e));return n.sort((e,n)=>t.value.indexOf(e)-t.value.indexOf(n)),n}).filter(e=>e.length>0):[]),D=p(()=>t.value.filter(e=>e.type!==`label`&&e.type!==`separator`)),O=Fn(e.options,{strategy:`absolute`,placement:`bottom-start`,offset:8,flip:{},shift:{padding:8},size:!1,autoPlacement:!1,hide:!1,inline:!1}),k=$X(O),j=e=>{if(!m)return;let t=m();t&&St({getBoundingClientRect:()=>t},e,{placement:O.placement,strategy:O.strategy,middleware:k}).then(({x:t,y:n,strategy:r})=>{e.style.width=`max-content`,e.style.position=r,e.style.top=`0`,e.style.left=`0`,e.style.transform=`translate(${Math.round(t)}px, ${Math.round(n)}px)`})},M=()=>{r.value=`open`,u||(u=e=>{l&&l({event:e})&&(e.preventDefault(),e.stopPropagation())},document.addEventListener(`keydown`,u,!0)),d||(d=()=>{setTimeout(()=>{if(r.value===`open`){let t=e.editor.view.state.tr.setMeta(C,{exit:!0});e.editor.view.dispatch(t)}},0)},e.editor.view.dom.addEventListener(`blur`,d)),g||(g=()=>{o&&j(o)},window.addEventListener(`scroll`,g,!0)),h=e=>{n.value=e,a&&a.updateProps({groups:E.value,selectedIndex:e,onSelect:c,onHover:h,state:r.value})},a=new _b(N,{props:{groups:E.value,selectedIndex:n.value,onSelect:c,onHover:h,state:r.value},editor:e.editor}),o=document.createElement(`div`),o.style.position=O.strategy,o.style.zIndex=`50`,s=e=>{e.preventDefault()},o.addEventListener(`mousedown`,s),((typeof e.appendTo==`function`?e.appendTo():e.appendTo)??e.editor.view.dom.parentElement)?.appendChild(o),a.element&&o.appendChild(a.element),j(o)};e.ignoreFilter&&(_=f(()=>F(e.items),e=>{if(!m)return;let i=e?.length?qn(e)?e.flat():e:[];if(t.value=i.slice(0,S),!t.value.length){y();return}if(n.value>=D.value.length&&(n.value=Math.max(0,D.value.length-1)),r.value===`closed`&&t.value.length){M();return}a&&a.updateProps({groups:E.value,selectedIndex:n.value,onSelect:c,onHover:h,state:r.value}),o&&j(o)},{deep:!0,flush:`sync`}));let N={props:{groups:{type:Array,required:!0},selectedIndex:{type:Number,required:!0},onSelect:{type:Function,required:!0},onHover:{type:Function,required:!0},state:{type:String,required:!0}},setup(t){function n(e,n,r){e.preventDefault(),t.onSelect(n,r)}function r(e){t.onHover(e)}return()=>{let i=t.groups,a=new Map,o=0;for(let e of i)for(let t of e){let e=t;e.type!==`label`&&e.type!==`separator`&&a.set(t,o++)}return ue(`div`,{class:e.ui.value.content(),role:`listbox`,"data-state":t.state},[ue(`div`,{class:e.ui.value.viewport(),role:`presentation`},i.map((i,o)=>ue(`div`,{key:`group-${o}`,class:e.ui.value.group(),role:`group`},i.map((i,s)=>{let c=i;if(c.type===`label`)return ue(`div`,{key:`label-${o}-${s}`,class:e.ui.value.label({class:c.class})},e.renderItem(i,e.ui));if(c.type===`separator`)return ue(`div`,{key:`separator-${o}-${s}`,class:e.ui.value.separator({class:c.class}),role:`separator`});let l=a.get(i),u=l===t.selectedIndex;return ue(`div`,{key:`item-${l}`,class:e.ui.value.item({class:c.class,active:!1}),role:`option`,"aria-selected":u,"data-highlighted":u?``:void 0,"data-disabled":c.disabled?``:void 0,onMousedown:e=>n(e,i,l),onMouseenter:()=>r(l),ref:e=>{e&&u&&e.scrollIntoView({block:`nearest`,inline:`nearest`})}},e.renderItem(i,e.ui))}))))])}}};return{plugin:Tb({...e.suggestion||{},pluginKey:C,editor:e.editor,char:e.char,items:({query:t})=>(i.value=t,e.ignoreFilter?T.value.slice(0,S):x(T.value,t).slice(0,S)),command:({editor:t,range:n,props:r})=>{e.onSelect(t,n,r)},render:()=>(l=e=>{let{event:t}=e;if(!a||!D.value.length)return!1;if(t.key===`Escape`)return y(),!0;if(t.key===`ArrowUp`)return n.value=(n.value+D.value.length-1)%D.value.length,a?.updateProps({groups:E.value,selectedIndex:n.value,onSelect:c,onHover:h,state:r.value}),!0;if(t.key===`ArrowDown`)return n.value=(n.value+1)%D.value.length,a?.updateProps({groups:E.value,selectedIndex:n.value,onSelect:c,onHover:h,state:r.value}),!0;if(t.key===`Enter`||t.key===`Tab`){let e=D.value[n.value];return e&&c&&c(e),!0}return!1},{onStart:r=>{n.value=0,c=e=>r.command(e),m=r.clientRect,!r.loading&&(t.value=e.ignoreFilter?T.value.slice(0,S):r.items,t.value.length&&M())},onUpdate:i=>{if(c=e=>i.command(e),!i.loading){if(t.value=e.ignoreFilter?T.value.slice(0,S):i.items,n.value>=D.value.length&&(n.value=Math.max(0,D.value.length-1)),!t.value.length){y();return}a?a.updateProps({groups:E.value,selectedIndex:n.value,onSelect:c,onHover:h,state:r.value}):M(),o&&j(o)}},onKeyDown:l,onExit:()=>{y(),m=null,i.value=``}})}),destroy:()=>{r.value=`closed`,u&&=(document.removeEventListener(`keydown`,u,!0),null),d&&=(e.editor.view.dom.removeEventListener(`blur`,d),null),g&&=(window.removeEventListener(`scroll`,g,!0),null),o&&s&&(o.removeEventListener(`mousedown`,s),s=null),a&&=(a.destroy(),null),o&&=(o.remove(),null),_&&=(_(),null)},filteredItems:t,searchTerm:i}}var rZ={slots:{content:`min-w-48 max-w-60 max-h-96 bg-default shadow-lg rounded-md ring ring-default overflow-hidden data-[state=open]:animate-[scale-in_100ms_var(--ease-out)] data-[state=closed]:animate-[scale-out_100ms_var(--ease-out)] origin-(--reka-dropdown-menu-content-transform-origin) flex flex-col`,viewport:`relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1`,group:`p-1 isolate`,label:`w-full flex items-center font-semibold text-highlighted`,separator:`-mx-1 my-1 h-px bg-border`,item:`group relative w-full flex items-start select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75`,itemLeadingIcon:`shrink-0 flex items-center justify-center`,itemLeadingAvatar:`shrink-0`,itemLeadingAvatarSize:``,itemWrapper:`flex-1 flex flex-col text-start min-w-0`,itemLabel:`truncate`,itemDescription:`truncate text-muted`,itemLabelExternalIcon:`inline-block size-3 align-top text-dimmed`},variants:{size:{xs:{label:`p-1 text-[10px]/3 gap-1`,item:`p-1 text-xs gap-1`,itemLeadingIcon:`size-4 text-sm`,itemLeadingAvatarSize:`3xs`},sm:{label:`p-1.5 text-[10px]/3 gap-1.5`,item:`p-1.5 text-xs gap-1.5`,itemLeadingIcon:`size-4 text-sm`,itemLeadingAvatarSize:`3xs`},md:{label:`p-1.5 text-xs gap-1.5`,item:`p-1.5 text-sm gap-1.5`,itemLeadingIcon:`size-5 text-base`,itemLeadingAvatarSize:`2xs`},lg:{label:`p-2 text-xs gap-2`,item:`p-2 text-sm gap-2`,itemLeadingIcon:`size-5 text-base`,itemLeadingAvatarSize:`2xs`},xl:{label:`p-2 text-sm gap-2`,item:`p-2 text-base gap-2`,itemLeadingIcon:`size-6 text-xl`,itemLeadingAvatarSize:`xs`}},active:{true:{item:`text-highlighted before:bg-elevated/75`,itemLeadingIcon:`text-default`},false:{item:[`text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50`,`transition-colors before:transition-colors`],itemLeadingIcon:[`text-dimmed group-data-highlighted:not-group-data-disabled:text-default`,`transition-colors`]}}},defaultVariants:{size:`md`}},iZ=Object.assign({inheritAttrs:!1},{__name:`EditorSuggestionMenu`,props:{size:{type:null,required:!1},items:{type:Array,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},editor:{type:Object,required:!1},char:{type:String,required:!1,default:`/`},pluginKey:{type:String,required:!1,default:`suggestionMenu`},filterFields:{type:Array,required:!1},limit:{type:Number,required:!1},options:{type:Object,required:!1},suggestion:{type:Object,required:!1},appendTo:{type:Function,required:!1,skipCheck:!0}},setup(e){let t=e,n=_e(),r=ie(`editorHandlers`,p(()=>QX())),i=p(()=>nr({extend:rZ,...n.ui?.editorSuggestionMenu||{}})({size:t.size})),a=null;return he(async()=>{await ae(),t.editor&&!t.editor.isDestroyed&&(a=nZ({editor:t.editor,char:t.char,pluginKey:t.pluginKey,items:fe(()=>t.items),filterFields:t.filterFields,limit:t.limit,options:t.options,suggestion:t.suggestion,appendTo:t.appendTo,ui:i,onSelect:(e,t,n)=>{if(n.type===`label`||n.type===`separator`)return;e.chain().focus().deleteRange(t).run();let i=r?.value?.[n.kind];i&&i.execute(e,n).run()},renderItem:(e,t)=>e.type===`label`?[ue(`span`,{},e.label)]:[e.icon?ue(ge,{name:e.icon,class:t.value.itemLeadingIcon()}):null,ue(`span`,{class:t.value.itemWrapper()},[ue(`span`,{class:t.value.itemLabel()},e.label),e.description?ue(`span`,{class:t.value.itemDescription()},e.description):null])]}),t.editor.registerPlugin(a.plugin))}),P(()=>{a&&=(a.destroy(),null),t.editor&&!t.editor.isDestroyed&&t.editor.unregisterPlugin(t.pluginKey)}),(e,t)=>(J(),b(`div`))}});function aZ(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var oZ=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&ug(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ke(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Qe(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ge(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Pn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Fe(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(bt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Ct(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=tv(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof hl){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof tw){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():aZ(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&St(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},sZ=e=>new jl({key:typeof e.pluginKey==`string`?new Pl(e.pluginKey):e.pluginKey,view:t=>new oZ({view:t,...e})}),cZ=V({name:`BubbleMenu`,inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:void 0},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:n}){let r=A(null),i=e.pluginKey??new Pl(`bubbleMenu`);return he(()=>{let{editor:t,options:n,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),ae(()=>{t.registerPlugin(sZ({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),P(()=>{let{editor:t}=e;t.unregisterPlugin(i)}),()=>ue(`div`,{ref:r,...n},t.default?.call(t))}}),lZ=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return A_(e,{textSerializers:j_(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ke(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Qe(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ge(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Pn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Fe(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(bt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Ct(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=tv(this.view,e.from,e.to);St({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},uZ=e=>new jl({key:typeof e.pluginKey==`string`?new Pl(e.pluginKey):e.pluginKey,view:t=>new lZ({view:t,...e})}),dZ=V({name:`FloatingMenu`,inheritAttrs:!1,props:{pluginKey:{type:null,default:void 0},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:n}){let r=A(null),i=e.pluginKey??new Pl(`floatingMenu`);return he(()=>{let{editor:t,updateDelay:n,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),t.registerPlugin(uZ({pluginKey:i,editor:t,element:l,updateDelay:n,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),P(()=>{let{editor:t}=e;t.unregisterPlugin(i)}),()=>ue(`div`,{ref:r,...n},t.default?.call(t))}}),fZ={slots:{root:`focus:outline-none`,base:`flex items-stretch gap-1.5`,group:`flex items-center gap-0.5`,separator:`w-px self-stretch bg-border`},variants:{layout:{bubble:{base:`bg-default border border-default rounded-lg p-1`},floating:{base:`bg-default border border-default rounded-lg p-1`},fixed:{base:``}}}},pZ=Object.assign({inheritAttrs:!1},{__name:`EditorToolbar`,props:{as:{type:null,required:!1},color:{type:null,required:!1,default:`neutral`},variant:{type:null,required:!1,default:`ghost`},activeColor:{type:null,required:!1,default:`primary`},activeVariant:{type:null,required:!1,default:`soft`},size:{type:null,required:!1,default:`sm`},items:{type:null,required:!1},editor:{type:Object,required:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},layout:{type:String,required:!1,default:`fixed`},pluginKey:{type:[Object,String],required:!1},updateDelay:{type:Number,required:!1},resizeDelay:{type:Number,required:!1},shouldShow:{type:[Function,null],required:!1},appendTo:{type:Function,required:!1,skipCheck:!0},getReferencedVirtualElement:{type:Function,required:!1},options:{type:Object,required:!1}},setup(e){let t=hr(`editorToolbar`,e),n=_e(),r=ie(`editorHandlers`,p(()=>QX())),a=p(()=>({bubble:cZ,floating:dZ,fixed:`template`})[t.layout]),c=mr(pe(t,`as`,`color`,`variant`,`activeColor`,`activeVariant`,`size`,`items`,`layout`,`editor`,`class`,`ui`)),l=p(()=>Fn(t.options,{offset:8,shift:{padding:8}})),u=p(()=>nr({extend:fZ,...n.ui?.editorToolbar||{}})({layout:t.layout})),d=p(()=>t.items?.length?qn(t.items)?t.items:[t.items]:[]);function f(e){return t.editor?.isEditable?`items`in e&&e.items?.length?e.items?.some(e=>f(e))||!1:`kind`in e?(r?.value?.[e.kind])?.isActive(t.editor,e)||!1:e.active??!1:!1}function m(e){if(!t.editor?.isEditable)return!0;if(`items`in e&&e.items?.length){let t=(qn(e.items)?e.items.flat():e.items).filter(e=>e.type!==`separator`&&e.type!==`label`);return t.length===0||t.every(e=>m(e))}if(!(`kind`in e))return e.disabled??!1;let n=r?.value?.[e.kind];return n?n.isDisabled?.(t.editor,e)?!0:!n.canExecute(t.editor,e):!1}function h(e,n){if(!t.editor?.isEditable||m(n))return;if(`items`in n||!(`kind`in n)){if(`onClick`in n)for(let t of Array.isArray(n.onClick)?n.onClick:[n.onClick])t?.(e);return}let i=r?.value?.[n.kind];i&&i.execute(t.editor,n).run()}function g(e){if(e.items)return(qn(e.items)?e.items.flat():e.items).find(e=>`kind`in e&&f(e))}function _(e){let n=gr(e,[`kind`,`mark`,`align`,`level`,`href`,`src`,`pos`,`items`,`slot`,`checkedIcon`,`loadingIcon`,`externalIcon`,`content`,`arrow`,`portal`,`modal`,`tooltip`,`onClick`]);if(`items`in e&&e.items?.length){let t=g(e);t?.icon&&(n.icon=t.icon),t?.label&&n.label!==void 0&&(n.label=t.label)}return Fn(n,{"aria-label":n.label?void 0:e.tooltip?.text,color:t.color,activeColor:t.activeColor,activeVariant:t.activeVariant,variant:t.variant,size:t.size})}function v(e){let n=Gn(e,[`size`,`checkedIcon`,`loadingIcon`,`externalIcon`,`content`,`arrow`,`portal`,`modal`,`ui`]);return Fn(n,{modal:!1,size:t.size})}function y(e){let t=`children`in e&&Array.isArray(e.children)?e.children.map(y):void 0;if(!(`kind`in e))return t?{...e,children:t}:e;let n=e;return{...n,...t&&{children:t},active:f(n),disabled:m(n),onSelect:e=>h(e,n)}}function x(e){return e.items?qn(e.items)?e.items.map(e=>e.map(y)):[e.items.map(y)]:[]}return(e,n)=>(J(),k(F(rr),W({as:a.value},a.value===`template`?{...e.$attrs}:{editor:F(t).editor,tabindex:-1,class:u.value.root({class:F(t).ui?.root}),...F(c),options:l.value,...e.$attrs}),{default:i(()=>[H(F(rr),{as:F(t).as,role:`toolbar`,"data-slot":`base`,class:G(u.value.base({class:[F(t).ui?.base,F(t).class]}))},{default:i(()=>[(J(!0),b(O,null,s(d.value,(n,r)=>(J(),b(O,{key:`group-${r}`},[j(`div`,{role:`group`,"data-slot":`group`,class:G(u.value.group({class:F(t).ui?.group}))},[(J(!0),b(O,null,s(n,(t,n)=>o(e.$slots,t.slot||`item`,{item:t,index:n,isActive:f,isDisabled:m,onClick:h},()=>[`items`in t&&t.items?.length?(J(),k(Bt,W({key:0,ref_for:!0},v(t),{items:x(t)}),{default:i(()=>[t.tooltip?(J(),k(Ft,W({key:0,disabled:m(t)},{ref_for:!0},{...t.tooltip||{}}),{default:i(()=>[H(dr,W({active:f(t),disabled:m(t)},{ref_for:!0},_(t),{onClick:e=>h(e,t)}),null,16,[`active`,`disabled`,`onClick`])]),_:2},1040,[`disabled`])):(J(),k(dr,W({key:1,active:f(t),disabled:m(t)},{ref_for:!0},_(t),{onClick:e=>h(e,t)}),null,16,[`active`,`disabled`,`onClick`]))]),_:2},1040,[`items`])):t.tooltip?(J(),k(Ft,W({key:1,disabled:m(t)},{ref_for:!0},{...t.tooltip||{}}),{default:i(()=>[H(dr,W({active:f(t),disabled:m(t)},{ref_for:!0},_(t),{ui:t.ui,onClick:e=>h(e,t)}),null,16,[`active`,`disabled`,`ui`,`onClick`])]),_:2},1040,[`disabled`])):(J(),k(dr,W({key:2,active:f(t),disabled:m(t)},{ref_for:!0},_(t),{ui:t.ui,onClick:e=>h(e,t)}),null,16,[`active`,`disabled`,`ui`,`onClick`]))],void 0,`group-${r}-${n}`)),128))],2),r<d.value.length-1?(J(),k(F(Pa),{key:0,"data-slot":`separator`,class:G(u.value.separator({class:F(t).ui?.separator})),orientation:`vertical`},null,8,[`class`])):M(``,!0)],64))),128))]),_:3},8,[`as`,`class`])]),_:3},16,[`as`]))}}),mZ=e=>Array.from(e.entries()).map(([e,t])=>t&&t.user?{clientId:e,...t.user}:{clientId:e}),hZ=()=>null,gZ=e=>hy(e)&&/^#[0-9a-fA-F]{6}$/.test(e),_Z=e=>({...e,color:gZ(e.color)?e.color:`transparent`}),vZ=By.create({name:`collaborationCaret`,priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:e=>{let t=document.createElement(`span`),{color:n}=_Z(e);t.classList.add(`collaboration-carets__caret`),t.style.borderColor=n;let r=document.createElement(`div`);return r.classList.add(`collaboration-carets__label`),r.style.backgroundColor=n,r.insertBefore(document.createTextNode(e.name),null),t.insertBefore(r,null),t},selectionRender:e=>gZ(e.color)?BY(e):{},onUpdate:hZ}},onCreate(){if(this.options.onUpdate!==hZ&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCaret.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),!this.options.provider)throw Error(`The "provider" option is required for the CollaborationCaret extension`)},addStorage(){return{users:[]}},addCommands(){return{updateUser:e=>()=>(this.options.provider.awareness.setLocalStateField(`user`,e),!0),user:e=>({editor:t})=>(console.warn(`[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret`),t.commands.updateUser(e))}},addProseMirrorPlugins(){let{provider:e}=this.options,t=this.storage,n=this.options.user;return[new jl({key:new Pl(`collaborationCaretAwarenessListener`),view:()=>{let r=()=>{t.users=mZ(e.awareness.states)};return e.awareness.setLocalStateField(`user`,n),t.users=mZ(e.awareness.states),e.awareness.on(`update`,r),{destroy:()=>{e.awareness.off(`update`,r),t.users=[]}}}}),UY(e.awareness,{cursorBuilder:e=>this.options.render(_Z(e)),selectionBuilder:e=>this.options.selectionRender(_Z(e))})]}}),yZ=`markdown`;function bZ(e={}){let{content:n,contentType:r=yZ,streaming:i,components:a=[],extensions:o=[],kitOptions:s,editorOptions:c,onError:u,onCreate:d,onUpdate:m,onDestroy:h}=e,g=t(void 0),_=null,v=[...a,...s?.components??[]],y=u===void 0?s?.serializer:{onError:u,...s?.serializer},b=[tN.configure({...s,...y?{serializer:y}:{},components:v}),...o],x=ce(n),S=x!==void 0&&(r===`ast`||OC(x)),C=S?void 0:x??void 0,w=x===void 0||S?void 0:r;return he(()=>{let e=new pb({...c,extensions:b,content:C,...w?{contentType:w}:{},onCreate({editor:e}){d?.(e)},onUpdate({editor:e,transaction:t}){m?.(e,t)},onDestroy(){h?.()}});x!==void 0&&(r===`ast`||OC(x))&&e.commands.setComarkAst(x,{emitUpdate:!1}),g.value=e,f(()=>ce(i)===!0,t=>{t?_=e.storage.comark.stream():(_?.end(),_=null)},{immediate:!0}),(l(n)||typeof n==`function`)&&f(()=>ce(n),t=>{if(t!==void 0&&!e.isDestroyed){if(_?.active){typeof t==`string`&&_.set(t);return}AC(e,t,r)}})}),P(()=>{g.value?.destroy()}),{editor:g,isReady:p(()=>g.value!==void 0),setContent:async(e,t={})=>{let n=g.value;if(!n)return;let i=t.contentType??r,a;a=typeof e==`function`?await e({content:i===`markdown`?await n.storage.comark.getMarkdown():jC(n,i),editor:n}):e,AC(n,a,i,t)},getAst:()=>g.value?.storage.comark.getAst()??null,getMarkdown:()=>g.value?.storage.comark.getMarkdown()??Promise.resolve(null),getJson:()=>g.value?.getJSON()??null,getHtml:()=>g.value?.getHTML()??null}}V({name:`ComarkEditor`,inheritAttrs:!1,props:{editor:{type:Object,default:void 0},content:{type:[Object,String,Array],default:void 0},contentType:{type:String,default:void 0},streaming:{type:Boolean,default:!1},components:{type:Array,default:void 0},extensions:{type:Array,default:void 0},editorOptions:{type:Object,default:void 0},kitOptions:{type:Object,default:void 0},onError:{type:Function,default:void 0},modelValue:{type:[Object,String,Array],default:void 0},modelModifiers:{type:Object,default:()=>({})}},emits:{"update:modelValue":e=>!0,ready:e=>!0,update:(e,t)=>!0},slots:Object,setup(e,{emit:t,slots:n,attrs:r,expose:i}){let a=()=>e.modelValue,o=e=>t(`update:modelValue`,e),s=I(),c=()=>e.modelValue!==void 0||s?.vnode.props?.[`onUpdate:modelValue`]!=null,l=s?.vnode.props!=null&&`editor`in s.vnode.props;function u(){let t=e.modelModifiers;return t.html?`html`:t.json?`json`:t.ast?`ast`:t.markdown?`markdown`:null}let d=p(()=>u()??e.contentType??`markdown`),m=p(()=>e.content===void 0?u()??e.contentType??`markdown`:e.contentType??`markdown`),h=null,g=MC(),_=e.content===void 0?a():e.content,v=l?null:bZ({content:_,contentType:m.value,streaming:()=>e.streaming,components:e.components,extensions:e.extensions,kitOptions:e.kitOptions,editorOptions:e.editorOptions,onError:e.onError,onCreate:n=>{c()&&(m.value===`markdown`&&typeof _==`string`||e.content===void 0?b(n):y(n)),t(`ready`,n)},onUpdate:(e,n)=>{t(`update`,e,n),c()&&(g.bump(),!n.getMeta(`comarkModelApply`)&&g.schedule(()=>void y(e)))}});async function y(e){if(e.isDestroyed)return;if(d.value===`markdown`){let t=g.capture();try{let n=await e.storage.comark.getMarkdown();if(e.isDestroyed||!g.isCurrent(t)||n===h)return;h=n,o(n)}catch(n){if(e.isDestroyed||!g.isCurrent(t))return;e.storage.comark.onError?.(n,{phase:`render`})}return}let t=jC(e,d.value),n=NC(t);n!==h&&(h=n,o(t))}async function b(e){if(d.value===`markdown`){let t=g.capture();try{let n=await e.storage.comark.getMarkdown();if(e.isDestroyed||!g.isCurrent(t))return;h=n}catch(n){if(e.isDestroyed||!g.isCurrent(t))return;h=null,e.storage.comark.onError?.(n,{phase:`render`})}return}h=NC(jC(e,d.value))}f(()=>e.modelValue,e=>{if(e===void 0||!v)return;let t=v.editor.value?.storage.comark.streamSession;if(t?.active){typeof e==`string`&&t.set(e);return}if(d.value===`markdown`&&typeof e==`string`){if(e===h)return;h=e}else{let t=NC(e);if(t===h)return;h=t}g.bump(),v.setContent(e,{contentType:d.value,transactionMeta:{[kC]:!0}})});let x=p(()=>e.editor??v?.editor.value);return i({editor:x,isReady:p(()=>x.value!==void 0),setContent:v?.setContent,getAst:v?.getAst,getMarkdown:v?.getMarkdown,getJson:v?.getJson,getHtml:v?.getHtml}),()=>{let e=x.value,t=e?[n.default?.({editor:e}),ue(mb,{editor:e,"data-comark-editor-content":``,...r})]:[n.fallback?.()];return ue(`div`,{"data-comark-editor":``},t)}}});function xZ(e){let t=Nj(e);if(!e.nodeView)return t;let n=e.nodeView,r=t.extension.extend({addNodeView(){return bb(n)}});return{...t,extension:r}}var SZ=[`disabled`,`aria-label`],CZ={class:`grid w-64 gap-3 p-3`},wZ={class:`text-xs font-medium text-highlighted`},TZ={class:`font-mono`},EZ={contenteditable:`false`,class:`flex min-h-8 select-none items-center gap-2 border-b border-default px-3 text-xs text-muted`},DZ={class:`font-mono text-highlighted`},OZ=[`disabled`,`aria-label`],kZ={class:`text-highlighted`},AZ={class:`grid w-64 gap-3 p-3`},jZ={class:`text-xs font-medium text-highlighted`},MZ={class:`font-mono`},NZ={key:1,class:`ms-auto hidden truncate sm:inline`},PZ=V({__name:`console-comark-component`,props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{},definition:{}},setup(e){let t=e,n=p(()=>Object.entries(t.definition.props).map(([e,n])=>({name:e,type:n.type,value:t.node.attrs[e]}))),r=p(()=>t.editor.isEditable);function a(e){return e==null||e===``?`—`:String(e)===e?e:JSON.stringify(e)}function o(e,n,r){let i=r;if(n===`number`&&(i=r==null||r===``?null:Number(r)),n===`json`)try{i=String(r).trim()?JSON.parse(String(r)):null}catch{return}t.updateAttributes({[e]:i})}return(t,c)=>{let l=ge,u=Vr,d=Sn,f=Yr;return e.definition.kind===`inline`?(J(),k(F(gb),{key:0,as:`span`,class:`vitehub-comark-inline rounded-sm bg-elevated px-1 py-px text-[0.9em] ring-1 ring-default ring-inset`,"data-component":e.definition.name},{default:i(()=>[H(F(hb),{as:`span`}),n.value.length?(J(),k(f,{key:0,content:{align:`start`}},{content:i(()=>[j(`div`,CZ,[j(`p`,wZ,q(e.definition.label),1),(J(!0),b(O,null,s(n.value,e=>(J(),b(`label`,{key:e.name,class:`grid gap-1 text-xs text-muted`},[j(`span`,TZ,q(e.name),1),e.type===`boolean`?(J(),k(u,{key:0,"model-value":e.value===!0,"onUpdate:modelValue":t=>o(e.name,e.type,t)},null,8,[`model-value`,`onUpdate:modelValue`])):(J(),k(d,{key:1,"model-value":e.type===`json`?e.value===null||e.value===void 0?``:JSON.stringify(e.value):String(e.value??``),type:e.type===`number`?`number`:`text`,ui:{base:e.type===`json`?`font-mono text-xs`:``},"onUpdate:modelValue":t=>o(e.name,e.type,t)},null,8,[`model-value`,`type`,`ui`,`onUpdate:modelValue`]))]))),128))])]),default:i(()=>[j(`button`,{type:`button`,contenteditable:`false`,class:`ms-1 inline-flex rounded-sm px-1 align-baseline font-mono text-[0.8em] text-muted hover:bg-elevated focus-visible:outline-2 disabled:pointer-events-none`,disabled:!r.value,"aria-label":`Edit ${e.definition.label} props`},[H(l,{name:`i-lucide-settings-2`,class:`size-3`,"aria-hidden":`true`})],8,SZ)]),_:1})):M(``,!0)]),_:1},8,[`data-component`])):(J(),k(F(gb),{key:1,class:`vitehub-comark-block my-3 rounded-lg ring-1 ring-default`,"data-component":e.definition.name},{default:i(()=>[j(`div`,EZ,[H(l,{name:`i-lucide-component`,class:`size-3.5 shrink-0`,"aria-hidden":`true`}),j(`span`,DZ,`::`+q(e.definition.name),1),n.value.length?(J(),k(f,{key:0,content:{align:`start`}},{content:i(()=>[j(`div`,AZ,[j(`p`,jZ,q(e.definition.label),1),(J(!0),b(O,null,s(n.value,e=>(J(),b(`label`,{key:e.name,class:`grid gap-1 text-xs text-muted`},[j(`span`,MZ,q(e.name),1),e.type===`boolean`?(J(),k(u,{key:0,"model-value":e.value===!0,"onUpdate:modelValue":t=>o(e.name,e.type,t)},null,8,[`model-value`,`onUpdate:modelValue`])):(J(),k(d,{key:1,"model-value":e.type===`json`?e.value===null||e.value===void 0?``:JSON.stringify(e.value):String(e.value??``),type:e.type===`number`?`number`:`text`,ui:{base:e.type===`json`?`font-mono text-xs`:``},"onUpdate:modelValue":t=>o(e.name,e.type,t)},null,8,[`model-value`,`type`,`ui`,`onUpdate:modelValue`]))]))),128))])]),default:i(()=>[j(`button`,{type:`button`,class:`flex min-w-0 items-center gap-2 rounded-sm px-1 font-mono hover:bg-elevated focus-visible:outline-2 disabled:pointer-events-none`,disabled:!r.value,"aria-label":`Edit ${e.definition.label} props`},[(J(!0),b(O,null,s(n.value,e=>(J(),b(`span`,{key:e.name,class:`truncate`},[K(q(e.name)+`=`,1),j(`span`,kZ,q(a(e.value)),1)]))),128))],8,OZ)]),_:1})):M(``,!0),e.definition.description?(J(),b(`span`,NZ,q(e.definition.description),1)):M(``,!0)]),H(F(hb),{class:`px-4 py-1`})]),_:1},8,[`data-component`]))}}}),FZ={key:0,class:`rounded-md bg-elevated/60 px-3 py-2 text-xs text-muted`},IZ={class:`flex w-full justify-end gap-2`},LZ=V({__name:`console-media-dialog`,setup(e,{expose:t}){let n=A(!1),r=A(),a=A(``),o=A(``),s=A(),c,l=p(()=>r.value?.files.map(e=>e.name)??[]);function d(e){c?.(e),c=void 0,n.value=!1}function f(){let e=a.value.trim();e&&d([o.value.trim()?{alt:o.value.trim(),src:e}:{src:e}])}function m(e){return c?.([]),r.value=e,a.value=``,o.value=e.files[0]?.name.replace(/\.[^.]+$/,``).replace(/[-_]+/g,` `)??``,n.value=!0,ae(()=>s.value?.inputRef?.focus()),new Promise(e=>c=e)}return t({pick:m}),(e,t)=>{let r=Sn,c=Br,p=dr,m=Lr;return J(),k(m,{open:n.value,title:`Insert image`,description:`Enter the Blob path or URL of the image. The Markdown stores it as written.`,ui:{content:`sm:max-w-[540px]`},"onUpdate:open":t[3]||=e=>{e||d([])}},{body:i(()=>[j(`form`,{id:`vitehub-media-dialog`,class:`grid gap-4`,onSubmit:u(f,[`prevent`])},[l.value.length?(J(),b(`p`,FZ,` The Console can't upload `+q(l.value.join(`, `))+` yet. Upload it to a Blob store, then enter its path. `,1)):M(``,!0),H(c,{label:`Blob path or URL`,required:``,ui:{label:`text-xs`}},{default:i(()=>[H(r,{ref_key:`srcInput`,ref:s,modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,class:`w-full`,ui:{base:`font-mono text-[13px]`},placeholder:`media/launch-cover.png`,autocomplete:`off`},null,8,[`modelValue`])]),_:1}),H(c,{label:`Alt text`,description:`Describes the image for people who can't see it.`,ui:{label:`text-xs`,description:`text-xs`}},{default:i(()=>[H(r,{modelValue:o.value,"onUpdate:modelValue":t[1]||=e=>o.value=e,class:`w-full`,placeholder:`The Console editor with the slash menu open`,autocomplete:`off`},null,8,[`modelValue`])]),_:1})],32)]),footer:i(()=>[j(`div`,IZ,[H(p,{variant:`ghost`,label:`Cancel`,onClick:t[2]||=e=>d([])}),H(p,{type:`submit`,form:`vitehub-media-dialog`,label:`Insert`,disabled:!a.value.trim()},null,8,[`disabled`])])]),_:1},8,[`open`])}}}),RZ=[`aria-label`],zZ={key:1,class:`mb-4 flex items-start gap-2 rounded-md bg-elevated/60 px-3 py-2 text-[13px] text-muted`,role:`status`},BZ={key:3,class:`vitehub-markdown-editor__content text-dimmed`},VZ=V({__name:`console-markdown-editor`,props:z({active:{type:Boolean},collection:{},components:{},disabled:{type:Boolean},documentId:{},label:{},live:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:z([`change`,`outline`],[`update:modelValue`]),setup(e,{expose:n,emit:a}){let o=e,s=a,c=_(e,`modelValue`),l=Ye(),d=A(),m=A(!!o.live&&!o.disabled),g=A(!o.live),v=c.value,y=c.value,x,S=0,C=0,T,N,I=0,L=0,R=o.live,ee=p(()=>TN(o.components)),z=new Map(ee.value.map(e=>[e.name,e])),te=aN(wN(o.components),e=>xZ({...e,nodeView:V({name:`ConsoleComark${e.name}`,props:vb,setup:t=>()=>ue(PZ,{...t,definition:z.get(e.name)})})})),B=Gb(),ne=A(),re=B??{pick:e=>ne.value?.pick(e)??Promise.resolve([])};function ie(e){return[...e??[]].filter(e=>e.type.startsWith(`image/`))}async function ae(e,t){let n=U.value;if(!n||!n.isEditable)return;let r;try{r=await re.pick({collection:o.collection,documentId:o.documentId,files:e,kind:`image`,multiple:!0})}catch{l.error(`Couldn't insert the image. Try again.`);return}if(!r.length||n.isDestroyed)return;let i=r.map(e=>({attrs:{alt:e.alt??null,src:e.src,title:e.title??null},type:`image`})),a=n.chain().focus();t===void 0?a.insertContent(i).run():a.insertContentAt(t,i).run()}let oe=By.create({name:`vitehubMediaDrop`,addProseMirrorPlugins(){return[new jl({props:{handleDrop:(e,t,n,r)=>{let i=ie(t.dataTransfer?.files);return r||!i.length?!1:(t.preventDefault(),ae(i,e.posAtCoords({left:t.clientX,top:t.clientY})?.pos),!0)},handlePaste:(e,t)=>{let n=ie(t.clipboardData?.files);return n.length?(ae(n),!0):!1}}})]}}),{editor:U,getMarkdown:W,setContent:se}=bZ({components:te,contentType:`markdown`,editorOptions:{editable:!!o.live&&!o.disabled,editorProps:{attributes:{"aria-label":o.label??`Body`,"aria-multiline":`true`,class:`vitehub-markdown-editor__content`,role:`textbox`}}},extensions:[$A.configure({includeChildren:!1,placeholder:({node:e})=>e.type.name===`heading`?`Heading ${e.attrs.level}`:`Type / for commands`,showOnlyCurrent:!0}),oe,...R?[h(tX.configure({fragment:h(R.document.getXmlFragment(`body`))})),h(vZ.configure({provider:R.provider,user:R.user}))]:[]],kitOptions:{resolveSrc:e=>B?.resolveSrc?.(e),starterKit:{...R?oN.starterKit:{},dropcursor:{class:`vitehub-drop-cursor`,color:`var(--ui-primary)`,width:2},link:{openOnClick:!1}}},onError:(e,t)=>{},onUpdate:()=>{!S&&!R&&de(),S||s(`change`),ve()}});function ce(){return N||=le().finally(()=>{N=void 0,T&&ce()}),N}async function le(){let e=I;if(T&&clearTimeout(T),T=void 0,g.value||d.value)return;let t=await W();if(e!==I||o.active===!1||t===null)return;let n=t===x?y:t;v=n,c.value=n}function de(){T&&clearTimeout(T),T=setTimeout(()=>void ce(),120)}async function fe(){if(!(R||!T&&!N)){L++,me();try{do await ce();while(T||N)}finally{L--,me()}}}async function K(e){let t=U.value;if(!t)return;let n=++C;S=n,g.value=!0,d.value=void 0,I++,T&&clearTimeout(T),T=void 0,me();try{let r=await Cr(e,{autoClose:!1,headingIds:!1});if(n!==S||t.isDestroyed)return;await se(r,{contentType:`ast`,emitUpdate:!1,transactionMeta:{addToHistory:!1}});let i=await W();if(n!==S||t.isDestroyed)return;let a=await pe(e,i??void 0);if(n!==S||t.isDestroyed)return;y=e,v=e,x=i??void 0,d.value=a,_e()}catch(e){n===S&&(d.value=e instanceof Error?e.message:`The rich editor cannot show this Markdown.`)}finally{n===S&&(S=0,g.value=!1,me())}}async function pe(e,t){if(t!==void 0&&t!==e)try{let n=await bN(e,t,{components:wN(o.components)});return n?xN(n):void 0}catch{return}}f(U,e=>{if(e){if(!R){K(c.value);return}me(),ve()}},{once:!0}),f(c,e=>{R||e===v||(v=e,o.active!==!1&&K(e))}),f(()=>o.active,e=>{if(e===!1){I++,T&&clearTimeout(T),T=void 0;return}R||c.value!==y&&K(c.value)});function me(){m.value=!L&&!o.disabled&&!d.value&&!g.value,U.value?.setEditable(m.value,!1)}f(()=>o.disabled,me);let he;function _e(){let e=U.value;if(!e)return;let t=[];e.state.doc.descendants((e,n)=>(e.type.name===`heading`&&e.textContent.trim()&&t.push({id:jN(e.textContent),level:Number(e.attrs.level)||1,pos:n,text:e.textContent}),e.type.name!==`heading`&&e.type.name!==`paragraph`)),s(`outline`,t)}function ve(){clearTimeout(he),he=setTimeout(_e,250)}function ye(e){let t=U.value;if(!t)return;let n=t.view.nodeDOM(e);n instanceof HTMLElement&&n.scrollIntoView({behavior:`instant`,block:`start`}),t.chain().focus().setTextSelection(e+1).run()}function be(e=`start`){U.value?.chain().focus(e).run()}P(()=>{S=0,I++,T&&clearTimeout(T),clearTimeout(he)});async function xe(){return g.value||d.value?null:await W()}n({commit:fe,focus:be,markdown:xe,scrollTo:ye});function Se(e,t){let{$from:n}=e.state.selection;return n.depth>0&&n.parent.type.name===`paragraph`&&n.parent.content.size===0?e.chain().focus().insertContentAt({from:n.before(),to:n.after()},t):e.chain().focus().insertContent(t)}let Ce={component:{canExecute:()=>!0,execute:(e,t)=>{let n=t?.component?z.get(t.component):void 0;if(!n)return e.chain();let r=EN(n);return n.kind===`inline`?e.chain().focus().insertContent({attrs:r,content:[{text:n.label,type:`text`}],type:n.name}):Se(e,{attrs:r,content:[{type:`paragraph`}],type:n.name})},isActive:()=>!1},image:{canExecute:()=>!0,execute:e=>(ae([]),e.chain()),isActive:e=>e.isActive(`image`)},table:{canExecute:e=>e.can().insertTable({cols:3,rows:3,withHeaderRow:!0}),execute:e=>e.chain().focus().insertTable({cols:3,rows:3,withHeaderRow:!0}),isActive:e=>e.isActive(`table`)}},we=p(()=>({...zb(),...Ce}));w(`editorHandlers`,we);let Te=p(()=>DN(ee.value)),Ee=ON.map(e=>({...e})),De=p(()=>[[{activeColor:`neutral`,activeVariant:`ghost`,content:{align:`start`},items:[{label:`Turn into`,type:`label`},...Ee],label:`Text`,portal:!1,tooltip:{text:`Turn into`},trailingIcon:`i-lucide-chevron-down`,ui:{content:`bg-default backdrop-blur-none`,label:`text-xs`}}],[{"aria-label":`Bold`,icon:`i-lucide-bold`,kind:`mark`,mark:`bold`,tooltip:{kbds:[`meta`,`b`],text:`Bold`}},{"aria-label":`Italic`,icon:`i-lucide-italic`,kind:`mark`,mark:`italic`,tooltip:{kbds:[`meta`,`i`],text:`Italic`}},{"aria-label":`Strikethrough`,icon:`i-lucide-strikethrough`,kind:`mark`,mark:`strike`,tooltip:{kbds:[`meta`,`shift`,`s`],text:`Strikethrough`}},{"aria-label":`Inline code`,icon:`i-lucide-code`,kind:`mark`,mark:`code`,tooltip:{kbds:[`meta`,`e`],text:`Inline code`}}],[{"aria-label":`Link`,icon:`i-lucide-link`,slot:`link`,tooltip:{text:`Link`}}]]);function Oe({editor:e,state:t,view:n}){let r=document.activeElement instanceof Element&&!!document.activeElement.closest(`.vitehub-bubble`);return!n.hasFocus()&&!r||t.selection.empty||!e.isEditable||e.isActive(`image`)||e.isActive(`codeBlock`)?!1:!(`node`in t.selection)}let ke=A(!1),Ae=A(``);function je(e){ke.value=e,e&&(Ae.value=String(U.value?.getAttributes(`link`).href??``))}function Me(){let e=U.value;if(!e)return;let t=Ae.value.trim(),n=e.chain().focus().extendMarkRange(`link`);t?n.setLink({href:t}).run():n.unsetLink().run(),ke.value=!1}let Ne=t();function Pe(e){let t=Ne.value,n=t?.node?.type;if(!t||!n)return[];let r=t.pos;return Bb(e,[[...kN.has(n)?[{children:Ee,icon:`i-lucide-repeat-2`,label:`Turn into`}]:[],{icon:`i-lucide-copy-plus`,kind:`duplicate`,label:`Duplicate`,pos:r},{icon:`i-lucide-link`,label:`Copy link`,onSelect:()=>void Fe(e,r)}],[{icon:`i-lucide-arrow-up`,kind:`moveUp`,label:`Move up`,pos:r},{icon:`i-lucide-arrow-down`,kind:`moveDown`,label:`Move down`,pos:r}],[{color:`error`,icon:`i-lucide-trash-2`,kind:`delete`,label:`Delete`,pos:r}]],Ce)}async function Fe(e,t){let n=``;e.state.doc.forEach((e,r)=>{r<=t&&e.type.name===`heading`&&e.textContent.trim()&&(n=jN(e.textContent))});let r=new URL(window.location.href);r.hash=n;try{await navigator.clipboard.writeText(r.toString()),l.show({title:n?`Link to section copied`:`Link copied`})}catch{l.error(`Couldn't copy the link.`)}}function Ie(e,t){if(!e)return;let n=t();we.value.suggestion.execute(e,{pos:n?.pos}).run()}function Le(e,t){e.chain().setMeta(`lockDragHandle`,t).run()}return f(U,e=>{if(!e||!window.location.hash)return;let t=decodeURIComponent(window.location.hash.slice(1));setTimeout(()=>{e.state.doc.forEach((e,n)=>{e.type.name===`heading`&&jN(e.textContent)===t&&ye(n)})},300)},{once:!0}),(t,n)=>{let a=ge,o=dr,s=Sn,c=Yr,l=pZ,f=iZ,p=Bt,h=tZ;return J(),b(`section`,{class:`vitehub-markdown-editor relative`,"aria-label":e.label??`Body`},[g.value?(J(),k(Wr,{key:0,label:`Loading editor…`})):M(``,!0),d.value?(J(),b(`p`,zZ,[H(a,{name:`i-lucide-lock`,class:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),j(`span`,null,`Read-only here. `+q(d.value)+` Switch to Source to read or edit the Markdown.`,1)])):M(``,!0),F(U)?(J(),b(O,{key:2},[D(H(F(mb),{editor:F(U),"aria-busy":g.value},null,8,[`editor`,`aria-busy`]),[[r,!g.value]]),H(l,{editor:F(U),layout:`bubble`,items:De.value,"should-show":Oe,"active-color":`neutral`,"active-variant":`soft`,ui:{root:`vitehub-bubble`,base:`gap-0.5`},onKeydown:n[2]||=E(e=>F(U).commands.focus(),[`escape`])},{link:i(()=>[H(c,{open:ke.value,portal:!1,content:{align:`start`,side:`bottom`,sideOffset:8},"onUpdate:open":je},{content:i(()=>[j(`form`,{class:`flex w-72 items-center gap-1 p-1`,onSubmit:u(Me,[`prevent`])},[H(s,{modelValue:Ae.value,"onUpdate:modelValue":n[0]||=e=>Ae.value=e,autofocus:``,class:`flex-1`,variant:`none`,placeholder:`https://vitehub.dev`,"aria-label":`Link URL`,ui:{base:`text-[13px]`}},null,8,[`modelValue`]),H(o,{type:`submit`,size:`xs`,variant:`ghost`,icon:`i-lucide-corner-down-left`,"aria-label":`Apply link`}),F(U).isActive(`link`)?(J(),k(o,{key:0,size:`xs`,variant:`ghost`,icon:`i-lucide-link-2-off`,"aria-label":`Remove link`,onClick:n[1]||=e=>{Ae.value=``,Me()}})):M(``,!0)],32)]),default:i(()=>[H(o,{icon:`i-lucide-link`,variant:`ghost`,size:`sm`,"aria-label":`Link`,active:F(U).isActive(`link`),"active-variant":`soft`},null,8,[`active`])]),_:1},8,[`open`])]),_:1},8,[`editor`,`items`]),H(f,{editor:F(U),items:Te.value,"filter-fields":[`label`,`keywords`],limit:24},null,8,[`editor`,`items`]),m.value?(J(),k(h,{key:0,editor:F(U),onNodeChange:n[4]||=e=>Ne.value=e},{default:i(({ui:e,onClick:t})=>[H(o,{icon:`i-lucide-plus`,variant:`ghost`,size:`xs`,"aria-label":`Insert block below`,class:G(e.handle()),onClick:u(e=>Ie(F(U),t),[`stop`])},null,8,[`class`,`onClick`]),H(p,{modal:!1,items:Pe(F(U)),content:{side:`left`,align:`start`},ui:{content:`w-52`},"onUpdate:open":n[3]||=e=>Le(F(U),e)},{default:i(({open:n})=>[H(o,{icon:`i-lucide-grip-vertical`,variant:`ghost`,size:`xs`,"active-variant":`soft`,"aria-label":`Block actions. Drag to move.`,active:n,class:G(e.handle()),onClick:t},null,8,[`active`,`class`,`onClick`])]),_:2},1032,[`items`])]),_:1},8,[`editor`])):M(``,!0)],64)):(J(),b(`div`,BZ,`Loading editor…`)),F(B)?M(``,!0):(J(),k(LZ,{key:4,ref_key:`dialog`,ref:ne},null,512))],8,RZ)}}}),HZ=[`aria-label`],UZ=[`aria-expanded`,`aria-controls`],WZ={class:`truncate text-dimmed`},GZ={key:0,class:`size-1.5 shrink-0 rounded-full bg-error`,"aria-hidden":`true`},KZ=[`id`],qZ=[`id`],JZ={class:`sr-only`},YZ=[`id`],XZ={class:`sr-only`},ZZ={class:`flex h-8 items-center px-2.5`},QZ={class:`mt-4 grid items-start gap-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,16rem)]`},$Z={class:`grid content-start gap-1.5`},eQ={class:`truncate text-xs text-dimmed`},tQ={class:`line-clamp-1 text-sm font-medium text-highlighted`},nQ={class:`line-clamp-2 text-xs text-muted`},rQ={key:0,class:`text-xs text-muted`},iQ={class:`grid content-start gap-1.5`},aQ={class:`overflow-hidden rounded-md border border-default`},oQ={class:`relative aspect-[1.91/1] bg-elevated`},sQ=[`src`],cQ={key:1,class:`absolute inset-0 flex flex-col items-center justify-center gap-1 text-dimmed`},lQ={class:`text-xs`},uQ={class:`grid gap-0.5 border-t border-default p-3`},dQ={class:`truncate text-xs text-dimmed`},fQ={class:`line-clamp-1 text-sm font-medium text-highlighted`},pQ={key:0,class:`line-clamp-2 text-xs text-muted`},mQ=`bg-transparent hover:bg-transparent focus:bg-transparent disabled:bg-transparent ring-0 hover:ring-1 hover:ring-inset hover:ring-(--ui-border) focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-(--ui-border-accented) aria-invalid:ring-1 aria-invalid:ring-error/60 text-base md:text-sm`,hQ=V({__name:`console-seo-panel`,props:z({disabled:{type:Boolean},errors:{},fallbacks:{},hint:{},name:{},schema:{}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=_(e,`modelValue`);function a(e){return e instanceof Object&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}function o(e){return String(e)===e?e:``}let s=p(()=>a(n.value)),c=p(()=>Object.keys(t.errors).some(e=>e===t.name||e.startsWith(`${t.name}.`))),l=A(Object.keys(s.value).length>0||c.value);f(c,e=>{e&&(l.value=!0)});function u(e,t){let r={...s.value};t===void 0||t===``||t===!1?delete r[e]:r[e]=t,n.value=Object.keys(r).length?r:void 0}let d=e=>`field-${t.name}-${e}`,m=p(()=>hS(t.schema).find(e=>e.name===`image`)),h=p(()=>globalThis.location?.host||`example.com`),g=p(()=>o(s.value.title).trim()||t.fallbacks.title||``),v=p(()=>o(s.value.description).trim()||t.fallbacks.description||``),y=p(()=>o(s.value.canonical)||t.fallbacks.url||`/`),x=p(()=>{let e=/^https?:\/\//i.test(y.value)?new URL(y.value):void 0,t=(e?e.pathname:y.value).split(`/`).filter(Boolean);return[e?.host??h.value,...t].join(` › `)}),S=Gb(),C=p(()=>{let e=s.value.image??t.fallbacks.image,n=a(e).pathname;return(String(n)===n?S?.resolveSrc?.(n):void 0)??Cn(e)}),w=A(!1);f(C,()=>{w.value=!1});let T=p(()=>s.value.noindex===!0),E=p(()=>{if(T.value)return`Hidden from search engines`;let e=[`title`,`description`,`image`,`canonical`].filter(e=>s.value[e]!==void 0&&s.value[e]!==``);return e.length?`${e.length} of 4 set`:`From the document`});function O(e){let n=Object.entries(t.errors).filter(([n])=>n===`${t.name}.${e}`||n.startsWith(`${t.name}.${e}.`)).flatMap(([,e])=>e);return n.length?n.join(` `):void 0}let N=p(()=>o(s.value.title).length),I=p(()=>o(s.value.description).length),L=p(()=>N.value>t.hint.title.recommended),R=p(()=>I.value>t.hint.description.recommended||I.value>0&&I.value<t.hint.description.min),ee=A(),z=A(0),te=A(14),B=typeof ResizeObserver>`u`?void 0:new ResizeObserver(([e])=>{z.value=e?.contentRect.width??0;let t=ee.value?.querySelector(`textarea`);t&&(te.value=Number.parseFloat(getComputedStyle(t).fontSize)||14)});f(ee,(e,t)=>{t&&B?.unobserve(t),e&&B?.observe(e)}),P(()=>B?.disconnect());let V=p(()=>{let e=t.fallbacks.description||`Search engines pick text from the page`;if(o(s.value.description)||!e||!z.value)return 1;let n=Math.max(12,Math.floor((z.value-84)/(te.value*.54)));return Math.min(6,Math.ceil(e.length/n))});return(t,n)=>{let a=ge,f=Sn,p=ji,_=Vr;return J(),b(`section`,{class:`mt-1 grid gap-px`,"aria-label":`${e.name} settings`},[j(`button`,{type:`button`,class:`flex h-8 w-fit max-w-full items-center gap-2 rounded-md px-1.5 text-[13px] text-muted hover:text-highlighted focus-visible:outline-2`,"aria-expanded":l.value,"aria-controls":`${d(`group`)}`,onClick:n[0]||=e=>l.value=!l.value},[H(a,{name:l.value?`i-lucide-chevron-down`:`i-lucide-chevron-right`,class:`size-4 shrink-0 opacity-70`,"aria-hidden":`true`},null,8,[`name`]),n[8]||=j(`span`,{class:`font-medium text-highlighted`},`SEO`,-1),j(`span`,WZ,q(E.value),1),c.value&&!l.value?(J(),b(`span`,GZ)):M(``,!0)],8,UZ),D(j(`div`,{id:d(`group`),class:`grid gap-px`},[H(eJ,{icon:`i-lucide-heading`,label:`Title`,control:d(`title`),error:O(`title`)},{default:i(()=>[H(f,{id:d(`title`),"model-value":o(s.value.title),class:`w-full`,variant:`ghost`,ui:{base:mQ,trailing:`pe-2.5`},disabled:e.disabled,placeholder:e.fallbacks.title,"aria-invalid":O(`title`)?`true`:void 0,"aria-describedby":`${d(`title`)}-count`,"onUpdate:modelValue":n[1]||=e=>u(`title`,String(e??``))},{trailing:i(()=>[j(`span`,{id:`${d(`title`)}-count`,class:G([`text-xs tabular-nums`,L.value?`text-warning`:`text-dimmed`])},[K(q(N.value)+`/`+q(e.hint.title.recommended),1),j(`span`,JZ,` characters`+q(L.value?`, longer than search results show`:``),1)],10,qZ)]),_:1},8,[`id`,`model-value`,`ui`,`disabled`,`placeholder`,`aria-invalid`,`aria-describedby`])]),_:1},8,[`control`,`error`]),H(eJ,{icon:`i-lucide-align-left`,label:`Description`,control:d(`description`),error:O(`description`)},{default:i(()=>[j(`div`,{ref_key:`descriptionBox`,ref:ee,class:`relative`},[H(p,{id:d(`description`),"model-value":o(s.value.description),class:`w-full`,variant:`ghost`,autoresize:``,rows:V.value,ui:{base:`${mQ} pe-16`},disabled:e.disabled,placeholder:e.fallbacks.description||`Search engines pick text from the page`,"aria-invalid":O(`description`)?`true`:void 0,"aria-describedby":`${d(`description`)}-count`,"onUpdate:modelValue":n[2]||=e=>u(`description`,String(e??``))},null,8,[`id`,`model-value`,`rows`,`ui`,`disabled`,`placeholder`,`aria-invalid`,`aria-describedby`]),j(`span`,{id:`${d(`description`)}-count`,class:G([`pointer-events-none absolute top-2 right-2.5 text-xs tabular-nums`,R.value?`text-warning`:`text-dimmed`])},[K(q(I.value)+`/`+q(e.hint.description.recommended),1),j(`span`,XZ,` characters`+q(R.value?`, recommended ${e.hint.description.min} to ${e.hint.description.recommended}`:``),1)],10,YZ)],512)]),_:1},8,[`control`,`error`]),m.value&&m.value.kind!==`string`?(J(),k(jJ,{key:0,disabled:e.disabled,errors:e.errors,field:{...m.value,label:`Social image`},"model-value":s.value.image,parent:e.name,"onUpdate:modelValue":n[3]||=e=>u(`image`,e)},null,8,[`disabled`,`errors`,`field`,`model-value`,`parent`])):(J(),k(eJ,{key:1,icon:`i-lucide-image`,label:`Social image`,control:d(`image`),error:O(`image`)},{default:i(()=>[H(f,{id:d(`image`),"model-value":o(s.value.image),class:`w-full`,variant:`ghost`,ui:{base:mQ},disabled:e.disabled,placeholder:`/og/page.png`,"onUpdate:modelValue":n[4]||=e=>u(`image`,String(e??``))},null,8,[`id`,`model-value`,`ui`,`disabled`])]),_:1},8,[`control`,`error`])),H(eJ,{icon:`i-lucide-link`,label:`Canonical URL`,control:d(`canonical`),error:O(`canonical`)},{default:i(()=>[H(f,{id:d(`canonical`),"model-value":o(s.value.canonical),class:`w-full`,variant:`ghost`,ui:{base:`${mQ} font-mono text-xs md:text-xs`},disabled:e.disabled,placeholder:e.fallbacks.url??`The document URL`,"onUpdate:modelValue":n[5]||=e=>u(`canonical`,String(e??``))},null,8,[`id`,`model-value`,`ui`,`disabled`,`placeholder`])]),_:1},8,[`control`,`error`]),H(eJ,{icon:`i-lucide-eye-off`,label:`Hide from search`,control:d(`noindex`),error:O(`noindex`)},{default:i(()=>[j(`span`,ZZ,[H(_,{id:d(`noindex`),size:`sm`,"model-value":T.value,disabled:e.disabled,"onUpdate:modelValue":n[6]||=e=>u(`noindex`,e===!0)},null,8,[`id`,`model-value`,`disabled`])])]),_:1},8,[`control`,`error`]),j(`div`,QZ,[j(`figure`,$Z,[n[9]||=j(`figcaption`,{class:`text-xs text-muted`},`Search result`,-1),j(`div`,{class:G([`grid gap-0.5 rounded-md border border-default p-3`,T.value?`opacity-50`:void 0])},[j(`p`,eQ,q(x.value),1),j(`p`,tQ,q(g.value?F(Xt)(g.value,e.hint.title.recommended):`Untitled`),1),j(`p`,nQ,q(v.value?F(Xt)(v.value,e.hint.description.recommended):`No description. Search engines pick text from the page.`),1)],2),T.value?(J(),b(`p`,rQ,`Hidden from search results and the sitemap.`)):M(``,!0)]),j(`figure`,iQ,[n[10]||=j(`figcaption`,{class:`text-xs text-muted`},`Social card`,-1),j(`div`,aQ,[j(`div`,oQ,[C.value&&!w.value?(J(),b(`img`,{key:0,src:C.value,alt:``,class:`absolute inset-0 size-full object-cover`,onError:n[7]||=e=>w.value=!0},null,40,sQ)):(J(),b(`div`,cQ,[H(a,{name:`i-lucide-image`,class:`size-5`,"aria-hidden":`true`}),j(`span`,lQ,q(C.value?`Image not served`:`No image`),1)]))]),j(`div`,uQ,[j(`p`,dQ,q(h.value),1),j(`p`,fQ,q(g.value||`Untitled`),1),v.value?(J(),b(`p`,pQ,q(v.value),1)):M(``,!0)])])])])],8,KZ),[[r,l.value]])],8,HZ)}}}),gQ={class:`flex min-w-0 flex-1 flex-col`},_Q={class:`me-1 hidden lg:inline-flex`},vQ={class:`me-1 hidden lg:inline-flex`},yQ={class:`me-1 inline-flex`,role:`status`,"aria-live":`polite`},bQ={class:`hidden sm:inline`},xQ=[`aria-checked`,`tabindex`,`onClick`],SQ={class:`sr-only`,role:`status`},CQ={class:`flex min-h-0 flex-1`},wQ=[`aria-busy`],TQ={key:4,class:`mx-auto w-full max-w-[52rem] px-6 pt-10 pb-8 sm:px-16 sm:pt-14`},EQ={key:0,class:`mb-6 grid gap-1.5 rounded-md bg-warning/5 px-3 py-2 text-[13px] ring-1 ring-warning/30 ring-inset`,role:`status`,"aria-live":`polite`},DQ={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},OQ={key:0,class:`ps-7 text-default`},kQ={key:1,class:`ps-7 text-muted`},AQ={key:2,class:`ps-7 text-muted`},jQ={key:3,class:`ps-7 text-error`},MQ={key:1,class:`mb-6 grid gap-1.5 rounded-md px-3 py-2 text-[13px] ring-1 ring-default ring-inset`,role:`status`,"aria-live":`polite`},NQ={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},PQ={class:`min-w-0 flex-1 text-default`},FQ={key:0,class:`flex items-center gap-3 ps-7 text-muted`},IQ={class:`flex-1`},LQ={key:2,class:`mb-6 flex items-center gap-2 text-[13px] text-muted`},RQ={key:0,class:`mb-4 text-[32px]/[40px] font-semibold tracking-[-0.04rem] text-highlighted`},zQ={key:1,class:`mb-4`},BQ=[`for`],VQ=[`id`,`value`,`placeholder`,`disabled`,`aria-invalid`,`aria-describedby`],HQ=[`aria-label`],UQ=[`id`],WQ={id:`field-id-hint`,class:`text-xs text-dimmed`},GQ=[`title`],KQ={class:`truncate`},qQ={key:3,class:`my-6 border-default`},JQ={key:4,class:`mb-4 grid gap-3`,"aria-label":`Stored file`},YQ={class:`flex items-center gap-2 text-xs text-muted`},XQ={class:`font-mono text-highlighted`},ZQ={class:`ms-auto`},QQ={key:0,class:`overflow-x-auto rounded-md bg-elevated/50 px-4 py-3 font-mono text-[13px]/6 text-muted select-text`,"aria-label":`Frontmatter, read-only`},$Q={key:6,class:`flex min-h-[40vh] items-start gap-2 text-[13px] text-muted`,role:`status`},e$={key:8,class:`min-h-80 overflow-x-auto font-mono text-[13px] leading-6 whitespace-pre-wrap text-muted select-text`,"aria-label":`Markdown body as last saved, read-only`},t$={key:0,class:`hidden w-72 shrink-0 flex-col border-s border-default lg:flex`,"aria-label":`Side panel`},n$={class:`flex h-11 shrink-0 items-center gap-1 border-b border-default px-2`},r$={class:`min-h-0 flex-1 overflow-y-auto p-2`},i$={key:0,"aria-label":`Outline`},a$={key:0,class:`px-2 py-1.5 text-xs text-muted`},o$={key:1,class:`grid`},s$=[`onClick`],c$=[`aria-valuenow`,`aria-valuetext`],l$={key:1,class:`absolute inset-0 z-30 cursor-col-resize`},u$={key:0,class:`grid gap-3`},d$={class:`text-xs text-muted`},f$={class:`flex w-full flex-wrap justify-end gap-2`},p$={class:`flex w-full flex-wrap justify-end gap-2`},m$={key:0,class:`text-sm text-error`,role:`alert`},h$={key:1,class:`grid gap-3`},g$={class:`flex w-full flex-wrap justify-end gap-2`},_$={key:1,class:`grid gap-3`},v$={class:`flex w-full justify-end gap-2`},y$={key:1,class:`grid justify-items-start gap-3`},b$={role:`alert`,class:`text-sm text-muted`},x$={key:2,class:`grid gap-3`},S$={class:`text-xs text-muted`},C$={class:`flex w-full flex-wrap justify-end gap-2`},w$={key:0,class:`text-[13px] text-muted tabular-nums`},T$={key:1,class:`mt-1 text-xs text-dimmed`},E$={class:`flex w-full justify-end gap-2`},D$={class:`flex w-full justify-end gap-2`},O$={class:`flex flex-wrap items-end gap-3`},k$={class:`pb-2 text-xs text-dimmed`},A$={key:0,class:`mt-2 text-xs text-error`},j$={class:`flex w-full justify-end gap-2`},M$={class:`flex w-full justify-end gap-2`},N$={key:0,class:`grid gap-3`},P$={class:`flex items-center gap-2`},F$={class:`text-sm font-medium text-highlighted`},I$={key:0,class:`flex justify-center py-8`},L$={key:1,class:`text-xs text-muted`},R$=1e3,z$=`vitehub:console:preview-width`,B$=V({__name:`console-document-editor`,props:{changes:{},client:{},collection:{},documentId:{},parent:{},setup:{}},emits:[`changed`],setup(n,{emit:a}){let o=n,c=a,l=cr(),u=Jn(),d=Ye(),m=p(()=>o.documentId===void 0),g=p(()=>o.collection.kind===`singleton`),_=p(()=>Jt(o.collection)),v=p(()=>hS(o.collection.schema)),y=p(()=>Me(o.collection)),x=p(()=>g.value?void 0:v.value.find(e=>e.name===o.collection.titleField&&e.kind===`string`)),S=p(()=>$t(o.collection.schema)),C=A(!m.value),T=A(),E=A(null),N=A(),I=A(),L=A(!1),R=t(),ee=t(new Ve(9,0)),z=A(!1),te=Intl.DateTimeFormat().resolvedOptions().timeZone,B=A({body:``,data:m.value||g.value?bS(o.collection.schema):{}}),V=A(``),ne=A(!1),ie=A(!1),oe=A(!1),U=A(),W=A(),se=A({}),ce=A(),le=A(!1),ue=A(!1),de=A(!1),fe=A(!1),pe=A([]),me=A(),_e=A(!1),ve=A(),ye=A(Date.now()),be=A(),xe=A(!1),Se=A(!1),Ce=A(),we=A(!1),Te=A(!1),Ee=A(),De=A(),Oe=A(!1),ke=A(),Ae=A(),je=A(`rich`),Pe=A(),Fe=A([]),Le=!0,Re=0,ze,He=!1,We=p(()=>o.collection.access.write),Ge=p(()=>o.collection.access.publish),Ke=A(`shared`),qe=p(()=>Ke.value===`local`),Je=A(null),Xe=A(),Qe=A(!1),$e=A(!1),et=A(!1),tt=A(),nt=A(!1),rt=A(!1),it=A(),at=A(!1);if(!m.value&&o.documentId!==void 0&&We.value){let e=KK(window.sessionStorage,o.collection.name,o.documentId);e&&(Ke.value=`local`,Je.value=e.base,Xe.value=e.start,B.value=Rn(e.version))}let ot=ki({client:o.client,collection:o.collection.name,documentId:()=>m.value?void 0:o.documentId,canWrite:()=>We.value&&!qe.value,live:()=>!!bt.value,onDigest:rr}),ct=ot.mode,{dialogOpen:ut,holder:dt,others:ft,presence:mt,unreachable:gt}=ot,_t=Oi(o.setup),yt=A(),bt=p(()=>{if(!(!_t||!_.value||m.value||yt.value||qe.value||o.documentId===void 0))return g.value?o.collection.name:`${o.collection.name}/${o.documentId}`}),xt=_t?FK({definition:_t,room:()=>bt.value,components:()=>o.collection.components,user:()=>mt.value?.user,onReset:Nt}):void 0,St=p(()=>!!(xt?.ready.value&&bt.value)),Ct=p(()=>St.value?xt?.others.value??[]:[]),wt=p(()=>xt?.status.value??`connecting`),Tt=p(()=>{let e=xt?.document.value,t=xt?.provider.value,n=xt?.identity.value;return St.value&&e&&t&&n?h({document:e,provider:t,user:n}):void 0}),Dt=A(0),Ot=p(()=>{if(!_.value||m.value)return;let e=o.setup?.live;if(e&&`unavailable`in e)return e.unavailable;if(yt.value===`unreachable`)return`The live session did not answer. Saves still refuse to overwrite a newer version.`}),At=A(),Mt=0;if(xt){f(xt.readOnlyReason,e=>{e===`document`&&(yt.value=`document`)});let e;f(bt,t=>{clearTimeout(e),t&&(e=setTimeout(()=>{!xt.ready.value&&bt.value===t&&(yt.value=`unreachable`)},8e3))},{immediate:!0}),P(()=>clearTimeout(e)),f(xt.document,()=>Dt.value++),f(()=>xt.fields.value,e=>{e&&St.value&&pt(Ln(e))!==pt(Ln(B.value.data))&&(B.value={...B.value,data:Rn(e)})}),f(()=>xt.saveStatus.value?.savedAt,(e,t)=>{e&&e!==t&&St.value&&(U.value=e,Xn(),Fn(),(pe.value.length||fe.value||qi.value===`history`)&&qr())}),f(()=>xt.issues.value,e=>{if(!St.value||!xt.saveStatus.value?.savedAt)return;let t=e.filter(e=>e.field!==void 0&&e.field!==`body`).map(e=>({field:e.field,message:e.message,path:e.path??[]}));se.value=cS(wS(v.value,t)),er=Object.fromEntries(Object.entries(B.value.data).map(([e,t])=>[e,pt(t??null)]))})}function Nt(e){if(Date.now()<Mt||e.reason!==`source-changed`)return;let t=g.value?`page`:y.value.toLowerCase();if(!e.unsaved){d.show({title:`This ${t} was updated`});return}At.value=e.unsaved,d.show({action:{label:`Copy your unsaved edits`,onClick:()=>void It()},title:`This ${t} changed while you typed`})}async function It(){let e=At.value;if(e)try{await navigator.clipboard.writeText(e.body),d.show({title:`Your edits copied`})}catch{d.error(`Couldn't copy. Select the text and copy it.`)}}function Lt(e){let t=(e instanceof Element?e.closest(`[data-vitehub-field]`):null)?.getAttribute(`data-vitehub-field`)??(e instanceof Element?e.id:``);return v.value.map(e=>e.name).find(e=>{let n=`field-${e.replace(/[^a-zA-Z0-9_-]/g,`-`)}`;return t===n||t.startsWith(`${n}-`)})}function Rt(e){let t=Lt(e.target);_i.value=t,St.value&&xt?.focus(t)}function zt(e){Lt(e.relatedTarget)||(_i.value=void 0,St.value&&xt?.focus(void 0))}let Vt=p(()=>{let e={};for(let t of Ct.value)t.focus&&(e[`field-${t.focus.replace(/[^a-zA-Z0-9_-]/g,`-`)}`]??=[]).push(t);return e});w(`vitehubFieldPeople`,Vt);let Ht=p(()=>!m.value&&(gt.value||mt.value?.available===!1)),Ut=p(()=>{if(!We.value||m.value||qe.value)return;let e=Wt.value;if(ct.value===`blocked`)return Gt.value?{icon:`i-lucide-users`,text:`Read-only · ${e}`}:{icon:`i-lucide-lock`,text:e===`You`?`Read-only · You're editing this in another tab`:`Read-only · ${e} is editing`};if(ct.value===`taken`){let t=Ai(U.value??E.value?.updatedAt),n=e===`You`?`Your other tab took over`:`${e} took over`;return{icon:`i-lucide-user-round-pen`,text:t?`${n} · Your changes up to ${t} are saved`:n}}if(ct.value===`left`)return{icon:`i-lucide-lock-open`,text:e===`You`?`Your other tab stopped editing`:`${e} stopped editing`}}),Wt=p(()=>{let e=ot.holder.value;return e?.kind===`live`?Ti(e):ot.ownOtherTab.value?`You`:e?.user.name??`Someone`}),Gt=p(()=>ot.holder.value?.kind===`live`),qt=p(()=>{let e=mt.value?.holder;if(!qe.value||!e||e.self||e.kind===`live`||ct.value===`editing`)return;let t=e.user.id===mt.value?.user?.id?`You`:e.user.name;return t===`You`?`Your other tab is editing the shared draft.`:`${t} is editing the shared draft.`}),Yt=A(0),Xt=p(()=>We.value&&(qe.value||m.value||ct.value===`free`||ct.value===`editing`)),Zt=A(!1),Qt=A(),en=p(()=>hn(o.collection)),nn=A(0),an=p(()=>en.value[nn.value]?.prefix??``),on=p(()=>m.value?V.value.trim()?`${an.value}${V.value.trim()}`:``:o.documentId),sn=p(()=>E.value?{body:E.value.body,data:E.value.data}:{body:``,data:bS(o.collection.schema)}),cn=p(()=>St.value||qe.value?!1:m.value?!!V.value.trim()||pt(Ln(B.value.data))!==pt(Ln(sn.value.data))||!!B.value.body.trim():E.value?B.value.body.trimEnd()!==E.value.body.trimEnd()||mn.value:g.value&&N.value!==`deleted`&&pt(Ln(B.value.data))!==pt(Ln(sn.value.data))),dn=p(()=>qe.value&&!C.value&&!E.value&&!T.value),fn=p(()=>{let e=Xe.value;return!qe.value||!e?!1:B.value.body.trimEnd()!==e.body.trimEnd()||pt(Ln(B.value.data))!==pt(Ln(e.data))}),pn=p(()=>qe.value&&!C.value&&!!E.value&&E.value.digest!==Je.value),mn=p(()=>!!E.value&&pt(Ln(B.value.data))!==pt(Ln(E.value.data))),gn=p(()=>!m.value&&!C.value&&!E.value&&!qe.value&&N.value===`deleted`),vn=p(()=>!g.value&&!m.value&&!C.value&&!E.value&&!qe.value&&!T.value&&N.value!==`deleted`);f(()=>cn.value||fn.value||dn.value,e=>{window.parent!==window&&window.parent.postMessage({type:`vitehub:dirty`,dirty:e},location.origin)},{immediate:!0}),P(()=>{window.parent!==window&&window.parent.postMessage({type:`vitehub:dirty`,dirty:!1},location.origin)});let yn=p(()=>Ge.value&&!m.value&&!dn.value&&(cn.value||N.value===`draft`||N.value===`changed`||N.value===`deleted`)),bn=p(()=>{if(g.value)return o.collection.label;let e=x.value?B.value.data[x.value.name]:void 0;return String(e)===e&&e.trim()?e:m.value?`New ${y.value.toLowerCase()}`:o.documentId}),Cn=p(()=>/\.[\w-]+$/.exec(o.collection.path)?.[0]??`.md`),wn=p(()=>E.value?.path.split(`/`).pop()??`${on.value}${Cn.value}`),En=p(()=>Object.values(se.value).reduce((e,t)=>e+t.length,0)),Dn=p(()=>m.value&&V.value&&!Ue(V.value.trim())?`Id can use letters, numbers, dashes, and slashes, such as hello-world or 2026/launch.`:se.value[``]?.join(` `)),On=p(()=>!St.value&&!qe.value&&We.value&&!m.value&&(!!E.value||g.value&&N.value!==`deleted`)&&!ce.value&&!oe.value&&!Se.value&&ot.mayWrite.value),kn=p(()=>Pe.value===void 0?void 0:AN(Pe.value)),An=A(!1),jn,Mn,Nn=0;f(ie,e=>{if(clearTimeout(jn),clearTimeout(Mn),e){jn=setTimeout(()=>{An.value=!0,Nn=Date.now()},200);return}An.value&&(Mn=setTimeout(()=>An.value=!1,Math.max(0,400-(Date.now()-Nn))))});let Pn=p(()=>oe.value?{label:`Publishing…`,pending:!0,tone:`neutral`}:et.value?{label:`Applying…`,pending:!0,tone:`neutral`}:An.value?{label:`Saving…`,pending:!0,tone:`neutral`}:qe.value?{label:fn.value?`Local edits · not saved`:`Local only`,tone:fn.value?`warning`:`neutral`}:St.value&&xt?xt.saveStatus.value?.error?{action:`retry`,label:`Not saved · retry`,tone:`error`}:En.value?{action:`fields`,label:`${En.value===1?`1 field needs`:`${En.value} fields need`} attention`,tone:`error`}:E.value?.conflict?{action:`site`,label:`Changed on the site too`,tone:`warning`}:N.value?{label:xn(N.value),savedAt:xt.saveStatus.value?.savedAt??U.value??E.value?.updatedAt??void 0,tone:tn(N.value)}:void 0:ce.value?{action:`conflict`,label:`Not saved · newer version`,tone:`error`}:En.value?{action:`fields`,label:`${En.value===1?`1 field needs`:`${En.value} fields need`} attention`,tone:`error`}:W.value&&cn.value?{action:`retry`,label:`Not saved · retry`,tone:`error`}:E.value?.conflict?{action:`site`,label:`Changed on the site too`,tone:`warning`}:m.value?cn.value?{label:`Not created yet`,tone:`neutral`}:void 0:N.value?{label:cn.value&&!On.value?`Unsaved`:xn(N.value),savedAt:U.value??E.value?.updatedAt??void 0,tone:cn.value&&!On.value?`warning`:tn(N.value)}:g.value&&!E.value&&!C.value?{label:`Not saved yet`,tone:`neutral`}:void 0);function Fn(){Re++,c(`changed`)}function In(e){if(!S.value)return;let t={...B.value.data};e===void 0?delete t[S.value.name]:t[S.value.name]=e,B.value={...B.value,data:t}}function Ln(e){return xS(v.value,e)}function Rn(e){return JSON.parse(JSON.stringify(e))}let zn=p(()=>o.parent??(g.value?void 0:{label:o.collection.label,to:Bn()}));function Bn(){return{name:l.name??void 0,params:{collection:o.collection.name,document:[]},query:ht(o.collection.name)}}function Vn(e){return{name:l.name??void 0,params:{collection:o.collection.name,document:e.split(`/`)},query:{}}}let Hn=new Set;function Un(e){Hn.add(e.digest),E.value=e,N.value=e.state,I.value=e.schedule,B.value={body:e.body,data:Rn(e.data)},Gn(e)}function Gn(e){if(!e.issues?.length){se.value={};return}se.value=cS(wS(v.value,e.issues)),er=Object.fromEntries(Object.entries(e.data).map(([e,t])=>[e,pt(t??null)])),tr=e.body}async function Kn(){if(!m.value){C.value=!0,T.value=void 0;try{let e=await o.client.get(o.collection.name,o.documentId);if(e&&(St.value||qe.value)){qn(e);return}if(e&&E.value&&cn.value)return;if(e)Un(e);else{E.value=null,g.value&&!qe.value&&(B.value={body:``,data:bS(o.collection.schema)});let e=await o.client.list(o.collection.name,{filter:{id:o.documentId},limit:1,state:`deleted`});N.value=e.items[0]?.state,I.value=e.items[0]?.schedule}T.value=void 0}catch(e){T.value=e}finally{C.value=!1}}}function qn(e){Hn.add(e.digest),E.value=e,N.value=e.state,I.value=e.schedule}async function Yn(){if(!(m.value||o.documentId===void 0))try{let e=await o.client.get(o.collection.name,o.documentId);if(!qe.value)return;e?qn(e):E.value=null}catch{}}async function Xn(){if(!m.value)try{let e=await o.client.get(o.collection.name,o.documentId);e&&qn(e)}catch{}}let Zn=null;async function Qn(){if(!xt)return!1;ie.value=!0,W.value=void 0;try{return Zn=await xt.save(),await Xn(),!0}catch(e){return W.value=un(e,`The request failed.`),d.error(`Couldn't save. Try again.`,{label:`Retry`,onClick:()=>void Qn()}),!1}finally{ie.value=!1}}async function $n(){await ae();let e=document.querySelector(`.vitehub-document-editor [aria-invalid='true']`);e?.focus({preventScroll:!0}),e?.scrollIntoView({block:`center`,behavior:`instant`})}let er={},tr=``;f(V,e=>{if(se.value[``]&&Ue(e.trim())){let e={...se.value};delete e[``],se.value=e}}),f(()=>B.value.data,e=>{if(!En.value)return;let t=Object.fromEntries(Object.entries(se.value).filter(([t])=>{let n=t.split(`.`)[0]??``;return!n||pt(e[n]??null)===er[n]}));Object.keys(t).length!==Object.keys(se.value).length&&(se.value=t)},{deep:!0});async function nr(e={}){if(!We.value)return;if(St.value){await Qn();return}if(ie.value){e.auto||(He=!0);return}if(clearTimeout(ze),await ke.value?.commit(),m.value&&!Ue(on.value)){se.value={"":[on.value?`Id can use letters, numbers, dashes, and slashes.`:`Id is required.`]},er={},await $n();return}if(!m.value&&!ot.mayWrite.value&&!await ot.claim())return;ie.value=!0;let t=!!W.value;W.value=void 0;let n={body:B.value.body,data:Ln(B.value.data)};try{let t=await o.client.save(o.collection.name,on.value,{...n,ifDigest:e.ifDigest===void 0?E.value?.digest??null:e.ifDigest,session:Di});Yt.value=0,ce.value=void 0,le.value=!1;let r=B.value.body!==n.body||pt(Ln(B.value.data))!==pt(n.data);Hn.add(t.digest),E.value=t,N.value=t.state,r||(B.value={body:t.body===n.body?B.value.body:t.body,data:Rn(t.data)}),Gn(t),U.value=new Date().toISOString(),Fn(),I.value?.status===`pending`&&Rr!==I.value.id&&(Rr=I.value.id,d.show({title:`Draft changed after scheduling. Cancel the schedule and schedule again to publish this version.`})),m.value&&await u.replace({...Vn(t.id),state:{vitehubDocumentSavedAt:U.value}}),(pe.value.length||fe.value||qi.value===`history`)&&qr(),je.value===`source`&&Zr()}catch(r){let i=rn(r);if(jt(r))Yt.value++,await ot.refresh(),(ct.value===`free`||ct.value===`editing`)&&(ct.value=`taken`);else if(i)se.value=cS(wS(v.value,i)),er=Object.fromEntries(Object.entries(B.value.data).map(([e,t])=>[e,pt(t??null)])),tr=n.body,e.auto||await $n();else if(lt(r)){let t=await o.client.get(o.collection.name,on.value).catch(()=>null);ce.value={mine:n,theirs:t};let r=()=>{le.value=!0};e.auto?d.error(`Someone saved a newer version. Saving is paused.`,{label:`Compare`,onClick:r}):r()}else W.value=un(r,`The request failed.`),(!e.auto||!t)&&d.error(`Couldn't save. Try again.`,{label:`Retry`,onClick:()=>nr()})}finally{ie.value=!1}if(He&&(He=!1,cn.value))return await nr();cn.value&&!W.value&&hr()}function rr(e){if(St.value)return;if(qe.value){!C.value&&(E.value?.digest??null)!==e&&Yn();return}if(m.value||C.value||ie.value||oe.value||Se.value||cn.value||(E.value?.digest??null)===e||!E.value&&e===null||e!==null&&Hn.has(e))return;let t=ct.value===`free`,n=E.value?.digest;Kn().then(()=>{E.value?.digest!==n&&(Fn(),t&&!cn.value&&d.show({title:`This ${g.value?`page`:y.value.toLowerCase()} was updated`}))})}function ir(){ot.readOnly(),cn.value&&!m.value&&(B.value={body:sn.value.body,data:Rn(sn.value.data)})}async function ar(){if(!await ot.takeover()){d.error(`Couldn't take over. Try again.`);return}Yt.value=0,cn.value&&await nr()}function or(){ut.value=!1,ot.resume(),yt.value=void 0}async function sr(){ot.resume(),await Kn()}async function ur(){let e=await o.client.get(o.collection.name,on.value).catch(()=>null);Qt.value={mine:{body:B.value.body,data:Ln(B.value.data)},theirs:e},Zt.value=!0}async function fr(){let e=_.value?B.value.body:JSON.stringify(Ln(B.value.data),null,2);try{await navigator.clipboard.writeText(e),d.show({title:`Your edits copied`})}catch{d.error(`Couldn't copy. Select the text and copy it.`)}}async function pr(){let e=JSON.stringify(Ln(B.value.data),null,2);try{await navigator.clipboard.writeText(_.value?`${e}\n\n${B.value.body}`:e),d.show({title:`Your local edits copied`})}catch{d.error(`Couldn't copy. Select the text and copy it.`)}}function mr(){return ie.value?new Promise(e=>{let t=f(ie,n=>{n||(t(),e())})}):Promise.resolve()}function hr(){clearTimeout(ze),On.value&&(ze=setTimeout(()=>{cn.value&&On.value&&(!En.value||gr())&&nr({auto:!0})},R$))}function gr(){return Object.entries(er).some(([e,t])=>pt(B.value.data[e]??null)!==t)||B.value.body!==tr}f(B,()=>{if(qe.value){br();return}if(St.value){xt?.writeFields(Ln(B.value.data));return}cn.value&&(m.value||(ot.input(),!ot.mayWrite.value&&ct.value===`free`&&ot.claim().then(e=>{e&&hr()})),hr())},{deep:!0});function _r(){if(!ce.value)return;let e=ce.value.theirs;nr({ifDigest:e?.digest??null})}function vr(){if(!ce.value)return;let e=ce.value.theirs;ce.value=void 0,le.value=!1,e?Un(e):Kn()}async function yr(){if(!Ge.value||oe.value||En.value)return;if(qe.value){await Ar();return}if(E.value?.conflict){await oi();return}if(clearTimeout(ze),await ke.value?.commit(),await mr(),St.value&&!await Qn()||St.value&&En.value||cn.value&&(await nr(),cn.value||ce.value||En.value||W.value))return;let e=N.value,t=gn.value;oe.value=!0,t||(N.value=`published`);try{let e=await o.client.publish(o.collection.name,[{digest:E.value?.digest??null,id:on.value}]),n=e.pullRequest;e.documents.length&&n?d.show({action:{label:`Open pull request`,onClick:()=>void window.open(n.url,`_blank`,`noopener`)},title:`Pull request #${n.number} opened. The changes go live when it merges.`}):e.documents.length&&d.show({title:t?`${y.value} removed from the site`:`Changes published`}),Fn(),gi.value++,t?await u.replace(Bn()):cn.value||await Kn()}catch(t){N.value=e;let n=rn(t);vt(t)?(await Kn(),await oi()):Tn(t)?(await Kn(),d.error(`Someone saved a newer draft. Review it, then publish again.`)):n?(se.value=cS(wS(v.value,n)),er=Object.fromEntries(Object.entries(B.value.data).map(([e,t])=>[e,pt(t??null)])),tr=B.value.body,d.error(`This draft no longer validates. Fix it, then publish.`),await $n()):d.error(`Couldn't publish. ${un(t,`Try again.`)}`,{label:`Retry`,onClick:yr})}finally{oe.value=!1}cn.value&&hr()}function br(){qe.value&&Xe.value&&o.documentId!==void 0&&(Qe.value=!qK(window.sessionStorage,o.collection.name,o.documentId,{base:Je.value,start:Xe.value,version:{body:B.value.body,data:Rn(B.value.data)}}))}async function xr(){if(qe.value||!We.value||m.value||!E.value)return;clearTimeout(ze),await ke.value?.commit(),await mr();let e=St.value;if(e&&!await Qn()||!e&&cn.value&&(await nr(),cn.value||ce.value||W.value))return;let t=E.value;if(!t)return;let n=e?Zn:t.digest,r=e?{body:t.body,data:Rn(t.data)}:{body:B.value.body,data:Rn(B.value.data)},i={body:(e?await ke.value?.markdown():void 0)??r.body,data:Rn(B.value.data)};Je.value=n,Xe.value=Rn(r),B.value=i,Ke.value=`local`,br(),ct.value===`editing`&&(ot.resume(),ot.refresh())}async function Sr(){if(qe.value){if(await ke.value?.commit(),fn.value||dn.value){$e.value=!0;return}Tr()}}function Cr(e){e===`local`?xr():Sr()}function wr(){o.documentId!==void 0&&JK(window.sessionStorage,o.collection.name,o.documentId),$e.value=!1,tt.value=void 0,Xe.value=void 0,Ke.value=`shared`,ot.resume()}async function Tr(){wr(),E.value=null,await Kn()}async function Er(e=Je.value){if(!qe.value||et.value||o.documentId===void 0)return;await ke.value?.commit();let t=!!(_t&&_.value&&!yt.value);if(!t&&!await ot.acquire()){Or(()=>void Er(e));return}et.value=!0;let n={body:B.value.body,data:Ln(B.value.data)};try{let r=await o.client.save(o.collection.name,o.documentId,{...n,ifDigest:e,session:Di,...t?{live:!0}:{}});await ke.value?.commit();let i=B.value.body!==n.body||pt(Ln(B.value.data))!==pt(n.data);i?(qn(r),Gn(r),$e.value=!1,tt.value=void 0,Je.value=r.digest,Xe.value={body:r.body,data:Rn(r.data)},br()):(wr(),Un(r)),U.value=new Date().toISOString(),Fn(),d.show({title:i?`Local edits saved to the shared draft. Edits made since stay local.`:`Local edits saved to the shared draft`}),(pe.value.length||fe.value||qi.value===`history`)&&qr()}catch(t){let n=rn(t);lt(t)?($e.value=!1,await Dr()):n?(se.value=cS(wS(v.value,n)),er=Object.fromEntries(Object.entries(B.value.data).map(([e,t])=>[e,pt(t??null)])),$e.value=!1,await $n()):jt(t)?d.error(`Someone else is editing. Your local edits stay here. Try again when they stop.`):d.error(`Couldn't apply. ${un(t,`Try again.`)}`,{label:`Retry`,onClick:()=>void Er(e)})}finally{et.value=!1,kr()}}async function Dr(){if(o.documentId!==void 0){nt.value=!0;try{let e=await o.client.get(o.collection.name,o.documentId);qe.value&&(tt.value={theirs:e})}catch(e){qe.value&&(tt.value={failed:un(e,`The request failed.`)})}finally{nt.value=!1}}}function Or(e){let t=qt.value;d.error(t?`${t} Your local edits stay here. Try again when they stop.`:`Couldn't get the edit lock. Your local edits stay here.`,{label:`Retry`,onClick:e})}function kr(){qe.value&&ct.value===`editing`&&(ot.resume(),ot.refresh())}async function Ar(){if(o.documentId!==void 0){rt.value=!0,it.value=void 0,at.value=!0;try{let[e,t]=await Promise.all([o.client.get(o.collection.name,o.documentId),o.client.get(o.collection.name,o.documentId,`published`)]);it.value={draft:e,site:t},e&&qn(e)}catch(e){rt.value=!1,d.error(`Couldn't load the shared draft. ${un(e,`Try again.`)}`)}finally{at.value=!1}}}async function jr(){let e=it.value;if(e?.draft&&!oe.value&&o.documentId!==void 0){if(e.draft.conflict){rt.value=!1,await oi(e.draft);return}oe.value=!0;try{let t=await o.client.publish(o.collection.name,[{digest:e.draft.digest,id:o.documentId}]);rt.value=!1;let n=t.pullRequest;n?d.show({action:{label:`Open pull request`,onClick:()=>void window.open(n.url,`_blank`,`noopener`)},title:`Pull request #${n.number} opened. The shared draft goes live when it merges. Your local edits are still here.`}):d.show({title:`Shared draft published. Your local edits are still here.`}),Fn(),gi.value++,await Yn()}catch(e){Tn(e)||vt(e)?(d.error(`The shared draft changed while you reviewed it. Review it again.`),await Ar()):rn(e)?d.error(`The shared draft has invalid fields. Fix them in Collaborative, then publish.`):d.error(`Couldn't publish. ${un(e,`Try again.`)}`)}finally{oe.value=!1}}}let Mr=p(()=>R.value?Ie(R.value.toString(),ee.value.toString()):void 0),Nr=p(()=>Mr.value!==void 0&&Date.parse(Mr.value)<=Date.now()),Pr=p(()=>Ne(te)),Fr=p(()=>I.value?kt(I.value,o.setup):``),Ir=p(()=>{let e=o.setup?.schedule,t={label:`Schedule…`,icon:`i-lucide-calendar-clock`,disabled:!!e||!!(I.value&&I.value.status!==`failed`),...e?{description:Et(e.message)}:{},onSelect:Vr};return e?.docs?[[t],[{label:`Set up scheduling`,icon:`i-lucide-book-open`,to:e.docs,target:`_blank`}]]:[[t]]}),Rr;async function Vr(){o.setup?.schedule||(clearTimeout(ze),await ke.value?.commit(),await mr(),(!St.value||await Qn())&&(cn.value&&(await nr(),cn.value||ce.value||En.value||W.value)||(R.value=Ne(te).add({days:1}),L.value=!0)))}async function Hr(){if(!(!Ge.value||cn.value||z.value||!Mr.value||Nr.value)){z.value=!0;try{let e=await o.client.schedule(o.collection.name,Mr.value,[{digest:E.value?.digest??null,id:on.value}]);I.value={at:e.at,id:e.id,status:e.status},L.value=!1,d.show({title:ln(e)}),Fn()}catch(e){L.value=!1,Tn(e)?(await Kn(),d.error(`Someone saved a newer draft. Review it, then schedule again.`)):d.error(`Couldn't schedule. ${un(e,`Try again.`)}`)}finally{z.value=!1}}}async function Ur(){if(!I.value)return;let e=I.value.status===`failed`;try{await o.client.unschedule(o.collection.name,I.value.id),I.value=void 0,d.show({title:e?`Failed schedule dismissed`:`Schedule cancelled`}),Fn()}catch(e){d.error(`Couldn't cancel the schedule. ${un(e,`Try again.`)}`),Kn()}}async function Gr(){if(clearTimeout(ze),await mr(),!E.value)return;if(!await ot.claim()){ue.value=!1;return}let e=St.value;if(e&&!await Qn())return;let t={id:on.value,revision:E.value.revision},{client:n,collection:r}=o;de.value=!0;try{e&&(Mt=Date.now()+1e4),await n.remove(r.name,t.id,E.value.digest,Di,e),ue.value=!1,E.value=null,Fn(),await u.replace(Bn()),d.show({action:{label:`Undo`,onClick:async()=>{try{await n.restore(r.name,t.id,t.revision,null),await u.push(Vn(t.id))}catch{d.error(`Couldn't restore the ${y.value.toLowerCase()}. Try again from History.`)}}},title:`${y.value} deleted`})}catch(e){ue.value=!1,d.error(lt(e)?`This ${y.value.toLowerCase()} changed since you opened it. Reload, then delete it.`:`Couldn't delete. Try again.`)}finally{de.value=!1}}async function qr(e=!1){if(!m.value){_e.value=!0;try{let t=await o.client.revisions(o.collection.name,on.value,e?me.value:void 0);pe.value=e?[...pe.value,...t.revisions]:t.revisions,me.value=t.cursor,ye.value=Date.now(),ve.value=void 0}catch(e){ve.value=e}finally{_e.value=!1}}}async function Yr(e){fe.value=!0,xe.value=!0,be.value={current:null,document:null,revision:e};try{let[t,n]=await Promise.all([o.client.raw(o.collection.name,on.value,e.id),o.client.raw(o.collection.name,on.value)]);be.value={current:n,document:t,revision:e}}catch{d.error(`Couldn't open this version. Try again.`),be.value=void 0}finally{xe.value=!1}}async function Xr(){if(!be.value?.document||!await ot.claim())return;clearTimeout(ze),await ke.value?.commit(),await mr();let e=St.value;if(e&&!await Qn())return;let t={document:E.value,unsaved:cn.value?Rn(B.value):void 0},{client:n,collection:r}=o,i=on.value;Se.value=!0;try{e&&(Mt=Date.now()+1e4);let a=await n.restore(r.name,i,be.value.revision.id,E.value?.digest??null,Di,e);e?qn(a):Un(a),U.value=new Date().toISOString(),be.value=void 0,fe.value=!1,Fn(),qr(),d.show({action:{label:`Undo`,onClick:async()=>{try{let o=Le?E.value?.digest??a.digest:a.digest;if(e&&(Mt=Date.now()+1e4),t.document){let a=await n.restore(r.name,i,t.document.revision,o,e?Di:void 0,e);Le&&e?qn(a):Le&&Un(a)}else await n.remove(r.name,i,o,e?Di:void 0,e),Le&&(E.value=null,N.value=`deleted`);Le&&t.unsaved&&(B.value=t.unsaved),Fn()}catch{d.error(`Couldn't undo the restore. Pick the earlier version in History.`)}}},title:`Version restored`})}catch(e){d.error(lt(e)?`This ${y.value.toLowerCase()} changed since you opened it. Reload, then restore.`:`Couldn't restore. Try again.`)}finally{Se.value=!1}}async function Zr(){if(m.value||!E.value){Pe.value=void 0;return}try{Pe.value=(await o.client.raw(o.collection.name,on.value))?.text}catch{Pe.value=void 0}}async function $r(){await ke.value?.commit(),(cn.value||ce.value)&&await nr()}async function ei(e){e===`source`&&await ke.value?.commit(),je.value=e}function ti(){ei(je.value===`rich`?`source`:`rich`)}async function ni(e){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=e.currentTarget instanceof Element?e.currentTarget.closest(`[role="radiogroup"]`):null;await ei(e.key===`Home`?`rich`:e.key===`End`||je.value===`rich`?`source`:`rich`),await ae(),t?.querySelector(`[aria-checked="true"]`)?.focus()}function ri(e){(e.metaKey||e.ctrlKey)&&!e.altKey&&(e.key.toLowerCase()===`s`&&(e.preventDefault(),$r()),e.key===`/`&&!m.value&&_.value&&(e.preventDefault(),ti()))}function ii(e){(cn.value||fn.value||dn.value)&&e.preventDefault()}function ai(e){e===`conflict`&&(le.value=!0),e===`fields`&&$n(),e===`retry`&&nr(),e===`site`&&oi()}async function oi(e){if(!Te.value){if(qe.value&&!e){await Ar();return}we.value=!0,Ce.value=void 0,De.value=e,Ee.value=void 0,Te.value=!0;try{let t=await o.client.get(o.collection.name,on.value,`published`);Ce.value={site:t,published:t?.digest??null,...e?{shared:e}:{}}}catch(e){Ee.value=`Couldn't load the site version. ${un(e,`Try again.`)}`}finally{Te.value=!1}}}async function si(e){let t=Ce.value;if(!t||!E.value||Oe.value)return;if(t.shared){await ci(e,t.site,t.published,t.shared);return}if(qe.value){we.value=!1;return}if(!await ot.claim())return;clearTimeout(ze),await ke.value?.commit(),await mr();let n=St.value;if(n&&!await Qn())return;let r=e===`site`&&t.site?{body:t.site.body,data:Ln(t.site.data)}:{body:B.value.body,data:Ln(B.value.data)};Oe.value=!0;try{n&&(Mt=Date.now()+1e4);let i=await o.client.save(o.collection.name,on.value,{...r,ifDigest:E.value.digest,ifPublishedDigest:t.published,session:Di,...n?{live:!0}:{}});n?qn(i):Un(i),we.value=!1,Ce.value=void 0,U.value=new Date().toISOString(),Fn(),d.show({title:e===`site`?`Draft matches the site again.`:`Draft kept. Publishing it replaces the site version.`})}catch(e){lt(e)?(await Kn(),d.error(`It changed again while you compared. Compare the latest versions.`),E.value?.conflict&&await oi()):d.error(`Couldn't save. ${un(e,`Try again.`)}`)}finally{Oe.value=!1}}async function ci(e,t,n,r){if(!qe.value||o.documentId===void 0)return;let i=e===`site`&&t?t:r,a=!!(_t&&_.value&&!yt.value);if(!a&&!await ot.acquire()){Or(()=>void ci(e,t,n,r));return}Oe.value=!0;try{qn(await o.client.save(o.collection.name,o.documentId,{body:i.body,data:Ln(i.data),ifDigest:r.digest,ifPublishedDigest:n,session:Di,...a?{live:!0}:{}})),we.value=!1,Ce.value=void 0,Fn(),gi.value++,d.show({title:e===`site`?`The shared draft matches the site again. Your local edits are still here.`:`Shared draft kept. Review it, then publish.`}),e===`draft`&&await Ar()}catch(e){lt(e)?(we.value=!1,Ce.value=void 0,d.error(`The shared draft or the site changed while you compared. Review it again.`),await Ar()):jt(e)?d.error(`Someone else is editing. Your local edits stay here. Try again when they stop.`):d.error(`Couldn't save. ${un(e,`Try again.`)}`)}finally{Oe.value=!1,kr()}}function li(){let e=Ae.value;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)}function ui(e){if(!x.value||!(e.target instanceof HTMLTextAreaElement))return;let t=e.target.value.replace(/\r?\n/g,` `);B.value={...B.value,data:{...B.value.data,[x.value.name]:t}},li()}function di(e){let t=e.target;t instanceof HTMLTextAreaElement&&(e.key===`Enter`&&!e.isComposing&&!(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ke.value?.focus(`start`)),e.key===`ArrowDown`&&t.selectionStart===t.value.length&&(e.preventDefault(),ke.value?.focus(`start`)))}let fi=p(()=>IK(E.value?.url,window.location.origin)),pi=p(()=>l.query.preview!==void 0&&!m.value&&!!fi.value),mi=A(`draft`),hi=A(`desktop`),gi=A(0),_i=A(),vi=A(Number(window.localStorage.getItem(z$))||560),yi=A(),bi=window.matchMedia(`(min-width: 1024px)`),wi=A(bi.matches),Ei=e=>wi.value=e.matches;bi.addEventListener(`change`,Ei),P(()=>bi.removeEventListener(`change`,Ei));let Mi=A(),Ni,Pi=0;P(()=>clearTimeout(Ni)),f([St,pi,Dt,()=>o.documentId],()=>{clearTimeout(Ni),Pi++,Mi.value=void 0,St.value&&pi.value&&zi()});function Fi(e){let t={...l.query};e?t.preview=null:delete t.preview,u.replace({query:t})}let Ii=p(()=>({collection:o.collection.name,id:on.value,data:Ln(B.value.data),..._.value?{body:St.value?Mi.value??E.value?.body??``:B.value.body}:{}})),Li=p(()=>Xt.value?v.value.filter(e=>e.kind===`string`||e.kind===`text`).map(e=>e.name):[]);function Ri(){St.value&&pi.value&&(clearTimeout(Ni),Ni=setTimeout(()=>void zi(),250))}async function zi(){let e=++Pi,t=await ke.value?.markdown();t!=null&&e===Pi&&(Mi.value=t)}async function Bi(e){if(!wi.value)return;let t=Li.value.includes(e);if(e===`body`){t||ke.value?.focus(`start`);return}if(x.value?.name===e&&je.value===`rich`){Ae.value?.scrollIntoView({block:`nearest`}),t||Ae.value?.focus({preventScroll:!0});return}je.value!==`rich`&&await ei(`rich`),await ae();let n=document.querySelector(`.vitehub-document-editor [data-vitehub-field="field-${e.replace(/[^a-zA-Z0-9_-]/g,`-`)}"]`);n&&(n.scrollIntoView({block:`center`}),n.animate([{backgroundColor:`color-mix(in oklab, var(--ui-primary) 14%, transparent)`},{backgroundColor:`transparent`}],{duration:1200,easing:`ease-out`}),t||n.querySelector(`input, textarea, select, button, [contenteditable='true']`)?.focus({preventScroll:!0}))}function Vi(e,t){Xt.value&&Li.value.includes(e)&&(B.value={...B.value,data:{...B.value.data,[e]:t}},x.value?.name===e&&ae(li))}function Hi(e){let t=yi.value?.clientWidth??window.innerWidth;vi.value=UK(e,t),window.localStorage.setItem(z$,String(vi.value))}let Ui=A(!1);function Wi(e){if(e.button!==0||!(e.currentTarget instanceof HTMLElement))return;e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),Ui.value=!0;let n=yi.value?.getBoundingClientRect().right??window.innerWidth,r=e=>Hi(n-e.clientX),i=()=>{Ui.value=!1,t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i)};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i)}function Gi(e){let t=e.shiftKey?96:32,n=yi.value?.clientWidth??window.innerWidth,r={ArrowLeft:vi.value+t,ArrowRight:vi.value-t,Home:n,End:0}[e.key];r!==void 0&&(e.preventDefault(),Hi(r))}let Ki=p(()=>[[{label:`Collaborative`,description:_t&&_.value?`Edit the shared draft with everyone. It saves as you type.`:`Edit the shared draft. It saves as you type.`,icon:`i-lucide-users`,type:`checkbox`,checked:!qe.value,onUpdateChecked:()=>Cr(`shared`)},{label:`Local only`,description:`Edits stay in this tab and save nowhere until you apply them.`,icon:`i-lucide-laptop`,type:`checkbox`,checked:qe.value,onUpdateChecked:()=>Cr(`local`)}]]),qi=p(()=>l.query.panel===`history`||l.query.panel===`outline`?l.query.panel:void 0);function Ji(e){let t={...l.query};e?t.panel=e:delete t.panel,u.replace({query:t})}function Yi(){window.matchMedia(`(min-width: 1024px)`).matches?Ji(`history`):fe.value=!0}f(()=>x.value?B.value.data[x.value.name]:void 0,e=>{m.value&&!ne.value&&(V.value=Pt(String(e??``))),ae(li)}),f(fe,e=>{e&&!pe.value.length&&qr(),e||(be.value=void 0)}),f(qi,e=>{e===`history`&&qr()},{immediate:!0}),f(je,e=>{e===`source`&&Zr()}),f(()=>o.changes,(e,t)=>{let n=Math.min(Re,e-t);Re-=n,!(e-t-n<=0)&&(qe.value?Yn():!cn.value&&!m.value&&!ie.value&&!oe.value&&Kn())});async function Xi(){if(await ke.value?.commit(),fn.value||dn.value)return $e.value=!0,!1;if(cn.value&&(await mr(),cn.value&&On.value&&await nr({auto:!0}),cn.value&&!window.confirm(m.value?`Leave without creating this document?`:`Leave without saving? Your changes will be lost.`)))return!1}lr(Xi),Wn((e,t)=>{if(qe.value&&e.path!==t.path)return Xi()}),he(()=>{window.addEventListener(`keydown`,ri),window.addEventListener(`beforeunload`,ii);let e=window.history.state?.vitehubDocumentSavedAt;String(e)===e&&(U.value=e),Kn().then(()=>ae(li)),m.value&&ae(()=>Ae.value?.focus())}),P(()=>{Le=!1,clearTimeout(jn),clearTimeout(Mn),clearTimeout(ze),window.removeEventListener(`keydown`,ri),window.removeEventListener(`beforeunload`,ii)});let Zi=p(()=>[[...m.value?[]:[{label:`History`,icon:`i-lucide-history`,onSelect:Yi}],...!m.value&&_.value?[{label:je.value===`rich`?`View source`:`Edit rich text`,icon:`i-lucide-file-code`,kbds:[`meta`,`/`],onSelect:ti}]:[],...Ge.value&&I.value?[{label:I.value.status===`failed`?`Dismiss failed schedule`:`Cancel schedule`,icon:`i-lucide-calendar-x`,onSelect:()=>void Ur()}]:[],{label:`Copy id`,icon:`i-lucide-copy`,onSelect:()=>void navigator.clipboard?.writeText(on.value)},...E.value?[{label:`Copy path`,icon:`i-lucide-folder`,onSelect:()=>void navigator.clipboard?.writeText(E.value.path)}]:[]],...Xt.value&&!qe.value&&E.value&&!g.value?[[{label:`Delete`,icon:`i-lucide-trash-2`,color:`error`,onSelect:()=>ue.value=!0}]]:[]]);return(t,a)=>{let o=Ft,c=dr,l=Bt,u=sS,d=Jr,f=ge,p=zr,h=Sn,v=ji,w=Lr,A=aS,P=Br,ae=rS,U=Kr;return J(),b(O,null,[j(`div`,{ref_key:`splitRoot`,ref:yi,class:`relative flex min-h-0 flex-1`},[j(`div`,gQ,[H(Si,{title:bn.value,back:zn.value,trail:zn.value&&zn.value.label!==bn.value?[zn.value]:[]},e({right:i(()=>[St.value?(J(),b(O,{key:0},[Ct.value.length?(J(),k(F(Xa),{key:0,class:`me-1`,people:Ct.value,max:4,size:`sm`,variant:`outline`},null,8,[`people`])):M(``,!0),H(o,{text:`Everyone here edits together. The draft saves a few seconds after typing stops.`,content:{side:`bottom`}},{default:i(()=>[H(F($a),{class:`me-1 hidden sm:inline-flex`,status:wt.value},{default:i(()=>[H(F(eo)),H(F(to),null,{default:i(({state:e})=>[K(q(e===`connected`?`Live`:e===`reconnecting`?`Reconnecting…`:`Connecting…`),1)]),_:1})]),_:1},8,[`status`])]),_:1})],64)):F(ft).length?(J(),k(qb,{key:1,class:`me-1`,sessions:F(ft),user:F(mt)?.user},null,8,[`sessions`,`user`])):M(``,!0),!St.value&&Ot.value&&F(ft).length?(J(),k(o,{key:2,text:Ot.value,content:{side:`bottom`}},{default:i(()=>[j(`span`,_Q,[H(xi,{label:F(Ci)},null,8,[`label`])])]),_:1},8,[`text`])):M(``,!0),Ht.value?(J(),k(o,{key:3,text:F(mt)?.reason??`The Console could not reach the server. Saves still refuse to overwrite a newer version.`,content:{side:`bottom`}},{default:i(()=>[j(`span`,vQ,[H(xi,{label:`Can't check who else is editing`})])]),_:1},8,[`text`])):M(``,!0),j(`span`,yQ,[Pn.value?.action&&!An.value?(J(),b(`button`,{key:0,type:`button`,class:`rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2`,onClick:a[0]||=e=>ai(Pn.value.action)},[H(xi,{label:Pn.value.label,tone:Pn.value.tone,class:`underline decoration-dotted underline-offset-4 hover:text-highlighted`},null,8,[`label`,`tone`])])):Pn.value?(J(),k(o,{key:1,text:m.value?`Create saves the first draft`:`Drafts save as you type. ⌘S saves now.`,content:{side:`bottom`}},{default:i(()=>[H(xi,{label:Pn.value.label,tone:Pn.value.tone,pending:Pn.value.pending},{default:i(()=>[K(q(Pn.value.label),1),Pn.value.savedAt?(J(),b(O,{key:0},[a[46]||=K(` · `,-1),H(Qr,{value:Pn.value.savedAt,prefix:`Saved`,seconds:``},null,8,[`value`])],64)):M(``,!0)]),_:1},8,[`label`,`tone`,`pending`])]),_:1},8,[`text`])):M(``,!0)]),We.value&&(E.value||qe.value)&&!m.value&&!vn.value&&!gn.value&&!T.value?(J(),k(l,{key:4,items:Ki.value,content:{align:`end`},ui:{content:`w-72`,itemDescription:`whitespace-normal!`}},{default:i(()=>[H(c,{size:`sm`,variant:`ghost`,color:qe.value?`warning`:`neutral`,icon:qe.value?`i-lucide-laptop`:`i-lucide-users`,"trailing-icon":`i-lucide-chevron-down`,"aria-label":`Editing: ${qe.value?`Local only`:`Collaborative`}`,loading:et.value},{default:i(()=>[j(`span`,bQ,q(qe.value?`Local only`:`Collaborative`),1)]),_:1},8,[`color`,`icon`,`aria-label`,`loading`])]),_:1},8,[`items`])):M(``,!0),E.value&&!m.value&&!vn.value?(J(),k(o,{key:5,text:fi.value?`Preview the page`:`Set url on the collection to preview its pages`,content:{side:`bottom`}},{default:i(()=>[H(c,{variant:`ghost`,size:`sm`,icon:`i-lucide-app-window`,"aria-label":`Preview the page`,"aria-pressed":pi.value,disabled:!fi.value,active:pi.value,"active-variant":`soft`,onClick:a[1]||=e=>Fi(!pi.value)},null,8,[`aria-pressed`,`disabled`,`active`])]),_:1},8,[`text`])):M(``,!0),_.value&&!m.value&&!C.value&&!vn.value&&!gn.value&&!T.value?(J(),b(`div`,{key:6,class:G([`hidden items-center rounded-md p-0.5 ring-1 ring-default ring-inset`,pi.value?``:`md:flex`]),role:`radiogroup`,"aria-label":`Editing mode`},[(J(),b(O,null,s([{label:`Rich`,value:`rich`},{label:`Source`,value:`source`}],e=>H(o,{key:e.value,text:e.value===`rich`?`Edit as a page`:`The stored Markdown file`,kbds:[`meta`,`/`]},{default:i(()=>[j(`button`,{type:`button`,role:`radio`,class:G([`h-6 rounded-[4px] px-2 text-xs focus-visible:outline-2`,je.value===e.value?`bg-elevated text-highlighted`:`text-muted hover:text-highlighted`]),"aria-checked":je.value===e.value,tabindex:je.value===e.value?0:-1,onClick:t=>ei(e.value),onKeydown:ni},q(e.label),43,xQ)]),_:2},1032,[`text`])),64))],2)):M(``,!0),m.value&&We.value?(J(),k(c,{key:7,size:`sm`,label:`Create`,loading:ie.value,onClick:a[2]||=e=>nr()},null,8,[`loading`])):yn.value?(J(),k(u,{key:8,size:`sm`},{default:i(()=>[H(o,{text:En.value?F(Kt)(En.value):void 0,disabled:!En.value,content:{side:`bottom`}},{default:i(()=>[H(c,{label:N.value===`deleted`?`Publish deletion`:qe.value?`Publish shared draft`:`Publish`,loading:oe.value,disabled:!!ce.value||z.value||!!En.value,"aria-description":En.value?F(Kt)(En.value):void 0,onClick:yr},null,8,[`label`,`loading`,`disabled`,`aria-description`])]),_:1},8,[`text`,`disabled`]),N.value!==`deleted`&&!qe.value?(J(),k(l,{key:0,items:Ir.value,content:{align:`end`},ui:{content:`max-w-72`,itemDescription:`whitespace-normal!`}},{default:i(()=>[H(c,{icon:`i-lucide-chevron-down`,"aria-label":`More publish options`,disabled:!!ce.value||oe.value||!!En.value,loading:z.value,class:`border-s border-(--ui-bg)/25`},null,8,[`disabled`,`loading`])]),_:1},8,[`items`])):M(``,!0)]),_:1})):M(``,!0),!m.value&&!vn.value?(J(),k(o,{key:9,text:`Outline and history`,content:{side:`bottom`}},{default:i(()=>[H(c,{class:`hidden lg:inline-flex`,variant:`ghost`,size:`sm`,icon:`i-lucide-panel-right`,"aria-label":`Toggle the side panel`,active:!!qi.value,"active-variant":`soft`,onClick:a[3]||=e=>Ji(qi.value?void 0:_.value?`outline`:`history`)},null,8,[`active`])]),_:1})):M(``,!0),vn.value?M(``,!0):(J(),k(l,{key:10,items:Zi.value,content:{align:`end`}},{default:i(()=>[H(c,{variant:`ghost`,size:`sm`,icon:`i-lucide-ellipsis`,"aria-label":`More actions`})]),_:1},8,[`items`]))]),_:2},[I.value?{name:`title-trailing`,fn:i(()=>[H(o,{text:Fr.value,content:{side:`bottom`}},{default:i(()=>[H(xi,{class:`shrink-0`,tone:F(_n)(I.value),label:F(ln)(I.value)},null,8,[`tone`,`label`])]),_:1},8,[`text`])]),key:`0`}:void 0]),1032,[`title`,`back`,`trail`]),j(`p`,SQ,q(C.value?`Loading document…`:``),1),j(`div`,CQ,[j(`div`,{class:`vitehub-document-editor min-h-0 min-w-0 flex-1 overflow-y-auto`,"aria-busy":C.value},[T.value?(J(),k(Ze,{key:0,class:`m-4`,title:`Couldn't open this ${y.value.toLowerCase()}`,error:T.value,retry:Kn},null,8,[`title`,`error`])):C.value?(J(),k(Wr,{key:1,label:`Loading document…`})):vn.value?(J(),k(d,{key:2,class:`py-16`,variant:`naked`,icon:`i-lucide-file-question`,title:`This ${y.value.toLowerCase()} does not exist`,description:`It may have been deleted and published, or the id is wrong.`,actions:[{label:`Back to ${n.collection.label}`,to:Bn()}]},null,8,[`title`,`actions`])):gn.value?(J(),k(d,{key:3,class:`py-16`,variant:`naked`,icon:`i-lucide-file-x`,title:`Deleted from the draft`,description:`It stays on the published site until you publish the deletion. Open History to restore an earlier version.`,actions:[{label:`History`,icon:`i-lucide-history`,color:`neutral`,variant:`outline`,onClick:()=>fe.value=!0}]},null,8,[`actions`])):(J(),b(`article`,TQ,[qe.value?(J(),b(`div`,EQ,[j(`div`,DQ,[H(f,{name:`i-lucide-laptop`,class:`size-4 shrink-0 text-warning`,"aria-hidden":`true`}),a[47]||=j(`span`,{class:`min-w-0 flex-1 text-default`},`Local only · Your edits stay in this tab. Nobody sees them, and nothing saves until you apply them.`,-1),dn.value?(J(),k(c,{key:0,size:`xs`,color:`neutral`,variant:`ghost`,label:`Copy`,icon:`i-lucide-copy`,"aria-label":`Copy your local edits`,onClick:pr})):M(``,!0),H(c,{size:`xs`,color:`neutral`,variant:`ghost`,label:`Discard…`,disabled:!fn.value&&!dn.value||et.value,onClick:a[4]||=e=>$e.value=!0},null,8,[`disabled`]),H(c,{size:`xs`,color:`neutral`,variant:`outline`,label:`Apply to shared draft`,disabled:!fn.value&&!dn.value,loading:et.value,onClick:a[5]||=e=>Er()},null,8,[`disabled`,`loading`])]),dn.value?(J(),b(`p`,OQ,` The shared draft was deleted after your local edits started. They are still here. Copy them, apply them to create the `+q(g.value?`page`:y.value.toLowerCase())+` again after a comparison, or discard them. `,1)):M(``,!0),qt.value?(J(),b(`p`,kQ,q(qt.value)+` Apply when they stop.`,1)):M(``,!0),pn.value?(J(),b(`p`,AQ,`Someone saved the shared draft after your local edits started. Apply compares them before it saves.`)):M(``,!0),Qe.value?(J(),b(`p`,jQ,`This tab can't keep your local edits after a reload. Apply or copy them before you leave.`)):M(``,!0)])):M(``,!0),Ut.value?(J(),b(`div`,MQ,[j(`div`,NQ,[H(f,{name:Ut.value.icon,class:`size-4 shrink-0 text-muted`,"aria-hidden":`true`},null,8,[`name`]),j(`span`,PQ,q(Ut.value.text),1),F(ct)===`blocked`?(J(),b(O,{key:0},[Gt.value&&F(_t)?(J(),k(c,{key:0,size:`xs`,color:`neutral`,variant:`outline`,label:`Join`,onClick:or})):Gt.value?M(``,!0):(J(),k(c,{key:1,size:`xs`,color:`neutral`,variant:`outline`,label:`Take over`,onClick:ar}))],64)):F(ct)===`taken`?(J(),b(O,{key:1},[H(c,{size:`xs`,color:`neutral`,variant:`ghost`,label:`Compare`,onClick:ur}),H(c,{size:`xs`,color:`neutral`,variant:`outline`,label:`Take back`,onClick:ar})],64)):F(ct)===`left`?(J(),k(c,{key:2,size:`xs`,color:`neutral`,variant:`outline`,label:`Reload and edit`,onClick:sr})):M(``,!0)]),F(ct)===`taken`&&Yt.value?(J(),b(`div`,FQ,[j(`span`,IQ,q(Yt.value===1?`1 edit wasn't saved`:`${Yt.value} edits weren't saved`),1),H(c,{size:`xs`,color:`neutral`,variant:`ghost`,icon:`i-lucide-copy`,label:`Copy`,onClick:fr})])):M(``,!0)])):M(``,!0),We.value?M(``,!0):(J(),b(`p`,LQ,[H(f,{name:`i-lucide-lock`,class:`size-4 shrink-0`,"aria-hidden":`true`}),a[48]||=K(` Read-only. You can read drafts of this collection but not change them. `,-1)])),je.value===`rich`?(J(),b(O,{key:3},[g.value?(J(),b(`h1`,RQ,q(n.collection.label),1)):x.value?(J(),b(`div`,zQ,[j(`label`,{for:`field-${x.value.name}`,class:`sr-only`},q(x.value.label),9,BQ),j(`textarea`,{id:`field-${x.value.name}`,ref_key:`titleInput`,ref:Ae,value:String(B.value.data[x.value.name]??``),rows:`1`,class:`block w-full resize-none overflow-hidden rounded-sm bg-transparent text-[32px]/[40px] font-semibold tracking-[-0.04rem] text-highlighted outline-none placeholder:text-dimmed focus-visible:outline-none disabled:cursor-default`,placeholder:`${y.value} title`,disabled:!Xt.value,"aria-invalid":se.value[x.value.name]?`true`:void 0,"aria-describedby":se.value[x.value.name]?`field-${x.value.name}-error`:void 0,onInput:ui,onKeydown:di,onFocus:Rt,onBlur:zt},null,40,VQ),Vt.value[`field-${x.value.name}`]?(J(),b(`span`,{key:0,class:`-mt-1`,role:`img`,"aria-label":Vt.value[`field-${x.value.name}`].map(e=>`${e.name} is editing this field`).join(`, `)},[H(F(Xa),{"aria-hidden":`true`,style:{"--vh-avatar-size":`1rem`},people:Vt.value[`field-${x.value.name}`],variant:`outline`},null,8,[`people`])],8,HQ)):M(``,!0),se.value[x.value.name]?(J(),b(`p`,{key:1,id:`field-${x.value.name}-error`,class:`mt-1 text-xs text-error`},q(se.value[x.value.name].join(` `)),9,UQ)):M(``,!0)])):M(``,!0),H(PJ,{modelValue:B.value.data,"onUpdate:modelValue":a[9]||=e=>B.value.data=e,schema:n.collection.schema,exclude:[x.value?.name,S.value?.name].filter(e=>e!==void 0),errors:se.value,disabled:!Xt.value,unfolded:!_.value,onSubmit:$r,onFocusin:Rt,onFocusout:zt},{default:i(()=>[m.value&&en.value.length>1?(J(),k(eJ,{key:0,icon:`i-lucide-folder`,label:`Folder`,control:`field-folder`},{default:i(()=>[H(p,{id:`field-folder`,modelValue:nn.value,"onUpdate:modelValue":a[6]||=e=>nn.value=e,class:`w-full`,variant:`ghost`,items:en.value.map((e,t)=>({label:e.folder||`/`,value:t})),ui:{base:`font-mono text-xs`}},null,8,[`modelValue`,`items`])]),_:1})):M(``,!0),m.value?(J(),k(eJ,{key:1,icon:`i-lucide-file`,label:`Id`,control:`field-id`,error:Dn.value,missing:!V.value.trim()&&!Dn.value},{default:i(()=>[H(h,{id:`field-id`,modelValue:V.value,"onUpdate:modelValue":[a[7]||=e=>V.value=e,a[8]||=e=>ne.value=!0],class:`w-full`,variant:`ghost`,placeholder:`hello-world`,ui:{base:`bg-transparent hover:bg-transparent focus:bg-transparent ring-0 hover:ring-1 hover:ring-inset hover:ring-(--ui-border) focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-(--ui-border-accented) font-mono text-xs`,trailing:`pe-2`},"aria-invalid":Dn.value?`true`:void 0,"aria-describedby":Dn.value?`field-id-error`:`field-id-hint`},{trailing:i(()=>[j(`span`,WQ,q(ne.value?`${en.value[nn.value]?.folder??``}${V.value||`…`}${Cn.value}`:`From the title`),1)]),_:1},8,[`modelValue`,`aria-invalid`,`aria-describedby`])]),_:1},8,[`error`,`missing`])):E.value?(J(),k(eJ,{key:2,icon:`i-lucide-file`,label:`File`},{default:i(()=>[j(`span`,{class:`flex h-8 min-w-0 items-center px-2.5 font-mono text-xs text-muted`,title:E.value.path},[j(`span`,KQ,q(E.value.path),1)],8,GQ)]),_:1})):M(``,!0)]),_:1},8,[`modelValue`,`schema`,`exclude`,`errors`,`disabled`,`unfolded`]),S.value?(J(),k(hQ,{key:2,"model-value":B.value.data[S.value.name],name:S.value.name,schema:S.value.schema,hint:S.value.hint,fallbacks:F(st)(B.value.data,n.collection.titleField,E.value?.url),errors:se.value,disabled:!Xt.value,"onUpdate:modelValue":In},null,8,[`model-value`,`name`,`schema`,`hint`,`fallbacks`,`errors`,`disabled`])):M(``,!0),_.value?(J(),b(`hr`,qQ)):M(``,!0)],64)):(J(),b(`section`,JQ,[j(`div`,YQ,[H(f,{name:`i-lucide-file-code`,class:`size-4 shrink-0`,"aria-hidden":`true`}),j(`span`,XQ,q(E.value?.path),1),j(`span`,ZQ,q(St.value?`Read-only during a live session. Edit in Rich.`:mn.value?`Fields are saving…`:`Fields are read-only here. Edit them in Rich.`),1)]),kn.value?.frontmatter?(J(),b(`pre`,QQ,q(kn.value.frontmatter.trimEnd()),1)):M(``,!0)])),_.value&&Tt.value?D((J(),k(VZ,{key:`live-${Dt.value}`,ref_key:`bodyEditor`,ref:ke,"model-value":B.value.body,live:Tt.value,active:je.value===`rich`,collection:n.collection.name,components:n.collection.components,"document-id":on.value,disabled:!Xt.value||!!F(xt)?.readOnlyReason.value,label:`Body`,onChange:Ri,onOutline:a[10]||=e=>Fe.value=e},null,8,[`model-value`,`live`,`active`,`collection`,`components`,`document-id`,`disabled`])),[[r,je.value===`rich`]]):_.value&&bt.value?D((J(),b(`div`,$Q,[H(f,{name:`i-lucide-loader-circle`,class:`mt-0.5 size-4 animate-spin`,"aria-hidden":`true`}),a[49]||=K(` Joining the live session… `,-1)],512)),[[r,je.value===`rich`]]):_.value?D((J(),k(VZ,{key:7,ref_key:`bodyEditor`,ref:ke,modelValue:B.value.body,"onUpdate:modelValue":a[11]||=e=>B.value.body=e,active:je.value===`rich`,collection:n.collection.name,components:n.collection.components,"document-id":m.value?void 0:on.value,disabled:!Xt.value,label:`Body`,onOutline:a[12]||=e=>Fe.value=e},null,8,[`modelValue`,`active`,`collection`,`components`,`document-id`,`disabled`])),[[r,je.value===`rich`]]):M(``,!0),_.value&&je.value===`source`&&St.value?(J(),b(`pre`,e$,q(kn.value?.body??B.value.body),1)):_.value&&je.value===`source`?(J(),k(v,{key:9,modelValue:B.value.body,"onUpdate:modelValue":a[13]||=e=>B.value.body=e,disabled:!Xt.value,autoresize:``,rows:16,variant:`none`,class:`w-full`,ui:{base:`min-h-80 p-0 font-mono text-[13px] leading-6`},"aria-label":`Markdown body`},null,8,[`modelValue`,`disabled`])):M(``,!0)]))],8,wQ),qi.value&&!m.value&&!vn.value?(J(),b(`aside`,t$,[j(`div`,n$,[(J(!0),b(O,null,s(_.value?[{label:`Outline`,value:`outline`},{label:`History`,value:`history`}]:[{label:`History`,value:`history`}],e=>(J(),k(c,{key:e.value,size:`xs`,variant:`ghost`,label:e.label,active:qi.value===e.value,"active-variant":`soft`,"aria-pressed":qi.value===e.value,onClick:t=>Ji(e.value)},null,8,[`label`,`active`,`aria-pressed`,`onClick`]))),128)),H(c,{class:`ms-auto`,size:`xs`,variant:`ghost`,icon:`i-lucide-x`,"aria-label":`Close the side panel`,onClick:a[14]||=e=>Ji(void 0)})]),j(`div`,r$,[qi.value===`outline`?(J(),b(`nav`,i$,[Fe.value.length?(J(),b(`ol`,o$,[(J(!0),b(O,null,s(Fe.value,e=>(J(),b(`li`,{key:`${e.pos}`},[j(`button`,{type:`button`,class:`block w-full truncate rounded-md py-1 pe-2 text-left text-[13px] text-muted hover:bg-elevated/60 hover:text-highlighted focus-visible:outline-2`,style:re({paddingInlineStart:`${.5+(e.level-1)*.75}rem`}),onClick:t=>ke.value?.scrollTo(e.pos)},q(e.text),13,s$)]))),128))])):(J(),b(`p`,a$,`Headings in the body show here.`))])):(J(),k(pq,{key:1,revisions:pe.value,cursor:me.value,loading:_e.value,error:ve.value,"loaded-at":ye.value,selected:fe.value?be.value?.revision.id:void 0,onOpen:Yr,onMore:a[15]||=e=>qr(!0)},null,8,[`revisions`,`cursor`,`loading`,`error`,`loaded-at`,`selected`]))])])):M(``,!0)])]),pi.value&&fi.value&&E.value?(J(),b(O,{key:0},[wi.value?(J(),b(`div`,{key:0,class:`group relative z-10 -mx-1 w-2 shrink-0 cursor-col-resize touch-none focus-visible:outline-none`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the preview`,"aria-controls":`vitehub-document-preview`,"aria-valuenow":vi.value,"aria-valuemin":320,"aria-valuetext":`Preview ${vi.value} pixels wide`,tabindex:`0`,onPointerdown:Wi,onKeydown:Gi},[j(`div`,{class:G([`mx-auto h-full w-px bg-(--ui-border) transition-colors group-hover:bg-(--ui-border-accented) group-focus-visible:w-0.5 group-focus-visible:bg-primary`,Ui.value?`w-0.5 bg-primary`:``])},null,2)],40,c$)):M(``,!0),H(Dq,{id:`vitehub-document-preview`,view:mi.value,"onUpdate:view":a[16]||=e=>mi.value=e,viewport:hi.value,"onUpdate:viewport":a[17]||=e=>hi.value=e,class:G(wi.value?`shrink-0`:`absolute inset-0 z-20`),style:re(wi.value?{width:`${vi.value}px`}:void 0),client:n.client,collection:n.collection,"document-id":on.value,url:fi.value,document:Ii.value,"text-fields":Li.value,local:qe.value,highlight:_i.value,reloads:gi.value,overlay:!wi.value,onClose:a[18]||=e=>Fi(!1),onSelect:Bi,onEdit:Vi},null,8,[`view`,`viewport`,`class`,`style`,`client`,`collection`,`document-id`,`url`,`document`,`text-fields`,`local`,`highlight`,`reloads`,`overlay`]),Ui.value?(J(),b(`div`,l$)):M(``,!0)],64)):M(``,!0)],512),H(w,{open:le.value&&!!ce.value,title:`This ${y.value.toLowerCase()} changed since you opened it`,description:`Someone saved a newer version, so saving paused. Compare it with yours, then choose which one to keep.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[20]||=e=>{e||(le.value=!1)}},{body:i(()=>[ce.value?(J(),b(`div`,u$,[j(`p`,d$,[a[50]||=j(`span`,{class:`font-medium text-highlighted`},`Removed lines`,-1),a[51]||=K(` are in the saved version, `,-1),a[52]||=j(`span`,{class:`font-medium text-highlighted`},`added lines`,-1),a[53]||=K(` are yours. `,-1),ce.value.theirs?M(``,!0):(J(),b(O,{key:0},[K(` The saved version deleted this `+q(y.value.toLowerCase())+`.`,1)],64))]),H(XK,{before:ce.value.theirs?{body:ce.value.theirs.body,data:ce.value.theirs.data}:null,after:ce.value.mine,format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])])):M(``,!0)]),footer:i(()=>[j(`div`,f$,[H(c,{variant:`ghost`,label:`Keep editing`,onClick:a[19]||=e=>le.value=!1}),H(c,{variant:`outline`,label:`Load theirs`,onClick:vr}),H(c,{color:`error`,label:`Overwrite with mine`,loading:ie.value,onClick:_r},null,8,[`loading`])])]),_:1},8,[`open`,`title`]),H(w,{open:$e.value,title:`Apply your local edits?`,description:`Collaborative edits the shared draft. Save your local edits to it first, or discard them.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[23]||=e=>{e||($e.value=!1)}},{body:i(()=>[Xe.value?(J(),k(XK,{key:0,before:Xe.value,after:{body:B.value.body,data:Ln(B.value.data)},format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])):M(``,!0)]),footer:i(()=>[j(`div`,p$,[H(c,{variant:`ghost`,label:`Keep editing locally`,onClick:a[21]||=e=>$e.value=!1}),H(c,{color:`error`,variant:`outline`,label:`Discard local edits`,disabled:et.value,onClick:Tr},null,8,[`disabled`]),H(c,{label:`Apply to shared draft`,loading:et.value,onClick:a[22]||=e=>Er()},null,8,[`loading`])])]),_:1},8,[`open`]),H(w,{open:!!tt.value,title:tt.value&&`failed`in tt.value?`Couldn't read the shared draft`:tt.value&&!tt.value.theirs?`The shared draft was deleted`:`The shared draft changed`,description:tt.value&&`failed`in tt.value?`Someone changed the shared draft after your local edits started from it, so nothing was saved. Read it again to compare. Your local edits stay here.`:tt.value&&!tt.value.theirs?`Someone deleted the shared draft after your local edits started from it, so nothing was saved. Create it again from your local edits, or keep them here.`:`Someone saved the shared draft after your local edits started from it, so nothing was saved. Compare them, then choose.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[26]||=e=>{e||(tt.value=void 0)}},{body:i(()=>[tt.value&&`failed`in tt.value?(J(),b(`p`,m$,q(tt.value.failed),1)):tt.value?(J(),b(`div`,h$,[a[54]||=j(`p`,{class:`text-xs text-muted`},[j(`span`,{class:`font-medium text-highlighted`},`Removed lines`),K(` are in the shared draft, `),j(`span`,{class:`font-medium text-highlighted`},`added lines`),K(` are your local edits. `)],-1),H(XK,{before:tt.value.theirs?{body:tt.value.theirs.body,data:tt.value.theirs.data}:null,after:{body:B.value.body,data:Ln(B.value.data)},format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])])):M(``,!0)]),footer:i(()=>[j(`div`,g$,[H(c,{variant:`ghost`,label:`Keep editing locally`,onClick:a[24]||=e=>tt.value=void 0}),tt.value&&`failed`in tt.value?(J(),k(c,{key:0,label:`Retry`,loading:nt.value,onClick:Dr},null,8,[`loading`])):tt.value?(J(),b(O,{key:1},[H(c,{variant:`outline`,label:`Discard mine`,disabled:et.value,onClick:Tr},null,8,[`disabled`]),H(c,{color:`error`,label:tt.value.theirs?`Overwrite with mine`:`Create again from mine`,loading:et.value,onClick:a[25]||=e=>Er(tt.value.theirs?.digest??null)},null,8,[`label`,`loading`])],64)):M(``,!0)])]),_:1},8,[`open`,`title`,`description`]),H(w,{open:rt.value,title:`Publish the shared draft?`,description:`This publishes the shared draft that everyone edits. Your local edits are not part of it and stay in this tab.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[28]||=e=>{e||(rt.value=!1)}},{body:i(()=>[at.value?(J(),k(Wr,{key:0,label:`Loading the shared draft…`})):it.value?(J(),b(`div`,_$,[a[55]||=j(`p`,{class:`text-xs text-muted`},[j(`span`,{class:`font-medium text-highlighted`},`Removed lines`),K(` are on the site, `),j(`span`,{class:`font-medium text-highlighted`},`added lines`),K(` are the shared draft. `)],-1),H(XK,{before:it.value.site?{body:it.value.site.body,data:it.value.site.data}:null,after:it.value.draft?{body:it.value.draft.body,data:it.value.draft.data}:null,format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])])):M(``,!0)]),footer:i(()=>[j(`div`,v$,[H(c,{variant:`ghost`,label:`Cancel`,onClick:a[27]||=e=>rt.value=!1}),H(c,{label:`Publish shared draft`,disabled:!it.value?.draft,loading:oe.value,onClick:jr},null,8,[`disabled`,`loading`])])]),_:1},8,[`open`]),H(w,{open:we.value,title:`This page also changed on the site`,description:`It changed on the site after your draft started from it, for example with a Git commit. Publishing your draft would erase that change, so nothing was published. Compare them and choose what to keep.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[33]||=e=>{e||(we.value=!1)}},{body:i(()=>[Te.value?(J(),k(Wr,{key:0,label:`Loading the site version…`})):Ee.value?(J(),b(`div`,y$,[j(`p`,b$,q(Ee.value),1),H(c,{variant:`outline`,label:`Retry`,onClick:a[29]||=e=>oi(De.value)})])):Ce.value?(J(),b(`div`,x$,[j(`p`,S$,[a[56]||=j(`span`,{class:`font-medium text-highlighted`},`Removed lines`,-1),a[57]||=K(` are on the site, `,-1),a[58]||=j(`span`,{class:`font-medium text-highlighted`},`added lines`,-1),K(` are `+q(Ce.value.shared?`the shared draft. Your local edits are not part of it`:`your draft`)+`. `,1),Ce.value.site?M(``,!0):(J(),b(O,{key:0},[K(` The site no longer has this `+q(y.value.toLowerCase())+`. Keep `+q(Ce.value.shared?`the shared`:`your`)+` draft to publish it again.`,1)],64))]),H(XK,{before:Ce.value.site?{body:Ce.value.site.body,data:Ce.value.site.data}:null,after:Ce.value.shared?{body:Ce.value.shared.body,data:Ln(Ce.value.shared.data)}:{body:B.value.body,data:Ln(B.value.data)},format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])])):M(``,!0)]),footer:i(()=>[j(`div`,C$,[H(c,{variant:`ghost`,label:`Keep editing`,onClick:a[30]||=e=>we.value=!1}),Ce.value?.site?(J(),k(c,{key:0,variant:`outline`,label:`Use the site version`,loading:Oe.value,onClick:a[31]||=e=>si(`site`)},null,8,[`loading`])):M(``,!0),H(c,{label:Ce.value?.shared?`Keep the shared draft`:`Keep my draft`,disabled:!Ce.value,loading:Oe.value,onClick:a[32]||=e=>si(`draft`)},null,8,[`label`,`disabled`,`loading`])])]),_:1},8,[`open`]),H(w,{open:F(ut),title:Gt.value?Wt.value:Wt.value===`You`?`You're editing this in another tab`:`${Wt.value} is editing this page`,description:Gt.value?F(_t)?`Join to edit together. Everyone's edits save to the draft.`:`Open it read-only until the live session ends.`:Wt.value===`You`?`Open it read-only here, or take over from the other tab. Everything you saved stays in history.`:`Open it read-only, or take over. Everything ${Wt.value} saved stays in history.`,"onUpdate:open":a[34]||=e=>{e||ir()}},e({footer:i(()=>[j(`div`,E$,[H(c,{color:`neutral`,variant:`outline`,label:`Open read-only`,onClick:ir}),We.value&&Gt.value&&F(_t)?(J(),k(c,{key:0,color:`neutral`,label:`Join`,onClick:or})):We.value&&!Gt.value?(J(),k(c,{key:1,color:`neutral`,label:`Take over`,onClick:ar})):M(``,!0)])]),_:2},[F(dt)?.since||Ot.value?{name:`body`,fn:i(()=>[F(dt)?.since?(J(),b(`p`,w$,q(Gt.value?`Live since`:`Editing since`)+` `+q(F(Ai)(F(dt).since)),1)):M(``,!0),Ot.value&&!Gt.value?(J(),b(`p`,T$,q(F(Ci)),1)):M(``,!0)]),key:`0`}:void 0]),1032,[`open`,`title`,`description`]),H(w,{open:Zt.value&&!!Qt.value,title:`${Wt.value===`You`?`Your other tab`:Wt.value} took over`,description:`Removed lines are in their saved version, added lines are on your screen.`,ui:{content:`sm:max-w-3xl`},"onUpdate:open":a[36]||=e=>{e||(Zt.value=!1)}},{body:i(()=>[Qt.value?(J(),k(XK,{key:0,before:Qt.value.theirs?{body:Qt.value.theirs.body,data:Qt.value.theirs.data}:null,after:Qt.value.mine,format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])):M(``,!0)]),footer:i(()=>[j(`div`,D$,[H(c,{color:`neutral`,variant:`ghost`,label:`Close`,onClick:a[35]||=e=>Zt.value=!1}),H(c,{color:`neutral`,variant:`outline`,icon:`i-lucide-copy`,label:`Copy mine`,onClick:fr})])]),_:1},8,[`open`,`title`]),H(w,{open:L.value,"onUpdate:open":a[40]||=e=>L.value=e,title:`Schedule publishing`,description:`Publish this draft of ${bn.value} later. Saving it again before then makes the schedule fail instead of publishing changes nobody reviewed.`},{body:i(()=>[j(`div`,O$,[H(P,{label:`Date`,ui:{label:`text-xs`}},{default:i(()=>[H(A,{modelValue:R.value,"onUpdate:modelValue":a[37]||=e=>R.value=e,"min-value":Pr.value,class:`w-40`,"aria-label":`Publish date`},null,8,[`modelValue`,`min-value`])]),_:1}),H(P,{label:`Time`,ui:{label:`text-xs`}},{default:i(()=>[H(ae,{modelValue:ee.value,"onUpdate:modelValue":a[38]||=e=>ee.value=e,"hour-cycle":24,class:`w-24`,"aria-label":`Publish time`},null,8,[`modelValue`])]),_:1}),j(`span`,k$,q(F(te)),1)]),Nr.value?(J(),b(`p`,A$,`Choose a time in the future.`)):M(``,!0)]),footer:i(()=>[j(`div`,j$,[H(c,{variant:`ghost`,label:`Cancel`,onClick:a[39]||=e=>L.value=!1}),H(c,{label:`Schedule`,disabled:!Mr.value||Nr.value,loading:z.value,onClick:Hr},null,8,[`disabled`,`loading`])])]),_:1},8,[`open`,`description`]),H(w,{open:ue.value,"onUpdate:open":a[42]||=e=>ue.value=e,title:`Delete this ${y.value.toLowerCase()}?`,description:`${bn.value} is removed from the draft. It stays on the published site until you publish the deletion, and History can restore it.`},{footer:i(()=>[j(`div`,M$,[H(c,{variant:`ghost`,label:`Cancel`,onClick:a[41]||=e=>ue.value=!1}),H(c,{color:`error`,label:`Delete`,loading:de.value,onClick:Gr},null,8,[`loading`])])]),_:1},8,[`open`,`title`,`description`]),H(U,{open:fe.value,"onUpdate:open":a[45]||=e=>fe.value=e,title:`History`,description:`Saves and publishes of ${on.value}`,ui:{content:`sm:max-w-xl`,footer:`justify-end`}},e({body:i(()=>[be.value?(J(),b(`div`,N$,[j(`div`,P$,[H(c,{variant:`ghost`,size:`xs`,icon:`i-lucide-arrow-left`,label:`All versions`,onClick:a[43]||=e=>be.value=void 0})]),j(`div`,null,[j(`p`,F$,[K(q(F(Be)(be.value.revision))+` `,1),H(Qr,{value:be.value.revision.createdAt},null,8,[`value`]),be.value.revision.author?(J(),b(O,{key:0},[K(` by `+q(be.value.revision.author),1)],64)):M(``,!0)]),a[59]||=j(`p`,{class:`text-xs text-muted`},`Compared with the saved draft.`,-1)]),xe.value?(J(),b(`div`,I$,[H(f,{name:`i-lucide-loader-circle`,class:`size-4 animate-spin text-muted`})])):be.value.document?(J(),k(XK,{key:2,before:be.value.current?.text??null,after:be.value.document.text,format:n.collection.format,name:wn.value},null,8,[`before`,`after`,`format`,`name`])):(J(),b(`p`,L$,`The `+q(y.value.toLowerCase())+` does not exist in this version.`,1))])):(J(),k(pq,{key:1,revisions:pe.value,cursor:me.value,loading:_e.value,error:ve.value,"loaded-at":ye.value,onOpen:Yr,onMore:a[44]||=e=>qr(!0)},null,8,[`revisions`,`cursor`,`loading`,`error`,`loaded-at`]))]),_:2},[be.value?.document&&Xt.value&&!qe.value?{name:`footer`,fn:i(()=>[H(c,{icon:`i-lucide-rotate-ccw`,label:`Restore this version`,loading:Se.value,onClick:Xr},null,8,[`loading`])]),key:`0`}:void 0]),1032,[`open`,`description`])],64)}}}),V$={slots:{base:[`relative group rounded-md inline-flex items-center disabled:cursor-not-allowed disabled:opacity-75`,`transition-colors`],leading:`absolute inset-y-0 start-0 flex items-center`,leadingIcon:`shrink-0 text-dimmed`,leadingAvatar:`shrink-0`,leadingAvatarSize:``,trailing:`absolute inset-y-0 end-0 flex items-center`,trailingIcon:`shrink-0 text-dimmed`,value:`truncate pointer-events-none`,placeholder:`truncate text-dimmed`,arrow:`fill-bg stroke-default`,content:[`max-h-[min(15rem,var(--reka-select-content-available-height,15rem))] w-(--reka-select-trigger-width) bg-default shadow-lg rounded-md ring ring-default overflow-hidden origin-(--reka-select-content-transform-origin) pointer-events-auto data-[state=closed]:pointer-events-none! flex flex-col`,`max-h-[min(15rem,var(--reka-combobox-content-available-height,15rem))] origin-(--reka-combobox-content-transform-origin) w-(--reka-combobox-trigger-width)`],viewport:`relative scroll-py-1 overflow-y-auto flex-1`,group:`p-1 isolate`,empty:`text-center text-muted`,label:`font-semibold text-highlighted`,separator:`-mx-1 my-1 h-px bg-border`,item:[`group relative w-full flex items-start select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75 text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50`,`transition-colors before:transition-colors`],itemLeadingIcon:[`shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default`,`transition-colors`],itemLeadingAvatar:`shrink-0`,itemLeadingAvatarSize:``,itemLeadingChip:`shrink-0`,itemLeadingChipSize:``,itemTrailing:`ms-auto inline-flex gap-1.5 items-center`,itemTrailingIcon:`shrink-0`,itemWrapper:`flex-1 flex flex-col min-w-0`,itemLabel:`truncate`,itemDescription:`truncate text-muted`,input:`border-b border-default`,focusScope:`flex flex-col min-h-0`,trailingClear:`p-0`},variants:{fieldGroup:{horizontal:`not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]`,vertical:`not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]`},size:{xs:{base:`px-2 py-1 text-sm/4 gap-1`,leading:`ps-2`,trailing:`pe-2`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,label:`p-1 text-[10px]/3 gap-1`,item:`p-1 text-xs gap-1`,itemLeadingIcon:`size-4`,itemLeadingAvatarSize:`3xs`,itemLeadingChip:`size-4`,itemLeadingChipSize:`sm`,itemTrailingIcon:`size-4`,empty:`p-2 text-xs`},sm:{base:`px-2.5 py-1.5 text-sm/4 gap-1.5`,leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-4`,leadingAvatarSize:`3xs`,trailingIcon:`size-4`,label:`p-1.5 text-[10px]/3 gap-1.5`,item:`p-1.5 text-xs gap-1.5`,itemLeadingIcon:`size-4`,itemLeadingAvatarSize:`3xs`,itemLeadingChip:`size-4`,itemLeadingChipSize:`sm`,itemTrailingIcon:`size-4`,empty:`p-2.5 text-xs`},md:{base:`px-2.5 py-1.5 text-base/5 gap-1.5`,leading:`ps-2.5`,trailing:`pe-2.5`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,label:`p-1.5 text-xs gap-1.5`,item:`p-1.5 text-sm gap-1.5`,itemLeadingIcon:`size-5`,itemLeadingAvatarSize:`2xs`,itemLeadingChip:`size-5`,itemLeadingChipSize:`md`,itemTrailingIcon:`size-5`,empty:`p-2.5 text-sm`},lg:{base:`px-3 py-2 text-base/5 gap-2`,leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-5`,leadingAvatarSize:`2xs`,trailingIcon:`size-5`,label:`p-2 text-xs gap-2`,item:`p-2 text-sm gap-2`,itemLeadingIcon:`size-5`,itemLeadingAvatarSize:`2xs`,itemLeadingChip:`size-5`,itemLeadingChipSize:`md`,itemTrailingIcon:`size-5`,empty:`p-3 text-sm`},xl:{base:`px-3 py-2 text-base gap-2`,leading:`ps-3`,trailing:`pe-3`,leadingIcon:`size-6`,leadingAvatarSize:`xs`,trailingIcon:`size-6`,label:`p-2 text-sm gap-2`,item:`p-2 text-base gap-2`,itemLeadingIcon:`size-6`,itemLeadingAvatarSize:`xs`,itemLeadingChip:`size-6`,itemLeadingChipSize:`lg`,itemTrailingIcon:`size-6`,empty:`p-3 text-base`}},variant:{outline:`text-highlighted bg-default ring ring-inset ring-accented hover:bg-elevated disabled:bg-default`,soft:`text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50`,subtle:`text-highlighted bg-elevated ring ring-inset ring-accented hover:bg-accented/75 disabled:bg-elevated`,ghost:`text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent`,none:`text-highlighted bg-transparent focus:outline-none`},color:{primary:``,secondary:``,success:``,info:``,warning:``,error:``,neutral:``},leading:{true:``},trailing:{true:``},loading:{true:``},highlight:{true:``},fixed:{false:``},type:{file:`file:me-1.5 file:font-medium file:text-muted file:outline-none`},position:{popper:{content:`data-[state=open]:animate-[scale-in_100ms_var(--ease-out)] data-[state=closed]:animate-[scale-out_100ms_var(--ease-out)]`},"item-aligned":{content:``}},multiple:{true:``},virtualize:{true:{viewport:`p-1 isolate`},false:{viewport:`divide-y divide-default`}}},compoundVariants:[{color:`primary`,variant:[`outline`,`subtle`],class:`outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary`},{color:`secondary`,variant:[`outline`,`subtle`],class:`outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary`},{color:`success`,variant:[`outline`,`subtle`],class:`outline-success/25 focus-visible:outline-3 focus-visible:ring-success`},{color:`info`,variant:[`outline`,`subtle`],class:`outline-info/25 focus-visible:outline-3 focus-visible:ring-info`},{color:`warning`,variant:[`outline`,`subtle`],class:`outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning`},{color:`error`,variant:[`outline`,`subtle`],class:`outline-error/25 focus-visible:outline-3 focus-visible:ring-error`},{color:`primary`,variant:[`soft`,`ghost`],class:`outline-primary/25 focus-visible:outline-3`},{color:`secondary`,variant:[`soft`,`ghost`],class:`outline-secondary/25 focus-visible:outline-3`},{color:`success`,variant:[`soft`,`ghost`],class:`outline-success/25 focus-visible:outline-3`},{color:`info`,variant:[`soft`,`ghost`],class:`outline-info/25 focus-visible:outline-3`},{color:`warning`,variant:[`soft`,`ghost`],class:`outline-warning/25 focus-visible:outline-3`},{color:`error`,variant:[`soft`,`ghost`],class:`outline-error/25 focus-visible:outline-3`},{color:`primary`,highlight:!0,class:`ring ring-inset ring-primary`},{color:`secondary`,highlight:!0,class:`ring ring-inset ring-secondary`},{color:`success`,highlight:!0,class:`ring ring-inset ring-success`},{color:`info`,highlight:!0,class:`ring ring-inset ring-info`},{color:`warning`,highlight:!0,class:`ring ring-inset ring-warning`},{color:`error`,highlight:!0,class:`ring ring-inset ring-error`},{color:`neutral`,variant:[`outline`,`subtle`],class:`outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted`},{color:`neutral`,variant:[`soft`,`ghost`],class:`outline-inverted/25 focus-visible:outline-3`},{color:`neutral`,highlight:!0,class:`ring ring-inset ring-inverted`},{leading:!0,size:`xs`,class:`ps-7`},{leading:!0,size:`sm`,class:`ps-8`},{leading:!0,size:`md`,class:`ps-9`},{leading:!0,size:`lg`,class:`ps-10`},{leading:!0,size:`xl`,class:`ps-11`},{trailing:!0,size:`xs`,class:`pe-7`},{trailing:!0,size:`sm`,class:`pe-8`},{trailing:!0,size:`md`,class:`pe-9`},{trailing:!0,size:`lg`,class:`pe-10`},{trailing:!0,size:`xl`,class:`pe-11`},{loading:!0,leading:!0,class:{leadingIcon:`animate-spin`}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:`animate-spin`}},{fixed:!1,size:`xs`,class:`md:text-xs`},{fixed:!1,size:`sm`,class:`md:text-xs`},{fixed:!1,size:`md`,class:`md:text-sm`},{fixed:!1,size:`lg`,class:`md:text-sm`}],defaultVariants:{size:`md`,color:`primary`,variant:`outline`,position:`popper`}},H$=Object.assign({inheritAttrs:!1},{__name:`SelectMenu`,props:z({id:{type:String,required:!1},placeholder:{type:String,required:!1},searchInput:{type:[Boolean,Object],required:!1,default:!0},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},selectedIcon:{type:null,required:!1},clear:{type:[Boolean,Object],required:!1},clearIcon:{type:null,required:!1},content:{type:Object,required:!1},arrow:{type:[Boolean,Object],required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},virtualize:{type:[Boolean,Object],required:!1,default:!1},valueKey:{type:null,required:!1},labelKey:{type:null,required:!1,default:`label`},descriptionKey:{type:null,required:!1,default:`description`},items:{type:null,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},multiple:{type:Boolean,required:!1},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},createItem:{type:[Boolean,String,Object],required:!1},filterFields:{type:Array,required:!1},ignoreFilter:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},class:{type:null,required:!1},ui:{type:Object,required:!1},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},resetSearchTermOnBlur:{type:Boolean,required:!1,default:!0},resetSearchTermOnSelect:{type:Boolean,required:!1,default:!0},resetModelValueOnClear:{type:Boolean,required:!1,default:!0},highlightOnHover:{type:Boolean,required:!1},by:{type:[String,Function],required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},{searchTerm:{type:String,default:``},searchTermModifiers:{}}),emits:z([`change`,`blur`,`focus`,`create`,`clear`,`highlight`,`update:modelValue`,`update:open`],[`update:searchTerm`]),setup(e,{expose:t,emit:n}){let r=e,a=n,l=y(),d=hr(`selectMenu`,r),m=_(e,`searchTerm`,{type:String,default:``}),{t:h}=Ln(),g=_e(),{filterGroups:v}=bn(),x=mr(C(d,`modelValue`,`defaultValue`,`open`,`defaultOpen`,`required`,`multiple`,`resetSearchTermOnBlur`,`resetSearchTermOnSelect`,`resetModelValueOnClear`,`highlightOnHover`,`by`),a),S=Bn(fe(()=>d.portal)),w=fe(()=>Fn(d.content,{side:`bottom`,sideOffset:8,collisionPadding:8,position:`popper`})),T=fe(()=>Fn(d.arrow,{rounded:!0})),D=p(()=>typeof d.clear==`object`?d.clear:{}),N=fe(()=>d.virtualize?Fn(typeof d.virtualize==`boolean`?{}:d.virtualize,{estimateSize:Rt(Ne.value,Se.value??`md`,d.descriptionKey,!!l[`item-description`])}):!1),P=fe(()=>Fn(d.searchInput,{placeholder:h(`selectMenu.search`),variant:`none`,fixed:d.fixed})),{emitFormBlur:I,emitFormFocus:L,emitFormInput:z,emitFormChange:te,size:B,color:V,id:ne,name:re,highlight:ie,disabled:oe,ariaAttrs:ce}=pr(r),{orientation:le,size:ue}=fr(r),{isLeading:pe,isTrailing:me,leadingIconName:ve,trailingIconName:ye}=ur(p(()=>({icon:d.icon,leading:d.leading,leadingIcon:d.leadingIcon,trailing:d.trailing,trailingIcon:d.trailingIcon??g.ui.icons.chevronDown,loading:d.loading,loadingIcon:d.loadingIcon}))),be=p(()=>V.value??d.color),xe=p(()=>ie.value??d.highlight),Se=p(()=>ue.value??B.value??d.size),Ce=p(()=>oe.value??d.disabled),[we,Te]=de(),[Ee,De]=de({props:{item:{type:[Object,String,Number,Boolean],required:!0},index:{type:Number,required:!1}}}),Oe=p(()=>nr({extend:V$,...g.ui?.selectMenu||{}})({color:be.value,variant:d.variant,size:Se.value,loading:d.loading,highlight:xe.value,fixed:d.fixed,leading:pe.value||!!d.avatar||!!l.leading,trailing:me.value||!!l.trailing,fieldGroup:le.value,virtualize:!!d.virtualize,multiple:d.multiple}));function ke(e){if(d.multiple&&Array.isArray(e)){let t=e.map(e=>Kn(je.value,e,{labelKey:d.labelKey,valueKey:d.valueKey,by:d.by})).filter(e=>e!=null&&e!==``);return t.length>0?t.join(`, `):void 0}return Kn(je.value,e,{labelKey:d.labelKey,valueKey:d.valueKey,by:d.by})}let Ae=p(()=>d.items?.length?qn(d.items)?d.items:[d.items]:[]),je=p(()=>Ae.value.flatMap(e=>e)),Me=p(()=>{if(d.ignoreFilter||!m.value)return Ae.value;let e=Array.isArray(d.filterFields)?d.filterFields:[d.labelKey];return v(Ae.value,m.value,{fields:e,isStructural:e=>Ke(e)&&!!e.type&&[`label`,`separator`].includes(e.type)})}),Ne=p(()=>Me.value.flatMap(e=>e)),Pe=p(()=>{if(!d.createItem||!m.value)return!1;let e=d.valueKey?{[d.valueKey]:m.value}:m.value;return typeof d.createItem==`object`&&d.createItem.when===`always`||d.createItem===`always`?!Ne.value.find(t=>Yn(t,e,d.by??d.valueKey)):!Ne.value.length}),Fe=p(()=>typeof d.createItem==`object`?d.createItem.position:`bottom`),Ie=c(`triggerRef`);function Le(){d.autofocus&&Ie.value?.$el?.focus({focusVisible:!0})}let Re;he(()=>{Re=setTimeout(()=>{Le()},d.autofocusDelay)}),se(()=>clearTimeout(Re));function ze(e){if(ee(d.modelValue)===e)return;d.modelModifiers?.trim&&(typeof e==`string`||e==null)&&(e=e?.trim()??null),d.modelModifiers?.number&&(e=Zn(e)),d.modelModifiers?.nullable&&(e??=null),d.modelModifiers?.optional&&!d.modelModifiers?.nullable&&e!==null&&(e??=void 0);let t=new Event(`change`,{target:{value:e}});a(`change`,t),te(),z(),d.resetSearchTermOnSelect&&(m.value=``)}let Be=A(!1),Ve;se(()=>clearTimeout(Ve));function He(e){if(Be.value=e,e){let e=new FocusEvent(`focus`);a(`focus`,e),L(),clearTimeout(Ve)}else{let e=new FocusEvent(`blur`);a(`blur`,e),I(),d.resetSearchTermOnBlur&&(Ve=setTimeout(()=>{m.value=``},100))}}function Ue(e){if(Be.value)return;let t=e.currentTarget;e.preventDefault(),t.click()}function We(e){e.preventDefault(),e.stopPropagation(),a(`create`,m.value)}function Ge(e,t){if(Ke(t)){if(t.disabled){e.preventDefault();return}t.onSelect?.(e)}}function Ke(e){return typeof e==`object`&&!!e}function qe(e){return d.multiple&&Array.isArray(e)?e.length===0:e==null||e===``}function Je(){Ce.value||a(`clear`)}function Ye(e){P.value.autofocus===!1&&e.preventDefault()}function Xe(e){let t=document.activeElement;t&&t!==document.body&&!e.target.contains(t)&&e.preventDefault()}let Ze=c(`viewportRef`),Qe=c(`comboboxRootRef`);return f(()=>d.items,async()=>{Be.value&&d.createItem&&(await ae(),Qe.value?.highlightFirstItem?.())},{flush:`post`}),t({triggerRef:fe(()=>Ie.value?.$el),viewportRef:fe(()=>Ze.value)}),(e,t)=>(J(),b(O,null,[H(F(we),null,{default:i(()=>[H(F(Ji),{"data-slot":`item`,class:G(Oe.value.item({class:F(d).ui?.item})),value:m.value,onSelect:We},{default:i(()=>[j(`span`,{"data-slot":`itemLabel`,class:G(Oe.value.itemLabel({class:F(d).ui?.itemLabel}))},[o(e.$slots,`create-item-label`,{item:m.value},()=>[K(q(F(h)(`selectMenu.create`,{label:m.value})),1)])],2)]),_:3},8,[`class`,`value`])]),_:3}),H(F(Ee),null,{default:i(({item:t,index:n})=>[Ke(t)&&t.type===`label`?(J(),k(F(Xi),{key:0,"data-slot":`label`,class:G(Oe.value.label({class:[F(d).ui?.label,t.ui?.label,t.class]}))},{default:i(()=>[K(q(F(Xn)(t,F(d).labelKey)),1)]),_:2},1032,[`class`])):Ke(t)&&t.type===`separator`?(J(),k(F(Qi),{key:1,"data-slot":`separator`,class:G(Oe.value.separator({class:[F(d).ui?.separator,t.ui?.separator,t.class]}))},null,8,[`class`])):(J(),k(F(Ji),{key:2,"data-slot":`item`,class:G(Oe.value.item({class:[F(d).ui?.item,Ke(t)&&t.ui?.item,Ke(t)&&t.class]})),disabled:Ke(t)&&t.disabled,value:F(d).valueKey&&Ke(t)?F(Xn)(t,F(d).valueKey):t,onSelect:e=>Ge(e,t)},{default:i(()=>[o(e.$slots,`item`,{item:t,index:n,ui:Oe.value},()=>[o(e.$slots,`item-leading`,{item:t,index:n,ui:Oe.value},()=>[Ke(t)&&t.icon?(J(),k(ge,{key:0,name:t.icon,"data-slot":`itemLeadingIcon`,class:G(Oe.value.itemLeadingIcon({class:[F(d).ui?.itemLeadingIcon,t.ui?.itemLeadingIcon]}))},null,8,[`name`,`class`])):Ke(t)&&t.avatar?(J(),k(sr,W({key:1,size:t.ui?.itemLeadingAvatarSize||F(d).ui?.itemLeadingAvatarSize||Oe.value.itemLeadingAvatarSize()},t.avatar,{"data-slot":`itemLeadingAvatar`,class:Oe.value.itemLeadingAvatar({class:[F(d).ui?.itemLeadingAvatar,t.ui?.itemLeadingAvatar]})}),null,16,[`size`,`class`])):Ke(t)&&t.chip?(J(),k(or,W({key:2,size:t.ui?.itemLeadingChipSize||F(d).ui?.itemLeadingChipSize||Oe.value.itemLeadingChipSize(),inset:``,standalone:``},t.chip,{"data-slot":`itemLeadingChip`,class:Oe.value.itemLeadingChip({class:[F(d).ui?.itemLeadingChip,t.ui?.itemLeadingChip]})}),null,16,[`size`,`class`])):M(``,!0)]),j(`span`,{"data-slot":`itemWrapper`,class:G(Oe.value.itemWrapper({class:[F(d).ui?.itemWrapper,Ke(t)&&t.ui?.itemWrapper]}))},[j(`span`,{"data-slot":`itemLabel`,class:G(Oe.value.itemLabel({class:[F(d).ui?.itemLabel,Ke(t)&&t.ui?.itemLabel]}))},[o(e.$slots,`item-label`,{item:t,index:n},()=>[K(q(Ke(t)?F(Xn)(t,F(d).labelKey):t),1)])],2),Ke(t)&&(F(Xn)(t,F(d).descriptionKey)||l[`item-description`])?(J(),b(`span`,{key:0,"data-slot":`itemDescription`,class:G(Oe.value.itemDescription({class:[F(d).ui?.itemDescription,Ke(t)&&t.ui?.itemDescription]}))},[o(e.$slots,`item-description`,{item:t,index:n},()=>[K(q(F(Xn)(t,F(d).descriptionKey)),1)])],2)):M(``,!0)],2),j(`span`,{"data-slot":`itemTrailing`,class:G(Oe.value.itemTrailing({class:[F(d).ui?.itemTrailing,Ke(t)&&t.ui?.itemTrailing]}))},[o(e.$slots,`item-trailing`,{item:t,index:n,ui:Oe.value}),H(F(Yi),{"as-child":``},{default:i(()=>[H(ge,{name:F(d).selectedIcon||F(g).ui.icons.check,"data-slot":`itemTrailingIcon`,class:G(Oe.value.itemTrailingIcon({class:[F(d).ui?.itemTrailingIcon,Ke(t)&&t.ui?.itemTrailingIcon]}))},null,8,[`name`,`class`])]),_:2},1024)],2)])]),_:2},1032,[`class`,`disabled`,`value`,`onSelect`]))]),_:3}),H(F(Fi),W({ref_key:`comboboxRootRef`,ref:Qe},F(x),{"ignore-filter":``,"as-child":``,name:F(re),disabled:Ce.value,"onUpdate:modelValue":ze,"onUpdate:open":He}),{default:i(({modelValue:n,open:r})=>[H(F(Ii),{"as-child":``},{default:i(()=>[H(F($i),W({id:F(ne),ref_key:`triggerRef`,ref:Ie,"data-slot":`base`,class:Oe.value.base({class:[F(d).ui?.base,F(d).class]}),tabindex:`0`},{"aria-label":void 0,...e.$attrs,...F(ce)},{onKeydown:[E(Ue,[`down`]),E(Ue,[`up`])]}),{default:i(()=>[F(pe)||F(d).avatar||l.leading?(J(),b(`span`,{key:0,"data-slot":`leading`,class:G(Oe.value.leading({class:F(d).ui?.leading}))},[o(e.$slots,`leading`,{modelValue:n,open:r,ui:Oe.value},()=>[F(pe)&&F(ve)?(J(),k(ge,{key:0,name:F(ve),"data-slot":`leadingIcon`,class:G(Oe.value.leadingIcon({class:F(d).ui?.leadingIcon}))},null,8,[`name`,`class`])):F(d).avatar?(J(),k(sr,W({key:1,size:F(d).ui?.itemLeadingAvatarSize||Oe.value.itemLeadingAvatarSize()},F(d).avatar,{"data-slot":`itemLeadingAvatar`,class:Oe.value.itemLeadingAvatar({class:F(d).ui?.itemLeadingAvatar})}),null,16,[`size`,`class`])):M(``,!0)])],2)):M(``,!0),o(e.$slots,`default`,{modelValue:n,open:r,ui:Oe.value},()=>[(J(!0),b(O,null,s([ke(n)],e=>(J(),b(O,{key:e},[e==null?(J(),b(`span`,{key:1,"data-slot":`placeholder`,class:G(Oe.value.placeholder({class:F(d).ui?.placeholder}))},q(F(d).placeholder??`\xA0`),3)):(J(),b(`span`,{key:0,"data-slot":`value`,class:G(Oe.value.value({class:F(d).ui?.value}))},q(e),3))],64))),128))]),F(me)||l.trailing||F(d).clear?(J(),b(`span`,{key:1,"data-slot":`trailing`,class:G(Oe.value.trailing({class:F(d).ui?.trailing}))},[o(e.$slots,`trailing`,{modelValue:n,open:r,ui:Oe.value},()=>[F(d).clear&&!Ce.value&&!qe(n)?(J(),k(F(Vi),{key:0,"as-child":``},{default:i(()=>[H(dr,W({as:`span`,icon:F(d).clearIcon||F(g).ui.icons.close,size:Se.value,variant:`link`,color:`neutral`,tabindex:`-1`},D.value,{"data-slot":`trailingClear`,class:Oe.value.trailingClear({class:F(d).ui?.trailingClear}),onClick:u(Je,[`stop`])}),null,16,[`icon`,`size`,`class`])]),_:1})):F(ye)?(J(),k(ge,{key:1,name:F(ye),"data-slot":`trailingIcon`,class:G(Oe.value.trailingIcon({class:F(d).ui?.trailingIcon}))},null,8,[`name`,`class`])):M(``,!0)])],2)):M(``,!0)]),_:2},1040,[`id`,`class`])]),_:2},1024),H(F(Zi),R(U(F(S))),{default:i(()=>[H(F(ir),null,{default:i(()=>[H(F(Hi),W({"data-slot":`content`,class:Oe.value.content({class:F(d).ui?.content})},w.value),{default:i(()=>[H(F(Ir),{loop:``,"data-slot":`focusScope`,class:G(Oe.value.focusScope({class:F(d).ui?.focusScope})),onMountAutoFocus:Ye,onUnmountAutoFocus:Xe},{default:i(()=>[o(e.$slots,`content-top`),F(d).searchInput?(J(),k(F(qi),{key:0,modelValue:m.value,"onUpdate:modelValue":t[1]||=e=>m.value=e,"display-value":()=>m.value,"as-child":``},{default:i(()=>[H(Sn,W({autofocus:``,autocomplete:`off`,size:Se.value},P.value,{"model-modifiers":{trim:F(d).modelModifiers?.trim},"data-slot":`input`,class:Oe.value.input({class:F(d).ui?.input}),onChange:t[0]||=u(()=>{},[`stop`])}),null,16,[`size`,`model-modifiers`,`class`])]),_:1},8,[`modelValue`,`display-value`])):M(``,!0),H(F(Ui),{"data-slot":`empty`,class:G(Oe.value.empty({class:F(d).ui?.empty}))},{default:i(()=>[o(e.$slots,`empty`,{searchTerm:m.value},()=>[K(q(m.value?F(h)(`selectMenu.noMatch`,{searchTerm:m.value}):F(h)(`selectMenu.noData`)),1)])]),_:3},8,[`class`]),j(`div`,{ref_key:`viewportRef`,ref:Ze,role:`presentation`,"data-slot":`viewport`,class:G(Oe.value.viewport({class:F(d).ui?.viewport}))},[F(d).virtualize?(J(),b(O,{key:0},[Pe.value&&Fe.value===`top`?(J(),k(F(Te),{key:0})):M(``,!0),H(F(ea),W({options:Ne.value,"text-content":e=>Ke(e)?F(Xn)(e,F(d).labelKey):String(e)},N.value),{default:i(({option:e,virtualItem:t})=>[H(F(De),{item:e,index:t.index},null,8,[`item`,`index`])]),_:1},16,[`options`,`text-content`]),Pe.value&&Fe.value===`bottom`?(J(),k(F(Te),{key:1})):M(``,!0)],64)):(J(),b(O,{key:1},[Pe.value&&Fe.value===`top`?(J(),k(F(Ki),{key:0,"data-slot":`group`,class:G(Oe.value.group({class:F(d).ui?.group}))},{default:i(()=>[H(F(Te))]),_:1},8,[`class`])):M(``,!0),(J(!0),b(O,null,s(Me.value,(e,t)=>(J(),k(F(Ki),{key:`group-${t}`,"data-slot":`group`,class:G(Oe.value.group({class:F(d).ui?.group}))},{default:i(()=>[(J(!0),b(O,null,s(e,(e,n)=>(J(),k(F(De),{key:`group-${t}-${n}`,item:e,index:n},null,8,[`item`,`index`]))),128))]),_:2},1032,[`class`]))),128)),Pe.value&&Fe.value===`bottom`?(J(),k(F(Ki),{key:1,"data-slot":`group`,class:G(Oe.value.group({class:F(d).ui?.group}))},{default:i(()=>[H(F(Te))]),_:1},8,[`class`])):M(``,!0)],64))],2),o(e.$slots,`content-bottom`)]),_:3},8,[`class`]),F(d).arrow?(J(),k(F(Bi),W({key:0},T.value,{"data-slot":`arrow`,class:Oe.value.arrow({class:F(d).ui?.arrow})}),null,16,[`class`])):M(``,!0)]),_:3},16,[`class`])]),_:3})]),_:3},16)]),_:3},16,[`name`,`disabled`])],64))}}),U$={class:`grid max-w-72 gap-3 p-3`},W$={class:`text-[13px] text-muted`},G$={class:`flex justify-end gap-2`},K$={key:0,class:`flex flex-wrap items-center gap-1.5`},q$={class:`ms-auto flex items-center gap-2`},J$={class:`grid w-64 gap-3 p-3`},Y$={key:0,class:`flex items-center gap-3 border-b border-default px-4 py-1.5`},X$={class:`min-w-0 flex-1 text-[13px] text-muted tabular-nums`},Z$={class:`sr-only`,role:`status`},Q$=[`aria-busy`],$$={key:3,class:`w-full table-fixed text-left`,"aria-label":`Documents`},e1={class:`sticky top-0 z-10 bg-default text-xs text-muted shadow-[inset_0_-1px_0_var(--ui-border)]`},t1={class:`h-9`},n1={key:0,class:`w-10 ps-4 font-medium`},r1={key:1,class:`hidden w-40 px-2 font-medium lg:table-cell`},i1={key:2,class:`hidden w-32 px-2 font-medium md:table-cell`},a1={class:`divide-y divide-default`},o1={key:0,class:`ps-4`},s1={class:`px-2 py-2 sm:py-1.5`},c1={class:`mb-1 h-4`},l1={key:0,class:`text-xs text-muted`},u1={class:`hidden px-2 sm:table-cell`},d1={key:1,class:`hidden px-2 lg:table-cell`},f1={key:2,class:`hidden px-2 md:table-cell`},p1={class:`hidden px-4 sm:table-cell`},m1=[`onClick`],h1=[`href`,`onClick`],g1={class:`flex min-w-0 items-center gap-2`},_1={class:`block truncate font-mono text-xs text-dimmed`},v1={class:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-3 sm:hidden`},y1={class:`hidden px-2 sm:table-cell`},b1={class:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-0.5`},x1={key:1,class:`hidden truncate px-2 text-[13px] text-muted lg:table-cell`},S1={key:2,class:`hidden truncate px-2 text-[13px] tabular-nums text-muted md:table-cell`},C1={class:`hidden truncate pe-4 ps-2 text-right text-[13px] text-muted sm:table-cell`},w1={key:1},T1={key:4,class:`flex justify-center p-4`},E1={key:5,class:`flex flex-wrap gap-x-3 px-4 py-3 text-xs text-muted`},D1={key:0},O1={class:`tabular-nums`},k1={key:0},A1={key:1},j1=`*`,M1=V({__name:`console-document-list`,props:{changes:{},client:{},collection:{},setup:{}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,a=cr(),o=Jn(),c=Ye(),{of:l,user:d}=wi({client:n.client,collection:n.collection.name}),m=p(()=>hS(n.collection.schema)),h=p(()=>m.value.filter(e=>e.kind===`enum`||e.kind===`boolean`||e.kind===`string-list`).slice(0,3)),g=p(()=>m.value.find(e=>e.kind===`date`||e.kind===`date-time`)),_=p(()=>m.value.find(e=>e.kind===`string-list`||e.kind===`enum`)),v=p(()=>[...g.value?[{label:`${g.value.label}, newest`,value:`${g.value.name}:desc`},{label:`${g.value.label}, oldest`,value:`${g.value.name}:asc`}]:[],...n.collection.titleField?[{label:`Title A–Z`,value:`${n.collection.titleField}:asc`}]:[],{label:`Id A–Z`,value:`id:asc`}]),y=p(()=>v.value[0].value);function x(){return qe(a.query,{facets:h.value.map(e=>e.name),sorts:v.value.map(e=>e.value)})}let S=x(),C=A(S.search),w=A(S.state),T=A(S.sort),E=A(S.filters),D=A([]),N=A(),I=A(!1),L=A(!1),R=A(),ee=A(new Set),z=A(!1),te=A(!1),B=A(),V=0,ne,re=p(()=>N.value?.states??{changed:0,deleted:0,draft:0,published:0}),ie=p(()=>re.value.draft+re.value.changed+re.value.published),ae=p(()=>N.value?.changes.filter(e=>!e.issues)??[]),oe=p(()=>(N.value?.changes.length??0)-ae.value.length),U=p(()=>ae.value.length),W=p(()=>[{label:`All`,value:`all`,count:ie.value},{label:`Drafts`,value:`draft`,count:re.value.draft},{label:`Changed`,value:`changed`,count:re.value.changed},{label:`Published`,value:`published`,count:re.value.published},...re.value.deleted||w.value===`deleted`?[{label:`Deleted`,value:`deleted`,count:re.value.deleted}]:[],...N.value?.scheduled||w.value===`scheduled`?[{label:`Scheduled`,value:`scheduled`,count:N.value?.scheduled??0}]:[]].map(({count:e,...t})=>({...t,badge:{class:`min-w-5 justify-center rounded-full tabular-nums`,color:`neutral`,label:N.value?String(e):`…`,variant:`soft`}}))),se=p(()=>D.value.filter(e=>ee.value.has(e.id)&&e.state!==`published`).map(e=>({digest:e.digest,id:e.id}))),ce=p(()=>Object.entries(E.value).filter(([,e])=>e&&e!==j1).map(([e,t])=>({label:h.value.find(t=>t.name===e)?.label??e,name:e,value:t}))),le=p(()=>{let e=n.collection.label.toLowerCase();if(C.value.trim())return{action:!0,description:`Nothing matches “${C.value.trim()}”${ce.value.length||w.value!==`all`?` with these filters`:``}.`,title:`No matching documents`};if(ce.value.length)return{action:!0,description:`Nothing matches these filters.`,title:`No matching documents`};if(w.value===`draft`)return{action:!1,description:`New ${e} stay here until you publish them.`,title:`No drafts`};if(w.value===`changed`)return{action:!1,description:`Published documents with unpublished edits show here.`,title:`No unpublished changes`};if(w.value===`deleted`)return{action:!1,description:`Documents deleted from the draft stay here until you publish the deletion.`,title:`Nothing deleted`};if(w.value===`published`)return{action:!1,description:`Published documents are on the site.`,title:`Nothing published yet`};if(w.value===`scheduled`)return{action:!1,description:n.setup?.schedule?Et(n.setup.schedule.message):`Schedule a publish from the arrow next to Publish on a document.`,title:`Nothing scheduled`}}),ue=A({});function de(e,t){let n=ue.value[e]??[];return[{label:`Any ${t.toLowerCase()}`,value:j1},...n.map(e=>({label:`${e.value} (${e.count})`,value:e.value}))]}function fe(){return Object.fromEntries(ce.value.map(e=>[e.name,e.value]))}function pe(e){let t={...E.value};delete t[e],E.value=t}function me(){let e=On({filters:fe(),search:C.value,sort:T.value,state:w.value},y.value);$e(n.collection.name,e),pt(e)!==pt(On(x(),y.value))&&o.replace({query:e})}async function he(e=!1){let t=++V;R.value=void 0,e?L.value=!0:I.value=!0;let[r,i]=T.value.split(`:`);try{let a=await n.client.list(n.collection.name,{cursor:e?N.value?.nextCursor??void 0:void 0,facets:h.value.map(e=>e.name),filter:fe(),limit:50,search:C.value.trim()||void 0,sort:{direction:i===`desc`?`desc`:`asc`,field:r},scheduled:w.value===`scheduled`||void 0,state:w.value===`all`||w.value===`scheduled`?void 0:w.value});if(t!==V)return;D.value=e?[...D.value,...a.items]:a.items,!e&&!ce.value.length&&a.facets&&(ue.value=a.facets),N.value=e?{...a,facets:N.value?.facets??a.facets,states:a.states}:a,R.value=void 0,e||(ee.value=new Set)}catch(e){t===V&&(R.value=e)}finally{t===V&&(I.value=!1,L.value=!1)}}function ge(e){return{name:a.name??void 0,params:{collection:n.collection.name,document:e.id.split(`/`)},query:{}}}function _e(e){o.push(ge(e))}function ve(e){e.target instanceof HTMLElement&&e.target.scrollIntoView({block:`nearest`,inline:`nearest`})}function be(){o.push({name:a.name??void 0,params:{collection:n.collection.name,document:[]},query:{new:`1`}})}function xe(e,t){let n=new Set(ee.value);t===!0?n.add(e):n.delete(e),ee.value=n}let Se=p(()=>!D.value.length||!ee.value.size?!1:D.value.every(e=>ee.value.has(e.id))?!0:`indeterminate`);function Ce(e){ee.value=e===!0?new Set(D.value.map(e=>e.id)):new Set}function we(e){return D.value.find(t=>t.id===e)?.title??e}function Te(){B.value=void 0,he()}async function Ee(e=ae.value){if(z.value||I.value||!e.length)return;let t={items:D.value,page:N.value,selected:ee.value},i=new Set(e.map(e=>e.id)),a={...re.value};D.value=D.value.flatMap(e=>e.state===`published`||!i.has(e.id)?[e]:(a[e.state]--,e.state===`deleted`?[]:(a.published++,[{...e,state:`published`}])));for(let e of N.value?.changes??[])!i.has(e.id)||D.value.some(t=>t.id===e.id)||t.items.some(t=>t.id===e.id)||(a[e.state]--,e.state!==`deleted`&&a.published++);N.value&&={...N.value,changes:N.value.changes.filter(e=>!i.has(e.id)),states:a},ee.value=new Set,te.value=!1,B.value=void 0,z.value=!0;try{let t=(await n.client.publish(n.collection.name,e)).documents.length;t&&c.show({title:t===1?`Change published`:`${t} changes published`}),r(`changed`)}catch(n){D.value=t.items,N.value=t.page,ee.value=t.selected;let r=Tn(n),i=vt(n),a=jn(n);if(i?.length){let e=i[0];B.value={actions:[{color:`neutral`,label:`Open ${we(e.id)}`,onClick:()=>_e({id:e.id}),variant:`outline`}],color:`warning`,description:`Nothing was published. ${i.map(e=>we(e.id)).join(`, `)} also changed on the site after the draft started from ${i.length===1?`it`:`them`}, for example with a Git commit. Open ${i.length===1?`it`:`each one`} to compare and choose what to keep.`,title:i.length===1?`1 document changed on the site too`:`${i.length} documents changed on the site too`}}else if(r){let e=r.map(e=>`${we(e.id)}${e.actual===null?` (deleted)`:``}`).join(`, `);B.value={actions:[{color:`neutral`,label:`Refresh`,onClick:Te,variant:`outline`}],color:`warning`,description:`Nothing was published. ${e} changed after this list loaded. Refresh to review the latest drafts, then publish again.`,title:r.length===1?`1 document changed since you reviewed it`:`${r.length} documents changed since you reviewed them`}}else if(a){let e=rn(n)??[];B.value={actions:[{color:`neutral`,label:`Open ${we(a)}`,onClick:()=>_e({id:a}),variant:`outline`}],color:`error`,description:`Nothing was published. ${wS(m.value,e).map(e=>e.message).join(` `)} Open it, fix the fields, and save before you publish.`,title:`${we(a)} no longer validates`}}else c.error(`Couldn't publish. ${un(n,`Try again.`)}`,{label:`Retry`,onClick:()=>Ee(e)})}finally{z.value=!1}}function De(e,t){if(e==null||e===``)return`—`;if(t===`date`||t===`date-time`){let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e):t.toLocaleDateString(`en`,{day:`numeric`,month:`short`,timeZone:`UTC`,year:`numeric`})}return Array.isArray(e)?e.length?e.join(`, `):`—`:String(e)}return f(C,()=>{ne&&clearTimeout(ne),ne=setTimeout(()=>{me(),he()},200)}),f([w,T,E],()=>{me(),he()},{deep:!0}),f(()=>a.query,()=>{let e=x();e.search!==C.value&&(C.value=e.search),e.state!==w.value&&(w.value=e.state),e.sort!==T.value&&(T.value=e.sort),pt(e.filters)!==pt(fe())&&(E.value=e.filters)}),f(()=>[n.collection.name,n.changes],()=>void he(),{immediate:!0}),$e(n.collection.name,On(S,y.value)),P(()=>{V++,ne&&clearTimeout(ne)}),(t,n)=>{let r=Hr,a=dr,c=Yr,f=Sn,p=Ur,m=H$,y=zr,x=Br,S=Dr,A=Jr,P=Rr,V=ye,ne=Ft;return J(),b(O,null,[H(Si,{title:e.collection.label,description:e.collection.path},{right:i(()=>[z.value?(J(),k(xi,{key:0,label:`Publishing…`,pending:``})):M(``,!0),e.collection.access.publish&&U.value?(J(),k(c,{key:1,open:te.value,"onUpdate:open":n[2]||=e=>te.value=e},{content:i(()=>[j(`div`,U$,[j(`p`,W$,[K(` Copy every draft change of `+q(e.collection.label)+` to the published site: `+q([re.value.draft&&`${re.value.draft} new`,re.value.changed&&`${re.value.changed} changed`,re.value.deleted&&`${re.value.deleted} deleted`].filter(Boolean).join(`, `))+`. `,1),oe.value?(J(),b(O,{key:0},[K(q(oe.value===1?`1 draft with field issues stays`:`${oe.value} drafts with field issues stay`)+` unpublished.`,1)],64)):M(``,!0)]),j(`div`,G$,[H(a,{variant:`ghost`,size:`sm`,label:`Cancel`,onClick:n[0]||=e=>te.value=!1}),H(a,{size:`sm`,label:`Publish all`,loading:z.value,onClick:n[1]||=e=>Ee(ae.value)},null,8,[`loading`])])])]),default:i(()=>[H(a,{variant:`outline`,size:`sm`,label:`Publish`,loading:z.value,disabled:I.value,"aria-label":`Publish ${U.value} ${U.value===1?`change`:`changes`}`},{trailing:i(()=>[H(r,{color:`neutral`,variant:`soft`,size:`sm`,class:`rounded-full tabular-nums`,label:String(U.value)},null,8,[`label`])]),_:1},8,[`loading`,`disabled`,`aria-label`])]),_:1},8,[`open`])):M(``,!0),e.collection.access.write?(J(),k(a,{key:2,size:`sm`,icon:`i-lucide-plus`,label:`New`,onClick:be})):M(``,!0)]),_:1},8,[`title`,`description`]),H(Zr,null,{default:i(()=>[H(f,{modelValue:C.value,"onUpdate:modelValue":n[3]||=e=>C.value=e,class:`w-full sm:w-56`,icon:`i-lucide-search`,size:`sm`,placeholder:`Search ${e.collection.label.toLowerCase()}…`,"aria-label":`Search documents`,ui:{base:`text-base sm:text-sm`}},null,8,[`modelValue`,`placeholder`]),H(p,{modelValue:w.value,"onUpdate:modelValue":n[4]||=e=>w.value=e,items:W.value,content:!1,size:`xs`,variant:`link`,color:`neutral`,class:`min-w-0 max-w-full`,"aria-label":`Filter by state`,"aria-busy":!N.value&&I.value,ui:{list:`max-w-full overflow-x-auto`,trigger:`shrink-0 text-[13px]`},onFocusin:ve},null,8,[`modelValue`,`items`,`aria-busy`]),ce.value.length?(J(),b(`div`,K$,[(J(!0),b(O,null,s(ce.value,e=>(J(),k(a,{key:e.name,variant:`soft`,size:`xs`,"trailing-icon":`i-lucide-x`,label:`${e.label}: ${e.value}`,"aria-label":`Remove filter ${e.label}: ${e.value}`,onClick:t=>pe(e.name)},null,8,[`label`,`aria-label`,`onClick`]))),128))])):M(``,!0),j(`div`,q$,[h.value.length?(J(),k(c,{key:0,content:{align:`end`}},{content:i(()=>[j(`div`,J$,[(J(!0),b(O,null,s(h.value,e=>(J(),k(x,{key:e.name,label:e.label,ui:{label:`text-xs`}},{default:i(()=>[e.kind===`string-list`?(J(),k(m,{key:0,modelValue:E.value[e.name],"onUpdate:modelValue":t=>E.value[e.name]=t,size:`sm`,class:`w-full`,"value-key":`value`,items:de(e.name,e.label),placeholder:`Any ${e.label.toLowerCase()}`,"search-input":{placeholder:`Search ${e.label.toLowerCase()}…`}},null,8,[`modelValue`,`onUpdate:modelValue`,`items`,`placeholder`,`search-input`])):(J(),k(y,{key:1,modelValue:E.value[e.name],"onUpdate:modelValue":t=>E.value[e.name]=t,size:`sm`,class:`w-full`,items:de(e.name,e.label),placeholder:`Any ${e.label.toLowerCase()}`},null,8,[`modelValue`,`onUpdate:modelValue`,`items`,`placeholder`]))]),_:2},1032,[`label`]))),128)),ce.value.length?(J(),k(a,{key:0,class:`justify-self-start`,variant:`link`,size:`xs`,label:`Clear filters`,onClick:n[5]||=e=>E.value={}})):M(``,!0)])]),default:i(()=>[H(a,{variant:`outline`,size:`sm`,icon:`i-lucide-list-filter`,label:`Filter`})]),_:1})):M(``,!0),H(y,{modelValue:T.value,"onUpdate:modelValue":n[6]||=e=>T.value=e,size:`sm`,class:`w-40`,items:v.value,"aria-label":`Sort documents`},null,8,[`modelValue`,`items`])])]),_:1}),e.collection.access.publish&&ee.value.size?(J(),b(`div`,Y$,[j(`p`,X$,q(ee.value.size)+` selected`,1),H(a,{variant:`ghost`,size:`xs`,label:`Clear`,onClick:n[7]||=e=>ee.value=new Set}),se.value.length?(J(),k(a,{key:0,variant:`outline`,size:`xs`,loading:z.value,label:`Publish ${se.value.length}`,onClick:n[8]||=e=>Ee(se.value)},null,8,[`loading`,`label`])):M(``,!0)])):M(``,!0),j(`p`,Z$,q(z.value?`Publishing changes…`:I.value?`Loading documents…`:R.value?`Documents could not be loaded.`:`${N.value?.total??0} documents`),1),j(`div`,{class:`min-h-0 flex-1 overflow-y-auto`,"aria-busy":I.value||L.value||z.value},[B.value?(J(),k(S,{key:0,class:`m-4`,color:B.value.color,variant:`outline`,icon:`i-lucide-circle-alert`,role:`alert`,title:B.value.title,description:B.value.description,actions:B.value.actions,close:``,"onUpdate:open":n[9]||=e=>B.value=void 0},null,8,[`color`,`title`,`description`,`actions`])):M(``,!0),R.value?(J(),k(Ze,{key:1,class:`m-4`,compact:!!D.value.length,title:`Couldn't load ${e.collection.label.toLowerCase()}`,error:R.value,retry:()=>he()},null,8,[`compact`,`title`,`error`,`retry`])):M(``,!0),!I.value&&!R.value&&!D.value.length?(J(),k(A,{key:2,class:`m-4 py-12`,icon:`i-lucide-file-text`,title:le.value?.title??`No ${e.collection.label.toLowerCase()} yet`,description:le.value?.description??(e.collection.access.write?`Create the first document.`:`Documents appear here when someone saves one.`),actions:le.value?le.value.action?[{label:`Clear filters`,color:`neutral`,variant:`outline`,onClick:()=>{C.value=``,w.value=`all`,E.value={}}}]:[]:e.collection.access.write?[{label:`New document`,icon:`i-lucide-plus`,onClick:be}]:[]},null,8,[`title`,`description`,`actions`])):M(``,!0),D.value.length||I.value?(J(),b(`table`,$$,[j(`thead`,e1,[j(`tr`,t1,[e.collection.access.publish?(J(),b(`th`,n1,[H(P,{"model-value":Se.value,disabled:I.value||z.value,"aria-label":`Select every document on this page`,"onUpdate:modelValue":Ce},null,8,[`model-value`,`disabled`])])):M(``,!0),j(`th`,{class:G([`font-medium`,e.collection.access.publish?`px-2`:`px-4`])},`Title`,2),j(`th`,{class:G([`hidden px-2 font-medium sm:table-cell`,N.value?.scheduled?`w-56`:`w-28`])},`State`,2),_.value?(J(),b(`th`,r1,q(_.value.label),1)):M(``,!0),g.value?(J(),b(`th`,i1,q(g.value.label),1)):M(``,!0),n[12]||=j(`th`,{class:`hidden w-28 pe-4 ps-2 text-right font-medium sm:table-cell`},`Updated`,-1)])]),j(`tbody`,a1,[I.value&&!D.value.length?(J(),b(O,{key:0},s(9,t=>j(`tr`,{key:t,class:`h-18 sm:h-12`,"aria-hidden":`true`},[e.collection.access.publish?(J(),b(`td`,o1,[H(V,{class:`size-4 animate-none rounded`})])):M(``,!0),j(`td`,s1,[j(`div`,c1,[t===1?(J(),b(`span`,l1,`Loading documents…`)):(J(),k(V,{key:1,class:`h-4 w-2/3 animate-none rounded`}))]),H(V,{class:`h-3 w-1/3 animate-none rounded`}),H(V,{class:`mt-1 h-4 w-16 animate-none rounded sm:hidden`})]),j(`td`,u1,[H(V,{class:`h-3 w-16 animate-none rounded`})]),_.value?(J(),b(`td`,d1,[H(V,{class:`h-3 w-12 animate-none rounded`})])):M(``,!0),g.value?(J(),b(`td`,f1,[H(V,{class:`h-3 w-16 animate-none rounded`})])):M(``,!0),j(`td`,p1,[H(V,{class:`ms-auto h-3 w-12 animate-none rounded`})])])),64)):M(``,!0),(J(!0),b(O,null,s(D.value,t=>(J(),b(`tr`,{key:t.id,class:G([`group h-12 cursor-pointer hover:bg-elevated/60`,{"bg-elevated/40":ee.value.has(t.id)}]),onClick:e=>_e(t)},[e.collection.access.publish?(J(),b(`td`,{key:0,class:`ps-4`,onClick:n[10]||=u(()=>{},[`stop`])},[H(P,{class:G(ee.value.size?``:`opacity-0 group-hover:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`),"model-value":ee.value.has(t.id),disabled:I.value||z.value,"aria-label":`Select ${t.title}`,"onUpdate:modelValue":e=>xe(t.id,e)},null,8,[`class`,`model-value`,`disabled`,`aria-label`,`onUpdate:modelValue`])])):M(``,!0),j(`td`,{class:G([`min-w-0 py-2 sm:py-1`,e.collection.access.publish?`px-2`:`px-4`])},[j(`a`,{href:F(o).resolve(ge(t)).href,class:`block min-w-0 rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2`,onClick:u(e=>_e(t),[`prevent`])},[j(`span`,g1,[j(`span`,{class:G([`truncate text-sm font-medium text-highlighted`,{"text-muted line-through decoration-(--ui-text-dimmed)":t.state===`deleted`}])},q(t.title),3),H(qb,{sessions:F(l)(e.collection.name,t.id),user:F(d),variant:`row`},null,8,[`sessions`,`user`])]),j(`span`,_1,q(t.id),1)],8,h1),j(`span`,v1,[H(xi,{tone:F(tn)(t.state),label:F(xn)(t.state)},null,8,[`tone`,`label`]),t.issues?(J(),k(xi,{key:0,tone:`error`,label:t.issues===1?`1 issue`:`${t.issues} issues`},null,8,[`label`])):M(``,!0),t.conflict?(J(),k(xi,{key:1,tone:`warning`,label:`Changed on the site too`})):M(``,!0),t.schedule?(J(),k(xi,{key:2,tone:F(_n)(t.schedule),label:F(ln)(t.schedule)},null,8,[`tone`,`label`])):M(``,!0)])],2),j(`td`,y1,[j(`span`,b1,[H(xi,{tone:F(tn)(t.state),label:F(xn)(t.state),class:`text-[13px]`},null,8,[`tone`,`label`]),t.issues?(J(),k(ne,{key:0,text:F(Kt)(t.issues),content:{side:`top`}},{default:i(()=>[H(xi,{tone:`error`,label:t.issues===1?`1 issue`:`${t.issues} issues`,class:`text-[13px]`},null,8,[`label`])]),_:2},1032,[`text`])):M(``,!0),t.conflict?(J(),k(ne,{key:1,text:`Open it to compare with the site before you publish`,content:{side:`top`}},{default:i(()=>[H(xi,{tone:`warning`,label:`Changed on the site too`,class:`text-[13px]`})]),_:1})):M(``,!0),t.schedule?(J(),k(ne,{key:2,text:F(kt)(t.schedule,e.setup),content:{side:`top`}},{default:i(()=>[H(xi,{tone:F(_n)(t.schedule),label:F(ln)(t.schedule),class:`text-[13px]`},null,8,[`tone`,`label`])]),_:2},1032,[`text`])):M(``,!0)])]),_.value?(J(),b(`td`,x1,q(De(t.data[_.value.name])),1)):M(``,!0),g.value?(J(),b(`td`,S1,q(De(t.data[g.value.name],g.value.kind)),1)):M(``,!0),j(`td`,C1,[t.updatedAt?(J(),k(Qr,{key:0,value:t.updatedAt},null,8,[`value`])):(J(),b(`span`,w1,`—`))])],10,m1))),128))])])):M(``,!0),N.value?.nextCursor?(J(),b(`div`,T1,[H(a,{variant:`outline`,size:`sm`,label:`Load more`,loading:L.value,onClick:n[11]||=e=>he(!0)},null,8,[`loading`])])):M(``,!0),I.value||D.value.length?(J(),b(`p`,E1,[I.value?(J(),b(`span`,D1,q(D.value.length?`Updating documents…`:`Loading documents…`),1)):(J(),b(O,{key:1},[j(`span`,O1,q(D.value.length)+` of `+q(N.value?.total??D.value.length),1),w.value===`draft`?(J(),b(`span`,k1,`Drafts aren't on the site until you publish them.`)):w.value===`deleted`?(J(),b(`span`,A1,`Deleted documents stay on the site until you publish the deletion.`)):M(``,!0)],64))])):M(``,!0)],8,Q$)],64)}}}),N1={class:`min-h-0 flex-1 overflow-y-auto`},P1={class:`mx-auto grid max-w-5xl gap-2 px-4 py-6 sm:px-6`},F1={key:1,class:`grid gap-px`},I1={class:`text-[13px] font-medium text-highlighted`},L1={class:`ms-1 font-normal text-dimmed tabular-nums`},R1={class:`divide-y divide-default overflow-hidden rounded-lg border border-default`,"aria-label":`Settings`},z1={class:`grid min-w-0 flex-1`},B1={class:`truncate text-sm font-medium text-highlighted`},V1={class:`truncate font-mono text-xs text-dimmed`},H1={key:0,class:`shrink-0 text-xs text-dimmed`},U1={key:3,class:`hidden w-16 shrink-0 whitespace-nowrap text-right text-xs text-muted sm:inline`},W1=V({__name:`console-document-settings`,props:{error:{},label:{},loading:{type:Boolean},overview:{},section:{},singletons:{}},emits:[`reload`],setup(e,{emit:t}){let n=e,r=t,a=cr(),o=p(()=>n.loading&&!n.singletons.length);function c(e){let t=n.overview?.collections.find(t=>t.name===e)?.states;if(t)return[`deleted`,`changed`,`draft`,`published`].find(e=>t[e]>0)}function l(e){return n.overview?.collections.find(t=>t.name===e)?.changes[0]?.updatedAt??void 0}function u(e){return{name:Ce(a.name,xe(n.section)),params:{collection:e,document:[]},query:{}}}return(t,n)=>{let a=Dr,d=ye,f=Jr,p=ge,m=v(`RouterLink`);return J(),b(O,null,[H(Si,{title:e.label},null,8,[`title`]),j(`div`,N1,[j(`div`,P1,[e.error?(J(),k(a,{key:0,color:`error`,variant:`subtle`,icon:`i-lucide-cloud-off`,title:`Couldn't load singletons`,description:F(un)(e.error),actions:[{label:`Try again`,icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,onClick:()=>r(`reload`)}]},null,8,[`description`,`actions`])):o.value?(J(),b(`div`,F1,[(J(),b(O,null,s(2,e=>H(d,{key:e,class:`h-14 rounded-md`})),64))])):e.singletons.length?(J(),b(O,{key:3},[j(`h2`,I1,[n[0]||=K(` Singletons `,-1),j(`span`,L1,q(e.singletons.length),1)]),j(`ul`,R1,[(J(!0),b(O,null,s(e.singletons,t=>(J(),b(`li`,{key:t.name},[H(m,{to:u(t.name),class:`flex min-h-14 items-center gap-3 px-3 py-2 hover:bg-elevated/60 focus-visible:outline-2 focus-visible:-outline-offset-2`},{default:i(()=>[j(`span`,z1,[j(`span`,B1,q(t.label),1),j(`span`,V1,q(t.path),1)]),t.access.write?M(``,!0):(J(),b(`span`,H1,`Read-only`)),c(t.name)?(J(),k(xi,{key:1,class:`shrink-0`,tone:F(tn)(c(t.name)),label:F(xn)(c(t.name))},null,8,[`tone`,`label`])):e.overview?(J(),k(xi,{key:2,class:`shrink-0`,tone:`neutral`,label:`Not created`})):M(``,!0),l(t.name)?(J(),b(`span`,U1,[H(Qr,{value:l(t.name)},null,8,[`value`])])):M(``,!0),H(p,{name:`i-lucide-chevron-right`,class:`size-4 shrink-0 text-dimmed`,"aria-hidden":`true`})]),_:2},1032,[`to`])]))),128))]),n[1]||=j(`p`,{class:`text-xs text-dimmed`},`Each is one document at a fixed path. It saves as a draft and publishes like any other document.`,-1)],64)):(J(),k(f,{key:2,variant:`naked`,icon:`i-lucide-settings-2`,title:`No singletons`,description:`Define a singleton() in server/content.ts, such as settings.json, to edit it here.`}))])])],64)}}}),G1={class:`grid gap-2`},K1={key:0,class:`text-xs text-muted`},q1={key:1,class:`grid gap-2`},J1=[`src`],Y1={class:`grid min-w-0 flex-1 gap-0.5`},X1={class:`flex min-w-0 items-baseline gap-2`},Z1={class:`truncate font-mono text-xs text-highlighted`},Q1={class:`text-xs text-dimmed tabular-nums`},$1={class:`truncate text-xs text-muted`},e0=[`aria-label`,`onChange`],t0={class:`grid grid-cols-[minmax(0,1fr)_auto] gap-2`},n0={key:1,class:`text-xs text-error`},r0={key:2,class:`text-xs text-dimmed`},i0={class:`font-mono`},a0={class:`flex justify-end gap-2`},o0=V({__name:`console-media-crops`,props:{client:{},disabled:{type:Boolean},file:{},served:{}},emits:[`updated`],setup(e,{emit:t}){let n=e,r=t,a=Ye(),o=p(()=>Object.entries(n.file.crops??{}).map(([e,t])=>({name:e,...t,ratio:mi(t.aspect)??1}))),c=p(()=>n.file.url??oi(n.served,n.file.pathname)),l=A(),d=A(!1),f=A(``),m=A(`4:5`),h=A(``),g=[...li.map(e=>({label:`${e.aspect} · ${e.label}`,value:e.aspect})),{label:`Custom…`,value:`custom`}],_=p(()=>ci(f.value)),v=p(()=>m.value===`custom`?h.value.trim():m.value),y=p(()=>!!(_.value&&n.file.crops?.[_.value])),x=p(()=>!!_.value&&!y.value&&!!mi(v.value)),S=A({});function C(e){if(c.value)return ei(c.value,{crop:e.name,version:`${n.file.updatedAt}`,width:256})}async function w(e,t,n){l.value=e;try{return r(`updated`,await t()),!0}catch(e){return a.error(`${n} ${un(e,`Try again.`)}`),!1}finally{l.value=void 0}}async function T(){if(!x.value)return;let e=_.value;await w(e,()=>n.client.update(n.file.pathname,{crops:{[e]:{aspect:v.value}}}),`Couldn't add the crop.`)&&(f.value=``,d.value=!1,a.show({title:`Crop ${e} added`}))}async function E(e,t){let r=t.target,i=r.files?.[0];r.value=``,i&&await w(e,async()=>(await n.client.upload(i,{crop:{name:e,pathname:n.file.pathname}})).file,`Couldn't upload the replacement.`)&&a.show({title:`Replacement for ${e} uploaded`})}async function D(e){await w(e,()=>n.client.removeCropReplacement(n.file.pathname,e),`Couldn't remove the replacement.`)&&a.show({title:`${e} crops the original again`})}async function N(e){await w(e,()=>n.client.update(n.file.pathname,{crops:{[e]:null}}),`Couldn't delete the crop.`)&&a.show({title:`Crop ${e} deleted`})}return(t,n)=>{let r=dr,a=Bt,c=Sn,p=zr;return J(),b(`div`,G1,[!o.value.length&&!d.value?(J(),b(`p`,K1,[...n[5]||=[K(` No crops. Add one for each layout that needs its own framing, such as `,-1),j(`span`,{class:`font-mono`},`mobile`,-1),K(` at 4:5. `,-1)]])):M(``,!0),o.value.length?(J(),b(`ul`,q1,[(J(!0),b(O,null,s(o.value,t=>(J(),b(`li`,{key:t.name,class:`flex items-center gap-3 rounded-md border border-default p-2`},[j(`div`,{class:`h-14 shrink-0 overflow-hidden rounded-sm bg-elevated`,style:re({aspectRatio:String(t.ratio),background:e.file.color})},[C(t)?(J(),b(`img`,{key:0,src:C(t),alt:``,class:`size-full object-cover`,style:re(t.replacement?void 0:{objectPosition:F(ti)(t.focal??e.file.focal,e.file,t.ratio)})},null,12,J1)):M(``,!0)],4),j(`div`,Y1,[j(`p`,X1,[j(`span`,Z1,q(t.name),1),j(`span`,Q1,q(t.aspect),1)]),j(`p`,$1,[t.replacement?(J(),b(O,{key:0},[n[6]||=K(` Replacement`,-1),t.replacement.width?(J(),b(O,{key:0},[K(` · `+q(t.replacement.width)+`×`+q(t.replacement.height),1)],64)):M(``,!0)],64)):(J(),b(O,{key:1},[K(`From the focal point`)],64))])]),j(`input`,{ref_for:!0,ref:e=>{S.value[t.name]=e},type:`file`,accept:`image/jpeg,image/png,image/webp,image/avif`,class:`hidden`,"aria-label":`Replacement image for ${t.name}`,onChange:e=>E(t.name,e)},null,40,e0),H(a,{disabled:e.disabled,content:{align:`end`},items:[[{label:t.replacement?`Upload another replacement`:`Upload replacement`,icon:`i-lucide-upload`,onSelect:()=>S.value[t.name]?.click()},...t.replacement?[{label:`Use the focal point`,icon:`i-lucide-crosshair`,onSelect:()=>D(t.name)}]:[]],[{label:`Delete crop`,icon:`i-lucide-trash-2`,color:`error`,onSelect:()=>N(t.name)}]]},{default:i(()=>[H(r,{variant:`ghost`,size:`xs`,icon:`i-lucide-ellipsis`,loading:l.value===t.name,disabled:e.disabled,"aria-label":`Actions for crop ${t.name}`},null,8,[`loading`,`disabled`,`aria-label`])]),_:2},1032,[`disabled`,`items`])]))),128))])):M(``,!0),d.value?(J(),b(`form`,{key:2,class:`grid gap-2 rounded-md border border-default p-2`,onSubmit:u(T,[`prevent`])},[j(`div`,t0,[H(c,{modelValue:f.value,"onUpdate:modelValue":n[0]||=e=>f.value=e,size:`sm`,placeholder:`mobile`,"aria-label":`Crop name`,autofocus:``,ui:{base:`font-mono text-xs`}},null,8,[`modelValue`]),H(p,{modelValue:m.value,"onUpdate:modelValue":n[1]||=e=>m.value=e,size:`sm`,class:`w-36`,items:g,"aria-label":`Aspect ratio`},null,8,[`modelValue`])]),m.value===`custom`?(J(),k(c,{key:0,modelValue:h.value,"onUpdate:modelValue":n[2]||=e=>h.value=e,size:`sm`,placeholder:`3:2`,"aria-label":`Custom aspect ratio`,ui:{base:`font-mono text-xs`}},null,8,[`modelValue`])):M(``,!0),y.value?(J(),b(`p`,n0,`A crop named `+q(_.value)+` exists.`,1)):f.value&&_.value!==f.value?(J(),b(`p`,r0,[n[7]||=K(`Saved as `,-1),j(`span`,i0,q(_.value),1),n[8]||=K(`.`,-1)])):M(``,!0),j(`div`,a0,[H(r,{variant:`ghost`,size:`xs`,label:`Cancel`,onClick:n[3]||=e=>d.value=!1}),H(r,{type:`submit`,size:`xs`,label:`Add crop`,disabled:!x.value,loading:l.value===_.value},null,8,[`disabled`,`loading`])])],32)):e.disabled?M(``,!0):(J(),k(r,{key:3,variant:`outline`,size:`xs`,icon:`i-lucide-plus`,label:`Add crop`,class:`w-fit`,onClick:n[4]||=e=>d.value=!0}))])}}}),s0={class:`grid gap-3`},c0=[`src`,`alt`],l0=[`disabled`,`aria-label`],u0={class:`grid grid-cols-4 items-end gap-2`,"aria-label":`Crop previews`},d0=[`src`],f0={class:`text-[11px] text-dimmed tabular-nums`},p0=V({__name:`console-media-focal`,props:z({alt:{},color:{},disabled:{type:Boolean},height:{},src:{},width:{}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=_(e,`modelValue`),r=A(),i=A(),a=p(()=>i.value??n.value??{x:.5,y:.5}),o=p(()=>t.width&&t.height?t.width/t.height:4/3);function c(e){return Math.round(Math.min(Math.max(e,0),1)*1e3)/1e3}function l(e){let t=r.value?.getBoundingClientRect();if(t?.width&&t.height)return{x:c((e.clientX-t.left)/t.width),y:c((e.clientY-t.top)/t.height)}}function d(e){t.disabled||e.button!==0||(e.currentTarget.setPointerCapture(e.pointerId),i.value=l(e))}function f(e){i.value&&=l(e)??i.value}function m(){if(!i.value)return;let e=i.value;i.value=void 0,(e.x!==n.value?.x||e.y!==n.value?.y)&&(n.value=e)}function h(e){if(t.disabled)return;let r=e.shiftKey?.1:.01,i={ArrowDown:[0,r],ArrowLeft:[-r,0],ArrowRight:[r,0],ArrowUp:[0,-r]}[e.key];i&&(e.preventDefault(),n.value={x:c(a.value.x+i[0]),y:c(a.value.y+i[1])})}let g=p(()=>li.map(e=>({...e,ratio:mi(e.aspect)??1}))),v=e=>`${Math.round(e*100)}%`;return(t,n)=>(J(),b(`div`,s0,[j(`div`,{ref_key:`frame`,ref:r,class:G([`vitehub-media-focal relative w-full touch-none overflow-hidden rounded-md select-none`,e.disabled?``:`cursor-crosshair`]),style:re({aspectRatio:String(o.value),background:e.color??`var(--ui-bg-elevated)`}),onPointerdown:d,onPointermove:f,onPointerup:m,onPointercancel:m},[j(`img`,{src:e.src,alt:e.alt??``,class:`absolute inset-0 size-full object-contain`,draggable:`false`},null,8,c0),j(`button`,{type:`button`,class:`vitehub-media-focal__marker`,style:re({left:v(a.value.x),top:v(a.value.y)}),disabled:e.disabled,"aria-label":`Focal point, ${v(a.value.x)} from the left and ${v(a.value.y)} from the top. Use the arrow keys to move it.`,onKeydown:h,onPointerdown:u(d,[`stop`])},null,44,l0)],38),j(`div`,u0,[(J(!0),b(O,null,s(g.value,t=>(J(),b(`figure`,{key:t.aspect,class:`grid gap-1`},[j(`div`,{class:`overflow-hidden rounded-sm ring-1 ring-(--ui-border) ring-inset`,style:re({aspectRatio:String(t.ratio),background:e.color??`var(--ui-bg-elevated)`})},[j(`img`,{src:e.src,alt:``,class:`size-full object-cover`,style:re({objectPosition:F(ti)(a.value,{width:e.width,height:e.height},t.ratio)}),draggable:`false`},null,12,d0)],4),j(`figcaption`,f0,q(t.aspect),1)]))),128))])]))}}),m0=[`aria-label`],h0={class:`flex h-(--ui-header-height) shrink-0 items-center gap-2 border-b border-default px-4`},g0=[`title`],_0={class:`min-h-0 flex-1 overflow-y-auto`},v0={class:`grid gap-3 p-4`},y0={key:1,class:`flex aspect-[4/3] flex-col items-center justify-center gap-2 rounded-md bg-elevated text-dimmed`},b0={class:`text-xs`},x0={key:2,class:`text-xs text-muted`},S0={class:`grid gap-3 border-t border-default p-4`,"aria-labelledby":`media-detail-text`},C0={class:`flex items-center justify-between`},w0={class:`text-xs text-dimmed`,"aria-live":`polite`},T0={class:`grid gap-3 border-t border-default p-4`,"aria-label":`File information`},E0={class:`grid grid-cols-2 gap-x-4 gap-y-2`},D0={class:`text-xs text-dimmed`},O0={class:`text-[13px] text-highlighted tabular-nums`},k0={class:`grid gap-1`},A0={class:`flex min-w-0 items-center gap-1 rounded-md bg-elevated/60 py-1 ps-2 pe-1`},j0=[`title`],M0={key:0,class:`grid gap-1`},N0={class:`flex min-w-0 items-center gap-1 rounded-md bg-elevated/60 py-1 ps-2 pe-1`},P0=[`title`],F0={key:0,class:`grid gap-3 border-t border-default p-4`,"aria-labelledby":`media-detail-crops`},I0={class:`grid gap-2 border-t border-default p-4`,"aria-labelledby":`media-detail-usage`},L0={key:0,class:`flex items-center gap-2 text-xs text-muted`},R0={key:2,class:`text-xs text-muted`},z0={key:3,class:`grid gap-px`},B0={class:`min-w-0 flex-1 truncate text-highlighted`},V0={class:`shrink-0 text-xs text-dimmed`},H0=V({__name:`console-media-detail`,props:{access:{},client:{},file:{},section:{},served:{}},emits:[`close`,`remove`,`rename`,`updated`],setup(e,{emit:t}){let n=e,r=t,a=cr(),o=Ye(),c=p(()=>n.file.url??oi(n.served,n.file.pathname)),l=p(()=>ui(n.file.contentType)),u=p(()=>l.value===`image`),d=p(()=>{if(c.value&&u.value)return pi(n.file.contentType)?ei(c.value,{version:n.file.updatedAt,width:1080}):c.value}),m=p(()=>c.value?new URL(c.value,globalThis.location?.href??`http://localhost`).href:void 0),h=A(n.file.alt??``),g=A(n.file.caption??``),_=A(!1),y=A(!1),x,S;f(()=>n.file.pathname,()=>{E(),h.value=n.file.alt??``,g.value=n.file.caption??``,y.value=!1,ee()});function C(){return h.value.trim()!==(n.file.alt??``)||g.value.trim()!==(n.file.caption??``)}async function w(){if(clearTimeout(x),!C()||!n.access.write)return;let e=n.file.pathname,t={alt:h.value.trim()||null,caption:g.value.trim()||null};_.value=!0;try{let i=await n.client.update(e,t);y.value=!0,i.pathname===n.file.pathname&&r(`updated`,i)}catch(e){o.error(`Couldn't save the details. ${un(e,`Try again.`)}`)}finally{_.value=!1}}function T(){y.value=!1,clearTimeout(x),x=setTimeout(()=>void E(),600)}async function E(){await S,S=w(),await S}P(()=>void E());async function D(e){try{r(`updated`,await n.client.update(n.file.pathname,{focal:e??null}))}catch(e){o.error(`Couldn't save the focal point. ${un(e,`Try again.`)}`)}}async function N(e,t){if(e)try{await navigator.clipboard.writeText(e),o.show({title:`${t} copied`})}catch{o.error(`Couldn't copy the ${t.toLowerCase()}.`)}}let I=A(),L=A(),R=0;async function ee(){let e=++R;I.value=void 0,L.value=void 0;try{let t=await n.client.usage([n.file.pathname]);e===R&&(I.value=t[n.file.pathname]??[])}catch(t){e===R&&(L.value=t)}}ee();function z(e){return{name:Ce(a.name,xe(n.section)),params:{collection:e.collection,document:e.id.split(`/`)}}}let te=p(()=>[...n.file.width&&n.file.height?[{label:`Dimensions`,value:`${n.file.width} × ${n.file.height}`}]:[],{label:`Size`,value:Xr(n.file.size)},{label:`Format`,value:ai(n.file)},{label:`Uploaded`,value:ii(n.file.createdAt)}]);return(t,n)=>{let a=dr,o=Bt,f=ge,p=ji,x=Br,S=ye,C=v(`RouterLink`);return J(),b(`aside`,{class:`vitehub-media-detail flex min-h-0 flex-col border-default bg-default`,"aria-label":`Details of ${e.file.name}`},[j(`header`,h0,[j(`h2`,{class:`min-w-0 flex-1 truncate text-sm font-semibold text-highlighted`,title:e.file.pathname},q(e.file.name),9,g0),H(o,{content:{align:`end`},items:[[{label:`Copy URL`,icon:`i-lucide-link`,disabled:!m.value,onSelect:()=>N(m.value,`URL`)},{label:`Copy pathname`,icon:`i-lucide-copy`,onSelect:()=>N(e.file.pathname,`Pathname`)},...c.value?[{label:`Open original`,icon:`i-lucide-arrow-up-right`,to:c.value,target:`_blank`}]:[]],...e.access.manage&&!e.client.isProtected?.(e.file.pathname)?[[{label:`Rename or move…`,icon:`i-lucide-pencil`,onSelect:()=>r(`rename`,e.file)},{label:`Delete`,icon:`i-lucide-trash-2`,color:`error`,onSelect:()=>r(`remove`,e.file)}]]:[]]},{default:i(()=>[H(a,{variant:`ghost`,size:`sm`,icon:`i-lucide-ellipsis`,"aria-label":`File actions`})]),_:1},8,[`items`]),H(a,{variant:`ghost`,size:`sm`,icon:`i-lucide-x`,"aria-label":`Close details`,onClick:n[0]||=e=>r(`close`)})]),j(`div`,_0,[j(`section`,v0,[d.value?(J(),k(p0,{key:0,"model-value":e.file.focal,src:d.value,alt:e.file.alt,color:e.file.color,width:e.file.width,height:e.file.height,disabled:!e.access.write,"onUpdate:modelValue":D},null,8,[`model-value`,`src`,`alt`,`color`,`width`,`height`,`disabled`])):(J(),b(`div`,y0,[H(f,{name:F(si)[l.value],class:`size-8`,"aria-hidden":`true`},null,8,[`name`]),j(`span`,b0,q(c.value?F(ai)(e.file):`Not served. Enable blob.serve to preview files.`),1)])),d.value?(J(),b(`p`,x0,q(e.access.write?`Click or drag to set the focal point. Crops and variants keep it in frame.`:`Crops and variants keep the focal point in frame.`),1)):M(``,!0)]),j(`section`,S0,[j(`div`,C0,[n[6]||=j(`h3`,{id:`media-detail-text`,class:`text-xs font-medium text-highlighted`},`Description`,-1),j(`span`,w0,q(_.value?`Saving…`:y.value?`Saved`:``),1)]),H(x,{label:`Alt text`,description:u.value?`What the image shows, for people who cannot see it.`:void 0,ui:{label:`text-xs`,description:`text-xs`}},{default:i(()=>[H(p,{modelValue:h.value,"onUpdate:modelValue":[n[1]||=e=>h.value=e,T],class:`w-full`,autoresize:``,rows:2,maxrows:6,disabled:!e.access.write,placeholder:`A laptop on a desk, with the editor open`,onBlur:E},null,8,[`modelValue`,`disabled`])]),_:1},8,[`description`]),H(x,{label:`Caption`,ui:{label:`text-xs`}},{default:i(()=>[H(p,{modelValue:g.value,"onUpdate:modelValue":[n[2]||=e=>g.value=e,T],class:`w-full`,autoresize:``,rows:1,maxrows:6,disabled:!e.access.write,placeholder:`Shown under the image where the site uses captions`,onBlur:E},null,8,[`modelValue`,`disabled`])]),_:1})]),j(`section`,T0,[j(`dl`,E0,[(J(!0),b(O,null,s(te.value,e=>(J(),b(`div`,{key:e.label,class:`grid gap-0.5`},[j(`dt`,D0,q(e.label),1),j(`dd`,O0,q(e.value),1)]))),128))]),j(`div`,k0,[n[7]||=j(`span`,{class:`text-xs text-dimmed`},`Pathname`,-1),j(`div`,A0,[j(`code`,{class:`min-w-0 flex-1 truncate text-xs`,title:e.file.pathname},q(e.file.pathname),9,j0),H(a,{variant:`ghost`,size:`xs`,icon:`i-lucide-copy`,"aria-label":`Copy pathname`,onClick:n[3]||=t=>N(e.file.pathname,`Pathname`)})])]),m.value?(J(),b(`div`,M0,[n[8]||=j(`span`,{class:`text-xs text-dimmed`},`URL`,-1),j(`div`,N0,[j(`code`,{class:`min-w-0 flex-1 truncate text-xs`,title:m.value},q(c.value),9,P0),H(a,{variant:`ghost`,size:`xs`,icon:`i-lucide-copy`,"aria-label":`Copy URL`,onClick:n[4]||=e=>N(m.value,`URL`)})])])):M(``,!0)]),u.value&&c.value&&F(pi)(e.file.contentType)?(J(),b(`section`,F0,[n[9]||=j(`div`,{class:`grid gap-0.5`},[j(`h3`,{id:`media-detail-crops`,class:`text-xs font-medium text-highlighted`},`Crops`),j(`p`,{class:`text-xs text-muted`},`Framing for other layouts. Upload a replacement when a phone needs a different image.`)],-1),H(o0,{client:e.client,file:e.file,served:e.served,disabled:!e.access.write,onUpdated:n[5]||=e=>r(`updated`,e)},null,8,[`client`,`file`,`served`,`disabled`])])):M(``,!0),j(`section`,I0,[n[11]||=j(`h3`,{id:`media-detail-usage`,class:`text-xs font-medium text-highlighted`},`Used in`,-1),L.value?(J(),b(`div`,L0,[n[10]||=j(`span`,{class:`min-w-0 flex-1`},`Couldn't find the documents that use this file.`,-1),H(a,{variant:`ghost`,size:`xs`,label:`Try again`,onClick:ee})])):I.value?I.value.length?(J(),b(`ul`,z0,[(J(!0),b(O,null,s(I.value,e=>(J(),b(`li`,{key:`${e.collection}/${e.id}`},[H(C,{to:z(e),class:`flex h-8 items-center gap-2 rounded-md px-2 text-[13px] hover:bg-elevated focus-visible:outline-2`},{default:i(()=>[H(f,{name:`i-lucide-file-text`,class:`size-4 shrink-0 text-dimmed`,"aria-hidden":`true`}),j(`span`,B0,q(e.title),1),j(`span`,V0,q(e.refs.includes(`published`)?e.refs.includes(`draft`)?`Published`:`Published only`:`Draft`),1)]),_:2},1032,[`to`])]))),128))])):(J(),b(`p`,R0,`No document uses this file.`)):(J(),k(S,{key:1,class:`h-7 w-2/3`}))])])],8,m0)}}}),U0={key:0,class:`text-xs text-dimmed`},W0={class:`relative flex min-h-0 flex-1`},G0={key:1,class:`vitehub-media-library__detail flex flex-col items-center justify-center gap-2 p-6 text-center`},K0={class:`text-sm text-highlighted`},q0={class:`text-xs text-muted`},J0=V({__name:`console-media-library`,props:{client:{},label:{},section:{}},setup(e){let n=e,r=cr(),a=Jn(),o=A(),s=A({manage:!1,read:!0,write:!1}),c=A(null),l=A([]),u=t(),d=A();function m(e){let t=r.query[e];return String(t)===t?t:``}let h=p({get:()=>m(`folder`),set:e=>{a.replace({query:{...r.query,file:void 0,folder:e||void 0}})}});f(h,e=>ni(n.section,e),{immediate:!0});let g=p(()=>hi(h.value).slice(0,-1).map(e=>({label:e?fi(e):n.label,to:{query:e?{folder:e}:{}}}))),_=A(null);f(()=>m(`file`),async e=>{if(!e){u.value=void 0;return}if(u.value?.pathname!==e)try{u.value=await n.client.get(e),d.value=void 0}catch(e){u.value=void 0,d.value=e}},{immediate:!0});function v(e){u.value=e,a.replace({query:{...r.query,file:e?.pathname}})}function y(e){u.value=e,o.value?.replace(e)}return(t,n)=>{let r=Ft,a=dr;return J(),b(O,null,[H(Si,{title:h.value?F(fi)(h.value):e.label,trail:g.value,back:g.value.at(-1)},{right:i(()=>[s.value.write?s.value.manage?M(``,!0):(J(),k(r,{key:1,text:`Moving and deleting files needs publish access`},{default:i(()=>[...n[7]||=[j(`span`,{class:`hidden text-xs text-dimmed sm:inline`},`Can't move or delete`,-1)]]),_:1})):(J(),b(`span`,U0,`Read-only`)),j(`div`,{ref_key:`actions`,ref:_,class:`flex items-center gap-1.5`},null,512)]),_:1},8,[`title`,`trail`,`back`]),j(`div`,W0,[H(gi,{ref_key:`browser`,ref:o,folder:h.value,"onUpdate:folder":n[0]||=e=>h.value=e,selected:l.value,"onUpdate:selected":n[1]||=e=>l.value=e,mode:`page`,"root-label":e.label,"actions-target":_.value,client:e.client,active:u.value?.pathname,onOpen:v,onInfo:n[2]||=e=>{s.value=e.access,c.value=e.served}},null,8,[`folder`,`selected`,`root-label`,`actions-target`,`client`,`active`]),u.value?(J(),k(H0,{key:u.value.pathname,class:`vitehub-media-library__detail`,access:s.value,client:e.client,file:u.value,section:e.section,served:c.value,onClose:n[3]||=e=>v(void 0),onUpdated:y,onRename:n[4]||=e=>o.value?.askMove([e]),onRemove:n[5]||=e=>o.value?.askRemove([e])},null,8,[`access`,`client`,`file`,`section`,`served`])):d.value?(J(),b(`div`,G0,[j(`p`,K0,`Couldn't open `+q(m(`file`)),1),j(`p`,q0,q(F(un)(d.value)),1),H(a,{variant:`outline`,size:`sm`,label:`Close`,onClick:n[6]||=e=>v(void 0)})])):M(``,!0)])],64)}}}),Y0={class:`flex w-full flex-wrap items-center gap-3`},X0={key:1,class:`min-w-0 flex-1 truncate text-[13px] text-muted`},Z0={class:`flex shrink-0 gap-2`},Q0=V({__name:`console-media-picker`,props:{client:{},section:{}},setup(e,{expose:n}){let r=e,a=Ye(),o=A(!1),s=t(),c=A(``),l=A([]),u=A(),d=A({manage:!1,read:!0,write:!1}),f=A(),m=A(``),h=A(!1),g,_=p(()=>!s.value?.multiple),v=p(()=>s.value?.accept??(s.value?.kind===`image`?[`image/*`]:void 0)),y=p(()=>s.value?.kind===`file`?`Choose a file`:_.value?`Choose an image`:`Insert images`),x=p(()=>l.value.flatMap(e=>u.value?.file(e)??[])),S=A(!1),C=p(()=>x.value.length===1?x.value[0]:void 0);function w(e,t=e.alt){let n={reference:{contentType:e.contentType,pathname:e.pathname,size:e.size},src:e.pathname};return t&&(n.alt=t),n}function T(e){g?.(e),g=void 0,o.value=!1}async function E(){let e=x.value;if(!e.length)return;let t=C.value,n=m.value.trim();if(t&&S.value&&n!==(t.alt??``)&&d.value.write){h.value=!0;try{await r.client.update(t.pathname,{alt:n||null})}catch(e){a.error(`Couldn't save the alt text. ${un(e,`Try again.`)}`)}finally{h.value=!1}}T(e.map(e=>w(e,e===t&&S.value?n||void 0:e.alt)))}let D=di(()=>r.client);async function O(e){let t=e.files.filter(t=>ri(e.accept??(e.kind===`image`?[`image/*`]:void 0),t.type));if(!t.length)return[];let n=yi(r.section),i=t.length===1?t[0].name:`${t.length} files`,o=a.show({duration:6e4,title:`Uploading ${i}…`}),s=await D.add(t,n);a.remove(o.id);let c=D.entries.value.filter(e=>e.state===`failed`);return c.length&&a.error(`Couldn't upload ${c.length===1?c[0].file.name:`${c.length} files`}. ${c[0].error??``}`.trim()),D.clear(),s.length&&a.show({title:`${s.length===1?s[0].file.name:`${s.length} files`} uploaded to ${fi(n)}`}),s.map(e=>w(e.file))}function M(e){return e.files.length?O(e):e.store&&e.store!==f.value?Promise.resolve([]):(g?.([]),s.value=e,c.value=yi(r.section),l.value=[],m.value=``,S.value=!1,o.value=!0,new Promise(e=>g=e))}function N(e){l.value=e;let t=e.length===1?u.value?.file(e[0]):void 0;m.value=t?.alt??``,S.value=!1}return n({pick:M}),(t,n)=>{let r=Sn,a=dr,p=Lr;return J(),k(p,{open:o.value,title:y.value,description:s.value?.kind===`file`?`Pick a file from the library, or upload one.`:`Pick from the library, or drop images here to upload them.`,ui:{content:`sm:max-w-5xl h-[min(44rem,calc(100dvh-4rem))] flex flex-col`,body:`flex min-h-0 flex-1 flex-col p-0 sm:p-0`},"onUpdate:open":n[5]||=e=>{e||T([])}},{body:i(()=>[H(gi,{ref_key:`browser`,ref:u,folder:c.value,"onUpdate:folder":n[0]||=e=>c.value=e,mode:`picker`,"root-label":`Media`,selected:l.value,client:e.client,accept:v.value,multiple:!_.value,"onUpdate:selected":N,onConfirm:E,onInfo:n[1]||=e=>{d.value=e.access,f.value=e.store}},null,8,[`folder`,`selected`,`client`,`accept`,`multiple`])]),footer:i(()=>[j(`div`,Y0,[C.value&&C.value.contentType.startsWith(`image/`)?(J(),k(r,{key:0,modelValue:m.value,"onUpdate:modelValue":[n[2]||=e=>m.value=e,n[3]||=e=>S.value=!0],class:`min-w-0 flex-1`,size:`sm`,disabled:!d.value.write&&!!C.value.alt,placeholder:`Alt text for ${C.value.name}`,"aria-label":`Alt text`},null,8,[`modelValue`,`disabled`,`placeholder`])):(J(),b(`p`,X0,q(x.value.length?`${x.value.length} selected`:_.value?`Nothing selected`:`Select images, or Shift-click a range`),1)),j(`div`,Z0,[H(a,{variant:`ghost`,label:`Cancel`,onClick:n[4]||=e=>T([])}),H(a,{label:s.value?.kind===`file`||_.value?`Choose`:`Insert`,disabled:!x.value.length,loading:h.value,onClick:E},null,8,[`label`,`disabled`,`loading`])])])]),_:1},8,[`open`,`title`,`description`])}}}),$0={key:0,class:`vitehub-console__panel-title`},e2={class:`min-w-0 flex-1 truncate`},t2=[`aria-label`],n2={key:0,class:`truncate`},r2={key:0,class:`vitehub-console__section-heading`},i2={key:1,class:`vitehub-console__section-rule`,"aria-hidden":`true`},a2={key:2,class:`px-1 pb-2`},o2={key:3,class:`px-1 pb-2`},s2={class:`vitehub-console__collection-mark`,"aria-hidden":`true`},c2={class:`min-w-0 flex-1 truncate`},l2={key:0,class:`vitehub-console__section-hint`},u2={key:1,class:`vitehub-console__pills`},d2={key:0,class:`vitehub-console__pill`},f2={class:`sr-only`},p2={key:1,class:`vitehub-console__pill`},m2={key:1,class:`vitehub-console__collapsed-dot`,"aria-hidden":`true`},h2={key:6,class:`px-2 py-1.5 text-xs leading-relaxed text-muted`},g2={key:7,class:`px-2 py-1.5 text-xs text-muted`},_2={key:0,class:`vitehub-console__section-heading`},v2={key:1,class:`vitehub-console__section-rule`,"aria-hidden":`true`},y2={key:0,class:`truncate`},b2={key:2,class:`flex min-h-0 flex-1 items-center justify-center`},x2=V({__name:`console-documents`,props:{agentsBase:{},definitionsBase:{},details:{},documentsBase:{},kvBase:{},searchBase:{},sectionsBase:{}},setup(e){let n=e,r=cr(),a=Jn(),o=p(()=>n.details.id),c=p(()=>tt(n.documentsBase,o.value)),l=A([]),u=t(),d=A(!0),m=A(),h=A(!1),g=A(!1),_=A(0),y=t(),x=A(!1),S=A(),C=0,w=p(()=>vi(_i(n.documentsBase),o.value)),T=(n.details.pages??[]).some(e=>e.view.kind===`media-library`),E=A(),D=t(),N=A(T);T&&Wb({pick:e=>E.value?.pick(e)??Promise.resolve([]),resolveSrc:e=>bi(e)?oi(D.value?.served,e):void 0,async describe(e){let t=await w.value.get(e.pathname).catch(()=>void 0);if(!t)return;let n=t.url??oi(D.value?.served,t.pathname),r=n&&pi(t.contentType)?ei(n,{fit:t.focal?`inside`:`cover`,height:96,version:t.updatedAt,width:96}):n;return{...t.alt?{alt:t.alt}:{},...t.color?{color:t.color}:{},...t.focal?{focal:t.focal}:{},...t.width?{width:t.width}:{},...t.height?{height:t.height}:{},...r?{thumbnail:r}:{}}},async updateAlt(e,t){await w.value.update(e.pathname,{alt:t||null})}});async function P(){if(T)try{D.value=await w.value.info()}catch{}finally{N.value=!1}}function I(e){return Array.isArray(e)?e.length?e.join(`/`):void 0:String(e)===e&&e?e:void 0}let L=p(()=>l.value.filter(e=>e.kind!==`singleton`)),R=p(()=>l.value.filter(e=>e.kind===`singleton`)),ee=p(()=>(n.details.pages??[]).filter(e=>e.view.kind!==`document-settings`||R.value.length)),z=p(()=>ee.value.find(e=>e.view.kind===`document-settings`)),te=p(()=>d.value||!!m.value||L.value.length>0||!R.value.length),B=p(()=>ee.value.find(e=>e.index)),V=p(()=>I(r.params.collection)),ne=p(()=>I(r.params.document)),re=p(()=>r.query.new!==void 0&&!ne.value),ie=p(()=>l.value.find(e=>e.name===V.value)),ae=p(()=>V.value===`-`?ne.value??``:void 0),oe=p(()=>{let e=r.meta.consolePage;return String(e)===e?ee.value.find(t=>t.id===e):V.value?void 0:B.value}),U=p(()=>new Map((y.value?.collections??[]).map(e=>[e.name,e.states]))),W=p(()=>{let e=L.value.map(e=>e.label.trim().slice(0,1).toUpperCase());return new Map(L.value.map((t,n)=>{let r=e.filter(t=>t===e[n]).length>1;return[t.name,r?`${e[n]}${t.label.trim().slice(1,2).toLowerCase()}`:e[n]]}))}),se=p(()=>ee.value.filter(e=>!e.group)),ce=p(()=>{let e=new Map;for(let t of ee.value)t.group&&e.set(t.group,[...e.get(t.group)??[],t]);return[...e].map(([e,t])=>({items:t,label:e}))});function le(){return Ce(r.name,xe(o.value))}function ue(e){return e.index?{name:le(),params:{collection:``,document:[]},query:{}}:{name:Ce(r.name,be(o.value,e.id)),query:{}}}function de(e){return{name:le(),params:{collection:e,document:[]},query:ht(e)}}function fe(e){if(!e)return;let t=[e.draft&&`${e.draft} ${e.draft===1?`draft`:`drafts`}`,e.changed&&`${e.changed} changed`,e.deleted&&`${e.deleted} deleted`].filter(Boolean);return t.length?t.join(`, `):void 0}let pe=p(()=>ie.value?.kind===`singleton`?ie.value.document:ne.value);async function me(){d.value=!0;try{let e=Te(await Oe(n.definitionsBase,{query:{section:o.value}}),o.value);if(!e||e.kind!==`document-editor`)throw Error(`The Console returned invalid collections.`);l.value=[...e.collections],u.value=e.setup,m.value=void 0,!V.value&&!oe.value&&l.value[0]&&await a.replace({name:le(),params:{collection:l.value[0].name,document:[]},query:{}})}catch(e){m.value=e}finally{d.value=!1}}async function _e(){let e=++C;x.value=!0;try{let t=await c.value.overview();if(e!==C)return;y.value=t,S.value=void 0}catch(t){e===C&&(S.value=t)}finally{e===C&&(x.value=!1)}}function Se(){me(),_e()}return he(()=>{ve(o.value),Se(),P()}),f(o,()=>{ve(o.value),l.value=[],y.value=void 0,Se()}),f(_,()=>void _e()),(t,n)=>{let r=dr,a=Ft,f=Hb,p=ge,C=v(`RouterLink`),D=Dr,A=ye,P=qr,I=Jr,ne=Dn;return J(),k(pn,{active:o.value,"sections-base":e.sectionsBase},{default:i(()=>[H(P,{id:`console-navigation`,open:h.value,"onUpdate:open":n[3]||=e=>h.value=e,collapsed:g.value,"onUpdate:collapsed":n[4]||=e=>g.value=e,class:`vitehub-console__nav`,"default-size":15,"collapsed-size":3.5,"min-size":12,"max-size":24,menu:{title:e.details.label,description:e.details.description},ui:{body:`gap-0 overflow-hidden p-0`},collapsible:``,resizable:``},{header:i(({collapsed:t})=>[t?(J(),k(a,{key:1,text:`Expand sidebar`,content:{side:`right`}},{default:i(()=>[H(f,{class:`mx-auto`,size:`sm`,"aria-label":`Expand sidebar`})]),_:1})):(J(),b(`div`,$0,[j(`span`,e2,q(e.details.label),1),H(a,{text:`Reload`},{default:i(()=>[H(r,{"aria-label":`Reload collections and counts`,icon:`i-lucide-refresh-cw`,size:`xs`,variant:`ghost`,loading:d.value,onClick:Se},null,8,[`loading`])]),_:1}),H(a,{text:`Collapse sidebar`},{default:i(()=>[H(f,{class:`hidden lg:inline-flex`,size:`xs`,"aria-label":`Collapse sidebar`})]),_:1})]))]),default:i(({collapsed:t})=>[j(`nav`,{class:G([`vitehub-console__section-nav`,{"is-collapsed":t}]),"aria-label":e.details.label},[(J(!0),b(O,null,s(se.value,e=>(J(),k(a,{key:e.id,text:e.label,content:{side:`right`},disabled:!t},{default:i(()=>[H(C,{to:ue(e),class:`vitehub-console__section-link`,"aria-current":oe.value?.id===e.id?`page`:void 0,"aria-label":t?e.label:void 0,onClick:n[0]||=e=>h.value=!1},{default:i(()=>[H(p,{name:e.icon,class:`vitehub-console__section-icon`,"aria-hidden":`true`},null,8,[`name`]),t?M(``,!0):(J(),b(`span`,n2,q(e.label),1))]),_:2},1032,[`to`,`aria-current`,`aria-label`])]),_:2},1032,[`text`,`disabled`]))),128)),!t&&ee.value.length&&te.value?(J(),b(`p`,r2,`Collections`)):ee.value.length&&te.value?(J(),b(`div`,i2)):M(``,!0),!t&&m.value&&F(Ee)(m.value)?(J(),b(`div`,a2,[H(D,{color:`neutral`,variant:`subtle`,icon:`i-lucide-log-in`,title:`Sign in to edit`,description:`You are not signed in, or your session ended. Sign in, then reload.`,actions:[{label:`Reload`,icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,onClick:Se}]},null,8,[`actions`])])):!t&&m.value?(J(),b(`div`,o2,[H(D,{color:`error`,variant:`subtle`,icon:`i-lucide-cloud-off`,title:`Couldn't load collections`,description:F(un)(m.value),actions:[{label:`Try again`,icon:`i-lucide-refresh-cw`,color:`neutral`,variant:`outline`,onClick:me}]},null,8,[`description`,`actions`])])):d.value&&!l.value.length?(J(),b(O,{key:4},s(3,e=>H(A,{key:e,class:`my-0.5 h-8 rounded-md`})),64)):L.value.length?(J(!0),b(O,{key:5},s(L.value,e=>(J(),k(a,{key:e.name,text:t?[e.label,fe(U.value.get(e.name))].filter(Boolean).join(` · `):fe(U.value.get(e.name))??``,content:{side:`right`},disabled:!t&&!fe(U.value.get(e.name))},{default:i(()=>[H(C,{to:de(e.name),class:`vitehub-console__section-link`,"aria-current":!oe.value&&e.name===V.value?`page`:void 0,"aria-label":t?e.label:void 0,onClick:n[1]||=e=>h.value=!1},{default:i(()=>[j(`span`,s2,q(W.value.get(e.name)),1),t?fe(U.value.get(e.name))?(J(),b(`span`,m2)):M(``,!0):(J(),b(O,{key:0},[j(`span`,c2,q(e.label),1),e.access.write?U.value.get(e.name)?(J(),b(`span`,u2,[U.value.get(e.name).draft?(J(),b(`span`,d2,[n[9]||=j(`span`,{class:`vitehub-console__pill-dot is-draft`,"aria-hidden":`true`},null,-1),K(q(U.value.get(e.name).draft)+` `,1),j(`span`,f2,q(U.value.get(e.name).draft===1?`draft`:`drafts`),1)])):M(``,!0),U.value.get(e.name).changed+U.value.get(e.name).deleted?(J(),b(`span`,p2,[n[10]||=j(`span`,{class:`vitehub-console__pill-dot is-changed`,"aria-hidden":`true`},null,-1),K(q(U.value.get(e.name).changed+U.value.get(e.name).deleted)+` `,1),n[11]||=j(`span`,{class:`sr-only`},`changed`,-1)])):M(``,!0)])):M(``,!0):(J(),b(`span`,l2,`Read-only`))],64))]),_:2},1032,[`to`,`aria-current`,`aria-label`])]),_:2},1032,[`text`,`disabled`]))),128)):!t&&!R.value.length&&u.value?.access?(J(),b(`p`,h2,[H($r,{hint:u.value.access},null,8,[`hint`])])):!t&&!R.value.length?(J(),b(`p`,g2,` No collections you can read. `)):M(``,!0),(J(!0),b(O,null,s(ce.value,e=>(J(),b(O,{key:e.label},[t?(J(),b(`div`,v2)):(J(),b(`p`,_2,q(e.label),1)),(J(!0),b(O,null,s(e.items,e=>(J(),k(a,{key:e.id,text:e.label,content:{side:`right`},disabled:!t},{default:i(()=>[H(C,{to:ue(e),class:`vitehub-console__section-link`,"aria-current":oe.value?.id===e.id||!oe.value&&e.view.kind===`document-settings`&&ie.value?.kind===`singleton`?`page`:void 0,"aria-label":t?e.label:void 0,onClick:n[2]||=e=>h.value=!1},{default:i(()=>[H(p,{name:e.icon,class:`vitehub-console__section-icon`,"aria-hidden":`true`},null,8,[`name`]),t?M(``,!0):(J(),b(`span`,y2,q(e.label),1))]),_:2},1032,[`to`,`aria-current`,`aria-label`])]),_:2},1032,[`text`,`disabled`]))),128))],64))),128))],10,t2)]),_:1},8,[`open`,`collapsed`,`menu`]),H(vn,{"agents-base":e.agentsBase,"definitions-base":e.definitionsBase,"kv-base":e.kvBase,"search-base":e.searchBase,"sections-base":e.sectionsBase,onChanged:n[5]||=e=>_.value++},null,8,[`agents-base`,`definitions-base`,`kv-base`,`search-base`,`sections-base`]),H(ne,{id:`${o.value}-documents`,ui:{body:`min-h-0 overflow-hidden p-0 gap-0`}},{default:i(()=>[oe.value?.view.kind===`document-dashboard`?(J(),k(tS,{key:0,client:c.value,collections:l.value,error:S.value??m.value,label:oe.value.label,loading:x.value||d.value,overview:y.value,section:o.value,setup:u.value,onChanged:n[6]||=e=>_.value++,onReload:Se},null,8,[`client`,`collections`,`error`,`label`,`loading`,`overview`,`section`,`setup`])):oe.value?.view.kind===`document-settings`?(J(),k(W1,{key:1,error:m.value,label:oe.value.label,loading:d.value,overview:y.value,section:o.value,singletons:R.value,onReload:Se},null,8,[`error`,`label`,`loading`,`overview`,`section`,`singletons`])):oe.value?.view.kind===`media-library`?(J(),k(J0,{key:2,client:w.value,label:oe.value.label,section:o.value},null,8,[`client`,`label`,`section`])):ae.value===void 0?ie.value&&(pe.value||re.value)&&N.value?(J(),b(O,{key:4},[H(Si,{title:ie.value.label},null,8,[`title`]),H(Wr,{label:`Preparing document…`})],64)):ie.value&&(pe.value||re.value)?(J(),k(B$,{key:`${ie.value.name}/${pe.value??`~new`}`,client:c.value,collection:ie.value,"document-id":pe.value,parent:ie.value.kind===`singleton`&&z.value?{label:z.value.label,to:ue(z.value)}:void 0,changes:_.value,setup:u.value,onChanged:n[7]||=e=>_.value++},null,8,[`client`,`collection`,`document-id`,`parent`,`changes`,`setup`])):ie.value?(J(),k(M1,{key:ie.value.name,client:c.value,collection:ie.value,changes:_.value,setup:u.value,onChanged:n[8]||=e=>_.value++},null,8,[`client`,`collection`,`changes`,`setup`])):!d.value&&V.value&&!m.value?(J(),b(O,{key:7},[H(Si,{title:e.details.label},null,8,[`title`]),H(I,{class:`min-h-0 flex-1`,variant:`naked`,icon:`i-lucide-folder-x`,title:`No collection named ${V.value}`,description:`It does not exist, or you cannot read its drafts.`,actions:l.value[0]?[{label:`Open ${l.value[0].label}`,to:de(l.value[0].name)}]:[]},null,8,[`title`,`actions`])],64)):(J(),b(O,{key:8},[H(Si,{title:e.details.label},null,8,[`title`]),d.value?(J(),k(Wr,{key:0,label:`Loading collections…`})):m.value?(J(),k(Ze,{key:1,title:`Couldn't load collections`,error:m.value,retry:me},null,8,[`error`])):(J(),b(`div`,b2,[u.value?.access?(J(),k(I,{key:0,variant:`naked`,icon:`i-lucide-lock`,title:`No one can read documents yet`},{description:i(()=>[H($r,{hint:u.value.access},null,8,[`hint`])]),_:1})):(J(),k(I,{key:1,variant:`naked`,icon:e.details.icon,title:`Nothing to edit yet`,description:e.details.view.notice},null,8,[`icon`,`description`]))]))],64)):(J(),b(O,{key:3},[H(Si,{title:e.details.label},null,8,[`title`]),H(I,{class:`min-h-0 flex-1`,variant:`naked`,icon:`i-lucide-file-question`,title:ae.value?`No page named ${ae.value}`:`No page here`,description:`${e.details.label} has no such page.`,actions:[{label:`Open ${B.value?.label??e.details.label}`,color:`neutral`,variant:`outline`,to:B.value?ue(B.value):{name:le()}}]},null,8,[`title`,`description`,`actions`])],64))]),_:1},8,[`id`]),F(T)?(J(),k(Q0,{key:0,ref_key:`mediaPicker`,ref:E,client:w.value,section:o.value},null,8,[`client`,`section`])):M(``,!0)]),_:1},8,[`active`,`sections-base`])}}});export{x2 as default};
|