tmux-ide 2.1.4 → 2.6.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 +115 -101
- package/bin/cli.js +13678 -4
- package/bin/cli.ts +1143 -260
- package/package.json +27 -17
- package/packages/daemon/dist/__tests__/support.d.ts +7 -0
- package/packages/daemon/dist/__tests__/support.js +33 -0
- package/packages/daemon/dist/agent-explain.d.ts +45 -0
- package/packages/daemon/dist/agent-explain.js +210 -0
- package/packages/daemon/dist/attach.d.ts +3 -0
- package/packages/daemon/dist/attach.js +14 -0
- package/packages/daemon/dist/bin.d.ts +2 -0
- package/packages/daemon/dist/bin.js +3 -0
- package/packages/daemon/dist/canonical.d.ts +2 -0
- package/packages/daemon/dist/canonical.js +1 -0
- package/packages/daemon/dist/cli.d.ts +1 -0
- package/packages/daemon/dist/cli.js +425 -0
- package/packages/daemon/dist/command-center/actions/contract.d.ts +1 -0
- package/packages/daemon/dist/command-center/actions/contract.js +2 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.d.ts +27 -0
- package/packages/daemon/dist/command-center/actions/dispatcher.js +109 -0
- package/packages/daemon/dist/command-center/actions/errors.d.ts +38 -0
- package/packages/daemon/dist/command-center/actions/errors.js +56 -0
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.d.ts +12 -0
- package/packages/daemon/dist/command-center/actions/handlers/_project-context.js +12 -0
- package/packages/daemon/dist/command-center/actions/handlers/_resolve-project.d.ts +42 -0
- package/packages/daemon/dist/command-center/actions/handlers/_resolve-project.js +48 -0
- package/packages/daemon/dist/command-center/actions/handlers/app-set-remote-access.d.ts +23 -0
- package/packages/daemon/dist/command-center/actions/handlers/app-set-remote-access.js +67 -0
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.d.ts +12 -0
- package/packages/daemon/dist/command-center/actions/handlers/config-actions.js +69 -0
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.d.ts +6 -0
- package/packages/daemon/dist/command-center/actions/handlers/daemon-shutdown.js +24 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-activate.d.ts +7 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-activate.js +19 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-launch.d.ts +18 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-launch.js +58 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-open-terminal.d.ts +32 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-open-terminal.js +69 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-restart.d.ts +17 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-restart.js +27 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-stop.d.ts +24 -0
- package/packages/daemon/dist/command-center/actions/handlers/project-stop.js +38 -0
- package/packages/daemon/dist/command-center/actions/handlers/terminal-respawn.d.ts +24 -0
- package/packages/daemon/dist/command-center/actions/handlers/terminal-respawn.js +88 -0
- package/packages/daemon/dist/command-center/actions/handlers/terminal-stop.d.ts +14 -0
- package/packages/daemon/dist/command-center/actions/handlers/terminal-stop.js +22 -0
- package/packages/daemon/dist/command-center/actions/registry.d.ts +35 -0
- package/packages/daemon/dist/command-center/actions/registry.js +109 -0
- package/packages/daemon/dist/command-center/discovery.d.ts +23 -0
- package/packages/daemon/dist/command-center/discovery.js +67 -0
- package/packages/daemon/dist/command-center/index.d.ts +10 -0
- package/packages/daemon/dist/command-center/index.js +21 -0
- package/packages/daemon/dist/command-center/schemas.d.ts +76 -0
- package/packages/daemon/dist/command-center/schemas.js +68 -0
- package/packages/daemon/dist/command-center/server.d.ts +26 -0
- package/packages/daemon/dist/command-center/server.js +1103 -0
- package/packages/daemon/dist/command-center/ws-events.d.ts +59 -0
- package/packages/daemon/dist/command-center/ws-events.js +277 -0
- package/packages/daemon/dist/config.d.ts +19 -0
- package/packages/daemon/dist/config.js +494 -0
- package/packages/daemon/dist/detect.d.ts +15 -0
- package/packages/daemon/dist/detect.js +228 -0
- package/packages/daemon/dist/doctor.d.ts +21 -0
- package/packages/daemon/dist/doctor.js +154 -0
- package/packages/daemon/dist/embed.d.ts +1 -0
- package/packages/daemon/dist/embed.js +1 -0
- package/packages/daemon/dist/index.d.ts +3 -0
- package/packages/daemon/dist/index.js +2 -0
- package/packages/daemon/dist/init.d.ts +4 -0
- package/packages/daemon/dist/init.js +174 -0
- package/packages/daemon/dist/inspect.d.ts +54 -0
- package/packages/daemon/dist/inspect.js +118 -0
- package/packages/daemon/dist/launch.d.ts +23 -0
- package/packages/daemon/dist/launch.js +250 -0
- package/packages/daemon/dist/lib/active-projects.d.ts +12 -0
- package/packages/daemon/dist/lib/active-projects.js +35 -0
- package/packages/daemon/dist/lib/agent-discovery.d.ts +43 -0
- package/packages/daemon/dist/lib/agent-discovery.js +85 -0
- package/packages/daemon/dist/lib/app-config.d.ts +147 -0
- package/packages/daemon/dist/lib/app-config.js +191 -0
- package/packages/daemon/dist/lib/app-settings.d.ts +9 -0
- package/packages/daemon/dist/lib/app-settings.js +44 -0
- package/packages/daemon/dist/lib/auth/auth-service.d.ts +33 -0
- package/packages/daemon/dist/lib/auth/auth-service.js +172 -0
- package/packages/daemon/dist/lib/auth/middleware.d.ts +16 -0
- package/packages/daemon/dist/lib/auth/middleware.js +43 -0
- package/packages/daemon/dist/lib/auth/types.d.ts +1 -0
- package/packages/daemon/dist/lib/auth/types.js +2 -0
- package/packages/daemon/dist/lib/auth-token.d.ts +1 -0
- package/packages/daemon/dist/lib/auth-token.js +4 -0
- package/packages/daemon/dist/lib/authorship.d.ts +62 -0
- package/packages/daemon/dist/lib/authorship.js +209 -0
- package/packages/daemon/dist/lib/canonical-daemon.d.ts +21 -0
- package/packages/daemon/dist/lib/canonical-daemon.js +111 -0
- package/packages/daemon/dist/lib/cli-action-bridge.d.ts +27 -0
- package/packages/daemon/dist/lib/cli-action-bridge.js +161 -0
- package/packages/daemon/dist/lib/daemon-embed.d.ts +31 -0
- package/packages/daemon/dist/lib/daemon-embed.js +643 -0
- package/packages/daemon/dist/lib/daemon-watchdog.d.ts +16 -0
- package/packages/daemon/dist/lib/daemon-watchdog.js +98 -0
- package/packages/daemon/dist/lib/daemon.d.ts +8 -0
- package/packages/daemon/dist/lib/daemon.js +79 -0
- package/packages/daemon/dist/lib/dot-path.d.ts +2 -0
- package/packages/daemon/dist/lib/dot-path.js +17 -0
- package/packages/daemon/dist/lib/errors.d.ts +37 -0
- package/packages/daemon/dist/lib/errors.js +50 -0
- package/packages/daemon/dist/lib/filesystem-browser.d.ts +85 -0
- package/packages/daemon/dist/lib/filesystem-browser.js +257 -0
- package/packages/daemon/dist/lib/launch-plan.d.ts +6 -0
- package/packages/daemon/dist/lib/launch-plan.js +76 -0
- package/packages/daemon/dist/lib/log.d.ts +40 -0
- package/packages/daemon/dist/lib/log.js +86 -0
- package/packages/daemon/dist/lib/output.d.ts +9 -0
- package/packages/daemon/dist/lib/output.js +65 -0
- package/packages/daemon/dist/lib/project-init-runner.d.ts +46 -0
- package/packages/daemon/dist/lib/project-init-runner.js +117 -0
- package/packages/daemon/dist/lib/project-inspect.d.ts +28 -0
- package/packages/daemon/dist/lib/project-inspect.js +67 -0
- package/packages/daemon/dist/lib/project-onboard.d.ts +58 -0
- package/packages/daemon/dist/lib/project-onboard.js +108 -0
- package/packages/daemon/dist/lib/project-probe.d.ts +35 -0
- package/packages/daemon/dist/lib/project-probe.js +61 -0
- package/packages/daemon/dist/lib/project-registry.d.ts +76 -0
- package/packages/daemon/dist/lib/project-registry.js +230 -0
- package/packages/daemon/dist/lib/session-monitor.d.ts +15 -0
- package/packages/daemon/dist/lib/session-monitor.js +103 -0
- package/packages/daemon/dist/lib/session-options.d.ts +13 -0
- package/packages/daemon/dist/lib/session-options.js +85 -0
- package/packages/daemon/dist/lib/shell.d.ts +5 -0
- package/{src/lib/shell.ts → packages/daemon/dist/lib/shell.js} +3 -3
- package/packages/daemon/dist/lib/sizes.d.ts +16 -0
- package/packages/daemon/dist/lib/sizes.js +36 -0
- package/packages/daemon/dist/lib/skill-sync.d.ts +60 -0
- package/packages/daemon/dist/lib/skill-sync.js +128 -0
- package/packages/daemon/dist/lib/slugify.d.ts +4 -0
- package/packages/daemon/dist/lib/slugify.js +10 -0
- package/packages/daemon/dist/lib/terminals-store.d.ts +27 -0
- package/packages/daemon/dist/lib/terminals-store.js +111 -0
- package/packages/daemon/dist/lib/update-check.d.ts +118 -0
- package/packages/daemon/dist/lib/update-check.js +261 -0
- package/packages/daemon/dist/lib/update.d.ts +65 -0
- package/packages/daemon/dist/lib/update.js +141 -0
- package/packages/daemon/dist/lib/workspace-registry.d.ts +84 -0
- package/packages/daemon/dist/lib/workspace-registry.js +176 -0
- package/packages/daemon/dist/lib/worktree.d.ts +76 -0
- package/packages/daemon/dist/lib/worktree.js +207 -0
- package/packages/daemon/dist/lib/yaml-io.d.ts +10 -0
- package/packages/daemon/dist/lib/yaml-io.js +24 -0
- package/packages/daemon/dist/ls.d.ts +3 -0
- package/packages/daemon/dist/ls.js +35 -0
- package/packages/daemon/dist/restart.d.ts +4 -0
- package/packages/daemon/dist/restart.js +16 -0
- package/packages/daemon/dist/restore.d.ts +86 -0
- package/packages/daemon/dist/restore.js +406 -0
- package/packages/daemon/dist/schemas/domain.d.ts +1 -0
- package/packages/daemon/dist/schemas/domain.js +2 -0
- package/packages/daemon/dist/schemas/filesystem.d.ts +29 -0
- package/packages/daemon/dist/schemas/filesystem.js +29 -0
- package/packages/daemon/dist/schemas/ide-config.d.ts +1 -0
- package/packages/daemon/dist/schemas/ide-config.js +2 -0
- package/packages/daemon/dist/schemas/index.d.ts +12 -0
- package/packages/daemon/dist/schemas/index.js +6 -0
- package/packages/daemon/dist/schemas/inspect.d.ts +53 -0
- package/packages/daemon/dist/schemas/inspect.js +57 -0
- package/packages/daemon/dist/schemas/registry.d.ts +35 -0
- package/packages/daemon/dist/schemas/registry.js +43 -0
- package/packages/daemon/dist/schemas/ws-events.d.ts +72 -0
- package/packages/daemon/dist/schemas/ws-events.js +110 -0
- package/packages/daemon/dist/send.d.ts +27 -0
- package/packages/daemon/dist/send.js +141 -0
- package/packages/daemon/dist/server/index.d.ts +10 -0
- package/packages/daemon/dist/server/index.js +55 -0
- package/packages/daemon/dist/server/pty-bridge.d.ts +174 -0
- package/packages/daemon/dist/server/pty-bridge.js +422 -0
- package/packages/daemon/dist/server/standalone.d.ts +1 -0
- package/packages/daemon/dist/server/standalone.js +14 -0
- package/packages/daemon/dist/server/ws-route.d.ts +74 -0
- package/packages/daemon/dist/server/ws-route.js +379 -0
- package/packages/daemon/dist/status.d.ts +3 -0
- package/packages/daemon/dist/status.js +46 -0
- package/packages/daemon/dist/stop.d.ts +3 -0
- package/packages/daemon/dist/stop.js +21 -0
- package/packages/daemon/dist/terminal/NodePtyAdapter.d.ts +44 -0
- package/packages/daemon/dist/terminal/NodePtyAdapter.js +253 -0
- package/packages/daemon/dist/terminal/PtyAdapter.d.ts +124 -0
- package/packages/daemon/dist/terminal/PtyAdapter.js +43 -0
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.d.ts +77 -0
- package/packages/daemon/dist/terminal/__tests__/MockPtyAdapter.js +155 -0
- package/packages/daemon/dist/types.d.ts +2 -0
- package/packages/daemon/dist/types.js +1 -0
- package/packages/daemon/dist/validate.d.ts +4 -0
- package/packages/daemon/dist/validate.js +184 -0
- package/packages/daemon/dist/widgets/changes/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/changes/index.jsx +575 -0
- package/packages/daemon/dist/widgets/config/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/config/index.jsx +395 -0
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.d.ts +10 -0
- package/packages/daemon/dist/widgets/explorer/breadcrumbs.jsx +51 -0
- package/packages/daemon/dist/widgets/explorer/footer.d.ts +6 -0
- package/packages/daemon/dist/widgets/explorer/footer.jsx +11 -0
- package/packages/daemon/dist/widgets/explorer/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/explorer/index.jsx +393 -0
- package/packages/daemon/dist/widgets/explorer/tree-model.d.ts +13 -0
- package/packages/daemon/dist/widgets/explorer/tree-model.js +69 -0
- package/packages/daemon/dist/widgets/explorer/tree.d.ts +13 -0
- package/packages/daemon/dist/widgets/explorer/tree.jsx +108 -0
- package/packages/daemon/dist/widgets/lib/config-model.d.ts +22 -0
- package/packages/daemon/dist/widgets/lib/config-model.js +99 -0
- package/packages/daemon/dist/widgets/lib/files.d.ts +11 -0
- package/packages/daemon/dist/widgets/lib/files.js +76 -0
- package/packages/daemon/dist/widgets/lib/git.d.ts +11 -0
- package/packages/daemon/dist/widgets/lib/git.js +70 -0
- package/packages/daemon/dist/widgets/lib/grammar.d.ts +79 -0
- package/packages/daemon/dist/widgets/lib/grammar.js +95 -0
- package/packages/daemon/dist/widgets/lib/help-overlay.d.ts +19 -0
- package/packages/daemon/dist/widgets/lib/help-overlay.jsx +69 -0
- package/packages/daemon/dist/widgets/lib/pane-comms.d.ts +28 -0
- package/packages/daemon/dist/widgets/lib/pane-comms.js +189 -0
- package/packages/daemon/dist/widgets/lib/theme.d.ts +44 -0
- package/packages/daemon/dist/widgets/lib/theme.js +153 -0
- package/packages/daemon/dist/widgets/lib/watcher.d.ts +9 -0
- package/packages/daemon/dist/widgets/lib/watcher.js +92 -0
- package/packages/daemon/dist/widgets/preview/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/preview/index.jsx +371 -0
- package/packages/daemon/dist/widgets/resolve.d.ts +20 -0
- package/packages/daemon/dist/widgets/resolve.js +100 -0
- package/packages/daemon/dist/widgets/setup/agent-naming.d.ts +9 -0
- package/packages/daemon/dist/widgets/setup/agent-naming.jsx +81 -0
- package/packages/daemon/dist/widgets/setup/config-tree.d.ts +13 -0
- package/packages/daemon/dist/widgets/setup/config-tree.jsx +203 -0
- package/packages/daemon/dist/widgets/setup/detect-panel.d.ts +14 -0
- package/{src/widgets/setup/detect-panel.tsx → packages/daemon/dist/widgets/setup/detect-panel.jsx} +16 -40
- package/packages/daemon/dist/widgets/setup/field-editor.d.ts +12 -0
- package/packages/daemon/dist/widgets/setup/field-editor.jsx +163 -0
- package/packages/daemon/dist/widgets/setup/footer.d.ts +17 -0
- package/packages/daemon/dist/widgets/setup/footer.jsx +64 -0
- package/packages/daemon/dist/widgets/setup/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/setup/index.jsx +261 -0
- package/packages/daemon/dist/widgets/setup/layout-picker.d.ts +9 -0
- package/packages/daemon/dist/widgets/setup/layout-picker.jsx +69 -0
- package/packages/daemon/dist/widgets/setup/setup-model.d.ts +15 -0
- package/packages/daemon/dist/widgets/setup/setup-model.js +157 -0
- package/packages/daemon/dist/widgets/sidebar/index.d.ts +1 -0
- package/packages/daemon/dist/widgets/sidebar/index.jsx +462 -0
- package/scripts/build-cli.mjs +101 -0
- package/scripts/build-tui.mjs +58 -0
- package/scripts/capture-codex-traffic.mjs +195 -0
- package/scripts/check-src-additions.sh +74 -0
- package/scripts/coverage-summary.mjs +68 -0
- package/scripts/install-git-hooks.js +53 -0
- package/scripts/merge-update-manifests.mjs +58 -0
- package/scripts/merge-update-manifests.test.mjs +82 -0
- package/scripts/pack-check-run.mjs +83 -0
- package/scripts/postinstall.js +28 -6
- package/scripts/prepublish-check.mjs +44 -0
- package/scripts/stress-test.ts +141 -0
- package/scripts/verify-endpoints.sh +90 -0
- package/skill/SKILL.md +203 -236
- package/dashboard/out/404/index.html +0 -1
- package/dashboard/out/404.html +0 -1
- package/dashboard/out/__next.__PAGE__.txt +0 -9
- package/dashboard/out/__next._full.txt +0 -21
- package/dashboard/out/__next._head.txt +0 -5
- package/dashboard/out/__next._index.txt +0 -7
- package/dashboard/out/__next._tree.txt +0 -4
- package/dashboard/out/_next/static/Tl1KoIH7mHCyjo5KtXqQ0/_buildManifest.js +0 -11
- package/dashboard/out/_next/static/Tl1KoIH7mHCyjo5KtXqQ0/_clientMiddlewareManifest.json +0 -1
- package/dashboard/out/_next/static/Tl1KoIH7mHCyjo5KtXqQ0/_ssgManifest.js +0 -1
- package/dashboard/out/_next/static/chunks/048e2449530877e2.js +0 -1
- package/dashboard/out/_next/static/chunks/053c57bda6abb959.js +0 -1
- package/dashboard/out/_next/static/chunks/056760c6c2dd9172.js +0 -1
- package/dashboard/out/_next/static/chunks/06ab47357b6d3e35.js +0 -1
- package/dashboard/out/_next/static/chunks/0921cbe5dfd6738e.js +0 -1
- package/dashboard/out/_next/static/chunks/0b2599bf468cf5ea.js +0 -1
- package/dashboard/out/_next/static/chunks/0c012eac08ef2c4f.js +0 -1
- package/dashboard/out/_next/static/chunks/0c29e87fcdcffac3.js +0 -1
- package/dashboard/out/_next/static/chunks/0e1e98854430c693.js +0 -1
- package/dashboard/out/_next/static/chunks/0e24498976a88976.js +0 -1
- package/dashboard/out/_next/static/chunks/0e5bf11ff0b9ab90.js +0 -1
- package/dashboard/out/_next/static/chunks/0eae0a45ab8416c8.js +0 -1
- package/dashboard/out/_next/static/chunks/104797400d9d38ad.js +0 -1
- package/dashboard/out/_next/static/chunks/10cfcfce475f9d2d.js +0 -1
- package/dashboard/out/_next/static/chunks/11bac38e7cfb4ecc.js +0 -1
- package/dashboard/out/_next/static/chunks/120c5f6501ec3529.js +0 -1
- package/dashboard/out/_next/static/chunks/121fceb2b1dcd79f.js +0 -1
- package/dashboard/out/_next/static/chunks/13726b63e1be6b98.js +0 -1
- package/dashboard/out/_next/static/chunks/140c6ce631514660.js +0 -1
- package/dashboard/out/_next/static/chunks/1435ee3a51174c97.js +0 -1
- package/dashboard/out/_next/static/chunks/14dc927d2e2cca91.js +0 -1
- package/dashboard/out/_next/static/chunks/179c3031b292d98e.js +0 -1
- package/dashboard/out/_next/static/chunks/181e88957c47e5c1.js +0 -1
- package/dashboard/out/_next/static/chunks/18f70ba23873c432.js +0 -1
- package/dashboard/out/_next/static/chunks/1b58303b027fd135.js +0 -1
- package/dashboard/out/_next/static/chunks/1b5f49a358dcc71e.js +0 -1
- package/dashboard/out/_next/static/chunks/1bba44b81585099a.js +0 -1
- package/dashboard/out/_next/static/chunks/1bea8dee19a3e9ae.js +0 -1
- package/dashboard/out/_next/static/chunks/1cfad21646fc250e.js +0 -1
- package/dashboard/out/_next/static/chunks/1d053dc9e1e428ef.js +0 -1
- package/dashboard/out/_next/static/chunks/1e7d7639c6f0ee5e.js +0 -1
- package/dashboard/out/_next/static/chunks/1f42504ca81463f1.js +0 -1
- package/dashboard/out/_next/static/chunks/20c92047399305b4.js +0 -1
- package/dashboard/out/_next/static/chunks/214560e9514a9a4d.js +0 -1
- package/dashboard/out/_next/static/chunks/21d4ef106914e997.js +0 -1
- package/dashboard/out/_next/static/chunks/2586e83fc3dc2588.js +0 -1
- package/dashboard/out/_next/static/chunks/267136a09e94f5c2.js +0 -1
- package/dashboard/out/_next/static/chunks/271c50b329917c10.js +0 -1
- package/dashboard/out/_next/static/chunks/27fccecefffd88b5.js +0 -1
- package/dashboard/out/_next/static/chunks/28f058ed331315b6.js +0 -1
- package/dashboard/out/_next/static/chunks/28f704f2cc5713eb.js +0 -1
- package/dashboard/out/_next/static/chunks/290f67a6cd150a98.js +0 -1
- package/dashboard/out/_next/static/chunks/2ad12f4dcc30d30a.js +0 -1
- package/dashboard/out/_next/static/chunks/2b650b172078ab92.js +0 -1
- package/dashboard/out/_next/static/chunks/2bd91076019a6453.js +0 -1
- package/dashboard/out/_next/static/chunks/2e1278563a8e26be.js +0 -1
- package/dashboard/out/_next/static/chunks/309eb70780a3d67d.js +0 -1
- package/dashboard/out/_next/static/chunks/30f71950992e2307.js +0 -1
- package/dashboard/out/_next/static/chunks/31191873c2075784.js +0 -1
- package/dashboard/out/_next/static/chunks/31a790921a0c035e.js +0 -1
- package/dashboard/out/_next/static/chunks/34f8d7a5a06e8e32.js +0 -1
- package/dashboard/out/_next/static/chunks/36b3716436d9bc9d.js +0 -1
- package/dashboard/out/_next/static/chunks/3770b7d0ff004de3.js +0 -1
- package/dashboard/out/_next/static/chunks/381ab3bd4cffbf4d.js +0 -1
- package/dashboard/out/_next/static/chunks/38aa4eada5dcd1a4.js +0 -1
- package/dashboard/out/_next/static/chunks/39723132b78cb77e.js +0 -1
- package/dashboard/out/_next/static/chunks/399efdcc3fe56e09.js +0 -1
- package/dashboard/out/_next/static/chunks/3a8431a9221b0706.js +0 -1
- package/dashboard/out/_next/static/chunks/3a9b40810ce88cbf.js +0 -1
- package/dashboard/out/_next/static/chunks/3b322e3e9476ecdf.js +0 -1
- package/dashboard/out/_next/static/chunks/3bb14befeeb08c28.js +0 -1
- package/dashboard/out/_next/static/chunks/3c99637ebd462b20.js +0 -1
- package/dashboard/out/_next/static/chunks/3cbb9217d56459d8.js +0 -1
- package/dashboard/out/_next/static/chunks/3d438e0929a762f7.js +0 -1
- package/dashboard/out/_next/static/chunks/3e6d4834e0752f76.js +0 -2
- package/dashboard/out/_next/static/chunks/3e6f8cedaad4e89b.js +0 -1
- package/dashboard/out/_next/static/chunks/3e701259ce1b53e3.js +0 -1
- package/dashboard/out/_next/static/chunks/41562f7ab7c033eb.js +0 -1
- package/dashboard/out/_next/static/chunks/418fadd8a94e2fd7.js +0 -1
- package/dashboard/out/_next/static/chunks/42345437bb922e9c.js +0 -1
- package/dashboard/out/_next/static/chunks/434b6bd78c97b668.js +0 -1
- package/dashboard/out/_next/static/chunks/434febe897d33e2d.js +0 -1
- package/dashboard/out/_next/static/chunks/45d28707dd8ce1c1.js +0 -1
- package/dashboard/out/_next/static/chunks/4620a640e88cb1b7.js +0 -1
- package/dashboard/out/_next/static/chunks/468f8eb604502ea4.js +0 -1
- package/dashboard/out/_next/static/chunks/495f5cedf8afe823.js +0 -1
- package/dashboard/out/_next/static/chunks/49a89d1704d27740.js +0 -1
- package/dashboard/out/_next/static/chunks/49e5c37d15f63def.js +0 -1
- package/dashboard/out/_next/static/chunks/4a46ad186a8587ee.css +0 -2
- package/dashboard/out/_next/static/chunks/4a5c728574935d50.js +0 -1
- package/dashboard/out/_next/static/chunks/4b27ebd4d9304d8f.js +0 -1
- package/dashboard/out/_next/static/chunks/4b965aa320a9b358.js +0 -1
- package/dashboard/out/_next/static/chunks/4bb2da90bbe5794f.js +0 -1
- package/dashboard/out/_next/static/chunks/4d2f1c6f631e4b85.js +0 -1
- package/dashboard/out/_next/static/chunks/4d696d5a64dab42e.js +0 -1
- package/dashboard/out/_next/static/chunks/4f660dadb3f1e9e2.js +0 -1
- package/dashboard/out/_next/static/chunks/507b50d47f949333.js +0 -1
- package/dashboard/out/_next/static/chunks/50b1b7063bb044e2.js +0 -1
- package/dashboard/out/_next/static/chunks/50c0c2e3c4f02508.js +0 -1
- package/dashboard/out/_next/static/chunks/50d7ba9803e65b02.js +0 -1
- package/dashboard/out/_next/static/chunks/51535a6d4c98c7a4.js +0 -1
- package/dashboard/out/_next/static/chunks/526de6cc16c7dd2f.js +0 -1
- package/dashboard/out/_next/static/chunks/5307604f8632b3fd.js +0 -1
- package/dashboard/out/_next/static/chunks/5480bd722260f231.js +0 -1
- package/dashboard/out/_next/static/chunks/54c61c82e5f1dca5.js +0 -1
- package/dashboard/out/_next/static/chunks/555de6ac6bb9034c.js +0 -1
- package/dashboard/out/_next/static/chunks/562b89ee76a4b90c.js +0 -1
- package/dashboard/out/_next/static/chunks/5747f9a32edff429.js +0 -1
- package/dashboard/out/_next/static/chunks/57ee141430b4c05c.js +0 -1
- package/dashboard/out/_next/static/chunks/584c066a0837dd9a.js +0 -1
- package/dashboard/out/_next/static/chunks/5856aed4670a6253.js +0 -1
- package/dashboard/out/_next/static/chunks/58fe563414726511.js +0 -1
- package/dashboard/out/_next/static/chunks/5948196b2729b18c.js +0 -1
- package/dashboard/out/_next/static/chunks/5ab77c69e7306f97.js +0 -1
- package/dashboard/out/_next/static/chunks/5b3fa4c99d61611c.js +0 -1
- package/dashboard/out/_next/static/chunks/5cc87abaef616661.js +0 -1
- package/dashboard/out/_next/static/chunks/5dfa7913f99bb966.js +0 -1
- package/dashboard/out/_next/static/chunks/5e49b008432770f1.js +0 -1
- package/dashboard/out/_next/static/chunks/5e5a33dd81c45c47.js +0 -1
- package/dashboard/out/_next/static/chunks/5ee61bed638eb8a8.js +0 -1
- package/dashboard/out/_next/static/chunks/5eed557b9f45ae4a.js +0 -1
- package/dashboard/out/_next/static/chunks/60446823a7d30c1b.js +0 -1
- package/dashboard/out/_next/static/chunks/605150c490861442.js +0 -1
- package/dashboard/out/_next/static/chunks/609056d51c0bf332.js +0 -1
- package/dashboard/out/_next/static/chunks/60ec91dfeb50071b.js +0 -1
- package/dashboard/out/_next/static/chunks/61bc7be0bba6a33f.js +0 -1
- package/dashboard/out/_next/static/chunks/61f4a5c9ce23e55e.js +0 -1
- package/dashboard/out/_next/static/chunks/63aae3585be04e65.js +0 -1
- package/dashboard/out/_next/static/chunks/64e0e1ee7ef4f01b.js +0 -1
- package/dashboard/out/_next/static/chunks/66e9b4c26ff1aaaf.js +0 -1
- package/dashboard/out/_next/static/chunks/67068847aa1b5e98.js +0 -1
- package/dashboard/out/_next/static/chunks/68d7de1f2e202c26.js +0 -1
- package/dashboard/out/_next/static/chunks/698ca3ea1937ba4f.js +0 -1
- package/dashboard/out/_next/static/chunks/69eb97c24b5b6b9d.js +0 -1
- package/dashboard/out/_next/static/chunks/6b1ac098c228a479.js +0 -1
- package/dashboard/out/_next/static/chunks/6bb8020cb796bcc1.js +0 -1
- package/dashboard/out/_next/static/chunks/6cf8b1db17f2a155.js +0 -1
- package/dashboard/out/_next/static/chunks/6e7613643906ea88.js +0 -1
- package/dashboard/out/_next/static/chunks/6ea27ceb2e6feae5.js +0 -1
- package/dashboard/out/_next/static/chunks/6f95a8dbcf23dded.js +0 -1
- package/dashboard/out/_next/static/chunks/6fd44e759d82f64e.js +0 -1
- package/dashboard/out/_next/static/chunks/716ec29c268c38f6.js +0 -1
- package/dashboard/out/_next/static/chunks/717b399dfcf7c02c.js +0 -1
- package/dashboard/out/_next/static/chunks/72badd90e1c91348.js +0 -1
- package/dashboard/out/_next/static/chunks/72f9296dbb7ae3c4.js +0 -1
- package/dashboard/out/_next/static/chunks/73aa31e1144d8191.js +0 -1
- package/dashboard/out/_next/static/chunks/73f98ded8fe2e879.js +0 -1
- package/dashboard/out/_next/static/chunks/740a2e8ace15e13b.js +0 -1
- package/dashboard/out/_next/static/chunks/74e57c16e7304b6b.js +0 -1
- package/dashboard/out/_next/static/chunks/7628dead4d113df2.js +0 -1
- package/dashboard/out/_next/static/chunks/7717c88c07ed96e6.js +0 -1
- package/dashboard/out/_next/static/chunks/775581f7956d9a27.js +0 -1
- package/dashboard/out/_next/static/chunks/77d3b6661befdb98.js +0 -1
- package/dashboard/out/_next/static/chunks/78435c0e1c77fea7.js +0 -1
- package/dashboard/out/_next/static/chunks/791336748b9c9393.js +0 -1
- package/dashboard/out/_next/static/chunks/79ea68dfae65ef2f.js +0 -1
- package/dashboard/out/_next/static/chunks/7bae777a472eb13c.js +0 -1
- package/dashboard/out/_next/static/chunks/7fd847f47237a35c.js +0 -1
- package/dashboard/out/_next/static/chunks/804d718be0370058.css +0 -1
- package/dashboard/out/_next/static/chunks/807cb3c1923995ab.js +0 -1
- package/dashboard/out/_next/static/chunks/8286b39407d94447.js +0 -1
- package/dashboard/out/_next/static/chunks/84e4305b8dc830ed.js +0 -1
- package/dashboard/out/_next/static/chunks/850f99dbfabb53e0.js +0 -1
- package/dashboard/out/_next/static/chunks/85594127e66b6b7f.js +0 -1
- package/dashboard/out/_next/static/chunks/858c11169c183c9c.js +0 -1
- package/dashboard/out/_next/static/chunks/85e27005dfe4c3e3.js +0 -1
- package/dashboard/out/_next/static/chunks/8707bd3d8ddc1f1c.js +0 -1
- package/dashboard/out/_next/static/chunks/8851e5d7ef894973.js +0 -1
- package/dashboard/out/_next/static/chunks/88ba3782cc614989.js +0 -1
- package/dashboard/out/_next/static/chunks/8a0c9a181784c2ef.js +0 -1
- package/dashboard/out/_next/static/chunks/8ad01ae355a6e7f6.js +0 -1
- package/dashboard/out/_next/static/chunks/8d2ed93b0d0a4b4f.js +0 -1
- package/dashboard/out/_next/static/chunks/8dc352ebd5310d3c.js +0 -1
- package/dashboard/out/_next/static/chunks/8dd1d722c8c1a22c.js +0 -1
- package/dashboard/out/_next/static/chunks/8e60fe307e3e4986.js +0 -1
- package/dashboard/out/_next/static/chunks/8eea4dd71e25f32a.js +0 -1
- package/dashboard/out/_next/static/chunks/8f468a65bac34eaa.js +0 -1
- package/dashboard/out/_next/static/chunks/9057e5382d6a5059.js +0 -1
- package/dashboard/out/_next/static/chunks/931d056437805ecb.js +0 -1
- package/dashboard/out/_next/static/chunks/954eb11648dd8cff.js +0 -1
- package/dashboard/out/_next/static/chunks/955034d876d14bb3.js +0 -1
- package/dashboard/out/_next/static/chunks/966c4895773249f6.js +0 -1
- package/dashboard/out/_next/static/chunks/96aff410a6ab106c.js +0 -1
- package/dashboard/out/_next/static/chunks/99b396c821c1dd2d.js +0 -1
- package/dashboard/out/_next/static/chunks/9a255fd2cf4922ae.js +0 -1
- package/dashboard/out/_next/static/chunks/9b1f6aa73bc864b2.js +0 -1
- package/dashboard/out/_next/static/chunks/9b9ce582c533aa79.js +0 -1
- package/dashboard/out/_next/static/chunks/9c19bd3c773c6611.js +0 -1
- package/dashboard/out/_next/static/chunks/9ceeaa847eb15ca2.js +0 -1
- package/dashboard/out/_next/static/chunks/9d2e6e7b8b65f845.js +0 -1
- package/dashboard/out/_next/static/chunks/9de23802066128ff.js +0 -1
- package/dashboard/out/_next/static/chunks/9e327f94b3701170.js +0 -1
- package/dashboard/out/_next/static/chunks/9e7818421c2d455a.js +0 -1
- package/dashboard/out/_next/static/chunks/9e935acbcf2fb519.js +0 -1
- package/dashboard/out/_next/static/chunks/9ed9f68340343b51.js +0 -1
- package/dashboard/out/_next/static/chunks/9f94a0242455fc20.js +0 -1
- package/dashboard/out/_next/static/chunks/9fff46b5aaecf47e.js +0 -1
- package/dashboard/out/_next/static/chunks/a06d267a5c557657.js +0 -1
- package/dashboard/out/_next/static/chunks/a0eb8c81c54722fe.js +0 -1
- package/dashboard/out/_next/static/chunks/a16808e83106427d.js +0 -1
- package/dashboard/out/_next/static/chunks/a2215e2bc72739ef.js +0 -1
- package/dashboard/out/_next/static/chunks/a2de9e6696eb9c17.js +0 -1
- package/dashboard/out/_next/static/chunks/a33420b8c14090d6.js +0 -1
- package/dashboard/out/_next/static/chunks/a360bffef39d818b.js +0 -1
- package/dashboard/out/_next/static/chunks/a42852fdf5287cf5.js +0 -1
- package/dashboard/out/_next/static/chunks/a4efc88488322b67.js +0 -1
- package/dashboard/out/_next/static/chunks/a696a91d14101bdb.js +0 -1
- package/dashboard/out/_next/static/chunks/a6dad97d9634a72d.js +0 -1
- package/dashboard/out/_next/static/chunks/a6dad97d9634a72d.js.map +0 -1
- package/dashboard/out/_next/static/chunks/a705c7261712bd8e.js +0 -1
- package/dashboard/out/_next/static/chunks/a7d1e4b067ace180.js +0 -1
- package/dashboard/out/_next/static/chunks/a8590c121a7efaa5.js +0 -1
- package/dashboard/out/_next/static/chunks/a95953a83a6df6cf.js +0 -1
- package/dashboard/out/_next/static/chunks/a9d0a757d3b4afed.js +0 -1
- package/dashboard/out/_next/static/chunks/a9dc35514619c872.js +0 -1
- package/dashboard/out/_next/static/chunks/aae0253c73fba984.js +0 -193
- package/dashboard/out/_next/static/chunks/ab1821552066a74d.js +0 -1
- package/dashboard/out/_next/static/chunks/ac96bc0eccebe15a.js +0 -1
- package/dashboard/out/_next/static/chunks/acc03cfaaf6bb30f.js +0 -1
- package/dashboard/out/_next/static/chunks/acc298ae059b9fe4.js +0 -1
- package/dashboard/out/_next/static/chunks/ad076b6e996d250c.js +0 -1
- package/dashboard/out/_next/static/chunks/ae53b64af7ba16d5.js +0 -1
- package/dashboard/out/_next/static/chunks/ae5da7fa4bc5fa95.js +0 -1
- package/dashboard/out/_next/static/chunks/aefcf0eb033a155e.js +0 -1
- package/dashboard/out/_next/static/chunks/b12d43100ee10526.js +0 -1
- package/dashboard/out/_next/static/chunks/b137952dd5566a41.js +0 -1
- package/dashboard/out/_next/static/chunks/b2832d8a2d332a47.js +0 -1
- package/dashboard/out/_next/static/chunks/b417aa09c15f63c6.js +0 -1
- package/dashboard/out/_next/static/chunks/b48e152ba7bf6caf.js +0 -1
- package/dashboard/out/_next/static/chunks/b4cbef8e4714bf92.js +0 -1
- package/dashboard/out/_next/static/chunks/b568ff8383a37f53.js +0 -1
- package/dashboard/out/_next/static/chunks/b6e1495dd89a39e3.js +0 -1
- package/dashboard/out/_next/static/chunks/b73a21bd67528440.js +0 -1
- package/dashboard/out/_next/static/chunks/b77ee62bc71dcec7.js +0 -1
- package/dashboard/out/_next/static/chunks/b7f454615c11d4eb.js +0 -1
- package/dashboard/out/_next/static/chunks/b818ea32a839590f.js +0 -1
- package/dashboard/out/_next/static/chunks/b901ce78c1c65d66.js +0 -1
- package/dashboard/out/_next/static/chunks/b93d647b803be9fa.js +0 -1
- package/dashboard/out/_next/static/chunks/b960b09ff1ecd6bb.js +0 -1
- package/dashboard/out/_next/static/chunks/ba717c7779a778fc.js +0 -1
- package/dashboard/out/_next/static/chunks/bacb0ae7458d18b6.js +0 -1
- package/dashboard/out/_next/static/chunks/bb51f68b27346852.js +0 -1
- package/dashboard/out/_next/static/chunks/bb67f22e1ab632ae.js +0 -1
- package/dashboard/out/_next/static/chunks/bbae97ec58d1bb9d.js +0 -1
- package/dashboard/out/_next/static/chunks/bbaf38ee90307765.js +0 -1
- package/dashboard/out/_next/static/chunks/be01598fe1fce5db.js +0 -1
- package/dashboard/out/_next/static/chunks/bf4cbbc095987fec.js +0 -1
- package/dashboard/out/_next/static/chunks/c18f823797d57446.js +0 -1
- package/dashboard/out/_next/static/chunks/c1bcece34ec5b295.js +0 -1
- package/dashboard/out/_next/static/chunks/c1ccbc3a51adaf0a.js +0 -1
- package/dashboard/out/_next/static/chunks/c1f54a628f27791c.js +0 -1
- package/dashboard/out/_next/static/chunks/c21916bf5d232151.js +0 -1
- package/dashboard/out/_next/static/chunks/c27e570f0fc2f78b.js +0 -1
- package/dashboard/out/_next/static/chunks/c322b8005eebc0d8.js +0 -1
- package/dashboard/out/_next/static/chunks/c3900ac2b009b764.js +0 -1
- package/dashboard/out/_next/static/chunks/c3c597c8eb77ad6b.js +0 -1
- package/dashboard/out/_next/static/chunks/c58d45c1d88e208c.js +0 -1
- package/dashboard/out/_next/static/chunks/c63875998d7a655f.js +0 -1
- package/dashboard/out/_next/static/chunks/c6eaa7c8e7209c8e.js +0 -1
- package/dashboard/out/_next/static/chunks/c6f820f71162a59a.js +0 -1
- package/dashboard/out/_next/static/chunks/c7ce0941d1dfe7ed.js +0 -1
- package/dashboard/out/_next/static/chunks/c877259f784ec8e5.js +0 -1
- package/dashboard/out/_next/static/chunks/cb8057e86aaa1c68.js +0 -1
- package/dashboard/out/_next/static/chunks/ccb4e306ee4859b1.js +0 -1
- package/dashboard/out/_next/static/chunks/ccde62b0fa8112eb.js +0 -1
- package/dashboard/out/_next/static/chunks/cd421f0971c63c31.js +0 -1
- package/dashboard/out/_next/static/chunks/cde0317494d4adb7.js +0 -1
- package/dashboard/out/_next/static/chunks/cfae64434b92b8b6.js +0 -1
- package/dashboard/out/_next/static/chunks/cfc0e19310ec0a36.js +0 -1
- package/dashboard/out/_next/static/chunks/d0f344c7d0bcb59a.js +0 -1
- package/dashboard/out/_next/static/chunks/d1871c73e74e1f50.js +0 -1
- package/dashboard/out/_next/static/chunks/d18f658850711061.js +0 -1
- package/dashboard/out/_next/static/chunks/d25d9c48880697f6.js +0 -1
- package/dashboard/out/_next/static/chunks/d3f0a72bbc3060b0.js +0 -1
- package/dashboard/out/_next/static/chunks/d5fca429bc89060b.js +0 -1
- package/dashboard/out/_next/static/chunks/d6a6c75c9a4bef49.js +0 -1
- package/dashboard/out/_next/static/chunks/d6a8f93aa8f1e345.js +0 -1
- package/dashboard/out/_next/static/chunks/d7deab676b19ba0e.js +0 -1
- package/dashboard/out/_next/static/chunks/d80030dde88cec85.js +0 -1
- package/dashboard/out/_next/static/chunks/da84f9774c076ff1.js +0 -1
- package/dashboard/out/_next/static/chunks/da98ecc6b9b0ceb2.js +0 -1
- package/dashboard/out/_next/static/chunks/db550aabce60b912.js +0 -4
- package/dashboard/out/_next/static/chunks/dc87f77fcc029482.js +0 -1
- package/dashboard/out/_next/static/chunks/dd05f30acdb63a53.js +0 -1
- package/dashboard/out/_next/static/chunks/dea150155499b903.js +0 -1
- package/dashboard/out/_next/static/chunks/df4358754ff1d5e8.js +0 -1
- package/dashboard/out/_next/static/chunks/df8b21ff12d23b0e.js +0 -1
- package/dashboard/out/_next/static/chunks/df8fc68d77debf2c.js +0 -1
- package/dashboard/out/_next/static/chunks/df9ed1ffec90589f.js +0 -1
- package/dashboard/out/_next/static/chunks/dfa65ece1598f934.js +0 -1
- package/dashboard/out/_next/static/chunks/dfaab5cdd41a20d9.js +0 -1
- package/dashboard/out/_next/static/chunks/e00c03c942b5ae3e.js +0 -1
- package/dashboard/out/_next/static/chunks/e02d27cf679bece1.js +0 -1
- package/dashboard/out/_next/static/chunks/e0b747585f78513a.js +0 -1
- package/dashboard/out/_next/static/chunks/e19b71ca23fd7df0.js +0 -1
- package/dashboard/out/_next/static/chunks/e21cbe89d0cda120.js +0 -1
- package/dashboard/out/_next/static/chunks/e2a0386930edd34f.js +0 -1
- package/dashboard/out/_next/static/chunks/e375de19a36e2f38.js +0 -1
- package/dashboard/out/_next/static/chunks/e5241b4a6496a9e0.js +0 -1
- package/dashboard/out/_next/static/chunks/e569dd07c96eb4dd.js +0 -1
- package/dashboard/out/_next/static/chunks/e61c3ea91233f948.js +0 -1
- package/dashboard/out/_next/static/chunks/e73b42c5d34c4c28.js +0 -1
- package/dashboard/out/_next/static/chunks/e7c5b2105f651e87.js +0 -1
- package/dashboard/out/_next/static/chunks/e878e58a69bb01b6.js +0 -1
- package/dashboard/out/_next/static/chunks/e8f090a4dc571062.js +0 -1
- package/dashboard/out/_next/static/chunks/e98dc34dac91cdad.js +0 -1
- package/dashboard/out/_next/static/chunks/ea67cf7a0c5e7233.js +0 -1
- package/dashboard/out/_next/static/chunks/eacc98a1e3512fa9.js +0 -1
- package/dashboard/out/_next/static/chunks/eae9cd74d9bbed8b.js +0 -1
- package/dashboard/out/_next/static/chunks/eb187fd345852b34.js +0 -1
- package/dashboard/out/_next/static/chunks/ecea46df7a40b427.js +0 -1
- package/dashboard/out/_next/static/chunks/ecf48b83f4245d9c.js +0 -1
- package/dashboard/out/_next/static/chunks/eda41732bf966c6d.js +0 -1
- package/dashboard/out/_next/static/chunks/ee174a433049f43a.js +0 -1
- package/dashboard/out/_next/static/chunks/ee66b2d3b76de72e.js +0 -1
- package/dashboard/out/_next/static/chunks/ef058d3041c3d8ab.js +0 -1
- package/dashboard/out/_next/static/chunks/f3544b800b0d4969.js +0 -1
- package/dashboard/out/_next/static/chunks/f3b280e604b97509.js +0 -1
- package/dashboard/out/_next/static/chunks/f42e1d3693232993.js +0 -1
- package/dashboard/out/_next/static/chunks/f5a5fdd80166d304.js +0 -1
- package/dashboard/out/_next/static/chunks/f60adc5dd6169316.js +0 -1
- package/dashboard/out/_next/static/chunks/f6255bc2e6c68ce8.js +0 -1
- package/dashboard/out/_next/static/chunks/f6bb677d2d8840db.js +0 -1
- package/dashboard/out/_next/static/chunks/f6f3bf016239c33a.js +0 -1
- package/dashboard/out/_next/static/chunks/f6f57a46cd074bfe.js +0 -1
- package/dashboard/out/_next/static/chunks/f7feb9c1199e8cf6.js +0 -1
- package/dashboard/out/_next/static/chunks/f831087bf964cc3d.js +0 -1
- package/dashboard/out/_next/static/chunks/fa5a2f7244935aa2.js +0 -1
- package/dashboard/out/_next/static/chunks/fa73f36df4c38fa0.js +0 -1
- package/dashboard/out/_next/static/chunks/faa1461722d6a88d.js +0 -1
- package/dashboard/out/_next/static/chunks/fbf706b9a0edb7e6.js +0 -1
- package/dashboard/out/_next/static/chunks/fc2b8c8b7446bbc2.js +0 -1
- package/dashboard/out/_next/static/chunks/fd516f3930c128c1.js +0 -1
- package/dashboard/out/_next/static/chunks/fd663e7ff8de4887.js +0 -1
- package/dashboard/out/_next/static/chunks/fe5b656cc9bdd60e.js +0 -1
- package/dashboard/out/_next/static/chunks/turbopack-2f5dec4a537c0ee7.js +0 -4
- package/dashboard/out/_next/static/media/02263ebadd758ea4-s.8da66e7f.woff2 +0 -0
- package/dashboard/out/_next/static/media/2fe89d53234c61d4-s.cb53f04b.woff2 +0 -0
- package/dashboard/out/_next/static/media/59b15b4bcd7b1eb5-s.afa48be3.woff2 +0 -0
- package/dashboard/out/_next/static/media/5e05ae5b48faa55e-s.6b5ea6af.woff2 +0 -0
- package/dashboard/out/_next/static/media/68757d6cddeff913-s.e6cd1753.woff2 +0 -0
- package/dashboard/out/_next/static/media/99e609270109b47d-s.p.64b9304e.woff2 +0 -0
- package/dashboard/out/_next/static/media/a7afbb44bec2bb18-s.1dcddae6.woff2 +0 -0
- package/dashboard/out/_next/static/media/e390973e931a41c5-s.a82ecf4e.woff2 +0 -0
- package/dashboard/out/_next/static/media/e532fa1b9921e1cd-s.764b43eb.woff2 +0 -0
- package/dashboard/out/_next/static/media/effe91970fc4db64-s.p.19510058.woff2 +0 -0
- package/dashboard/out/_not-found/__next._full.txt +0 -15
- package/dashboard/out/_not-found/__next._head.txt +0 -5
- package/dashboard/out/_not-found/__next._index.txt +0 -7
- package/dashboard/out/_not-found/__next._not-found.__PAGE__.txt +0 -5
- package/dashboard/out/_not-found/__next._not-found.txt +0 -4
- package/dashboard/out/_not-found/__next._tree.txt +0 -2
- package/dashboard/out/_not-found/index.html +0 -1
- package/dashboard/out/_not-found/index.txt +0 -15
- package/dashboard/out/index.html +0 -1
- package/dashboard/out/index.txt +0 -21
- package/dashboard/out/project/__fallback/__next._full.txt +0 -19
- package/dashboard/out/project/__fallback/__next._head.txt +0 -5
- package/dashboard/out/project/__fallback/__next._index.txt +0 -7
- package/dashboard/out/project/__fallback/__next._tree.txt +0 -5
- package/dashboard/out/project/__fallback/__next.project.$d$name.__PAGE__.txt +0 -7
- package/dashboard/out/project/__fallback/__next.project.$d$name.txt +0 -4
- package/dashboard/out/project/__fallback/__next.project.txt +0 -4
- package/dashboard/out/project/__fallback/index.html +0 -1
- package/dashboard/out/project/__fallback/index.txt +0 -19
- package/src/__tests__/support.ts +0 -186
- package/src/attach.ts +0 -20
- package/src/cli.test.ts +0 -314
- package/src/command-center/discovery.test.ts +0 -265
- package/src/command-center/discovery.ts +0 -296
- package/src/command-center/index.ts +0 -31
- package/src/command-center/schemas.ts +0 -57
- package/src/command-center/server.test.ts +0 -814
- package/src/command-center/server.ts +0 -1427
- package/src/command-center/static.test.ts +0 -105
- package/src/command-center/static.ts +0 -122
- package/src/config-cli.test.ts +0 -86
- package/src/config.test.ts +0 -205
- package/src/config.ts +0 -313
- package/src/detect.test.ts +0 -142
- package/src/detect.ts +0 -248
- package/src/dispatch.ts +0 -102
- package/src/doctor.test.ts +0 -119
- package/src/doctor.ts +0 -167
- package/src/init.test.ts +0 -101
- package/src/init.ts +0 -211
- package/src/inspect.test.ts +0 -67
- package/src/inspect.ts +0 -212
- package/src/integration.test.ts.skip +0 -276
- package/src/js-yaml.d.ts +0 -10
- package/src/launch.test.ts +0 -149
- package/src/launch.ts +0 -583
- package/src/lib/auth/auth-service.test.ts +0 -178
- package/src/lib/auth/auth-service.ts +0 -227
- package/src/lib/auth/middleware.test.ts +0 -119
- package/src/lib/auth/middleware.ts +0 -56
- package/src/lib/auth/types.ts +0 -13
- package/src/lib/authorship.test.ts +0 -242
- package/src/lib/authorship.ts +0 -280
- package/src/lib/cast/recorder.test.ts +0 -127
- package/src/lib/cast/recorder.ts +0 -148
- package/src/lib/daemon-watchdog.ts +0 -102
- package/src/lib/daemon.ts +0 -431
- package/src/lib/dot-path.test.ts +0 -66
- package/src/lib/dot-path.ts +0 -17
- package/src/lib/errors.ts +0 -44
- package/src/lib/event-log.test.ts +0 -189
- package/src/lib/event-log.ts +0 -237
- package/src/lib/github-pr.ts +0 -182
- package/src/lib/hq/client.test.ts +0 -154
- package/src/lib/hq/client.ts +0 -142
- package/src/lib/hq/mdns.test.ts +0 -54
- package/src/lib/hq/mdns.ts +0 -88
- package/src/lib/hq/registry.test.ts +0 -237
- package/src/lib/hq/registry.ts +0 -145
- package/src/lib/hq/types.ts +0 -44
- package/src/lib/ipc/socket-protocol.test.ts +0 -126
- package/src/lib/ipc/socket-protocol.ts +0 -324
- package/src/lib/launch-plan.test.ts +0 -119
- package/src/lib/launch-plan.ts +0 -90
- package/src/lib/log.test.ts +0 -39
- package/src/lib/log.ts +0 -71
- package/src/lib/metrics.test.ts +0 -213
- package/src/lib/metrics.ts +0 -345
- package/src/lib/orchestrator.test.ts +0 -2358
- package/src/lib/orchestrator.ts +0 -1799
- package/src/lib/output.ts +0 -76
- package/src/lib/plan-store.test.ts +0 -148
- package/src/lib/plan-store.ts +0 -131
- package/src/lib/research.test.ts +0 -208
- package/src/lib/research.ts +0 -475
- package/src/lib/round-trip.test.ts +0 -341
- package/src/lib/session-monitor.test.ts +0 -152
- package/src/lib/session-monitor.ts +0 -282
- package/src/lib/session-options.test.ts +0 -146
- package/src/lib/session-options.ts +0 -100
- package/src/lib/shell.test.ts +0 -20
- package/src/lib/sizes.test.ts +0 -73
- package/src/lib/sizes.ts +0 -36
- package/src/lib/skill-registry.test.ts +0 -134
- package/src/lib/skill-registry.ts +0 -86
- package/src/lib/slugify.test.ts +0 -35
- package/src/lib/slugify.ts +0 -10
- package/src/lib/task-store.ts +0 -352
- package/src/lib/tmux.test.ts +0 -500
- package/src/lib/tmux.ts +0 -372
- package/src/lib/token-tracker.test.ts +0 -102
- package/src/lib/token-tracker.ts +0 -70
- package/src/lib/tunnels/cloudflare.test.ts +0 -73
- package/src/lib/tunnels/cloudflare.ts +0 -254
- package/src/lib/tunnels/manager.test.ts +0 -63
- package/src/lib/tunnels/manager.ts +0 -132
- package/src/lib/tunnels/ngrok.test.ts +0 -94
- package/src/lib/tunnels/ngrok.ts +0 -261
- package/src/lib/tunnels/tailscale.test.ts +0 -103
- package/src/lib/tunnels/tailscale.ts +0 -1048
- package/src/lib/tunnels/types.ts +0 -44
- package/src/lib/validation.test.ts +0 -289
- package/src/lib/validation.ts +0 -123
- package/src/lib/webhook.ts +0 -51
- package/src/lib/workflow-store.ts +0 -209
- package/src/lib/ws-v3/protocol.test.ts +0 -127
- package/src/lib/ws-v3/protocol.ts +0 -160
- package/src/lib/yaml-io.test.ts +0 -125
- package/src/lib/yaml-io.ts +0 -27
- package/src/ls.test.ts +0 -76
- package/src/ls.ts +0 -40
- package/src/metrics-cli.ts +0 -177
- package/src/notify.ts +0 -85
- package/src/orchestrator-status.ts +0 -228
- package/src/plan.ts +0 -117
- package/src/postinstall.test.ts +0 -79
- package/src/remote.test.ts +0 -115
- package/src/remote.ts +0 -148
- package/src/restart.ts +0 -24
- package/src/schemas/domain.ts +0 -422
- package/src/schemas/ide-config.ts +0 -148
- package/src/schemas/index.ts +0 -53
- package/src/send.test.ts +0 -70
- package/src/send.ts +0 -181
- package/src/skill.test.ts +0 -114
- package/src/skill.ts +0 -138
- package/src/status.ts +0 -66
- package/src/stop.test.ts +0 -151
- package/src/stop.ts +0 -37
- package/src/task.test.ts +0 -1466
- package/src/task.ts +0 -1143
- package/src/tunnel.test.ts +0 -80
- package/src/tunnel.ts +0 -133
- package/src/types.ts +0 -15
- package/src/ui/index.ts +0 -32
- package/src/ui/terminal/index.ts +0 -9
- package/src/ui/types.ts +0 -91
- package/src/ui/web/base.css +0 -80
- package/src/ui/web/components/Box.tsx +0 -59
- package/src/ui/web/components/Input.tsx +0 -32
- package/src/ui/web/components/ScrollBox.tsx +0 -60
- package/src/ui/web/components/Text.tsx +0 -28
- package/src/ui/web/hooks.ts +0 -106
- package/src/ui/web/index.ts +0 -27
- package/src/ui/web/render.ts +0 -77
- package/src/ui/web/utils/color.test.ts +0 -93
- package/src/ui/web/utils/color.ts +0 -27
- package/src/validate.test.ts +0 -385
- package/src/validate.ts +0 -217
- package/src/widgets/changes/index.tsx +0 -576
- package/src/widgets/config/index.tsx +0 -440
- package/src/widgets/costs/index.tsx +0 -216
- package/src/widgets/explorer/breadcrumbs.tsx +0 -77
- package/src/widgets/explorer/footer.tsx +0 -20
- package/src/widgets/explorer/header.tsx +0 -23
- package/src/widgets/explorer/index.tsx +0 -408
- package/src/widgets/explorer/tree-model.test.ts +0 -214
- package/src/widgets/explorer/tree-model.ts +0 -103
- package/src/widgets/explorer/tree.tsx +0 -156
- package/src/widgets/lib/config-model.ts +0 -116
- package/src/widgets/lib/files.test.ts +0 -103
- package/src/widgets/lib/files.ts +0 -88
- package/src/widgets/lib/git.test.ts +0 -151
- package/src/widgets/lib/git.ts +0 -88
- package/src/widgets/lib/pane-comms.test.ts +0 -178
- package/src/widgets/lib/pane-comms.ts +0 -207
- package/src/widgets/lib/theme.ts +0 -151
- package/src/widgets/lib/watcher.ts +0 -50
- package/src/widgets/mission-control/activity-feed.tsx +0 -59
- package/src/widgets/mission-control/agent-panel.tsx +0 -132
- package/src/widgets/mission-control/command-bar.tsx +0 -63
- package/src/widgets/mission-control/index.tsx +0 -751
- package/src/widgets/mission-control/task-panel.tsx +0 -238
- package/src/widgets/preview/index.tsx +0 -415
- package/src/widgets/resolve.ts +0 -40
- package/src/widgets/setup/agent-naming.tsx +0 -112
- package/src/widgets/setup/config-tree.tsx +0 -238
- package/src/widgets/setup/field-editor.tsx +0 -265
- package/src/widgets/setup/footer.tsx +0 -107
- package/src/widgets/setup/index.tsx +0 -340
- package/src/widgets/setup/layout-picker.tsx +0 -96
- package/src/widgets/setup/orchestrator-panel.tsx +0 -200
- package/src/widgets/setup/review-panel.tsx +0 -140
- package/src/widgets/setup/setup-model.test.ts +0 -303
- package/src/widgets/setup/setup-model.ts +0 -188
- package/src/widgets/tasks/index.tsx +0 -129
- package/src/widgets/tasks/task-detail.tsx +0 -309
- package/src/widgets/tasks/task-form.tsx +0 -193
- package/src/widgets/tasks/task-list.tsx +0 -205
- package/src/widgets/tasks/task-model.test.ts +0 -473
- package/src/widgets/tasks/task-model.ts +0 -157
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,41855,(e,t,n)=>{t.exports=e.r(77439)},61904,(e,t,n)=>{var r={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,o=l(e),s=o[0],a=o[1],c=new i((s+a)*3/4-a),d=0,u=a>0?s-4:s;for(n=0;n<u;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[d++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t),c},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(function(e,t,r){for(var i,o=[],s=t;s<r;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}(e,s,s+16383>a?a:s+16383));return 1===i?o.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&o.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),o.join("")};for(var n=[],r=[],i="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r[45]=62,r[95]=63},72:function(e,t,n){"use strict";var r=n(675),i=n(783),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(r,i),l=s(o),c=l.write(r,i);return c!==o&&(l=l.slice(0,c)),l}if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(e.buffer,SharedArrayBuffer)))return function(e,t,n){var r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),a.prototype),r}(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return a.from(d,t,n);var f=function(e){if(a.isBuffer(e)){var t=0|h(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return c(e),s(e<0?0:0|h(e))}function u(e){for(var t=e.length<0?0:0|h(e.length),n=s(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,n){return(c(e),e<=0)?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return d(e)},a.allocUnsafeSlow=function(e){return d(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return E(e).length;default:if(i)return r?-1:N(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var i,o,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=I[e[o]];return i}(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return i=this,o=t,s=n,0===o&&s===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(o,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(this,t,n);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){var o;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(o=n*=1)!=o&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return y(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;s=2,a/=2,l/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var d=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===d?0:o-d)){if(-1===d&&(d=o),o-d+1===l)return d*s}else -1!==d&&(o-=o-d),d=-1}else for(n+l>a&&(n=a-l),o=n;o>=0;o--){for(var u=!0,h=0;h<l;h++)if(c(e,o+h)!==c(t,h)){u=!1;break}if(u)return o}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(T(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),T(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;var n,r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(T(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,n,r,i){if(T(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,s=n-t,l=Math.min(o,s),c=this.slice(r,i),d=e.slice(t,n),u=0;u<l;++u)if(c[u]!==d[u]){o=c[u],s=d[u];break}return o<s?-1:+(s<o)},a.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)};function v(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,l,c=e[i],d=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=n)switch(u){case 1:c<128&&(d=c);break;case 2:(192&(o=e[i+1]))==128&&(l=(31&c)<<6|63&o)>127&&(d=l);break;case 3:o=e[i+1],s=e[i+2],(192&o)==128&&(192&s)==128&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,r.push(d>>>10&1023|55296),d=56320|1023&d),r.push(d),i+=u}var h=r,p=h.length;if(p<=4096)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<p;)f+=String.fromCharCode.apply(String,h.slice(m,m+=4096));return f}function b(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function x(e,t,n,r,i,o){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function k(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function w(e,t,n,r,o){return t*=1,n>>>=0,o||k(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function S(e,t,n,r,o){return t*=1,n>>>=0,o||k(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,s,a,l,c,d,u,h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var p=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a,l=parseInt(t.substr(2*s,2),16);if((a=l)!=a)break;e[n+s]=l}return s}(this,e,t,n);case"utf8":case"utf-8":return i=t,o=n,M(N(e,this.length-i),this,i,o);case"ascii":return s=t,a=n,M(A(e),this,s,a);case"latin1":case"binary":return function(e,t,n,r){return M(A(t),e,n,r)}(this,e,t,n);case"base64":return l=t,c=n,M(E(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,u=n,M(function(e,t){for(var n,r,i=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i.push(n%256),i.push(r);return i}(e,this.length-d),this,d,u);default:if(p)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,a.prototype),r},a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;x(this,e,t,n,i,0)}var o=1,s=0;for(this[t]=255&e;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n},a.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;x(this,e,t,n,i,0)}var o=n-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,n){return w(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return w(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return S(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return S(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var o=i-1;o>=0;--o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var s=a.isBuffer(e)?e:a.from(e,r),l=s.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=s[i%l]}return this};var C=/[^+/0-9A-Za-z-_]/g;function N(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319||s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return o}function A(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function E(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var I=function(){for(var e="0123456789abcdef",t=Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},783:function(e,t){t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,c=l>>1,d=-7,u=n?i-1:0,h=n?-1:1,p=e[t+u];for(u+=h,o=p&(1<<-d)-1,p>>=-d,d+=a;d>0;o=256*o+e[t+u],u+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+e[t+u],u+=h,d-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,l,c=8*o-i-1,d=(1<<c)-1,u=d>>1,h=5960464477539062e-23*(23===i),p=r?0:o-1,f=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=d?(a=0,s=d):s+u>=1?(a=(t*l-1)*Math.pow(2,i),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=255&s,p+=f,s/=256,c-=8);e[n+p-f]|=128*m}}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}},s=!0;try{r[e](n,n.exports,o),s=!1}finally{s&&delete i[e]}return n.exports}o.ab="/ROOT/node_modules/.pnpm/next@16.1.6_@babel+core@7.28.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/buffer/",t.exports=o(72)},4135,(e,t,n)=>{e.e,function(e){let t=Symbol("newer"),n=Symbol("older");class r{constructor(e,t){"number"!=typeof e&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,o=this.limit||Number.MAX_VALUE;this._keymap.clear();let s=e[Symbol.iterator]();for(let e=s.next();!e.done;e=s.next()){let s=new i(e.value[0],e.value[1]);if(this._keymap.set(s.key,s),r?(r[t]=s,s[n]=r):this.oldest=s,r=s,0==o--)throw Error("overflow")}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var o=this._keymap.get(e);return o?(o.value=r,this._markEntryAsUsed(o)):(this._keymap.set(e,o=new i(e,r)),this.newest?(this.newest[t]=o,o[n]=this.newest):this.oldest=o,this.newest=o,++this.size,this.size>this.limit&&this.shift()),this}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new s(this.oldest)}values(){return new a(this.oldest)}entries(){return this}[Symbol.iterator](){return new o(this.oldest)}forEach(e,n){"object"!=typeof n&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e="",n=this.oldest;n;)e+=String(n.key)+":"+n.value,(n=n[t])&&(e+=" < ");return e}}function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function o(e){this.entry=e}function s(e){this.entry=e}function a(e){this.entry=e}e.LRUMap=r,o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}},s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}},a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}}(n)},69090,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,o=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g;function u(e){return e?e.replace(d,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,d=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function p(){var e={line:n,column:d};return function(t){return t.position=new f(e),g(o),t}}function f(e){this.start=e,this.end={line:n,column:d},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+d+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=d,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function y(e){var t;for(e=e||[];t=v();)!1!==t&&e.push(t);return e}function v(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return d+=2,h(r),e=e.slice(n),d+=2,t({type:"comment",comment:r})}}f.prototype.content=e,g(o);var b,x=[];for(y(x);b=function(){var e=p(),t=g(s);if(t){if(v(),!g(a))return m("property missing ':'");var n=g(l),i=e({type:"declaration",property:u(t[0].replace(r,"")),value:n?u(n[0].replace(r,"")):""});return g(c),i}}();)!1!==b&&(x.push(b),y(x));return x}},59596,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),o="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;o?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(69090))},51521,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,o=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},c=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||o.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(a,c):e.replace(s,c)).replace(i,l))}},63185,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(59596)),i=e.r(51521);function o(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}o.default=o,t.exports=o},75609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},d=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(s)return s(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,o,s,u=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof u&&(f=u,u=arguments[1]||{},h=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});h<p;++h)if(t=arguments[h],null!=t)for(n in t)r=d(u,n),u!==(i=d(t,n))&&(f&&i&&(l(i)||(o=a(i)))?(o?(o=!1,s=r&&a(r)?r:[]):s=r&&l(r)?r:{},c(u,{name:n,newValue:e(f,s,i)})):void 0!==i&&c(u,{name:n,newValue:i}));return u}},36508,e=>{"use strict";let t,n,r,i,o,s,a;var l,c,d,u,h,p,f,m,g,y,v,b,x,k,w,S,C,N,A,E,M,T,I,L,O,D,R,P,_,j,B,z,$,F,U,H,W,V,G,q,K,J,X,Y,Q,Z,ee=e.i(2560),et=e.i(97747),en=e.i(41855),er=e.i(23790);function ei(e,t=2e3){let[n,r]=(0,et.useState)(null),[i,o]=(0,et.useState)(!0),[s,a]=(0,et.useState)(null),[l,c]=(0,et.useState)(!1),[d,u]=(0,et.useState)(0),h=(0,et.useRef)(!0),p=(0,et.useCallback)(async()=>{try{let t=await e();h.current&&(r(t),a(null),c(!1),u(Date.now()),o(!1))}catch(e){h.current&&(a(e.message),c(!0),o(!1))}},[e]);return(0,et.useEffect)(()=>{h.current=!0,o(!0),p();let e=setInterval(p,t);return()=>{h.current=!1,clearInterval(e)}},[p,t]),{data:n,loading:i,error:s,stale:l,lastUpdate:d,refresh:p}}var eo=e.i(89871);function es({agent:e}){return(0,ee.jsxs)("div",{className:"flex items-center h-6 px-2 hover:bg-[var(--surface-hover)]",children:[(0,ee.jsx)("span",{className:"w-3 shrink-0",style:{color:e.isBusy?"var(--yellow)":"var(--dim)"},children:e.isBusy?"●":"○"}),(0,ee.jsx)("span",{className:"w-[16ch] shrink-0 text-[var(--fg)] truncate",children:e.paneTitle}),(0,ee.jsx)("span",{className:`flex-1 truncate ${e.taskTitle?"text-[var(--fg-secondary)]":"text-[var(--dim)]"}`,children:e.taskTitle??(e.isBusy?"working...":"idle")}),e.elapsed&&(0,ee.jsx)("span",{className:"text-[var(--dim)] shrink-0 pl-2",children:e.elapsed})]})}var ea=e.i(71538);let el="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ec(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function ed(e){return"nodeType"in e}function eu(e){var t,n;return e?ec(e)?e:ed(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function eh(e){let{Document:t}=eu(e);return e instanceof t}function ep(e){return!ec(e)&&e instanceof eu(e).HTMLElement}function ef(e){return e instanceof eu(e).SVGElement}function em(e){return e?ec(e)?e.document:ed(e)?eh(e)?e:ep(e)||ef(e)?e.ownerDocument:document:document:document}let eg=el?et.useLayoutEffect:et.useEffect;function ey(e){let t=(0,et.useRef)(e);return eg(()=>{t.current=e}),(0,et.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function ev(e,t){void 0===t&&(t=[e]);let n=(0,et.useRef)(e);return eg(()=>{n.current!==e&&(n.current=e)},t),n}function eb(e,t){let n=(0,et.useRef)();return(0,et.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ex(e){let t=ey(e),n=(0,et.useRef)(null),r=(0,et.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function ek(e){let t=(0,et.useRef)();return(0,et.useEffect)(()=>{t.current=e},[e]),t.current}let ew={};function eS(e,t){return(0,et.useMemo)(()=>{if(t)return t;let n=null==ew[e]?0:ew[e]+1;return ew[e]=n,e+"-"+n},[e,t])}function eC(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{for(let[r,i]of Object.entries(n)){let n=t[r];null!=n&&(t[r]=n+e*i)}return t},{...t})}}let eN=eC(1),eA=eC(-1);function eE(e){if(!e)return!1;let{KeyboardEvent:t}=eu(e.target);return t&&e instanceof t}function eM(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=eu(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let eT=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[eT.Translate.toString(e),eT.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),eI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]",eL={display:"none"};function eO(e){let{id:t,value:n}=e;return et.default.createElement("div",{id:t,style:eL},n)}function eD(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return et.default.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}let eR=(0,et.createContext)(null),eP={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},e_={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ej(e){var t;let n,{announcements:r=e_,container:i,hiddenTextDescribedById:o,screenReaderInstructions:s=eP}=e,{announce:a,announcement:l}=function(){let[e,t]=(0,et.useState)("");return{announce:(0,et.useCallback)(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=eS("DndLiveRegion"),[d,u]=(0,et.useState)(!1);if((0,et.useEffect)(()=>{u(!0)},[]),t=(0,et.useMemo)(()=>({onDragStart(e){let{active:t}=e;a(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&a(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;a(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;a(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;a(r.onDragCancel({active:t,over:n}))}}),[a,r]),n=(0,et.useContext)(eR),(0,et.useEffect)(()=>{if(!n)throw Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n]),!d)return null;let h=et.default.createElement(et.default.Fragment,null,et.default.createElement(eO,{id:o,value:s.draggable}),et.default.createElement(eD,{id:c,announcement:l}));return i?(0,ea.createPortal)(h,i):h}function eB(){}(l=C||(C={})).DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable";let ez=Object.freeze({x:0,y:0});function e$(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function eF(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function eU(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}let eH=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=eU(t,t.left,t.top),o=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){var s;let n=(s=eU(r),Math.sqrt(Math.pow(s.x-i.x,2)+Math.pow(s.y-i.y,2)));o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(e$)},eW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,o=n.get(r);if(o){let n=function(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height);if(r<i&&n<o){let s=t.width*t.height,a=e.width*e.height,l=(i-r)*(o-n);return Number((l/(s+a-l)).toFixed(4))}return 0}(o,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(eF)};function eV(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ez}let eG=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((e,t)=>({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})};function eq(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}let eK={ignoreTransform:!1};function eJ(e,t){void 0===t&&(t=eK);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=eu(e).getComputedStyle(e);t&&(n=function(e,t,n){let r=eq(t);if(!r)return e;let{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,r))}let{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function eX(e){return eJ(e,{ignoreTransform:!0})}function eY(e,t){let n=[];return e?function r(i){var o,s;let a;if(null!=t&&n.length>=t||!i)return n;if(eh(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ep(i)||ef(i)||n.includes(i))return n;let l=eu(e).getComputedStyle(i);return(i!==e&&(void 0===(o=l)&&(o=eu(i).getComputedStyle(i)),a=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let t=o[e];return"string"==typeof t&&a.test(t)}))&&n.push(i),void 0===(s=l)&&(s=eu(i).getComputedStyle(i)),"fixed"===s.position)?n:r(i.parentNode)}(e):n}function eQ(e){let[t]=eY(e,1);return null!=t?t:null}function eZ(e){return el&&e?ec(e)?e:ed(e)?eh(e)||e===em(e).scrollingElement?window:ep(e)?e:null:null:null}function e0(e){return ec(e)?e.scrollX:e.scrollLeft}function e1(e){return ec(e)?e.scrollY:e.scrollTop}function e2(e){return{x:e0(e),y:e1(e)}}function e8(e){return!!el&&!!e&&e===document.scrollingElement}function e5(e){let t={x:0,y:0},n=e8(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x;return{isTop:i,isLeft:o,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(c=N||(N={}))[c.Forward=1]="Forward",c[c.Backward=-1]="Backward";let e6={x:.2,y:.2};function e3(e){return e.reduce((e,t)=>eN(e,e2(t)),ez)}function e4(e,t){if(void 0===t&&(t=eJ),!e)return;let{top:n,left:r,bottom:i,right:o}=t(e);eQ(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}let e7=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+e0(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+e1(t),0)}]];class e9{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=eY(t),r=e3(n);for(const[t,i,o]of(this.rect={...e},this.width=e.width,this.height=e.height,e7))for(const e of i)Object.defineProperty(this,e,{get:()=>{let i=o(n),s=r[t]-i;return this.rect[e]+s},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class te{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function tt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}function tn(e){e.preventDefault()}function tr(e){e.stopPropagation()}(d=A||(A={})).Click="click",d.DragStart="dragstart",d.Keydown="keydown",d.ContextMenu="contextmenu",d.Resize="resize",d.SelectionChange="selectionchange",d.VisibilityChange="visibilitychange",(u=E||(E={})).Space="Space",u.Down="ArrowDown",u.Right="ArrowRight",u.Left="ArrowLeft",u.Up="ArrowUp",u.Esc="Escape",u.Enter="Enter",u.Tab="Tab";let ti={start:[E.Space,E.Enter],cancel:[E.Esc],end:[E.Space,E.Enter,E.Tab]},to=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case E.Right:return{...n,x:n.x+25};case E.Left:return{...n,x:n.x-25};case E.Down:return{...n,y:n.y+25};case E.Up:return{...n,y:n.y-25}}};class ts{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new te(em(t)),this.windowListeners=new te(eu(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(A.Resize,this.handleCancel),this.windowListeners.add(A.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(A.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&e4(n),t(ez)}handleKeyDown(e){if(eE(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=ti,coordinateGetter:o=to,scrollBehavior:s="smooth"}=r,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);let{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:ez;this.referenceCoordinates||(this.referenceCoordinates=c);let d=o(e,{active:t,context:n.current,currentCoordinates:c});if(d){let t=eA(d,c),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:o,isRight:a,isLeft:l,isBottom:c,maxScroll:u,minScroll:h}=e5(n),p=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}(n),f={x:Math.min(i===E.Right?p.right-p.width/2:p.right,Math.max(i===E.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(i===E.Down?p.bottom-p.height/2:p.bottom,Math.max(i===E.Down?p.top:p.top+p.height/2,d.y))},m=i===E.Right&&!a||i===E.Left&&!l,g=i===E.Down&&!c||i===E.Up&&!o;if(m&&f.x!==d.x){let e=n.scrollLeft+t.x,o=i===E.Right&&e<=u.x||i===E.Left&&e>=h.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:s});o?r.x=n.scrollLeft-e:r.x=i===E.Right?n.scrollLeft-u.x:n.scrollLeft-h.x,r.x&&n.scrollBy({left:-r.x,behavior:s});break}if(g&&f.y!==d.y){let e=n.scrollTop+t.y,o=i===E.Down&&e<=u.y||i===E.Up&&e>=h.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:s});o?r.y=n.scrollTop-e:r.y=i===E.Down?n.scrollTop-u.y:n.scrollTop-h.y,r.y&&n.scrollBy({top:-r.y,behavior:s});break}}this.handleMove(e,eN(eA(d,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ta(e){return!!(e&&"distance"in e)}function tl(e){return!!(e&&"delay"in e)}ts.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ti,onActivation:i}=t,{active:o}=n,{code:s}=e.nativeEvent;if(r.start.includes(s)){let t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class tc{constructor(e,t,n){var r;void 0===n&&(n=function(e){let{EventTarget:t}=eu(e);return e instanceof t?e:em(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:o}=i;this.props=e,this.events=t,this.document=em(o),this.documentListeners=new te(this.document),this.listeners=new te(n),this.windowListeners=new te(eu(o)),this.initialCoordinates=null!=(r=eM(i))?r:ez,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(A.Resize,this.handleCancel),this.windowListeners.add(A.DragStart,tn),this.windowListeners.add(A.VisibilityChange,this.handleCancel),this.windowListeners.add(A.ContextMenu,tn),this.documentListeners.add(A.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(tl(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(ta(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(A.Click,tr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(A.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:n,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:s}}=i;if(!r)return;let a=null!=(t=eM(e))?t:ez,l=eA(r,a);if(!n&&s){if(ta(s)){if(null!=s.tolerance&&tt(l,s.tolerance))return this.handleCancel();if(tt(l,s.distance))return this.handleStart()}return tl(s)&&tt(l,s.tolerance)?this.handleCancel():void this.handlePending(s,l)}e.cancelable&&e.preventDefault(),o(a)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===E.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let td={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tu extends tc{constructor(e){const{event:t}=e;super(e,td,em(t.target))}}tu.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!!n.isPrimary&&0===n.button&&(null==r||r({event:n}),!0)}}];(h=M||(M={}))[h.RightClick=2]="RightClick";(p=T||(T={}))[p.Pointer=0]="Pointer",p[p.DraggableRect=1]="DraggableRect",(f=I||(I={}))[f.TreeOrder=0]="TreeOrder",f[f.ReversedTreeOrder=1]="ReversedTreeOrder";let th={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};(m=L||(L={}))[m.Always=0]="Always",m[m.BeforeDragging=1]="BeforeDragging",m[m.WhileDragging=2]="WhileDragging",(O||(O={})).Optimized="optimized";let tp=new Map;function tf(e,t){return eb(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function tm(e){let{callback:t,disabled:n}=e,r=ey(t),i=(0,et.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,et.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function tg(e){return new e9(eJ(e),e)}function ty(e,t,n){void 0===t&&(t=tg);let[r,i]=(0,et.useState)(null);function o(){i(r=>{if(!e)return null;if(!1===e.isConnected){var i;return null!=(i=null!=r?r:n)?i:null}let o=t(e);return JSON.stringify(r)===JSON.stringify(o)?r:o})}let s=function(e){let{callback:t,disabled:n}=e,r=ey(t),i=(0,et.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,et.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=tm({callback:o});return eg(()=>{o(),e?(null==a||a.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==s||s.disconnect())},[e]),r}let tv=[];function tb(e,t){void 0===t&&(t=[]);let n=(0,et.useRef)(null);return(0,et.useEffect)(()=>{n.current=null},t),(0,et.useEffect)(()=>{let t=e!==ez;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?eA(e,n.current):ez}function tx(e){return(0,et.useMemo)(()=>{let t,n;return e?(t=e.innerWidth,{top:0,left:0,right:t,bottom:n=e.innerHeight,width:t,height:n}):null},[e])}let tk=[];function tw(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ep(t)?t:e}let tS=[{sensor:tu,options:{}},{sensor:ts,options:{}}],tC={current:{}},tN={draggable:{measure:eX},droppable:{measure:eX,strategy:L.WhileDragging,frequency:O.Optimized},dragOverlay:{measure:eJ}};class tA extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}let tE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tA,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:eB},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tN,measureDroppableContainers:eB,windowRect:null,measuringScheduled:!1},tM={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:eB,draggableNodes:new Map,over:null,measureDroppableContainers:eB},tT=(0,et.createContext)(tM),tI=(0,et.createContext)(tE);function tL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tA}}}function tO(e,t){switch(t.type){case C.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case C.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case C.DragEnd:case C.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case C.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new tA(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case C.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;let s=new tA(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case C.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let o=new tA(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function tD(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,et.useContext)(tT),o=ek(r),s=ek(null==n?void 0:n.id);return(0,et.useEffect)(()=>{if(!t&&!r&&o&&null!=s){if(!eE(o)||document.activeElement===o.target)return;let e=i.get(s);if(!e)return;let{activatorNode:t,node:n}=e;(t.current||n.current)&&requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=e.matches(eI)?e:e.querySelector(eI);if(t){t.focus();break}}})}},[r,t,i,s,o]),null}function tR(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}let tP=(0,et.createContext)({...ez,scaleX:1,scaleY:1});(g=D||(D={}))[g.Uninitialized=0]="Uninitialized",g[g.Initializing=1]="Initializing",g[g.Initialized=2]="Initialized";let t_=(0,et.memo)(function(e){var t,n,r,i,o,s,a,l;let c,d,u,h,p,f,m,g,{id:y,accessibility:v,autoScroll:b=!0,children:x,sensors:k=tS,collisionDetection:w=eW,measuring:S,modifiers:A,...E}=e,[M,O]=(0,et.useReducer)(tO,void 0,tL),[R,P]=function(){let[e]=(0,et.useState)(()=>new Set),t=(0,et.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,et.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[_,j]=(0,et.useState)(D.Uninitialized),B=_===D.Initialized,{draggable:{active:z,nodes:$,translate:F},droppable:{containers:U}}=M,H=null!=z?$.get(z):null,W=(0,et.useRef)({initial:null,translated:null}),V=(0,et.useMemo)(()=>{var e;return null!=z?{id:z,data:null!=(e=null==H?void 0:H.data)?e:tC,rect:W}:null},[z,H]),G=(0,et.useRef)(null),[q,K]=(0,et.useState)(null),[J,X]=(0,et.useState)(null),Y=ev(E,Object.values(E)),Q=eS("DndDescribedBy",y),Z=(0,et.useMemo)(()=>U.getEnabled(),[U]),ee=(0,et.useMemo)(()=>({draggable:{...tN.draggable,...null==S?void 0:S.draggable},droppable:{...tN.droppable,...null==S?void 0:S.droppable},dragOverlay:{...tN.dragOverlay,...null==S?void 0:S.dragOverlay}}),[null==S?void 0:S.draggable,null==S?void 0:S.droppable,null==S?void 0:S.dragOverlay]),{droppableRects:en,measureDroppableContainers:er,measuringScheduled:ei}=function(e,t){let{dragging:n,dependencies:r,config:i}=t,[o,s]=(0,et.useState)(null),{frequency:a,measure:l,strategy:c}=i,d=(0,et.useRef)(e),u=function(){switch(c){case L.Always:return!1;case L.BeforeDragging:return n;default:return!n}}(),h=ev(u),p=(0,et.useCallback)(function(e){void 0===e&&(e=[]),h.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),f=(0,et.useRef)(null),m=eb(t=>{if(u&&!n)return tp;if(!t||t===tp||d.current!==e||null!=o){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new e9(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,u,l]);return(0,et.useEffect)(()=>{d.current=e},[e]),(0,et.useEffect)(()=>{u||p()},[n,u]),(0,et.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,et.useEffect)(()=>{u||"number"!=typeof a||null!==f.current||(f.current=setTimeout(()=>{p(),f.current=null},a))},[a,u,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:null!=o}}(Z,{dragging:B,dependencies:[F.x,F.y],config:ee.droppable}),eo=eb(e=>{var t;return null==z?null:null!=(t=null!=p?p:e)?t:null},[p=(h=null!=z?$.get(z):void 0)?h.node.current:null,z]),es=(0,et.useMemo)(()=>J?eM(J):null,[J]),ec=(c=(null==q?void 0:q.autoScrollEnabled)===!1,d="object"==typeof b?!1===b.enabled:!1===b,u=B&&!c&&!d,"object"==typeof b?{...b,enabled:u}:{enabled:u}),ed=tf(eo,ee.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,o=(0,et.useRef)(!1),{x:s,y:a}="boolean"==typeof i?{x:i,y:i}:i;eg(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let i=eV(n(e),r);if(s||(i.x=0),a||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=eQ(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,a,r,n])}({activeNode:null!=z?$.get(z):null,config:ec.layoutShiftCompensation,initialRect:ed,measure:ee.draggable.measure});let eh=ty(eo,ee.draggable.measure,ed),ef=ty(eo?eo.parentElement:null),em=(0,et.useRef)({activatorEvent:null,active:null,activeNode:eo,collisionRect:null,collisions:null,droppableRects:en,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:U,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ey=U.getNodeFor(null==(t=em.current.over)?void 0:t.id),ew=function(e){let{measure:t}=e,[n,r]=(0,et.useState)(null),i=tm({callback:(0,et.useCallback)(e=>{for(let{target:n}of e)if(ep(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[o,s]=ex((0,et.useCallback)(e=>{let n=tw(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]));return(0,et.useMemo)(()=>({nodeRef:o,rect:n,setRef:s}),[n,o,s])}({measure:ee.dragOverlay.measure}),eC=null!=(n=ew.nodeRef.current)?n:eo,eA=B?null!=(r=ew.rect)?r:eh:null,eE=!!(ew.nodeRef.current&&ew.rect),eT=(f=tf(o=eE?null:eh),eV(o,f)),eI=tx(eC?eu(eC):null),eL=(s=B?null!=ey?ey:eo:null,m=(0,et.useRef)(s),g=eb(e=>s?e&&e!==tv&&s&&m.current&&s.parentNode===m.current.parentNode?e:eY(s):tv,[s]),(0,et.useEffect)(()=>{m.current=s},[s]),g),eO=function(e,t){void 0===t&&(t=eJ);let[n]=e,r=tx(n?eu(n):null),[i,o]=(0,et.useState)(tk);function s(){o(()=>e.length?e.map(e=>e8(e)?r:new e9(t(e),e)):tk)}let a=tm({callback:s});return eg(()=>{null==a||a.disconnect(),s(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(eL),eD=tR(A,{transform:{x:F.x-eT.x,y:F.y-eT.y,scaleX:1,scaleY:1},activatorEvent:J,active:V,activeNodeRect:eh,containerNodeRect:ef,draggingNodeRect:eA,over:em.current.over,overlayNodeRect:ew.rect,scrollableAncestors:eL,scrollableAncestorRects:eO,windowRect:eI}),eP=es?eN(es,F):null,e_=function(e){let[t,n]=(0,et.useState)(null),r=(0,et.useRef)(e),i=(0,et.useCallback)(e=>{let t=eZ(e.target);t&&n(e=>e?(e.set(t,e2(t)),new Map(e)):null)},[]);return(0,et.useEffect)(()=>{let t=r.current;if(e!==t){o(t);let s=e.map(e=>{let t=eZ(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,e2(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{let t=eZ(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),(0,et.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>eN(e,t),ez):e3(e):ez,[e,t])}(eL),eB=tb(e_),e$=tb(e_,[eh]),eF=eN(eD,eB),eU=eA?eG(eA,eD):null,eH=V&&eU?w({active:V,collisionRect:eU,droppableRects:en,droppableContainers:Z,pointerCoordinates:eP}):null,eq=function(e,t){if(!e||0===e.length)return null;let[n]=e;return n.id}(eH,0),[eK,eX]=(0,et.useState)(null),e0=(a=eE?eD:eN(eD,e$),l=null!=(i=null==eK?void 0:eK.rect)?i:null,{...a,scaleX:l&&eh?l.width/eh.width:1,scaleY:l&&eh?l.height/eh.height:1}),e1=(0,et.useRef)(null),e4=(0,et.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==G.current)return;let i=$.get(G.current);if(!i)return;let o=e.nativeEvent,s=new n({active:G.current,activeNode:i,event:o,options:r,context:em,onAbort(e){if(!$.get(e))return;let{onDragAbort:t}=Y.current,n={id:e};null==t||t(n),R({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!$.get(e))return;let{onDragPending:i}=Y.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==i||i(o),R({type:"onDragPending",event:o})},onStart(e){let t=G.current;if(null==t)return;let n=$.get(t);if(!n)return;let{onDragStart:r}=Y.current,i={activatorEvent:o,active:{id:t,data:n.data,rect:W}};(0,ea.unstable_batchedUpdates)(()=>{null==r||r(i),j(D.Initializing),O({type:C.DragStart,initialCoordinates:e,active:t}),R({type:"onDragStart",event:i}),K(e1.current),X(o)})},onMove(e){O({type:C.DragMove,coordinates:e})},onEnd:a(C.DragEnd),onCancel:a(C.DragCancel)});function a(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=em.current,s=null;if(t&&i){let{cancelDrop:a}=Y.current;s={activatorEvent:o,active:t,collisions:n,delta:i,over:r},e===C.DragEnd&&"function"==typeof a&&await Promise.resolve(a(s))&&(e=C.DragCancel)}G.current=null,(0,ea.unstable_batchedUpdates)(()=>{O({type:e}),j(D.Uninitialized),eX(null),K(null),X(null),e1.current=null;let t=e===C.DragEnd?"onDragEnd":"onDragCancel";if(s){let e=Y.current[t];null==e||e(s),R({type:t,event:s})}})}}e1.current=s},[$]),e7=(0,et.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,o=$.get(r);null!==G.current||!o||i.dndKit||i.defaultPrevented||!0===e(n,t.options,{active:o})&&(i.dndKit={capturedBy:t.sensor},G.current=r,e4(n,t))},[$,e4]),te=(0,et.useMemo)(()=>k.reduce((e,t)=>{let{sensor:n}=t;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:e7(e.handler,t)}))]},[]),[k,e7]);(0,et.useEffect)(()=>{if(!el)return;let e=k.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},k.map(e=>{let{sensor:t}=e;return t})),eg(()=>{eh&&_===D.Initializing&&j(D.Initialized)},[eh,_]),(0,et.useEffect)(()=>{let{onDragMove:e}=Y.current,{active:t,activatorEvent:n,collisions:r,over:i}=em.current;if(!t||!n)return;let o={active:t,activatorEvent:n,collisions:r,delta:{x:eF.x,y:eF.y},over:i};(0,ea.unstable_batchedUpdates)(()=>{null==e||e(o),R({type:"onDragMove",event:o})})},[eF.x,eF.y]),(0,et.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=em.current;if(!e||null==G.current||!t||!i)return;let{onDragOver:o}=Y.current,s=r.get(eq),a=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:a};(0,ea.unstable_batchedUpdates)(()=>{eX(a),null==o||o(l),R({type:"onDragOver",event:l})})},[eq]),eg(()=>{em.current={activatorEvent:J,active:V,activeNode:eo,collisionRect:eU,collisions:eH,droppableRects:en,draggableNodes:$,draggingNode:eC,draggingNodeRect:eA,droppableContainers:U,over:eK,scrollableAncestors:eL,scrollAdjustedTranslate:eF},W.current={initial:eA,translated:eU}},[V,eo,eH,eU,$,eC,eA,en,U,eK,eL,eF]),function(e){let t,{acceleration:n,activator:r=T.Pointer,canScroll:i,draggingRect:o,enabled:s,interval:a=5,order:l=I.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:p}=e,f=function(e){let{delta:t,disabled:n}=e,r=ek(t);return eb(e=>{if(n||!r||!e)return th;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:e.x[N.Backward]||-1===i.x,[N.Forward]:e.x[N.Forward]||1===i.x},y:{[N.Backward]:e.y[N.Backward]||-1===i.y,[N.Forward]:e.y[N.Forward]||1===i.y}}},[n,t,r])}({delta:h,disabled:!s}),[m,g]=(t=(0,et.useRef)(null),[(0,et.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,et.useCallback)(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]),y=(0,et.useRef)({x:0,y:0}),v=(0,et.useRef)({x:0,y:0}),b=(0,et.useMemo)(()=>{switch(r){case T.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case T.DraggableRect:return o}},[r,o,c]),x=(0,et.useRef)(null),k=(0,et.useCallback)(()=>{let e=x.current;if(!e)return;let t=y.current.x*v.current.x,n=y.current.y*v.current.y;e.scrollBy(t,n)},[]),w=(0,et.useMemo)(()=>l===I.TreeOrder?[...d].reverse():d,[l,d]);(0,et.useEffect)(()=>{if(!s||!d.length||!b)return void g();for(let e of w){if((null==i?void 0:i(e))===!1)continue;let t=u[d.indexOf(e)];if(!t)continue;let{direction:r,speed:o}=function(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;void 0===r&&(r=10),void 0===i&&(i=e6);let{isTop:c,isBottom:d,isLeft:u,isRight:h}=e5(e),p={x:0,y:0},f={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+m.height?(p.y=N.Backward,f.y=r*Math.abs((t.top+m.height-o)/m.height)):!d&&l>=t.bottom-m.height&&(p.y=N.Forward,f.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!h&&a>=t.right-m.width?(p.x=N.Forward,f.x=r*Math.abs((t.right-m.width-a)/m.width)):!u&&s<=t.left+m.width&&(p.x=N.Backward,f.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:p,speed:f}}(e,t,b,n,p);for(let e of["x","y"])f[e][r[e]]||(o[e]=0,r[e]=0);if(o.x>0||o.y>0){g(),x.current=e,m(k,a),y.current=o,v.current=r;return}}y.current={x:0,y:0},v.current={x:0,y:0},g()},[n,k,i,g,s,a,JSON.stringify(b),JSON.stringify(f),m,d,w,u,JSON.stringify(p)])}({...ec,delta:F,draggingRect:eU,pointerCoordinates:eP,scrollableAncestors:eL,scrollableAncestorRects:eO});let tt=(0,et.useMemo)(()=>({active:V,activeNode:eo,activeNodeRect:eh,activatorEvent:J,collisions:eH,containerNodeRect:ef,dragOverlay:ew,draggableNodes:$,droppableContainers:U,droppableRects:en,over:eK,measureDroppableContainers:er,scrollableAncestors:eL,scrollableAncestorRects:eO,measuringConfiguration:ee,measuringScheduled:ei,windowRect:eI}),[V,eo,eh,J,eH,ef,ew,$,U,en,eK,er,eL,eO,ee,ei,eI]),tn=(0,et.useMemo)(()=>({activatorEvent:J,activators:te,active:V,activeNodeRect:eh,ariaDescribedById:{draggable:Q},dispatch:O,draggableNodes:$,over:eK,measureDroppableContainers:er}),[J,te,V,eh,O,Q,$,eK,er]);return et.default.createElement(eR.Provider,{value:P},et.default.createElement(tT.Provider,{value:tn},et.default.createElement(tI.Provider,{value:tt},et.default.createElement(tP.Provider,{value:e0},x)),et.default.createElement(tD,{disabled:(null==v?void 0:v.restoreFocus)===!1})),et.default.createElement(ej,{...v,hiddenTextDescribedById:Q}))}),tj=(0,et.createContext)(null),tB="button",tz={timeout:25};function t$(e){let{animation:t,children:n}=e,[r,i]=(0,et.useState)(null),[o,s]=(0,et.useState)(null),a=ek(n);return n||r||!a||i(a),eg(()=>{if(!o)return;let e=null==r?void 0:r.key,n=null==r?void 0:r.props.id;null==e||null==n?i(null):Promise.resolve(t(n,o)).then(()=>{i(null)})},[t,r,o]),et.default.createElement(et.default.Fragment,null,n,r?(0,et.cloneElement)(r,{ref:s}):null)}let tF={x:0,y:0,scaleX:1,scaleY:1};function tU(e){let{children:t}=e;return et.default.createElement(tT.Provider,{value:tM},et.default.createElement(tP.Provider,{value:tF},t))}let tH={position:"fixed",touchAction:"none"},tW=e=>eE(e)?"transform 250ms ease":void 0,tV=(0,et.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:c,transition:d=tW}=e;if(!a)return null;let u=i?c:{...c,scaleX:1,scaleY:1},h={...tH,width:a.width,height:a.height,top:a.top,left:a.left,transform:eT.Transform.toString(u),transformOrigin:i&&r?function(e,t){let n=eM(e);if(!n)return"0 0";let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}(r,a):void 0,transition:"function"==typeof d?d(r):d,...l};return et.default.createElement(n,{className:s,style:h,ref:t},o)}),tG={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:eT.Transform.toString(t)},{transform:eT.Transform.toString(n)}]},sideEffects:(i={styles:{active:{opacity:"0"}}},e=>{let{active:t,dragOverlay:n}=e,r={},{styles:o,className:s}=i;if(null!=o&&o.active)for(let[e,n]of Object.entries(o.active))void 0!==n&&(r[e]=t.node.style.getPropertyValue(e),t.node.style.setProperty(e,n));if(null!=o&&o.dragOverlay)for(let[e,t]of Object.entries(o.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return null!=s&&s.active&&t.node.classList.add(s.active),null!=s&&s.dragOverlay&&n.node.classList.add(s.dragOverlay),function(){for(let[e,n]of Object.entries(r))t.node.style.setProperty(e,n);null!=s&&s.active&&t.node.classList.remove(s.active)}})},tq=0,tK=et.default.memo(e=>{var t;let{adjustScale:n=!1,children:r,dropAnimation:i,style:o,transition:s,modifiers:a,wrapperElement:l="div",className:c,zIndex:d=999}=e,{activatorEvent:u,active:h,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:k,windowRect:w}=(0,et.useContext)(tI),S=(0,et.useContext)(tP),C=(t=null==h?void 0:h.id,(0,et.useMemo)(()=>{if(null!=t)return++tq},[t])),N=tR(a,{activatorEvent:u,active:h,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:k,transform:S,windowRect:w}),A=tf(p),E=function(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ey((e,o)=>{if(null===t)return;let s=n.get(e);if(!s)return;let a=s.node.current;if(!a)return;let l=tw(o);if(!l)return;let{transform:c}=eu(o).getComputedStyle(o),d=eq(c);if(!d)return;let u="function"==typeof t?t:function(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...tG,...e};return e=>{let{active:o,dragOverlay:s,transform:a,...l}=e;if(!t)return;let c={x:s.rect.left-o.rect.left,y:s.rect.top-o.rect.top},d={scaleX:1!==a.scaleX?o.rect.width*a.scaleX/s.rect.width:1,scaleY:1!==a.scaleY?o.rect.height*a.scaleY/s.rect.height:1},u={x:a.x-c.x,y:a.y-c.y,...d},h=i({...l,active:o,dragOverlay:s,transform:{initial:a,final:u}}),[p]=h,f=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(f))return;let m=null==r?void 0:r({active:o,dragOverlay:s,...l}),g=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{g.onfinish=()=>{null==m||m(),e()}})}}(t);return e4(a,i.draggable.measure),u({active:{id:e,data:s.data,node:a,rect:i.draggable.measure(a)},draggableNodes:n,dragOverlay:{node:o,rect:i.dragOverlay.measure(l)},droppableContainers:r,measuringConfiguration:i,transform:d})})}({config:i,draggableNodes:m,droppableContainers:g,measuringConfiguration:b}),M=A?y.setRef:void 0;return et.default.createElement(tU,null,et.default.createElement(t$,{animation:E},h&&C?et.default.createElement(tV,{key:C,id:h.id,ref:M,as:l,activatorEvent:u,adjustScale:n,className:c,transition:s,rect:A,style:{zIndex:d,...o},transform:N},r):null))}),tJ={"in-progress":"var(--yellow)",todo:"var(--dim)",review:"var(--magenta)",done:"var(--green)"};function tX({task:e,onClick:t,selected:n=!1}){let r=function(e){switch(e){case 1:return{text:"***",color:"var(--red)"};case 2:return{text:"**",color:"var(--yellow)"};default:return{text:"*",color:"var(--accent)"}}}(e.priority),i=tJ[e.status],o=e.proof?.tests&&e.proof.tests.passed===e.proof.tests.total;return(0,ee.jsxs)("div",{onClick:t,className:`cursor-pointer px-2 py-1.5 mb-px transition-colors ${n?"bg-[var(--surface-active)]":"bg-[var(--surface)] hover:bg-[var(--surface-hover)]"}`,style:{borderLeft:`2px solid ${n?"var(--accent)":i}`},children:[(0,ee.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ee.jsx)("span",{style:{color:r.color},className:"shrink-0 text-[11px]",children:r.text}),(0,ee.jsx)("span",{className:"text-[var(--dim)] shrink-0",children:e.id}),(0,ee.jsx)("span",{className:"flex-1"}),o&&(0,ee.jsx)("span",{className:"text-[var(--green)] text-[10px]",title:`${e.proof.tests.passed}/${e.proof.tests.total} tests`,children:"✓"}),e.proof?.pr&&(0,ee.jsxs)("span",{className:"text-[var(--cyan)] text-[10px]",children:["PR#",e.proof.pr.number]}),e.milestone&&(0,ee.jsx)("span",{className:"text-[var(--magenta)] text-[10px]",children:e.milestone}),e.specialty&&(0,ee.jsx)("span",{className:"text-[var(--cyan)] text-[10px]",children:e.specialty}),e.fulfills?.length>0&&(0,ee.jsxs)("span",{className:"text-[var(--yellow)] text-[10px]",title:e.fulfills.join(", "),children:["✓",e.fulfills.length]}),e.depends_on?.length>0&&(0,ee.jsxs)("span",{className:"text-[var(--dim)] text-[10px]",title:`depends: ${e.depends_on.join(", ")}`,children:["⇅",e.depends_on.length]})]}),(0,ee.jsx)("div",{className:"truncate text-[var(--fg)] mt-0.5",children:e.title}),e.assignee&&(0,ee.jsxs)("div",{className:"text-[var(--cyan)] mt-0.5 truncate text-[11px]",children:["@",e.assignee]})]})}let tY=["todo","in-progress","review","done"],tQ={"in-progress":"var(--yellow)",todo:"var(--dim)",review:"var(--magenta)",done:"var(--green)"},tZ={"in-progress":"DOING",todo:"TODO",review:"REVIEW",done:"DONE"};function t0({task:e,sessionName:t,agents:n,allTasks:r=[],onClose:i,onUpdated:o}){let[s,a]=(0,et.useState)(!1),[l,c]=(0,et.useState)(!1),[d,u]=(0,et.useState)(e.title),[h,p]=(0,et.useState)(e.description),[f,m]=(0,et.useState)(e.priority),[g,y]=(0,et.useState)(!1);async function v(n){a(!0),await (0,er.updateTask)(t,e.id,{status:n}),o(),a(!1)}async function b(n){a(!0),await (0,er.updateTask)(t,e.id,{assignee:n||void 0}),o(),a(!1)}async function x(){a(!0),await (0,er.updateTask)(t,e.id,{title:d.trim(),description:h.trim(),priority:f}),o(),a(!1),c(!1)}async function k(){a(!0),await (0,er.deleteTaskApi)(t,e.id),o(),i()}let w="text-[var(--dim)] text-[10px] uppercase tracking-wider mb-1",S="w-full bg-[var(--surface)] border border-[var(--border)] text-[var(--fg)] px-2 py-1 outline-none focus:border-[var(--accent)]",C=e.proof?.notes;return(0,ee.jsxs)("div",{className:"fixed inset-0 z-50 flex justify-end",children:[(0,ee.jsx)("div",{className:"absolute inset-0 bg-[var(--modal-overlay)]",onClick:i}),(0,ee.jsxs)("div",{className:"relative w-full max-w-md bg-[var(--bg)] border-l border-[var(--border)] overflow-auto",children:[(0,ee.jsxs)("div",{className:"flex items-center justify-between px-4 h-8 bg-[var(--surface)] border-b border-[var(--border)]",children:[(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["task ",e.id]}),(0,ee.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ee.jsx)("button",{onClick:()=>c(!l),className:`text-[11px] transition-colors ${l?"text-[var(--accent)]":"text-[var(--dim)] hover:text-[var(--fg)]"}`,children:l?"viewing":"edit"}),(0,ee.jsx)("button",{onClick:i,className:"text-[var(--dim)] hover:text-[var(--fg)] transition-colors",children:"×"})]})]}),(0,ee.jsxs)("div",{className:"p-4 space-y-4",children:[(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"title"}),l?(0,ee.jsx)("input",{type:"text",value:d,onChange:e=>u(e.target.value),className:S}):(0,ee.jsx)("div",{className:"text-[var(--fg)]",children:e.title})]}),(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"description"}),l?(0,ee.jsx)("textarea",{value:h,onChange:e=>p(e.target.value),rows:3,className:`${S} resize-none`}):(0,ee.jsx)("div",{className:"text-[var(--fg)] whitespace-pre-wrap",children:e.description||(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:"—"})})]}),(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"priority"}),l?(0,ee.jsxs)("select",{value:f,onChange:e=>m(Number(e.target.value)),className:S,children:[(0,ee.jsx)("option",{value:1,children:"P1 — critical"}),(0,ee.jsx)("option",{value:2,children:"P2 — high"}),(0,ee.jsx)("option",{value:3,children:"P3 — normal"}),(0,ee.jsx)("option",{value:4,children:"P4 — low"})]}):(0,ee.jsxs)("span",{style:{color:1===e.priority?"var(--red)":2===e.priority?"var(--yellow)":"var(--accent)"},children:["*".repeat(Math.max(1,4-e.priority))," P",e.priority]})]}),l&&(0,ee.jsx)("button",{onClick:x,disabled:s,className:"px-3 py-1 text-[var(--bg)] bg-[var(--accent)] hover:opacity-90 transition-opacity disabled:opacity-50",children:s?"saving...":"save"}),!l&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"status"}),(0,ee.jsx)("div",{className:"flex gap-1",children:tY.map(t=>(0,ee.jsx)("button",{disabled:s,onClick:()=>v(t),className:`px-2 py-0.5 border transition-colors ${e.status===t?"border-[var(--accent)] bg-[var(--surface-active)]":"border-[var(--border)] hover:border-[var(--dim)]"}`,style:e.status===t?{color:tQ[t]}:{color:"var(--dim)"},children:tZ[t]},t))})]}),!l&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"assignee"}),(0,ee.jsxs)("select",{value:e.assignee??"",onChange:e=>b(e.target.value),disabled:s,className:S,children:[(0,ee.jsx)("option",{value:"",children:"unassigned"}),n.map((e,t)=>(0,ee.jsx)("option",{value:e.paneTitle,children:e.paneTitle},`${e.paneTitle}-${t}`))]})]}),e.milestone&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"milestone"}),(0,ee.jsx)("div",{className:"text-[var(--magenta)]",children:e.milestone})]}),e.specialty&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"specialty"}),(0,ee.jsx)("div",{className:"text-[var(--cyan)]",children:e.specialty})]}),e.fulfills&&e.fulfills.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"fulfills"}),(0,ee.jsx)("div",{className:"text-[var(--yellow)]",children:e.fulfills.join(", ")})]}),e.depends_on?.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"depends on"}),(0,ee.jsx)("div",{className:"flex gap-2 flex-wrap",children:e.depends_on.map(e=>{let t=r.find(t=>t.id===e),n=t?.status==="done";return(0,ee.jsxs)("span",{className:"text-[11px] px-1.5 py-0.5 border border-[var(--border)]",style:{color:n?"var(--green)":"var(--dim)"},children:[n?"✓":"○"," ",e,t?` ${t.title.slice(0,20)}`:""]},e)})})]}),e.proof&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"proof"}),(0,ee.jsxs)("div",{className:"space-y-1.5",children:[e.proof.tests&&(0,ee.jsxs)("div",{style:{color:e.proof.tests.passed===e.proof.tests.total?"var(--green)":"var(--red)"},children:["Tests: ",e.proof.tests.passed,"/",e.proof.tests.total," ",e.proof.tests.passed===e.proof.tests.total?"passing":"failing"]}),e.proof.pr&&(0,ee.jsxs)("div",{children:[e.proof.pr.url?(0,ee.jsxs)("a",{href:e.proof.pr.url,target:"_blank",rel:"noopener noreferrer",className:"text-[var(--cyan)] hover:underline",children:["PR #",e.proof.pr.number]}):(0,ee.jsxs)("span",{className:"text-[var(--cyan)]",children:["PR #",e.proof.pr.number]}),e.proof.pr.status&&(0,ee.jsx)("span",{className:"text-[var(--dim)] ml-2",children:e.proof.pr.status})]}),e.proof.ci&&(0,ee.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ee.jsxs)("span",{style:{color:"passing"===e.proof.ci.status||"green"===e.proof.ci.status?"var(--green)":"var(--red)"},children:["CI: ",e.proof.ci.status]}),e.proof.ci.url&&(0,ee.jsx)("a",{href:e.proof.ci.url,target:"_blank",rel:"noopener noreferrer",className:"text-[var(--cyan)] text-[11px] hover:underline",children:"view"})]}),C&&(0,ee.jsx)("div",{className:"text-[var(--fg)] whitespace-pre-wrap",children:C})]})]}),e.retryCount>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"retries"}),(0,ee.jsxs)("span",{className:"text-[var(--yellow)]",children:["Retried ",e.retryCount,"/",e.maxRetries," times"]})]}),e.lastError&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"last error"}),(0,ee.jsx)("div",{className:"text-[var(--red)] text-[11px] whitespace-pre-wrap",children:e.lastError})]}),e.tags.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:w,children:"tags"}),(0,ee.jsx)("div",{className:"flex gap-1 flex-wrap",children:e.tags.map(e=>(0,ee.jsx)("span",{className:"px-1.5 py-0.5 bg-[var(--surface-active)] border border-[var(--border)] text-[var(--dim)] text-[11px]",children:e},e))})]}),(0,ee.jsx)("div",{className:"pt-4 border-t border-[var(--border)]",children:g?(0,ee.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ee.jsxs)("span",{className:"text-[var(--red)] text-[11px]",children:["Delete task ",e.id,"?"]}),(0,ee.jsx)("button",{onClick:k,disabled:s,className:"px-2 py-0.5 text-[var(--bg)] bg-[var(--red)] text-[11px] hover:opacity-90 disabled:opacity-50",children:s?"deleting...":"confirm"}),(0,ee.jsx)("button",{onClick:()=>y(!1),className:"px-2 py-0.5 text-[var(--dim)] border border-[var(--border)] text-[11px] hover:text-[var(--fg)]",children:"cancel"})]}):(0,ee.jsx)("button",{onClick:()=>y(!0),className:"text-[var(--red)] text-[11px] hover:underline",children:"delete task"})})]})]})]})}function t1({sessionName:e,goals:t,onClose:n,onCreated:r}){let[i,o]=(0,et.useState)(""),[s,a]=(0,et.useState)(""),[l,c]=(0,et.useState)(2),[d,u]=(0,et.useState)(""),[h,p]=(0,et.useState)(!1),[f,m]=(0,et.useState)(""),g=(0,et.useRef)(null);async function y(t){if(t.preventDefault(),!i.trim())return void m("Title is required");p(!0),m("");let o=await (0,er.createTask)(e,{title:i.trim(),description:s.trim()||void 0,priority:l,goal:d||void 0});p(!1),o?(r(),n()):m("Failed to create task")}(0,et.useEffect)(()=>{g.current?.focus()},[]),(0,et.useEffect)(()=>{function e(e){"Escape"===e.key&&n()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);let v="text-[var(--dim)] text-[10px] uppercase tracking-wider mb-1",b="w-full bg-[var(--surface)] border border-[var(--border)] text-[var(--fg)] px-2 py-1 outline-none focus:border-[var(--accent)] placeholder:text-[var(--dim)]";return(0,ee.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,ee.jsx)("div",{className:"absolute inset-0 bg-[var(--modal-overlay)]",onClick:n}),(0,ee.jsxs)("form",{onSubmit:y,className:"relative bg-[var(--bg)] border border-[var(--border)] w-full max-w-md",children:[(0,ee.jsxs)("div",{className:"flex items-center justify-between px-4 h-8 bg-[var(--surface)] border-b border-[var(--border)]",children:[(0,ee.jsx)("span",{className:"text-[var(--fg)]",children:"new task"}),(0,ee.jsx)("button",{type:"button",onClick:n,className:"text-[var(--dim)] hover:text-[var(--fg)] transition-colors",children:"esc ×"})]}),(0,ee.jsxs)("div",{className:"p-4 space-y-3",children:[(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:v,children:"title *"}),(0,ee.jsx)("input",{ref:g,type:"text",value:i,onChange:e=>o(e.target.value),placeholder:"What needs to be done?",className:b})]}),(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{className:v,children:"description"}),(0,ee.jsx)("textarea",{value:s,onChange:e=>a(e.target.value),placeholder:"Details...",rows:3,className:`${b} resize-none`})]}),(0,ee.jsxs)("div",{className:"flex gap-3",children:[(0,ee.jsxs)("div",{className:"flex-1",children:[(0,ee.jsx)("div",{className:v,children:"priority"}),(0,ee.jsxs)("select",{value:l,onChange:e=>c(Number(e.target.value)),className:b,children:[(0,ee.jsx)("option",{value:1,children:"P1 — critical"}),(0,ee.jsx)("option",{value:2,children:"P2 — high"}),(0,ee.jsx)("option",{value:3,children:"P3 — normal"}),(0,ee.jsx)("option",{value:4,children:"P4 — low"})]})]}),(0,ee.jsxs)("div",{className:"flex-1",children:[(0,ee.jsx)("div",{className:v,children:"goal"}),(0,ee.jsxs)("select",{value:d,onChange:e=>u(e.target.value),className:b,children:[(0,ee.jsx)("option",{value:"",children:"none"}),t.map(e=>(0,ee.jsx)("option",{value:e.id,children:e.title},e.id))]})]})]}),f&&(0,ee.jsx)("div",{className:"text-[var(--red)] text-[11px]",children:f}),(0,ee.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,ee.jsx)("button",{type:"button",onClick:n,className:"px-3 py-1 text-[var(--dim)] border border-[var(--border)] hover:border-[var(--dim)] transition-colors",children:"cancel"}),(0,ee.jsx)("button",{type:"submit",disabled:h,className:"px-3 py-1 text-[var(--bg)] bg-[var(--accent)] hover:opacity-90 transition-opacity disabled:opacity-50",children:h?"creating...":"create"})]})]})]})]})}let t2=[{status:"todo",label:"TODO",color:"var(--dim)"},{status:"in-progress",label:"DOING",color:"var(--yellow)"},{status:"review",label:"REVIEW",color:"var(--magenta)"},{status:"done",label:"DONE",color:"var(--green)"}];function t8({status:e,label:t,color:n,children:r,isOver:i,count:o,onAction:s}){let{setNodeRef:a}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,o=eS("Droppable"),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=(0,et.useContext)(tT),d=(0,et.useRef)({disabled:n}),u=(0,et.useRef)(!1),h=(0,et.useRef)(null),p=(0,et.useRef)(null),{disabled:f,updateMeasurementsFor:m,timeout:g}={...tz,...i},y=ev(null!=m?m:r),v=tm({callback:(0,et.useCallback)(()=>{if(!u.current){u.current=!0;return}null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),p.current=null},g)},[g]),disabled:f||!s}),[b,x]=ex((0,et.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),u.current=!1),e&&v.observe(e))},[v])),k=ev(t);return(0,et.useEffect)(()=>{v&&b.current&&(v.disconnect(),u.current=!1,v.observe(b.current))},[b,v]),(0,et.useEffect)(()=>(a({type:C.RegisterDroppable,element:{id:r,key:o,disabled:n,node:b,rect:h,data:k}}),()=>a({type:C.UnregisterDroppable,key:o,id:r})),[r]),(0,et.useEffect)(()=>{n!==d.current.disabled&&(a({type:C.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:(null==l?void 0:l.id)===r,node:b,over:l,setNodeRef:x}}({id:e});return(0,ee.jsxs)("div",{ref:a,className:`bg-[var(--bg)] flex flex-col min-h-0 transition-colors duration-150 ${i?"bg-[var(--surface-hover)]":""}`,children:[(0,ee.jsxs)("div",{className:"flex items-center justify-between px-2 h-6 bg-[var(--surface)] border-b border-[var(--border)] shrink-0",children:[(0,ee.jsx)("span",{style:{color:n},children:t}),(0,ee.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,ee.jsx)("button",{onClick:s,className:"text-[var(--dim)] hover:text-[var(--accent)] transition-colors text-[13px] leading-none",children:"+"}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:o})]})]}),(0,ee.jsx)("div",{className:"flex-1 overflow-auto p-px",children:r})]})}function t5({task:e,selected:t,onClick:n}){let{attributes:r,listeners:i,setNodeRef:o,transform:s,isDragging:a}=function(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,o=eS("Draggable"),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:h}=(0,et.useContext)(tT),{role:p=tB,roleDescription:f="draggable",tabIndex:m=0}=null!=i?i:{},g=(null==l?void 0:l.id)===t,y=(0,et.useContext)(g?tP:tj),[v,b]=ex(),[x,k]=ex(),w=(0,et.useMemo)(()=>s.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[s,t]),S=ev(n);return eg(()=>(u.set(t,{id:t,key:o,node:v,activatorNode:x,data:S}),()=>{let e=u.get(t);e&&e.key===o&&u.delete(t)}),[u,t]),{active:l,activatorEvent:a,activeNodeRect:c,attributes:(0,et.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":!!g&&p===tB||void 0,"aria-roledescription":f,"aria-describedby":d.draggable}),[r,p,m,g,f,d.draggable]),isDragging:g,listeners:r?void 0:w,node:v,over:h,setNodeRef:b,setActivatorNodeRef:k,transform:y}}({id:e.id}),l={transform:eT.Translate.toString(s),opacity:a?.3:1,transition:a?"none":"opacity 150ms ease"};return(0,ee.jsx)("div",{ref:o,style:l,...i,...r,children:(0,ee.jsx)(tX,{task:e,selected:t,onClick:n})})}function t6({tasks:e,sessionName:t,agents:n,goals:r=[],onRefresh:i}){var o;let[s,a]=(0,et.useState)(null),[l,c]=(0,et.useState)(null),[d,u]=(0,et.useState)(null),[h,p]=(0,et.useState)(!1),f=s?e.find(e=>e.id===s)??null:null,m=l?e.find(e=>e.id===l)??null:null,g=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,et.useMemo)(()=>[...t].filter(e=>null!=e),[...t])}((o={activationConstraint:{distance:5}},(0,et.useMemo)(()=>({sensor:tu,options:null!=o?o:{}}),[tu,o])));async function y(n){let{active:r,over:o}=n;if(c(null),u(null),!o)return;let s=String(r.id),a=String(o.id),l=e.find(e=>e.id===s);!l||l.status===a||t2.some(e=>e.status===a)&&(await (0,er.updateTask)(t,s,{status:a}),i())}return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)(t_,{sensors:g,collisionDetection:eH,onDragStart:function(e){c(String(e.active.id))},onDragOver:function(e){let t=e.over?.id;t&&"string"==typeof t?u(t2.some(e=>e.status===t)?t:null):u(null)},onDragEnd:y,children:[(0,ee.jsx)("div",{className:"grid grid-cols-4 gap-px flex-1 min-h-0 bg-[var(--border)]",children:t2.map(t=>{let n=e.filter(e=>e.status===t.status).sort((e,t)=>e.priority-t.priority);return(0,ee.jsxs)(t8,{status:t.status,label:t.label,color:t.color,count:n.length,isOver:d===t.status,onAction:"todo"===t.status?()=>p(!0):void 0,children:[n.map(e=>(0,ee.jsx)(t5,{task:e,selected:e.id===s,onClick:()=>a(s===e.id?null:e.id)},e.id)),0===n.length&&(0,ee.jsx)("div",{className:"text-[var(--dim)] text-center py-4 text-[11px]",children:"—"})]},t.status)})}),(0,ee.jsx)(tK,{dropAnimation:null,children:m&&(0,ee.jsx)("div",{className:"opacity-90 shadow-lg pointer-events-none",children:(0,ee.jsx)(tX,{task:m,selected:!1,onClick:()=>{}})})})]}),f&&(0,ee.jsx)(t0,{task:f,sessionName:t,agents:n,allTasks:e,onClose:()=>a(null),onUpdated:i}),h&&(0,ee.jsx)(t1,{sessionName:t,goals:r,onClose:()=>p(!1),onCreated:i})]})}let t3="diffs-container",t4=/(?=^From [a-f0-9]+ .+$)/m,t7=/(?=^diff --git)/gm,t9=/(?=^---\s+\S)/gm,ne=/(?=^@@ )/gm,nt=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,nn=/(?<=\n)/,nr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,ni=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,no=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,ns=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,na="header-prefix",nl="header-metadata",nc={dark:"pierre-dark",light:"pierre-light"},nd="data-unsafe-css",nu={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},nh=Object.freeze({fromStart:0,fromEnd:0}),np={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},nf={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function nm(e){return e.replace(/\n$|\r\n$/,"")}function ng(e,{cacheKey:t,isGitDiff:n=t7.test(e),oldFile:r,newFile:i,throwOnError:o=!1}={}){let s,a=0,l=e.split(ne),c=null==r||null==i,d=0,u=0;for(let e of l){let l,h,p=e.split(nn),f=p.shift();if(null==f){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",e);continue}let m=f.match(nt),g=0,y=0;if(null==m||null==s){if(null!=s){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",e);continue}for(let e of(1===(s={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:c,additionLines:c||null==r||null==i?[]:i.contents.split(nn),deletionLines:c||null==r||null==i?[]:r.contents.split(nn),cacheKey:t}).additionLines.length&&i?.contents===""&&(s.additionLines.length=0),1===s.deletionLines.length&&r?.contents===""&&(s.deletionLines.length=0),p.unshift(f),p)){let t=e.match(n?ni:nr);if(e.startsWith("diff --git")){let[,,t,,n]=e.trim().match(no)??[];s.name=n.trim(),t!==n&&(s.prevName=t.trim())}else if(null!=t){let[,e,n]=t;"---"===e&&"/dev/null"!==n?(s.prevName=n.trim(),s.name=n.trim()):"+++"===e&&"/dev/null"!==n&&(s.name=n.trim())}else if(n){if(e.startsWith("new mode ")&&(s.mode=e.replace("new mode","").trim()),e.startsWith("old mode ")&&(s.prevMode=e.replace("old mode","").trim()),e.startsWith("new file mode")&&(s.type="new",s.mode=e.replace("new file mode","").trim()),e.startsWith("deleted file mode")&&(s.type="deleted",s.mode=e.replace("deleted file mode","").trim()),e.startsWith("similarity index")&&(e.startsWith("similarity index 100%")?s.type="rename-pure":s.type="rename-changed"),e.startsWith("index ")){let[,t,n,r]=e.trim().match(ns)??[];null!=t&&(s.prevObjectId=t),null!=n&&(s.newObjectId=n),null!=r&&(s.mode=r)}e.startsWith("rename from ")&&(s.prevName=e.replace("rename from ","")),e.startsWith("rename to ")&&(s.name=e.replace("rename to ","").trim())}}continue}for(;p.length>0&&("\n"===p[p.length-1]||"\r"===p[p.length-1]||"\r\n"===p[p.length-1]||""===p[p.length-1]);)p.pop();let v=parseInt(m[3]),b=parseInt(m[1]);d=c?d:b-1,u=c?u:v-1;let x={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(m[4]??"1"),additionStart:v,additionLines:g,deletionCount:parseInt(m[2]??"1"),deletionStart:b,deletionLines:y,deletionLineIndex:d,additionLineIndex:u,hunkContent:[],hunkContext:m[5],hunkSpecs:f,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(x.additionCount)||isNaN(x.deletionCount)||isNaN(x.additionStart)||isNaN(x.deletionStart)){if(o)throw Error("parsePatchContent: invalid hunk metadata");console.error("parsePatchContent: invalid hunk metadata",x);continue}for(let e of p){let t=function(e){let t=e[0];if("+"!==t&&"-"!==t&&" "!==t&&"\\"!==t)return void console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);let n=e.substring(1);return{line:""===n?"\n":n,type:" "===t?"context":"\\"===t?"metadata":"+"===t?"addition":"deletion"}}(e);if(null==t){console.error("processFile: invalid rawLine:",e);continue}let{type:n,line:r}=t;if("addition"===n)(null==l||"change"!==l.type)&&(l=ny("change",d,u),x.hunkContent.push(l)),u++,c&&s.additionLines.push(r),l.additions++,g++,h="addition";else if("deletion"===n)(null==l||"change"!==l.type)&&(l=ny("change",d,u),x.hunkContent.push(l)),d++,c&&s.deletionLines.push(r),l.deletions++,y++,h="deletion";else if("context"===n)(null==l||"context"!==l.type)&&(l=ny("context",d,u),x.hunkContent.push(l)),u++,d++,c&&(s.deletionLines.push(r),s.additionLines.push(r)),l.lines++,h="context";else if("metadata"===n&&null!=l){if("context"===l.type?(x.noEOFCRAdditions=!0,x.noEOFCRDeletions=!0):"deletion"===h?x.noEOFCRDeletions=!0:"addition"===h&&(x.noEOFCRAdditions=!0),c&&("addition"===h||"context"===h)){let e=s.additionLines.length-1;e>=0&&(s.additionLines[e]=nm(s.additionLines[e]))}if(c&&("deletion"===h||"context"===h)){let e=s.deletionLines.length-1;e>=0&&(s.deletionLines[e]=nm(s.deletionLines[e]))}}}for(let e of(x.additionLines=g,x.deletionLines=y,x.collapsedBefore=Math.max(x.additionStart-1-a,0),s.hunks.push(x),a=x.additionStart+x.additionCount-1,x.hunkContent))"context"===e.type?(x.splitLineCount+=e.lines,x.unifiedLineCount+=e.lines):(x.splitLineCount+=Math.max(e.additions,e.deletions),x.unifiedLineCount+=e.deletions+e.additions);x.splitLineStart=s.splitLineCount+x.collapsedBefore,x.unifiedLineStart=s.unifiedLineCount+x.collapsedBefore,s.splitLineCount+=x.collapsedBefore+x.splitLineCount,s.unifiedLineCount+=x.collapsedBefore+x.unifiedLineCount}if(null!=s){if(s.hunks.length>0&&!c&&s.additionLines.length>0&&s.deletionLines.length>0){let e=s.hunks[s.hunks.length-1],t=e.additionStart+e.additionCount-1,n=Math.max(s.additionLines.length-t,0);s.splitLineCount+=n,s.unifiedLineCount+=n}return n||(null!=s.prevName&&s.name!==s.prevName?s.hunks.length>0?s.type="rename-changed":s.type="rename-pure":null!=i&&""===i.contents?s.type="deleted":null!=r&&""===r.contents&&(s.type="new")),"rename-pure"!==s.type&&"rename-changed"!==s.type&&(s.prevName=void 0),s}}function ny(e,t,n){return"change"===e?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}function nv(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}let nb={position:"absolute",top:0,bottom:0,textAlign:"center"},nx={display:"contents"};function nk(){return null}function nw(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function nS(e){return{type:"text",value:e}}function nC({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function nN({name:e,width:t=16,height:n=16,properties:r}){return nC({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...r},children:[nC({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function nA(e){return nC({tagName:"div",properties:{"data-gutter":""},children:e})}function nE(e,t,n){return nC({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":"annotation"===t?void 0:e,style:"annotation"===t?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}let nM=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class nT{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function nI(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new nT(n,r,t)}function nL(e){return e.toLowerCase()}nT.prototype.normal={},nT.prototype.property={},nT.prototype.space=void 0;class nO{constructor(e,t){this.attribute=t,this.property=e}}nO.prototype.attribute="",nO.prototype.booleanish=!1,nO.prototype.boolean=!1,nO.prototype.commaOrSpaceSeparated=!1,nO.prototype.commaSeparated=!1,nO.prototype.defined=!1,nO.prototype.mustUseProperty=!1,nO.prototype.number=!1,nO.prototype.overloadedBoolean=!1,nO.prototype.property="",nO.prototype.spaceSeparated=!1,nO.prototype.space=void 0;let nD=0,nR=nF(),nP=nF(),n_=nF(),nj=nF(),nB=nF(),nz=nF(),n$=nF();function nF(){return 2**++nD}e.s(["boolean",0,nR,"booleanish",0,nP,"commaOrSpaceSeparated",0,n$,"commaSeparated",0,nz,"number",0,nj,"overloadedBoolean",0,n_,"spaceSeparated",0,nB],83954);var nU=e.i(83954);let nH=Object.keys(nU);class nW extends nO{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<nH.length;){const e=nH[i];!function(e,t,n){n&&(e[t]=n)}(this,nH[i],(n&nU[e])===nU[e])}}}function nV(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let o=new nW(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[nL(r)]=r,n[nL(o.attribute)]=r}return new nT(t,n,e.space)}nW.prototype.defined=!0;let nG=nV({properties:{ariaActiveDescendant:null,ariaAtomic:nP,ariaAutoComplete:null,ariaBusy:nP,ariaChecked:nP,ariaColCount:nj,ariaColIndex:nj,ariaColSpan:nj,ariaControls:nB,ariaCurrent:null,ariaDescribedBy:nB,ariaDetails:null,ariaDisabled:nP,ariaDropEffect:nB,ariaErrorMessage:null,ariaExpanded:nP,ariaFlowTo:nB,ariaGrabbed:nP,ariaHasPopup:null,ariaHidden:nP,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nB,ariaLevel:nj,ariaLive:null,ariaModal:nP,ariaMultiLine:nP,ariaMultiSelectable:nP,ariaOrientation:null,ariaOwns:nB,ariaPlaceholder:null,ariaPosInSet:nj,ariaPressed:nP,ariaReadOnly:nP,ariaRelevant:null,ariaRequired:nP,ariaRoleDescription:nB,ariaRowCount:nj,ariaRowIndex:nj,ariaRowSpan:nj,ariaSelected:nP,ariaSetSize:nj,ariaSort:null,ariaValueMax:nj,ariaValueMin:nj,ariaValueNow:nj,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function nq(e,t){return t in e?e[t]:t}function nK(e,t){return nq(e,t.toLowerCase())}let nJ=nV({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nz,acceptCharset:nB,accessKey:nB,action:null,allow:null,allowFullScreen:nR,allowPaymentRequest:nR,allowUserMedia:nR,alt:null,as:null,async:nR,autoCapitalize:null,autoComplete:nB,autoFocus:nR,autoPlay:nR,blocking:nB,capture:null,charSet:null,checked:nR,cite:null,className:nB,cols:nj,colSpan:null,content:null,contentEditable:nP,controls:nR,controlsList:nB,coords:nj|nz,crossOrigin:null,data:null,dateTime:null,decoding:null,default:nR,defer:nR,dir:null,dirName:null,disabled:nR,download:n_,draggable:nP,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:nR,formTarget:null,headers:nB,height:nj,hidden:n_,high:nj,href:null,hrefLang:null,htmlFor:nB,httpEquiv:nB,id:null,imageSizes:null,imageSrcSet:null,inert:nR,inputMode:null,integrity:null,is:null,isMap:nR,itemId:null,itemProp:nB,itemRef:nB,itemScope:nR,itemType:nB,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:nR,low:nj,manifest:null,max:null,maxLength:nj,media:null,method:null,min:null,minLength:nj,multiple:nR,muted:nR,name:null,nonce:null,noModule:nR,noValidate:nR,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:nR,optimum:nj,pattern:null,ping:nB,placeholder:null,playsInline:nR,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:nR,referrerPolicy:null,rel:nB,required:nR,reversed:nR,rows:nj,rowSpan:nj,sandbox:nB,scope:null,scoped:nR,seamless:nR,selected:nR,shadowRootClonable:nR,shadowRootDelegatesFocus:nR,shadowRootMode:null,shape:null,size:nj,sizes:null,slot:null,span:nj,spellCheck:nP,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nj,step:null,style:null,tabIndex:nj,target:null,title:null,translate:null,type:null,typeMustMatch:nR,useMap:null,value:nP,width:nj,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nB,axis:null,background:null,bgColor:null,border:nj,borderColor:null,bottomMargin:nj,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:nR,declare:nR,event:null,face:null,frame:null,frameBorder:null,hSpace:nj,leftMargin:nj,link:null,longDesc:null,lowSrc:null,marginHeight:nj,marginWidth:nj,noResize:nR,noHref:nR,noShade:nR,noWrap:nR,object:null,profile:null,prompt:null,rev:null,rightMargin:nj,rules:null,scheme:null,scrolling:nP,standby:null,summary:null,text:null,topMargin:nj,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nj,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:nR,disableRemotePlayback:nR,prefix:null,property:null,results:nj,security:null,unselectable:null},space:"html",transform:nK}),nX=nV({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:n$,accentHeight:nj,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nj,amplitude:nj,arabicForm:null,ascent:nj,attributeName:null,attributeType:null,azimuth:nj,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nj,by:null,calcMode:null,capHeight:nj,className:nB,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:nj,diffuseConstant:nj,direction:null,display:null,dur:null,divisor:nj,dominantBaseline:null,download:nR,dx:null,dy:null,edgeMode:null,editable:null,elevation:nj,enableBackground:null,end:null,event:null,exponent:nj,externalResourcesRequired:null,fill:null,fillOpacity:nj,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:nz,g2:nz,glyphName:nz,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nj,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nj,horizOriginX:nj,horizOriginY:nj,id:null,ideographic:nj,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nj,k:nj,k1:nj,k2:nj,k3:nj,k4:nj,kernelMatrix:n$,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nj,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:nj,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:nj,overlineThickness:nj,paintOrder:null,panose1:null,path:null,pathLength:nj,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nB,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nj,pointsAtY:nj,pointsAtZ:nj,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:n$,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:n$,rev:n$,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:n$,requiredFeatures:n$,requiredFonts:n$,requiredFormats:n$,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:nj,specularExponent:nj,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nj,strikethroughThickness:nj,string:null,stroke:null,strokeDashArray:n$,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nj,strokeOpacity:nj,strokeWidth:null,style:null,surfaceScale:nj,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:n$,tabIndex:nj,tableValues:null,target:null,targetX:nj,targetY:nj,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:n$,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nj,underlineThickness:nj,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nj,values:null,vAlphabetic:nj,vMathematical:nj,vectorEffect:null,vHanging:nj,vIdeographic:nj,version:null,vertAdvY:nj,vertOriginX:nj,vertOriginY:nj,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nj,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nq}),nY=nV({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),nQ=nV({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nK}),nZ=nV({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),n0=nI([nG,nJ,nY,nQ,nZ],"html"),n1=nI([nG,nX,nY,nQ,nZ],"svg"),n2={}.hasOwnProperty;function n8(e,t){let n=t||{};function r(t,...n){let i=r.invalid,o=r.handlers;if(t&&n2.call(t,e)){let n=String(t[e]);i=n2.call(o,n)?o[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}let n5=/["&'<>`]/g,n6=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n3=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,n4=/[|\\{}()[\]^$+*?.]/g,n7=new WeakMap,n9=/[\dA-Fa-f]/,re=/\d/,rt=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],rn={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},rr=["cent","copy","divide","gt","lt","not","para","times"],ri={}.hasOwnProperty,ro={};for(t in rn)ri.call(rn,t)&&(ro[rn[t]]=t);let rs=/[^\dA-Za-z]/;function ra(e,t,n){var r,i;let o,s,a=(r=n.omitOptionalSemicolons,o="&#x"+e.toString(16).toUpperCase(),r&&t&&!n9.test(String.fromCharCode(t))?o:o+";");if((n.useNamedReferences||n.useShortestReferences)&&(s=function(e,t,n,r){let i=String.fromCharCode(e);if(ri.call(ro,i)){let e=ro[i],o="&"+e;return n&&rt.includes(e)&&!rr.includes(e)&&(!r||t&&61!==t&&rs.test(String.fromCharCode(t)))?o:o+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){let r,o=(i=n.omitOptionalSemicolons,r="&#"+String(e),i&&t&&!re.test(String.fromCharCode(t))?r:r+";");o.length<a.length&&(a=o)}return s&&(!n.useShortestReferences||s.length<a.length)?s:a}function rl(e,t){let n;var r,i=e,o=Object.assign({format:ra},t);if(i=i.replace(o.subset?(r=o.subset,(n=n7.get(r))||(n=function(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(n4,"\\$&"));return RegExp("(?:"+t.join("|")+")","g")}(r),n7.set(r,n)),n):n5,s),o.subset||o.escapeOnly)return i;return i.replace(n6,function(e,t,n){return o.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,n.charCodeAt(t+2),o)}).replace(n3,s);function s(e,t,n){return o.format(e.charCodeAt(0),n.charCodeAt(t+1),o)}}let rc=/^>|^->|<!--|-->|--!>|<!-$/g,rd=[">"],ru=["<",">"];function rh(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}function rp(e,t){let n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}let rf=/[A-Z]/g,rm=/-[a-z]/g,rg=/^data[-\w.:]+$/i;function ry(e,t){let n=nL(t),r=t,i=nO;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&rg.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(rm,rb);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rm.test(e)){let n=e.replace(rf,rv);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=nW}return new i(r,t)}function rv(e){return"-"+e.toLowerCase()}function rb(e){return e.charAt(1).toUpperCase()}function rx(e){return e.join(" ").trim()}let rk=/[ \t\n\f\r]/g;function rw(e){return"object"==typeof e?"text"===e.type&&rS(e.value):rS(e)}function rS(e){return""===e.replace(rk,"")}let rC=rE(1),rN=rE(-1),rA=[];function rE(e){return function(t,n,r){let i=t?t.children:rA,o=(n||0)+e,s=i[o];if(!r)for(;s&&rw(s);)o+=e,s=i[o];return s}}let rM={}.hasOwnProperty;function rT(e){return function(t,n,r){return rM.call(e,t.tagName)&&e[t.tagName](t,n,r)}}let rI=rT({body:function(e,t,n){let r=rC(n,t);return!r||"comment"!==r.type},caption:rL,colgroup:rL,dd:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){let r=rC(n,t);return!!(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:rL,html:function(e,t,n){let r=rC(n,t);return!r||"comment"!==r.type},li:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){let r=rC(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||"element"!==n.type||"a"!==n.tagName&&"audio"!==n.tagName&&"del"!==n.tagName&&"ins"!==n.tagName&&"map"!==n.tagName&&"noscript"!==n.tagName&&"video"!==n.tagName},rp:rO,rt:rO,tbody:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:rD,tfoot:function(e,t,n){return!rC(n,t)},th:rD,thead:function(e,t,n){let r=rC(n,t);return!!(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function rL(e,t,n){let r=rC(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&rw(r.value.charAt(0)))}function rO(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function rD(e,t,n){let r=rC(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}let rR=rT({body:function(e){let t=rC(e,-1,!0);return!t||"comment"!==t.type&&!("text"===t.type&&rw(t.value.charAt(0)))&&("element"!==t.type||"meta"!==t.tagName&&"link"!==t.tagName&&"script"!==t.tagName&&"style"!==t.tagName&&"template"!==t.tagName)},colgroup:function(e,t,n){let r=rN(n,t),i=rC(e,-1,!0);return!(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&rI(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"col"===i.tagName)},head:function(e){let t=new Set;for(let n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||"element"===n.type},html:function(e){let t=rC(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){let r=rN(n,t),i=rC(e,-1);return!(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&rI(r,n.children.indexOf(r),n))&&!!(i&&"element"===i.type&&"tr"===i.tagName)}}),rP={name:[[" \n\f\r &/=>".split("")," \n\f\r \"&'/=>`".split("")],["\0 \n\f\r \"&'/<=>".split(""),"\0 \n\f\r \"&'/<=>`".split("")]],unquoted:[[" \n\f\r &>".split(""),"\0 \n\f\r \"&'<=>`".split("")],["\0 \n\f\r \"&'<=>`".split(""),"\0 \n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},r_=["<","&"];function rj(e,t,n,r){return n&&"element"===n.type&&("script"===n.tagName||"style"===n.tagName)?e.value:rl(e.value,Object.assign({},r.settings.characterReferences,{subset:r_}))}let rB=n8("type",{invalid:function(e){throw Error("Expected node, not `"+e+"`")},unknown:function(e){throw Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+rl(e.value,Object.assign({},r.settings.characterReferences,{subset:rd}))+">":"<!--"+e.value.replace(rc,function(e){return rl(e,Object.assign({},r.settings.characterReferences,{subset:ru}))})+"-->"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){let i,o=r.schema,s="svg"!==o.space&&r.settings.omitOptionalTags,a="svg"===o.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),l=[];"html"===o.space&&"svg"===e.tagName&&(r.schema=n1);let c=function(e,t){let n,r=[],i=-1;if(t){for(n in t)if(null!==t[n]&&void 0!==t[n]){let i=function(e,t,n){let r,i=ry(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=+!e.settings.allowDangerousCharacters,a=e.quote;if(i.overloadedBoolean&&(n===i.attribute||""===n)?n=!0:(i.boolean||i.overloadedBoolean)&&("string"!=typeof n||n===i.attribute||""===n)&&(n=!!n),null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";let l=rl(i.attribute,Object.assign({},e.settings.characterReferences,{subset:rP.name[o][s]}));return!0===n||(n=Array.isArray(n)?(i.commaSeparated?rp:rx)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(r=rl(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:rP.unquoted[o][s]}))),r!==n&&(e.settings.quoteSmart&&rh(n,a)>rh(n,e.alternative)&&(a=e.alternative),r=a+rl(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?rP.single:rP.double)[o][s],attribute:!0}))+a),l+(r?"="+r:r))}(e,n,t[n]);i&&r.push(i)}}for(;++i<r.length;){let t=e.settings.tightAttributes?r[i].charAt(r[i].length-1):void 0;i!==r.length-1&&'"'!==t&&"'"!==t&&(r[i]+=" ")}return r.join("")}(r,e.properties),d=r.all("html"===o.space&&"template"===e.tagName?e.content:e);return r.schema=o,d&&(a=!1),!c&&s&&rR(e,t,n)||(l.push("<",e.tagName,c?" "+c:""),a&&("svg"===o.space||r.settings.closeSelfClosing)&&(i=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===i||i&&'"'!==i&&"'"!==i)&&l.push(" "),l.push("/")),l.push(">")),l.push(d),a||s&&rI(e,t,n)||l.push("</"+e.tagName+">"),l.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:rj(e,t,n,r)},root:function(e,t,n,r){return r.all(e)},text:rj}}),rz={},r$={},rF=[];function rU(e,t){let n=t||rz,r=n.quote||'"';if('"'!==r&&"'"!==r)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return({one:rH,all:rW,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||nM,characterReferences:n.characterReferences||r$,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?n1:n0,quote:r,alternative:'"'===r?"'":'"'}).one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function rH(e,t,n){return rB(e,t,n,this)}function rW(e){let t=[],n=e&&e.children||rF,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}var rV=class{hoveredLine;pre;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.detachDocumentPointerListeners(),this.clearPointerSession(),null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):null!=this.gutterUtilityContainer&&(this.gutterUtilityContainer.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,"gutterSelecting"===this.pointerSession.mode&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return null===this.renderedSelectionRange}setSelection(e){let t=!(e===this.selectedRange||nw(e??void 0,this.selectedRange??void 0));(this.isSelectionDirty()||t)&&(this.selectedRange=e,this.renderSelection(),t&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{if(null!=this.hoveredLine){if("diff"===this.mode&&"diff-line"===this.hoveredLine.type)return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if("file"===this.mode&&"line"===this.hoveredLine.type)return{lineNumber:this.hoveredLine.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onMergeConflictActionClick:i}=this.options;null==t&&null==n&&null==r&&null==i||null!=this.options.onGutterUtilityClick&&rX(e.composedPath())||(rY(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{let{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:r,enableGutterUtility:i=!1}=this.options;("disabled"!==t||i||null!=n||null!=r)&&(rY(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;(rY(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),null==this.hoveredLine)?rY(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no .hoveredLine"):(this.gutterUtilityContainer?.remove(),this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine())};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();rY(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);rY(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",i);let{onLineClick:o,onLineNumberClick:s,onLineEnter:a,onLineLeave:l,onHunkExpand:c,onMergeConflictActionClick:d}=this.options;switch(e){case"move":if(rq(i)&&this.hoveredLine?.lineElement===i.lineElement)break;null!=this.hoveredLine&&(this.gutterUtilityContainer?.remove(),l?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),rq(i)&&(this.setHoveredLine(this.toEventBaseProps(i)),null!=this.gutterUtilityContainer&&i.numberElement.appendChild(this.gutterUtilityContainer),a?.({...this.hoveredLine,event:t}));break;case"click":{var u,h;if(null==i)break;if("kind"in(u=i)&&"merge-conflict-action"===u.kind&&null!=d){d(i);break}if("type"in(h=i)&&"line-info"===h.type&&null!=c){c(i.hunkIndex,t.shiftKey?"both":i.direction,t.shiftKey?1/0:void 0);break}if(!rq(i))break;let e=this.toEventBaseProps(i);null!=s&&i.numberColumn?s({...e,event:t}):null!=o&&o({...e,event:t})}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:r,onLineNumberClick:i,onLineEnter:o,onLineLeave:s,onHunkExpand:a,onMergeConflictActionClick:l,enableGutterUtility:c=!1,enableLineSelection:d=!1,onGutterUtilityClick:u}=this.options,h=null!=u,p="disabled"!==n||null!=r||null!=i||null!=a||null!=l||null!=o||null!=s||c||d||h;if(p&&!this.hasPointerListeners){let n;e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,rY(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(n=[],("both"===t||"click"===t)&&(null!=r&&n.push("onLineClick"),null!=i&&n.push("onLineNumberClick"),null!=a&&n.push("expandable hunk separators"),null!=l&&n.push("merge conflict actions")),n)),rY(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),rY(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")}else!p&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);let f="selecting"===this.pointerSession.mode||"pendingSingleLineUnselect"===this.pointerSession.mode,m="gutterSelecting"===this.pointerSession.mode;(!d&&f||!h&&m)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(null==this.pre)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=null!=e,i=null!=t||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if("mouse"===e.pointerType&&0!==e.button||null==this.pre||"idle"!==this.pointerSession.mode)return;let t=e.composedPath();rX(t)&&null!=this.options.onGutterUtilityClick?this.startGutterSelectionFromPointerDown(e,t):this.startLineSelectionFromPointerDown(e,t)};startLineSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let r=this.getSelectionPointerInfo(t,!0);if(null==r)return;let{pre:i}=this;if(null==i)return;e.preventDefault();let{lineNumber:o,eventSide:s,lineIndex:a}=r;if(e.shiftKey&&null!=this.selectedRange){let t=this.getIndexesFromSelection(this.selectedRange,"split"===i.getAttribute("data-diff-type"));if(null==t)return;let n=t.start<=t.end?a>=t.start:a<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(o,s,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===o&&this.selectedRange?.end===o){let t={lineNumber:o,side:s};this.selectionAnchor=t,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.selectedRange=null,this.selectionAnchor={lineNumber:o,side:s},this.updateSelection(o,s,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1,onGutterUtilityClick:r}=this.options;if(null==r)return;let i=this.getSelectionPointFromPath(t);null!=i&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:i,current:i},n&&(this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.selectedRange)),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let n=this.getSelectionPointFromPath(e.composedPath());if(null==n)return;this.pointerSession.current=n,!0===t&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(null==t||null==this.selectionAnchor)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{var n;if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(null==t||null==this.selectionAnchor)return;let r={lineNumber:t.lineNumber,side:t.eventSide};if(n=this.pointerSession.pending,n.lineNumber===r.lineNumber&&n.side===r.side)return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.selectedRange),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let r=this.getSelectionPointFromPath(e.composedPath());null!=r&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){null!=this.hoveredLine&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t="disabled"}=this.options;null!=this.hoveredLine&&this.clearHoveredLine(),this.hoveredLine=e,"disabled"!==t&&(("both"===t||"line"===t)&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),("both"===t||"number"===t)&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}ensureGutterUtilityNode(e){if(null==this.gutterUtilityContainer&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)null!=this.gutterUtilityButton&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),null==this.gutterUtilitySlot&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,null==this.gutterUtilityButton){let e=document.createElement("div");e.innerHTML=rU(nC({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[nN({name:"diffs-icon-plus",properties:{"data-icon":""}})]}));let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){"pendingSingleLineUnselect"===this.pointerSession.mode&&(this.pointerSession={mode:"idle"})}getSelectionPointerInfo(e,t){let n=this.resolvePointerTarget(e);if(rq(n)&&(!t||n.numberColumn)&&null!=n.splitLineIndex)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:"diff"===this.mode?n.side:void 0}}getSelectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(rq(t))return{lineNumber:t.lineNumber,side:"diff"===this.mode?t.side:void 0}}getLineIndex(e,t){let{getLineIndex:n}=this.options;return null!=n?n(e,t):[e-1,e-1]}updateSelection(e,t,n=!0){let r,{selectedRange:i}=this;if(null==e)r=null;else{let n=this.selectionAnchor?.side??t,i=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(i,e,n,t)}nw(i??void 0,r??void 0)||(this.selectedRange=r,n&&this.notifySelectionChangeDelta(),this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection))}getIndexesFromSelection(e,t){if(null==this.pre)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return null!=n&&null!=r?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}renderSelection=()=>{if(null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),null==this.pre||this.renderedSelectionRange===this.selectedRange)return;for(let e of this.pre.querySelectorAll("[data-selected-line]"))e.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,null==this.selectedRange)return;let{children:e}=this.pre;if(0===e.length)return;if(e.length>2)throw console.error(e),Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let t="split"===this.pre.getAttribute("data-diff-type"),n=this.getIndexesFromSelection(this.selectedRange,t);if(null==n)throw console.error({rowRange:n,selectedRange:this.selectedRange}),Error("InteractionManager.renderSelection: No valid rowRange");let r=n.start===n.end,i=Math.min(n.start,n.end),o=Math.max(n.start,n.end);for(let n of e){let[e,s]=n.children,a=s.children.length;if(a!==e.children.length)throw Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let n=0;n<a;n++){let a=s.children[n],l=e.children[n];if(!(a instanceof HTMLElement)||!(l instanceof HTMLElement))continue;let c=this.parseLineIndex(a,t);if((c??0)>o)break;if(null==c||c<i)continue;let d=r?"single":c===i?"first":c===o?"last":"";a.setAttribute("data-selected-line",d),l.setAttribute("data-selected-line",d),l.nextSibling instanceof HTMLElement&&a.nextSibling instanceof HTMLElement&&(a.nextSibling.hasAttribute("data-line-annotation")||a.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(r?(d="last",a.setAttribute("data-selected-line","first")):c===i?d="":c===o&&a.setAttribute("data-selected-line",""),a.nextSibling.setAttribute("data-selected-line",d),l.nextSibling.setAttribute("data-selected-line",d))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.selectedRange??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.selectedRange??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return"file"===this.mode?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...null!=n?{side:n}:{},...n!==r&&null!=r?{endSide:r}:{}}}resolvePointerTarget(e){let t,n,r,i,o,s,a,l,c=!1;for(let u of e){if(!(u instanceof HTMLElement))continue;if(null==l&&u.hasAttribute("data-merge-conflict-action")){var d;let e=u.getAttribute("data-merge-conflict-action")??void 0,t=u.getAttribute("data-merge-conflict-conflict-index")??void 0,n=null!=t?Number.parseInt(t,10):NaN;("current"===(d=e)||"incoming"===d||"both"===d)&&Number.isFinite(n)&&(l={kind:"merge-conflict-action",resolution:e,conflictIndex:n})}let e=null==o?u.getAttribute("data-column-number")??void 0:void 0;if(null!=e){o=u,a=Number.parseInt(e,10),c=!0,t=rJ(u),i=u.getAttribute("data-line-index")??void 0;continue}let h=null==r?u.getAttribute("data-line")??void 0:void 0;if(null!=h){r=u,a=Number.parseInt(h,10),t=rJ(u),i=u.getAttribute("data-line-index")??void 0;continue}if(null==s&&u.hasAttribute("data-expand-button")){s={hunkIndex:void 0,direction:u.hasAttribute("data-expand-up")?"up":u.hasAttribute("data-expand-down")?"down":"both"};continue}let p=null!=s?u.getAttribute("data-expand-index")??void 0:void 0;if(null!=s&&null!=p){let e=Number.parseInt(p,10);Number.isNaN(e)||(s.hunkIndex=e);continue}if(null==n&&u.hasAttribute("data-code")){n=u;break}}if(null!=l)return l;if(s?.hunkIndex!=null)return{type:"line-info",hunkIndex:s.hunkIndex,direction:s.direction};if(r??=null!=i?rK(n,`[data-line][data-line-index="${i}"]`):void 0,o??=null!=i?rK(n,`[data-column-number][data-line-index="${i}"]`):void 0,null==n||null==r||null==o||null==t||null==a||Number.isNaN(a))return;let u=this.parseLineIndex(r,this.isSplitDiff());if("file"===this.mode)return{kind:"line",lineType:t,lineElement:r,lineNumber:a,numberColumn:c,numberElement:o,side:void 0,splitLineIndex:u};let h=(()=>{switch(t){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return n.hasAttribute("data-deletions")?"deletions":"additions"}})();return{kind:"line",lineType:t,lineElement:r,lineNumber:a,numberColumn:c,numberElement:o,side:h,splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){let n=(e.getAttribute("data-line-index")??"").split(",").map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));return t&&2===n.length?n[1]:t?void 0:n[0]}};function rG({enableGutterUtility:e,enableHoverUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:o,onLineLeave:s,onLineNumberClick:a,renderGutterUtility:l,renderHoverUtility:c,__debugPointerEvents:d,enableLineSelection:u,onLineSelected:h,onLineSelectionStart:p,onLineSelectionChange:f,onLineSelectionEnd:m},g,y,v){return{enableGutterUtility:function({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:n,renderHoverUtility:r,onGutterUtilityClick:i}){if(void 0!==e&&void 0!==t)throw Error("Cannot use both 'enableGutterUtility' and deprecated 'enableHoverUtility'. Use only 'enableGutterUtility'.");if(null!=n&&null!=r)throw Error("Cannot use both 'renderGutterUtility' and deprecated 'renderHoverUtility'. Use only 'renderGutterUtility'.");if(null!=i&&(null!=n||null!=r))throw Error("Cannot use both 'onGutterUtilityClick' and render utility callbacks ('renderGutterUtility'/'renderHoverUtility'). Use only one gutter utility API.");return e??t??!1}({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:l,renderHoverUtility:c,onGutterUtilityClick:r}),usesCustomGutterUtility:null!=l||null!=c,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:g,onMergeConflictActionClick:v,onLineClick:i,onLineEnter:o,onLineLeave:s,onLineNumberClick:a,__debugPointerEvents:d,enableLineSelection:u,onLineSelected:h,onLineSelectionStart:p,onLineSelectionChange:f,onLineSelectionEnd:m,getLineIndex:y}}function rq(e){return null!=e&&"kind"in e&&"line"===e.kind}function rK(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function rJ(e){let t=e.getAttribute("data-line-type");if(null!=t)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function rX(e){for(let t of e)if(t instanceof HTMLElement&&t.hasAttribute("data-utility-button"))return!0;return!1}function rY(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if("click"!==t)return;break;case"move":if("move"!==t)return}console.log(...n)}var rQ=class{observedNodes=new Map;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.queuedUpdates.clear()}resizeObserver;setup(e,t){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);let n=e.querySelectorAll("code"),r=new Map(this.observedNodes);for(let e of(this.observedNodes.clear(),n)){let t=r.get(e);if(null!=t&&"code"!==t.type)throw Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let n=e.firstElementChild;n instanceof HTMLElement||(n=null),null!=t?(this.observedNodes.set(e,t),r.delete(e),t.numberElement!==n?(null!=t.numberElement&&this.resizeObserver.unobserve(t.numberElement),null!=n&&(this.resizeObserver.observe(n),r.delete(n),this.observedNodes.set(n,t)),t.numberElement=n):null!=t.numberElement&&(r.delete(t.numberElement),this.observedNodes.set(t.numberElement,t))):(t={type:"code",codeElement:e,numberElement:n,codeWidth:"auto",numberWidth:0},this.observedNodes.set(e,t),this.resizeObserver.observe(e),null!=n&&(this.observedNodes.set(n,t),this.resizeObserver.observe(n)))}if(n.length>1&&!t){let t=e.querySelectorAll('[data-line-annotation*=","]'),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let{lineAnnotation:t=""}=e.dataset;if(!/^\d+,\d+$/.test(t)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:t,element:e});continue}let r=n.get(t);null==r&&(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(2!==t.length){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",e,t);continue}let[n,i]=t,o=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let a=r.get(o);if(null!=a){this.observedNodes.set(o,a),this.observedNodes.set(s,a),r.delete(o),r.delete(s);continue}let l=Math.max((a={type:"annotations",column1:{container:n,child:o,childHeight:o.getBoundingClientRect().height},column2:{container:i,child:s,childHeight:s.getBoundingClientRect().height},currentHeight:"auto"}).column1.childHeight,a.column2.childHeight);this.applyNewHeight(a,l),this.observedNodes.set(o,a),this.observedNodes.set(s,a),this.resizeObserver.observe(o),this.resizeObserver.observe(s)}}for(let e of r.keys())e.isConnected&&(e.style.removeProperty("--diffs-column-content-width"),e.style.removeProperty("--diffs-column-number-width"),e.style.removeProperty("--diffs-column-width"),e.parentElement instanceof HTMLElement&&e.parentElement.style.removeProperty("--diffs-annotation-min-height")),this.resizeObserver.unobserve(e);r.clear()}handleResizeObserver=e=>{for(let t of e){let{target:e,borderBoxSize:n}=t;if(!(e instanceof HTMLElement)){console.error("FileDiff.handleResizeObserver: Invalid element for ResizeObserver",t);continue}let r=this.observedNodes.get(e);if(null==r){console.error("FileDiff.handleResizeObserver: Not a valid observed node",t);continue}let i=n[0];if("annotations"===r.type){let t=e===r.column1.child?r.column1:e===r.column2.child?r.column2:void 0;if(null==t){console.error("FileDiff.handleResizeObserver: Couldn't find a column for",{item:r,target:e});continue}t.childHeight=i.blockSize;let n=Math.max(r.column1.childHeight,r.column2.childHeight);this.applyNewHeight(r,n)}else if("code"===r.type){let t=[e,i.inlineSize],n=this.queuedUpdates.get(r)??[];n.push(t),this.queuedUpdates.set(r,n)}}this.handleColumnChange()};handleColumnChange=()=>{for(let[e,t]of this.queuedUpdates)for(let[n,r]of t)if(n===e.codeElement){let n=Math.max(Math.floor(r),0);if(n!==e.codeWidth){let t=Math.max(n-e.numberWidth,0);e.codeWidth=0===n?"auto":n,e.codeElement.style.setProperty("--diffs-column-content-width",`${t>0?`${t}px`:"auto"}`),e.codeElement.style.setProperty("--diffs-column-width",`${"number"==typeof e.codeWidth?`${e.codeWidth}px`:"auto"}`)}null!=e.numberElement&&"number"==typeof e.codeWidth&&0===e.numberWidth&&t.push([e.numberElement,e.numberElement.getBoundingClientRect().width])}else if(n===e.numberElement){let t=Math.max(Math.ceil(r),0);if(t!==e.numberWidth&&(e.numberWidth=t,e.codeElement.style.setProperty("--diffs-column-number-width",`${0===e.numberWidth?"auto":`${e.numberWidth}px`}`),"auto"!==e.codeWidth)){let t=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty("--diffs-column-content-width",`${0===t?"auto":`${t}px`}`)}}this.queuedUpdates.clear()};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`),e.column2.container.style.setProperty("--diffs-annotation-min-height",`${e.currentHeight}px`))}};function rZ(e,t){return null==e||null==t?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}let r0=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
3
|
-
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
4
|
-
</symbol>
|
|
5
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
6
|
-
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
7
|
-
</symbol>
|
|
8
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
9
|
-
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
10
|
-
</symbol>
|
|
11
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
12
|
-
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
13
|
-
</symbol>
|
|
14
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
15
|
-
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
16
|
-
</symbol>
|
|
17
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
18
|
-
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
19
|
-
</symbol>
|
|
20
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
21
|
-
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
22
|
-
</symbol>
|
|
23
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
24
|
-
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
25
|
-
</symbol>
|
|
26
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
27
|
-
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
28
|
-
</symbol>
|
|
29
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
30
|
-
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
31
|
-
</symbol>
|
|
32
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
33
|
-
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
34
|
-
</symbol>
|
|
35
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
36
|
-
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
37
|
-
</symbol>
|
|
38
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
39
|
-
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
40
|
-
</symbol>
|
|
41
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
42
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
43
|
-
</symbol>
|
|
44
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
45
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
46
|
-
</symbol>
|
|
47
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
48
|
-
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
49
|
-
</symbol>
|
|
50
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
51
|
-
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
52
|
-
</symbol>
|
|
53
|
-
</svg>`;function r1(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}let r2={};function r8({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return null==e&&((e=document.createElement("code")).setAttribute("data-code",""),null!=n&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),null!=r?e.style.setProperty("grid-row",`span ${r}`):e.style.removeProperty("grid-row"),i?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}if("u">typeof HTMLElement&&null==customElements.get(t3)){let e;class t extends HTMLElement{constructor(){if(super(),null!=this.shadowRoot)return;const t=this.attachShadow({mode:"open"});null==e&&(e=new CSSStyleSheet).replaceSync("@layer base, theme, unsafe;\n\n@layer base {\n :host {\n --diffs-bg: #fff;\n --diffs-fg: #000;\n --diffs-font-fallback:\n 'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono',\n 'Courier New', monospace;\n --diffs-header-font-fallback:\n system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',\n 'Noto Sans', 'Liberation Sans', Arial, sans-serif;\n\n --diffs-mixer: light-dark(black, white);\n --diffs-gap-fallback: 8px;\n\n --diffs-added-light: #0dbe4e;\n --diffs-added-dark: #5ecc71;\n --diffs-modified-light: #009fff;\n --diffs-modified-dark: #69b1ff;\n --diffs-deleted-light: #ff2e3f;\n --diffs-deleted-dark: #ff6762;\n\n /*\n // Available CSS Color Overrides\n --diffs-bg-buffer-override\n --diffs-bg-hover-override\n --diffs-bg-context-override\n --diffs-bg-separator-override\n\n --diffs-fg-number-override\n --diffs-fg-number-addition-override\n --diffs-fg-number-deletion-override\n --diffs-fg-conflict-marker-override\n\n --diffs-deletion-color-override\n --diffs-addition-color-override\n --diffs-modified-color-override\n\n --diffs-bg-deletion-override\n --diffs-bg-deletion-number-override\n --diffs-bg-deletion-hover-override\n --diffs-bg-deletion-emphasis-override\n\n --diffs-bg-addition-override\n --diffs-bg-addition-number-override\n --diffs-bg-addition-hover-override\n --diffs-bg-addition-emphasis-override\n\n // Line Selection Color Overrides (for enableLineSelection)\n --diffs-selection-color-override\n --diffs-bg-selection-override\n --diffs-bg-selection-number-override\n --diffs-bg-selection-background-override\n --diffs-bg-selection-number-background-override\n\n // Available CSS Layout Overrides\n --diffs-gap-inline\n --diffs-gap-block\n --diffs-gap-style\n --diffs-tab-size\n */\n\n color-scheme: light dark;\n display: block;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n font-feature-settings: var(--diffs-font-features);\n }\n\n /* NOTE(mdo): Some semantic HTML elements (e.g. `pre`, `code`) have default\n * user-agent styles. These must be overridden to use our custom styles. */\n pre,\n code,\n [data-error-wrapper] {\n isolation: isolate;\n margin: 0;\n padding: 0;\n display: block;\n outline: none;\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n }\n\n pre,\n code {\n background-color: var(--diffs-bg);\n }\n\n code {\n contain: content;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n [data-icon-sprite] {\n display: none;\n }\n\n /* NOTE(mdo): Headers and separators are within pre/code, so we need to reset\n * their font-family explicitly. */\n [data-diffs-header],\n [data-separator] {\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n }\n\n [data-file-info] {\n padding: 10px;\n font-weight: 700;\n color: var(--fg);\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n background-color: color-mix(in lab, var(--bg) 98%, var(--fg));\n border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));\n }\n\n [data-diffs-header],\n [data-diff],\n [data-file],\n [data-error-wrapper],\n [data-virtualizer-buffer] {\n --diffs-bg: light-dark(var(--diffs-light-bg), var(--diffs-dark-bg));\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n --diffs-bg-buffer: var(\n --diffs-bg-buffer-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))\n )\n );\n --diffs-bg-hover: var(\n --diffs-bg-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer))\n )\n );\n\n --diffs-bg-context: var(\n --diffs-bg-context-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))\n )\n );\n --diffs-bg-context-number: var(\n --diffs-bg-context-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-marker: var(\n --diffs-bg-conflict-marker-override,\n light-dark(\n color-mix(\n in lab,\n var(--diffs-bg-context) 88%,\n var(--diffs-modified-base)\n ),\n color-mix(\n in lab,\n var(--diffs-bg-context) 80%,\n var(--diffs-modified-base)\n )\n )\n );\n --diffs-bg-conflict-current: var(\n --diffs-bg-conflict-current-override,\n light-dark(#e5f8ea, #274432)\n );\n --diffs-bg-conflict-base: var(\n --diffs-bg-conflict-base-override,\n light-dark(\n color-mix(\n in lab,\n var(--diffs-bg-context) 90%,\n var(--diffs-modified-base)\n ),\n color-mix(\n in lab,\n var(--diffs-bg-context) 82%,\n var(--diffs-modified-base)\n )\n )\n );\n --diffs-bg-conflict-incoming: var(\n --diffs-bg-conflict-incoming-override,\n light-dark(#e6f1ff, #253b5a)\n );\n --diffs-bg-conflict-marker-number: var(\n --diffs-bg-conflict-marker-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-conflict-marker) 72%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-conflict-marker) 54%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-current-number: var(\n --diffs-bg-conflict-current-number-override,\n light-dark(#d7f1de, #30533d)\n );\n --diffs-bg-conflict-base-number: var(\n --diffs-bg-conflict-base-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-conflict-base) 72%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-conflict-base) 54%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-incoming-number: var(\n --diffs-bg-conflict-incoming-number-override,\n light-dark(#d8e8ff, #2f4b73)\n );\n --conflict-bg-current: var(\n --conflict-bg-current-override,\n var(--diffs-bg-addition)\n );\n --conflict-bg-incoming: var(\n --conflict-bg-incoming-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-number: var(\n --conflict-bg-current-number-override,\n var(--diffs-bg-addition-number)\n );\n --conflict-bg-incoming-number: var(\n --conflict-bg-incoming-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-header: var(\n --conflict-bg-current-header-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-addition-base))\n )\n );\n --conflict-bg-incoming-header: var(\n --conflict-bg-incoming-header-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-header-number: var(\n --conflict-bg-current-header-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-addition-base))\n )\n );\n --conflict-bg-incoming-header-number: var(\n --conflict-bg-incoming-header-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-modified-base))\n )\n );\n\n --diffs-bg-separator: var(\n --diffs-bg-separator-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))\n )\n );\n\n --diffs-fg: light-dark(var(--diffs-light), var(--diffs-dark));\n --diffs-fg-number: var(\n --diffs-fg-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))\n )\n );\n --diffs-fg-conflict-marker: var(\n --diffs-fg-conflict-marker-override,\n var(--diffs-fg-number)\n );\n\n --diffs-deletion-base: var(\n --diffs-deletion-color-override,\n light-dark(\n var(\n --diffs-light-deletion-color,\n var(--diffs-deletion-color, var(--diffs-deleted-light))\n ),\n var(\n --diffs-dark-deletion-color,\n var(--diffs-deletion-color, var(--diffs-deleted-dark))\n )\n )\n );\n --diffs-addition-base: var(\n --diffs-addition-color-override,\n light-dark(\n var(\n --diffs-light-addition-color,\n var(--diffs-addition-color, var(--diffs-added-light))\n ),\n var(\n --diffs-dark-addition-color,\n var(--diffs-addition-color, var(--diffs-added-dark))\n )\n )\n );\n --diffs-modified-base: var(\n --diffs-modified-color-override,\n light-dark(\n var(\n --diffs-light-modified-color,\n var(--diffs-modified-color, var(--diffs-modified-light))\n ),\n var(\n --diffs-dark-modified-color,\n var(--diffs-modified-color, var(--diffs-modified-dark))\n )\n )\n );\n\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n --diffs-bg-deletion: var(\n --diffs-bg-deletion-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-number: var(\n --diffs-bg-deletion-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-hover: var(\n --diffs-bg-deletion-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-emphasis: var(\n --diffs-bg-deletion-emphasis-override,\n light-dark(\n rgb(from var(--diffs-deletion-base) r g b / 0.15),\n rgb(from var(--diffs-deletion-base) r g b / 0.2)\n )\n );\n\n --diffs-bg-addition: var(\n --diffs-bg-addition-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-number: var(\n --diffs-bg-addition-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-hover: var(\n --diffs-bg-addition-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-emphasis: var(\n --diffs-bg-addition-emphasis-override,\n light-dark(\n rgb(from var(--diffs-addition-base) r g b / 0.15),\n rgb(from var(--diffs-addition-base) r g b / 0.2)\n )\n );\n\n --diffs-selection-base: var(--diffs-modified-base);\n --diffs-selection-number-fg: light-dark(\n color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer))\n );\n --diffs-bg-selection: var(\n --diffs-bg-selection-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)),\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base))\n )\n );\n --diffs-bg-selection-number: var(\n --diffs-bg-selection-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)),\n color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base))\n )\n );\n\n background-color: var(--diffs-bg);\n color: var(--diffs-fg);\n }\n\n [data-diff],\n [data-file] {\n /* This feels a bit crazy to me... so I need to think about it a bit more... */\n --diffs-grid-number-column-width: minmax(min-content, max-content);\n --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;\n\n &[data-dehydrated] {\n --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);\n }\n\n &[data-theme-type='light'],\n & {\n [data-line] span {\n color: light-dark(\n var(--diffs-token-light, var(--diffs-light)),\n var(--diffs-token-dark, var(--diffs-dark))\n );\n font-weight: var(--diffs-token-light-font-weight, inherit);\n font-style: var(--diffs-token-light-font-style, inherit);\n -webkit-text-decoration: var(--diffs-token-light-text-decoration, inherit);\n text-decoration: var(--diffs-token-light-text-decoration, inherit);\n }\n }\n\n &[data-theme-type='dark'] [data-line] span {\n font-weight: var(--diffs-token-dark-font-weight, inherit);\n font-style: var(--diffs-token-dark-font-style, inherit);\n -webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit);\n text-decoration: var(--diffs-token-dark-text-decoration, inherit);\n }\n\n &:hover [data-code]::-webkit-scrollbar-thumb {\n background-color: var(--diffs-bg-context);\n }\n }\n\n [data-line] span {\n background-color: light-dark(\n var(--diffs-token-light-bg, inherit),\n var(--diffs-token-dark-bg, inherit)\n );\n }\n\n [data-line],\n [data-gutter-buffer],\n [data-line-annotation],\n [data-no-newline] {\n color: var(--diffs-fg);\n background-color: var(--diffs-line-bg, var(--diffs-bg));\n }\n\n [data-no-newline] {\n -webkit-user-select: none;\n user-select: none;\n\n span {\n opacity: 0.6;\n }\n }\n\n @media (prefers-color-scheme: dark) {\n [data-diffs-header],\n [data-error-wrapper],\n [data-diff],\n [data-file] {\n color-scheme: dark;\n }\n\n [data-content] [data-line] span {\n font-weight: var(--diffs-token-dark-font-weight, inherit);\n font-style: var(--diffs-token-dark-font-style, inherit);\n -webkit-text-decoration: var(--diffs-token-dark-text-decoration, inherit);\n text-decoration: var(--diffs-token-dark-text-decoration, inherit);\n }\n }\n\n [data-diffs-header],\n [data-diff],\n [data-file] {\n &[data-theme-type='light'] {\n color-scheme: light;\n }\n\n &[data-theme-type='dark'] {\n color-scheme: dark;\n }\n }\n\n [data-diff-type='split'][data-overflow='scroll'] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n\n [data-additions] {\n border-left: 1px solid var(--diffs-bg);\n }\n\n [data-deletions] {\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-code] {\n display: grid;\n grid-auto-flow: dense;\n grid-template-columns: var(--diffs-code-grid);\n overflow: scroll clip;\n overscroll-behavior-x: none;\n tab-size: var(--diffs-tab-size, 2);\n align-self: flex-start;\n padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));\n padding-bottom: max(\n 0px,\n calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px)\n );\n }\n\n [data-container-size] {\n container-type: inline-size;\n }\n\n [data-code]::-webkit-scrollbar {\n width: 0;\n height: 6px;\n }\n\n [data-code]::-webkit-scrollbar-track {\n background: transparent;\n }\n\n [data-code]::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 1px solid transparent;\n background-clip: content-box;\n border-radius: 3px;\n }\n\n [data-code]::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n\n /*\n * If we apply these rules globally it will mean that webkit will opt into the\n * standards compliant version of custom css scrollbars, which we do not want\n * because the custom stuff will look better\n */\n @supports (-moz-appearance: none) {\n [data-code] {\n scrollbar-width: thin;\n scrollbar-color: var(--diffs-bg-context) transparent;\n padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n }\n\n [data-diffs-header] ~ [data-diff],\n [data-diffs-header] ~ [data-file] {\n [data-code],\n &[data-overflow='wrap'] {\n padding-top: 0;\n }\n }\n\n [data-gutter] {\n display: grid;\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n grid-column: 1;\n z-index: 3;\n position: relative;\n background-color: var(--diffs-bg);\n\n [data-gutter-buffer],\n [data-column-number] {\n border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));\n }\n }\n\n [data-content] {\n display: grid;\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n grid-column: 2;\n min-width: 0;\n }\n\n [data-diff-type='split'][data-overflow='wrap'] {\n display: grid;\n grid-auto-flow: dense;\n grid-template-columns: repeat(2, var(--diffs-code-grid));\n padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n\n [data-deletions] {\n display: contents;\n\n [data-gutter] {\n grid-column: 1;\n }\n\n [data-content] {\n grid-column: 2;\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-additions] {\n display: contents;\n\n [data-gutter] {\n grid-column: 3;\n border-left: 1px solid var(--diffs-bg);\n }\n\n [data-content] {\n grid-column: 4;\n }\n }\n }\n\n [data-overflow='scroll'] [data-gutter] {\n position: sticky;\n left: 0;\n }\n\n [data-line-annotation][data-selected-line] {\n background-color: unset;\n\n &::before {\n content: '';\n /* FIXME(amadeus): This needs to be audited ... */\n position: sticky;\n top: 0;\n left: 0;\n display: block;\n border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg));\n background-color: var(--diffs-bg-selection-number);\n }\n\n [data-annotation-content] {\n background-color: var(--diffs-bg-selection);\n }\n }\n\n [data-interactive-lines] [data-line] {\n cursor: pointer;\n }\n\n [data-content-buffer],\n [data-gutter-buffer] {\n position: relative;\n -webkit-user-select: none;\n user-select: none;\n min-height: 1lh;\n }\n\n [data-gutter-buffer='annotation'] {\n min-height: 0;\n }\n\n [data-gutter-buffer='buffer'] {\n background-size: 8px 8px;\n background-position: 0 0;\n background-origin: border-box;\n background-color: var(--diffs-bg);\n /* This is incredibley expensive... */\n background-image: repeating-linear-gradient(\n -45deg,\n transparent,\n transparent calc(3px * 1.414),\n rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414),\n rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414)\n );\n }\n\n [data-content-buffer] {\n grid-column: 1;\n /* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */\n background-size: 8px 8px;\n background-position: 5px 0;\n background-origin: border-box;\n background-color: var(--diffs-bg);\n /* This is incredibley expensive... */\n background-image: repeating-linear-gradient(\n -45deg,\n transparent,\n transparent calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(4px * 1.414)\n );\n }\n\n [data-separator] {\n box-sizing: content-box;\n background-color: var(--diffs-bg);\n }\n\n [data-separator='simple'] {\n min-height: 4px;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'],\n [data-separator='metadata'],\n [data-separator='simple'] {\n background-color: var(--diffs-bg-separator);\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'],\n [data-separator='metadata'] {\n height: 32px;\n position: relative;\n }\n\n [data-separator-wrapper] {\n -webkit-user-select: none;\n user-select: none;\n fill: currentColor;\n position: absolute;\n inset-inline: 0;\n display: flex;\n align-items: center;\n background-color: var(--diffs-bg);\n height: 100%;\n }\n\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-separator='metadata'] [data-separator-wrapper] {\n inset-inline: 100% auto;\n padding-inline: 1ch;\n height: 100%;\n background-color: var(--diffs-bg-separator);\n color: var(--diffs-fg-number);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: min-content;\n }\n\n [data-separator='line-info'] {\n margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n\n [data-separator='line-info-basic'],\n [data-separator='metadata'] {\n margin-block: 0;\n }\n\n [data-separator='line-info'][data-separator-first] {\n margin-top: 0;\n }\n\n [data-separator='line-info'][data-separator-last] {\n margin-bottom: 0;\n }\n\n [data-expand-index] [data-separator-wrapper] {\n display: grid;\n grid-template-columns: 32px auto;\n }\n\n [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 32px 32px auto;\n }\n\n [data-expand-button],\n [data-separator-content] {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n background-color: var(--diffs-bg-separator);\n }\n\n [data-expand-button] {\n justify-content: center;\n flex-shrink: 0;\n cursor: pointer;\n min-width: 32px;\n align-self: stretch;\n color: var(--diffs-fg-number);\n border-right: 2px solid var(--diffs-bg);\n\n &:hover {\n color: var(--diffs-fg);\n }\n }\n\n [data-expand-down] [data-icon] {\n transform: scaleY(-1);\n }\n\n [data-separator-content] {\n flex: 1 1 auto;\n padding: 0 1ch;\n height: 100%;\n color: var(--diffs-fg-number);\n\n overflow: hidden;\n justify-content: flex-start;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'] {\n [data-separator-content] {\n height: 100%;\n -webkit-user-select: none;\n user-select: none;\n overflow: clip;\n }\n }\n\n @supports (width: 1cqi) {\n [data-unified] {\n [data-separator='line-info'] [data-separator-wrapper] {\n padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n width: 100cqi;\n\n [data-separator-content] {\n border-radius: 6px;\n }\n }\n\n [data-separator='line-info'][data-expand-index]\n [data-separator-wrapper]\n [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-gutter] {\n [data-separator='line-info'] [data-separator-wrapper] {\n padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n }\n\n [data-separator='line-info'] [data-separator-content] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n [data-separator='line-info'][data-expand-index] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-additions] {\n [data-content] [data-separator='line-info'] {\n background-color: var(--diffs-bg);\n\n [data-separator-wrapper] {\n display: none;\n }\n }\n\n [data-gutter] [data-separator='line-info'] [data-separator-wrapper] {\n display: block;\n height: 100%;\n background-color: var(--diffs-bg-separator);\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n\n [data-separator-content],\n [data-expand-button] {\n display: none;\n }\n }\n }\n\n [data-overflow='scroll']\n [data-additions]\n [data-gutter]\n [data-separator='line-info']\n [data-separator-wrapper] {\n width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));\n }\n\n [data-overflow='wrap']\n [data-additions]\n [data-content]\n [data-separator='line-info']\n [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n display: block;\n height: 100%;\n margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n\n [data-separator-content],\n [data-expand-button] {\n display: none;\n }\n }\n\n [data-separator='line-info'] [data-separator-wrapper] {\n [data-expand-both],\n [data-expand-down],\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n @media (pointer: fine) {\n [data-separator='line-info'] [data-separator-wrapper] {\n &[data-separator-multi-button] {\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: unset;\n }\n\n [data-expand-down] {\n border-bottom-left-radius: 6px;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: coarse) {\n [data-separator='line-info-basic']\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px 34px auto;\n\n [data-separator-content] {\n grid-column: unset;\n grid-row: unset;\n }\n }\n\n @supports (width: 1cqi) {\n [data-separator='line-info'] [data-separator-wrapper] {\n [data-expand-both],\n [data-expand-down],\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n &[data-separator-multi-button] {\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n [data-expand-down] {\n border-bottom-left-radius: unset;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: fine) {\n [data-separator-wrapper][data-separator-multi-button] {\n display: grid;\n grid-template-rows: 50% 50%;\n\n [data-separator-content] {\n grid-column: 2;\n grid-row: 1 / -1;\n min-width: min-content;\n }\n\n [data-expand-button] {\n grid-column: 1;\n }\n }\n\n [data-separator='line-info'] [data-separator-wrapper],\n [data-separator='line-info']\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px auto;\n }\n\n [data-separator='line-info-basic'][data-expand-index]\n [data-separator-wrapper] {\n grid-template-columns: 100% auto;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'] {\n [data-separator-multi-button] {\n [data-expand-up] {\n border-bottom: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n [data-expand-down] {\n border-top: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n }\n }\n }\n\n [data-additions] [data-gutter] [data-separator-wrapper],\n [data-additions] [data-separator='line-info-basic'] [data-separator-wrapper],\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-line-annotation],\n [data-gutter-buffer='annotation'] {\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-merge-conflict-actions],\n [data-gutter-buffer='merge-conflict-action'] {\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-has-merge-conflict] [data-line-annotation],\n [data-has-merge-conflict] [data-gutter-buffer='annotation'] {\n --diffs-line-bg: var(--diffs-bg);\n }\n\n [data-has-merge-conflict] [data-gutter-buffer='merge-conflict-action'] {\n --diffs-line-bg: var(--diffs-bg);\n }\n\n [data-line-annotation] {\n min-height: var(--diffs-annotation-min-height, 0);\n z-index: 2;\n }\n\n [data-merge-conflict-actions] {\n z-index: 2;\n }\n\n [data-separator='custom'] {\n display: grid;\n grid-template-columns: subgrid;\n }\n\n [data-line],\n [data-column-number],\n [data-no-newline] {\n position: relative;\n padding-inline: 1ch;\n }\n\n [data-indicators='classic'] [data-line] {\n padding-inline-start: 2ch;\n }\n\n [data-indicators='classic'] {\n [data-line-type='change-addition'],\n [data-line-type='change-deletion'] {\n &[data-no-newline],\n &[data-line] {\n &::before {\n display: inline-block;\n width: 1ch;\n height: 1lh;\n position: absolute;\n top: 0;\n left: 0;\n -webkit-user-select: none;\n user-select: none;\n }\n }\n }\n\n [data-line-type='change-addition'] {\n &[data-line],\n &[data-no-newline] {\n &::before {\n content: '+';\n color: var(--diffs-addition-base);\n }\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-line],\n &[data-no-newline] {\n &::before {\n content: '-';\n color: var(--diffs-deletion-base);\n }\n }\n }\n }\n\n [data-indicators='bars'] {\n [data-line-type='change-deletion'],\n [data-line-type='change-addition'] {\n &[data-column-number] {\n &::before {\n content: '';\n display: block;\n width: 4px;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n -webkit-user-select: none;\n user-select: none;\n contain: strict;\n }\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-column-number] {\n &::before {\n background-image: linear-gradient(\n 0deg,\n var(--diffs-bg-deletion) 50%,\n var(--diffs-deletion-base) 50%\n );\n background-repeat: repeat;\n background-size: 2px 2px;\n background-size: calc(1lh / round(1lh / 2px))\n calc(1lh / round(1lh / 2px));\n }\n }\n }\n\n [data-line-type='change-addition'] {\n &[data-column-number] {\n &::before {\n background-color: var(--diffs-addition-base);\n }\n }\n }\n }\n\n [data-overflow='wrap'] {\n [data-line],\n [data-annotation-content] {\n white-space: pre-wrap;\n word-break: break-word;\n }\n }\n\n [data-overflow='scroll'] [data-line] {\n white-space: pre;\n min-height: 1lh;\n }\n\n [data-column-number] {\n box-sizing: content-box;\n text-align: right;\n -webkit-user-select: none;\n user-select: none;\n background-color: var(--diffs-bg);\n color: var(--diffs-fg-number);\n padding-left: 2ch;\n }\n\n [data-line-number-content] {\n display: inline-block;\n min-width: var(\n --diffs-min-number-column-width,\n var(--diffs-min-number-column-width-default, 3ch)\n );\n }\n\n [data-disable-line-numbers] {\n [data-column-number] {\n min-width: 4px;\n padding: 0;\n }\n\n [data-line-number-content] {\n display: none;\n }\n\n [data-gutter-utility-slot] {\n right: unset;\n left: 0;\n justify-content: flex-start;\n }\n\n &[data-indicators='bars'] [data-gutter-utility-slot] {\n /* Using 5px here because theres a 1px separator after the bar */\n left: 5px;\n }\n }\n\n [data-file][data-disable-line-numbers] {\n [data-gutter-buffer],\n [data-column-number] {\n min-width: 0;\n border-right: 0;\n }\n }\n\n [data-interactive-line-numbers] [data-column-number] {\n cursor: pointer;\n }\n\n [data-diff-span] {\n border-radius: 3px;\n -webkit-box-decoration-break: clone;\n box-decoration-break: clone;\n }\n\n [data-line-type='change-addition'] {\n &[data-column-number] {\n color: var(\n --diffs-fg-number-addition-override,\n var(--diffs-addition-base)\n );\n }\n\n > [data-diff-span] {\n background-color: var(--diffs-bg-addition-emphasis);\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-column-number] {\n color: var(\n --diffs-fg-number-deletion-override,\n var(--diffs-deletion-base)\n );\n }\n\n [data-diff-span] {\n background-color: var(--diffs-bg-deletion-emphasis);\n }\n }\n\n [data-background] [data-line-type='change-addition'] {\n --diffs-line-bg: var(--diffs-bg-addition);\n\n &[data-column-number] {\n background-color: var(--diffs-bg-addition-number);\n }\n }\n\n [data-background] [data-line-type='change-deletion'] {\n --diffs-line-bg: var(--diffs-bg-deletion);\n\n &[data-column-number] {\n background-color: var(--diffs-bg-deletion-number);\n }\n }\n\n [data-merge-conflict^='marker-'][data-line] {\n &[data-line-type='context'],\n &[data-line-type='context-expanded'] {\n color: var(--diffs-fg);\n\n span {\n color: var(--diffs-fg) !important;\n }\n }\n }\n\n [data-merge-conflict='marker-start'][data-line] {\n &[data-line-type='context'],\n &[data-line-type='context-expanded'] {\n &::after {\n content: ' (Current Change)';\n color: var(--diffs-fg-conflict-marker);\n opacity: 1;\n font-style: normal;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n }\n }\n }\n\n [data-merge-conflict='marker-end'][data-line] {\n &[data-line-type='context'],\n &[data-line-type='context-expanded'] {\n &::after {\n content: ' (Incoming Change)';\n color: var(--diffs-fg-conflict-marker);\n opacity: 1;\n font-style: normal;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n }\n }\n }\n\n [data-merge-conflict='marker-start'],\n [data-merge-conflict='marker-base'],\n [data-merge-conflict='marker-separator'],\n [data-merge-conflict='marker-end'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg-conflict-marker);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg-conflict-marker-number);\n color: var(--diffs-fg-conflict-marker);\n\n [data-line-number-content] {\n color: var(--diffs-fg-conflict-marker);\n }\n }\n }\n\n [data-merge-conflict='current'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-current);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-current-number);\n color: var(--diffs-addition-base);\n }\n }\n\n [data-merge-conflict='marker-start'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-current-header);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-current-header-number);\n color: var(--diffs-addition-base);\n\n [data-line-number-content] {\n color: var(--diffs-addition-base);\n }\n }\n }\n\n [data-merge-conflict='marker-end'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-incoming-header);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-incoming-header-number);\n color: var(--diffs-modified-base);\n\n [data-line-number-content] {\n color: var(--diffs-modified-base);\n }\n }\n }\n\n [data-merge-conflict='marker-separator'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg);\n }\n }\n\n [data-merge-conflict='base'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg-conflict-base);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg-conflict-base-number);\n color: var(--diffs-modified-base);\n }\n }\n\n [data-merge-conflict='incoming'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-incoming);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-incoming-number);\n color: var(--diffs-modified-base);\n }\n }\n\n @media (pointer: fine) {\n [data-column-number],\n [data-line] {\n &[data-hovered] {\n background-color: var(--diffs-bg-hover);\n }\n }\n\n [data-background] {\n [data-column-number],\n [data-line] {\n &[data-hovered] {\n &[data-line-type='change-deletion'] {\n background-color: var(--diffs-bg-deletion-hover);\n }\n\n &[data-line-type='change-addition'] {\n background-color: var(--diffs-bg-addition-hover);\n }\n }\n }\n }\n }\n\n [data-diffs-header] {\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-height: calc(\n 1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3)\n );\n padding-inline: 16px;\n top: 0;\n z-index: 2;\n }\n\n [data-header-content] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-width: 0;\n white-space: nowrap;\n }\n\n [data-header-content] [data-prev-name],\n [data-header-content] [data-title] {\n direction: rtl;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 0;\n white-space: nowrap;\n }\n\n [data-prev-name] {\n opacity: 0.7;\n }\n\n [data-rename-icon] {\n fill: currentColor;\n flex-shrink: 0;\n flex-grow: 0;\n }\n\n [data-diffs-header] [data-metadata] {\n display: flex;\n align-items: center;\n gap: 1ch;\n white-space: nowrap;\n }\n\n [data-diffs-header] [data-additions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-addition-base);\n }\n\n [data-diffs-header] [data-deletions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-deletion-base);\n }\n\n [data-annotation-content] {\n position: relative;\n display: flow-root;\n align-self: flex-start;\n z-index: 2;\n min-width: 0;\n isolation: isolate;\n }\n\n [data-merge-conflict-actions-content] {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n padding-inline: 0.5rem;\n min-height: 1.75rem;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n font-size: 0.75rem;\n line-height: 1.2;\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action] {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--diffs-fg-number);\n font: inherit;\n font-style: normal;\n cursor: pointer;\n padding: 0;\n }\n\n [data-merge-conflict-action]:hover {\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action='current']:hover {\n color: var(--diffs-addition-base);\n }\n\n [data-merge-conflict-action='incoming']:hover {\n color: var(--diffs-modified-base);\n }\n\n [data-merge-conflict-action-separator] {\n color: var(--diffs-fg-number);\n opacity: 0.6;\n -webkit-user-select: none;\n user-select: none;\n }\n\n /* Sticky positioning has a composite costs, so we should _only_ pay it if we\n * need to */\n [data-overflow='scroll'] [data-annotation-content] {\n position: sticky;\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n }\n\n [data-overflow='scroll'] [data-merge-conflict-actions-content] {\n position: sticky;\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n }\n\n /* Undo some of the stuff that the 'pre' tag does */\n [data-annotation-slot] {\n text-wrap-mode: wrap;\n word-break: normal;\n white-space-collapse: collapse;\n }\n\n [data-change-icon] {\n fill: currentColor;\n flex-shrink: 0;\n }\n\n [data-change-icon='change'],\n [data-change-icon='rename-pure'],\n [data-change-icon='rename-changed'] {\n color: var(--diffs-modified-base);\n }\n\n [data-change-icon='new'] {\n color: var(--diffs-addition-base);\n }\n\n [data-change-icon='deleted'] {\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon='file'] {\n opacity: 0.6;\n }\n\n /* Line selection highlighting */\n [data-selected-line] {\n &[data-gutter-buffer='annotation'],\n &[data-column-number] {\n color: var(--diffs-selection-number-fg);\n background-color: var(--diffs-bg-selection-number);\n }\n\n &[data-line] {\n background-color: var(--diffs-bg-selection);\n }\n }\n\n [data-line-type='change-addition'],\n [data-line-type='change-deletion'] {\n &[data-selected-line] {\n &[data-line],\n &[data-line][data-hovered] {\n background-color: light-dark(\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 82%,\n var(--diffs-selection-base)\n ),\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 75%,\n var(--diffs-selection-base)\n )\n );\n }\n\n &[data-column-number],\n &[data-column-number][data-hovered] {\n color: var(--diffs-selection-number-fg);\n background-color: light-dark(\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 75%,\n var(--diffs-selection-base)\n ),\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 60%,\n var(--diffs-selection-base)\n )\n );\n }\n }\n }\n\n [data-gutter-utility-slot] {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n display: flex;\n justify-content: flex-end;\n }\n\n [data-unmodified-lines] {\n display: block;\n overflow: hidden;\n min-width: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 0 1 auto;\n }\n\n [data-error-wrapper] {\n overflow: auto;\n padding: var(--diffs-gap-block, var(--diffs-gap-fallback))\n var(--diffs-gap-inline, var(--diffs-gap-fallback));\n max-height: 400px;\n scrollbar-width: none;\n\n [data-error-message] {\n font-weight: bold;\n font-size: 18px;\n color: var(--diffs-deletion-base);\n }\n\n [data-error-stack] {\n color: var(--diffs-fg-number);\n }\n }\n\n [data-placeholder] {\n contain: strict;\n }\n\n [data-utility-button] {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n appearance: none;\n width: 1lh;\n height: 1lh;\n margin-right: calc((1lh - 1ch) * -1);\n padding: 0;\n cursor: pointer;\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n border-radius: 4px;\n background-color: var(--diffs-modified-base);\n color: var(--diffs-bg);\n fill: currentColor;\n position: relative;\n z-index: 4;\n }\n}\n"),t.adoptedStyleSheets=[e]}}customElements.define(t3,t)}var r5=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){if(null==t||null==n)for(let r of e.children??[])r instanceof HTMLElement&&("deletions"in r.dataset?t=r:"additions"in r.dataset&&(n=r));null==n||null==t?this.cleanUp():(this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0)}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};let r6=new Map,r3=new Map,r4=new Map,r7=new Set;function r9(e){for(let t of Array.isArray(e)?e:[e])if(!r7.has(t))return!1;return!0}function ie(e,t){for(let n of e=Array.isArray(e)?e:[e]){if(r7.has(n.name))continue;let e=r6.get(n.name);null==e&&(e=n,r6.set(n.name,e)),r7.add(e.name),t.loadLanguageSync(e.data)}}function it(){return"u">typeof WorkerGlobalScope&&"u">typeof self&&self instanceof WorkerGlobalScope}let ir=[{id:"abap",name:"ABAP",import:()=>e.A(81107)},{id:"actionscript-3",name:"ActionScript",import:()=>e.A(63750)},{id:"ada",name:"Ada",import:()=>e.A(91813)},{id:"angular-html",name:"Angular HTML",import:()=>e.A(56500)},{id:"angular-ts",name:"Angular TypeScript",import:()=>e.A(16569)},{id:"apache",name:"Apache Conf",import:()=>e.A(34082)},{id:"apex",name:"Apex",import:()=>e.A(96050)},{id:"apl",name:"APL",import:()=>e.A(19847)},{id:"applescript",name:"AppleScript",import:()=>e.A(78893)},{id:"ara",name:"Ara",import:()=>e.A(73785)},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>e.A(70789)},{id:"asm",name:"Assembly",import:()=>e.A(57041)},{id:"astro",name:"Astro",import:()=>e.A(77155)},{id:"awk",name:"AWK",import:()=>e.A(19686)},{id:"ballerina",name:"Ballerina",import:()=>e.A(4821)},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>e.A(81214)},{id:"beancount",name:"Beancount",import:()=>e.A(7827)},{id:"berry",name:"Berry",aliases:["be"],import:()=>e.A(59139)},{id:"bibtex",name:"BibTeX",import:()=>e.A(75527)},{id:"bicep",name:"Bicep",import:()=>e.A(65206)},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:()=>e.A(20766)},{id:"blade",name:"Blade",import:()=>e.A(43021)},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>e.A(590)},{id:"c",name:"C",import:()=>e.A(2328)},{id:"c3",name:"C3",import:()=>e.A(853)},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>e.A(87209)},{id:"cairo",name:"Cairo",import:()=>e.A(82927)},{id:"clarity",name:"Clarity",import:()=>e.A(52460)},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>e.A(85623)},{id:"cmake",name:"CMake",import:()=>e.A(85367)},{id:"cobol",name:"COBOL",import:()=>e.A(93874)},{id:"codeowners",name:"CODEOWNERS",import:()=>e.A(81727)},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>e.A(52172)},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>e.A(67432)},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>e.A(92185)},{id:"coq",name:"Coq",import:()=>e.A(83109)},{id:"cpp",name:"C++",aliases:["c++"],import:()=>e.A(63419)},{id:"crystal",name:"Crystal",import:()=>e.A(80210)},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>e.A(37160)},{id:"css",name:"CSS",import:()=>e.A(35302)},{id:"csv",name:"CSV",import:()=>e.A(4163)},{id:"cue",name:"CUE",import:()=>e.A(2170)},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>e.A(59146)},{id:"d",name:"D",import:()=>e.A(53717)},{id:"dart",name:"Dart",import:()=>e.A(40194)},{id:"dax",name:"DAX",import:()=>e.A(96874)},{id:"desktop",name:"Desktop",import:()=>e.A(17925)},{id:"diff",name:"Diff",import:()=>e.A(58196)},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>e.A(41274)},{id:"dotenv",name:"dotEnv",import:()=>e.A(169)},{id:"dream-maker",name:"Dream Maker",import:()=>e.A(86068)},{id:"edge",name:"Edge",import:()=>e.A(24716)},{id:"elixir",name:"Elixir",import:()=>e.A(62285)},{id:"elm",name:"Elm",import:()=>e.A(35711)},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>e.A(70112)},{id:"erb",name:"ERB",import:()=>e.A(19341)},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>e.A(16686)},{id:"fennel",name:"Fennel",import:()=>e.A(6581)},{id:"fish",name:"Fish",import:()=>e.A(14037)},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>e.A(35601)},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>e.A(83987)},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>e.A(6099)},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>e.A(83499)},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>e.A(87861)},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>e.A(80083)},{id:"gdshader",name:"GDShader",import:()=>e.A(38264)},{id:"genie",name:"Genie",import:()=>e.A(7204)},{id:"gherkin",name:"Gherkin",import:()=>e.A(13549)},{id:"git-commit",name:"Git Commit Message",import:()=>e.A(97183)},{id:"git-rebase",name:"Git Rebase Message",import:()=>e.A(32046)},{id:"gleam",name:"Gleam",import:()=>e.A(7826)},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>e.A(7076)},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>e.A(25338)},{id:"glsl",name:"GLSL",import:()=>e.A(20366)},{id:"gn",name:"GN",import:()=>e.A(7005)},{id:"gnuplot",name:"Gnuplot",import:()=>e.A(9742)},{id:"go",name:"Go",import:()=>e.A(32961)},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>e.A(28949)},{id:"groovy",name:"Groovy",import:()=>e.A(99953)},{id:"hack",name:"Hack",import:()=>e.A(94818)},{id:"haml",name:"Ruby Haml",import:()=>e.A(45962)},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>e.A(54989)},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>e.A(19766)},{id:"haxe",name:"Haxe",import:()=>e.A(36800)},{id:"hcl",name:"HashiCorp HCL",import:()=>e.A(48226)},{id:"hjson",name:"Hjson",import:()=>e.A(82962)},{id:"hlsl",name:"HLSL",import:()=>e.A(44097)},{id:"html",name:"HTML",import:()=>e.A(63665)},{id:"html-derivative",name:"HTML (Derivative)",import:()=>e.A(94224)},{id:"http",name:"HTTP",import:()=>e.A(67513)},{id:"hurl",name:"Hurl",import:()=>e.A(81432)},{id:"hxml",name:"HXML",import:()=>e.A(62205)},{id:"hy",name:"Hy",import:()=>e.A(79622)},{id:"imba",name:"Imba",import:()=>e.A(92033)},{id:"ini",name:"INI",aliases:["properties"],import:()=>e.A(80261)},{id:"java",name:"Java",import:()=>e.A(44410)},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>e.A(91941)},{id:"jinja",name:"Jinja",import:()=>e.A(61819)},{id:"jison",name:"Jison",import:()=>e.A(12957)},{id:"json",name:"JSON",import:()=>e.A(69035)},{id:"json5",name:"JSON5",import:()=>e.A(15864)},{id:"jsonc",name:"JSON with Comments",import:()=>e.A(61453)},{id:"jsonl",name:"JSON Lines",import:()=>e.A(27145)},{id:"jsonnet",name:"Jsonnet",import:()=>e.A(72102)},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>e.A(61866)},{id:"jsx",name:"JSX",import:()=>e.A(47375)},{id:"julia",name:"Julia",aliases:["jl"],import:()=>e.A(79483)},{id:"just",name:"Just",import:()=>e.A(27549)},{id:"kdl",name:"KDL",import:()=>e.A(78226)},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>e.A(89992)},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>e.A(96473)},{id:"latex",name:"LaTeX",import:()=>e.A(39084)},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>e.A(87185)},{id:"less",name:"Less",import:()=>e.A(67110)},{id:"liquid",name:"Liquid",import:()=>e.A(77875)},{id:"llvm",name:"LLVM IR",import:()=>e.A(67140)},{id:"log",name:"Log file",import:()=>e.A(92086)},{id:"logo",name:"Logo",import:()=>e.A(96265)},{id:"lua",name:"Lua",import:()=>e.A(19030)},{id:"luau",name:"Luau",import:()=>e.A(56786)},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>e.A(43167)},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>e.A(90015)},{id:"marko",name:"Marko",import:()=>e.A(77121)},{id:"matlab",name:"MATLAB",import:()=>e.A(93408)},{id:"mdc",name:"MDC",import:()=>e.A(81294)},{id:"mdx",name:"MDX",import:()=>e.A(42248)},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>e.A(18803)},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>e.A(89643)},{id:"mojo",name:"Mojo",import:()=>e.A(29681)},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>e.A(75864)},{id:"move",name:"Move",import:()=>e.A(1566)},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>e.A(17849)},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>e.A(68450)},{id:"nextflow-groovy",name:"nextflow-groovy",import:()=>e.A(44946)},{id:"nginx",name:"Nginx",import:()=>e.A(35471)},{id:"nim",name:"Nim",import:()=>e.A(24230)},{id:"nix",name:"Nix",import:()=>e.A(91052)},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>e.A(40785)},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>e.A(65479)},{id:"objective-cpp",name:"Objective-C++",import:()=>e.A(74546)},{id:"ocaml",name:"OCaml",import:()=>e.A(64834)},{id:"odin",name:"Odin",import:()=>e.A(91473)},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>e.A(31836)},{id:"pascal",name:"Pascal",import:()=>e.A(86958)},{id:"perl",name:"Perl",import:()=>e.A(98959)},{id:"php",name:"PHP",import:()=>e.A(6721)},{id:"pkl",name:"Pkl",import:()=>e.A(98326)},{id:"plsql",name:"PL/SQL",import:()=>e.A(14547)},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>e.A(19867)},{id:"polar",name:"Polar",import:()=>e.A(67362)},{id:"postcss",name:"PostCSS",import:()=>e.A(44583)},{id:"powerquery",name:"PowerQuery",import:()=>e.A(65129)},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>e.A(69514)},{id:"prisma",name:"Prisma",import:()=>e.A(43874)},{id:"prolog",name:"Prolog",import:()=>e.A(65557)},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>e.A(53316)},{id:"pug",name:"Pug",aliases:["jade"],import:()=>e.A(6098)},{id:"puppet",name:"Puppet",import:()=>e.A(32516)},{id:"purescript",name:"PureScript",import:()=>e.A(58805)},{id:"python",name:"Python",aliases:["py"],import:()=>e.A(86636)},{id:"qml",name:"QML",import:()=>e.A(48377)},{id:"qmldir",name:"QML Directory",import:()=>e.A(28449)},{id:"qss",name:"Qt Style Sheets",import:()=>e.A(80279)},{id:"r",name:"R",import:()=>e.A(74190)},{id:"racket",name:"Racket",import:()=>e.A(22166)},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>e.A(43712)},{id:"razor",name:"ASP.NET Razor",import:()=>e.A(94256)},{id:"reg",name:"Windows Registry Script",import:()=>e.A(10369)},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>e.A(27379)},{id:"rel",name:"Rel",import:()=>e.A(62502)},{id:"riscv",name:"RISC-V",import:()=>e.A(36578)},{id:"ron",name:"RON",import:()=>e.A(34463)},{id:"rosmsg",name:"ROS Interface",import:()=>e.A(57616)},{id:"rst",name:"reStructuredText",import:()=>e.A(25130)},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>e.A(70562)},{id:"rust",name:"Rust",aliases:["rs"],import:()=>e.A(20768)},{id:"sas",name:"SAS",import:()=>e.A(93376)},{id:"sass",name:"Sass",import:()=>e.A(84802)},{id:"scala",name:"Scala",import:()=>e.A(87506)},{id:"scheme",name:"Scheme",import:()=>e.A(23504)},{id:"scss",name:"SCSS",import:()=>e.A(4006)},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>e.A(31324)},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>e.A(90222)},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>e.A(17085)},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>e.A(36141)},{id:"smalltalk",name:"Smalltalk",import:()=>e.A(73046)},{id:"solidity",name:"Solidity",import:()=>e.A(37320)},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>e.A(12549)},{id:"sparql",name:"SPARQL",import:()=>e.A(55388)},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>e.A(71559)},{id:"sql",name:"SQL",import:()=>e.A(62250)},{id:"ssh-config",name:"SSH Config",import:()=>e.A(79140)},{id:"stata",name:"Stata",import:()=>e.A(58405)},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>e.A(96543)},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>e.A(13164)},{id:"svelte",name:"Svelte",import:()=>e.A(76180)},{id:"swift",name:"Swift",import:()=>e.A(83238)},{id:"system-verilog",name:"SystemVerilog",import:()=>e.A(20599)},{id:"systemd",name:"Systemd Units",import:()=>e.A(33838)},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>e.A(24411)},{id:"tasl",name:"Tasl",import:()=>e.A(13935)},{id:"tcl",name:"Tcl",import:()=>e.A(20474)},{id:"templ",name:"Templ",import:()=>e.A(53318)},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>e.A(79228)},{id:"tex",name:"TeX",import:()=>e.A(40618)},{id:"toml",name:"TOML",import:()=>e.A(5470)},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>e.A(30537)},{id:"tsv",name:"TSV",import:()=>e.A(40623)},{id:"tsx",name:"TSX",import:()=>e.A(24096)},{id:"turtle",name:"Turtle",import:()=>e.A(27542)},{id:"twig",name:"Twig",import:()=>e.A(77825)},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>e.A(19350)},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>e.A(86116)},{id:"typst",name:"Typst",aliases:["typ"],import:()=>e.A(72085)},{id:"v",name:"V",import:()=>e.A(56293)},{id:"vala",name:"Vala",import:()=>e.A(3131)},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>e.A(17240)},{id:"verilog",name:"Verilog",import:()=>e.A(86165)},{id:"vhdl",name:"VHDL",import:()=>e.A(35200)},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>e.A(33464)},{id:"vue",name:"Vue",import:()=>e.A(54049)},{id:"vue-html",name:"Vue HTML",import:()=>e.A(499)},{id:"vue-vine",name:"Vue Vine",import:()=>e.A(6993)},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>e.A(80598)},{id:"wasm",name:"WebAssembly",import:()=>e.A(72318)},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>e.A(84860)},{id:"wgsl",name:"WGSL",import:()=>e.A(46196)},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>e.A(19331)},{id:"wit",name:"WebAssembly Interface Types",import:()=>e.A(25277)},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>e.A(68013)},{id:"xml",name:"XML",import:()=>e.A(64046)},{id:"xsl",name:"XSL",import:()=>e.A(7544)},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>e.A(18299)},{id:"zenscript",name:"ZenScript",import:()=>e.A(36493)},{id:"zig",name:"Zig",import:()=>e.A(76720)}],ii=Object.fromEntries(ir.map(e=>[e.id,e.import])),io=Object.fromEntries(ir.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),is={...ii,...io};async function ia(e){if(it())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=r3.get(e);if(null!=t)return t;try{let t=r4.get(e);if(null==t&&Object.prototype.hasOwnProperty.call(is,e)&&(t=is[e]),null==t)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return r6.has(e)||r6.set(e,n),n});return r3.set(e,n),await n}finally{r3.delete(e)}}function il(e){return r6.get(e)??ia(e)}let ic=new Map,id=new Map,iu=new Map,ih=new Set;function ip(e,t){for(let n of e=Array.isArray(e)?e:[e]){let e;if("string"==typeof n){if(null==(e=ic.get(n)))throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,ic.has(n)||ic.set(n,e);ih.has(n)||(ih.add(n),t.loadThemeSync(e))}}let im=Object.fromEntries([{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>e.A(71233)},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>e.A(69905)},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>e.A(21579)},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>e.A(17347)},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>e.A(79579)},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>e.A(17235)},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>e.A(82774)},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>e.A(52161)},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>e.A(10803)},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>e.A(60897)},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>e.A(88958)},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>e.A(24347)},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>e.A(39415)},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>e.A(12625)},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>e.A(88984)},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>e.A(99547)},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>e.A(26878)},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>e.A(97301)},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>e.A(4877)},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>e.A(36193)},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>e.A(40608)},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>e.A(96394)},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>e.A(21243)},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>e.A(10707)},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>e.A(17644)},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>e.A(5583)},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>e.A(17669)},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>e.A(63824)},{id:"horizon-bright",displayName:"Horizon Bright",type:"dark",import:()=>e.A(86278)},{id:"houston",displayName:"Houston",type:"dark",import:()=>e.A(27289)},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>e.A(88348)},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>e.A(44132)},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>e.A(14230)},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>e.A(71202)},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>e.A(25402)},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>e.A(14117)},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>e.A(45165)},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>e.A(32896)},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>e.A(26230)},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>e.A(16100)},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>e.A(47952)},{id:"min-light",displayName:"Min Light",type:"light",import:()=>e.A(28043)},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>e.A(17390)},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>e.A(67165)},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>e.A(34685)},{id:"nord",displayName:"Nord",type:"dark",import:()=>e.A(87e3)},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>e.A(93697)},{id:"one-light",displayName:"One Light",type:"light",import:()=>e.A(52159)},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>e.A(71284)},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>e.A(1663)},{id:"red",displayName:"Red",type:"dark",import:()=>e.A(20216)},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>e.A(55440)},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>e.A(78800)},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>e.A(23257)},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>e.A(55807)},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>e.A(95487)},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>e.A(36490)},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>e.A(48663)},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>e.A(15839)},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>e.A(35719)},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>e.A(39152)},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>e.A(2271)},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>e.A(13655)},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>e.A(61619)},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>e.A(55196)}].map(e=>[e.id,e.import]));class ig extends Error{constructor(e){super(e),this.name="ShikiError"}}var iy=e.i(20698);function iv(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}var ib=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ix=class{static hasCaptures(e){return null!==e&&(ib.lastIndex=0,ib.test(e))}static replaceCaptures(e,t,n){return e.replace(ib,(e,r,i,o)=>{let s=n[parseInt(r||i,10)];if(!s)return e;{let e=t.substring(s.start,s.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function ik(e,t){if(null===e&&null===t)return 0;if(!e)return -1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){var i,o;let n=(i=e[r],i<(o=t[r])?-1:+(i>o));if(0!==n)return n}return 0}return n-r}function iw(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function iS(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var iC=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},iN=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i,o=t[e];if(!o.settings)continue;if("string"==typeof o.scope){let e=o.scope;i=(e=(e=e.replace(/^[,]+/,"")).replace(/[,]+$/,"")).split(",")}else i=Array.isArray(o.scope)?o.scope:[""];let s=-1;if("string"==typeof o.settings.fontStyle){s=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++)switch(e[t]){case"italic":s|=1;break;case"bold":s|=2;break;case"underline":s|=4;break;case"strikethrough":s|=8}}let a=null;"string"==typeof o.settings.foreground&&iw(o.settings.foreground)&&(a=o.settings.foreground);let l=null;"string"==typeof o.settings.background&&iw(o.settings.background)&&(l=o.settings.background);for(let t=0,o=i.length;t<o;t++){let o=i[t].trim().split(" "),c=o[o.length-1],d=null;o.length>1&&(d=o.slice(0,o.length-1)).reverse(),n[r++]=new iM(c,d,e,s,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{var n,r;let i=(n=e.scope,n<(r=t.scope)?-1:+(n>r));return 0!==i||0!==(i=ik(e.parentScopes,t.parentScopes))?i:e.index-t.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(i=t.background)}let o=new iI(t),s=new iE(n,o.getId(r),o.getId(i)),a=new iD(new iO(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];a.insert(0,n.scope,n.parentScopes,n.fontStyle,o.getId(n.foreground),o.getId(n.background))}return new iN(o,s,a)}(e,t)}_cachedMatchRoot=new iC(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>(function(e,t){if(0===t.length)return!0;for(let i=0;i<t.length;i++){var n,r;let o=t[i],s=!1;if(">"===o){if(i===t.length-1)return!1;o=t[++i],s=!0}for(;e&&(n=e.scopeName,!((r=o)===n||n.startsWith(r)&&"."===n[r.length]));){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0})(e.parent,t.parentScopes));return n?new iE(n.fontStyle,n.foreground,n.background):null}},iA=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}},iE=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}},iM=class{constructor(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o}},iT=((y=iT||{})[y.NotSet=-1]="NotSet",y[y.None=0]="None",y[y.Italic=1]="Italic",y[y.Bold=2]="Bold",y[y.Underline=4]="Underline",y[y.Strikethrough=8]="Strikethrough",y),iI=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},iL=Object.freeze([]),iO=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||iL,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},iD=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length)&&!(r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==i)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,o,s){let a,l,c;if(""===n)return void this._doInsertHere(t,r,i,o,s);let d=n.indexOf(".");-1===d?(a=n,l=""):(a=n.substring(0,d),l=n.substring(d+1)),this._children.hasOwnProperty(a)?c=this._children[a]:(c=new e(this._mainRule.clone(),iO.cloneArr(this._rulesWithParentScopes)),this._children[a]=c),c.insert(t+1,l,r,i,o,s)}_doInsertHere(e,t,n,r,i){if(null===t)return void this._mainRule.acceptOverwrite(e,n,r,i);for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let s=this._rulesWithParentScopes[o];if(0===ik(s.parentScopes,t))return void s.acceptOverwrite(e,n,r,i)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===i&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new iO(e,t,n,r,i))}},iR=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:e.getForeground(t),background:e.getBackground(t)})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return(1024&e)!=0}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(0xff8000&e)>>>15}static getBackground(e){return(0xff000000&e)>>>24}static set(t,n,r,i,o,s,a){let l=e.getLanguageId(t),c=e.getTokenType(t),d=+!!e.containsBalancedBrackets(t),u=e.getFontStyle(t),h=e.getForeground(t),p=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==i&&(d=+!!i),-1!==o&&(u=o),0!==s&&(h=s),0!==a&&(p=a),(l|c<<8|d<<10|u<<11|h<<15|p<<24)>>>0}};function iP(e,t){var n;let r,i,o=[],s=(n=e,i=(r=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g).exec(n),{next:()=>{if(!i)return null;let e=i[0];return i=r.exec(n),e}}),a=s.next();for(;null!==a;){let e=0;if(2===a.length&&":"===a.charAt(1)){switch(a.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=s.next()}let t=c();if(o.push({matcher:t,priority:e}),","!==a)break;a=s.next()}return o;function l(){if("-"===a){a=s.next();let e=l();return t=>!!e&&!e(t)}if("("===a){a=s.next();let e=function(){let e=[],t=c();for(;t&&(e.push(t),"|"===a||","===a);){do a=s.next();while("|"===a||","===a)t=c()}return t=>e.some(e=>e(t))}();return")"===a&&(a=s.next()),e}if(i_(a)){let e=[];do e.push(a),a=s.next();while(i_(a))return n=>t(e,n)}return null}function c(){let e=[],t=l();for(;t;)e.push(t),t=l();return t=>e.every(e=>e(t))}}function i_(e){return!!e&&!!e.match(/[\w\.:]+/)}var ij=((v=ij||{})[v.None=0]="None",v[v.NotBeginString=1]="NotBeginString",v[v.NotEndString=2]="NotEndString",v[v.NotBeginPosition=4]="NotBeginPosition",v[v.DebugCall=8]="DebugCall",v);function iB(e){"function"==typeof e.dispose&&e.dispose()}var iz=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},i$=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},iF=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},iU=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new iz(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new iF;for(let n of e)!function(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let o=n.lookup(t);e instanceof iz?iW({baseGrammar:o,selfGrammar:i},r):iH(e.ruleName,{baseGrammar:o,selfGrammar:i,repository:i.repository},r);let s=n.injections(e.scopeName);if(s)for(let e of s)r.add(new iz(e))}(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof iz){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function iH(e,t,n){t.repository&&t.repository[e]&&iV([t.repository[e]],t,n)}function iW(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&iV(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&iV(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function iV(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?iv({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&iV(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let o=iY(i);switch(o.kind){case 0:iW({...t,selfGrammar:t.baseGrammar},n);break;case 1:iW(t,n);break;case 2:iH(o.ruleName,{...t,repository:e},n);break;case 3:case 4:let s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let r={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===o.kind?iH(o.ruleName,r,n):iW(r,n)}else 4===o.kind?n.add(new i$(o.scopeName,o.ruleName)):n.add(new iz(o.scopeName))}}}var iG=class{kind=0},iq=class{kind=1},iK=class{constructor(e){this.ruleName=e}kind=2},iJ=class{constructor(e){this.scopeName=e}kind=3},iX=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function iY(e){if("$base"===e)return new iG;if("$self"===e)return new iq;let t=e.indexOf("#");return -1===t?new iJ(e):0===t?new iK(e.substring(1)):new iX(e.substring(0,t),e.substring(t+1))}var iQ=/\\(\d+)/,iZ=/\\(\d+)/g;Symbol("RuleId");var i0=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ix.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ix.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${function e(t){let n=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return 0===n?t:~n==t.length-1?e(t.substring(0,t.length-1)):t.substr(~n+1)}(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?ix.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?ix.replaceCaptures(this._contentName,e,t):this._contentName}},i1=class extends i0{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,n,r){throw Error("Not supported!")}},i2=class extends i0{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new i4(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new i7,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},i8=class extends i0{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new i7,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},i5=class extends i0{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r),this._begin=new i4(i,this.id),this.beginCaptures=o,this._end=new i4(s||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){for(let t of(this._cachedCompiledPatterns=new i7,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},i6=class extends i0{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r),this._begin=new i4(i,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new i4(s,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)for(let t of(this._cachedCompiledPatterns=new i7,this.patterns))e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new i7,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},i3=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new i1(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new i2(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=iv({},r,t.repository));let i=t.patterns;return void 0===i&&t.include&&(i=[{include:t.include}]),new i8(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new i6(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new i5(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let o=0;for(let e in t){if("$vscodeTextmateLocation"===e)continue;let t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)i[e]=null;for(let o in t){if("$vscodeTextmateLocation"===o)continue;let s=parseInt(o,10),a=0;t[o].patterns&&(a=e.getCompiledRuleId(t[o],n,r)),i[s]=e.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,a)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let o=0,s=t.length;o<s;o++){let s=t[o],a=-1;if(s.include){let t=iY(s.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(r[s.include],n,r);break;case 2:let i=r[t.ruleName];i&&(a=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let o=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(o,r);if(c)if(l){let t=c.repository[l];t&&(a=e.getCompiledRuleId(t,n,c.repository))}else a=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else a=e.getCompiledRuleId(s,n,r);if(-1!==a){let e=n.getRule(a),t=!1;if((e instanceof i8||e instanceof i5||e instanceof i6)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;i.push(a)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},i4=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],i=!1;for(let o=0;o<t;o++)if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(r.push(e.substring(n,o)),r.push("$(?!\\n)(?<!\\n)"),n=o+2):("A"===t||"G"===t)&&(i=!0),o++}this.hasAnchor=i,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=iQ.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return iZ.lastIndex=0,this.source.replace(iZ,(e,t)=>iS(n[parseInt(t,10)]||""))}_buildAnchorCache(){let e,t,n,r;if("string"!=typeof this.source)throw Error("This method should only be called if the source is a string");let i=[],o=[],s=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),i[e]=n,o[e]=n,s[e]=n,a[e]=n,"\\"===n&&e+1<t&&("A"===(r=this.source.charAt(e+1))?(i[e+1]="",o[e+1]="",s[e+1]="A",a[e+1]="A"):"G"===r?(i[e+1]="",o[e+1]="G",s[e+1]="",a[e+1]="G"):(i[e+1]=r,o[e+1]=r,s[e+1]=r,a[e+1]=r),e++);return{A0_G0:i.join(""),A0_G1:o.join(""),A1_G0:s.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){if(!this.hasAnchor||!this._anchorCache||"string"!=typeof this.source)return this.source;if(e)if(t)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;return t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},i7=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new i9(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){if(!this._hasAnchors)return this.compile(e);if(t)if(n)return this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1;else return this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0;return n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0)}_resolveAnchors(e,t,n){return new i9(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},i9=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},oe=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ot=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new oe(e,8),this._embeddedLanguagesMatcher=new on(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new oe(0,0);_getBasicScopeAttributes=new iC(e=>new oe(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},on=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>iS(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};void 0!==iy.default&&iy.default.env.VSCODE_TEXTMATE_DEBUG;var or=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function oi(e,t,n,r,i,o,s,a){let l=t.content.length,c=!1,d=-1;if(s){let s=function(e,t,n,r,i,o){let s=i.beginRuleCapturedEOL?0:-1,a=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof i6&&a.push({rule:n,stack:t})}for(let p=a.pop();p;p=a.pop()){var l,c,d,u,h;let{ruleScanner:a,findOptions:f}=(l=p.rule,c=e,d=p.stack.endRule,u=n,h=r===s,{ruleScanner:l.compileWhileAG(c,d,u,h),findOptions:0}),m=a.findNextMatchSync(t,r,f);if(m){if(-2!==m.ruleId){i=p.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(o.produce(p.stack,m.captureIndices[0].start),oa(e,t,n,p.stack,o,p.rule.whileCaptures,m.captureIndices),o.produce(p.stack,m.captureIndices[0].end),s=m.captureIndices[0].end,m.captureIndices[0].end>r&&(r=m.captureIndices[0].end,n=!1))}else{i=p.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:s,isFirstLine:n}}(e,t,n,r,i,o);i=s.stack,r=s.linePos,n=s.isFirstLine,d=s.anchorPosition}let u=Date.now();for(;!c;){if(0!==a&&Date.now()-u>a)return new or(i,!0);!function(){let s=function(e,t,n,r,i,o){let s=function(e,t,n,r,i,o){let{ruleScanner:s,findOptions:a}=oo(i.getRule(e),e,i.endRule,n,r===o),l=s.findNextMatchSync(t,r,a);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}(e,t,n,r,i,o),a=e.getInjections();if(0===a.length)return s;let l=function(e,t,n,r,i,o,s){let a,l=Number.MAX_VALUE,c=null,d=0,u=o.contentNameScopesList.getScopeNames();for(let o=0,h=e.length;o<h;o++){let h=e[o];if(!h.matcher(u))continue;let{ruleScanner:p,findOptions:f}=oo(t.getRule(h.ruleId),t,null,r,i===s),m=p.findNextMatchSync(n,i,f);if(!m)continue;let g=m.captureIndices[0].start;if(!(g>=l)&&(l=g,c=m.captureIndices,a=m.ruleId,d=h.priority,l===i))break}return c?{priorityMatch:-1===d,captureIndices:c,matchedRuleId:a}:null}(a,e,t,n,r,i,o);if(!l)return s;if(!s)return l;let c=s.captureIndices[0].start,d=l.captureIndices[0].start;return d<c||l.priorityMatch&&d===c?l:s}(e,t,n,r,i,d);if(!s){o.produce(i,l),c=!0;return}let a=s.captureIndices,u=s.matchedRuleId,h=!!a&&a.length>0&&a[0].end>r;if(-1===u){let s=i.getRule(e);o.produce(i,a[0].start),i=i.withContentNameScopesList(i.nameScopesList),oa(e,t,n,i,o,s.endCaptures,a),o.produce(i,a[0].end);let u=i;if(i=i.parent,d=u.getAnchorPos(),!h&&u.getEnterPos()===r){i=u,o.produce(i,l),c=!0;return}}else{let s=e.getRule(u);o.produce(i,a[0].start);let p=i,f=s.getName(t.content,a),m=i.contentNameScopesList.pushAttributed(f,e);if(i=i.push(u,r,d,a[0].end===l,null,m,m),s instanceof i5){oa(e,t,n,i,o,s.beginCaptures,a),o.produce(i,a[0].end),d=a[0].end;let r=s.getContentName(t.content,a),u=m.pushAttributed(r,e);if(i=i.withContentNameScopesList(u),s.endHasBackReferences&&(i=i.withEndRule(s.getEndWithResolvedBackReferences(t.content,a))),!h&&p.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),c=!0;return}}else if(s instanceof i6){oa(e,t,n,i,o,s.beginCaptures,a),o.produce(i,a[0].end),d=a[0].end;let r=s.getContentName(t.content,a),u=m.pushAttributed(r,e);if(i=i.withContentNameScopesList(u),s.whileHasBackReferences&&(i=i.withEndRule(s.getWhileWithResolvedBackReferences(t.content,a))),!h&&p.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),c=!0;return}}else if(oa(e,t,n,i,o,s.captures,a),o.produce(i,a[0].end),i=i.pop(),!h){i=i.safePop(),o.produce(i,l),c=!0;return}}a[0].end>r&&(r=a[0].end,n=!1)}()}return new or(i,!1)}function oo(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function oa(e,t,n,r,i,o,s){if(0===o.length)return;let a=t.content,l=Math.min(o.length,s.length),c=[],d=s[0].end;for(let t=0;t<l;t++){let l=o[t];if(null===l)continue;let u=s[t];if(0===u.length)continue;if(u.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=u.start;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?i.produceFromScopes(c[c.length-1].scopes,u.start):i.produce(r,u.start),l.retokenizeCapturedWithRuleId){let t=l.getName(a,s),o=r.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(a,s),d=o.pushAttributed(c,e),h=r.push(l.retokenizeCapturedWithRuleId,u.start,-1,!1,null,o,d),p=e.createOnigString(a.substring(0,u.end));oi(e,p,n&&0===u.start,u.start,h,i,!1,0),iB(p);continue}let h=l.getName(a,s);if(null!==h){let t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(h,e);c.push(new ol(t,u.end))}}for(;c.length>0;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var ol=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function oc(e,t,n,r,i){let o=iP(t,od),s=i3.getCompiledRuleId(n,r,i.repository);for(let n of o)e.push({debugSelector:t,matcher:n.matcher,ruleId:s,grammar:i,priority:n.priority})}function od(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(function(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}(t[r],e))return n=r+1,!0;return!1})}var ou=class{constructor(e,t,n,r,i,o,s,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new ot(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=oh(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const e of Object.keys(i))for(const t of iP(e,od))this._tokenTypeMatchers.push({matcher:t.matcher,type:i[e]})}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e=[],t=this._rootScopeName,n=({lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)}).lookup(t);if(n){let r=n.injections;if(r)for(let t in r)oc(e,t,r[t],this,n);let i=this._grammarRepository.injections(t);i&&i.forEach(t=>{let n=this.getExternalGrammar(t);if(n){let t=n.injectionSelector;t&&oc(e,t,n,this,n)}})}return e.sort((e,t)=>e.priority-t.priority),e}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=oh(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){let i;if(-1===this._rootId&&(this._rootId=i3.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==of.NULL)i=!1,t.reset();else{let e;i=!0;let n=this._basicScopeAttributesProvider.getDefaultAttributes(),r=this.themeProvider.getDefaults(),o=iR.set(0,n.languageId,n.tokenType,null,r.fontStyle,r.foregroundId,r.backgroundId),s=this.getRule(this._rootId).getName(null,null);e=s?op.createRootAndLookUpScopeName(s,o,this):op.createRoot("unknown",o),t=new of(null,this._rootId,-1,-1,!1,null,e,e)}e+="\n";let o=this.createOnigString(e),s=o.content.length,a=new og(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=oi(this,o,i,0,t,a,!0,r);return iB(o),{lineLength:s,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function oh(e,t){return(e=function e(t){return Array.isArray(t)?function(t){let n=[];for(let r=0,i=t.length;r<i;r++)n[r]=e(t[r]);return n}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let n={};for(let r in t)n[r]=e(t[r]);return n}(t):t}(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var op=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)r=new e(r,i=iA.push(i,t.scopeNames),t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new iA(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),o=new iA(null,t),s=r.themeProvider.themeMatch(o),a=e.mergeAttributes(n,i,s);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,i=0,o=0;return null!==n&&(r=n.fontStyle,i=n.foregroundId,o=n.backgroundId),iR.set(e,t.languageId,t.tokenType,null,r,i,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),o=t.scopePath.push(n),s=r.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,i,s);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},of=class e{constructor(e,t,n,r,i,o,s,a){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&op.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,o,s,a){return new e(this,t,n,r,i,o,s,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=op.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,op.fromExtension(r,n.contentNameScopesList))}},om=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):iP(e,od).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>iP(e,od).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},og=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=iR.set(n,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=iR.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},oy=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,new ou(e,o,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},ov=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new oy(iN.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(iN.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new om(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let o=new iU(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},ob=of.NULL;function ox(e,t){let n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))"string"==typeof i?n[e]=i:e===r&&Object.assign(n,i);return n}function ok(e,t){return e&&t?.[e?.toLowerCase()]||e}async function ow(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function oS(e){return!e||["plaintext","txt","text","plain"].includes(e)}function oC(e){return"ansi"===e||oS(e)}function oN(e){return"none"===e}function oA(e,t){if(!t)return e;for(let n of(e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]),Array.isArray(t)?t:t.split(/\s+/g)))n&&!e.properties.class.includes(n)&&e.properties.class.push(n);return e}function oE(e,t=!1){if(0===e.length)return[["",0]];let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;e<n.length;e+=2){let o=t?n[e]+(n[e+1]||""):n[e];i.push([o,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}let oM="light-dark()",oT=["color","background-color"];function oI(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&iT.Italic&&(t["font-style"]="italic"),e.fontStyle&iT.Bold&&(t["font-weight"]="bold");let n=[];e.fontStyle&iT.Underline&&n.push("underline"),e.fontStyle&iT.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function oL(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}let oO=new WeakMap;function oD(e,t){oO.set(e,t)}function oR(e){return oO.get(e)}class oP{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new oP(Object.fromEntries((Array.isArray(t)?t:[t]).map(e=>[e,ob])),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){var t;let n,r;return t=this._stacks[e],n=[],r=new Set,!function e(t){if(r.has(t))return;r.add(t);let i=t?.nameScopesList?.scopeName;i&&n.push(i),t.parent&&e(t.parent)}(t),n}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}let o_=[function(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){var n;let r,i=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new ig(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...o.indexToPos(e),offset:e}}{let t=o.lines[e.line];if(void 0===t)throw new ig(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${o.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new ig(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:o.posToIndex(e.line,n)}}},o={lines:r=oE(n=t.source,!0).map(([e])=>e),indexToPos:function(e){if(e===n.length)return{line:r.length-1,character:r[r.length-1].length};let t=e,i=0;for(let e of r){if(t<e.length)break;t-=e.length,i++}return{line:i,character:t}},posToIndex:function(e,t){let n=0;for(let t=0;t<e;t++)n+=r[t].length;return n+t}},s=(t.options.decorations||[]).map(e=>({...e,start:i(e.start),end:i(e.end)}));(function(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new ig(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,o=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,s=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||o||s||a){if(i&&o||s&&a||s&&n.start.offset===n.end.offset||o&&t.start.offset===t.end.offset)continue;throw new ig(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}})(s),e.set(t.meta,{decorations:s,converter:o,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){let n;if(!this.options.decorations?.length)return;let r=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]);return(n=Array.from(r instanceof Set?r:new Set(r)).sort((e,t)=>e-t)).length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);if(!t.length)return e;let r=0,i=[];for(let n of t)n>r&&i.push({...e,content:e.content.slice(r,n),offset:e.offset+r}),r=n;return r<e.content.length&&i.push({...e,content:e.content.slice(r),offset:e.offset+r}),i})):e},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==n.converter.lines.length)throw new ig(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let s=r[e],a="",l=-1,c=-1;if(0===t&&(l=0),0===n&&(c=0),n===1/0&&(c=s.children.length),-1===l||-1===c)for(let e=0;e<s.children.length;e++)a+=function e(t){return"text"===t.type?t.value:"element"===t.type?t.children.map(e).join(""):""}(s.children[e]),-1===l&&a.length===t&&(l=e+1),-1===c&&a.length===n&&(c=e+1);if(-1===l)throw new ig(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===c)throw new ig(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let d=s.children.slice(l,c);if(i.alwaysWrap||d.length!==s.children.length)if(i.alwaysWrap||1!==d.length||"element"!==d[0].type){let e={type:"element",tagName:"span",properties:{},children:d};o(e,i,"wrapper"),s.children.splice(l,d.length,e)}else o(d[0],i,"token");else o(s,i,"line")}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&oA(e,t.properties.class),e=i(e,n)||e}let s=[];for(let e of n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset)){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let i=t.line+1;i<n.line;i++)s.unshift(()=>{var t;r[t=i]=o(r[t],e,"line")});i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}()];function oj(e){let t=function(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case"pre":t.push(i);break;case"post":n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...o_]}var oB=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],oz={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function o$(e){let t=e.shift();if("2"===t){let t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){let t=e.shift();if(t)return{type:"table",index:Number(t)}}}var oF={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};let oU={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function oH(e,t,n={}){var r,i;let o,s,{theme:a=e.getLoadedThemes()[0]}=n,l=e.resolveLangAlias(n.lang||"text");if(oS(l)||oN(a))return oE(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:c,colorMap:d}=e.setTheme(a);if("ansi"===l){let e,r,i,o,s,a,l;return e=ox(c,n),r=oE(t),i=function(e=oF){let t;function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}return{value:function(r){switch(r.type){case"named":return e[r.name];case"rgb":return n(r.rgb);case"table":var i;return i=r.index,function(){if(t)return t;t=[];for(let n=0;n<oB.length;n++)t.push(e[oB[n]]);let r=[0,95,135,175,215,255];for(let e=0;e<6;e++)for(let i=0;i<6;i++)for(let o=0;o<6;o++)t.push(n([r[e],r[i],r[o]]));let i=8;for(let e=0;e<24;e++,i+=10)t.push(n([i,i,i]));return t}()[i]}}}}(Object.fromEntries(oB.map(e=>{let t=`terminal.ansi${e[0].toUpperCase()}${e.substring(1)}`;return[e,c.colors?.[t]||oU[e]]}))),o=null,s=null,a=new Set,l={parse(e){let t=[],n=0;do{let r=function(e,t){let n=e.indexOf("\x1b",t);if(-1!==n&&"["===e[n+1]){let t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}(e,n),i=r.sequence?e.substring(n,r.startPosition):e.substring(n);if(i.length>0&&t.push({value:i,foreground:o,background:s,decorations:new Set(a)}),r.sequence){let e=function(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9)oz[r]&&t.push({type:"setDecoration",value:oz[r]});else if(r<=29){let e=oz[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:oB[r-30]}});else if(38===r){let n=o$(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:oB[r-40]}});else if(48===r){let n=o$(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:oB[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:oB[r-100+8]}})}return t}(r.sequence);for(let t of e)"resetAll"===t.type?(o=null,s=null,a.clear()):"resetForegroundColor"===t.type?o=null:"resetBackgroundColor"===t.type?s=null:"resetDecoration"===t.type&&a.delete(t.value);for(let t of e)"setForegroundColor"===t.type?o=t.value:"setBackgroundColor"===t.type?s=t.value:"setDecoration"===t.type&&a.add(t.value)}n=r.position}while(n<e.length)return t}},r.map(t=>l.parse(t[0]).map(n=>{let r,o;n.decorations.has("reverse")?(r=n.background?i.value(n.background):c.bg,o=n.foreground?i.value(n.foreground):c.fg):(r=n.foreground?i.value(n.foreground):c.fg,o=n.background?i.value(n.background):void 0),r=ok(r,e),o=ok(o,e),n.decorations.has("dim")&&(r=function(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(8===e.length){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){let t=e[0],n=e[1],r=e[2],i=e[3],o=Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0");return`#${t}${t}${n}${n}${r}${r}${o}`}else if(3===e.length){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(r));let s=iT.None;return n.decorations.has("bold")&&(s|=iT.Bold),n.decorations.has("italic")&&(s|=iT.Italic),n.decorations.has("underline")&&(s|=iT.Underline),n.decorations.has("strikethrough")&&(s|=iT.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:o,fontStyle:s}}))}let u=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==u.name)throw new ig(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${u.name}"`);if(!n.grammarState.themes.includes(c.name))throw new ig(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${c.name}"`)}return s=new oP((o=oW(t,r=u,i=c,d,n)).stateStack,r.name,i.name),oD(o.tokens,s),o.tokens}function oW(e,t,n,r,i){let o=ox(n,i),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:a=500}=i,l=oE(e),c=i.grammarState?function(e,t){if(!(e instanceof oP))throw new ig("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,n.name)??ob:null!=i.grammarContextCode?oW(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:ob,d=[],u=[];for(let e=0,h=l.length;e<h;e++){let h,p,[f,m]=l[e];if(""===f){d=[],u.push([]);continue}if(s>0&&f.length>=s){d=[],u.push([{content:f,offset:m,color:"",fontStyle:0}]);continue}i.includeExplanation&&(h=t.tokenizeLine(f,c,a).tokens,p=0);let g=t.tokenizeLine2(f,c,a),y=g.tokens.length/2;for(let e=0;e<y;e++){let t=g.tokens[2*e],s=e+1<y?g.tokens[2*e+2]:f.length;if(t===s)continue;let a=g.tokens[2*e+1],l=ok(r[iR.getForeground(a)],o),c=iR.getFontStyle(a),u={content:f.substring(t,s),offset:m+t,color:l,fontStyle:c};if(i.includeExplanation){let e=[];if("scopeName"!==i.includeExplanation)for(let t of n.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(/,/).map(e=>e.trim());break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}u.explanation=[];let r=0;for(;t+r<s;){let t=h[p],n=f.substring(t.startIndex,t.endIndex);r+=n.length,u.explanation.push({content:n,scopes:"scopeName"===i.includeExplanation?t.scopes.map(e=>({scopeName:e})):function(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:function(e,t,n){let r=[];for(let{selectors:i,settings:o}of e)for(let e of i)if(function(e,t,n){if(!oV(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)oV(e[r],n[i])&&(r-=1),i-=1;return -1===r}(e,t,n)){r.push(o);break}return r}(e,i,t.slice(0,r))}}return n}(e,t.scopes)}),p+=1}}d.push(u)}u.push(d),d=[],c=g.ruleStack}return{tokens:u,stateStack:c}}function oV(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function oG(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=oH(e,t,{...n,theme:r.theme}),o=oR(i);return{tokens:i,state:o,theme:"string"==typeof r.theme?r.theme:r.theme.name}}),o=function(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));let s=i.map(()=>0),a=i.map(e=>e[0]);for(;a.every(e=>e);){let e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){let n=a[t];n.content.length===e?(o[t].push(n),s[t]+=1,a[t]=i[t][s[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...i.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,i)=>{let s={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(s.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:a,offset:l,...c}=e[t][i];s.variants[r[n].color]=c}),s})),a=i[0].state?new oP(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return a&&oD(s,a),s}function oq(e,t,n){let r,i,o,s,a,l;if("themes"in n){let{defaultColor:c="light",cssVariablePrefix:d="--shiki-",colorsRendering:u="css-vars"}=n,h=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:+(t.color===c));if(0===h.length)throw new ig("`themes` option must not be empty");let p=oG(e,t,n);if(l=oR(p),c&&oM!==c&&!h.find(e=>e.color===c))throw new ig(`\`themes\` option must contain the defaultColor key \`${c}\``);let f=h.map(t=>e.getTheme(t.theme)),m=h.map(e=>e.color);o=p.map(e=>e.map(e=>(function(e,t,n,r,i="css-vars"){let o={content:e.content,explanation:e.explanation,offset:e.offset},s=t.map(t=>oI(e.variants[t])),a=new Set(s.flatMap(e=>Object.keys(e))),l={},c=(e,r)=>{let i="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":i)};return s.forEach((e,n)=>{for(let o of a){let a=e[o]||"inherit";if(0===n&&r&&oT.includes(o))if(r===oM&&s.length>1){let e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new ig('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let d=s[e][o]||"inherit",u=s[r][o]||"inherit";l[o]=`light-dark(${d}, ${u})`,"css-vars"===i&&(l[c(n,o)]=a)}else l[o]=a;else"css-vars"===i&&(l[c(n,o)]=a)}}),o.htmlStyle=l,o})(e,m,d,c,u))),l&&oD(o,l);let g=h.map(e=>ox(e.theme,n));i=oK(h,f,g,d,c,"fg",u),r=oK(h,f,g,d,c,"bg",u),s=`shiki-themes ${f.map(e=>e.name).join(" ")}`,a=c?void 0:[i,r].join(";")}else if("theme"in n){let a=ox(n.theme,n);o=oH(e,t,n);let c=e.getTheme(n.theme);r=ok(c.bg,a),i=ok(c.fg,a),s=c.name,l=oR(o)}else throw new ig("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:i,bg:r,themeName:s,rootStyle:a,grammarState:l}}function oK(e,t,n,r,i,o,s){return e.map((a,l)=>{let c=ok(t[l][o],n[l])||"inherit",d=`${r+a.color}${"bg"===o?"-bg":""}:${c}`;if(0===l&&i){if(i===oM&&e.length>1){let r=e.findIndex(e=>"light"===e.color),i=e.findIndex(e=>"dark"===e.color);if(-1===r||-1===i)throw new ig('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let s=ok(t[r][o],n[r])||"inherit",a=ok(t[i][o],n[i])||"inherit";return`light-dark(${s}, ${a});${d}`}return c}return"css-vars"===s?d:null}).filter(e=>!!e).join(";")}function oJ(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>oJ(e,t,n),codeToTokens:(t,n)=>oq(e,t,n)}){let i=t;for(let e of oj(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:o,fg:s,bg:a,themeName:l,rootStyle:c,grammarState:d}=oq(e,i,n),{mergeWhitespaces:u=!0,mergeSameStyleTokens:h=!1}=n;!0===u?o=o.map(e=>{let t,n=[],r="";return e.forEach((i,o)=>{let s=!(i.fontStyle&&(i.fontStyle&iT.Underline||i.fontStyle&iT.Strikethrough));s&&i.content.match(/^\s+$/)&&e[o+1]?(void 0===t&&(t=i.offset),r+=i.content):r?(s?n.push({...i,offset:t,content:r+i.content}):n.push({content:r,offset:t},i),t=void 0,r=""):n.push(i)}),n}):"never"===u&&(o=o.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let o=[{...e,offset:e.offset+n.length,content:r}];return n&&o.unshift({content:n,offset:e.offset}),i&&o.push({content:i,offset:e.offset+n.length+r.length}),o}))),h&&(o=o.map(e=>{let t=[];for(let n of e){if(0===t.length){t.push({...n});continue}let e=t[t.length-1],r=oL(e.htmlStyle||oI(e)),i=oL(n.htmlStyle||oI(n)),o=e.fontStyle&&(e.fontStyle&iT.Underline||e.fontStyle&iT.Strikethrough),s=n.fontStyle&&(n.fontStyle&iT.Underline||n.fontStyle&iT.Strikethrough);o||s||r!==i?t.push({...n}):e.content+=n.content}return t}));let p={...r,get source(){return i}};for(let e of oj(n))o=e.tokens?.call(p,o)||o;return function(e,t,n,r=oR(e)){let i=oj(t),o=[],s={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};for(let[e,n]of(!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(c.tabindex=l.toString()),Object.entries(t.meta||{})))e.startsWith("_")||(c[e]=n);let d={type:"element",tagName:"pre",properties:c,children:[],data:t.data},u={type:"element",tagName:"code",properties:{},children:o},h=[],p={...n,structure:a,addClassToHast:oA,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return s},get pre(){return d},get code(){return u},get lines(){return h}};if(e.forEach((e,t)=>{t&&("inline"===a?s.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&o.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(let o of e){let e={type:"element",tagName:"span",properties:{...o.htmlAttrs},children:[{type:"text",value:o.content}]},l=oL(o.htmlStyle||oI(o));for(let s of(l&&(e.properties.style=l),i))e=s?.span?.call(p,e,t+1,r,n,o)||e;"inline"===a?s.children.push(e):"classic"===a&&n.children.push(e),r+=o.content.length}if("classic"===a){for(let e of i)n=e?.line?.call(p,n,t+1)||n;h.push(n),o.push(n)}else"inline"===a&&h.push(n)}),"classic"===a){for(let e of i)u=e?.code?.call(p,u)||u;for(let e of(d.children.push(u),i))d=e?.pre?.call(p,d)||d;s.children.push(d)}else if("inline"===a){let e=[],t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let n of s.children)"element"===n.type&&"br"===n.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):("element"===n.type||"text"===n.type)&&t.children.push(n);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;s.children=[];for(let e=0;e<n.children.length;e++){e>0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]});let t=n.children[e];"element"===t.type&&s.children.push(...t.children)}}let f=s;for(let e of i)f=e?.root?.call(p,f)||f;return r&&oD(f,r),f}(o,{...n,fg:s,bg:a,themeName:l,rootStyle:!1!==n.rootStyle&&(n.rootStyle??c)},p,d)}let oX="__shiki_resolved";function oY(e){if(e?.[oX])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?"#333333":"#bbbbbb"),n||(n="light"===t.type?"#fffffe":"#1e1e1e"),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,o=new Map;function s(e){if(o.has(e))return o.get(e);i+=1;let n=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?s(e):(o.set(e,n),n)}for(let e of(t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=s(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=s(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i}),Object.keys(t.colors||{})))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){let n=s(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,oX,{enumerable:!1,writable:!1,value:!0}),t}async function oQ(e){return Array.from(new Set((await Promise.all(e.filter(e=>!oC(e)).map(async e=>await ow(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function oZ(e){return(await Promise.all(e.map(async e=>oN(e)?null:oY(await ow(e))))).filter(e=>!!e)}class o0 extends Error{constructor(e){super(e),this.name="ShikiError"}}function o1(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new o0(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class o2 extends ov{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=oY(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=iN.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=o1(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>{if(!t)return!1;let r=t.embeddedLanguages||t.embeddedLangs;return r?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new o0(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}}class o8{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(".");n=[...n,...this._injections.get(r)||[]]}return n}}let o5=0;async function o6(e){e.engine||function(e,t=3){if(!(t>3))if(1)console.trace(`[SHIKI DEPRECATE]: ${e}`);else throw Error(`[SHIKI DEPRECATE]: ${e}`)}("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([oZ(e.themes||[]),oQ(e.langs||[]),e.engine]);return function(e){let t;o5+=1,!1!==e.warnings&&o5>=10&&o5%10==0&&console.warn(`[Shiki] ${o5} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let n=!1;if(!e.engine)throw new o0("`engine` option is required for synchronous mode");let r=(e.langs||[]).flat(1),i=(e.themes||[]).flat(1).map(oY),o=new o2(new o8(e.engine,r),i,r,e.langAlias);function s(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};c();let t=o.getTheme(e);if(!t)throw new o0(`Theme \`${e}\` not found, you may need to load it first`);return t}function a(...e){c(),o.loadLanguages(e.flat(1))}function l(...e){for(let t of(c(),e.flat(1)))o.loadTheme(t)}function c(){if(n)throw new o0("Shiki instance has been disposed")}function d(){n||(n=!0,o.dispose(),o5-=1)}return{setTheme:function(e){c();let n=s(e);return t!==e&&(o.setTheme(n),t=e),{theme:n,colorMap:o.getColorMap()}},getTheme:s,getLanguage:function(e){c();let t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new o0(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return c(),o.getLoadedThemes()},getLoadedLanguages:function(){return c(),o.getLoadedLanguages()},resolveLangAlias:function(t){return o1(t,e.langAlias)},loadLanguage:async function(...e){return a(await oQ(e))},loadLanguageSync:a,loadTheme:async function(...e){return c(),l(await oZ(e))},loadThemeSync:l,dispose:d,[Symbol.dispose]:d}}({...e,themes:t,langs:n,engine:r})}async function o3(e){let t=await o6(e);return{getLastGrammarState:(...e)=>(function(...e){if(2===e.length)return oR(e[1]);let[t,n,r={}]=e,{lang:i="text",theme:o=t.getLoadedThemes()[0]}=r;if(oS(i)||oN(o))throw new ig("Plain language does not have grammar state");if("ansi"===i)throw new ig("ANSI language does not have grammar state");let{theme:s,colorMap:a}=t.setTheme(o),l=t.getLanguage(i);return new oP(oW(n,l,s,a,r).stateStack,l.name,s.name)})(t,...e),codeToTokensBase:(e,n)=>oH(t,e,n),codeToTokensWithThemes:(e,n)=>oG(t,e,n),codeToTokens:(e,n)=>oq(t,e,n),codeToHast:(e,n)=>oJ(t,e,n),codeToHtml:(e,n)=>(function(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>oJ(e,t,n),codeToTokens:(t,n)=>oq(e,t,n)},i=rU(oJ(e,t,n,r));for(let e of oj(n))i=e.postprocess?.call(r,i,n)||i;return i})(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}async function o4(e){if(it())throw Error(`resolveTheme("${e}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=id.get(e);if(null!=t)return t;try{let t=iu.get(e)??im[e];if(null==t)throw Error(`resolveTheme: No valid loader for ${e}`);let n=t().then(t=>{var n,r;let i;return n=e,r="default"in t?t.default:t,i=ic.get(n),null!=i?i:(r=oY(r),ic.set(n,r),r)});id.set(e,n);let r=await n;if(r.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${r.name}`);return ic.set(r.name,r),r}finally{id.delete(e)}}function o7(e){return ic.get(e)??o4(e)}function o9(e,t){iu.has(e)?console.error("SharedHighlight.registerCustomTheme: theme name already registered",e):iu.set(e,t)}var se=e.i(61904);class st extends Error{constructor(e){super(e),this.name="ShikiError"}}function sn(){return"u">typeof performance?performance.now():Date.now()}let sr=(e,t)=>e+(t-e%t)%t;async function si(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}let o="u">typeof TextDecoder?new TextDecoder("utf8"):void 0;function s(e,t){return e?function(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&o)return o.decode(e.subarray(t,i));let s="";for(;t<i;){let n=e[t++];if(!(128&n)){s+=String.fromCharCode(n);continue}let r=63&e[t++];if((224&n)==192){s+=String.fromCharCode((31&n)<<6|r);continue}let i=63&e[t++];if((n=(240&n)==224?(15&n)<<12|r<<6|i:(7&n)<<18|r<<12|i<<6|63&e[t++])<65536)s+=String.fromCharCode(n);else{let e=n-65536;s+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return s}(r.HEAPU8,e,t):""}let a={emscripten_get_now:sn,emscripten_memcpy_big:function(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){let o=r.HEAPU8.length;if((e>>>=0)>0x80000000)return!1;for(let r=1;r<=4;r*=2){let s=o*(1+.2/r);if(s=Math.min(s,e+0x6000000),function(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}(Math.min(0x80000000,sr(Math.max(e,s),65536))))return!0}return!1},fd_write:()=>0};async function l(){let n=await e({env:a,wasi_snapshot_preview1:a});i((t=n.memory).buffer),Object.assign(r,n),r.UTF8ToString=s}return await l(),r}var so=Object.defineProperty,ss=(e,t,n)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?so(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n};let sa=null;class sl{constructor(e){ss(this,"utf16Length"),ss(this,"utf8Length"),ss(this,"utf16Value"),ss(this,"utf8Value"),ss(this,"utf16OffsetToUtf8"),ss(this,"utf8OffsetToUtf16");const t=e.length,n=sl._utf8ByteLength(e),r=n!==t,i=r?new Uint32Array(t+1):null;r&&(i[t]=n);const o=r?new Uint32Array(n+1):null;r&&(o[n]=t);const s=new Uint8Array(n);let a=0;for(let n=0;n<t;n++){const l=e.charCodeAt(n);let c=l,d=!1;if(l>=55296&&l<=56319&&n+1<t){const t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(c=(l-55296<<10)+65536|t-56320,d=!0)}r&&(i[n]=a,d&&(i[n+1]=a),c<=127?o[a+0]=n:c<=2047?(o[a+0]=n,o[a+1]=n):c<=65535?(o[a+0]=n,o[a+1]=n,o[a+2]=n):(o[a+0]=n,o[a+1]=n,o[a+2]=n,o[a+3]=n)),c<=127?s[a++]=c:(c<=2047?s[a++]=192|(1984&c)>>>6:(c<=65535?s[a++]=224|(61440&c)>>>12:(s[a++]=240|(1835008&c)>>>18,s[a++]=128|(258048&c)>>>12),s[a++]=128|(4032&c)>>>6),s[a++]=128|(63&c)>>>0),d&&n++}this.utf16Length=t,this.utf8Length=n,this.utf16Value=e,this.utf8Value=s,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),o=i,s=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(o=(i-55296<<10)+65536|t-56320,s=!0)}o<=127?t+=1:o<=2047?t+=2:o<=65535?t+=3:t+=4,s&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}let sc=class e{constructor(t){if(ss(this,"id",++e.LAST_ID),ss(this,"_onigBinding"),ss(this,"content"),ss(this,"utf16Length"),ss(this,"utf8Length"),ss(this,"utf16OffsetToUtf8"),ss(this,"utf8OffsetToUtf16"),ss(this,"ptr"),!sa)throw new st("Must invoke loadWasm first.");this._onigBinding=sa,this.content=t;const n=new sl(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||(e._sharedPtr=sa.omalloc(1e4)),e._sharedPtrInUse=!0,sa.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(sa)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};ss(sc,"LAST_ID",0),ss(sc,"_sharedPtr",0),ss(sc,"_sharedPtrInUse",!1);class sd{constructor(e){if(ss(this,"_onigBinding"),ss(this,"_ptr"),!sa)throw new st("Must invoke loadWasm first.");const t=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=new sl(e[r]);t[r]=i.createString(sa),n[r]=i.utf8Length}const r=sa.omalloc(4*e.length);sa.HEAPU32.set(t,r/4);const i=sa.omalloc(4*e.length);sa.HEAPU32.set(n,i/4);const o=sa.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)sa.ofree(t[n]);sa.ofree(i),sa.ofree(r),0===o&&function(e){throw new st(e.UTF8ToString(e.getLastOnigError()))}(sa),this._onigBinding=sa,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if("number"==typeof n&&(r=n),"string"==typeof e){e=new sc(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(0===o)return null;let s=i.HEAPU32,a=o/4,l=s[a++],c=s[a++],d=[];for(let t=0;t<c;t++){let n=e.convertUtf8OffsetToUtf16(s[a++]),r=e.convertUtf8OffsetToUtf16(s[a++]);d[t]={start:n,end:r,length:r-n}}return{index:l,captureIndices:d}}}function su(e){return t=>WebAssembly.instantiate(e,t)}async function sh(e){return e&&await (n||(n=async function(){sa=await si(async t=>{let n=e;if("function"==typeof(n=await n)&&(n=await n(t)),"function"==typeof n&&(n=await n(t)),"function"==typeof n.instantiator)n=await n.instantiator(t);else if("function"==typeof n.default)n=await n.default(t);else{var r,i,o,s;if(void 0!==n.data&&(n=n.data),r=n,"u">typeof Response&&r instanceof Response){n="function"==typeof WebAssembly.instantiateStreaming?await (o=n,e=>WebAssembly.instantiateStreaming(o,e))(t):await (s=n,async e=>{let t=await s.arrayBuffer();return WebAssembly.instantiate(t,e)})(t)}else(i=n,"u">typeof ArrayBuffer&&(i instanceof ArrayBuffer||ArrayBuffer.isView(i))||void 0!==se.Buffer&&se.Buffer.isBuffer?.(i)||"u">typeof SharedArrayBuffer&&i instanceof SharedArrayBuffer||"u">typeof Uint32Array&&i instanceof Uint32Array||n instanceof WebAssembly.Module)?n=await su(n)(t):"default"in n&&n.default instanceof WebAssembly.Module&&(n=await su(n.default)(t))}return"instance"in n&&(n=n.instance),"exports"in n&&(n=n.exports),n})}())),{createScanner:e=>new sd(e.map(e=>"string"==typeof e?e:e.source)),createString:e=>new sc(e)}}let sp=(o=(b={langs:is,themes:im,engine:()=>sh(e.A(62631))}).langs,s=b.themes,a=b.engine,async function(e){function t(t){if("string"==typeof t){if(oC(t=e.langAlias?.[t]||t))return[];let n=o[t];if(!n)throw new ig(`Language \`${t}\` is not included in this bundle. You may want to load it from external source.`);return n}return t}function n(e){if(oN(e))return"none";if("string"==typeof e){let t=s[e];if(!t)throw new ig(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let r=(e.themes??[]).map(e=>n(e)),i=(e.langs??[]).map(e=>t(e)),l=await o3({engine:e.engine??a(),...e,themes:r,langs:i});return{...l,loadLanguage:(...e)=>l.loadLanguage(...e.map(t)),loadTheme:(...e)=>l.loadTheme(...e.map(n)),getBundledLanguages:()=>o,getBundledThemes:()=>s}});function sf(e){if(1!=[...e].length)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}let sm=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),sg=String.raw;function sy(e,t){if(null==e)throw Error(t??"Value expected");return e}let sv=sg`\[\^?`,sb=`c.? | C(?:-.?)?|${sg`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${sg`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${sg`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${sg`o\{[^\}]*\}?`}|${sg`\d{1,3}`}`,sx=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,sk=RegExp(sg`
|
|
54
|
-
\\ (?:
|
|
55
|
-
${sb}
|
|
56
|
-
| [gk]<[^>]*>?
|
|
57
|
-
| [gk]'[^']*'?
|
|
58
|
-
| .
|
|
59
|
-
)
|
|
60
|
-
| \( (?:
|
|
61
|
-
\? (?:
|
|
62
|
-
[:=!>({]
|
|
63
|
-
| <[=!]
|
|
64
|
-
| <[^>]*>
|
|
65
|
-
| '[^']*'
|
|
66
|
-
| ~\|?
|
|
67
|
-
| #(?:[^)\\]|\\.?)*
|
|
68
|
-
| [^:)]*[:)]
|
|
69
|
-
)?
|
|
70
|
-
| \*[^\)]*\)?
|
|
71
|
-
)?
|
|
72
|
-
| (?:${sx.source})+
|
|
73
|
-
| ${sv}
|
|
74
|
-
| .
|
|
75
|
-
`.replace(/\s+/g,""),"gsu"),sw=RegExp(sg`
|
|
76
|
-
\\ (?:
|
|
77
|
-
${sb}
|
|
78
|
-
| .
|
|
79
|
-
)
|
|
80
|
-
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
81
|
-
| ${sv}
|
|
82
|
-
| &&
|
|
83
|
-
| .
|
|
84
|
-
`.replace(/\s+/g,""),"gsu");function sS(e,{inCharClass:t}){let n=e[1];if("c"===n||"C"===n){var r,i=e;let t="c"===i[1]?i[2]:i[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${i}"`);return sA(sf(t.toUpperCase())-64,i)}if("dDhHsSwW".includes(n)){let t;return sM({d:"digit",h:"hex",s:"space",w:"word"}[t=(r=e)[1].toLowerCase()],r,{negate:r[1]!==t})}if(e.startsWith(sg`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return sM("property",e,{value:r,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return sA(sf(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return sA(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);return parseInt("{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),16)}(e),e);if(sO.has(n))return sA(sO.get(n),e);if(/\d/.test(n))return{type:"EscapedNumber",inCharClass:t,raw:e};if("\\"===e)throw Error(sg`Incomplete escape "\"`);if("M"===n)throw Error(`Unsupported meta "${e}"`);if(2==[...e].length)return sA(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function sC(e,t){return{type:"Assertion",kind:e,raw:t}}function sN(e){return{type:"Backreference",raw:e}}function sA(e,t){return{type:"Character",value:e,raw:t}}function sE(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function sM(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function sT(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:sy(n.flags),raw:t}}function sI(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}let sL=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),sO=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function sD(e){let t=null,n,r;if("{"===e[0]){let{minStr:i,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups;if(+i>1e5||o&&+o>1e5)throw Error("Quantifier value unsupported in Oniguruma");if((n=+i)>(r=void 0===o?+i:""===o?1/0:+o)&&(t="possessive",[n,r]=[r,n]),e.endsWith("?")){if("possessive"===t)throw Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=+("+"===e[0]),r="?"===e[0]?1:1/0,t="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return{type:"Quantifier",kind:t,min:n,max:r,raw:e}}function sR(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function sP(e,t){if(!Array.isArray(e.body))throw Error("Expected node with body array");if(1!==e.body.length)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}let s_=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function sj(e,t={}){var n;let r={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},i=function(e,t={}){let n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw Error("String expected as pattern");let r=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!"imxDPSWy".includes(r))throw Error(`Invalid flag "${r}"`);if("y"===r){if(!/^y{[gw]}/.test(e.slice(n)))throw Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3;continue}t[({i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"})[r]]=!0}return t}(n.flags),i=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX:()=>i.at(-1),numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},s=[],a;for(sk.lastIndex=0;a=sk.exec(e);){let t=function(e,t,n,r){let[i,o]=n;if("["===n||"[^"===n){let e=function(e,t,n){let r=[sE("^"===t[1],t)],i=1,o;for(sw.lastIndex=n;o=sw.exec(e);){let e=o[0];if("["===e[0]&&":"!==e[1])i++,r.push(sE("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(sA(93,e));else if(i--,r.push({type:"CharacterClassClose",raw:e}),!i)break}else{let t=function(e){if("\\"===e[0])return sS(e,{inCharClass:!0});if("["===e[0]){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!sm.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return sM("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?{type:"CharacterClassHyphen",raw:e}:"&&"===e?{type:"CharacterClassIntersector",raw:e}:sA(sf(e),e)}(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:sw.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===i){if("AbBGyYzZ".includes(o))return{token:sC(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:{type:"Subroutine",raw:n}}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:sN(n)}}if("K"===o)return{token:sT("keep",n)};if("N"===o||"R"===o)return{token:sM("newline",n,{negate:"N"===o})};if("O"===o)return{token:sM("any",n)};if("X"===o)return{token:sM("text_segment",n)};let e=sS(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===i){if("*"===o)return{token:function(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(""===r)throw Error(`Named callout tag with empty value not allowed "${e}"`);let o=i?i.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[s,a,l]=o,c=sL.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw Error(`Named callout allows only one argument "${o}"`);if("string"==typeof s)throw Error(`Named callout argument must be a number "${s}"`);break;case"max":if(!o.length||o.length>2)throw Error(`Named callout must have one or two arguments "${o}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if(2===o.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(o.length>1)throw Error(`Named callout allows only one argument "${o}"`);if(1===o.length&&("number"==typeof s||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${s}"`);break;case"cmp":if(3!==o.length)throw Error(`Named callout must have three arguments "${o}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw Error(`Named callout argument one must be a tag or number "${s}"`);if("number"==typeof a||!/^(?:[<>!=]=|[<>])$/.test(a))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${c}"`)}return{type:"NamedCallout",kind:c,tag:r??null,arguments:i?.split(",")??null,raw:e}}(n)};if("(?{"===n)throw Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[r])throw Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:function(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";let i=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=sR(n),s=sR(r),a={};if(o&&(a.enable=o),s&&(a.disable=s),e.endsWith(")"))return t.replaceCurrentModX(i),sT("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(i),t.numOpenGroups++,sI("group",e,{...(o||s)&&{flags:a}});throw Error(`Unexpected flag modifier "${e}"`)}(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:sI("group",n)};if("(?>"===n)return{token:sI("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:sI("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:sI("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw Error(`Unsupported absence function kind "${n}"`);return{token:sI("absence_repeater",n)}}throw"(?("===n?Error(`Unsupported conditional "${n}"`):Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error('Unmatched ")"');return{token:{type:"GroupClose",raw:n}}}if(e.getCurrentModX()){if("#"===n){let e=t.indexOf(`
|
|
85
|
-
`,r);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return"."===n?{token:sM("dot",n)}:"^"===n||"$"===n?{token:sC(e.singleline?({"^":sg`\A`,$:sg`\Z`})[n]:n,n)}:"|"===n?{token:{type:"Alternator",raw:n}}:sx.test(n)?{tokens:function(e){let t,n=[],r=RegExp(sx,"gy");for(;t=r.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(t){let{min:i,max:o}=t.groups;if(+i>+o&&e.endsWith("?")){r.lastIndex--,n.push(sD(e.slice(0,-1)));continue}}}n.push(sD(e))}return n}(n)}:{token:sA(sf(n),n)}}(o,e,a[0],sk.lastIndex);t.tokens?s.push(...t.tokens):t.token&&s.push(t.token),void 0!==t.lastIndex&&(sk.lastIndex=t.lastIndex)}let l=[],c=0;s.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++c:"("===e.raw&&l.push(e)}),c||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let d=c||l.length;return{tokens:s.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&("0"!==i&&1===i.length||"0"!==i[0]&&+i<=t))return[sN(n)];let o=[],s=i.match(/^[0-7]+|\d/g);for(let e=0;e<s.length;e++){let t,r=s[e];if(0===e&&"8"!==r&&"9"!==r){if((t=parseInt(r,8))>127)throw Error(sg`Octal encoded byte above 177 unsupported "${n}"`)}else t=sf(r);o.push(sA(t,(0===e?"\\":"")+r))}return o}(e,d):e).flat(),flags:r}}(e,{flags:r.flags,rules:{captureGroup:r.rules.captureGroup,singleline:r.rules.singleline}}),o=(e,t)=>{let n=i.tokens[s.nextIndex];switch(s.parent=e,s.nextIndex++,n.type){case"Alternator":return sB();case"Assertion":return function({kind:e}){return sz(sy({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===sg`\B`||e===sg`\Y`})}(n);case"Backreference":return function({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,o=!1;if(n>i)if(t.skipBackrefValidation)o=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,s$(r?i+1-n:n,{orphan:o})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return s$(r)}return i(+r)}(n,s);case"Character":return sU(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){let{tokens:r,walk:i}=t,o=t.parent,s=o.body.at(-1),a=r[t.nextIndex];if(!n.isCheckingRangeEnd&&s&&"CharacterClass"!==s.type&&"CharacterClassRange"!==s.type&&a&&"CharacterClassOpen"!==a.type&&"CharacterClassClose"!==a.type&&"CharacterClassIntersector"!==a.type){let e=i(o,{...n,isCheckingRangeEnd:!0});if("Character"===s.type&&"Character"===e.type)return o.body.pop(),function(e,t){if(t.value<e.value)throw Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(s,e);throw Error("Invalid character class range")}return sU(sf("-"))}(0,s,t);case"CharacterClassOpen":return function({negate:e},t,n){let{tokens:r,walk:i}=t,o=r[t.nextIndex],s=[sH()],a=s1(o);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)s.push(sH()),t.nextIndex++;else{let e=s.at(-1);e.body.push(i(e,n))}a=s1(r[t.nextIndex],o)}let l=sH({negate:e});return 1===s.length?l.body=s[0].body:(l.kind="intersection",l.body=s.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(n,s,t);case"CharacterSet":return function({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:o,unicodePropertyMap:s}=r;if("property"===e){let r=s0(n);if(!sm.has(r)||s?.has(r))return sJ(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:o,unicodePropertyMap:s});e="posix",n=r}return"posix"===e?function(e,t){let n=!!t?.negate;if(!sm.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):sW(e,{negate:t})}(n,s);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:sy(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){var r,i;let{tokens:o,capturingGroups:s,namedGroupsByName:a,skipLookbehindValidation:l,walk:c}=t,d=function({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case"absence_repeater":var o="repeater";!1;return{type:"AbsenceFunction",kind:o,body:sX(void 0)};case"atomic":return sV({atomic:!0});case"capturing":return sF(i,{name:n});case"group":return sV({flags:e});case"lookahead":case"lookbehind":return sG({behind:"lookbehind"===t,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}(e),u="AbsenceFunction"===d.type,h=sZ(d),p=h&&d.negate;if("CapturingGroup"===d.type&&(s.push(d),d.name&&(r=d.name,i=[],a.has(r)||a.set(r,i),a.get(r)).push(d)),u&&n.isInAbsenceFunction)throw Error("Nested absence function not supported by Oniguruma");let f=s2(o[t.nextIndex]);for(;"GroupClose"!==f.type;){if("Alternator"===f.type)d.body.push(sB()),t.nextIndex++;else{let e=d.body.at(-1),t=c(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||u,isInLookbehind:n.isInLookbehind||h,isInNegLookbehind:n.isInNegLookbehind||p});if(e.body.push(t),(h||n.isInLookbehind)&&!l){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(p||n.isInNegLookbehind){if(sQ(t)||"CapturingGroup"===t.type)throw Error(e)}else if(sQ(t)||sZ(t)&&t.negate)throw Error(e)}}f=s2(o[t.nextIndex])}return t.nextIndex++,d}(n,s,t);case"NamedCallout":var r,o;return r=n.kind,o=n.tag,{type:"NamedCallout",kind:r,tag:o,arguments:n.arguments};case"Quantifier":return function({kind:e,min:t,max:n},r){let i=r.parent,o=i.body.at(-1);if(!o||!s_.has(o.type))throw Error("Quantifier requires a repeatable token");let s=sq(e,t,n,o);return i.body.pop(),s}(n,s);case"Subroutine":return function({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(o){let e=+o.groups.num,r=n.length;if(t.hasNumberedRef=!0,(i=({"":e,"+":r+e,"-":r+1-e})[o.groups.sign])<1)throw Error("Invalid subroutine number")}else"0"===i&&(i=0);let s=sK(i);return r.push(s),s}(n,s);default:throw Error(`Unexpected token type "${n.type}"`)}},s={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:r.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:r.skipBackrefValidation,skipLookbehindValidation:r.skipLookbehindValidation,skipPropertyNameValidation:r.skipPropertyNameValidation,subroutines:[],tokens:i.tokens,unicodePropertyMap:r.unicodePropertyMap,walk:o},a=(n={type:"Flags",...i.flags},{type:"Regex",body:sX(void 0),flags:n}),l=a.body[0];for(;s.nextIndex<i.tokens.length;){let e=o(l,{});"Alternative"===e.type?(a.body.push(e),l=e):l.body.push(e)}let{capturingGroups:c,hasNumberedRef:d,namedGroupsByName:u,subroutines:h}=s;if(d&&u.size&&!r.rules.captureGroup)throw Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:e}of h)if("number"==typeof e){if(e>c.length)throw Error("Subroutine uses a group number that's not defined");e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(sg`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(sg`Subroutine uses a group name that's not defined "\g<${e}>"`);return a}function sB(e){return{type:"Alternative",body:sY(e?.body)}}function sz(e,t){let n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function s$(e,t){let n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function sF(e,t){var n;let r={name:void 0,isSubroutined:!1,...t};if(void 0!==r.name&&(n=r.name,!/^[\p{Alpha}\p{Pc}][^)]*$/u.test(n)))throw Error(`Group name "${r.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...r.name&&{name:r.name},...r.isSubroutined&&{isSubroutined:r.isSubroutined},body:sX(t?.body)}}function sU(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?Error(`Invalid code point out of range "\\x{${t}}"`):Error(`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:"Character",value:e}}function sH(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:sY(e?.body)}}function sW(e,t){let n=!!t?.negate,r={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(r.negate=n),"text_segment"!==e&&("newline"!==e||n)||(r.variableLength=!0),r}function sV(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:sX(e?.body)}}function sG(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:sX(e?.body)}}function sq(e,t,n,r){if(t>n)throw Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function sK(e){return{type:"Subroutine",ref:e}}function sJ(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(s0(e));if(!r){if(n.normalizeUnknownPropertyNames)r=e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(sg`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function sX(e){if(void 0===e)e=[sB()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw Error("Invalid body; expected array of one or more Alternative nodes");return e}function sY(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error("Invalid body; expected array of nodes");return e}function sQ(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function sZ(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function s0(e){return e.replace(/[- _]+/g,"").toLowerCase()}function s1(e,t){return sy(e,`${t?.type==="Character"&&93===t.value?"Empty":"Unclosed"} character class`)}function s2(e){return sy(e,"Unclosed group")}function s8(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(o,s=null,a=null,l=null){let c=0,d=!1,u={node:o,parent:s,key:a,container:l,root:e,remove(){s5(l).splice(Math.max(0,s6(a)+c),1),c--,d=!0},removeAllNextSiblings:()=>s5(l).splice(s6(a)+1),removeAllPrevSiblings(){let e=s6(a)+c;return c-=e,s5(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;l?l[Math.max(0,s6(a)+c)]=e:sy(s,"Can't replace root node")[a]=e,n&&i(e,s,a,l),d=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(s5(l).splice(Math.max(0,s6(a)+c),1,...e),c+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],s,s6(a)+n+t,l)}d=!0},skip(){d=!0}},{type:h}=o,p=t["*"],f=t[h],m="function"==typeof p?p:p?.enter,g="function"==typeof f?f:f?.enter;if(m?.(u,n),g?.(u,n),!d)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":case"Alternative":case"CharacterClass":case"LookaroundAssertion":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":i(o.min,o,"min"),i(o.max,o,"max");break;case"Quantifier":i(o.body,o,"body");break;case"Regex":r(o.body,o),i(o.flags,o,"flags");break;default:throw Error(`Unexpected node type "${h}"`)}return f?.exit?.(u,n),p?.exit?.(u,n),c}return i(e),e}function s5(e){if(!Array.isArray(e))throw Error("Container expected");return e}function s6(e){if("number"!=typeof e)throw Error("Numeric key expected");return e}let s3=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`,s4=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function s7(e,t,n,r){let i=RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1],s=0,a="";for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===s4.DEFAULT==!s)){n instanceof Function?a+=n(t,{context:s?s4.CHAR_CLASS:s4.DEFAULT,negated:o[o.length-1]}):a+=n;continue}"["===e[0]?(s++,o.push("^"===e[1])):"]"===e&&s&&(s--,o.pop()),a+=e}return a}function s9(e,t,n){return!!function(e,t,n=0,r){let i;if(!RegExp(t,"su").test(e))return null;let o=RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");o.lastIndex=n;let s=0;for(;i=o.exec(e);){let{0:e,groups:{$skip:t}}=i;if(!t&&(!r||r===s4.DEFAULT==!s))return i;"["===e?s++:"]"===e&&s&&s--,o.lastIndex==i.index&&o.lastIndex++}return null}(e,t,0,n)}let ae=RegExp(String.raw`(?<noncapturingStart>${s3})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu"),at=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,an=RegExp(String.raw`
|
|
86
|
-
\\(?: \d+
|
|
87
|
-
| c[A-Za-z]
|
|
88
|
-
| [gk]<[^>]+>
|
|
89
|
-
| [pPu]\{[^\}]+\}
|
|
90
|
-
| u[A-Fa-f\d]{4}
|
|
91
|
-
| x[A-Fa-f\d]{2}
|
|
92
|
-
)
|
|
93
|
-
| \((?: \? (?: [:=!>]
|
|
94
|
-
| <(?:[=!]|[^>]+>)
|
|
95
|
-
| [A-Za-z\-]+:
|
|
96
|
-
| \(DEFINE\)
|
|
97
|
-
))?
|
|
98
|
-
| (?<qBase>${at})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
99
|
-
| \\?.
|
|
100
|
-
`.replace(/\s+/g,""),"gsu"),ar=String.raw,ai=ar`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,ao=ar`\(\?R=(?<rDepth>[^\)]+)\)|${ai}`,as=ar`\(\?<(?![=!])(?<captureName>[^>]+)>`,aa=ar`${as}|(?<unnamed>\()(?!\?)`,al=RegExp(ar`${as}|${ao}|\(\?|\\?.`,"gsu"),ac="Cannot use multiple overlapping recursions";function ad(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e*=1)<2||e>100)throw Error(t)}function au(e,t,n,r,i,o,s){let a=new Set;r&&s7(e+t,as,({groups:{captureName:e}})=>{a.add(e)},s4.DEFAULT);let l=[n,r?a:null,i,o,s];return`${e}${ah(`(?:${e}`,"forward",...l)}(?:)${ah(`${t})`,"backward",...l)}${t}`}function ah(e,t,n,r,i,o,s){let a=e=>"forward"===t?e+2:n-e+2-1,l="";for(let t=0;t<n;t++){let n=a(t);l+=s7(e,ar`${aa}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:a,backref:l}})=>{if(l&&r&&!r.has(l))return e;let c=`_$${n}`;if(a||t){let n=s+o.length+1;return o.push(n),function(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}(i,n),a?e:`(?<${t}${c}>`}return ar`\k<${l}${c}>`},s4.DEFAULT)}return l}function ap(e,t,n,r,i,o){if(e.size&&r){let s=0;s7(t,aa,()=>s++,s4.DEFAULT);let a=o-s+i,l=new Map;return e.forEach((e,t)=>{let i=(r-s*n)/n,o=s*n,c=t>a+s?t+r:t,d=[];for(let t of e)if(t<=a)d.push(t);else if(t>a+s+i)d.push(t+r);else if(t<=a+s)for(let e=0;e<=n;e++)d.push(t+s*e);else for(let e=0;e<=n;e++)d.push(t+o+i*e);l.set(c,d)}),l}return e}var af=String.fromCodePoint,am=String.raw,ag={},ay=globalThis.RegExp;function av(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ab(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}ag.flagGroups=(()=>{try{new ay("(?i:)")}catch{return!1}return!0})(),ag.unicodeSets=(()=>{try{new ay("[[]]","v")}catch{return!1}return!0})(),ag.bugFlagVLiteralHyphenIsRange=!!ag.unicodeSets&&(()=>{try{new ay(am`[\d\-a]`,"v")}catch{return!0}return!1})(),ag.bugNestedClassIgnoresNegation=ag.unicodeSets&&new ay("[[^a]]","v").test("a");var ax={ES2025:2025,ES2024:2024,ES2018:2018},ak={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function aw(e={}){if("[object Object]"!==({}).toString.call(e))throw Error("Unexpected options");if(void 0!==e.target&&!ak[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=ag.flagGroups?"ES2025":ag.unicodeSets?"ES2024":"ES2018"),t}var aS=new Set([af(304),af(305)]),aC=am`[\p{L}\p{M}\p{N}\p{Pc}]`;function aN(e){if(aS.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=aT.get(n),o=aE.get(n),s=aM.get(n);return 1==[...r].length&&t.add(r),s&&t.add(s),i&&t.add(i),t.add(n),o&&t.add(o),[...t]}var aA=new Map(`C Other
|
|
101
|
-
Cc Control cntrl
|
|
102
|
-
Cf Format
|
|
103
|
-
Cn Unassigned
|
|
104
|
-
Co Private_Use
|
|
105
|
-
Cs Surrogate
|
|
106
|
-
L Letter
|
|
107
|
-
LC Cased_Letter
|
|
108
|
-
Ll Lowercase_Letter
|
|
109
|
-
Lm Modifier_Letter
|
|
110
|
-
Lo Other_Letter
|
|
111
|
-
Lt Titlecase_Letter
|
|
112
|
-
Lu Uppercase_Letter
|
|
113
|
-
M Mark Combining_Mark
|
|
114
|
-
Mc Spacing_Mark
|
|
115
|
-
Me Enclosing_Mark
|
|
116
|
-
Mn Nonspacing_Mark
|
|
117
|
-
N Number
|
|
118
|
-
Nd Decimal_Number digit
|
|
119
|
-
Nl Letter_Number
|
|
120
|
-
No Other_Number
|
|
121
|
-
P Punctuation punct
|
|
122
|
-
Pc Connector_Punctuation
|
|
123
|
-
Pd Dash_Punctuation
|
|
124
|
-
Pe Close_Punctuation
|
|
125
|
-
Pf Final_Punctuation
|
|
126
|
-
Pi Initial_Punctuation
|
|
127
|
-
Po Other_Punctuation
|
|
128
|
-
Ps Open_Punctuation
|
|
129
|
-
S Symbol
|
|
130
|
-
Sc Currency_Symbol
|
|
131
|
-
Sk Modifier_Symbol
|
|
132
|
-
Sm Math_Symbol
|
|
133
|
-
So Other_Symbol
|
|
134
|
-
Z Separator
|
|
135
|
-
Zl Line_Separator
|
|
136
|
-
Zp Paragraph_Separator
|
|
137
|
-
Zs Space_Separator
|
|
138
|
-
ASCII
|
|
139
|
-
ASCII_Hex_Digit AHex
|
|
140
|
-
Alphabetic Alpha
|
|
141
|
-
Any
|
|
142
|
-
Assigned
|
|
143
|
-
Bidi_Control Bidi_C
|
|
144
|
-
Bidi_Mirrored Bidi_M
|
|
145
|
-
Case_Ignorable CI
|
|
146
|
-
Cased
|
|
147
|
-
Changes_When_Casefolded CWCF
|
|
148
|
-
Changes_When_Casemapped CWCM
|
|
149
|
-
Changes_When_Lowercased CWL
|
|
150
|
-
Changes_When_NFKC_Casefolded CWKCF
|
|
151
|
-
Changes_When_Titlecased CWT
|
|
152
|
-
Changes_When_Uppercased CWU
|
|
153
|
-
Dash
|
|
154
|
-
Default_Ignorable_Code_Point DI
|
|
155
|
-
Deprecated Dep
|
|
156
|
-
Diacritic Dia
|
|
157
|
-
Emoji
|
|
158
|
-
Emoji_Component EComp
|
|
159
|
-
Emoji_Modifier EMod
|
|
160
|
-
Emoji_Modifier_Base EBase
|
|
161
|
-
Emoji_Presentation EPres
|
|
162
|
-
Extended_Pictographic ExtPict
|
|
163
|
-
Extender Ext
|
|
164
|
-
Grapheme_Base Gr_Base
|
|
165
|
-
Grapheme_Extend Gr_Ext
|
|
166
|
-
Hex_Digit Hex
|
|
167
|
-
IDS_Binary_Operator IDSB
|
|
168
|
-
IDS_Trinary_Operator IDST
|
|
169
|
-
ID_Continue IDC
|
|
170
|
-
ID_Start IDS
|
|
171
|
-
Ideographic Ideo
|
|
172
|
-
Join_Control Join_C
|
|
173
|
-
Logical_Order_Exception LOE
|
|
174
|
-
Lowercase Lower
|
|
175
|
-
Math
|
|
176
|
-
Noncharacter_Code_Point NChar
|
|
177
|
-
Pattern_Syntax Pat_Syn
|
|
178
|
-
Pattern_White_Space Pat_WS
|
|
179
|
-
Quotation_Mark QMark
|
|
180
|
-
Radical
|
|
181
|
-
Regional_Indicator RI
|
|
182
|
-
Sentence_Terminal STerm
|
|
183
|
-
Soft_Dotted SD
|
|
184
|
-
Terminal_Punctuation Term
|
|
185
|
-
Unified_Ideograph UIdeo
|
|
186
|
-
Uppercase Upper
|
|
187
|
-
Variation_Selector VS
|
|
188
|
-
White_Space space
|
|
189
|
-
XID_Continue XIDC
|
|
190
|
-
XID_Start XIDS`.split(/\s/).map(e=>[s0(e),e])),aE=new Map([["s",af(383)],[af(383),"s"]]),aM=new Map([[af(223),af(7838)],[af(107),af(8490)],[af(229),af(8491)],[af(969),af(8486)]]),aT=new Map([aL(453),aL(456),aL(459),aL(498),...aO(8072,8079),...aO(8088,8095),...aO(8104,8111),aL(8124),aL(8140),aL(8188)]),aI=new Map([["alnum",am`[\p{Alpha}\p{Nd}]`],["alpha",am`\p{Alpha}`],["ascii",am`\p{ASCII}`],["blank",am`[\p{Zs}\t]`],["cntrl",am`\p{Cc}`],["digit",am`\p{Nd}`],["graph",am`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",am`\p{Lower}`],["print",am`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",am`[\p{P}\p{S}]`],["space",am`\p{space}`],["upper",am`\p{Upper}`],["word",am`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",am`\p{AHex}`]]);function aL(e){let t=af(e);return[t.toLowerCase(),t]}function aO(e,t){return(function(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n})(e,t).map(e=>aL(e))}var aD=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),aR={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if("repeater"===i){let e=sV();e.body[0].body.push(sG({negate:!0,body:r}),sJ("Any"));let i=sV();i.body[0].body.push(sq("greedy",0,1/0,e)),n(aG(i,t),{traverse:!0})}else throw Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>"flags"===e.kind);for(let e=n+1;e<t.body.length;e++)ab(r,t.body[e],[]).push(...i)},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=a$(t.get(e));if(n){let t=sV({flags:n});t.body[0].body=e.body,e.body=[aG(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:o,replaceWith:s},a){let{kind:l,negate:c}=e,{asciiWordBoundaries:d,avoidSubclass:u,supportedGNodes:h,wordIsAscii:p}=a;if("text_segment_boundary"===l)throw Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if("line_end"===l)s(aG(sG({body:[sB({body:[sz("string_end")]}),sB({body:[sU(10)]})]}),t));else if("line_start"===l)s(aG(aH(am`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(h.has(e))i.flags.sticky=!0,o();else{var f;let e,i=r[n-1];if(i&&((e=["Character","CharacterClass","CharacterSet"]).includes((f=i).type)||"Quantifier"===f.type&&f.min&&e.includes(f.body.type)))s(aG(sG({negate:!0}),t));else if(u)throw Error(am`Uses "\G" in a way that requires a subclass`);else s(aV(sz("string_start"),t)),a.strategy="clip_search"}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)s(aG(aH(am`(?=\n?\z)`),t));else if("word_boundary"===l){if(!p&&!d){let e=`(?:(?<=${aC})(?!${aC})|(?<!${aC})(?=${aC}))`,n=`(?:(?<=${aC})(?=${aC})|(?<!${aC})(?!${aC}))`;s(aG(aH(c?n:e),t))}}else throw Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||aU(n)||(e.ref=n=az(n,t))},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!aU(r)&&(e.name=r=az(r,t)),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){"intersection"===t.kind&&n(aG(sH({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:o,spaceIsAscii:s,wordIsAscii:a}){let{kind:l,negate:c,value:d}=e;if(o&&("digit"===l||"digit"===d))return void n(aV(sW("digit",{negate:c}),t));if(s&&("space"===l||"space"===d))return void n(aG(aW(aH("[ -\r ]"),c),t));if(a&&("word"===l||"word"===d))return void n(aV(sW("word",{negate:c}),t));if("any"===l)n(aV(sJ("Any"),t));else if("digit"===l)n(aV(sJ("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw Error(am`Use of "\X" requires non-strict accuracy`);let e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",o=am`\p{RI}{2}|${e}(?:\u200D${e})*`;n(aG(aH(am`(?>\r\n|${i?am`\p{RGI_Emoji}`:o}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(aV(sJ("AHex",{negate:c}),t));else if("newline"===l)n(aG(aH(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(i||"graph"!==d&&"print"!==d)n(aG(aW(aH(aI.get(d)),c),t));else{if("strict"===r)throw Error(`POSIX class "${d}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[d];c&&(e=`\0-${af(e.codePointAt(0)-1)}${af(e.codePointAt(2)+1)}-\u{10FFFF}`),n(aG(aH(`[${e}]`),t))}else if("property"===l)aA.has(s0(d))||(e.key="sc");else if("space"===l)n(aV(sJ("space",{negate:c}),t));else if("word"===l)n(aG(aW(aH(aC),c),t));else throw Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:o,removeAllNextSiblings:s}){let{kind:a,flags:l}=e;if("flags"===a)if(l.enable||l.disable){let e=sV({flags:l});e.body[0].body=s(),i(aG(e,t),{traverse:!0})}else r();else if("keep"===a){let e=n.body[0],r=1===n.body.length&&sP(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(am`Uses "\K" in a way that's unsupported`);let s=sG({behind:!0});s.body[0].body=o(),i(aG(s,t))}else throw Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,e.flags.enable||e.flags.disable||delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if("fail"===r)n(aG(sG({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=sV();t.body[0].body.push(e.body),e.body=aG(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=function e(t){let n=t.find(e=>"search_start"===e.kind||function(e,t){let n={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===n.negate||e.negate===n.negate)&&1===e.body.length&&sP(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!n)return null;if("search_start"===n.kind)return n;if("LookaroundAssertion"===n.type)return n.body[0].body[0];if("CapturingGroup"===n.type||"Group"===n.type){let t=[];for(let r of n.body){let n=e(r.body);if(!n)return null;Array.isArray(n)?t.push(...n):t.push(n)}return t}return null}(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if("strict"===t&&n&&r)throw Error(am`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||aU(n)||(e.ref=n=az(n,t))}},aP={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:o,multiplexCapturesToLeftByRef:s,openRefs:a,reffedNodesByReferencer:l}){let c=i.get(e);if(c&&a.has(e.number)){let r=aV(aB(e.number),t);l.set(r,a.get(e.number)),n(r);return}a.set(e.number,e),s.set(e.number,[]),e.name&&ab(s,e.name,[]);let d=s.get(e.name??e.number);for(let t=0;t<d.length;t++){let n=d[t];if(c===n.node||c&&c===n.origin||e===n.origin){d.splice(t,1);break}}if(s.get(e.number).push({node:e,origin:c}),e.name&&s.get(e.name).push({node:e,origin:c}),e.name){let t=ab(o,e.name,new Map),n=!1;if(c)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=av(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:o}=e;if(i){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==o&&n.number!==o););r.reffedNodesByReferencer.set(e,n);return}let s=r.subroutineRefMap.get(o),a=0===o,l=a?aB(0):function e(t,n,r,i){let o=Array.isArray(t)?[]:{};for(let[s,a]of Object.entries(t))"parent"===s?o.parent=Array.isArray(r)?i:r:a&&"object"==typeof a?o[s]=e(a,n,o,r):("type"===s&&"CapturingGroup"===a&&n.set(o,n.get(t)??t),o[s]=a);return o}(s,r.groupOriginByCopy,null),c=l;if(!a){var d,u;let e=a$(function(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}(s,e=>"Group"===e.type&&!!e.flags)),t=e?av(r.globalFlags,e):r.globalFlags;d=t,u=r.currentFlags,(d.dotAll!==u.dotAll||d.ignoreCase!==u.ignoreCase)&&(c=sV({flags:function({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},e||(n.disable.dotAll=!0),t||(n.disable.ignoreCase=!0)),n}(t)})).body[0].body.push(l)}n(aG(c,t),{traverse:!a})}},a_={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>(function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;for(let t of aF(n.parent)){if(t===n)break;if(t===e||function e(t,n){for(let r of aF(t)??[])if(r===n||e(r,n))return!0;return!1}(t,e))return!0}}while(n=n.parent)throw Error("Unexpected path")})(t,e));i.length?i.length>1?n(aG(sV({atomic:!0,body:i.reverse().map(e=>sB({body:[s$(e.number)]}))}),t)):e.ref=i[0].number:n(aG(sG({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=sF();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function aj(e){s8(e,{"*"({node:e,parent:t}){e.parent=t}})}function aB(e){let t=sK(e);return t.isRecursive=!0,t}function az(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function a$(e){let t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return(e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable)?n:null}function aF(e){if(!e)throw Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function aU(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function aH(e,t){let n=sj(e,{...t,unicodePropertyMap:aA}).body;return n.length>1||n[0].body.length>1?sV({body:n}):n[0].body[0]}function aW(e,t){return e.negate=t,e}function aV(e,t){return e.parent=t,e}function aG(e,t){return aj(e),e.parent=t,e}var aq={"*":{enter({node:e},t){if(a8(e)){let n=t.getCurrentModI();t.pushModI(e.flags?av({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){a8(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){a0(af(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),a1(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&aD.has(e.value)&&t.setHasCasedChar()}},aK={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?am`\B`:am`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){let{body:r,name:i,number:o}=e,s={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(s.hidden=!0,o>a.number&&(s.transferTo=a.number)),t.captureMap.set(o,s),`(${i?`?<${i}>`:""}${r.map(n).join("|")})`},Character({value:e},t){let n=af(e),r=a2(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&a0(n)){let e=aN(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:o}=e,{body:s}=e;if("intersection"===r&&!t.useFlagV)throw Error("Use of character class intersection requires min target ES2024");ag.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&s.some(a5)&&(s=[sU(45),...s.filter(e=>!a5(e))]);let a=()=>`[${i?"^":""}${s.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ag.bugNestedClassIgnoresNegation)&&!i){let t=s.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let r=sV(),i=r.body[0];return r.parent=o,i.parent=r,e.body=s=s.filter(e=>!t.includes(e)),s.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=sB({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=a();return t.inCharClass=!1,r}let l=s[0];if("union"===r&&!i&&l&&((!t.useFlagV||!t.verbose)&&"union"===o.kind&&!(ag.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&"intersection"===o.kind&&1===s.length&&"CharacterClassRange"!==l.type))return s.map(n).join("");if(!t.useFlagV&&"CharacterClass"===o.type)throw Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=a2(n,i),s=a2(r,i),a=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&(function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:null===r?n.push(t[e]):(n.push([r,t[e]]),r=null);return n})(a1(e)).forEach(e=>{a.add(Array.isArray(e)?`${a2(e[0],i)}-${a2(e[1],i)}`:a2(e,i))}),`${o}-${s}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if("dot"===e)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?".":"[^]":am`[^\n]`;if("digit"===e)return t?am`\D`:am`\d`;if("property"===e){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&aD.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?am`\P`:am`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?am`\W`:am`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:r},i,o){let s=i.currentFlags;n&&(i.currentFlags=av(s,n));let a=t.map(o).join("|"),l=i.verbose||1!==t.length||"Quantifier"===r.type||e||i.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let r="";if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${r}:`}(e,n,i.useFlagMods)}${a})`:a;return i.currentFlags=s,l},LookaroundAssertion({body:e,kind:t,negate:n},r,i){let o=`${"lookahead"===t?"":"<"}${n?"!":"="}`;return`(?${o}${e.map(i).join("|")})`},Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){return(n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?")+({greedy:"",lazy:"?",possessive:"+"})[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error("Unexpected non-recursive subroutine in transformed AST");let r=n.recursionLimit;return 0===t?`(?R=${r})`:am`\g<${t}&R=${r}>`}},aJ=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),aX=new Set(["-","\\","]","^","["]),aY=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),aQ=new Map([[9,am`\t`],[10,am`\n`],[11,am`\v`],[12,am`\f`],[13,am`\r`],[8232,am`\u2028`],[8233,am`\u2029`],[65279,am`\uFEFF`]]),aZ=/^\p{Cased}$/u;function a0(e){return aZ.test(e)}function a1(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,o=[];if(r<65&&(65535===i||i>=131071)||65536===r&&i>=131071)return o;for(let e=r;e<=i;e++){let t=af(e);if(!a0(t))continue;let s=aN(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(s.length&&(o.push(...s),n))break}return o}function a2(e,{escDigit:t,inCharClass:n,useFlagV:r}){var i;if(aQ.has(e))return aQ.get(e);if(e<32||e>126&&e<160||e>262143||t&&(i=e)>47&&i<58)return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let o=af(e);return((n?r?aY:aX:aJ).has(o)?"\\":"")+o}function a8({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function a5({type:e,value:t}){return"Character"===e&&45===t}var a6=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,r){const i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error("Cannot provide options when copying a regexp");super(t,n),this.#n=t.source,t instanceof e&&(this.#e=t.#e,this.#r=t.#r,this.#i=t.#i,this.rawOptions=t.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?"":t,n),this.#n=t,this.#e=function(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)ab(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if("clip_search"===this.#i&&n&&r){this.lastIndex=0;let e=this.#o(t.slice(r));return e&&(function(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#o(t)}#o(e){let t;this.#t.lastIndex=this.lastIndex;let n=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!n||!this.#e.size)return n;let r=[...n];n.length=1,this.hasIndices&&(t=[...n.indices],n.indices.length=1);let i=[0];for(let e=1;e<r.length;e++){let{hidden:o,transferTo:s}=this.#e.get(e)??{};if(o?i.push(null):(i.push(n.length),n.push(r[e]),this.hasIndices&&n.indices.push(t[e])),s&&void 0!==r[e]){let o=i[s];if(!o)throw Error(`Invalid capture transfer to "${o}"`);if(n[o]=r[e],this.hasIndices&&(n.indices[o]=t[e]),n.groups){this.#r||(this.#r=function(e){let t,n=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,r=new Map,i=0,o=0;for(;t=n.exec(e);){let{0:e,groups:{capture:n,name:s}}=t;"["===e?i++:i?"]"===e&&i--:n&&(o++,s&&r.set(o,s))}return r}(this.source));let i=this.#r.get(s);i&&(n.groups[i]=r[e],this.hasIndices&&(n.indices.groups[i]=t[e]))}}}return n}};class a3{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){let r="string"==typeof e?e:e.content,i=[];function o(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:0xffffffff,end:0xffffffff,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let s=n.exec(r);if(!s)continue;if(s.index===t)return o(e,s,0);i.push([e,s,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return o(t,n,r)}return null}}async function a4({themes:t,langs:n,preferredHighlighter:i="shiki-js"}){let o=!function(e=r){return null!=e&&"then"in e}(r??=sp({themes:[],langs:["text"],engine:"shiki-wasm"===i?sh(e.A(62631)):function(e={}){let t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>{let n;return(n=function(e,t){var n;let r,i,o,s,a=aw(t),l=(n=sj(e,{flags:a.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:a.rules.captureGroup,singleline:a.rules.singleline},skipBackrefValidation:a.rules.allowOrphanBackrefs,unicodePropertyMap:aA}),r={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...{accuracy:a.accuracy,asciiWordBoundaries:a.rules.asciiWordBoundaries,avoidSubclass:a.avoidSubclass,bestEffortTarget:a.target}},aj(n),i={accuracy:r.accuracy,asciiWordBoundaries:r.asciiWordBoundaries,avoidSubclass:r.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:ax[r.bestEffortTarget]>=ax.ES2024,passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:n.flags.digitIsAscii,spaceIsAscii:n.flags.spaceIsAscii,wordIsAscii:n.flags.wordIsAscii},s8(n,aR,i),s={currentFlags:o={dotAll:n.flags.dotAll,ignoreCase:n.flags.ignoreCase},prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:i.subroutineRefMap},s8(n,aP,s),s8(n,a_,{groupsByName:s.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:s.reffedNodesByReferencer}),n._originMap=s.groupOriginByCopy,n._strategy=i.strategy,n),c=function(e,t){let n=aw(t),r=ax[n.target]>=ax.ES2024,i=ax[n.target]>=ax.ES2025,o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw Error("Invalid recursionLimit; use 2-20");let s=null,a=null;if(!i){let t=[e.flags.ignoreCase];s8(e,aq,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?s=!0:a=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||s)&&!a)},c=e,d={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!i&&s&&a),useFlagMods:i,useFlagV:r,verbose:n.verbose};function u(e){return d.lastNode=c,c=e,(function(e,t){if(null==e)throw Error(t??"Value expected");return e})(aK[e.type],`Unexpected node type "${e.type}"`)(e,d,u)}let h={pattern:e.body.map(u).join("|"),flags:u(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],d.captureMap.forEach((e,t)=>{e.hidden&&h._hiddenCaptures.push(t),e.transferTo&&ab(h._captureTransfers,e.transferTo,[]).push(t)}),h}(l,a),d=function(e,t){let n,{hiddenCaptures:r,mode:i}={hiddenCaptures:[],mode:"plugin",...t},o=t?.captureTransfers??new Map;if(!RegExp(ao,"su").test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:r};if("plugin"===i&&s9(e,ar`\(\?\(DEFINE\)`,s4.DEFAULT))throw Error("DEFINE groups cannot be used with recursion");let s=[],a=s9(e,ar`\\[1-9]`,s4.DEFAULT),l=new Map,c=[],d=!1,u=0,h=0;for(al.lastIndex=0;n=al.exec(e);){let{0:t,groups:{captureName:p,rDepth:f,gRNameOrNum:m,gRDepth:g}}=n;if("["===t)u++;else if(u)"]"===t&&u--;else if(f){if(ad(f),d)throw Error(ac);if(a)throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let t=e.slice(0,n.index),l=e.slice(al.lastIndex);if(s9(l,ao,s4.DEFAULT))throw Error(ac);let c=f-1;e=au(t,l,c,!1,r,s,h),o=ap(o,t,c,s.length,0,h);break}else if(m){ad(g);let u=!1;for(let e of c)if(e.name===m||e.num===+m){if(u=!0,e.hasRecursedWithin)throw Error(ac);break}if(!u)throw Error(ar`Recursive \g cannot be used outside the referenced group "${"external"===i?m:ar`\g<${m}&R=${g}>`}"`);let p=l.get(m),f=function(e,t){let n,r=/\\?./gsu;r.lastIndex=t;let i=e.length,o=0,s=1;for(;n=r.exec(e);){let[e]=n;if("["===e)o++;else if(o)"]"===e&&o--;else if("("===e)s++;else if(")"===e&&!--s){i=n.index;break}}return e.slice(t,i)}(e,p);if(a&&s9(f,ar`${as}|\((?!\?)`,s4.DEFAULT))throw Error(`${"external"===i?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let y=e.slice(p,n.index),v=f.slice(y.length+t.length),b=s.length,x=g-1,k=au(y,v,x,!0,r,s,h);o=ap(o,y,x,s.length-b,b,h);let w=e.slice(0,p),S=e.slice(p+f.length);e=`${w}${k}${S}`,al.lastIndex+=k.length-t.length-y.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),d=!0}else if(p)h++,l.set(String(h),al.lastIndex),l.set(p,al.lastIndex),c.push({num:h,name:p});else if("("===t[0]){let e="("===t;e&&(h++,l.set(String(h),al.lastIndex)),c.push(e?{num:h}:{})}else")"===t&&c.pop()}return r.push(...s),{pattern:e,captureTransfers:o,hiddenCaptures:r}}(c.pattern,{captureTransfers:c._captureTransfers,hiddenCaptures:c._hiddenCaptures,mode:"external"}),u=function(e,t){let n,r=t?.hiddenCaptures??[],i=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:r};let o="(?:(?=(",s=[0],a=[],l=0,c=0,d=NaN;do{let t;n=!1;let u=0,h=0,p=!1;for(ae.lastIndex=Number.isNaN(d)?0:d+o.length;t=ae.exec(e);){let{0:f,index:m,groups:{capturingStart:g,noncapturingStart:y}}=t;if("["===f)u++;else if(u)"]"===f&&u--;else if("(?>"!==f||p){if(p&&y)h++;else if(g)p?h++:(l++,s.push(l+c));else if(")"===f&&p){if(!h){let t=l+ ++c;e=`${e.slice(0,d)}${o}${e.slice(d+3,m)}))<$$${t}>)${e.slice(m+1)}`,n=!0,a.push(t);for(let e=0;e<r.length;e++)r[e]>=t&&r[e]++;if(i.size){let e=new Map;i.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),i=e}break}h--}}else d=m,p=!0}}while(n)return r.push(...a),{pattern:e=s7(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>s.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${s[n]}`}return`\\${n}`},s4.DEFAULT),captureTransfers:i,hiddenCaptures:r}}(function(e){let t;if(!RegExp(`${at}\\+`).test(e))return{pattern:e};let n=[],r=null,i=null,o="",s=0;for(an.lastIndex=0;t=an.exec(e);){let{0:c,index:d,groups:{qBase:u,qMod:h,invalidQ:p}}=t;if("["===c)s||(i=d),s++;else if("]"===c)s?s--:i=null;else if(!s)if("+"===h&&o&&!o.startsWith("(")){if(p)throw Error(`Invalid quantifier "${c}"`);let t=-1;if(/^\{\d+\}$/.test(u)){var a,l;a=e,l=d+u.length,e=a.slice(0,l)+""+a.slice(l+h.length)}else{if(")"===o||"]"===o){let t=")"===o?r:i;if(null===t)throw Error(`Invalid unmatched "${o}"`);e=`${e.slice(0,t)}(?>${e.slice(t,d)}${u})${e.slice(d+c.length)}`}else e=`${e.slice(0,d-o.length)}(?>${o}${u})${e.slice(d+c.length)}`;t+=4}an.lastIndex+=t}else"("===c[0]?n.push(d):")"===c&&(r=n.length?n.pop():null);o=c}return{pattern:e}}(d.pattern).pattern,{captureTransfers:d.captureTransfers,hiddenCaptures:d.hiddenCaptures}),h={pattern:u.pattern,flags:`${a.hasIndices?"d":""}${a.global?"g":""}${c.flags}${c.options.disable.v?"u":"v"}`};if(a.avoidSubclass){if(a.lazyCompileLength!==1/0)throw Error("Lazy compilation requires subclass")}else{let e=u.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(u.captureTransfers),n=l._strategy,r=h.pattern.length>=a.lazyCompileLength;(e.length||t.length||n||r)&&(h.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...n&&{strategy:n},...r&&{lazyCompile:r}})}return h}(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...{target:t.target}})).options?new a6(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)},{createScanner:e=>new a3(e,t),createString:e=>({content:e})}}()}))?r:await r;r=o;let s=[];for(let e of n){if("text"===e||"ansi"===e)continue;let t=il(e);"then"in t?s.push(t):ie(t,o)}let a=[];for(let e of t){let t=o7(e);"then"in t?a.push(t):ip(t,r)}return(s.length>0||a.length>0)&&await Promise.all([Promise.all(s).then(e=>{ie(e,o)}),Promise.all(a).then(e=>{ip(e,o)})]),o}function a7(e=nc){let t=[];return"string"==typeof e?t.push(e):(t.push(e.dark),t.push(e.light)),t}function a9(e){for(let t of a7(e))if(!ih.has(t))return!1;return!0}function le(e,t){return null==e||null==t||"string"==typeof e||"string"==typeof t?e===t:e.dark===t.dark&&e.light===t.light}o9("pierre-dark",async()=>{let t=await e.A(96109);return{...t.default??t,name:"pierre-dark"}}),o9("pierre-light",async()=>{let t=await e.A(87087);return{...t.default??t,name:"pierre-light"}});let lt=new Map,ln={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function lr(e){if(lt.has(e))return lt.get(e)??"text";if(null!=ln[e])return ln[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(null!=t){if(lt.has(t[1]))return lt.get(t[1])??"text";if(null!=ln[t[1]])return ln[t[1]]??"text"}let n=e.match(/\.([^.]+)$/)?.[1]??"";return lt.has(n)?lt.get(n)??"text":ln[n]??"text"}function li(e){return nC({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function lo(e){return nC({tagName:"div",children:[nC({tagName:"span",children:[nS("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function ls(e){return nC({tagName:"div",children:[nN({name:"both"===e?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{"data-expand-button":"","data-expand-both":"both"===e?"":void 0,"data-expand-up":"up"===e?"":void 0,"data-expand-down":"down"===e?"":void 0}})}function la({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:o,isLastHunk:s}){let a=[];if("metadata"===e&&null!=t&&a.push(nC({tagName:"div",children:[nS(t)],properties:{"data-separator-wrapper":""}})),("line-info"===e||"line-info-basic"===e)&&null!=t){let e=[];null!=n&&(r?(o||e.push(ls("up")),s||e.push(ls("down"))):e.push(ls(o||s?o?"down":"up":"both"))),e.push(nC({tagName:"div",children:[nC({tagName:"span",children:[nS(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a.push(nC({tagName:"div",children:e,properties:{"data-separator-wrapper":"","data-separator-multi-button":e.length>2?"":void 0}}))}return"custom"===e&&null!=i&&a.push(nC({tagName:"slot",properties:{name:i}})),nC({tagName:"div",children:a,properties:{"data-separator":0===a.length?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function ll({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:o=1,callback:s}){let a={finalHunk:e.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;let e=a.unifiedCount>=n+r,i=a.splitCount>=n+r;return"unified"===t?e:"split"===t?i:e&&i},shouldSkip(e,r){if(!a.isWindowedHighlight)return!1;let i=a.unifiedCount+e<n,o=a.splitCount+r<n;return"unified"===t?i:"split"===t?o:i&&o},incrementCounts(e,n){("unified"===t||"both"===t)&&(a.unifiedCount+=e),("split"===t||"both"===t)&&(a.splitCount+=n)},isInWindow(e,n){if(!a.isWindowedHighlight)return!0;let r=a.isInUnifiedWindow(e),i=a.isInSplitWindow(n);return"unified"===t?r:"split"===t?i:r||i},isInUnifiedWindow:e=>!a.isWindowedHighlight||a.unifiedCount>=n-e&&a.unifiedCount<n+r,isInSplitWindow:e=>!a.isWindowedHighlight||a.splitCount>=n-e&&a.splitCount<n+r,emit:(e,n=!1)=>(n||("unified"===t?a.incrementCounts(1,0):"split"===t?a.incrementCounts(0,1):a.incrementCounts(1,1)),s(e)??!1)};e:for(let[n,r]of e.hunks.entries()){if(a.shouldBreak())break;let s=lc(e.isPartial,r.collapsedBefore,i,n,o),d=(()=>{if(r!==a.finalHunk||!function(e){let t=e.hunks.at(-1);return null!=t&&!e.isPartial&&0!==e.additionLines.length&&0!==e.deletionLines.length&&(t.additionLineIndex+t.additionCount<e.additionLines.length||t.deletionLineIndex+t.deletionCount<e.deletionLines.length)}(e))return;let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),n=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(t!==n)throw Error(`iterateOverDiff: trailing context mismatch (additions=${t}, deletions=${n}) for ${e.name}`);let s=Math.min(t,n);return lc(e.isPartial,s,i,e.hunks.length,o)})(),u=s.fromStart+s.fromEnd;function l(e,n){return null==d||d.collapsedLines<=0||d.fromStart+d.fromEnd>0?0:"unified"===t?e===r.unifiedLineStart+r.unifiedLineCount-1?d.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?d.collapsedLines:0}function c(){if(0===s.collapsedLines)return 0;let e=s.collapsedLines;return s.collapsedLines=0,e}if(a.shouldSkip(u,u))a.incrementCounts(u,u),c();else{let e=r.unifiedLineStart-s.rangeSize,t=r.splitLineStart-s.rangeSize,i=r.deletionLineIndex-s.rangeSize,o=r.additionLineIndex-s.rangeSize,l=r.deletionStart-s.rangeSize,d=r.additionStart-s.rangeSize,u=0;for(;u<s.fromStart;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:l+u,lineIndex:i+u,noEOFCR:!1,unifiedLineIndex:e+u,splitLineIndex:t+u},additionLine:{unifiedLineIndex:e+u,splitLineIndex:t+u,lineIndex:o+u,lineNumber:d+u,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);u++}for(e=r.unifiedLineStart-s.fromEnd,t=r.splitLineStart-s.fromEnd,i=r.deletionLineIndex-s.fromEnd,o=r.additionLineIndex-s.fromEnd,l=r.deletionStart-s.fromEnd,d=r.additionStart-s.fromEnd,u=0;u<s.fromEnd;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:n,hunk:r,collapsedBefore:c(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:l+u,lineIndex:i+u,noEOFCR:!1,unifiedLineIndex:e+u,splitLineIndex:t+u},additionLine:{unifiedLineIndex:e+u,splitLineIndex:t+u,lineIndex:o+u,lineNumber:d+u,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);u++}}let h=r.unifiedLineStart,p=r.splitLineStart,f=r.deletionLineIndex,m=r.additionLineIndex,g=r.deletionStart,y=r.additionStart,v=r.hunkContent.at(-1);for(let e of r.hunkContent){if(a.shouldBreak())break e;let i=e===v;if("context"===e.type){if(a.shouldSkip(e.lines,e.lines))a.incrementCounts(e.lines,e.lines),c();else{let t=0;for(;t<e.lines;){if(a.isInWindow(0,0)){let o=i&&t===e.lines-1,s=h+t,d=p+t;if(a.emit({hunkIndex:n,hunk:r,collapsedBefore:c(),collapsedAfter:l(s,d),type:"context",deletionLine:{lineNumber:g+t,lineIndex:f+t,noEOFCR:o&&r.noEOFCRDeletions,unifiedLineIndex:s,splitLineIndex:d},additionLine:{unifiedLineIndex:s,splitLineIndex:d,lineIndex:m+t,lineNumber:y+t,noEOFCR:o&&r.noEOFCRAdditions}}))break e}else a.incrementCounts(1,1);t++}}h+=e.lines,p+=e.lines,f+=e.lines,m+=e.lines,g+=e.lines,y+=e.lines}else{let o=Math.max(e.deletions,e.additions),s=e.deletions+e.additions;if(!a.shouldSkip(s,o))for(let[d,u]of function(e,t,n){if(!e.isWindowedHighlight)return[[0,"unified"===n?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r="unified"===n?"unified":"split",i=[];function o(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function s(e,n){if(null==e)return;let[o,s]="split"===r?e:"additions"===n?[e[0]+t.deletions,e[1]+t.deletions]:e;s>o&&i.push([o,s])}if("split"!==n&&(s(o(e.unifiedCount,t.deletions),"deletions"),s(o(e.unifiedCount+t.deletions,t.additions),"additions")),"unified"!==n&&(s(o(e.splitCount,t.deletions),"deletions"),s(o(e.splitCount,t.additions),"additions")),0===i.length)return i;i.sort((e,t)=>e[0]-t[0]);let a=[i[0]];for(let[e,t]of i.slice(1)){let n=a[a.length-1];e<=n[1]?n[1]=Math.max(n[1],t):a.push([e,t])}return a}(a,e,t))for(let v=d;v<u;v++){let d=l(h+v,"unified"===t?p+(v<e.deletions?v:v-e.deletions):p+v);if(a.emit(function({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:o,unifiedLineIndex:s,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:d,deletionLineNumber:u,content:h,isLastContent:p,unifiedCount:f,splitCount:m}){let g=o<h.deletions?s+o:void 0,y="unified"===i?o>=h.deletions?s+o:void 0:o<h.additions?s+h.deletions+o:void 0,v="unified"===i?a+(o<h.deletions?o:o-h.deletions):a+o,b=o<h.deletions?c+o:void 0,x=o<h.deletions?u+o:void 0,k="unified"===i?o>=h.deletions?l+(o-h.deletions):void 0:o<h.additions?l+o:void 0,w="unified"===i?o>=h.deletions?d+(o-h.deletions):void 0:o<h.additions?d+o:void 0,S="unified"===i?p&&o===h.deletions-1&&t.noEOFCRDeletions:p&&o===m-1&&t.noEOFCRDeletions,C="unified"===i?p&&o===f-1&&t.noEOFCRAdditions:p&&o===m-1&&t.noEOFCRAdditions,N=null!=b&&null!=x&&null!=g?{lineNumber:x,lineIndex:b,noEOFCR:S,unifiedLineIndex:g,splitLineIndex:v}:void 0,A=null!=k&&null!=w&&null!=y?{unifiedLineIndex:y,splitLineIndex:v,lineIndex:k,lineNumber:w,noEOFCR:C}:void 0;if(null==N&&null!=A)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:A};if(null!=N&&null==A)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:void 0};if(null==N||null==A)throw Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:A}}({hunkIndex:n,hunk:r,collapsedBefore:c(),collapsedAfter:d,diffStyle:t,index:v,unifiedLineIndex:h,splitLineIndex:p,additionLineIndex:m,deletionLineIndex:f,additionLineNumber:y,deletionLineNumber:g,content:e,isLastContent:i,unifiedCount:s,splitCount:o}),!0))break e}c(),a.incrementCounts(s,o),h+=s,p+=o,f+=e.deletions,m+=e.additions,g+=e.deletions,y+=e.additions}}if(null!=d){let{collapsedLines:t,fromStart:n,fromEnd:r}=d,i=n+r,o=0;for(;o<i;){if(a.shouldBreak())break e;if(a.isInWindow(0,0)){let n=o===i-1;if(a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:n?t:0,type:"context-expanded",deletionLine:{lineNumber:g+o,lineIndex:f+o,noEOFCR:!1,unifiedLineIndex:h+o,splitLineIndex:p+o},additionLine:{unifiedLineIndex:h+o,splitLineIndex:p+o,lineIndex:m+o,lineNumber:y+o,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);o++}}}}function lc(e,t,n,r,i){if(0===(t=Math.max(t,0))||e)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:Math.max(t,0)};if(!0===n||t<=i)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),t),a=Math.min(Math.max(o?.fromEnd??0,0),t),l=s+a,c=l>=t;return{fromStart:c?t:s,fromEnd:c?0:a,rangeSize:t,collapsedLines:Math.max(t-l,0)}}let ld=function(e={}){let{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:r=e=>e}=e,i=new Map;function o(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function s(e){let s=t+function(e,t=0){let n=0xdeadbeef^t,r=0x41c6ce57^t;for(let t=0,i;t<e.length;t++)n=Math.imul(n^(i=e.charCodeAt(t)),0x9e3779b1),r=Math.imul(r^i,0x5f356495);return n=Math.imul(n^n>>>16,0x85ebca6b)^Math.imul(r^r>>>13,0xc2b2ae35),(0x100000000*(2097151&(r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(n^n>>>13,0xc2b2ae35)))+(n>>>0)).toString(36).slice(0,6)}("string"==typeof e?e:o(e))+n;return s=r(s),i.has(s)||i.set(s,"string"==typeof e?e:{...e}),s}return{name:"@shikijs/transformers:style-to-class",pre(e){if(!e.properties.style)return;let t=s(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=s(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry:()=>i,getCSS(){let e="";for(let[t,n]of i.entries())e+=`.${t}{${"string"==typeof n?n:o(n)}}`;return e},clearRegistry(){i.clear()}}}({classPrefix:"hl-"}),lu={name:"token-style-normalizer",tokens(e){for(let t of e)for(let e of t){if(null!=e.htmlStyle)continue;let t={};null!=e.color&&(t.color=e.color),null!=e.bgColor&&(t["background-color"]=e.bgColor),null!=e.fontStyle&&0!==e.fontStyle&&((1&e.fontStyle)!=0&&(t["font-style"]="italic"),(2&e.fontStyle)!=0&&(t["font-weight"]="bold"),(4&e.fontStyle)!=0&&(t["text-decoration"]="underline")),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function lh(e){return`--${"token"===e?"diffs-token":"diffs"}-`}function lp(e,t){t=null!=t?`${t}-`:"";let n="",r=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];null!=r&&(n+=`${lh("global")}${t}addition-color:${r};`);let i=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];null!=i&&(n+=`${lh("global")}${t}deletion-color:${i};`);let o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return null!=o&&(n+=`${lh("global")}${t}modified-color:${o};`),n}function lf(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t.children;t="children"in t?t.children[0]:null}throw console.error(e),Error("getLineNodes: Unable to find children")}function lm({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function lg({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let o=t[t.length-1];if(null==o||i||!n)return void t.push([+!r,e.value]);let s=0===o[0];if(r===s||r&&1===e.value.length&&!s){o[1]+=e.value;return}t.push([+!r,e.value])}class ly{diff(e,t,n={}){let r;"function"==typeof n?(r=n,n={}):"callback"in n&&(r=n.callback);let i=this.castInput(e,n),o=this.castInput(t,n),s=this.removeEmpty(this.tokenize(i,n)),a=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(s,a,n,r)}diffWithOptionsObj(e,t,n,r){var i;let o=e=>(e=this.postProcess(e,n),r)?void setTimeout(function(){r(e)},0):e,s=t.length,a=e.length,l=1,c=s+a;null!=n.maxEditLength&&(c=Math.min(c,n.maxEditLength));let d=null!=(i=n.timeout)?i:1/0,u=Date.now()+d,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=a&&p+1>=s)return o(this.buildValues(h[0].lastComponent,t,e));let f=-1/0,m=1/0,g=()=>{for(let r=Math.max(f,-l);r<=Math.min(m,l);r+=2){let i,l=h[r-1],c=h[r+1];l&&(h[r-1]=void 0);let d=!1;if(c){let e=c.oldPos-r;d=c&&0<=e&&e<s}let u=l&&l.oldPos+1<a;if(!d&&!u){h[r]=void 0;continue}if(i=!u||d&&l.oldPos<c.oldPos?this.addToPath(c,!0,!1,0,n):this.addToPath(l,!1,!0,1,n),p=this.extractCommon(i,t,e,r,n),i.oldPos+1>=a&&p+1>=s)return o(this.buildValues(i.lastComponent,t,e))||!0;h[r]=i,i.oldPos+1>=a&&(m=Math.min(m,r-1)),p+1>=s&&(f=Math.max(f,r+1))}l++};if(r)!function e(){setTimeout(function(){if(l>c||Date.now()>u)return r(void 0);g()||e()},0)}();else for(;l<=c&&Date.now()<=u;){let e=g();if(e)return e}}addToPath(e,t,n,r,i){let o=e.lastComponent;return o&&!i.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,r,i){let o=t.length,s=n.length,a=e.oldPos,l=a-r,c=0;for(;l+1<o&&a+1<s&&this.equals(n[a+1],t[l+1],i);)l++,a++,c++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!i.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r,i=[];for(;e;)i.push(e),r=e.previousComponent,delete e.previousComponent,e=r;i.reverse();let o=i.length,s=0,a=0,l=0;for(;s<o;s++){let e=i[s];if(e.removed)e.value=this.join(n.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(a,a+e.count);r=r.map(function(e,t){let r=n[l+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(a,a+e.count));a+=e.count,e.added||(l+=e.count)}}return i}}let lv=new class extends ly{};function lb(e,t){let n;for(n=0;n<e.length&&n<t.length&&e[n]==t[n];n++);return e.slice(0,n)}function lx(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length&&e[e.length-(n+1)]==t[t.length-(n+1)];n++);return e.slice(-n)}function lk(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function lw(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function lS(e,t){return lk(e,t,"")}function lC(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),o=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[o]?i[e]=i[o]:i[e]=o;o>0&&t[e]!=t[o];)o=i[o];t[e]==t[o]&&o++}o=0;for(let r=n;r<e.length;r++){for(;o>0&&e[r]!=t[o];)o=i[o];e[r]==t[o]&&o++}return o}(e,t))}function lN(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function lA(e){let t=e.match(/^\s*/);return t?t[0]:""}let lE="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",lM=RegExp(`[${lE}]+|\\s+|[^${lE}]`,"ug");function lT(e,t,n,r){var i,o,s,a;if(t&&n){let s=lA(t.value),a=lN(t.value),l=lA(n.value),c=lN(n.value);if(e){let r=lb(s,l);e.value=lw(e.value,l,r),t.value=lS(t.value,r),n.value=lS(n.value,r)}if(r){let e=lx(a,c);r.value=lk(r.value,c,e),i=t.value,t.value=lw(i,e,""),o=n.value,n.value=lw(o,e,"")}}else if(n){if(e){let e=lA(n.value);n.value=n.value.substring(e.length)}if(r){let e=lA(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=lA(r.value),i=lA(t.value),o=lN(t.value),a=lb(n,i);t.value=lS(t.value,a);let l=lx(lS(n,a),o);s=t.value,t.value=lw(s,l,""),r.value=lk(r.value,n,l),e.value=lw(e.value,n,n.slice(0,n.length-l.length))}else if(r){let e=lA(r.value),n=lC(lN(t.value),e);a=t.value,t.value=lw(a,n,"")}else if(e){let n=lC(lN(e.value),lA(t.value));t.value=lS(t.value,n)}}new class extends ly{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if("word"!=r.resolvedOptions().granularity)throw Error('The segmenter passed must have a granularity of "word"');for(let t of(n=[],Array.from(r.segment(e)))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(lM)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?null==i?r.push(e):r.push(r.pop()+e):null!=i&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&lT(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&lT(n,i,r,null),e}};let lI=new class extends ly{tokenize(e){let t=RegExp(`(\\r?\\n)|[${lE}]+|[^\\S\\n\\r]+|[^${lE}]`,"ug");return e.match(t)||[]}},lL={forcePlainText:!1},lO=-1;var lD=class{__id=`diff-hunks-renderer:${++lO}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;constructor(e={theme:nc},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=a9(e.theme??nc)?function(){if(null!=r&&!("then"in r))return r}():void 0)}cleanUp(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){this.getOptionsWithDefaults().themeType!==e&&this.mergeOptions({themeType:e})}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};("up"===t||"both"===t)&&(r.fromStart+=n),("down"===t||"both"===t)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&(this.renderCache=void 0),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??nh}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){for(let t of(this.additionAnnotations={},this.deletionAnnotations={},e)){let e=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return"change"!==t?{gutterLineType:t}:{gutterLineType:"deletions"===e?"change-deletion":"change-addition"}}createAnnotationElement(e){return nC({tagName:"div",children:[nC({tagName:"div",children:e.annotations?.map(e=>nC({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:a=!1,collapsedContextThreshold:l=1,expansionLineCount:c=100,hunkSeparators:d="line-info",lineDiffType:u="word-alt",maxLineDiffLength:h=1e3,overflow:p="scroll",theme:f=nc,themeType:m="system",tokenizeMaxLineLength:g=1e3,useCSSClasses:y=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:a,collapsedContextThreshold:l,expansionLineCount:c,hunkSeparators:d,lineDiffType:u,maxLineDiffLength:h,overflow:p,theme:this.workerManager?.getDiffRenderOptions().theme??f,themeType:m,tokenizeMaxLineLength:g,useCSSClasses:y}}async initializeHighlighter(){return this.highlighter=await a4(function(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:a7(t),preferredHighlighter:n}}(this.computedLang,this.options)),this.highlighter}hydrate(e){if(null==e)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getDiffResultCache(e);null==n||lR(t,n.options)||(n=void 0),this.renderCache??={diff:e,highlighted:!0,options:t,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0&&null==this.renderCache.result?this.workerManager.highlightDiffAST(this,this.diff):this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n}=this.getOptionsWithDefaults();return{theme:e,tokenizeMaxLineLength:t,lineDiffType:n}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result!=null&&e===n.diff&&lR(t,n.options)?{options:t,forceRender:!1}:{options:t,forceRender:!0}}renderDiff(e=this.renderCache?.diff,t=np){if(null==e)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),i=this.workerManager?.getDiffResultCache(e);null!=i&&null==this.renderCache&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...i});let{options:o,forceRender:s}=this.getRenderOptions(e);if(this.renderCache??={diff:e,highlighted:!1,options:o,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0){(null==this.renderCache.result||!this.renderCache.highlighted&&!rZ(this.renderCache.renderRange,t))&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,0===t.startingLine&&t.totalLines===1/0&&0===t.bufferBefore&&0===t.bufferAfter||!!n||this.expandedHunks,r),this.renderCache.renderRange=t);t.totalLines>0&&(!this.renderCache.highlighted||s)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??lr(e.name);let t=null!=this.highlighter&&a9(o.theme),n=null!=this.highlighter&&r9(this.computedLang);if(null!=this.highlighter&&t&&(s||!this.renderCache.highlighted&&n||null==this.renderCache.result)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,this.highlighter,!n);this.renderCache={diff:e,options:r,highlighted:n,result:t,renderRange:void 0}}t&&n||this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}return null!=this.renderCache.result?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=np){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n,r,i){var o;let{diffIndicators:s,disableBackground:a,disableLineNumbers:l,overflow:c,themeType:d}=this.getOptionsWithDefaults();return o={type:"diff",diffIndicators:s,disableBackground:a,disableLineNumbers:l,overflow:c,themeStyles:n,split:e,themeType:r??d,totalLines:t,customProperties:i},nC({tagName:"pre",properties:function({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,themeType:o,themeStyles:s,totalLines:a,type:l,customProperties:c}){let d={...c,"data-diff":"diff"===l?"":void 0,"data-file":"file"===l?"":void 0,"data-diff-type":"diff"===l?i?"split":"single":void 0,"data-overflow":r,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":"bars"===e||"classic"===e?e:void 0,"data-theme-type":"system"!==o?o:void 0,style:s,tabIndex:0};return d.style+=`--diffs-min-number-column-width-default:${`${a}`.length}ch;`,d}(o)})}async asyncHighlight(e){this.computedLang=e.lang??lr(e.name);let t=null!=this.highlighter&&a9(this.options.theme??nc),n=null!=this.highlighter&&r9(this.computedLang);return null!=this.highlighter&&t&&n||(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:function(e,t,n,{forcePlainText:r,startingLine:i,totalLines:o,expandedHunks:s,collapsedContextThreshold:a=1}=lL){r?(i??=0,o??=1/0):(i=0,o=1/0);let l=i>0||o<1/0,c=(()=>{let e=n.theme??nc;if("string"==typeof e)return t.getTheme(e).type})(),d=function({theme:e=nc,highlighter:t,prefix:n}){let r="";if("string"==typeof e){let i=t.getTheme(e);r+=`color:${i.fg};`,r+=`background-color:${i.bg};`,r+=`${lh("global")}fg:${i.fg};`,r+=`${lh("global")}bg:${i.bg};`,r+=lp(i,n)}else{let n=t.getTheme(e.dark);r+=`${lh("global")}dark:${n.fg};`,r+=`${lh("global")}dark-bg:${n.bg};`,r+=lp(n,"dark"),n=t.getTheme(e.light),r+=`${lh("global")}light:${n.fg};`,r+=`${lh("global")}light-bg:${n.bg};`,r+=lp(n,"light")}return r}({theme:n.theme,highlighter:t}),u=r&&!l&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},p=!r&&!e.isPartial,f=new Map;function m(e,t,n,r){if(l){let e=n.at(-1);(null==e||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}for(let c of(ll({diff:e,diffStyle:"both",startingLine:i,totalLines:o,expandedHunks:!l||(r?s:void 0),collapsedContextThreshold:a,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let o,s,a=(o=p?0:t,s=f.get(o)??{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]},f.set(o,s),s),l=null!=n?n.splitLineIndex:r.splitLineIndex;"change"===i&&null!=n&&null!=r&&function({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:o,lineDiffType:s}){var a,l,c,d;if(null==e||null==t||"none"===s)return;e=nm(e),t=nm(t);let u="char"===s?(a=e,l=t,lv.diff(a,l,void 0)):(c=e,d=t,lI.diff(c,d,void 0)),h=[],p=[],f="word-alt"===s,m=u.at(-1);for(let e of u){let t=e===m;e.added||e.removed?e.removed?lg({item:e,arr:h,enableJoin:f,isLastItem:t}):lg({item:e,arr:p,enableJoin:f,isLastItem:t}):(lg({item:e,arr:h,enableJoin:f,isNeutral:!0,isLastItem:t}),lg({item:e,arr:p,enableJoin:f,isNeutral:!0,isLastItem:t}))}let g=0;for(let e of h)1===e[0]&&i.push(lm({line:n,spanStart:g,spanLength:e[1].length})),g+=e[1].length;for(let e of(g=0,p))1===e[0]&&o.push(lm({line:r,spanStart:g,spanLength:e[1].length})),g+=e[1].length}({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:u}),null!=r&&(m(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:"change"===i?"change-deletion":i,lineNumber:r.lineNumber,altLineNumber:"change"===i?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${l}`})),null!=n&&(m(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:"change"===i?"change-addition":i,lineNumber:n.lineNumber,altLineNumber:"change"===i?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${l}`}))}}),f.values())){if(0===c.deletionContent.length&&0===c.additionContent.length)continue;let i={name:e.prevName??e.name,contents:c.deletionContent.value},o={name:e.name,contents:c.additionContent.value},{deletionLines:s,additionLines:a}=function({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:o,additionDecorations:s,languageOverride:a,options:{theme:l=nc,...c}}){let d=a??lr(e.name),u=a??lr(t.name),{state:h,transformers:p}=function(e=!1){let t={lineInfo:[]},n=[{line:e=>(delete e.properties.class,e),pre(e){let n=function(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t;t="children"in t?t.children[0]:null}}(e),r=[];if(null!=n){let e=1;for(let i of n.children)"element"===i.type&&(r.push(function(e,t,n){let r="function"==typeof n.lineInfo?n.lineInfo(t):n.lineInfo[t-1];if(null==r){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName="div",e.properties["data-line"]=r.lineNumber,e.properties["data-alt-line"]=r.altLineNumber,e.properties["data-line-type"]=r.type,e.properties["data-line-index"]=r.lineIndex,0===e.children.length&&e.children.push(nS("\n")),e}(i,e,t)),e++);n.children=r}return e}}];return e&&n.push(lu,ld),{state:t,transformers:n,toClass:ld}}(),f="string"==typeof l?{...c,lang:"text",theme:l,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:lh("token")}:{...c,lang:"text",themes:l,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:lh("token")};return{deletionLines:""===e.contents?[]:(f.lang=d,h.lineInfo=n,f.decorations=o,lf(i.codeToHast(nm(e.contents),f))),additionLines:""===t.contents?[]:(f.lang=u,f.decorations=s,h.lineInfo=r,lf(i.codeToHast(nm(t.contents),f)))}}({deletionFile:i,deletionInfo:c.deletionInfo,deletionDecorations:c.deletionDecorations,additionFile:o,additionInfo:c.additionInfo,additionDecorations:c.additionDecorations,highlighter:t,options:n,languageOverride:r?"text":e.lang});if(p){h.deletionLines=s,h.additionLines=a;continue}if(c.deletionSegments.length>0)for(let e of c.deletionSegments)for(let t=0;t<e.count;t++)h.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else h.deletionLines.push(...s);if(c.additionSegments.length>0)for(let e of c.additionSegments)for(let t=0;t<e.count;t++)h.additionLines[e.targetIndex+t]=a[e.originalOffset+t];else h.additionLines.push(...a)}return{code:h,themeStyles:d,baseThemeType:c}}(e,t,r,{forcePlainText:n,expandedHunks:!!n||void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n){if(null==this.renderCache)return;let r=this.renderCache.diff!==e||!this.renderCache.highlighted||!lR(this.renderCache.options,n);this.renderCache={diff:e,options:n,highlighted:!0,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let o,{diffStyle:s,disableFileHeader:a,expandUnchanged:l,expansionLineCount:c,collapsedContextThreshold:d,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let h="unified"===s,p=[],f=[],m=[],g=[],{additionLines:y,deletionLines:v}=n,b={rowCount:0,hunkSeparators:u,additionsContentAST:p,deletionsContentAST:f,unifiedContentAST:m,unifiedGutterAST:nA(),deletionsGutterAST:nA(),additionsGutterAST:nA(),expansionLineCount:c,hunkData:g,incrementRowCount(e=1){b.rowCount+=e},pushToGutter(e,t){switch(e){case"unified":b.unifiedGutterAST.children.push(t);break;case"deletions":b.deletionsGutterAST.children.push(t);break;case"additions":b.additionsGutterAST.children.push(t)}}},x=function(e){let t=e.hunks.at(-1);if(null==t||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),r=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==r)throw Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${r}) for ${e.name}`);return Math.min(n,r)}(e),k={size:0,side:void 0,increment(){this.size+=1},flush(){if("unified"!==s){if(this.size<=0||null==this.side){this.side=void 0,this.size=0;return}"additions"===this.side?(b.pushToGutter("additions",nE(void 0,"buffer",this.size)),p?.push(li(this.size))):(b.pushToGutter("deletions",nE(void 0,"buffer",this.size)),f?.push(li(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{b.pushToGutter(e,function(e,t,n,r={}){return nC({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:null!=t?[nC({tagName:"span",properties:{"data-line-number-content":""},children:[nS(`${t}`)]})]:void 0})}(t,n,r,i))};function S(e){k.flush(),"unified"===s?lj("unified",e,b):(lj("deletions",e,b),lj("additions",e,b))}ll({diff:e,diffStyle:s,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:!!l||this.expandedHunks,collapsedContextThreshold:d,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:a,type:l})=>{let c=null!=a?a.splitLineIndex:o.splitLineIndex,d=null!=o?o.unifiedLineIndex:a.unifiedLineIndex;"split"===s&&"change"!==l&&k.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:0===t,isLastHunk:!1,isExpandable:!e.isPartial});let h="unified"===s?d:c,p={type:l,hunkIndex:t,lineIndex:h,unifiedLineIndex:d,splitLineIndex:c,deletionLine:a,additionLine:o};if("unified"===s){let n=null!=a?v[a.lineIndex]:void 0,r=null!=o?y[o.lineIndex]:void 0;if(null==n&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let i="change"===l?null!=o?"change-addition":"change-deletion":l,s=this.getUnifiedLineDecoration({type:l,lineType:i,additionLineIndex:o?.lineIndex,deletionLineIndex:a?.lineIndex});w("unified",s.gutterLineType,null!=o?o.lineNumber:a.lineNumber,`${d},${c}`,s.gutterProperties),null!=r?r=lB(r,s.contentProperties):null!=n&&(n=lB(n,s.contentProperties)),l_({diffStyle:"unified",type:l,deletionLine:n,additionLine:r,unifiedSpan:this.getAnnotations("unified",a?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:b});let u=this.getUnifiedInlineRowsForLine?.(p);null!=u&&function(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}(u,b)}else{let n=null!=a?v[a.lineIndex]:void 0,r=null!=o?y[o.lineIndex]:void 0,i=this.getSplitLineDecoration({side:"deletions",type:l,lineIndex:a?.lineIndex}),s=this.getSplitLineDecoration({side:"additions",type:l,lineIndex:o?.lineIndex});if(null==n&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let d=(()=>{if("change"===l){if(null==r)return"additions";else if(null==n)return"deletions"}})();if(null!=d){if(null!=k.side&&k.side!==d)throw Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");k.side=d,k.increment()}let u=this.getAnnotations("split",a?.lineNumber,o?.lineNumber,t,h);if(null!=u&&k.size>0&&k.flush(),null!=a){let e=lB(n,i.contentProperties);w("deletions",i.gutterLineType,a.lineNumber,`${a.unifiedLineIndex},${c}`,i.gutterProperties),null!=e&&(n=e)}if(null!=o){let e=lB(r,s.contentProperties);w("additions",s.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${c}`,s.gutterProperties),null!=e&&(r=e)}l_({diffStyle:"split",type:l,additionLine:r,deletionLine:n,...u,createAnnotationElement:e=>this.createAnnotationElement(e),context:b});let f=this.getSplitInlineRowsForLine?.(p);null!=f&&function(e,t,n){for(let{deletion:r,addition:i}of e){if(null==r&&null==i)continue;let e=null!=r&&null!=i?void 0:null==r?"deletions":"additions";(null==e||n.side!==e)&&n.flush(),null!=r&&(t.deletionsContentAST.push(r.content),t.pushToGutter("deletions",r.gutter)),null!=i&&(t.additionsContentAST.push(i.content),t.pushToGutter("additions",i.gutter)),null!=e&&(n.side=e,n.increment()),t.incrementRowCount(1)}}(f,b,k)}let f=a?.noEOFCR??!1,m=o?.noEOFCR??!1;if(m||f){if(f){let e="context"===l||"context-expanded"===l?l:"change-deletion";"unified"===s?(b.unifiedContentAST.push(lo(e)),b.pushToGutter("unified",nE(e,"metadata",1))):(b.deletionsContentAST.push(lo(e)),b.pushToGutter("deletions",nE(e,"metadata",1)),m||(b.pushToGutter("additions",nE(void 0,"buffer",1)),b.additionsContentAST.push(li(1))))}if(m){let e="context"===l||"context-expanded"===l?l:"change-addition";"unified"===s?(b.unifiedContentAST.push(lo(e)),b.pushToGutter("unified",nE(e,"metadata",1))):(b.additionsContentAST.push(lo(e)),b.pushToGutter("additions",nE(e,"metadata",1)),f||(b.pushToGutter("deletions",nE(void 0,"buffer",1)),b.deletionsContentAST.push(li(1))))}b.incrementRowCount(1)}i>0&&"simple"!==u&&S({hunkIndex:"context-expanded"===l?t:t+1,collapsedLines:i,rangeSize:x,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),b.incrementRowCount(1)}}),"split"===s&&k.flush();let C=Math.max(null==(o=e.hunks.at(-1))?0:Math.max(o.additionStart+o.additionCount,o.deletionStart+o.deletionCount),e.additionLines.length??0,e.deletionLines.length??0),N=t.bufferBefore>0||t.bufferAfter>0,A=!h&&"deleted"!==e.type,E=!h&&"new"!==e.type,M=b.rowCount>0||N;p=A&&M?p:void 0,f=E&&M?f:void 0,m=h&&M?m:void 0;let T=this.createPreElement(null!=f&&null!=p,C,r,i);return{unifiedGutterAST:h&&M?b.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:E&&M?b.deletionsGutterAST.children:void 0,deletionsContentAST:f,additionsGutterAST:A&&M?b.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:g,preNode:T,themeStyles:r,baseThemeType:i,headerElement:a?void 0:this.renderHeader(this.diff,r,i),totalLines:C,rowCount:b.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){var n;let r="unified"===e?t.unifiedGutterAST:"deletions"===e?t.deletionsGutterAST:t.additionsGutterAST,i="unified"===e?t.unifiedContentAST:"deletions"===e?t.deletionsContentAST:t.additionsContentAST;if(null==r||null==i)return;let o=nA(r);return o.properties.style=`grid-row: span ${t.rowCount}`,[o,(n=t.rowCount,nC({tagName:"div",children:i,properties:{"data-content":"",style:`grid-row: span ${n}`}}))]}renderFullAST(e,t=[]){let n="line-info"===this.getOptionsWithDefaults().hunkSeparators,r=this.renderCodeAST("unified",e);if(null!=r)return t.push(nC({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};let i=this.renderCodeAST("deletions",e);null!=i&&t.push(nC({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));let o=this.renderCodeAST("additions",e);return null!=o&&t.push(nC({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return rU(this.renderFullAST(e,t))}renderPartialHTML(e,t){return null==t?rU(e):rU(nC({tagName:"code",children:e,properties:{"data-code":"","data-container-size":"line-info"===this.getOptionsWithDefaults().hunkSeparators?"":void 0,[`data-${t}`]:""}}))}getAnnotations(e,t,n,r,i){let o={type:"annotation",hunkIndex:r,lineIndex:i,annotations:[]};if(null!=t)for(let e of this.deletionAnnotations[t]??[])o.annotations.push(nv(e));let s={type:"annotation",hunkIndex:r,lineIndex:i,annotations:[]};if(null!=n)for(let t of this.additionAnnotations[n]??[])("unified"===e?o:s).annotations.push(nv(t));return"unified"===e?o.annotations.length>0?o:void 0:0!==s.annotations.length||0!==o.annotations.length?{deletionSpan:o,additionSpan:s}:void 0}renderHeader(e,t,n){let{themeType:r}=this.getOptionsWithDefaults();return function({fileOrDiff:e,themeStyles:t,themeType:n}){let r="type"in e?e:void 0,i={"data-diffs-header":"","data-change-type":r?.type,"data-theme-type":"system"!==n?n:void 0,style:t};return nC({tagName:"div",children:[function({name:e,prevName:t,iconType:n}){let r=[nC({tagName:"slot",properties:{name:na}}),nN({name:function(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}(n),properties:{"data-change-icon":n}})];return null!=t&&(r.push(nC({tagName:"div",children:[nS(t)],properties:{"data-prev-name":""}})),r.push(nN({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),r.push(nC({tagName:"div",children:[nS(e)],properties:{"data-title":""}})),nC({tagName:"div",children:r,properties:{"data-header-content":""}})}({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:r?.type??"file"}),function(e){let t=[];if(null!=e){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||0===n)&&t.push(nC({tagName:"span",children:[nS(`-${r}`)],properties:{"data-deletions-count":""}})),(n>0||0===r)&&t.push(nC({tagName:"span",children:[nS(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(nC({tagName:"slot",properties:{name:nl}})),nC({tagName:"div",children:t,properties:{"data-metadata":""}})}(r)],properties:i})}({fileOrDiff:e,themeStyles:t,themeType:n??r})}};function lR(e,t){return le(e.theme,t.theme)&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType}function lP(e){return`${e} unmodified line${e>1?"s":""}`}function l_({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:o,additionSpan:s,createAnnotationElement:a,context:l}){let c=!1;"unified"===e?(null!=r?l.unifiedContentAST.push(r):null!=n&&l.unifiedContentAST.push(n),null!=i&&(l.unifiedContentAST.push(a(i)),l.pushToGutter("unified",nE("change"===t?null!=n?"change-deletion":"change-addition":t,"annotation",1)),c=!0)):"split"===e&&(null!=n&&l.deletionsContentAST.push(n),null!=r&&l.additionsContentAST.push(r),null!=o&&(l.deletionsContentAST.push(a(o)),l.pushToGutter("deletions",nE("change"===t?null!=n?"change-deletion":"context":t,"annotation",1)),c=!0),null!=s&&(l.additionsContentAST.push(a(s)),l.pushToGutter("additions",nE("change"===t?null!=r?"change-addition":"context":t,"annotation",1)),c=!0)),c&&l.incrementRowCount(1)}function lj(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:o,isLastHunk:s,isExpandable:a},l){if(n<=0)return;let c="unified"===e?l.unifiedContentAST:"deletions"===e?l.deletionsContentAST:l.additionsContentAST;if("metadata"===l.hunkSeparators){null!=i&&(l.pushToGutter(e,la({type:"metadata",content:i,isFirstHunk:o,isLastHunk:s})),c.push(la({type:"metadata",content:i,isFirstHunk:o,isLastHunk:s})),"additions"!==e&&l.incrementRowCount(1));return}if("simple"===l.hunkSeparators){t>0&&(l.pushToGutter(e,la({type:"simple",isFirstHunk:o,isLastHunk:!1})),c.push(la({type:"simple",isFirstHunk:o,isLastHunk:!1})),"additions"!==e&&l.incrementRowCount(1));return}let d=`hunk-separator-${e}-${t}`,u=r>l.expansionLineCount,h=a?t:void 0;l.pushToGutter(e,la({type:l.hunkSeparators,content:lP(n),expandIndex:h,chunked:u,slotName:d,isFirstHunk:o,isLastHunk:s})),c.push(la({type:l.hunkSeparators,content:lP(n),expandIndex:h,chunked:u,slotName:d,isFirstHunk:o,isLastHunk:s})),"additions"!==e&&l.incrementRowCount(1),l.hunkData.push({slotName:d,hunkIndex:t,lines:n,type:e,expandable:a?{up:!o,down:!s,chunked:u}:void 0})}function lB(e,t){return null==e||"element"!==e.type||null==t?e:{...e,properties:{...e.properties,...t}}}let lz=new class extends ly{constructor(){super(...arguments),this.tokenize=l$}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function l$(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}let lF={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function lU(e,t,n,r,i,o,s){var a;let l;void 0===(l=s?"function"==typeof s?{callback:s}:s:{}).context&&(l.context=4);let c=l.context;if(l.newlineIsToken)throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!l.callback)return d(lz.diff(n,r,l));{let{callback:e}=l;a=Object.assign(Object.assign({},l),{callback:t=>{e(d(t))}}),lz.diff(n,r,a)}function d(n){if(!n)return;function r(e){return e.map(function(e){return" "+e})}n.push({value:"",lines:[]});let s=[],a=0,l=0,d=[],u=1,h=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||function(e){let t=e.endsWith("\n"),n=e.split("\n").map(e=>e+"\n");return t?n.pop():n.push(n.pop().slice(0,-1)),n}(t.value);if(t.lines=i,t.added||t.removed){if(!a){let t=n[e-1];a=u,l=h,t&&(a-=(d=c>0?r(t.lines.slice(-c)):[]).length,l-=d.length)}for(let e of i)d.push((t.added?"+":"-")+e);t.added?h+=i.length:u+=i.length}else{if(a)if(i.length<=2*c&&e<n.length-2)for(let e of r(i))d.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))d.push(t);let t={oldStart:a,oldLines:u-a+e,newStart:l,newLines:h-l+e,lines:d};s.push(t),a=0,l=0,d=[]}u+=i.length,h+=i.length}}for(let e of s)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith("\n")?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,"\"),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:o,hunks:s}}}function lH(e,t){if(t||(t=lF),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(e=>lH(e,t)).join("\n")}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push("Index: "+e.oldFileName),t.includeUnderline&&n.push("==================================================================="),t.includeFileHeaders&&(n.push("--- "+e.oldFileName+(void 0===e.oldHeader?"":" "+e.oldHeader)),n.push("+++ "+e.newFileName+(void 0===e.newHeader?"":" "+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t];for(let e of(0===r.oldLines&&(r.oldStart-=1),0===r.newLines&&(r.newStart-=1),n.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@"),r.lines))n.push(e)}return n.join("\n")+"\n"}function lW(e,t,n,r=!1){let i=ng(function(e,t,n,r,i,o,s){if("function"==typeof s&&(s={callback:s}),null==s?void 0:s.callback){let{callback:a}=s;lU(e,t,n,r,i,o,Object.assign(Object.assign({},s),{callback:e=>{e?a(lH(e,s.headerOptions)):a(void 0)}}))}else{let a=lU(e,t,n,r,i,o,s);if(!a)return;return lH(a,null==s?void 0:s.headerOptions)}}(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(null!=e.cacheKey&&null!=t.cacheKey)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(null==i)throw Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return i}let lV=-1;var lG=class{static LoadedCustomComponent=!0;__id=`file-diff:${++lV}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;unsafeCSSStyle;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(e={theme:nc},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new rQ,this.scrollSyncManager=new r5,this.interactionManager=new rV("diff",rG(e,"function"==typeof e.hunkSeparators||(e.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return{...e,hunkSeparators:"function"==typeof e.hunkSeparators?"custom":e.hunkSeparators}}createHunksRenderer(e){return new lD(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{let n,r;if(null==this.fileDiff)return;let i=this.fileDiff.hunks.at(-1);e:for(let o of this.fileDiff.hunks){let s="deletions"===t?o.deletionStart:o.additionStart,a="deletions"===t?o.deletionCount:o.additionCount,l=o.splitLineStart,c=o.unifiedLineStart;if(e<s){let t=s-e;n=Math.max(c-t,0),r=Math.max(l-t,0);break}if(e>=s+a){if(o===i){let t=e-(s+a);n=c+o.unifiedLineCount+t,r=l+o.splitLineCount+t;break}continue}for(let i of o.hunkContent)if("context"===i.type)if(e<s+i.lines){let t=e-s;r=l+t,n=c+t;break e}else s+=i.lines,l+=i.lines,c+=i.lines;else{let o="deletions"===t?i.deletions:i.additions;if(e<s+o){let o=e-s;n=c+("additions"===t?i.deletions:0)+o,r=l+o;break e}s+=o,l+=Math.max(i.deletions,i.additions),c+=i.deletions+i.additions}break}if(null!=n&&null!=r)return[n,r]};setOptions(e){null!=e&&(this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.interactionManager.setOptions(rG(e,"function"==typeof e.hunkSeparators||(e.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){if((this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.hunksRenderer.setThemeType(e),null!=this.headerElement&&("system"===e?delete this.headerElement.dataset.themeType:this.headerElement.dataset.themeType=e),null!=this.pre))switch(e){case"system":delete this.pre.dataset.themeType;break;case"light":case"dark":this.pre.dataset.themeType=e}}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!e&&!t&&!n&&"function"!=typeof this.options.hunkSeparators}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=""),this.fileContainer=void 0,null!=this.pre&&(this.pre.innerHTML="",this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{overflow:t="scroll",diffStyle:n="split"}=this.options,{fileContainer:r,prerenderedHTML:i,preventEmit:o=!1}=e;for(let e of(!function(e,t){if(null==t)return;let n=e.shadowRoot??e.attachShadow({mode:"open"});""===n.innerHTML&&(n.innerHTML=t)}(r,i),r.shadowRoot?.children??[])){if(e instanceof SVGElement){this.spriteSVG=e;continue}if(e instanceof HTMLElement){if(e instanceof HTMLPreElement){for(let t of(this.pre=e,e.children))t instanceof HTMLElement&&"code"===t.tagName.toLowerCase()&&("deletions"in t.dataset&&(this.codeDeletions=t),"additions"in t.dataset&&(this.codeAdditions=t),"unified"in t.dataset&&(this.codeUnified=t));continue}if("diffsHeader"in e.dataset){this.headerElement=e;continue}if(e instanceof HTMLStyleElement&&e.hasAttribute(nd)){this.unsafeCSSStyle=e;continue}}}if(null!=this.pre&&this.syncCodeNodesFromPre(this.pre),null==this.pre)this.render({...e,preventEmit:!0});else{let{lineAnnotations:i,oldFile:o,newFile:s,fileDiff:a}=e;this.fileContainer=r,delete this.pre.dataset.dehydrated,this.lineAnnotations=i??this.lineAnnotations,this.additionFile=s,this.deletionFile=o,this.fileDiff=a??(null!=o&&null!=s?lW(o,s):void 0),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===t),"scroll"===t&&"split"===n&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions)}o||this.emitPostRender()}rerender(){this.enabled&&(null!=this.fileDiff||null!=this.additionFile||null!=this.deletionFile)&&this.render({forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,forceRender:r=!1,preventEmit:i=!1,lineAnnotations:o,fileContainer:s,containerWrapper:a,renderRange:l}){if(!this.enabled)throw Error("FileDiff.render: attempting to call render after cleaned up");let{collapsed:c=!1}=this.options,d=c?void 0:l,u=null!=e&&null!=t&&(!r1(e,this.deletionFile)||!r1(t,this.additionFile)),h=null!=n&&n!==this.fileDiff,p=null!=o&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations;if(!c&&rZ(d,this.renderRange)&&!r&&!p&&(null!=n&&n===this.fileDiff||null==n&&!u))return!1;let{renderRange:f}=this;if(this.renderRange=d,this.deletionFile=e,this.additionFile=t,null!=n?this.fileDiff=n:null!=e&&null!=t&&u&&(h=!0,this.fileDiff=lW(e,t)),null!=o&&this.setLineAnnotations(o),null==this.fileDiff)return!1;this.hunksRenderer.setOptions({...this.options,hunkSeparators:"function"==typeof this.options.hunkSeparators?"custom":this.options.hunkSeparators}),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{diffStyle:m="split",disableErrorHandling:g=!1,disableFileHeader:y=!1,overflow:v="scroll"}=this.options;if(y&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),null!=this.headerPrefix&&(this.headerPrefix.remove(),this.headerPrefix=void 0),null!=this.headerMetadata&&(this.headerMetadata.remove(),this.headerMetadata=void 0)),s=this.getOrCreateFileContainer(s,a),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,nf);e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return i||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(r,p,u||h)&&this.applyPartialRender({previousRenderRange:f,renderRange:d}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,d);if(null==t)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;null!=t.headerElement&&this.applyHeaderToDOM(t.headerElement,s),null!=t.additionsContentAST||null!=t.deletionsContentAST||null!=t.unifiedContentAST?this.applyHunksToDOM(e,t):null!=this.pre&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,d),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.interactionManager.setup(e),this.resizeManager.setup(e,"wrap"===v),"scroll"===v&&"split"===m?this.scrollSyncManager.setup(e,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return i||this.emitPostRender(),!0}emitPostRender(){null!=this.fileContainer&&this.options.onPostRender?.(this.fileContainer,this)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();for(let{element:e}of(this.separatorCache.clear(),this.annotationCache.values()))e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(null==this.fileContainer)return!1;if(this.cleanChildNodes(),null==this.placeHolder){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.pre=void 0,this.spriteSVG=void 0,this.unsafeCSSStyle=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof t){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let i of e){var r;let e=i.slotName,o=this.separatorCache.get(e);if(null==o||(r=o.hunkData,i.slotName!==r.slotName||i.hunkIndex!==r.hunkIndex||i.lines!==r.lines||i.type!==r.type||i.expandable?.chunked!==r.expandable?.chunked||i.expandable?.up!==r.expandable?.up||i.expandable?.down!==r.expandable?.down)){o?.element.remove();let n=document.createElement("div");n.style.display="contents",n.slot=i.slotName;let r=t(i,this);null!=r&&n.appendChild(r),this.fileContainer.appendChild(n),o={element:n,hunkData:i},this.separatorCache.set(e,o)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(let[r,i]of this.lineAnnotations.entries()){var n;let o=`${r}-${nv(i)}`,s=this.annotationCache.get(o);if(null==s||(n=s.annotation,i.lineNumber!==n.lineNumber||i.side!==n.side||i.metadata!==n.metadata)){s?.element.remove();let e=t(i);if(null==e)continue;(s={element:function(e){let t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}(nv(i)),annotation:i}).element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let e,t=this.options.renderGutterUtility??this.options.renderHoverUtility;if(null==this.fileContainer||null==t){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=t(this.interactionManager.getHoveredLine);if(null!=n&&null!=this.gutterUtilityContent)return;if(null==n){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let r=((e=document.createElement("div")).slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e);r.appendChild(n),this.fileContainer.appendChild(r),this.gutterUtilityContent=r}getOrCreateFileContainer(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(t3),null!=n&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),null==this.spriteSVG){let e=document.createElement("div");e.innerHTML=r0;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){for(let t of(this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,Array.from(e.children)))t instanceof HTMLElement&&("unified"in t.dataset?this.codeUnified=t:"deletions"in t.dataset?this.codeDeletions=t:"additions"in t.dataset&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let n=rU(e);if(n!==this.lastRenderedHeaderHTML){let e=document.createElement("div");e.innerHTML=n;let r=e.firstElementChild;if(!(r instanceof HTMLElement))return;null!=this.headerElement?t.shadowRoot?.replaceChild(r,this.headerElement):t.shadowRoot?.prepend(r),this.headerElement=r,this.lastRenderedHeaderHTML=n}if(this.isContainerManaged)return;let{renderHeaderPrefix:r,renderHeaderMetadata:i}=this.options;null!=this.headerPrefix&&this.headerPrefix.remove(),null!=this.headerMetadata&&this.headerMetadata.remove();let o=r?.({deletionFile:this.deletionFile,additionFile:this.additionFile,fileDiff:this.fileDiff})??void 0,s=i?.({deletionFile:this.deletionFile,additionFile:this.additionFile,fileDiff:this.fileDiff})??void 0;null!=o&&(this.headerPrefix=document.createElement("div"),this.headerPrefix.slot=na,o instanceof Element?this.headerPrefix.appendChild(o):this.headerPrefix.innerText=`${o}`,t.appendChild(this.headerPrefix)),null!=s&&(this.headerMetadata=document.createElement("div"),this.headerMetadata.slot=nl,s instanceof Element?this.headerMetadata.appendChild(s):this.headerMetadata.innerText=`${s}`,t.appendChild(this.headerMetadata))}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;let{unsafeCSS:e}=this.options;if(null!=e&&""!==e){if(null==this.unsafeCSSStyle){let e;this.unsafeCSSStyle=((e=document.createElement("style")).setAttribute(nd,""),e),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)}this.unsafeCSSStyle.innerText=`@layer base, theme, unsafe;
|
|
191
|
-
@layer unsafe {
|
|
192
|
-
${e}
|
|
193
|
-
}`}}applyHunksToDOM(e,t){let{overflow:n="scroll"}=this.options,r=(this.options.hunkSeparators??"line-info")==="line-info",i="wrap"===n?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1,s=[],a=this.hunksRenderer.renderCodeAST("unified",t),l=this.hunksRenderer.renderCodeAST("deletions",t),c=this.hunksRenderer.renderCodeAST("additions",t);null!=a?(o=null==this.codeUnified||null!=this.codeAdditions||null!=this.codeDeletions,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=r8({code:this.codeUnified,columnType:"unified",rowSpan:i,containerSize:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(a),s.push(this.codeUnified)):null!=l||null!=c?(null!=l?(o=null==this.codeDeletions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=r8({code:this.codeDeletions,columnType:"deletions",rowSpan:i,containerSize:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(l),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),null!=c?(o=o||null==this.codeAdditions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=r8({code:this.codeAdditions,columnType:"additions",rowSpan:i,containerSize:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(c),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),0===s.length?e.textContent="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:o,options:{diffStyle:s="split"}}=this;if(null==n||null==e||null==t||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||null==this.lastRowCount)return!1;let a=this.getCodeColumns(s,r,o,i);if(null==a)return!1;let l=e.startingLine,c=t.startingLine,d=l+e.totalLines,u=c+t.totalLines,h=Math.max(l,c),p=Math.min(d,u);if(p<=h)return!1;let f=Math.max(0,h-l),m=Math.max(0,d-p),g=this.trimColumns({columns:a,trimStart:f,trimEnd:m,previousStart:l,overlapStart:h,overlapEnd:p,diffStyle:s});if(g<0)throw Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<g)throw Error("applyPartialRender: trimmed beyond DOM row count");let y=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0)&&null!=this.fileDiff)return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},b=v(c,Math.max(h-c,0));if(null==b&&c<h)return!1;let x=v(p,Math.max(u-p,0));if(null==x&&u>p)return!1;let k=(e,t)=>{if(null!=e){if("unified"!==s||Array.isArray(a))if("split"===s&&Array.isArray(a))this.insertPartialHTML(s,a,e,t);else throw Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");else this.insertPartialHTML(s,a,e,t);y+=e.rowCount}};return this.cleanupErrorWrapper(),k(b,"afterbegin"),k(x,"beforeend"),this.lastRowCount!==y&&(this.applyRowSpan(s,a,y),this.lastRowCount=y),!0}insertPartialHTML(e,t,n,r){if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST("deletions",n),i=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error("FileDiff.insertPartialHTML: Invalid argument composition");else{let e=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,e,r)}}renderPartialColumn(e,t,n){if(null==e||null==t)return;let r=lq(t[0]),i=lq(t[1]);if(null==r||null==i)throw Error("FileDiff.insertPartialHTML: Unexpected AST structure");let o=i.at(0);"beforeend"===n&&o?.type==="element"&&"number"==typeof o.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let s=i.at(-1);"afterbegin"===n&&s?.type==="element"&&"number"==typeof s.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let s=this.getBufferSize(t.dataset);null!=s&&(o?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(n,s+e))}applyRowSpan(e,t,n){let r=e=>{null!=e&&(e.gutter.style.setProperty("grid-row",`span ${n}`),e.content.style.setProperty("grid-row",`span ${n}`))};if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error("dun fuuuuked up");else r(t)}trimColumnRows(e,t,n){let r=0,i=0,o=0,s=!1,a=n>=0;if(null==e)return 0;let l=Array.from(e.content.children),c=Array.from(e.gutter.children);if(l.length!==c.length)throw Error("FileDiff.trimColumnRows: columns do not match");for(;o<l.length&&(!(t<=0)||a||s);){let e=c[o],d=l[o];if(o++,!(e instanceof HTMLElement)||!(d instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:d}),Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in d.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in d.dataset)){e.remove(),d.remove(),i++;continue}if("lineIndex"in e.dataset&&"lineIndex"in d.dataset){(t>0||a&&r>=n)&&(e.remove(),d.remove(),t>0&&0==--t&&(s=!0),i++),r++;continue}if("separator"in e.dataset&&"separator"in d.dataset||"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in d.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in d.dataset){(t>0||a&&r>=n)&&(e.remove(),d.remove(),i++);continue}if("buffer"===e.dataset.gutterBuffer&&"contentBuffer"in d.dataset){let o=this.getBufferSize(d.dataset);if(null==o)throw Error("FileDiff.trimColumnRows: invalid element");if(t>0){let n=Math.min(t,o),r=o-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(d,r),i+=n):(e.remove(),d.remove(),i+=o),t-=n}else if(a){let t=r,s=r+o-1;if(n<=t)e.remove(),d.remove(),i+=o;else if(n<=s){let t=s-n+1,r=o-t;this.updateBufferSize(e,r),this.updateBufferSize(d,r),i+=t}}r+=o;continue}throw console.error({gutterElement:e,contentElement:d}),Error("FileDiff.trimColumnRows: unknown row elements")}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:o,trimStart:s}){let a=Math.max(0,r-i),l=n-i;if(l<0)throw Error("FileDiff.trimColumns: overlap ends before previous");let c=s>0,d=o>0;if(!c&&!d)return 0;let u=c?a:0,h=d?l:-1;if("unified"===t&&!Array.isArray(e))return this.trimColumnRows(e,u,h);if("split"===t&&Array.isArray(e)){let t=this.trimColumnRows(e[0],u,h),n=this.trimColumnRows(e[1],u,h);if(null!=e[0]&&null!=e[1]&&t!==n)throw Error("FileDiff.trimColumns: split columns out of sync");return null!=e[0]?t:n}throw console.error({diffStyle:t,columns:e}),Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(e){if(null==e)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}if("unified"===e)return i(t);{let e=i(n),t=i(r);return null!=e||null!=t?[e,t]:void 0}}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||null==t){null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}applyPreNodeAttributes(e,{themeStyles:t,baseThemeType:n,additionsContentAST:r,deletionsContentAST:i,totalLines:o},s){var a;let{diffIndicators:l="bars",disableBackground:c=!1,disableLineNumbers:d=!1,overflow:u="scroll",themeType:h="system",diffStyle:p="split"}=this.options,f={type:"diff",diffIndicators:l,disableBackground:c,disableLineNumbers:d,overflow:u,split:"unified"!==p&&null!=r&&null!=i,themeStyles:t,themeType:n??h,totalLines:o,customProperties:s};a=this.appliedPreAttributes,(null==f||null==a?f!==a:!function(e=r2,t=r2){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}(f.customProperties,a.customProperties)||f.type!==a.type||f.diffIndicators!==a.diffIndicators||f.disableBackground!==a.disableBackground||f.disableLineNumbers!==a.disableLineNumbers||f.overflow!==a.overflow||f.split!==a.split||f.themeStyles!==a.themeStyles||f.themeType!==a.themeType||f.totalLines!==a.totalLines)&&(!function(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:o,split:s,themeStyles:a,themeType:l,totalLines:c,customProperties:d}){if(null!=d)for(let t in d){let n=d[t];null!=n&&e.setAttribute(t,`${n}`)}switch("diff"===t?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),"system"===l?e.removeAttribute("data-theme-type"):e.setAttribute("data-theme-type",l),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators")}i?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),r?e.removeAttribute("data-background"):e.setAttribute("data-background",""),"diff"===t?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.tabIndex=0,e.style=a,e.style.setProperty("--diffs-min-number-column-width-default",`${`${c}`.length}ch`)}(e,f),this.appliedPreAttributes=f)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML="",n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let r=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.innerHTML="",r.appendChild(this.errorWrapper);let i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);let o=document.createElement("pre");o.dataset.errorStack="",o.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function lq(e){if(null!=e&&"element"===e.type)return e.children??[]}let lK=-1;var lJ=class extends lG{__id=`little-virtualized-file-diff:${++lK}`;top;height=0;metrics;heightCache=new Map;isVisible=!1;virtualizer;constructor(e,t,n,r,i=!1){super(e,r,i);const{hunkSeparators:o="line-info"}=this.options;this.virtualizer=t,this.metrics=function(e,t){let n={...nu,...t};return n.hunkSeparatorHeight=function(e,t){if(null!=t)return t;switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}(e,t?.hunkSeparatorHeight),n}("function"==typeof o?"custom":o,n)}getLineHeight(e,t=!1){let n=this.heightCache.get(e);return null!=n?n:this.metrics.lineHeight*(t?2:1)}setOptions(e){if(null==e)return;let t=this.options.diffStyle,n=this.options.overflow,r=this.options.collapsed;super.setOptions(e),(t!==this.options.diffStyle||n!==this.options.overflow||r!==this.options.collapsed)&&(this.heightCache.clear(),this.computeApproximateSize(),this.renderRange=void 0),this.virtualizer.instanceChanged(this)}reconcileHeights(){let{overflow:e="scroll"}=this.options;if(null!=this.fileContainer&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),null==this.fileContainer||null==this.fileDiff){this.height=0;return}if("scroll"===e&&0===this.lineAnnotations.length&&!this.virtualizer.config.resizeDebugging)return;let t=this.getDiffStyle(),n=!1;for(let e of"split"===t?[this.codeDeletions,this.codeAdditions]:[this.codeUnified]){if(null==e)continue;let r=e.children[1];if(r instanceof HTMLElement)for(let e of r.children){if(!(e instanceof HTMLElement))continue;let r=e.dataset.lineIndex;if(null==r)continue;let i=function(e,t){let[n,r]=e.split(",").map(Number);return"split"===t?r:n}(r,t),o=e.getBoundingClientRect().height,s=!1;e.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in e.nextElementSibling.dataset||"noNewline"in e.nextElementSibling.dataset)&&("noNewline"in e.nextElementSibling.dataset&&(s=!0),o+=e.nextElementSibling.getBoundingClientRect().height),o!==this.getLineHeight(i,s)&&(n=!0,o===this.metrics.lineHeight*(s?2:1)?this.heightCache.delete(i):this.heightCache.set(i,o))}}(n||this.virtualizer.config.resizeDebugging)&&this.computeApproximateSize()}onRender=e=>null!=this.fileContainer&&(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){null!=this.fileContainer&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)};setVisibility(e){null!=this.fileContainer&&(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){let e=0===this.height;if(this.height=0,null==this.fileDiff)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1,hunkSeparators:o="line-info"}=this.options,{diffHeaderHeight:s,fileGap:a,hunkSeparatorHeight:l}=this.metrics,c=this.getDiffStyle(),d="simple"!==o&&"metadata"!==o&&"line-info-basic"!==o?a:0;if(t?"simple"!==o&&"metadata"!==o&&(this.height+=a):this.height+=s,!r&&(ll({diff:this.fileDiff,diffStyle:c,expandedHunks:!!n||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:e,collapsedBefore:t,collapsedAfter:n,deletionLine:r,additionLine:i})=>{let s=null!=i?i.splitLineIndex:r.splitLineIndex,a=null!=i?i.unifiedLineIndex:r.unifiedLineIndex,u=(i?.noEOFCR??!1)||(r?.noEOFCR??!1);t>0&&(e>0&&(this.height+=d),this.height+=l+d),this.height+=this.getLineHeight("split"===c?s:a,u),n>0&&"simple"!==o&&(this.height+=d+l)}}),this.fileDiff.hunks.length>0&&(this.height+=a),null!=this.fileContainer&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,...i}={}){let o=null==this.fileContainer;if(this.fileDiff??=r??(null!=t&&null!=n?lW(t,n):void 0),e=this.getOrCreateFileContainer(e),null==this.fileDiff)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(o?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let s=this.virtualizer.getWindowSpecs(),a=this.computeRenderRangeFromWindow(this.fileDiff,this.top,s);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:a,oldFile:t,newFile:n,...i})}getDiffStyle(){return this.options.diffStyle??"split"}getExpandedRegion(e,t,n){if(n<=0||e)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;if(r||n<=i)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};let o=this.hunksRenderer.getExpandedHunk(t),s=Math.min(Math.max(o.fromStart,0),n),a=Math.min(Math.max(o.fromEnd,0),n),l=s+a;return{fromStart:s,fromEnd:a,collapsedLines:Math.max(n-l,0),renderAll:l>=n}}getExpandedLineCount(e,t){var n;let r,i=0;if(e.isPartial){for(let n of e.hunks)i+="split"===t?n.splitLineCount:n.unifiedLineCount;return i}for(let[n,r]of e.hunks.entries()){i+="split"===t?r.splitLineCount:r.unifiedLineCount;let o=Math.max(r.collapsedBefore,0),{fromStart:s,fromEnd:a,renderAll:l}=this.getExpandedRegion(e.isPartial,n,o);o>0&&(i+=l?o:s+a)}let o=e.hunks.at(-1);if(null!=o&&null!=(r=(n=e).hunks.at(-1))&&!n.isPartial&&0!==n.additionLines.length&&0!==n.deletionLines.length&&(r.additionLineIndex+r.additionCount<n.additionLines.length||r.deletionLineIndex+r.deletionCount<n.deletionLines.length)){let t=e.additionLines.length-(o.additionLineIndex+o.additionCount),n=e.deletionLines.length-(o.deletionLineIndex+o.deletionCount);if(null!=o&&t!==n)throw Error(`VirtualizedFileDiff: trailing context mismatch (additions=${t}, deletions=${n}) for ${e.name}`);let r=Math.min(t,n);if(null!=o&&r>0){let{fromStart:t,renderAll:n}=this.getExpandedRegion(e.isPartial,e.hunks.length,r);i+=n?r:t}}return i}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let i,o,s,{disableFileHeader:a=!1,expandUnchanged:l=!1,collapsedContextThreshold:c=1,hunkSeparators:d="line-info"}=this.options,{diffHeaderHeight:u,fileGap:h,hunkLineCount:p,hunkSeparatorHeight:f,lineHeight:m}=this.metrics,g=this.getDiffStyle(),y=this.height,v=this.getExpandedLineCount(e,g),b=a?h:u;if(t<n-y||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:y-b-h};if(v<=p||0===e.hunks.length)return{startingLine:0,totalLines:p,bufferBefore:0,bufferAfter:0};let x=Math.ceil(Math.ceil(Math.max(r-n,0)/m)/p)*p+p,k=x/p,w=[],S=(n+r)/2,C="simple"===d||"metadata"===d||"line-info-basic"===d?0:h,N=t+b,A=0;if(ll({diff:e,diffStyle:g,expandedHunks:!!l||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:c,callback:({hunkIndex:e,collapsedBefore:a,collapsedAfter:l,deletionLine:c,additionLine:u})=>{let h=null!=u?u.splitLineIndex:c.splitLineIndex,m=null!=u?u.unifiedLineIndex:c.unifiedLineIndex,y=(u?.noEOFCR??!1)||(c?.noEOFCR??!1),v=a>0?f+C+(e>0?C:0):0;0===e&&"simple"===d&&(v=0),N+=v;let x=A%p==0;if(x&&(w.push(N-(t+b+v)),null!=s)){if(s<=0)return!0;s--}let E=this.getLineHeight("split"===g?h:m,y),M=Math.floor(A/p);return N>n-E&&N<r&&(i??=M),null==o&&N+E>S&&(o=M),null==s&&N>=r&&x&&(s=k),A++,N+=E,l>0&&"simple"!==d&&(N+=f+C),!1}}),null==i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:y-b-h};let E=w.length,M=Math.round((o??=i)-k/2),T=Math.max(0,Math.min(M,Math.max(0,E-k))),I=M<0?x+M*p:x,L=w[T]??0,O=T+I/p;return{startingLine:T*p,totalLines:I,bufferBefore:L,bufferAfter:O<w.length?y-b-w[O]-h:y-(N-t)-h}}};let lX=new Set,lY=new Set,lQ=null,lZ=!1;function l0(e){lZ?lX.add(e):(lY.add(e),lQ??=requestAnimationFrame(l1))}function l1(e){for(let t of(lZ=!0,lY))try{t(e)}catch(e){console.error(e)}lY.clear(),lX.size>0?(lY=new Set(lX),lX.clear(),lQ=requestAnimationFrame(l1)):lQ=null,lZ=!1}function l2({scrollTop:e,scrollHeight:t,height:n,containerOffset:r=0,fitPerfectly:i,overscrollSize:o}){let s=n+2*o,a=i?n:s;if(s>=(t=Math.max(t,a))||i){let n=Math.max(e-r,0);return{top:n,bottom:Math.max(Math.min(e+a,t)-r,n)}}let l=e+n/2-s/2,c=l+s;return l<0&&(l=0),c>t&&(c=t),{top:l=Math.floor(Math.max(l-r,0)),bottom:Math.ceil(Math.max(Math.min(c,t)-r,l))}}let l8=[0,1e-6,.99999,1],l5={overscrollSize:1e3,intersectionObserverMargin:4e3,resizeDebugging:!1},l6=0,l3=-1;function l4(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}(class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++l3}`;config;type="basic";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...l5,...e}}setup(t,n){if(null==this.root){for(let[r,i]of(this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:l8,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),l0(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)},this.connectQueue.entries()))this.connect(r,i);this.connectQueue.clear(),this.markDOMDirty(),l0(this.computeRenderRangeAndEmit)}}instanceChanged(e){this.instancesChanged.add(e),this.markDOMDirty(),l0(this.computeRenderRangeAndEmit)}getWindowSpecs(){return 0===this.windowSpecs.top&&0===this.windowSpecs.bottom&&(this.windowSpecs=l2({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin;return!(e<n-i-t||e>n+r+i)}handleContainerResize=e=>{if(null==this.root)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:e-l6,newSize:e}),l6=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:e-l6,newSize:e}),l6=e))}t&&l0(this.computeRenderRangeAndEmit)};setupWindow(){if(null==this.root||!(this.root instanceof Document))throw Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(null==this.root||this.root instanceof Document)throw Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),(e??=this.root.firstElementChild??void 0)instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+l4(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error("Virtualizer.connect: instance is already connected...");return null==this.intersectionObserver?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),l0(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),null!=t&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),l0(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,l0(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&null!=this.root&&this.root instanceof Document&&(this.scrollDirty=!0,l0(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||null==this.root||this.root instanceof Document||(this.scrollDirty=!0,l0(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&0===this.instancesChanged.size)return;if(0===this.instancesChanged.size){var n;let e=l2({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize});if(n=this.windowSpecs,(null==n||null==e?n===e:n.top===e.top&&n.bottom===e.bottom)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&0===this.instancesChanged.size)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)!i.has(e)&&e.onRender(t)&&i.add(e);for(let e of(this.scrollFix(r),this.instancesChanged.size>0&&this.markDOMDirty(),i))e.reconcileHeights();(this.instancesChanged.size>0||t)&&l0(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(null==e)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:o,fileTypeOffset:s}=e;if(null!=n&&null!=r){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=l4(e,t);n!==r&&this.applyScrollFix(n-r);return}}let a=l4(i,t);if("top"===s)a!==o&&this.applyScrollFix(a-o);else{let e=a+i.getBoundingClientRect().height;e!==o&&this.applyScrollFix(e-o)}}applyScrollFix(e){null==this.root||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){let t,n=this.getScrollContainerElement();for(let[r]of this.visibleInstances.entries()){let i,o,s,a,l=l4(r,n),c=l+r.offsetHeight;if(c<=0?(i=c,o="bottom"):(i=l,o="top"),c>0&&l<e)for(let e of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(e instanceof HTMLElement))continue;let t=e.dataset.lineIndex;if(null==t)continue;let r=l4(e,n);if(!(r<0)){s=t,a=r;break}}if(t?.lineOffset!=null&&null==a)continue;let d=!1;null==t||null!=a&&(null==t.lineOffset||a<t.lineOffset)?d=!0:null==a&&null==t.lineOffset&&(i>=0&&(t.fileOffset<0||i<t.fileOffset)?d=!0:i<0&&t.fileOffset<0&&i>t.fileOffset&&(d=!0)),d&&(t={fileElement:r,fileTypeOffset:o,fileOffset:i,lineIndex:s,lineOffset:a})}return t}handleIntersectionChange=e=>{for(let{target:t,isIntersecting:n}of(this.scrollDirty=!0,e)){if(!(t instanceof HTMLElement))throw Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");let e=this.observers.get(t);if(null==e)throw Error("Virtualizer.handleIntersectionChange: no instance for target");n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0)}this.visibleInstancesDirty&&l0(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=null==this.root?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty&&(this.scrollHeightDirty=!1,this.scrollHeight=null==this.root?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight),this.scrollHeight}getHeight(){return this.heightDirty&&(this.heightDirty=!1,this.height=null==this.root?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height),this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return null==this.root||this.root instanceof Document?void 0:this.root}});let l7=(0,et.createContext)(void 0);e.i(4135),Symbol("IGNORE_RESPONSE");let l9=(0,et.createContext)(void 0),ce="u"<typeof window?et.useEffect:et.useLayoutEffect;function ct(e,t){return t?{...e,renderGutterUtility:nk}:e}function cn({patch:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:o,style:s,prerenderedHTML:a,renderAnnotation:l,renderHeaderPrefix:c,renderHeaderMetadata:d,renderGutterUtility:u,renderHoverUtility:h}){var p,f;let m=(f=e,(0,et.useMemo)(()=>(function(e){let t=function(e,t,n=!1){let r=[];for(let t of e.split(t4))try{r.push(function(e,t,n=!1){let r,i=t7.test(e),o=e.split(i?t7:t9),s=[];for(let e of o){if(i&&!t7.test(e)||!i&&!t9.test(e)){if(null==r)r=e;else if(n)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",e);continue}let o=ng(e,{cacheKey:null!=t?`${t}-${s.length}`:void 0,isGitDiff:i,throwOnError:n});null!=o&&s.push(o)}return{patchMetadata:r,files:s}}(t,void 0,n))}catch(e){if(n)throw e;console.error(e)}return r}(e);if(1!==t.length)throw console.error(t),Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");let{files:n}=t[0];if(1!==n.length)throw console.error(n),Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]})(f),[f])),{ref:g,getHoveredLine:y}=function({oldFile:e,newFile:t,fileDiff:n,options:r,lineAnnotations:i,selectedLines:o,prerenderedHTML:s,metrics:a,hasGutterRenderUtility:l}){var c;let d,u=(0,et.useContext)(l7),h=(0,et.useContext)(l9),p=(0,et.useRef)(null),f=(c=o=>{if(null!=o){if(null!=p.current)throw Error("useFileDiffInstance: An instance should not already exist when a node is created");null!=u?p.current=new lJ(ct(r,l),u,a,h,!0):p.current=new lG(ct(r,l),h,!0),p.current.hydrate({fileDiff:n,oldFile:e,newFile:t,fileContainer:o,lineAnnotations:i,prerenderedHTML:s})}else{if(null==p.current)throw Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");p.current.cleanUp(),p.current=null}},d=(0,et.useRef)(c),(0,et.useInsertionEffect)(()=>void(d.current=c)),(0,et.useCallback)((...e)=>d.current(...e),[]));return ce(()=>{var s;let{current:a}=p;if(null==a)return;let c=ct(r,l),d=(s=a.options,!(le(s?.theme??nc,c?.theme??nc)&&function(e,t,n){if(e===t||null==e||null==t)return e===t;let r=new Set(n),i=Object.keys(e),o=new Set(Object.keys(t));for(let n of i)if(o.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(o))if(!r.has(e))return!1;return!0}(s,c,["theme"])));a.setOptions(c),a.render({forceRender:d,fileDiff:n,oldFile:e,newFile:t,lineAnnotations:i}),void 0!==o&&a.setSelectedLines(o)}),{ref:f,getHoveredLine:(0,et.useCallback)(()=>p.current?.getHoveredLine(),[])}}({fileDiff:m,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,hasGutterRenderUtility:null!=u||null!=h});return(0,ee.jsx)(t3,{ref:g,className:o,style:s,children:(p=function({fileDiff:e,actions:t,deletionFile:n,additionFile:r,renderHeaderPrefix:i,renderHeaderMetadata:o,renderAnnotation:s,renderGutterUtility:a,renderHoverUtility:l,renderMergeConflictUtility:c,lineAnnotations:d,getHoveredLine:u,getInstance:h}){let p=a??l,f=i?.({fileDiff:e,deletionFile:n,additionFile:r}),m=o?.({fileDiff:e,deletionFile:n,additionFile:r});return(0,ee.jsxs)(ee.Fragment,{children:[null!=f&&(0,ee.jsx)("div",{slot:na,children:f}),null!=m&&(0,ee.jsx)("div",{slot:nl,children:m}),null!=s&&d?.map((e,t)=>(0,ee.jsx)("div",{slot:nv(e),children:s(e)},t)),null!=t&&null!=c&&null!=h&&t.map(e=>{let t=function(e){let t=null!=e.incomingLineNumber?{side:"additions",lineNumber:e.incomingLineNumber}:null!=e.currentLineNumber?{side:"deletions",lineNumber:e.currentLineNumber}:void 0;return null!=t?function({side:e,lineNumber:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}({...t,conflictIndex:e.conflictIndex}):void 0}(e);return(0,ee.jsx)("div",{slot:t,style:nx,children:c(e,h)},t)}),null!=p&&(0,ee.jsx)("div",{slot:"gutter-utility-slot",style:nb,children:p(u)})]})}({fileDiff:m,renderHeaderPrefix:c,renderHeaderMetadata:d,renderAnnotation:l,lineAnnotations:r,renderGutterUtility:u,renderHoverUtility:h,getHoveredLine:y}),"u"<typeof window&&null!=a?(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:a}}),p]}):(0,ee.jsx)(ee.Fragment,{children:p}))})}var cr=et,ci=e.i(21957);class co extends cr.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}function cs({patch:e,diffStyle:t="split",preloaded:n}){let[r,i]=(0,cr.useState)(!1),{theme:o}=(0,ci.useTheme)(),s="light"!==o;if(!e.trim())return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"No changes"});let a=e.split("\n"),l=a.length>2e3&&!r,c=l?a.slice(0,2e3).join("\n"):e;return(0,ee.jsxs)("div",{className:"flex-1 overflow-auto",children:[l&&(0,ee.jsxs)("div",{className:"px-4 py-2 bg-[var(--surface)] border-b border-[var(--border)] flex items-center justify-between",children:[(0,ee.jsxs)("span",{className:"text-[var(--yellow)]",children:["showing first ",2e3," of ",a.length," lines"]}),(0,ee.jsx)("button",{onClick:()=>i(!0),className:"text-[var(--accent)] hover:underline",children:"show all"})]}),(0,ee.jsx)(co,{fallback:(0,ee.jsx)(ca,{patch:c}),children:(0,ee.jsx)(cr.Suspense,{fallback:(0,ee.jsx)(ca,{patch:c}),children:n?(0,ee.jsx)(cn,{patch:c,...n,className:"diff-container"}):(0,ee.jsx)(cn,{patch:c,options:{theme:s?"pierre-dark":"pierre-light",diffStyle:t,diffIndicators:"bars",overflow:"scroll",themeType:s?"dark":"light"},className:"diff-container"})})})]})}function ca({patch:e}){let t=e.split("\n").slice(0,500);return(0,ee.jsxs)("div",{className:"flex-1 overflow-auto p-4 font-mono text-xs leading-relaxed",children:[t.map((e,t)=>{let n="var(--fg)",r="var(--bg)";return e.startsWith("+")&&!e.startsWith("+++")?(n="var(--diff-add-text)",r="var(--diff-add-bg)"):e.startsWith("-")&&!e.startsWith("---")?(n="var(--diff-del-text)",r="var(--diff-del-bg)"):e.startsWith("@@")?n="var(--cyan)":(e.startsWith("diff ")||e.startsWith("index "))&&(n="var(--dim)"),(0,ee.jsx)("div",{style:{color:n,background:r,whiteSpace:"pre"},children:e||" "},t)}),t.length>=500&&(0,ee.jsx)("div",{style:{color:"var(--yellow)",padding:"8px 0"},children:"... truncated at 500 lines"})]})}function cl({files:e,selectedFile:t,onSelectFile:n}){return 0===e.length?(0,ee.jsx)("div",{className:"text-[var(--dim)] px-2 py-4",children:"No changed files"}):(0,ee.jsxs)("div",{children:[(0,ee.jsxs)("button",{onClick:()=>n(null),className:`w-full flex items-center h-6 px-2 text-left transition-colors ${null===t?"bg-[var(--surface-active)] text-[var(--accent)]":"text-[var(--dim)] hover:bg-[var(--surface-hover)] hover:text-[var(--fg)]"}`,children:[(0,ee.jsx)("span",{className:"flex-1 truncate",children:"All files"}),(0,ee.jsx)("span",{className:"shrink-0 text-[var(--dim)]",children:e.length})]}),e.map(e=>{let r=e.file.split("/").pop()??e.file,i=e.file.includes("/")?e.file.slice(0,e.file.lastIndexOf("/")+1):"",o=t===e.file;return(0,ee.jsxs)("button",{onClick:()=>n(e.file),className:`w-full flex items-center h-6 px-2 text-left transition-colors ${o?"bg-[var(--surface-active)]":"hover:bg-[var(--surface-hover)]"}`,children:[(0,ee.jsxs)("span",{className:"flex-1 min-w-0 truncate",children:[i&&(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:i}),(0,ee.jsx)("span",{className:o?"text-[var(--accent)]":"text-[var(--fg)]",children:r})]}),(0,ee.jsxs)("span",{className:"shrink-0 flex gap-1.5 ml-2",children:[e.additions>0&&(0,ee.jsxs)("span",{className:"text-[var(--green)]",children:["+",e.additions]}),e.deletions>0&&(0,ee.jsxs)("span",{className:"text-[var(--red)]",children:["-",e.deletions]})]})]},e.file)})]})}function cc({sessionName:e}){let{data:t,loading:n}=ei((0,et.useCallback)(()=>(0,er.fetchDiff)(e),[e]),5e3),[r,i]=(0,et.useState)(null),[o,s]=(0,et.useState)(""),[a,l]=(0,et.useState)("split"),[c,d]=(0,et.useState)(!1);(0,et.useEffect)(()=>{r?(d(!0),(0,er.fetchFileDiff)(e,r).then(e=>s(e)).catch(()=>s("")).finally(()=>d(!1))):s("")},[r,e]);let u=r?o:"";if(n&&!t)return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"Loading diffs…"});if(!t||!t.diff.trim())return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"No uncommitted changes"});let h=t.files.reduce((e,t)=>e+t.additions,0),p=t.files.reduce((e,t)=>e+t.deletions,0);return(0,ee.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,ee.jsxs)("div",{className:"flex items-center h-7 px-3 bg-[var(--surface)] border-b border-[var(--border)] shrink-0",children:[(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:[t.files.length," file",1!==t.files.length?"s":""," changed"]}),(0,ee.jsx)("span",{className:"mx-2 text-[var(--dim)] opacity-30",children:"│"}),(0,ee.jsxs)("span",{className:"text-[var(--green)]",children:["+",h]}),(0,ee.jsx)("span",{className:"mx-1 text-[var(--dim)] opacity-30",children:"/"}),(0,ee.jsxs)("span",{className:"text-[var(--red)]",children:["-",p]}),(0,ee.jsx)("span",{className:"flex-1"}),(0,ee.jsxs)("div",{className:"flex border border-[var(--border)] rounded overflow-hidden",children:[(0,ee.jsx)("button",{onClick:()=>l("split"),className:`px-2 h-5 text-[11px] transition-colors ${"split"===a?"bg-[var(--surface-active)] text-[var(--fg)]":"text-[var(--dim)] hover:text-[var(--fg)]"}`,children:"split"}),(0,ee.jsx)("button",{onClick:()=>l("unified"),className:`px-2 h-5 text-[11px] transition-colors ${"unified"===a?"bg-[var(--surface-active)] text-[var(--fg)]":"text-[var(--dim)] hover:text-[var(--fg)]"}`,children:"unified"})]})]}),(0,ee.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,ee.jsx)("div",{className:"w-[260px] shrink-0 border-r border-[var(--border)] overflow-y-auto",children:(0,ee.jsx)(cl,{files:t.files,selectedFile:r,onSelectFile:i})}),r&&u?(0,ee.jsx)(cs,{patch:u,diffStyle:a}):c?(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"loading diff..."}):(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"select a file to view diff"})]})]})}let cd={dispatch:{icon:">",color:"var(--accent)"},completion:{icon:"✓",color:"var(--green)"},stall:{icon:"!",color:"var(--yellow)"},retry:{icon:"~",color:"var(--yellow)"},reconcile:{icon:"×",color:"var(--red)"},error:{icon:"✗",color:"var(--red)"},task_created:{icon:"+",color:"var(--dim)"},status_change:{icon:"—",color:"var(--dim)"}},cu={icon:"·",color:"var(--dim)"};function ch({events:e,maxEvents:t=50}){let n=(0,et.useRef)(null),r=(0,et.useRef)(0);if((0,et.useEffect)(()=>{e.length>r.current&&n.current&&(n.current.scrollTop=0),r.current=e.length},[e.length]),0===e.length)return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"No activity yet"});let i=e.filter(e=>"agent_heartbeat"!==e.type).slice(0,t);return(0,ee.jsx)("div",{ref:n,className:"flex-1 overflow-y-auto py-1",children:i.map((e,t)=>{let{icon:n,color:r}=cd[e.type]??cu;return(0,ee.jsxs)("div",{className:"flex items-start h-6 px-3 hover:bg-[var(--surface-hover)]",children:[(0,ee.jsx)("span",{className:"w-[10ch] shrink-0 text-right text-[var(--dim)] pr-2",children:e.relative??""}),(0,ee.jsx)("span",{className:"w-3 shrink-0 text-center",style:{color:r},children:n}),(0,ee.jsx)("span",{className:"flex-1 truncate pl-1 text-[var(--fg)]",children:function(e){if(e.message)return e.message;let t=[];return e.agent&&t.push(e.agent),"dispatch"===e.type&&t.push("dispatched"),"completion"===e.type&&t.push("completed"),"stall"===e.type&&t.push("stalled on"),"retry"===e.type&&t.push("retrying"),"reconcile"===e.type&&t.push("released"),e.taskId&&t.push(`task ${e.taskId}`),t.join(" ")}(e)})]},`${e.timestamp}-${t}`)})})}function cp(){}function cf(){}let cm=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cg=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cy={};function cv(e,t){return((t||cy).jsx?cg:cm).test(e)}let cb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var cx=e.i(63185);let ck=cS("end"),cw=cS("start");function cS(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function cC(e){return e&&"object"==typeof e?"position"in e||"type"in e?cA(e.position):"start"in e||"end"in e?cA(e):"line"in e||"column"in e?cN(e):"":""}function cN(e){return cE(e&&e.line)+":"+cE(e&&e.column)}function cA(e){return cN(e&&e.start)+"-"+cN(e&&e.end)}function cE(e){return e&&"number"==typeof e?e:1}class cM extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},o=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(o=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=s?s.line:void 0,this.name=cC(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}cM.prototype.file="",cM.prototype.name="",cM.prototype.reason="",cM.prototype.message="",cM.prototype.stack="",cM.prototype.column=void 0,cM.prototype.line=void 0,cM.prototype.ancestors=void 0,cM.prototype.cause=void 0,cM.prototype.fatal=void 0,cM.prototype.place=void 0,cM.prototype.ruleId=void 0,cM.prototype.source=void 0;let cT={}.hasOwnProperty,cI=new Map,cL=/[A-Z]/g,cO=new Set(["table","tbody","thead","tfoot","tr"]),cD=new Set(["td","th"]),cR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cP(e,t,n){var r,i,o,s,a,l,c,d,u;let h,p,f,m,g,y,v,b,x,k,w;return"element"===t.type?(r=e,i=t,o=n,p=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=n1),r.ancestors.push(i),f=cz(r,i.tagName,!1),m=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&cT.call(t.properties,r)){let o=function(e,t,n){let r=ry(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?rp(n):rx(n)),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,cx.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new cM("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=cR+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)cT.call(e,t)&&(n[function(e){let t=e.replace(cL,cF);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?cb[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(o){let[r,s]=o;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof s&&cD.has(t.tagName)?n=s:i[r]=s}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),g=cB(r,i),cO.has(i.tagName)&&(g=g.filter(function(e){return"string"!=typeof e||!rw(e)})),c_(r,m,f,i),cj(m,g),r.ancestors.pop(),r.schema=h,r.create(i,f,m,o)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return cp("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}c$(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(s=e,a=t,l=n,v=y=s.schema,"svg"===a.name&&"html"===y.space&&(s.schema=n1),s.ancestors.push(a),b=null===a.name?s.Fragment:cz(s,a.name,!0),x=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];cp("ExpressionStatement"===t.type);let i=t.expression;cp("ObjectExpression"===i.type);let o=i.properties[0];cp("SpreadElement"===o.type),Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else c$(e,t.position);else{let i,o=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];cp("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else c$(e,t.position);else i=null===r.value||r.value;n[o]=i}return n}(s,a),k=cB(s,a),c_(s,x,b,a),cj(x,k),s.ancestors.pop(),s.schema=y,s.create(a,b,x,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);c$(e,t.position)}(e,t):"root"===t.type?(c=e,d=t,u=n,cj(w={},cB(c,d)),c.create(d,c.Fragment,w,u)):"text"===t.type?t.value:void 0}function c_(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cj(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function cB(e,t){let n=[],r=-1,i=e.passKeys?new Map:cI;for(;++r<t.children.length;){let o,s=t.children[r];if(e.passKeys){let e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){let t=i.get(e)||0;o=e+"-"+t,i.set(e,t+1)}}let a=cP(e,s,o);void 0!==a&&n.push(a)}return n}function cz(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=cv(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}cp(e,"always a result"),r=e}else r=cv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return cT.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);c$(e)}function c$(e,t){let n=new cM("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=cR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function cF(e){return"-"+e.toLowerCase()}let cU={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},cH={};function cW(e,t){let n=t||cH;return cV(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function cV(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return cG(e.children,t,n)}return Array.isArray(e)?cG(e,t,n):""}function cG(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=cV(e[i],t,n);return r.join("")}function cq(e,t,n,r){let i,o=e.length,s=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)(i=r.slice(s,s+1e4)).unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function cK(e,t){return e.length>0?(cq(e,e.length,0,t),e):t}let cJ={}.hasOwnProperty,cX=c7(/[A-Za-z]/),cY=c7(/[\dA-Za-z]/),cQ=c7(/[#-'*+\--9=?A-Z^-~]/);function cZ(e){return null!==e&&(e<32||127===e)}let c0=c7(/\d/),c1=c7(/[\dA-Fa-f]/),c2=c7(/[!-/:-@[-`{-~]/);function c8(e){return null!==e&&e<-2}function c5(e){return null!==e&&(e<0||32===e)}function c6(e){return -2===e||-1===e||32===e}let c3=c7(/\p{P}|\p{S}/u),c4=c7(/\s/);function c7(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function c9(e,t,n,r){let i=r?r-1:1/0,o=0;return function(r){return c6(r)?(e.enter(n),function r(s){return c6(s)&&o++<i?(e.consume(s),r):(e.exit(n),t(s))}(r)):t(r)}}let de={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),c9(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return c8(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},dt={tokenize:function(e){let t,n,r,i=this,o=[],s=0;return a;function a(t){if(s<o.length){let n=o[s];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(s++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&y();let r=i.events.length,o=r;for(;o--;)if("exit"===i.events[o][0]&&"chunkFlow"===i.events[o][1].type){n=i.events[o][1].end;break}g(s);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return cq(i.events,o+1,0,i.events.slice(r)),i.events.length=a,c(e)}return a(e)}function c(n){if(s===o.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(dn,d,u)(n)}function d(e){return t&&y(),g(s),h(e)}function u(e){return i.parser.lazy[i.now().line]=s!==o.length,r=i.now().offset,f(e)}function h(t){return i.containerState={},e.attempt(dn,p,f)(t)}function p(e){return s++,o.push([i.currentConstruct,i.containerState]),h(e)}function f(r){if(null===r){t&&y(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return c8(n)?(e.consume(n),m(e.exit("chunkFlow")),s=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,o){let a=i.sliceStream(e);if(o&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,o=t.events.length;for(;o--;)if(t.events[o][1].start.offset<r&&(!t.events[o][1].end||t.events[o][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(s),o=a;o<i.events.length;)i.events[o][1].end={...n},o++;cq(i.events,l+1,0,i.events.slice(a)),i.events.length=o}}function g(t){let n=o.length;for(;n-- >t;){let t=o[n];i.containerState=t[1],t[0].exit.call(i,e)}o.length=t}function y(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},dn={tokenize:function(e,t,n){return c9(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},dr={partial:!0,tokenize:function(e,t,n){return function(t){return c6(t)?c9(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||c8(e)?t(e):n(e)}}};class di{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&ds(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),ds(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ds(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);ds(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ds(this.left,t.reverse())}}}function ds(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function da(e){let t,n,r,i,o,s,a,l={},c=-1,d=new di(e);for(;++c<d.length;){for(;c in l;)c=l[c];if(t=d.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===d.get(c-1)[1].type&&((r=0)<(s=t[1]._tokenizer.events).length&&"lineEndingBlank"===s[r][1].type&&(r+=2),r<s.length&&"content"===s[r][1].type))for(;++r<s.length&&"content"!==s[r][1].type;)"chunkText"===s[r][1].type&&(s[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],o=e.get(t)[2],s=t-1,a=[],l=i._tokenizer;!l&&(l=o.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,d=[],u={},h=-1,p=i,f=0,m=0,g=[0];for(;p;){for(;e.get(++s)[1]!==p;);a.push(s),!p._tokenizer&&(n=o.sliceStream(p),p.next||n.push(null),r&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=p,p=p.next}for(p=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){let t=c.slice(g[h],g[h+1]),n=a.pop();d.push([n,n+t.length-1]),e.splice(n,2,t)}for(d.reverse(),h=-1;++h<d.length;)u[f+d[h][0]]=f+d[h][1],f+=d[h][1]-d[h][0]-1;return u}(d,c)),c=l[c],a=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=d.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(d.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...d.get(n)[1].start},(o=d.slice(n,c)).unshift(t),d.splice(n,c-n+1,o))}}return cq(e,0,1/0,d.slice(0)),!a}let dl={resolve:function(e){return da(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):c8(t)?e.check(dc,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},dc={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),c9(e,i,"linePrefix")};function i(i){if(null===i||c8(i))return n(i);let o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},dd={tokenize:function(e){let t=this,n=e.attempt(dr,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,c9(e,e.attempt(this.parser.constructs.flow,r,e.attempt(dl,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},du={resolveAll:dm()},dh=df("string"),dp=df("text");function df(e){return{resolveAll:dm("text"===e?dg:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return l(e)?i(e):s(e)}function s(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function dm(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function dg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],o=t.sliceStream(i),s=o.length,a=-1,l=0;for(;s--;){let e=o[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let o={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:i.start._bufferIndex+a,_index:i.start._index+s,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...o.start},i.start.offset===i.end.offset?Object.assign(i,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}function dy(e){return null===e||c5(e)||c4(e)?1:c3(e)?2:void 0}function dv(e,t,n){let r=[],i=-1;for(;++i<e.length;){let o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}let db={name:"attention",resolveAll:function(e,t){let n,r,i,o,s,a,l,c,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close){for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;let u={...e[n][1].end},h={...e[d][1].start};dx(u,-a),dx(h,a),o={type:a>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},s={type:a>1?"strongSequence":"emphasisSequence",start:{...e[d][1].start},end:h},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[d][1].start}},r={type:a>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[n][1].end={...o.start},e[d][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=cK(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=cK(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=cK(l,dv(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),l=cK(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[d][1].end.offset-e[d][1].start.offset?(c=2,l=cK(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):c=0,cq(e,n-1,d-n+3,l),d=n+l.length-c-2;break}}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=dy(i);return function(s){return n=s,e.enter("attentionSequence"),function s(a){if(a===n)return e.consume(a),s;let l=e.exit("attentionSequence"),c=dy(a),d=!c||2===c&&o||r.includes(a),u=!o||2===o&&c||r.includes(i);return l._open=!!(42===n?d:d&&(o||!u)),l._close=!!(42===n?u:u&&(c||!d)),t(a)}(s)}}};function dx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let dk={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return c6(t)?c9(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(dk,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return c6(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},dw={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return c2(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},dS=document.createElement("i");function dC(e){let t="&"+e+";";dS.innerHTML=t;let n=dS.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let dN={name:"characterReference",tokenize:function(e,t,n){let r,i,o=this,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=cY,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=c1,c):(e.enter("characterReferenceValue"),r=7,i=c0,c(t))}function c(a){if(59===a&&s){let r=e.exit("characterReferenceValue");return i!==cY||dC(o.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&s++<r?(e.consume(a),c):n(a)}}},dA={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},dE={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,o={partial:!0,tokenize:function(e,t,n){let o=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),c6(t)?c9(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(o++,e.consume(i),t):o>=a?(e.exit("codeFencedFenceSequence"),c6(i)?c9(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||c8(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},s=0,a=0;return function(t){var o;let c;return o=t,s=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=o,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),c6(i)?c9(e,l,"whitespace")(i):l(i))}(o)};function l(o){return null===o||c8(o)?(e.exit("codeFencedFence"),i.interrupt?t(o):e.check(dA,d,f)(o)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||c8(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):c6(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c9(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(o))}function c(t){return null===t||c8(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||c8(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function d(t){return e.attempt(o,f,u)(t)}function u(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return s>0&&c6(t)?c9(e,p,"linePrefix",s+1)(t):p(t)}function p(t){return null===t||c8(t)?e.check(dA,d,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||c8(n)?(e.exit("codeFlowValue"),p(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},dM={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),c9(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?o(n):c8(n)?e.attempt(dT,t,o)(n):(e.enter("codeFlowValue"),function n(r){return null===r||c8(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function o(n){return e.exit("codeIndented"),t(n)}}},dT={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):c8(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):c9(e,o,"linePrefix",5)(t)}function o(e){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):c8(e)?i(e):n(e)}}};function dI(e,t,n,r,i,o,s,a,l){let c=l||1/0,d=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),u):null===t||32===t||41===t||cZ(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),u(t)):null===t||60===t||c8(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return!d&&(null===i||41===i||c5(i))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i)):d<c&&40===i?(e.consume(i),d++,f):41===i?(e.consume(i),d--,f):null===i||32===i||40===i||cZ(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function dL(e,t,n,r,i,o){let s,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(u){return l>999||null===u||91===u||93===u&&!s||94===u&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):93===u?(e.exit(o),e.enter(i),e.consume(u),e.exit(i),e.exit(r),t):c8(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(u))}function d(t){return null===t||91===t||93===t||c8(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),s||(s=!c6(t)),92===t?u:d)}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,d):d(t)}}function dO(e,t,n,r,i,o){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a):n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),l(n))}function l(t){return t===s?(e.exit(o),a(s)):null===t?n(t):c8(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),c9(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||c8(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?d:c)}function d(t){return t===s||92===t?(e.consume(t),c):c(t)}}function dD(e,t){let n;return function r(i){return c8(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):c6(i)?c9(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function dR(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let dP={partial:!0,tokenize:function(e,t,n){return function(t){return c5(t)?dD(e,r)(t):n(t)};function r(t){return dO(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return c6(t)?c9(e,o,"whitespace")(t):o(t)}function o(e){return null===e||c8(e)?t(e):n(e)}}},d_=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dj=["pre","script","style","textarea"],dB={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(dr,t,n)}}},dz={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return c8(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},d$={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&cq(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,o,s=e.length,a=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=s);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return o=cK(o=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+a+3)),o=cK(o,[["enter",d,t]]),o=cK(o,dv(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),o=cK(o,[["exit",d,t],e[i-2],e[i-1],["exit",c,t]]),o=cK(o,e.slice(i+1)),o=cK(o,[["exit",l,t]]),cq(e,r,e.length,o),e},tokenize:function(e,t,n){let r,i,o=this,s=o.events.length;for(;s--;)if(("labelImage"===o.events[s][1].type||"labelLink"===o.events[s][1].type)&&!o.events[s][1]._balanced){r=o.events[s][1];break}return function(t){return r?r._inactive?d(t):(i=o.parser.defined.includes(dR(o.sliceSerialize({start:r.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(dF,c,i?c:d)(t):91===t?e.attempt(dU,c,i?l:d)(t):i?c(t):d(t)}function l(t){return e.attempt(dH,c,d)(t)}function c(e){return t(e)}function d(e){return r._balanced=!0,n(e)}}},dF={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return c5(t)?dD(e,i)(t):i(t)}function i(t){return 41===t?c(t):dI(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return c5(t)?dD(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?dO(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return c5(t)?dD(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},dU={tokenize:function(e,t,n){let r=this;return function(t){return dL.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(dR(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},dH={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},dW={name:"labelStartImage",resolveAll:d$.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},dV={name:"labelStartLink",resolveAll:d$.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},dG={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),c9(e,t,"linePrefix")}}},dq={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(o){var s;return e.enter("thematicBreak"),r=s=o,function o(s){return s===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),c6(n)?c9(e,o,"whitespace")(n):o(n))}(s)):i>=3&&(null===s||c8(s))?(e.exit("thematicBreak"),t(s)):n(s)}(s)}}},dK={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(dr,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,c9(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!c6(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dX,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,c9(e,e.attempt(dK,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:c0(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(dq,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return c0(i)&&++s<10?(e.consume(i),t):(!r.interrupt||s<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(dr,r.interrupt?n:l,e.attempt(dJ,d,c))}function l(e){return r.containerState.initialBlankLine=!0,o++,d(e)}function c(t){return c6(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},dJ={partial:!0,tokenize:function(e,t,n){let r=this;return c9(e,function(e){let i=r.events[r.events.length-1];return!c6(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},dX={partial:!0,tokenize:function(e,t,n){let r=this;return c9(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},dY={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s,e.push(["exit",s,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var s;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,s=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),c6(n)?c9(e,o,"lineSuffix")(n):o(n))}(s)):n(t)};function o(r){return null===r||c8(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,dL.call(i,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function o(t){return(r=dR(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return c5(t)?dD(e,a)(t):a(t)}function a(t){return dI(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(dP,c,c)(t)}function c(t){return c6(t)?c9(e,d,"whitespace")(t):d(t)}function d(o){return null===o||c8(o)?(e.exit("definition"),i.parser.defined.push(r),t(o)):n(o)}}}},"disable",0,{null:[]},"document",0,{42:dK,43:dK,45:dK,48:dK,49:dK,50:dK,51:dK,52:dK,53:dK,54:dK,55:dK,56:dK,57:dK,62:dk},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,o=3;return"whitespace"===e[3][1].type&&(o+=2),i-2>o&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4),i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},cq(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var o;return e.enter("atxHeading"),o=i,e.enter("atxHeadingSequence"),function i(o){return 35===o&&r++<6?(e.consume(o),i):null===o||c5(o)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||c8(r)?(e.exit("atxHeading"),t(r)):c6(r)?c9(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||c5(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(o)):n(o)}(o)}}},42:dq,45:[dY,dq],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,o,s,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(s){return 33===s?(e.consume(s),d):47===s?(e.consume(s),i=!0,p):63===s?(e.consume(s),r=3,l.interrupt?t:O):cX(s)?(e.consume(s),o=String.fromCharCode(s),f):n(s)}function d(i){return 45===i?(e.consume(i),r=2,u):91===i?(e.consume(i),r=5,s=0,h):cX(i)?(e.consume(i),r=4,l.interrupt?t:O):n(i)}function u(r){return 45===r?(e.consume(r),l.interrupt?t:O):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(s++)?(e.consume(r),s===i.length)?l.interrupt?t:C:h:n(r)}function p(t){return cX(t)?(e.consume(t),o=String.fromCharCode(t),f):n(t)}function f(s){if(null===s||47===s||62===s||c5(s)){let a=47===s,c=o.toLowerCase();return!a&&!i&&dj.includes(c)?(r=1,l.interrupt?t(s):C(s)):d_.includes(o.toLowerCase())?(r=6,a)?(e.consume(s),m):l.interrupt?t(s):C(s):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(s):i?function t(n){return c6(n)?(e.consume(n),t):w(n)}(s):g(s))}return 45===s||cY(s)?(e.consume(s),o+=String.fromCharCode(s),f):n(s)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:C):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||cX(t)?(e.consume(t),y):c6(t)?(e.consume(t),g):w(t)}function y(t){return 45===t||46===t||58===t||95===t||cY(t)?(e.consume(t),y):v(t)}function v(t){return 61===t?(e.consume(t),b):c6(t)?(e.consume(t),v):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,x):c6(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||c5(n)?v(n):(e.consume(n),t)}(t)}function x(t){return t===a?(e.consume(t),a=null,k):null===t||c8(t)?n(t):(e.consume(t),x)}function k(e){return 47===e||62===e||c6(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),S):n(t)}function S(t){return null===t||c8(t)?C(t):c6(t)?(e.consume(t),S):n(t)}function C(t){return 45===t&&2===r?(e.consume(t),M):60===t&&1===r?(e.consume(t),T):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),O):93===t&&5===r?(e.consume(t),L):c8(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(dB,R,N)(t)):null===t||c8(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),C)}function N(t){return e.check(dz,A,R)(t)}function A(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),E}function E(t){return null===t||c8(t)?N(t):(e.enter("htmlFlowData"),C(t))}function M(t){return 45===t?(e.consume(t),O):C(t)}function T(t){return 47===t?(e.consume(t),o="",I):C(t)}function I(t){if(62===t){let n=o.toLowerCase();return dj.includes(n)?(e.consume(t),D):C(t)}return cX(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),I):C(t)}function L(t){return 93===t?(e.consume(t),O):C(t)}function O(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),O):C(t)}function D(t){return null===t||c8(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),D)}function R(n){return e.exit("htmlFlow"),t(n)}}},61:dY,95:dq,96:dE,126:dE},"flowInitial",0,{[-2]:dM,[-1]:dM,32:dM},"insideSpan",0,{null:[db,du]},"string",0,{38:dN,92:dw},"text",0,{[-5]:dG,[-4]:dG,[-3]:dG,33:dW,38:dN,42:db,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return cX(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(t){return 43===t||45===t||46===t||cY(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,s):(43===n||45===n||46===n||cY(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||cZ(r)?n(r):(e.consume(r),s)}function a(t){return 64===t?(e.consume(t),l):cQ(t)?(e.consume(t),a):n(t)}function l(i){return cY(i)?function i(o){return 46===o?(e.consume(o),r=0,l):62===o?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(o){if((45===o||cY(o))&&r++<63){let n=45===o?t:i;return e.consume(o),n}return n(o)}(o)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,o,s=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),v):cX(t)?(e.consume(t),w):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,p):cX(t)?(e.consume(t),y):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function d(t){return null===t?n(t):45===t?(e.consume(t),u):c8(t)?(o=d,I(t)):(e.consume(t),d)}function u(t){return 45===t?(e.consume(t),h):d(t)}function h(e){return 62===e?T(e):45===e?u(e):d(e)}function p(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):c8(t)?(o=f,I(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?T(t):93===t?(e.consume(t),g):f(t)}function y(t){return null===t||62===t?T(t):c8(t)?(o=y,I(t)):(e.consume(t),y)}function v(t){return null===t?n(t):63===t?(e.consume(t),b):c8(t)?(o=v,I(t)):(e.consume(t),v)}function b(e){return 62===e?T(e):v(e)}function x(t){return cX(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||cY(t)?(e.consume(t),k):function t(n){return c8(n)?(o=t,I(n)):c6(n)?(e.consume(n),t):T(n)}(t)}function w(t){return 45===t||cY(t)?(e.consume(t),w):47===t||62===t||c5(t)?S(t):n(t)}function S(t){return 47===t?(e.consume(t),T):58===t||95===t||cX(t)?(e.consume(t),C):c8(t)?(o=S,I(t)):c6(t)?(e.consume(t),S):T(t)}function C(t){return 45===t||46===t||58===t||95===t||cY(t)?(e.consume(t),C):function t(n){return 61===n?(e.consume(n),N):c8(n)?(o=t,I(n)):c6(n)?(e.consume(n),t):S(n)}(t)}function N(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,A):c8(t)?(o=N,I(t)):c6(t)?(e.consume(t),N):(e.consume(t),E)}function A(t){return t===r?(e.consume(t),r=void 0,M):null===t?n(t):c8(t)?(o=A,I(t)):(e.consume(t),A)}function E(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||c5(t)?S(t):(e.consume(t),E)}function M(e){return 47===e||62===e||c5(e)?S(e):n(e)}function T(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function I(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),L}function L(t){return c6(t)?c9(e,O,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),o(t)}}}],91:dV,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return c8(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},dw],93:d$,95:db,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),o++,t):(e.exit("codeTextSequence"),s(n))}(t)};function s(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),s):96===l?(i=e.enter("codeTextSequence"),r=0,function n(s){return 96===s?(e.consume(s),r++,n):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(s)):(i.type="codeTextData",a(s))}(l)):c8(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||c8(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),a)}}}}],19210);var dQ=e.i(19210);let dZ=/[\0\t\n\r]/g;function d0(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let d1=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function d2(e){return e.replace(d1,d8)}function d8(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return d0(n.slice(t?2:1),t?16:10)}return dC(n)||e}let d5={}.hasOwnProperty;function d6(e){return{line:e.line,column:e.column,offset:e.offset}}function d3(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+cC({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cC({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+cC({start:t.start,end:t.end})+") is still open")}function d4(e){let t=this;t.parser=function(n){var r,i;let o,s,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(y),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(p),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(p,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:c,htmlText:r(g,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(y),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(v,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(v),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:s(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:s(),autolinkEmail:function(e){d.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){d.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:s(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=d0(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=dC(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=d6(e.end)},codeFenced:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:d,codeIndented:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:d,data:d,definition:s(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=dR(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:s(),hardBreakEscape:s(u),hardBreakTrailing:s(u),htmlFlow:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:d,htmlText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:d,image:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=d2(t),n.identifier=dR(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=d6(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),d.call(this,e))},link:s(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=dR(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:s(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:s(),thematicBreak:s()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(d5.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},s={stack:[r],tokenStack:[],config:t,enter:o,exit:a,buffer:i,resume:l,data:n},c=[],d=-1;for(;++d<e.length;)("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)&&("enter"===e[d][0]?c.push(d):d=function(e,t,n){let r,i,o,s,a=t-1,l=-1,c=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||o||(o=a),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){let t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,o=void 0,s=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];d5.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},s),e[d][1])}if(s.tokenStack.length>0){let e=s.tokenStack[s.tokenStack.length-1];(e[1]||d3).call(s,void 0,e[0])}for(r.position={start:d6(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:d6(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r};function r(e,t){return function(n){o.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function o(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:d6(t.start),end:void 0}}function s(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||d3).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+cC({start:e.start,end:e.end})+"): it’s not open");n.position.end=d6(e.end)}function l(){return cW(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:d6(e.start),end:void 0},t.push(n)),this.stack.push(n)}function d(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=d6(e.end)}function u(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function v(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!da(e););return e}((function(e){let t={constructs:function(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(cJ.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];if(o)for(r in o){cJ.call(i,r)||(i[r]=[]);let e=o[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);cq(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}([dQ,...(e||{}).extensions||[]]),content:n(de),defined:[],document:n(dt),flow:n(dd),lazy:{},string:n(dh),text:n(dp)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},o=[],s=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(p),consume:function(e){c8(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:f(p,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let o,s=e[r];if("string"==typeof s)o=s;else switch(s){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=t?" ":" ";break;case -1:if(!t&&n)continue;o=" ";break;default:o=String.fromCharCode(s)}n=-2===s,i.push(o)}return i.join("")}(u(e),t)},sliceStream:u,write:function(e){return(s=cK(s,e),function(){let e;for(;r._index<s.length;){let n=s[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),d=d(t)}else d=d(n)}}(),null!==s[s.length-1])?[]:(m(t,0),c.events=dv(o,c.events,c),c.events)}},d=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function u(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;if(r===o)n=[e[r].slice(i,s)];else{if(n=e.slice(r,o),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[o].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:o}}function p(e,t){t.restore()}function f(e,t){return function(n,i,o){var s;let d,u,p,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(s=n,function(e){let t=null!==e&&s[e],n=null!==e&&s.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(d=e,u=0,0===e.length)?o:y(e[u])}function y(e){return function(n){let i,o,s,d,u;return(i=h(),o=c.previous,s=c.currentConstruct,d=c.events.length,u=Array.from(a),f={from:d,restore:function(){r=i,c.previous=o,c.currentConstruct=s,c.events.length=d,a=u,g()}},p=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,v,b)(n)}}function v(t){return e(p,f),i}function b(e){return(f.restore(),++u<d.length)?y(d[u]):o}}}function m(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&cq(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((s=1,a="",l=!0,function(e,t,n){let r,i,c,d,u,h=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,a="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(dZ.lastIndex=c,d=(r=dZ.exec(e))&&void 0!==r.index?r.index:e.length,u=e.charCodeAt(d),!r){a=e.slice(c);break}if(10===u&&c===d&&o)h.push(-3),o=void 0;else switch(o&&(h.push(-5),o=void 0),c<d&&(h.push(e.slice(c,d)),s+=d-c),u){case 0:h.push(65533),s++;break;case 9:for(i=4*Math.ceil(s/4),h.push(-2);s++<i;)h.push(-1);break;case 10:h.push(-4),s=1;break;default:o=!0,s=1}c=d+1}return n&&(o&&h.push(-5),a&&h.push(a),h.push(null)),h})(n,r,!0))))}}let d7="object"==typeof self?self:globalThis,d9=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[o,s]=e[i];switch(o){case 0:case -1:return n(s,i);case 1:{let e=n([],i);for(let t of s)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),i);case 4:{let{source:e,flags:t}=s;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of s)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of s)e.add(r(t));return e}case 7:{let{name:e,message:t}=s;return n(new d7[e](t),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:e}=new Uint8Array(s);return n(new DataView(e),s)}}return n(new d7[o](s),i)})(0)},{toString:ue}={},{keys:ut}=Object,un=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=ue.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},ur=([e,t])=>0===e&&("function"===t||"symbol"===t),ui=(e,{json:t,lossy:n}={})=>{var r,i,o;let s,a,l=[];return(r=!(t||n),i=!!t,o=new Map,s=(e,t)=>{let n=l.push(e)-1;return o.set(t,n),n},a=e=>{if(o.has(e))return o.get(e);let[t,n]=un(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return s([-1],e)}return s([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),s([n,[...t]],e)}let r=[],i=s([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return s([n,e.toString()],e);case"Boolean":case"Number":case"String":return s([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let o=[],l=s([t,o],e);for(let t of ut(e))(r||!ur(un(e[t])))&&o.push([a(t),a(e[t])]);return l}case 3:return s([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return s([t,{source:n,flags:r}],e)}case 5:{let n=[],i=s([t,n],e);for(let[t,i]of e)(r||!(ur(un(t))||ur(un(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=s([t,n],e);for(let t of e)(r||!ur(un(t)))&&n.push(a(t));return i}}let{message:l}=e;return s([t,{name:n,message:l}],e)})(e),l},uo="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?d9(ui(e,t)):structuredClone(e):(e,t)=>d9(ui(e,t));function us(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let o=e.charCodeAt(n),s="";if(37===o&&cY(e.charCodeAt(n+1))&&cY(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){let t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(s=String.fromCharCode(o,t),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ua(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ul(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let uc=function(e){var t,n;if(null==e)return uu;if("function"==typeof e)return ud(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=uc(e[n]);return ud(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,ud(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,ud(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function ud(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function uu(){return!0}let uh=[],up="skip";function uf(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let o=uc(i),s=r?-1:1;(function e(i,a,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(d,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return d;function d(){var c;let d,u,h,p=uh;if((!t||o(i,a,l[l.length-1]||void 0))&&!1===(p=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?uh:[c])[0])return p;if("children"in i&&i.children&&i.children&&p[0]!==up)for(u=(r?i.children.length:-1)+s,h=l.concat(i);u>-1&&u<i.children.length;){if(!1===(d=e(i.children[u],u,h)())[0])return d;u="number"==typeof d[1]?d[1]:u+s}return p}})(e,void 0,[])()}function um(e,t,n,r){let i,o,s;"function"==typeof t&&"function"!=typeof n?(o=void 0,s=t,i=n):(o=t,s=n,i=r),uf(e,o,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return s(e,r,n)},i)}function ug(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});let s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function uy(e){let t=e.spread;return null==t?e.children.length>1:t}function uv(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let ub={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(t,o)]},e.patch(t,o),o},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),o=us(i.toLowerCase()),s=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=s+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ug(e,t);let i={src:us(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){let n={src:us(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ug(e,t);let i={href:us(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){let n={href:us(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=uy(n[r])}return t}(n):uy(t),o={},s=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&s.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=cw(t.children[1]),s=ck(t.children[t.children.length-1]);o&&s&&(r.position={start:o,end:s}),i.push(r)}let o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,s=o?o.length:t.children.length,a=-1,l=[];for(;++a<s;){let n=t.children[a],r={},s=o?o[a]:void 0;s&&(r.align=s);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,o=[];for(;r;)o.push(uv(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(uv(t.slice(i),i>0,!1)),o.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:ux,yaml:ux,definition:ux,footnoteDefinition:ux};function ux(){}let uk={}.hasOwnProperty,uw={};function uS(e,t){e.position&&(t.position=function(e){let t=cw(e),n=ck(e);if(t&&n)return{start:t,end:n}}(e))}function uC(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,uo(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function uN(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function uA(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function uE(e,t){let n,r,i,o,s=(n=t||uw,r=new Map,i=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=uA(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=uA(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:uC,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...ub,...n.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(uk.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=uo(n);return r.children=o.all(e),r}return uo(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(uk.call(n,"hProperties")||uk.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:n,patch:uS,wrap:uN},um(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),a=s.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ua,r=e.options.footnoteBackLabel||ul,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let o=e.all(i),s=String(i.identifier).toUpperCase(),c=us(s.toLowerCase()),d=0,u=[],h=e.footnoteCounts.get(s);for(;void 0!==h&&++d<=h;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,d);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let p=o[o.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...u)}else o.push(...u);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...uo(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(s),c=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&(cp("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function uM(e,t){return e&&"run"in e?async function(n,r){let i=uE(n,{file:r,...t});await e.run(i,r)}:function(n,r){return uE(n,{file:r,...e||t})}}function uT(e){if(e)throw e}var uI=e.i(75609);function uL(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let uO=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');u_(e);let r=0,i=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(i=o):(a=-1,i=s));return r===i?i=s:i<0&&(i=e.length),e.slice(r,i)},uD=function(e){let t;if(u_(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},uR=function(e){let t;u_(e);let n=e.length,r=-1,i=0,o=-1,s=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?o<0?o=n:1!==s&&(s=1):o>-1&&(s=-1)}return o<0||r<0||0===s||1===s&&o===r-1&&o===i+1?"":e.slice(o,r)},uP=function(...e){var t;let n,r,i,o=-1;for(;++o<e.length;)u_(e[o]),e[o]&&(i=void 0===i?e[o]:i+"/"+e[o]);return void 0===i?".":(u_(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",o=0,s=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(s===l-1||1===a);else if(s!==l-1&&2===a){if(i.length<2||2!==o||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",o=0):o=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),s=l,a=0;continue}}else if(i.length>0){i="",o=0,s=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),o=l-s-1;s=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function u_(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function uj(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let uB=["history","path","basename","stem","extname","dirname"];class uz{constructor(e){let t,n;t=e?uj(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<uB.length;){const e=uB[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)uB.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?uO(this.path):void 0}set basename(e){uF(e,"basename"),u$(e,"basename"),this.path=uP(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?uD(this.path):void 0}set dirname(e){uU(this.basename,"dirname"),this.path=uP(e||"",this.basename)}get extname(){return"string"==typeof this.path?uR(this.path):void 0}set extname(e){if(u$(e,"extname"),uU(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=uP(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){uj(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!uj(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),uF(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?uO(this.path,this.extname):void 0}set stem(e){uF(e,"stem"),u$(e,"stem"),this.path=uP(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new cM(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function u$(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function uF(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function uU(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let uH=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},uW={}.hasOwnProperty;class uV extends uH{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(o,...s){let a=e[++n],l=-1;if(o)return void r(o);for(;++l<t.length;)(null===s[l]||void 0===s[l])&&(s[l]=t[l]);t=s,a?(function(e,t){let n;return function(...t){let o,s=e.length>t.length;s&&t.push(r);try{o=e.apply(this,t)}catch(e){if(s&&n)throw e;return r(e)}s||(o&&o.then&&"function"==typeof o.then?o.then(i,r):o instanceof Error?r(o):i(o))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...s):r(null,...s)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new uV,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,uI.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(uJ("data",this.frozen),this.namespace[e]=t,this):uW.call(this.namespace,e)&&this.namespace[e]||void 0:e?(uJ("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=uQ(e),n=this.parser||this.Parser;return uq("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),uq("process",this.parser||this.Parser),uK("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let o=uQ(e),s=n.parse(o);function a(e,n){e||!n?i(e):r?r(n):(cp(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(s,o,function(e,t,r){var i,o;if(e||!t||!r)return a(e);let s=n.stringify(t,r);"string"==typeof(i=s)||(o=i)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?r.value=s:r.result=s,a(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),uq("processSync",this.parser||this.Parser),uK("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,uT(e),t=r}),uY("processSync","process",n),cp(t,"we either bailed on an error or have a tree"),t}run(e,t,n){uX(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,o){cp("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let s=uQ(t);r.run(e,s,function(t,r,s){let a=r||e;t?o(t):i?i(a):(cp(n,"`done` is defined if `resolve` is not"),n(void 0,a,s))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){uT(e),n=t,r=!0}),uY("runSync","run",r),cp(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=uQ(t),r=this.compiler||this.Compiler;return uK("stringify",r),uX(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(uJ("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else if("object"==typeof e)Array.isArray(e)?o(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,uI.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)s(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[i][1];uL(s)&&uL(r)&&(r=(0,uI.default)(!0,s,r)),n[i]=[e,r,...o]}}}}let uG=new uV().freeze();function uq(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function uK(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function uJ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uX(e){if(!uL(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function uY(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function uQ(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new uz(e)}let uZ=[],u0={allowDangerousHtml:!0},u1=/^(https?|ircs?|mailto|xmpp)$/i,u2=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function u8(e){var t;let n,r,i,o,s,a=(n=(t=e).rehypePlugins||uZ,r=t.remarkPlugins||uZ,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...u0}:u0,uG().use(d4).use(r).use(uM,i).use(n)),l=(o=e.children||"",s=new uz,"string"==typeof o?s.value=o:cf("Unexpected value `"+o+"` for `children` prop, expected `string`"),s);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||u5;for(let e of u2)Object.hasOwn(t,e.from)&&cf("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&o&&cf("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),um(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return s?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in cU)if(Object.hasOwn(cU,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=cU[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let s=n?!n.includes(e.tagName):!!o&&o.includes(e.tagName);if(!s&&r&&"number"==typeof t&&(s=!r(e,t,i)),s&&i&&"number"==typeof t)return a&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,o;let s;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let a=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=a,r=t.jsxDEV,s=function(e,t,i,o){let s=Array.isArray(i.children),a=cw(e);return r(t,i,o,s,{columnNumber:a?a.column-1:void 0,fileName:n,lineNumber:a?a.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,o=t.jsxs,s=function(e,t,n,r){let s=Array.isArray(n.children)?o:i;return r?s(t,n,r):s(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?n1:n0,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=cP(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ee.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ee.jsx,jsxs:ee.jsxs,passKeys:!0,passNode:!0})}(a.runSync(a.parse(l),l),e)}function u5(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||u1.test(e.slice(0,t))?e:""}function u6({authorship:e}){if(!e)return(0,ee.jsx)("div",{className:"text-[10px] text-[var(--dim)] px-1 py-1",children:"No authorship data"});let{aiPercent:t,humanPercent:n,totalChars:r}=e.stats;return(0,ee.jsxs)("div",{className:"flex items-center gap-3 px-1 py-1.5",children:[(0,ee.jsxs)("div",{className:"flex h-1.5 flex-1 overflow-hidden rounded-sm",children:[t>0&&(0,ee.jsx)("div",{className:"h-full transition-all duration-300",style:{width:`${t}%`,backgroundColor:"var(--ai-color)",opacity:.6}}),n>0&&(0,ee.jsx)("div",{className:"h-full transition-all duration-300",style:{width:`${n}%`,backgroundColor:"var(--human-color)",opacity:.6}})]}),(0,ee.jsxs)("span",{className:"text-[10px] shrink-0 flex gap-2",children:[(0,ee.jsxs)("span",{style:{color:"var(--ai-color)"},children:[t,"% AI"]}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:"/"}),(0,ee.jsxs)("span",{style:{color:"var(--human-color)"},children:[n,"% human"]}),(0,ee.jsxs)("span",{className:"text-[var(--dimmer)]",children:["(",Math.round(r/1e3),"k chars)"]})]})]})}var u3=((x=u3||{}).docTypeError="docTypeError",x.contextNotFound="contextNotFound",x.timerNotFound="timerNotFound",x.ctxCallOutOfScope="ctxCallOutOfScope",x.createNodeInParserFail="createNodeInParserFail",x.stackOverFlow="stackOverFlow",x.parserMatchError="parserMatchError",x.serializerMatchError="serializerMatchError",x.getAtomFromSchemaFail="getAtomFromSchemaFail",x.expectDomTypeError="expectDomTypeError",x.callCommandBeforeEditorView="callCommandBeforeEditorView",x.missingRootElement="missingRootElement",x.missingNodeInSchema="missingNodeInSchema",x.missingMarkInSchema="missingMarkInSchema",x.ctxNotBind="ctxNotBind",x.missingYjsDoc="missingYjsDoc",x);class u4 extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}let u7=(e,t)=>"function"==typeof t?"[Function]":t;function u9(){return new u4(u3.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function he(){return new u4(u3.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function ht(e){return new u4(u3.expectDomTypeError,`Expect to be a dom, but get: ${JSON.stringify(e,u7)}.`)}function hn(){return new u4(u3.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}class hr{constructor(){this.sliceMap=new Map,this.get=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){var n;throw n="string"==typeof e?e:e.name,new u4(u3.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}return t},this.remove=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}class hi{constructor(e,t,n){this.#s=[],this.#a=()=>{this.#s.forEach(e=>e(this.#l))},this.set=e=>{this.#l=e,this.#a()},this.get=()=>this.#l,this.update=e=>{this.#l=e(this.#l),this.#a()},this.type=n,this.#l=t,e.set(n.id,this)}#s;#l;#a;on(e){return this.#s.push(e),()=>{this.#s=this.#s.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#s=this.#s.filter(t=>t!==e)}offAll(){this.#s=[]}}class ho{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw u9()}}create(e,t=this._defaultValue){return new hi(e,t,this)}}let hs=(e,t)=>new ho(e,t);class ha{constructor(e,t,n){this.#c=new Set,this.#d=new Set,this.#u=new Map,this.#h=new Map,this.read=()=>({metadata:this.#p,injectedSlices:[...this.#c].map(e=>({name:"string"==typeof e?e:e.name,value:this.#f(e)})),consumedSlices:[...this.#d].map(e=>({name:"string"==typeof e?e:e.name,value:this.#f(e)})),recordedTimers:[...this.#u].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#m(e)})),waitTimers:[...this.#h].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#m(e)}))}),this.onRecord=e=>{this.#u.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#u.delete(e)},this.onDone=e=>{let t=this.#u.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{let n=Date.now();t.finally(()=>{this.#h.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#c.add(e)},this.onRemove=e=>{this.#c.delete(e)},this.onUse=e=>{this.#d.add(e)},this.#f=e=>this.#g.get(e).get(),this.#m=e=>this.#y.get(e).status,this.#g=e,this.#y=t,this.#p=n}#p;#g;#y;#c;#d;#u;#h;#f;#m}class hl{constructor(e,t,n){this.produce=e=>e&&Object.keys(e).length?new hl(this.#g,this.#y,{...e}):this,this.inject=(e,t)=>{let n=e.create(this.#g.sliceMap);return null!=t&&n.set(t),this.#v?.onInject(e),this},this.remove=e=>(this.#g.remove(e),this.#v?.onRemove(e),this),this.record=e=>(e.create(this.#y.store),this.#v?.onRecord(e),this),this.clearTimer=e=>(this.#y.remove(e),this.#v?.onClear(e),this),this.isInjected=e=>this.#g.has(e),this.isRecorded=e=>this.#y.has(e),this.use=e=>(this.#v?.onUse(e),this.#g.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#y.get(e),this.done=e=>{this.timer(e).done(),this.#v?.onDone(e)},this.wait=e=>{let t=this.timer(e).start();return this.#v?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#g=e,this.#y=t,this.#p=n,n&&(this.#v=new ha(e,t,n))}#g;#y;#p;#v;get meta(){return this.#p}get inspector(){return this.#v}}class hc{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t){var n;throw n=e.name,new u4(u3.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}class hd{constructor(e,t){this.#b=null,this.#x=null,this.#k="pending",this.start=()=>(this.#b??=new Promise((e,t)=>{this.#x=t=>{t instanceof CustomEvent&&t.detail.id===this.#w&&(this.#k="resolved",this.#S(),t.stopImmediatePropagation(),e())},this.#C(()=>{"pending"===this.#k&&(this.#k="rejected"),this.#S(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#k="pending",addEventListener(this.type.name,this.#x)}),this.#b),this.done=()=>{dispatchEvent(new CustomEvent(this.type.name,{detail:{id:this.#w}}))},this.#S=()=>{this.#x&&removeEventListener(this.type.name,this.#x)},this.#C=e=>{setTimeout(()=>{e()},this.type.timeout)},this.#w=Symbol(t.name),this.type=t,e.set(t.id,this)}#b;#x;#w;#k;get status(){return this.#k}#S;#C}class hu{constructor(e,t=3e3){this.create=e=>new hd(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}let hh=(e,t=3e3)=>new hu(e,t);function hp(e){this.content=e}hp.prototype={constructor:hp,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 -1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return -1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new hp(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new hp(n)},addToStart:function(e,t){return new hp([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new hp(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new hp(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=hp.from(e)).size?new hp(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=hp.from(e)).size?new hp(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=hp.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}},hp.from=function(e){if(e instanceof hp)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new hp(t)};class hf{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let a=this.content[o],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,i||null,o)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=l},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new hf(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],a=o+s.nodeSize;a>e&&((o<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=a}return new hf(n,r)}cutByIndex(e,t){return e==t?hf.empty:0==e&&t==this.content.length?this:new hf(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new hf(r,i)}addToStart(e){return new hf([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new hf(this.content.concat(e),this.size+e.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 function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)r++;return r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let a=t.child(--o),l=n.child(--s),c=a.nodeSize;if(a==l){r-=c,i-=c;continue}if(!a.sameMarkup(l))return{a:r,b:i};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,r--,i--;return{a:r,b:i}}if(a.content.size||l.content.size){let t=e(a.content,l.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return hg(0,e);if(e==this.size)return hg(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=n+this.child(t).nodeSize;if(r>=e){if(r==e)return hg(t+1,r);return hg(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return hf.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new hf(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return hf.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new hf(t||e,n)}static from(e){if(!e)return hf.empty;if(e instanceof hf)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new hf([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}hf.empty=new hf([],0);let hm={index:0,offset:0};function hg(e,t){return hm.index=e,hm.offset=t,hm}function hy(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))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(!hy(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!hy(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class hv{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||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(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&&hy(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return hv.none;if(e instanceof hv)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}hv.none=[];class hb extends Error{}class hx{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i){let{index:o,offset:s}=t.findIndex(n),a=t.maybeChild(o);if(s==n||a.isText)return i&&!i.canReplace(o,o,r)?null:t.cut(0,n).append(r).append(t.cut(n));let l=e(a.content,n-s-1,r,a);return l&&t.replaceChild(o,a.copy(l))}(this.content,e+this.openStart,t);return n&&new hx(n,this.openStart,this.openEnd)}removeBetween(e,t){return new hx(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:a,offset:l}=t.findIndex(r);if(o==n||s.isText){if(l!=r&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=a)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+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(e,t){if(!t)return hx.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new hx(hf.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new hx(e,n,r)}}function hk(e,t){if(!t.type.compatibleContent(e.type))throw new hb("Cannot join "+t.type.name+" onto "+e.type.name)}function hw(e,t,n){let r=e.node(n);return hk(r,t.node(n)),r}function hS(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 hC(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(hS(e.nodeAfter,r),o++));for(let e=o;e<s;e++)hS(i.child(e),r);t&&t.depth==n&&t.textOffset&&hS(t.nodeBefore,r)}function hN(e,t){return e.type.checkContent(t),e.copy(t)}function hA(e,t,n){let r=[];return hC(null,e,n,r),e.depth>n&&hS(hN(hw(e,t,n+1),hA(e,t,n+1)),r),hC(t,null,n,r),new hf(r)}hx.empty=new hx(hf.empty,0,0);class hE{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?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[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].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):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-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(0==e.content.size)return hv.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 o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].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++)!1!==n[i].type.spec.inclusive||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 hL(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(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new hE(t,n,i)}static resolveCached(e,t){let n=hI.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else hI.set(e,n=new hM);let r=n.elts[n.i]=hE.resolve(e,t);return n.i=(n.i+1)%hT,r}}class hM{constructor(){this.elts=[],this.i=0}}let hT=12,hI=new WeakMap;class hL{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)}}let hO=Object.create(null);class hD{constructor(e,t,n,r=hv.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||hf.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&&hy(this.attrs,t||e.defaultAttrs||hO)&&hv.sameSet(this.marks,n||hv.none)}copy(e=null){return e==this.content?this:new hD(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hD(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return hx.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new hx(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new hb("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new hb("Inconsistent open depths");return function e(t,n,r,i){let o=t.index(i),s=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){let a=e(t,n,r,i+1);return s.copy(s.content.replaceChild(o,a))}if(!r.content.size)return hN(s,hA(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){let{start:e,end:o}=function(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(hf.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return hN(s,function e(t,n,r,i,o){let s=t.depth>o&&hw(t,n,o+1),a=i.depth>o&&hw(r,i,o+1),l=[];return hC(null,t,o,l),s&&a&&n.index(o)==r.index(o)?(hk(s,a),hS(hN(s,e(t,n,r,i,o+1)),l)):(s&&hS(hN(s,hA(t,n,o+1)),l),hC(n,r,o,l),a&&hS(hN(a,hA(r,i,o+1)),l)),hC(i,null,o,l),new hf(l)}(t,e,o,n,i))}{let e=t.parent,i=e.content;return hN(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))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(0==e)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 hE.resolveCached(this,e)}resolveNoCache(e){return hE.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()+")"),hP(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=hf.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.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),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=hv.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!hv.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){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=hf.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}hD.prototype.text=void 0;class hR extends hD{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):hP(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(e){return e==this.marks?this:new hR(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new hR(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&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 hP(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class h_{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new hj(e,t);if(null==i.next)return h_.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(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 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=hB(e),r=n;return e.eat(",")&&(r="}"!=e.next?hB(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(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)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);h$(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new h_(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(hz);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(h$(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}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 0!=this.next.length&&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];return function i(o,s){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return hf.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(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:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.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=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(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("\n")}}h_.empty=new h_(!0);class hj{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 hB(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function hz(e,t){return t-e}function h$(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(hz)}function hF(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 hU(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function hH(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function hW(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new hG(e,r,t[r]);return n}class hV{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=hW(e,n.attrs),this.defaultAttrs=hF(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==h_.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:hU(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new hD(this,this.computeAttrs(e),hf.from(t),hv.setFrom(n))}createChecked(e=null,t,n){return t=hf.from(t),this.checkContent(t),new hD(this,this.computeAttrs(e),t,hv.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=hf.from(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(hf.empty,!0);return i?new hD(this,e,t.append(i),hv.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){hH(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:hv.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new hV(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class hG{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class hq{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=hW(e,r.attrs),this.excluded=null;let i=hF(this.attrs);this.instance=i?new hv(this,i):null}create(e=null){return!e&&this.instance?this.instance:new hv(this,hU(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new hq(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){hH(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class hK{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=hp.from(e.nodes),t.marks=hp.from(e.marks||{}),this.nodes=hV.compile(this.spec.nodes,this),this.marks=hq.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]=h_.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?hJ(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:hJ(this,n.split(" "))}this.nodeFromJSON=e=>hD.fromJSON(this,e),this.markFromJSON=e=>hv.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof hV){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new hR(n,n.defaultAttrs,e,hv.setFrom(t))}mark(e,t){return"string"==typeof e&&(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 hJ(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);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(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class hX{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&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 h2(this,t,!1);return n.addAll(e,hv.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new h2(this,t,!0);return n.addAll(e,hv.none,t.from,t.to),hx.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)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],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?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=h8(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=h8(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new hX(e,hX.schemaRules(e)))}}let hY={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hZ={ol:!0,ul:!0};function h0(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class h1{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=hv.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(hf.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(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=hf.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(hf.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&&!hY.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class h2{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=h0(null,t.preserveWhitespace,0)|4*!!n;i=r?new h1(r.type,r.attrs,hv.none,!0,t.topMatch||r.type.contentMatch,o):n?new h1(null,null,hv.none,!0,null,o):new h1(e.schema.topNodeType,null,hv.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else 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&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;hZ.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&hZ.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));t:if(a?a.ignore:hQ.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(hY.hasOwnProperty(o))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 t}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||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)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,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 s=this.top;if(o&&o.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;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?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(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+o)&&(r=a,i=s,!a.length))break;if(s.solid){if(n)break;o+=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=t.match.matchType(e.type));let n=hv.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):h5(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&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=h0(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let a=hv.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!h5(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new h1(e,t,a,r,null,s)),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|=1);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++)null==this.find[t].pos&&1==e.nodeType&&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++)null==this.find[r].pos&&1==e.nodeType&&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,o=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return o(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 h8(e){let t={};for(let n in e)t[n]=e[n];return t}function h5(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class h6{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=h4(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=h9(h4(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&&h9(h4(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return h9(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new h6(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=h3(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return h3(e.marks)}}function h3(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function h4(e){return e.document||window.document}let h7=new WeakMap;function h9(e,t,n,r){let i,o,s;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=h7.get(r))&&h7.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),l=o)&&l.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 c=a.indexOf(" ");c>0&&(n=a.slice(0,c),a=a.slice(c+1));let d=n?e.createElementNS(n,a):e.createElement(a),u=t[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in h=2,u)if(null!=u[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),u[e]):"style"==e&&d.style?d.style.cssText=u[e]:d.setAttribute(e,u[e])}}for(let o=h;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>h)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}{let{dom:t,contentDOM:o}=h9(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}class pe{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class pt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&pt.empty)return pt.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}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,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+i],c=this.ranges[s+o],d=a+l;if(e<=d){let i=l?e==a?-1:e==d?1:t:t,o=a+r+(i<0?0:c);if(n)return o;let u=e==(t<0?a:d)?null:s/3+(e-a)*65536,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new pe(o,h,u)}r+=c-l}return n?e+r:new pe(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+i];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+o]-a}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 o=this.ranges[r],s=o-(this.inverted?i:0),a=o+(this.inverted?0:i),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),i+=c-l}}invert(){return new pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?pt.empty:new pt(e<0?[0,-e,0]:[0,0,e])}}pt.empty=new pt([]);class pn{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(e=0,t=this.maps.length){return new pn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&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],null!=r&&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=[]),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(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new pn;return e.appendMappingInverted(this),e}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(null!=i.recover){let t=this.getMirror(n);if(null!=t&&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 pe(e,r,null)}}let pr=Object.create(null);class pi{getMap(){return pt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=pr[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in pr)throw RangeError("Duplicate use of step JSON ID "+e);return pr[e]=t,t.prototype.jsonID=e,t}}class po{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new po(e,null)}static fail(e){return new po(null,e)}static fromReplace(e,t,n,r){try{return po.ok(e.replace(t,n,r))}catch(e){if(e instanceof hb)return po.fail(e.message);throw e}}}function ps(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(ps(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return hf.fromArray(r)}class pa extends pi{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 hx(ps(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return po.fromReplace(e,this.from,this.to,i)}invert(){return new pl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new pa(t.pos,n.pos,this.mark)}merge(e){return e instanceof pa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new pa(t.from,t.to,e.markFromJSON(t.mark))}}pi.jsonID("addMark",pa);class pl extends pi{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 hx(ps(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return po.fromReplace(e,this.from,this.to,n)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new pl(t.pos,n.pos,this.mark)}merge(e){return e instanceof pl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pl(t.from,t.to,e.markFromJSON(t.mark))}}pi.jsonID("removeMark",pl);class pc extends pi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return po.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return po.fromReplace(e,this.pos,this.pos+1,new hx(hf.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new pc(this.pos,t.marks[n]);return new pc(this.pos,this.mark)}}return new pd(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pc(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pc(t.pos,e.markFromJSON(t.mark))}}pi.jsonID("addNodeMark",pc);class pd extends pi{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return po.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return po.fromReplace(e,this.pos,this.pos+1,new hx(hf.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new pc(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pd(t.pos,e.markFromJSON(t.mark))}}pi.jsonID("removeNodeMark",pd);class pu extends pi{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&pp(e,this.from,this.to)?po.fail("Structure replace would overwrite content"):po.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new pu(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new pu(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pu)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?hx.empty:new hx(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pu(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?hx.empty:new hx(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pu(this.from,this.to+(e.to-e.from),t,this.structure)}}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(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new pu(t.from,t.to,hx.fromJSON(e,t.slice),!!t.structure)}}pi.jsonID("replace",pu);class ph extends pi{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(pp(e,this.from,this.gapFrom)||pp(e,this.gapTo,this.to)))return po.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return po.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?po.fromReplace(e,this.from,this.to,n):po.fail("Content does not fit in gap")}getMap(){return new pt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ph(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new ph(t.pos,n.pos,r,i,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(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ph(t.from,t.to,t.gapFrom,t.gapTo,hx.fromJSON(e,t.slice),t.insert,!!t.structure)}}function pp(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function pf(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new pl(a,c,l.marks[t]));if(i&&l.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(l.text);)r||(r=new hx(hf.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new pu(a+e.index,a+e.index+e[0].length,r))}}else s.push(new pu(a,c,hx.empty));a=c}if(!r.validEnd){let t=r.fillBefore(hf.empty,!0);e.replace(a,a,new hx(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function pm(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,a,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(a==o.childCount||o.canReplace(0,a))))break;s&&(r=1),a<o.childCount&&(i=1)}return null}function pg(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<i;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return o?i.map(py).concat({type:t,attrs:n}).concat(o.map(py)):null}function py(e){return{type:e,attrs:null}}function pv(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function pb(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function px(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function pk(e,t){var n,r;let i=e.resolve(t),o=i.index();return n=i.nodeBefore,r=i.nodeAfter,!!(n&&r&&!n.isLeaf&&function(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 o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(n,r))&&i.parent.canReplace(o,o+1)}function pw(e,t,n=t,r=hx.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return pS(i,o,r)?new pu(t,n,r):new pC(i,o,r).fit()}function pS(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}pi.jsonID("replaceAround",ph);class pC{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=hf.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=hf.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,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let a=new hx(i,o,s);return e>-1?new ph(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new pu(n.pos,r.pos,a):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=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=pE(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:o,match:s}=this.frontier[i],a,l=null;if(1==t&&(r?s.matchType(r.type)||(l=s.fillBefore(hf.from(r),!1)):e&&o.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:l};if(2==t&&r&&(a=s.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:a};if(e&&s.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=pE(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new hx(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=pE(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new hx(pN(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new hx(pN(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 o=this.unplaced,s=n?n.content:o.content,a=o.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let h=s.size+e-(o.content.size-o.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;(++l>1||0==a||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(hf.empty,!0)))),t.copy(i)}(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=pA(this.placed,t,hf.from(c)),this.frontier[t].match=d,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<h;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?hx.empty:new hx(pN(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new hx(pN(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!pM(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){n: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)),o=pM(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=pM(e,n,r,t,!0);if(!i||i.childCount)continue n}return{depth:t,fit:o,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=pA(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=pA(this.placed,this.depth,hf.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(hf.empty,!0);e.childCount&&(this.placed=pA(this.placed,this.frontier.length,e))}}function pN(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(pN(e.firstChild.content,t-1,n)))}function pA(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(pA(e.lastChild.content,t-1,n)))}function pE(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function pM(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?a:null}function pT(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}class pI extends pi{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 po.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 po.fromReplace(e,this.pos,this.pos+1,new hx(hf.from(r),0,+!t.isLeaf))}getMap(){return pt.empty}invert(e){return new pI(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pI(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new pI(t.pos,t.attr,t.value)}}pi.jsonID("attr",pI);class pL extends pi{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 po.ok(n)}getMap(){return pt.empty}invert(e){return new pL(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new pL(t.attr,t.value)}}pi.jsonID("docAttr",pL);let pO=class extends Error{};(pO=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),pO.prototype.constructor=pO,pO.prototype.name="TransformError";class pD{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new pn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new pO(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,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?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=hx.empty){let r=pw(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new hx(hf.from(n),0,0))}delete(e,t){return this.replace(e,t,hx.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(pS(i,o,r))return e.step(new pu(t,n,r));let s=pT(i,o);0==s[s.length-1]&&s.pop();let a=-(i.depth+1);s.unshift(a);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;s.indexOf(e)>-1?a=e:i.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var u;let t=c[e],n=(u=t.type).spec.defining||u.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),p=i.index(c-1);if(h.canReplaceWith(p,p,u.type,u.marks))return e.replace(i.before(c),d?o.after(c):n,new hx(function e(t,n,r,i,o){if(n<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(e(o.content,n+1,r,i,o)))}if(n>i){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(hf.empty,!0))}return t}(r.content,0,r.openStart,a),a,r.openEnd))}}let h=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>h));a--){let e=s[a];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)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)break}return null}(this.doc,r,n.type);null!=e&&(r=i=e)}return this.replaceRange(r,i,new hx(hf.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=pT(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=hf.empty,u=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=hf.from(r.node(e).copy(d)),u++):l--;let h=hf.empty,p=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,h=hf.from(i.node(e).copy(h)),p++):c++;e.step(new ph(l,c,s,a,new hx(d.append(h),u,p),d.size-u,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);pb(e,r.node(),r.before(),a)}s.inlineContent&&pf(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new pu(c,l.map(t+n,-1),hx.empty,!0)),!0===r){let t=e.doc.resolve(c);pv(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=hf.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=hf.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new ph(i,o,i,o,new hx(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var s,a,l;let c,d,u="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,u)&&(s=i.doc,a=i.mapping.slice(o).map(t),l=n,d=(c=s.resolve(a)).index(),c.parent.canReplaceWith(d,d+1,l))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&pb(i,e,t,o),pf(i,i.mapping.slice(o).map(t,1),n,void 0,null===r);let s=i.mapping.slice(o),a=s.map(t,1),l=s.map(t+e.nodeSize,1);return i.step(new ph(a,l,a+1,l-1,new hx(hf.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===r&&pv(i,e,t,o),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new ph(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new hx(hf.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new pI(e,t,n)),this}setDocAttribute(e,t){return this.step(new pL(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 hv)t.isInSet(n.marks)&&this.step(new pd(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new pd(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),o=hf.empty,s=hf.empty;for(let e=i.depth,t=i.depth-n,a=n-1;e>t;e--,a--){o=hf.from(i.node(e).copy(o));let t=r&&r[a];s=hf.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new pu(t,t,new hx(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,a;return r=this,s=[],a=[],r.doc.nodesBetween(e,t,(r,l,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,e),u=Math.min(l+r.nodeSize,t),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:s.push(i=new pl(c,u,d[e])));o&&o.to==c?o.to=u:a.push(o=new pa(c,u,n))}}),s.forEach(e=>r.step(e)),a.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let a=null;if(n instanceof hq){let e=r.marks,t;for(;t=n.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<a.length;t++){let r=a[t],l;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(l=t)}l?(l.to=n,l.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}),i.forEach(e=>r.step(new pl(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return pf(this,e,t,n),this}}let pR=Object.create(null);class pP{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new p_(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=hx.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,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(l.pos),s?hx.empty:t),0==s&&pG(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:o,$to:s}=r[i],a=e.mapping.slice(n),l=a.map(o.pos),c=a.map(s.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),pG(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new pz(e):pV(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?pV(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):pV(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 pH(e.node(0))}static atStart(e){return pV(e,e,0,0,1)||new pH(e)}static atEnd(e){return pV(e,e,e.content.size,e.childCount,-1)||new pH(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=pR[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in pR)throw RangeError("Duplicate use of selection JSON ID "+e);return pR[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pz.between(this.$anchor,this.$head).getBookmark()}}pP.prototype.visible=!0;class p_{constructor(e,t){this.$from=e,this.$to=t}}let pj=!1;function pB(e){pj||e.parent.inlineContent||(pj=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class pz extends pP{constructor(e,t=e){pB(e),pB(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return pP.near(n);let r=e.resolve(t.map(this.anchor));return new pz(r.parent.inlineContent?r:n,n)}replace(e,t=hx.empty){if(super.replace(e,t),t==hx.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof pz&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new p$(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new pz(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=pP.findFrom(t,n,!0)||pP.findFrom(t,-n,!0);if(!e)return pP.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(pP.findFrom(e,-n,!0)||pP.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new pz(e,t)}}pP.jsonID("text",pz);class p${constructor(e,t){this.anchor=e,this.head=t}map(e){return new p$(e.map(this.anchor),e.map(this.head))}resolve(e){return pz.between(e.resolve(this.anchor),e.resolve(this.head))}}class pF extends pP{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?pP.near(i):new pF(i)}content(){return new hx(hf.from(this.node),0,0)}eq(e){return e instanceof pF&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new pU(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new pF(e.resolve(t.anchor))}static create(e,t){return new pF(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}pF.prototype.visible=!1,pP.jsonID("node",pF);class pU{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new p$(n,n):new pU(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&pF.isSelectable(n)?new pF(t):pP.near(t)}}class pH extends pP{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=hx.empty){if(t==hx.empty){e.delete(0,e.doc.content.size);let t=pP.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new pH(e)}map(e){return new pH(e)}eq(e){return e instanceof pH}getBookmark(){return pW}}pP.jsonID("all",pH);let pW={map(){return this},resolve:e=>new pH(e)};function pV(e,t,n,r,i,o=!1){if(t.inlineContent)return pz.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&pF.isSelectable(r))return pF.create(e,n-(i<0?r.nodeSize:0))}else{let t=pV(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function pG(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof pu||o instanceof ph)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(pP.near(e.doc.resolve(r),n)))}class pq extends pD{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=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return hv.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(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,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)||hv.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(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(pP.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function pK(e,t){return t&&e?e.bind(t):e}class pJ{constructor(e,t,n){this.name=e,this.init=pK(t.init,n),this.apply=pK(t.apply,n)}}let pX=[new pJ("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new pJ("selection",{init:(e,t)=>e.selection||pP.atStart(t.doc),apply:e=>e.selection}),new pJ("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new pJ("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class pY{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pX.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 pJ(e.key,e.spec.state,e))})}}class pQ{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 o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let a=r?r[o].n:0,l=r?r[o].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new pQ(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new pq(this)}static create(e){let t=new pY(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new pQ(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new pY(this.schema,e.plugins),n=t.fields,r=new pQ(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)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(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new pY(e.schema,e.plugins),i=new pQ(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=hD.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=pP.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=a.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class pZ{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:p1("plugin")}getState(e){return e[this.key]}}let p0=Object.create(null);function p1(e){return e in p0?e+"$"+ ++p0[e]:(p0[e]=0,e+"$")}class p2{constructor(e="key"){this.key=p1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let p8=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function p5(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let p6=(e,t,n)=>{let r=p5(e,n);if(!r)return!1;let i=p9(r);if(!i){let n=r.blockRange(),i=n&&pm(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(fn(e,i,t,-1))return!0;if(0==r.parent.content.size&&(p4(o,"end")||pF.isSelectable(o)))for(let n=r.depth;;n--){let s=pw(e.doc,r.before(n),r.after(n),hx.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(p4(o,"end")?pP.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):pF.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},p3=(e,t,n)=>{let r=p5(e,n);if(!r)return!1;let i=p9(r);return!!i&&function(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 o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let a=pw(e.doc,i,s,hx.empty);if(!a||a.from!=i||a instanceof pu&&a.slice.size>=s-i)return!1;if(n){let t=e.tr.step(a);t.setSelection(pz.create(t.doc,i)),n(t.scrollIntoView())}return!0}(e,i,t)};function p4(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let p7=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=p9(r)}let s=o&&o.nodeBefore;return!!s&&!!pF.isSelectable(s)&&(t&&t(e.tr.setSelection(pF.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function p9(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 fe(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}function ft(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function fn(e,t,n,r){let i,o,s,a=t.nodeBefore,l=t.nodeAfter,c,d,u=a.type.spec.isolating||l.type.spec.isolating;if(!u&&(i=t.nodeBefore,o=t.nodeAfter,s=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(s,s+1)&&!!(o.isTextblock||pk(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let h=!u&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(c=(d=a.contentMatchAt(a.childCount)).findWrapping(l.type))&&d.matchType(c[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=hf.empty;for(let e=c.length-1;e>=0;e--)i=hf.from(c[e].create(null,i));i=hf.from(a.copy(i));let o=e.tr.step(new ph(t.pos-1,r,t.pos,r,new hx(i,1,0),c.length,!0)),s=o.doc.resolve(r+2*c.length);s.nodeAfter&&s.nodeAfter.type==a.type&&pk(o.doc,s.pos)&&o.join(s.pos),n(o.scrollIntoView())}return!0}let p=l.type.spec.isolating||r>0&&u?null:pP.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&pm(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(h&&p4(l,"start",!0)&&p4(a,"end")){let r=a,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=l,s=1;for(;!o.isTextblock;o=o.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=hf.empty;for(let e=i.length-1;e>=0;e--)r=hf.from(i[e].copy(r));n(e.tr.step(new ph(t.pos-i.length,t.pos+l.nodeSize,t.pos+s,t.pos+l.nodeSize-s,new hx(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function fr(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(pz.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let fi=fr(-1),fo=fr(1);function fs(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&pg(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}function fa(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),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:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function fl(e,t=null,n){let r=!1!==(n&&n.removeWhenPresent),i=!1!==(n&&n.enterInlineAtoms),o=!(n&&n.includeWhitespace);return function(n,s){let{empty:a,$cursor:l,ranges:c}=n.selection;if(a&&!l||!function(e,t,n,r){for(let i=0;i<t.length;i++){let{$from:o,$to:s}=t[i],a=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,s.pos,(e,t)=>{if(a||!r&&e.isAtom&&e.isInline&&t>=o.pos&&t+e.nodeSize<=s.pos)return!1;a=e.inlineContent&&e.type.allowsMarkType(n)}),a)return!0}return!1}(n.doc,c,e,i))return!1;if(s)if(l)s(e.isInSet(n.storedMarks||l.marks())?n.tr.removeStoredMark(e):n.tr.addStoredMark(e.create(t)));else{let a,l=n.tr;i||(c=function(e){let t=[];for(let n=0;n<e.length;n++){let{$from:r,$to:i}=e[n];r.doc.nodesBetween(r.pos,i.pos,(e,n)=>{if(e.isAtom&&e.content.size&&e.isInline&&n>=r.pos&&n+e.nodeSize<=i.pos)return n+1>r.pos&&t.push(new p_(r,r.doc.resolve(n+1))),r=r.doc.resolve(n+1+e.content.size),!1}),r.pos<i.pos&&t.push(new p_(r,i))}return t}(c)),a=r?!c.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)):!c.every(t=>{let n=!1;return l.doc.nodesBetween(t.$from.pos,t.$to.pos,(r,i,o)=>{if(n)return!1;n=!e.isInSet(r.marks)&&!!o&&o.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-i),Math.min(r.nodeSize,t.$to.pos-i))))}),!n});for(let n=0;n<c.length;n++){let{$from:r,$to:i}=c[n];if(a){let n=r.pos,s=i.pos,a=r.nodeAfter,c=i.nodeBefore,d=o&&a&&a.isText?/^\s*/.exec(a.text)[0].length:0,u=o&&c&&c.isText?/\s*$/.exec(c.text)[0].length:0;n+d<s&&(n+=d,s-=u),l.addMark(n,s,e.create(t))}else l.removeMark(r.pos,i.pos,e)}s(l.scrollIntoView())}return!0}}function fc(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let fd=fc(p8,p6,p7),fu=fc(p8,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}(e,n);if(!r)return!1;let i=fe(r);if(!i)return!1;let o=i.nodeAfter;if(fn(e,i,t,1))return!0;if(0==r.parent.content.size&&(p4(o,"start")||pF.isSelectable(o))){let n=pw(e.doc,r.before(),r.after(),hx.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(p4(o,"start")?pP.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):pF.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=fe(r)}let s=o&&o.nodeAfter;return!!s&&!!pF.isSelectable(s)&&(t&&t(e.tr.setSelection(pF.create(e.doc,o.pos)).scrollIntoView()),!0)}),fh={Enter:fc((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof pH||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ft(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(pz.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},(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(px(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&pm(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof pF&&e.selection.node.isBlock)return!!n.parentOffset&&!!px(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let i=[],o,s,a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),s=ft(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));i.unshift(t||(a&&s?{type:s}:null)),o=e;break}if(1==e)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof pz||e.selection instanceof pH)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=px(c.doc,d,i.length,i);if(u||(i[0]=s?{type:s}:null,u=px(c.doc,d,i.length,i)),!u)return!1;if(c.split(d,i.length,i),!a&&l&&n.node(o).type!=s){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);s&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&c.setNodeMarkup(c.mapping.map(n.before(o)),s)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":(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),o=n.indexAfter(-1),s=ft(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(pP.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Backspace:fd,"Mod-Backspace":fd,"Shift-Backspace":fd,Delete:fu,"Mod-Delete":fu,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new pH(e.doc))),!0)},fp={"Ctrl-h":fh.Backspace,"Alt-Backspace":fh["Mod-Backspace"],"Ctrl-d":fh.Delete,"Ctrl-Alt-Backspace":fh["Mod-Delete"],"Alt-Delete":fh["Mod-Delete"],"Alt-d":fh["Mod-Delete"],"Ctrl-a":fi,"Ctrl-e":fo};for(let e in fh)fp[e]=fh[e];let ff=("u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&!!os.platform&&"darwin"==os.platform())?fp:fh,fm={}.hasOwnProperty;function fg(e,t,n){return">"+(n?"":" ")+e}function fy(e,t){return fv(e,t.inConstruct,!0)&&!fv(e,t.notInConstruct,!1)}function fv(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function fb(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&fy(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function fx(e,t){return!!(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function fk(e,t,n){return(n?"":" ")+e}function fw(e){let t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fS(e){return"&#x"+e.toString(16).toUpperCase()+";"}function fC(e,t,n){let r=dy(e),i=dy(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function fN(e,t,n,r){let i=function(e){let t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i),l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()})),c=l.charCodeAt(0),d=fC(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(l=fS(c)+l.slice(1));let u=l.charCodeAt(l.length-1),h=fC(r.after.charCodeAt(0),u,i);h.inside&&(l=l.slice(0,-1)+fS(u));let p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},a+l+p}function fA(e,t){let n=!1;return um(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,!1}),!!((!e.depth||e.depth<3)&&cW(e)&&(t.options.setext||n))}function fE(e){return e.value||""}function fM(e,t,n,r){let i=fw(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image"),a=n.enter("label"),l=n.createTracker(r),c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),s(),c}function fT(e,t,n,r){let i=e.referenceType,o=n.enter("imageReference"),s=n.enter("label"),a=n.createTracker(r),l=a.move("!["),c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();let d=n.stack;n.stack=[],s=n.enter("reference");let u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=d,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function fI(e,t,n){let r=e.value||"",i="`",o=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let e,t=n.unsafe[o],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}function fL(e,t){let n=cW(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function fO(e,t,n,r){let i,o,s=fw(n),a='"'===s?"Quote":"Apostrophe",l=n.createTracker(r);if(fL(e,n)){let t=n.stack;n.stack=[],i=n.enter("autolink");let r=l.move("<");return r+=l.move(n.containerPhrasing(e,{before:r,after:">",...l.current()})),r+=l.move(">"),i(),n.stack=t,r}i=n.enter("link"),o=n.enter("label");let c=l.move("[");return c+=l.move(n.containerPhrasing(e,{before:c,after:"](",...l.current()})),c+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${a}`),c+=l.move(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),o()),c+=l.move(")"),i(),c}function fD(e,t,n,r){let i=e.referenceType,o=n.enter("linkReference"),s=n.enter("label"),a=n.createTracker(r),l=a.move("["),c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),s();let d=n.stack;n.stack=[],s=n.enter("reference");let u=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=d,o(),"full"!==i&&c&&c===u?"shortcut"===i?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(u+"]"),l}function fR(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function fP(e){let t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}fN.peek=function(e,t,n){return n.options.emphasis||"*"},fE.peek=function(){return"<"},fM.peek=function(){return"!"},fT.peek=function(){return"!"},fI.peek=function(){return"`"},fO.peek=function(e,t,n){return fL(e,n)?"<":"["},fD.peek=function(){return"["};let f_=uc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fj(e,t,n,r){let i=function(e){let t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i),l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()})),c=l.charCodeAt(0),d=fC(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(l=fS(c)+l.slice(1));let u=l.charCodeAt(l.length-1),h=fC(r.after.charCodeAt(0),u,i);h.inside&&(l=l.slice(0,-1)+fS(u));let p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},a+l+p}fj.peek=function(e,t,n){return n.options.strong||"*"};let fB={blockquote:function(e,t,n,r){let i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);let s=n.indentLines(n.containerFlow(e,o.current()),fg);return i(),s},break:fb,code:function(e,t,n,r){let i=function(e){let t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(fx(e,n)){let e=n.enter("codeIndented"),t=n.indentLines(o,fk);return e(),t}let a=n.createTracker(r),l=i.repeat(Math.max(function(e,t){let n=String(e),r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}(o,i)+1,3)),c=n.enter("codeFenced"),d=a.move(l);if(e.lang){let t=n.enter(`codeFencedLang${s}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${s}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:"\n",encode:["`"],...a.current()})),t()}return d+=a.move("\n"),o&&(d+=a.move(o+"\n")),d+=a.move(l),c(),d},definition:function(e,t,n,r){let i=fw(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition"),a=n.enter("label"),l=n.createTracker(r),c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),s(),c},emphasis:fN,hardBreak:fb,heading:function(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(fA(e,n)){let t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}let s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(c)&&(c=fS(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),l(),a(),c},html:fE,image:fM,imageReference:fT,inlineCode:fI,link:fO,linkReference:fD,list:function(e,t,n,r){let i=n.enter("list"),o=n.bulletCurrent,s=e.ordered?function(e){let t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):fR(n),a=e.ordered?"."===s?")":".":function(e){let t=fR(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n),l=!!t&&!!n.bulletLastUsed&&s===n.bulletLastUsed;if(!e.ordered){let t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),fP(n)===s&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=a),n.bulletCurrent=s;let c=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),c},listItem:function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),o=n.bulletCurrent||fR(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));let a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e});return l(),c},paragraph:function(e,t,n,r){let i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some(function(e){return f_(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:fj,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){let r=(fP(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},fz=[function(e,t,n,r){if("code"===t.type&&fx(t,r)&&("list"===e.type||e.type===t.type&&fx(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&fA(t,r)))return;return+!!n.spread}}],f$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],fF=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:f$},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:f$},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:f$},{atBreak:!0,character:"+",after:"(?:[ \r\n])"},{atBreak:!0,character:"-",after:"(?:[ \r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:f$},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:f$},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:f$},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:f$},{atBreak:!0,character:"~"}];function fU(e){return e.label||!e.identifier?e.label||"":d2(e.identifier)}function fH(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}let fW=/\r?\n|\r/g;function fV(e,t){let n,r=[],i=0,o=0;for(;n=fW.exec(e);)s(e.slice(i,n.index)),r.push(n[0]),i=n.index+n[0].length,o++;return s(e.slice(i)),r.join("");function s(e){r.push(t(e,o,!e))}}function fG(e,t){return e-t}function fq(e,t){let n,r=/\\(?=[!-/:-@[-`{-~])/g,i=[],o=[],s=e+t,a=-1,l=0;for(;n=r.exec(s);)i.push(n.index);for(;++a<i.length;)l!==i[a]&&o.push(e.slice(l,i[a])),o.push("\\"),l=i[a];return o.push(e.slice(l)),o.join("")}function fK(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,o=n.column||1;return{move:function(e){let t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return i+=n.length-1,o=1===n.length?o+s.length:1+s.length+r,t},current:function(){return{now:{line:i,column:o},lineShift:r}},shift:function(e){r+=e}}}function fJ(e){throw Error("Cannot handle value `"+e+"`, expected node")}function fX(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function fY(e,t){if("definition"===e.type&&e.type===t.type)return 0}function fQ(e,t){return function(e,t,n){let r,i=t.indexStack,o=e.children||[],s=[],a=-1,l=n.before;i.push(-1);let c=t.createTracker(n);for(;++a<o.length;){let d,u=o[a];if(i[i.length-1]=a,a+1<o.length){let n=t.handle.handlers[o[a+1].type];n&&n.peek&&(n=n.peek),d=n?n(o[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;s.length>0&&("\r"===l||"\n"===l)&&"html"===u.type&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),l=" ",(c=t.createTracker(n)).move(s.join("")));let h=t.handle(u,e,t,{...c.current(),after:d,before:l});r&&r===h.slice(0,1)&&(h=fS(r.charCodeAt(0))+h.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,r=void 0,p&&(s.length>0&&p.before&&l===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+fS(l.charCodeAt(0))),p.after&&(r=d)),c.move(h),s.push(h),l=h.slice(-1)}return i.pop(),s.join("")}(e,this,t)}function fZ(e,t){return function(e,t,n){let r=t.indexStack,i=e.children||[],o=t.createTracker(n),s=[],a=-1;for(r.push(-1);++a<i.length;){let n=i[a];r[r.length-1]=a,s.push(o.move(t.handle(n,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<i.length-1&&s.push(o.move(function(e,t,n,r){let i=r.join.length;for(;i--;){let o=r.join[i](e,t,n,r);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n<!---->\n\n"}return"\n\n"}(n,i[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function f0(e,t){return function(e,t,n){let r=(n.before||"")+(t||"")+(n.after||""),i=[],o=[],s={},a=-1;for(;++a<e.unsafe.length;){let t,n=e.unsafe[a];if(!fy(e.stack,n))continue;let o=e.compilePattern(n);for(;t=o.exec(r);){let e="before"in n||!!n.atBreak,r="after"in n,o=t.index+(e?t[1].length:0);i.includes(o)?(s[o].before&&!e&&(s[o].before=!1),s[o].after&&!r&&(s[o].after=!1)):(i.push(o),s[o]={before:e,after:r})}}i.sort(fG);let l=n.before?n.before.length:0,c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){let e=i[a];!(e<l)&&!(e>=c)&&(!(e+1<c)||i[a+1]!==e+1||!s[e].after||s[e+1].before||s[e+1].after)&&(i[a-1]!==e-1||!s[e].before||s[e-1].before||s[e-1].after)&&(l!==e&&o.push(fq(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(o.push(fS(r.charCodeAt(e))),l++):o.push("\\"))}return o.push(fq(r.slice(l,c),n.after)),o.join("")}(this,e,t)}function f1(e){let t=this;t.compiler=function(n){var r;let i,o;return r={...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]},!function e(t,n){var r,i,o,s;let a,l=-1;if(n.extensions)for(;++l<n.extensions.length;)e(t,n.extensions[l]);for(a in n)if(fm.call(n,a))switch(a){case"extensions":break;case"unsafe":case"join":r=t[a],(i=n[a])&&r.push(...i);break;case"handlers":o=t[a],(s=n[a])&&Object.assign(o,s);break;default:t.options[a]=n[a]}return t}(i={associationId:fU,containerPhrasing:fQ,containerFlow:fZ,createTracker:fK,compilePattern:fH,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...fB},handle:void 0,indentLines:fV,indexStack:[],join:[...fz],options:{},safe:f0,stack:[],unsafe:[...fF]},r||{}),i.options.tightDefinitions&&i.join.push(fY),i.handle=n8("type",{invalid:fJ,unknown:fX,handlers:i.handlers}),(o=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0}))&&10!==o.charCodeAt(o.length-1)&&13!==o.charCodeAt(o.length-1)&&(o+="\n"),o}}var f2=e=>{throw TypeError(e)},f8=(e,t,n)=>t.has(e)||f2("Cannot "+n),f5=(e,t,n)=>(f8(e,t,"read from private field"),n?n.call(e):t.get(e)),f6=(e,t,n)=>t.has(e)?f2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),f3=(e,t,n,r)=>(f8(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class f4{}class f7{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw he();return e}}}class f9 extends f4{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,n){return new f9(e,t,n)}}let me=class extends f7{constructor(e){super(),f6(this,R),f6(this,P),f6(this,_),f6(this,j),f6(this,B),f6(this,z),f6(this,$),f3(this,R,hv.none),f3(this,P,e=>e.isText),f3(this,_,(e,t)=>{if(f5(this,P).call(this,e)&&f5(this,P).call(this,t)&&hv.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)}),f3(this,j,e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t){var n;throw n=e,new u4(u3.parserMatchError,`Cannot match target parser for node: ${JSON.stringify(n,u7)}.`)}return t}),f3(this,B,e=>{let t=f5(this,j).call(this,e);t.spec.parseMarkdown.runner(this,e,t)}),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(f9.create(e,[],t)),this),f3(this,z,()=>{f3(this,R,hv.none);let e=this.close();return f5(this,$).call(this,e.type,e.attrs,e.content)}),this.closeNode=()=>{try{f5(this,z).call(this)}catch(e){console.error(e)}return this},f3(this,$,(e,t,n)=>{let r=e.createAndFill(t,n,f5(this,R));if(!r){let r,i,o,s;throw r="name"in e?e.name:e,i=`Cannot create node for ${r}`,o=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(o).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},s=[["[Description]",i],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:o(e):"null")]].reduce((e,[t,n])=>{let r=`${t}: ${o(n)}.`;return e.concat(r)},[]),new u4(u3.createNodeInParserFail,s.join("\n"))}return this.push(r),r}),this.addNode=(e,t,n)=>{try{f5(this,$).call(this,e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{let n=e.create(t);return f3(this,R,n.addToSet(f5(this,R))),this},this.closeMark=e=>(f3(this,R,e.removeFromSet(f5(this,R))),this),this.addText=e=>{try{let t=this.top();if(!t)throw he();let n=t.pop(),r=this.schema.text(e,f5(this,R));if(!n)return t.push(r),this;let i=f5(this,_).call(this,n,r);if(i)return t.push(i),this;return t.push(n,r),this}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=f5(this,z).call(this);while(this.size())return e},this.next=(e=[])=>([e].flat().forEach(e=>f5(this,B).call(this,e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}};R=new WeakMap,P=new WeakMap,_=new WeakMap,j=new WeakMap,B=new WeakMap,z=new WeakMap,$=new WeakMap,me.create=(e,t)=>{let n=new me(e);return e=>(n.run(t,e),n.toDoc())};let mt=class extends f4{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}};mt.create=(e,t,n,r={})=>new mt(e,t,n,r);let mn=class extends f7{constructor(e){super(),f6(this,F),f6(this,U),f6(this,H),f6(this,W),f6(this,V),f6(this,G),f6(this,q),f6(this,K),f6(this,J),f6(this,X),f6(this,Y),f6(this,Q),f6(this,Z),f3(this,F,hv.none),f3(this,U,e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t){var n;throw n=e.type,new u4(u3.serializerMatchError,`Cannot match target serializer for node: ${JSON.stringify(n,u7)}.`)}return t}),f3(this,H,e=>f5(this,U).call(this,e).spec.toMarkdown.runner(this,e)),f3(this,W,(e,t)=>f5(this,U).call(this,e).spec.toMarkdown.runner(this,e,t)),f3(this,V,e=>{let{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!f5(this,W).call(this,t,e))&&f5(this,H).call(this,e),t.forEach(e=>f5(this,Z).call(this,e))}),f3(this,G,(e,t)=>{if(e.type===t||e.children?.length!==1)return e;let n=e=>{if(e.type===t)return e;if(e.children?.length!==1)return null;let[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;let i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r}),f3(this,q,e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){let{children:n,...i}=t=f5(this,G).call(this,t,r.type),{children:o,...s}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(s)){let t={...s,children:[...o,...n]};return e.slice(0,-1).concat(f5(this,q).call(this,t))}}return e.concat(t)},[])),e}),f3(this,K,e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t}),this.openNode=(e,t,n)=>(this.open(mt.create(e,void 0,t,n)),this),f3(this,J,(e,t)=>{let n="",r="",i=e.children,o=-1,s=-1;if(i){i&&i.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),s=t)});let e=i?.[s],t=i?.[o];if(e&&e.value.endsWith(" ")){let t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){let e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&f5(this,Y).call(this,"text",void 0,n);let a=t();return r.length&&f5(this,Y).call(this,"text",void 0,r),a}),f3(this,X,(e=!1)=>{let t=this.close(),n=()=>f5(this,Y).call(this,t.type,t.children,t.value,t.props);return e?f5(this,J).call(this,t,n):n()}),this.closeNode=()=>(f5(this,X).call(this),this),f3(this,Y,(e,t,n,r)=>{let i=mt.create(e,t,n,r),o=f5(this,q).call(this,f5(this,K).call(this,i));return this.push(o),o}),this.addNode=(e,t,n,r)=>(f5(this,Y).call(this,e,t,n,r),this),f3(this,Q,(e,t,n,r)=>e.isInSet(f5(this,F))?this:(f3(this,F,e.addToSet(f5(this,F))),this.openNode(t,n,{...r,isMark:!0}))),f3(this,Z,e=>{e.isInSet(f5(this,F))&&(f3(this,F,e.type.removeFromSet(f5(this,F))),f5(this,X).call(this,!0))}),this.withMark=(e,t,n,r)=>(f5(this,Q).call(this,e,t,n,r),this),this.closeMark=e=>(f5(this,Z).call(this,e),this),this.build=()=>{let e=null;do e=f5(this,X).call(this);while(this.size())return e},this.next=e=>(Object.prototype.hasOwnProperty.call(e,"size")?e.forEach(e=>{f5(this,V).call(this,e)}):f5(this,V).call(this,e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}};F=new WeakMap,U=new WeakMap,H=new WeakMap,W=new WeakMap,V=new WeakMap,G=new WeakMap,q=new WeakMap,K=new WeakMap,J=new WeakMap,X=new WeakMap,Y=new WeakMap,Q=new WeakMap,Z=new WeakMap,mn.create=(e,t)=>{let n=new mn(e);return e=>(n.run(e),n.toString(t))};class mr{constructor(e,t,n={}){this.match=e,this.match=e,this.handler="string"==typeof t?function(e){return function(t,n,r,i){let o=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);o+=n[0].slice(e+n[1].length);let t=(r+=e)-i;t>0&&(o=n[0].slice(e-t,e)+o,r=i)}return t.tr.insertText(o,r,i)}}(t):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}let mi=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i=n[r],o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};function mo(e,t,n=null,r){return new mr(e,(e,i,o,s)=>{let a=n instanceof Function?n(i):n,l=e.tr.delete(o,s),c=l.doc.resolve(o).blockRange(),d=c&&pg(c,t,a);if(!d)return null;l.wrap(c,d);let u=l.doc.resolve(o-1).nodeBefore;return u&&u.type==t&&pk(l.doc,o-1)&&(!r||r(i,u))&&l.join(o-1),l})}function ms(e,t,n=null){return new mr(e,(e,r,i,o)=>{let s=e.doc.resolve(i),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(i,o).setBlockType(i,i,t,a):null})}new mr(/--$/,"—",{inCodeMark:!1}),new mr(/\.\.\.$/,"…",{inCodeMark:!1}),new mr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new mr(/"$/,"”",{inCodeMark:!1}),new mr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new mr(/'$/,"’",{inCodeMark:!1});let ma="u">typeof navigator?navigator:null,ml="u">typeof document?document:null,mc=ma&&ma.userAgent||"",md=/Edge\/(\d+)/.exec(mc),mu=/MSIE \d/.exec(mc),mh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mc),mp=!!(mu||mh||md);mu?document.documentMode:mh?mh[1]:md&&md[1],!mp&&/gecko\/(\d+)/i.test(mc)&&(/Firefox\/(\d+)/.exec(mc)||[0,0])[1];let mf=!mp&&/Chrome\/(\d+)/.exec(mc);function mm(e,t,n,r,i,o){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;let l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){let i=a.match.exec(l),c=i&&i[0]&&a.handler(s,i,t-(i[0].length-r.length),n);if(c)return!1!==a.undoable&&c.setMeta(o,{transform:c,from:t,to:n,text:r}),e.dispatch(c),!0}return!1}mf&&mf[1],!mp&&ma&&/Apple Computer/.test(ma.vendor)&&(/Mobile\/\w+/.test(mc)||ma&&ma.maxTouchPoints>2)||ma&&/Mac/.test(ma.platform),/Android \d/.test(mc),ml&&"webkitFontSmoothing"in ml.documentElement.style&&(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];let mg=new p2("MILKDOWN_CUSTOM_INPUTRULES");function my(e,t,n={}){return new mr(e,(e,r,i,o)=>{var s,a,l,c;let{tr:d}=e,u=r.length,h=r[u-1],p=r[0],f=[],m=o,g={group:h,fullMatch:p,start:i,end:o},y=null==(s=n.updateCaptured)?void 0:s.call(n,g);if(Object.assign(g,y),{group:h,fullMatch:p,start:i,end:o}=g,null===p||(null==h?void 0:h.trim())==="")return null;if(h){let e=p.search(/\S/),s=i+p.indexOf(h),u=s+h.length;f=null!=(a=d.storedMarks)?a:[],u<o&&d.delete(u,o),s>i&&d.delete(i+e,s),m=i+e+h.length;let g=null==(l=n.getAttr)?void 0:l.call(n,r);d.addMark(i,m,t.create(g)),d.setStoredMarks(f),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:i,end:o,tr:d})}return d})}Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;for(var mv={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:"'"},mb={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mx="u">typeof navigator&&/Mac/.test(navigator.platform),mk="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mw=0;mw<10;mw++)mv[48+mw]=mv[96+mw]=String(mw);for(var mw=1;mw<=24;mw++)mv[mw+111]="F"+mw;for(var mw=65;mw<=90;mw++)mv[mw]=String.fromCharCode(mw+32),mb[mw]=String.fromCharCode(mw);for(var mS in mv)mb.hasOwnProperty(mS)||(mb[mS]=mv[mS]);let mC="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),mN="u">typeof navigator&&/Win/.test(navigator.platform);function mA(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 mE(e){let t;return new pZ({props:{handleKeyDown:(t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))mC?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e),function(e,n){var r;let i=("Esc"==(r=!(mx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||mk&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?mb:mv)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[mA(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[mA(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(mN&&n.ctrlKey&&n.altKey)&&(o=mv[n.keyCode])&&o!=i){let r=t[mA(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1})}})}let mM=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},mT=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},mI=null,mL=function(e,t,n){let r=mI||(mI=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},mO=function(){mI=null},mD=function(e,t,n,r){return n&&(mP(e,t,n,r,-1)||mP(e,t,n,r,1))},mR=/^(img|br|input|textarea|hr)$/i;function mP(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:m_(e))){let n=e.parentNode;if(!n||1!=n.nodeType||mj(e)||mR.test(e.nodeName)||"false"==e.contentEditable)return!1;t=mM(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?m_(e):0}}}function m_(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function mj(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)}let mB=function(e){return e.focusNode&&mD(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function mz(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let m$="u">typeof navigator?navigator:null,mF="u">typeof document?document:null,mU=m$&&m$.userAgent||"",mH=/Edge\/(\d+)/.exec(mU),mW=/MSIE \d/.exec(mU),mV=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mU),mG=!!(mW||mV||mH),mq=mW?document.documentMode:mV?+mV[1]:mH?+mH[1]:0,mK=!mG&&/gecko\/(\d+)/i.test(mU);mK&&(/Firefox\/(\d+)/.exec(mU)||[0,0])[1];let mJ=!mG&&/Chrome\/(\d+)/.exec(mU),mX=!!mJ,mY=mJ?+mJ[1]:0,mQ=!mG&&!!m$&&/Apple Computer/.test(m$.vendor),mZ=mQ&&(/Mobile\/\w+/.test(mU)||!!m$&&m$.maxTouchPoints>2),m0=mZ||!!m$&&/Mac/.test(m$.platform),m1=!!m$&&/Win/.test(m$.platform),m2=/Android \d/.test(mU),m8=!!mF&&"webkitFontSmoothing"in mF.documentElement.style,m5=m8?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function m6(e,t){return"number"==typeof e?e:e[t]}function m3(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=mT(s);continue}let e=s,n=e==o.body,a=n?function(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}}(o):function(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}}(e),l=0,c=0;if(t.top<a.top+m6(r,"top")?c=-(a.top-t.top+m6(i,"top")):t.bottom>a.bottom-m6(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+m6(i,"top")-a.top:t.bottom-a.bottom+m6(i,"bottom")),t.left<a.left+m6(r,"left")?l=-(a.left-t.left+m6(i,"left")):t.right>a.right-m6(r,"right")&&(l=t.right-a.right+m6(i,"right")),l||c)if(n)o.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:mT(s)}}function m4(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=mT(r));return t}function m7(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let m9=null;function ge(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function gt(e){return e.top<e.bottom||e.left<e.right}function gn(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(gt(e))return e}return Array.prototype.find.call(n,gt)||e.getBoundingClientRect()}let gr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gi(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=m8||mK;if(3==r.nodeType)if(s&&(gr.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=gn(mL(r,i,i),n);if(mK&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=gn(mL(r,i-1,i-1),-1);if(t.top==e.top){let n=gn(mL(r,i,i+1),-1);if(n.top!=e.top)return go(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,go(gn(mL(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==m_(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return gs(e.getBoundingClientRect(),!1)}if(null==o&&i<m_(r)){let e=r.childNodes[i];if(1==e.nodeType)return gs(e.getBoundingClientRect(),!0)}return gs(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==m_(r))){let e=r.childNodes[i-1],t=3==e.nodeType?mL(e,m_(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return go(gn(t,1),!1)}if(null==o&&i<m_(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?mL(e,0,+!s):1==e.nodeType?e:null:null;if(t)return go(gn(t,-1),!0)}return go(gn(3==r.nodeType?mL(r):r,-n),n>=0)}function go(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function gs(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ga(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()}}let gl=/[\u0590-\u08ac]/,gc=null,gd=null,gu=!1;class gh{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){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){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))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}else{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}if(e==this.dom&&this.contentDOM)r=t>mM(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}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],o=t+i.size;if(o>e||i instanceof gb){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof gp&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&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?mM(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?mM(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],a=o+n.size;if(-1==r&&e<=a){let i=o+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=mM(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=mM(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=a}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 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||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),o=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(i>a&&o<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((mK||mQ)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:mM(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(mK&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&mQ)&&mD(s.node,s.offset,c.anchorNode,c.anchorOffset)&&mD(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&!(d&&mK)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}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],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class gp extends gh{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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}}class gf extends gh{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.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class gm extends gh{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=h6.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new gm(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=gm.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=gI(i,t,o,n)),e>0&&(i=gI(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class gg extends gh{constructor(e,t,n,r,i,o,s,a,l){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],a,l=s&&s(t,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:o,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=h6.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return(c=gN(c,n,t),l)?a=new gx(e,t,n,r,c,d||null,u,l,i,o+1):t.isText?new gv(e,t,n,r,c,u,i):new gg(e,t,n,r,c,d||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>hf.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&gA(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,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,a=new gM(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,h,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(gT);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let e=0;e<a.length;e++)a[e].to<=o&&a.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let f=o+h.nodeSize;if(h.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-o),h=h.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice();r(h,m,t.forChild(o,h),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&a.syncToMarks(i==this.node.childCount?hv.none:this.node.child(i).marks,n,e,i),a.placeWidget(t,e,r)},(t,o,l,c)=>{let d;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,o,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,l,d,e)||a.updateNextNode(t,o,l,e,c,r)||a.addNode(t,o,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let a=n[s],l=a.dom;if(l.parentNode==t){for(;l!=i;)i=gE(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(l,i);if(a instanceof gm){let n=i?i.previousSibling:t.lastChild;e(a.contentDOM,a.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=gE(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),mZ&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof pz)||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)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;l+=t.text}if(o>=n){if(o>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}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 o=new gf(this,i,t,r);e.input.compositionNodes.push(o),this.children=gI(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(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=0}updateOuterDeco(e){if(gA(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=gC(this.dom,this.nodeDOM,gS(this.outerDeco,this.node,t),gS(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function gy(e,t,n,r,i){gN(r,t,e);let o=new gg(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class gv extends gg{constructor(e,t,n,r,i,o,s){super(e,t,n,r,i,null,o,s,0)}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 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||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=0,!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"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new gv(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class gb extends gh{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class gx extends gg{constructor(e,t,n,r,i,o,s,a,l,c){super(e,t,n,r,i,o,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)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)&&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)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let gk=function(e){e&&(this.nodeName=e)};gk.prototype=Object.create(null);let gw=[new gk];function gS(e,t,n){if(0==e.length)return gw;let r=n?gw[0]:new gk,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new gk(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new gk(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function gC(e,t,n,r){if(n==gw&&r==gw)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=gw[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&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++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&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)}}(i,s||gw[0],o)}return i}function gN(e,t,n){return gC(e,e,gw,gS(t,n,1!=e.nodeType))}function gA(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 gE(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class gM{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];r:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(e instanceof gm)n=e,r=e.children.length;else{a=e,r--;break}}else if(n==t)break r;else r=n.parent.children.indexOf(n),n=n.parent;let l=a.node;if(l){if(l!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}(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,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=gm.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}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,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof gg){let l=this.preMatch.matched.get(a);if(null!=l&&l!=i)return!1;let c=a.dom,d,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&gA(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!gA(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=gg.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=gg.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),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 gp(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 gm;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof gv)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mQ||mX)&&e&&"false"==e.dom.contentEditable&&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);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new gb(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function gT(e,t){return e.type.side-t.type.side}function gI(e,t,n,r,i){let o=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function gL(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(mB(n)){for(l=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&pF.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==m_(e);r||i;){if(e==n)return!0;let t=mM(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==m_(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new pF(s==e?a:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[l,s]=i==e.state.selection.anchor?[i,t]:[t,i],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let n="pointer"==t||e.state.selection.head<a.pos&&!o?1:-1;c=g$(e,d,a,n)}return c}function gO(e){return e.editable?e.hasFocus():gU(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function gD(e,t=!1){let n=e.state.selection;if(gB(e,n),gO(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&mX){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&mD(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,mM(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&mG&&mq<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let i,o,s,a,{anchor:l,head:c}=n,d,u;gR&&!(n instanceof pz)&&(n.$from.parent.inlineContent||(d=gP(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=gP(e,n.to))),e.docView.setSelection(l,c,e,t),gR&&(d&&gj(d),u&&gj(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),s=(o=r.domSelectionRange()).anchorNode,a=o.anchorOffset,i.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=a)&&(i.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!gO(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let gR=mQ||mX&&mY<63;function gP(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(mQ&&i&&"false"==i.contentEditable)return g_(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return g_(i);else if(o)return g_(o)}}function g_(e){return e.contentEditable="true",mQ&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function gj(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function gB(e,t){if(t instanceof pF){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(gz(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else gz(e)}function gz(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function g$(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||pz.between(t,n,r)}function gF(e){return(!e.editable||!!e.hasFocus())&&gU(e)}function gU(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function gH(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&pP.findFrom(o,t)}function gW(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function gV(e,t,n){let r=e.state.selection;if(r instanceof pz){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 o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return gW(e,new pz(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=gH(e.state,t);return!!n&&n instanceof pF&&gW(e,n)}else if(!(m0&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(pF.isSelectable(i)?gW(e,new pF(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!m8&&gW(e,new pz(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof pF&&r.node.isInline)return gW(e,new pz(t>0?r.$to:r.$from));let n=gH(e.state,t);return!!n&&gW(e,n)}}function gG(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function gq(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function gK(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(mK&&1==n.nodeType&&r<gG(n)&&gq(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(gq(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(gJ(n))break;else{let t=n.previousSibling;for(;t&&gq(t,-1);)i=n.parentNode,o=mM(t),t=t.previousSibling;if(t)r=gG(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?gX(e,n,r):i&&gX(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=gG(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(gq(i.childNodes[o],1))t=i,n=++o;else break}else if(gJ(i))break;else{let r=i.nextSibling;for(;r&&gq(r,1);)t=r.parentNode,n=mM(r)+1,r=r.nextSibling;if(r)o=0,s=gG(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&gX(e,t,n)}(e)}function gJ(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function gX(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!mj(e);)t=mM(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!mj(e);)t=mM(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(mB(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&&gD(e)},50)}function gY(e,t){let n=e.state.doc.resolve(t);if(!(mX||m1)&&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"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function gQ(e,t,n){let r=e.state.selection;if(r instanceof pz&&!r.empty||n.indexOf("s")>-1||m0&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=gH(e.state,t);if(n&&n instanceof pF)return gW(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof pH?pP.near(n,t):pP.findFrom(n,t);return!!s&&gW(e,s)}return!1}function gZ(e,t){if(!(e.state.selection instanceof pz))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 o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function g0(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function g1(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||h6.fromSchema(e.state.schema),a=g9(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&1==c.nodeType&&(d=g4[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function g2(e,t,n,r,i){let o,s,a=i.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new hx(hf.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),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,s=h6.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=g9().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),s;if((s=o&&g4[o[1].toLowerCase()])&&(e=s.map(e=>"<"+e+">").join("")+e+s.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(n=window.trustedTypes)?(ye||(ye=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),ye.createHTML(t)):t),s)for(let e=0;e<s.length;e++)i=i.querySelector(s[e])||i;return i}(n),m8&&function(e){let t=e.querySelectorAll(mX?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||hX.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||g8.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)s=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=hf.from(t.create(r[e+1],i)),o++,s++}return new hx(i,o,s)}(g3(s,+d[1],+d[2]),d[4]);else if((s=hx.maxOpen(function(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,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){let s=e(t,n,r,i.lastChild,o+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(hf.from(g5(r,t,o+1))))}}(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(hf.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));let n=g5(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return hf.from(o)}return e}(s.content,i),!0)).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=g3(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}let g8=/^(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 g5(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,hf.from(e));return e}function g6(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(o=0),i<r-1&&(a=g6(a,t,n,r,i+1,o)),i>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(hf.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function g3(e,t,n){return t<e.openStart&&(e=new hx(g6(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new hx(g6(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let g4={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},g7=null;function g9(){return g7||(g7=document.implementation.createHTMLDocument("title"))}let ye=null,yt={},yn={},yr={touchstart:!0,touchmove:!0};class yi{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 yo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ys(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ya(e,t))})}function ya(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function yl(e){return{left:e.clientX,top:e.clientY}}function yc(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function yd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}yn.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!yp(e,t))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!m2||!mX||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!mZ||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||m0&&72==r&&"c"==i)return gZ(e,-1)||gK(e,-1);if(46==r&&!t.shiftKey||m0&&68==r&&"c"==i)return gZ(e,1)||gK(e,1);if(13==r||27==r)return!0;if(37==r||m0&&66==r&&"c"==i){let t=37==r?"ltr"==gY(e,e.state.selection.from)?-1:1:-1;return gV(e,t,i)||gK(e,t)}if(39==r||m0&&70==r&&"c"==i){let t=39==r?"ltr"==gY(e,e.state.selection.from)?1:-1:1;return gV(e,t,i)||gK(e,t)}else if(38==r||m0&&80==r&&"c"==i)return gQ(e,-1,i)||gK(e,-1);else if(40==r||m0&&78==r&&"c"==i)return function(e){if(!mQ||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;g0(e,n,"true"),setTimeout(()=>g0(e,n,"false"),20)}return!1}(e)||gQ(e,1,i)||gK(e,1);else if(i==(m0?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():yo(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,mz(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},yn.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},yn.keypress=(e,t)=>{if(yp(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||m0&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof pz)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let yu=m0?"metaKey":"ctrlKey";yt.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=yy(e),s=Date.now(),a="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[yu]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?a="doubleClick":"doubleClick"==e.input.lastClick.type&&(a="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:a,button:t.button};let l=e.posAtCoords(yl(t));l&&("singleClick"==a?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new yh(e,l,t,!!o)):("doubleClick"==a?function(e,t,n,r){return yc(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return yc(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(yd(e,pz.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),o=i.before(t);if(n.inlineContent)yd(e,pz.create(r,o+1,o+1+n.content.size),"pointer");else{if(!pF.isSelectable(n))continue;yd(e,pF.create(r,o),"pointer")}return!0}}(e,n,r)})(e,l.pos,l.inside,t)?t.preventDefault():yo(e,"pointer"))};class yh{constructor(e,t,n,r){let i,o;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[yu],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof pF&&l.from<=o&&l.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&mK&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),yo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),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(()=>gD(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(yl(e))),this.updateAllowDefault(e),this.allowDefault||!t)yo(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,yc(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof pF&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(pF.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(yd(e,pF.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&pF.isSelectable(r))&&(yd(e,new pF(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||mQ&&this.mightDrag&&!this.mightDrag.node.isAtom||mX&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(yd(this.view,pP.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):yo(this.view,"pointer")}}move(e){this.updateAllowDefault(e),yo(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function yp(e,t){return!!e.composing||!!(mQ&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}yt.touchstart=e=>{e.input.lastTouch=Date.now(),yy(e),yo(e,"pointer")},yt.touchmove=e=>{e.input.lastTouch=Date.now(),yo(e,"pointer")},yt.contextmenu=e=>yy(e);let yf=m2?5e3:-1;function ym(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>yy(e),t))}function yg(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yy(e,t=!1){if(!m2||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),yg(e),t||e.docView&&e.docView.dirty){let n=gL(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}}yn.compositionstart=yn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof pz&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||mX&&m1&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),yy(e,!0),e.markCursor=null;else if(yy(e,!t.selection.empty),mK&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}ym(e,yf)},yn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,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++,ym(e,20))};let yv=mG&&mq<15||mZ&&m5<604;function yb(e,t,n,r,i){let o=g2(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||hx.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function yx(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," "):""}yt.copy=yn.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=yv?null:t.clipboardData,{dom:o,text:s}=g1(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(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)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},yn.paste=(e,t)=>{if(e.composing&&!m2)return;let n=yv?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&yb(e,yx(n),n.getData("text/html"),r,t)?t.preventDefault():function(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&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?yb(e,r.value,null,i,t):yb(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class yk{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let yw=m0?"altKey":"ctrlKey";function yS(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[yw]}for(let e in yt.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(yl(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof pF?i.to-1:i.to));else if(r&&r.mightDrag)n=pF.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=pF.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:a,text:l,slice:c}=g1(e,s);t.dataTransfer.files.length&&mX&&!(mY>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(yv?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",yv||t.dataTransfer.setData("text/plain",l),e.dragging=new yk(c,yS(e,t),n)},yt.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},yn.dragover=yn.dragenter=(e,t)=>t.preventDefault(),yn.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(yl(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=g2(e,yx(t.dataTransfer),yv?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&yS(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||hx.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let a=o?function(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<=(0==n.openStart&&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,o=r.index(t)+ +(n>0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);a=e&&s.canReplaceWith(o,o,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,i.pos,o):i.pos;null==a&&(a=i.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&pF.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new pF(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(g$(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},yt.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())&&gD(e)},20))},yt.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},yt.beforeinput=(e,t)=>{if(mX&&m2&&"deleteContentBackward"==t.inputType){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,mz(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)}},yn)yt[e]=yn[e];function yC(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}class yN{constructor(e,t){this.toDOM=e,this.spec=t||yI,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new yM(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof yN&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&yC(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yA{constructor(e,t){this.attrs=e,this.spec=t||yI}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new yM(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof yA&&yC(this.attrs,e.attrs)&&yC(this.spec,e.spec)}static is(e){return e.type instanceof yA}destroy(){}}class yE{constructor(e,t){this.attrs=e,this.spec=t||yI}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new yM(i.pos-n,o.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(e){return this==e||e instanceof yE&&yC(this.attrs,e.attrs)&&yC(this.spec,e.spec)}destroy(){}}class yM{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new yM(e,t,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(e,t,n){return new yM(e,e,new yN(t,n))}static inline(e,t,n,r){return new yM(e,t,new yA(n,r))}static node(e,t,n,r){return new yM(e,t,new yE(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof yA}get widget(){return this.type instanceof yN}}let yT=[],yI={};class yL{constructor(e,t){this.local=e.length?e:yT,this.children=t.length?t:yT}static create(e,t){return t.length?yj(t,e,0,yI):yO}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==yO||0==e.maps.length?this:this.mapInner(e,t,0,0,n||yI)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let a=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<a.length;i+=3){let o=a[i+1];if(o<0||e>o+t-r)continue;let l=a[i]+t-r;n>=l?a[i+1]=e<=l?-2:-1:e>=t&&s&&(a[i]+=s,a[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+o,-1)-i,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=yO?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=yj(function(e,t,n,r,i,o,s){for(let a=0;a<e.length;a+=3)-1==e[a+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let a=t.local[e].map(r,i,o);a?n.push(a):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[a+2],t[a]+o+1);return n}(a,e,t,n,i,o,s),r,0,s);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new yL(t.sort(yB),a)}(this.children,o||[],e,t,n,r,i):o?new yL(o.sort(yB),yT):yO}add(e,t){return t.length?this==yO?yL.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,a;if(a=yP(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,a,s+1):r.splice(i,0,o,o+e.nodeSize,yj(a,e,s+1,yI)),i+=3}});let o=yR(i?y_(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new yL(o.length?this.local.concat(o).sort(yB):this.local,r||this.children)}remove(e){return 0==e.length||this==yO?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(i,o+1);a!=yO?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new yL(r,n):yO}forChild(e,t){let n,r;if(this==yO)return this;if(t.isLeaf)return yL.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof yA){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new yL(r.sort(yB),yT);return n?new yD([e,n]):e}return n||yO}eq(e){if(this==e)return!0;if(!(e instanceof yL)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return yz(this.localsInner(e))}localsInner(e){if(this==yO)return yT;if(e.inlineContent||!this.local.some(yA.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof yA||t.push(this.local[e]);return t}forEachSet(e){e(this)}}yL.empty=new yL([],[]),yL.removeOverlap=yz;let yO=yL.empty;class yD{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,yI));return yD.from(n)}forChild(e,t){if(t.isLeaf)return yL.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=yO&&(i instanceof yD?n=n.concat(i.members):n.push(i))}return yD.from(n)}eq(e){if(!(e instanceof yD)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))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){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?yz(n?t:t.sort(yB)):yT}static from(e){switch(e.length){case 0:return yO;case 1:return e[0];default:return new yD(e.every(e=>e instanceof yL)?e:e.reduce((e,t)=>e.concat(t instanceof yL?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function yR(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 yM(i.from+t,i.to+t,i.type))}return n}function yP(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function y_(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function yj(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let a=yP(e,t,s+n);if(a){o=!0;let e=yj(a,t,n+s+1,r);e!=yO&&i.push(s,s+t.nodeSize,e)}});let s=yR(o?y_(e):e,-n).sort(yB);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new yL(s,i):yO}function yB(e,t){return e.from-t.from||e.to-t.to}function yz(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 o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),y$(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),y$(t,i,r.copy(o.from,r.to)));break}}return t}function y$(e,t,n){for(;t<e.length&&yB(n,e[t])>0;)t++;e.splice(t,0,n)}function yF(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=yO&&t.push(r)}),e.cursorWrapper&&t.push(yL.create(e.state.doc,[e.cursorWrapper.deco])),yD.from(t)}let yU={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yH=mG&&mq<=11;class yW{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}}class yV{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new yW,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]);mG&&mq<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():mQ&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),yH&&(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,yU)),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(gF(this.view)){if(this.suppressingSelectionUpdates)return gD(this.view);if(mG&&mq<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mD(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=mT(n))t.add(n);for(let r=e.anchorNode;r;r=mT(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?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(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&gF(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],l);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(a=!0))}if(l.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode)){for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(mK&&l.length){let e=l.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(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}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&mB(r)&&(c=gL(t))&&c.eq(pP.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,gD(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!yG.has(e)&&(yG.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=mK,yq||(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."),yq=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,l)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||gD(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(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(mG&&mq<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?mM(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?mM(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{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})}}let yG=new WeakMap,yq=!1;function yK(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return mD(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function yJ(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(mQ&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||mQ&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let yX=/^(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 yY(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:g$(e,t.resolve(n.anchor),t.resolve(n.head))}function yQ(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 yZ(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class y0{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 yi,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(y6),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=y8(this),y2(this),this.nodeViews=y5(this),this.docView=gy(this.state.doc,y1(this),yF(this),this.dom,this),this.domObserver=new yV(this,(e,t,n,r)=>(function(e,t,n,r,i){let o,s,a,l=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=gL(e,t);if(n&&!e.state.selection.eq(n)){if(mX&&m2&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,mz(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),l&&r.setMeta("composition",l),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let u=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:o,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],mB(c)||r.push({node:c.focusNode,offset:c.focusOffset})),mX&&8===e.input.lastKeyCode)for(let e=s;e>o;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let u=e.state.doc,h=e.someProp("domParser")||hX.fromSchema(e.state.schema),p=u.resolve(a),f=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:yJ,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),p=e.state.doc,f=p.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,s="end"):(o=e.state.selection.from,s="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let o=e.findDiffStart(t,n);if(null==o)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i){let e=Math.max(0,o-Math.min(s,a));r-=s+e-o}if(s<o&&e.size<t.size){let e=r<=o&&r>=s?o-r:0;(o-=e)&&o<t.size&&yZ(t.textBetween(o-1,o+1))&&(o+=e?1:-1),a=o+(a-s),s=o}else if(a<o){let t=r<=o&&r>=a?o-r:0;(o-=t)&&o<e.size&&yZ(e.textBetween(o-1,o+1))&&(o+=t?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}(f.content,h.doc.content,h.from,o,s);if(m&&e.input.domChangeCount++,(mZ&&e.input.lastIOSEnter>Date.now()-225||m2)&&i.some(e=>1==e.nodeType&&!yX.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,mz(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&u instanceof pz&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))m={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let t=yY(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);l&&n.setMeta("composition",l),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof pz&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),mG&&mq<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>h.from&&" "==h.doc.textBetween(m.start-h.from-1,m.start-h.from+1)&&(m.start--,m.endA--,m.endB--);let g=h.doc.resolveNoCache(m.start-h.from),y=h.doc.resolveNoCache(m.endB-h.from),v=p.resolve(m.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=m.endA;if((mZ&&e.input.lastIOSEnter>Date.now()-225&&(!b||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&g.pos<h.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(h.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,mz(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||yQ(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(yQ(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||yQ(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>t(e,mz(8,"Backspace")))){m2&&mX&&e.domObserver.suppressSelectionUpdates();return}mX&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),m2&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==m.endA&&(m.endB-=2,y=h.doc.resolveNoCache(m.endB-h.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,mz(13,"Enter"))})},20));let x=m.start,k=m.endA,w=t=>{let n=t||e.state.tr.replace(x,k,h.doc.slice(m.start-h.from,m.endB-h.from));if(h.sel){let t=yY(e,n.doc,h.sel);t&&!(mX&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==x||t.head==n.mapping.map(k)-1)||mG&&t.empty&&t.head==x)&&n.setSelection(t)}return l&&n.setMeta("composition",l),n.scrollIntoView()};if(b)if(g.pos==y.pos){mG&&mq<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>gD(e),20));let t=w(e.state.tr.delete(x,k)),n=p.resolve(m.start).marksAcross(p.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(a=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,a,l;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==i.length&&0==o.length)a=i[0],s="add",l=e=>e.mark(a.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;a=o[0],s="remove",l=e=>e.mark(a.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(l(t.child(e)));if(hf.from(c).eq(e))return{mark:a,type:s}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let t=w(e.state.tr);"add"==a.type?t.addMark(x,k,a.mark):t.removeMark(x,k,a.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>w(e.state.tr.insertText(t,x,k));e.someProp("handleTextInput",r=>r(e,x,k,t,n))||e.dispatch(n())}else e.dispatch(w());else e.dispatch(w())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in yt){let n=yt[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(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||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||ya(e,t)||!e.editable&&t.type in yn||n(e,t)},yr[t]?{passive:!0}:void 0)}mQ&&e.dom.addEventListener("input",()=>null),ys(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ys(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(y6),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(yg(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=y5(this);(function(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})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ys(this),this.editable=y8(this),y2(this);let c=yF(this),d=y1(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=s||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(o.selection))&&(a=!0);let p="preserve"==u&&a&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:m4(e.dom)}}(this);if(a){let t,n,a;this.domObserver.stop();let l=h&&(mG||mX)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,a=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(a)!=i.$anchor.start(a));if(h){let t=mX?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=m_(e=e.childNodes[t-1])}else{if(!e.parentNode||mj(e))return null;t=mM(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||mj(e))return null;t=mM(e)+1,e=e.parentNode}}}(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}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=gy(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(l=!0)}l||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),mD(t.node,t.offset,n.anchorNode,n.anchorOffset)))?gD(this,l):(gB(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;m7(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof pF){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&m3(this,t.getBoundingClientRect(),e)}else m3(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)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{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))}}}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 yk(e.slice,e.move,r<0?void 0:pF.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(mG){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("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(m9)return e.focus(m9);let t=m4(e);e.focus(null==m9?{get preventScroll(){return m9={preventScroll:!0},!0}}:void 0),m9||(m9=!1,m7(t,0))}(this.dom),gD(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&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 function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,a=0,l=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(m_(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(m_(r.startContainer),r.startOffset)}}}(o,t.left,t.top);l&&({node:s,offset:a}=l);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!ge(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(ge(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(mQ)for(let e=c;s&&e;e=mT(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(mK&&1==s.nodeType&&(a=Math.min(a,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[a],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&a++}m8&&a&&1==s.nodeType&&1==(n=s.childNodes[a-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==a||1!=s.nodeType||"BR"!=s.childNodes[a-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,a,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,a,l=0,c=n.top,d=n.top;for(let e=t.firstChild,u=0;e;e=e.nextSibling,u++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=mL(e).getClientRects()}for(let h=0;h<t.length;h++){let p=t[h];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,a=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(l=u+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(l=u+1)}}return(!o&&r&&(o=r,a=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=gn(r,1);if(n.top!=n.bottom&&ge(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,a):!o||s&&1==o.nodeType?{node:t,offset:l}:e(o,a)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return gi(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(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return gc==t&&gd==n?gu:(gc=t,gd=n,gu="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,ga(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-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=gi(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=mL(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?gl.test(r.parent.textContent)&&s.modify?ga(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:a}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==u;try{s.collapse(o,a),t&&(t!=o||i!=a)&&s.extend&&s.extend(t,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return yb(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return yb(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return g1(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yF(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,mO()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!ya(this,e)&&yt[e.type]&&(this.editable||!(e.type in yn))&&yt[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?mQ&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return yK(e,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?yK(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function y1(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[yM.node(0,e.state.doc.content.size,t)]}function y2(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:yM.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function y8(e){return!e.someProp("editable",t=>!1===t(e.state))}function y5(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 y6(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")}function y3(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}y0.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};let y4={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||"*",o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i+i),o(),a},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i),o(),a}},y7=hs({},"editorView"),y9=hs({},"editorState"),ve=hs([],"initTimer"),vt=hs({},"editor"),vn=hs([],"inputRules"),vr=hs([],"prosePlugins"),vi=hs([],"remarkPlugins"),vo=hs([],"nodeView"),vs=hs([],"markView"),va=hs(uG().use(d4).use(f1),"remark"),vl=hs({handlers:y4,encode:[]},"remarkStringifyOptions"),vc=hh("ConfigReady"),vd=hh("InitReady"),vu=hh("SchemaReady"),vh=hs([],"schemaTimer"),vp=hs({},"schema"),vf=hs([],"nodes"),vm=hs([],"marks");function vg(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}let vy=e=>(e.inject(vp,{}).inject(vf,[]).inject(vm,[]).inject(vh,[vd]).record(vu),async()=>{await e.waitTimers(vh);let t=e.get(va),n=e.get(vi).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(va,n);let r=new hK({nodes:Object.fromEntries(e.get(vf).map(([e,t])=>[e,vg(t)])),marks:Object.fromEntries(e.get(vm).map(([e,t])=>[e,vg(t)]))});return e.set(vp,r),e.done(vu),()=>{e.remove(vp).remove(vf).remove(vm).remove(vh).clearTimer(vu)}});y3(vy,{displayName:"Schema"});class vv{constructor(){this.#g=new hr,this.#N=null,this.setCtx=e=>{this.#N=e},this.chain=()=>{if(null==this.#N)throw hn();let e=this.#N,t=[],n=this.get.bind(this),r={run:()=>{let n=fc(...t),r=e.get(y7);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:(function(e,i){let o=n(e);return t.push(o(i)),r}).bind(this)};return r}}#g;#N;get ctx(){return this.#N}create(e,t){let n=e.create(this.#g.sliceMap);return n.set(t),n}get(e){return this.#g.get(e).get()}remove(e){return this.#g.remove(e)}call(e,t){if(null==this.#N)throw hn();let n=this.get(e)(t),r=this.#N.get(y7);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#N)throw hn();let t=this.#N.get(y7);return e(t.state,t.dispatch,t)}}let vb=hs(new vv,"commands"),vx=hs([vu],"commandsTimer"),vk=hh("CommandsReady"),vw=e=>{let t=new vv;return t.setCtx(e),e.inject(vb,t).inject(vx,[vu]).record(vk),async()=>(await e.waitTimers(vx),e.done(vk),()=>{e.remove(vb).remove(vx).clearTimer(vk)})};y3(vw,{displayName:"Commands"});class vS{constructor(){this.#N=null,this.#A=[],this.setCtx=e=>{this.#N=e},this.add=e=>(this.#A.push(e),()=>{this.#A=this.#A.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){let r={key:e,onRun:()=>n};this.#A.push(r),t.push(()=>{this.#A=this.#A.filter(e=>e!==r)})}else this.#A.push(n),t.push(()=>{this.#A=this.#A.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=(ff.Backspace=fc(mi,p8,p3,p7),ff);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#A.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{let i=this.#N;if(null==i)throw u9();return fc(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#N;#A;get ctx(){return this.#N}}let vC=hs(new vS,"keymap"),vN=hs([vu],"keymapTimer"),vA=hh("KeymapReady"),vE=e=>{let t=new vS;return t.setCtx(e),e.inject(vC,t).inject(vN,[vu]).record(vA),async()=>(await e.waitTimers(vN),e.done(vA),()=>{e.remove(vC).remove(vN).clearTimer(vA)})},vM=hh("ParserReady"),vT=()=>{throw u9()},vI=hs(vT,"parser"),vL=hs([],"parserTimer"),vO=e=>(e.inject(vI,vT).inject(vL,[vu]).record(vM),async()=>{await e.waitTimers(vL);let t=e.get(va),n=e.get(vp);return e.set(vI,me.create(n,t)),e.done(vM),()=>{e.remove(vI).remove(vL).clearTimer(vM)}});y3(vO,{displayName:"Parser"});let vD=hh("SerializerReady"),vR=hs([],"serializerTimer"),vP=()=>{throw u9()},v_=hs(vP,"serializer"),vj=e=>(e.inject(v_,vP).inject(vR,[vu]).record(vD),async()=>{await e.waitTimers(vR);let t=e.get(va),n=e.get(vp);return e.set(v_,mn.create(n,t)),e.done(vD),()=>{e.remove(v_).remove(vR).clearTimer(vD)}});y3(vj,{displayName:"Serializer"});let vB=hs("","defaultValue"),vz=hs(e=>e,"stateOptions"),v$=hs([],"editorStateTimer"),vF=hh("EditorStateReady"),vU=new p2("MILKDOWN_STATE_TRACKER"),vH=e=>(e.inject(vB,"").inject(y9,{}).inject(vz,e=>e).inject(v$,[vM,vD,vk,vA]).record(vF),async()=>{await e.waitTimers(v$);let t=e.get(vp),n=e.get(vI),r=e.get(vn),i=e.get(vz),o=e.get(vr),s=function(e,t,n){var r;if("string"==typeof e)return t(e);if("html"===e.type)return hX.fromSchema(n).parse(e.dom);if("json"===e.type)return hD.fromJSON(n,e.value);throw r=e,new u4(u3.docTypeError,`Doc type error, unsupported type: ${JSON.stringify(r,u7)}`)}(e.get(vB),n,t),a=e.get(vC),l=a.addBaseKeymap(),c=[...o,new pZ({key:vU,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(y9,i)}}}),function({rules:e}){let t=new pZ({key:mg,isInputRules:!0,state:{init:()=>null,apply(e,t){let n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>mm(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&mm(n,r.pos,r.pos,"",e,t)}),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;let{$cursor:i}=n.state.selection;return!!i&&mm(n,i.pos,i.pos,"\n",e,t)}}});return t}({rules:r}),mE(a.build())];e.set(vr,c);let d=i({schema:t,doc:s,plugins:c}),u=pQ.create(d);return e.set(y9,u),e.done(vF),()=>{l(),e.remove(vB).remove(y9).remove(vz).remove(v$).clearTimer(vF)}});y3(vH,{displayName:"EditorState"});let vW=hs([],"pasteRule"),vV=hs([vu],"pasteRuleTimer"),vG=hh("PasteRuleReady"),vq=e=>(e.inject(vW,[]).inject(vV,[vu]).record(vG),async()=>(await e.waitTimers(vV),e.done(vG),()=>{e.remove(vW).remove(vV).clearTimer(vG)}));y3(vq,{displayName:"PasteRule"});let vK=hh("EditorViewReady"),vJ=hs([],"editorViewTimer"),vX=hs({},"editorViewOptions"),vY=hs(null,"root"),vQ=hs(null,"rootDOM"),vZ=hs({},"rootAttrs"),v0=new p2("MILKDOWN_VIEW_CLEAR"),v1=e=>(e.inject(vY,document.body).inject(y7,{}).inject(vX,{}).inject(vQ,null).inject(vZ,{}).inject(vJ,[vF,vG]).record(vK),async()=>{var t;await e.wait(vd);let n=e.get(vY)||document.body,r="string"==typeof n?document.querySelector(n):n;e.update(vr,t=>[new pZ({key:v0,view:t=>{let n,i=r?((n=document.createElement("div")).className="milkdown",r.appendChild(n),e.set(vQ,n),Object.entries(e.get(vZ)).forEach(([e,t])=>n.setAttribute(e,t)),n):void 0;if(i&&r){let e=t.dom;r.replaceChild(i,e),i.appendChild(e)}return{destroy:()=>{i?.parentNode&&i?.parentNode.replaceChild(t.dom,i),i?.remove()}}}}),...t]),await e.waitTimers(vJ);let i=e.get(y9),o=e.get(vX),s=new y0(r,{state:i,nodeViews:Object.fromEntries(e.get(vo)),markViews:Object.fromEntries(e.get(vs)),transformPasted:(t,n,r)=>(e.get(vW).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...o});return(t=s.dom).classList.add("editor"),t.setAttribute("role","textbox"),e.set(y7,s),e.done(vK),()=>{s?.destroy(),e.remove(vY).remove(y7).remove(vX).remove(vQ).remove(vZ).remove(vJ).clearTimer(vK)}});y3(v1,{displayName:"EditorView"});var v2=((k=v2||{}).Idle="Idle",k.OnCreate="OnCreate",k.Created="Created",k.OnDestroy="OnDestroy",k.Destroyed="Destroyed",k);class v8{constructor(){this.#E=!1,this.#k="Idle",this.#M=[],this.#T=()=>void 0,this.#g=new hr,this.#y=new hc,this.#I=new Map,this.#L=new Map,this.#N=new hl(this.#g,this.#y),this.#O=()=>{var e,t;let n,r,i=(e=async e=>{await Promise.all(this.#M.map(t=>Promise.resolve(t(e))))},y3(n=t=>(t.record(vc),async()=>(await e(t),t.done(vc),()=>{t.clearTimer(vc)})),{displayName:"Config"}),n),o=[vy,vO,vj,vw,vE,vq,vH,v1,(t=this,y3(r=e=>(e.inject(vt,t).inject(vr,[]).inject(vi,[]).inject(vn,[]).inject(vo,[]).inject(vs,[]).inject(vl,{handlers:y4,encode:[]}).inject(va,uG().use(d4).use(f1)).inject(ve,[vc]).record(vd),async()=>{await e.waitTimers(ve);let t=e.get(vl);return e.set(va,uG().use(d4).use(f1,t)),e.done(vd),()=>{e.remove(vt).remove(vr).remove(vi).remove(vn).remove(vo).remove(vs).remove(vl).remove(va).remove(ve).clearTimer(vd)}}),{displayName:"Init"}),r),i];this.#D(o,this.#L)},this.#D=(e,t)=>{e.forEach(e=>{let n=this.#N.produce(this.#E?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})},this.#R=(e,t=!1)=>Promise.all([e].flat().map(async e=>{let n=this.#I.get(e),r=n?.cleanup;return(t?this.#I.delete(e):this.#I.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof r)?r():r})),this.#P=async()=>{await Promise.all([...this.#L.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#L.clear()},this.#_=e=>{this.#k=e,this.#T(e)},this.#j=e=>[...e.entries()].map(async([t,n])=>{let{ctx:r,handler:i}=n;if(!i)return;let o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})}),this.enableInspector=(e=!0)=>(this.#E=e,this),this.onStatusChange=e=>(this.#T=e,this),this.config=e=>(this.#M.push(e),this),this.removeConfig=e=>(this.#M=this.#M.filter(t=>t!==e),this),this.use=e=>{let t=[e].flat();return t.flat().forEach(e=>{this.#I.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),"Created"===this.#k&&this.#D(t,this.#I),this},this.remove=async e=>"OnCreate"===this.#k?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#R([e].flat(),!0),this),this.create=async()=>("OnCreate"===this.#k||("Created"===this.#k&&await this.destroy(),this.#_("OnCreate"),this.#O(),this.#D([...this.#I.keys()],this.#I),await Promise.all([this.#j(this.#L),this.#j(this.#I)].flat()),this.#_("Created")),this),this.destroy=async(e=!1)=>"Destroyed"===this.#k||"OnDestroy"===this.#k?this:"OnCreate"===this.#k?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#M=[]),this.#_("OnDestroy"),await this.#R([...this.#I.keys()],e),await this.#P(),this.#_("Destroyed"),this),this.action=e=>e(this.#N),this.inspect=()=>this.#E?[...this.#L.values(),...this.#I.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new v8}#E;#k;#M;#T;#g;#y;#I;#L;#N;#O;#D;#R;#P;#_;#j;get ctx(){return this.#N}get status(){return this.#k}}let v5=e=>crypto.getRandomValues(new Uint8Array(e)),v6=(e,t=21)=>{var n;let r,i;return n=0|t,i=-~(1.6*(r=(2<<Math.log2(e.length-1))-1)*n/e.length),(t=n)=>{let o="";for(;;){let n=v5(i),s=0|i;for(;s--;)if((o+=e[n[s]&r]||"").length>=t)return o}}};function v3(e,t){let n=function(e="cmdKey"){return hs(()=>()=>!1,e)}(e),r=i=>async()=>{r.key=n,await i.wait(vk);let o=t(i);return i.get(vb).create(n,o),r.run=t=>i.get(vb).call(e,t),()=>{i.get(vb).remove(n)}};return r}function v4(e){let t=n=>async()=>{await n.wait(vu);let r=e(n);return n.update(vn,e=>[...e,r]),t.inputRule=r,()=>{n.update(vn,e=>e.filter(e=>e!==r))}};return t}function v7(e,t){let n=r=>async()=>{let i=t(r);return r.update(vf,t=>[...t.filter(t=>t[0]!==e),[e,i]]),n.id=e,n.schema=i,()=>{r.update(vf,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{let n=t.get(vp).nodes[e];if(!n)throw new u4(u3.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`);return n},n}function v9(e){let t,n=n=>async()=>(await n.wait(vu),t=e(n),n.update(vr,e=>[...e,t]),()=>{n.update(vr,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function be(e,t){let n=hs(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function bt(e,t){let n=be(t,e),r=v7(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>bt(e,n(t)),i}function bn(e,t){var n;let r,i=be(t,e),o=(n=e=>e.get(i.key)(e),(r=t=>async()=>{let i=n(t);return t.update(vm,t=>[...t.filter(t=>t[0]!==e),[e,i]]),r.id=e,r.schema=i,()=>{t.update(vm,t=>t.filter(([t])=>t!==e))}}).type=t=>{let n=t.get(vp).marks[e];if(!n)throw new u4(u3.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`);return n},r),s=[i,o];return s.id=o.id,s.mark=o,s.type=e=>o.type(e),s.ctx=i,s.key=i.key,s.extendSchema=n=>bn(e,n(t)),s}function br(e,t){var n;let r,i=be(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),o=(n=e=>{let n=e.get(i.key);return Object.fromEntries(Object.entries(t).flatMap(([e,{command:t}])=>{let r=n[e],i=[r.shortcuts].flat(),o=r.priority;return i.map(e=>[e,{key:e,onRun:t,priority:o}])}))},r=e=>async()=>{await e.wait(vA);let t=e.get(vC),i=n(e),o=t.addObjectKeymap(i);return r.keymap=i,()=>{o()}}),s=[i,o];return s.ctx=i,s.shortcuts=o,s.key=i.key,s.keymap=o.keymap,s}v6("abcedfghicklmn",10);let bi=(e,t=()=>({}))=>be(t,`${e}Attr`),bo=(e,t=()=>({}))=>be(t,`${e}Attr`);function bs(e,t,n){let r=be(n??{},e),i=e=>async()=>{await e.wait(vd);let n={plugin:t(e),options:e.get(r.key)};return e.update(vi,e=>[...e,n]),()=>{e.update(vi,e=>e.filter(e=>e!==n))}},o=[r,i];return o.id=e,o.plugin=i,o.options=r,o}function ba(e){return String(e||"").toUpperCase()}function bl(){return function(e){let t=function(e){let t=new Map;if(!e||!e.type)throw Error("mdast-util-definitions expected node");return um(e,"definition",function(e){let n=ba(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){let n=ba(e);return t.get(n)}}(e);um(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[up,n];if("imageReference"===e.type||"linkReference"===e.type){let i=t(e.identifier);if(i&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:i.url,title:i.title,alt:e.alt}:{type:"link",url:i.url,title:i.title,children:e.children},[up,n]}})}}function bc(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name==="hardbreak"))return void e.next(t.content);let n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(hf.fromArray(n))}function bd(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}let bu=bo("emphasis");bd(bu,{displayName:"Attr<emphasis>",group:"Emphasis"});let bh=bn("emphasis",e=>({attrs:{marker:{default:e.get(vl).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(bu.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));bd(bh.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),bd(bh.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});let bp=v3("ToggleEmphasis",e=>()=>fl(bh.type(e)));bd(bp,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});let bf=v4(e=>my(/(?:^|[^*])\*([^*]+)\*$/,bh.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));bd(bf,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});let bm=v4(e=>my(/\b_(?![_\s])(.*?[^_\s])_\b/,bh.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));bd(bm,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});let bg=br("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{let t=e.get(vb);return()=>t.call(bp.key)}}});bd(bg.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),bd(bg.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});let by=bo("strong");bd(by,{displayName:"Attr<strong>",group:"Strong"});let bv=bn("strong",e=>({attrs:{marker:{default:e.get(vl).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(by.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));bd(bv.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),bd(bv.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});let bb=v3("ToggleStrong",e=>()=>fl(bv.type(e)));bd(bb,{displayName:"Command<toggleStrongCommand>",group:"Strong"});let bx=v4(e=>my(RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),bv.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));bd(bx,{displayName:"InputRule<strong>",group:"Strong"});let bk=br("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{let t=e.get(vb);return()=>t.call(bb.key)}}});bd(bk.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),bd(bk.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});let bw=bo("inlineCode");bd(bw,{displayName:"Attr<inlineCode>",group:"InlineCode"});let bS=bn("inlineCode",e=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(bw.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>{e.withMark(t,"inlineCode",n.text||"")}}}));bd(bS.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),bd(bS.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});let bC=v3("ToggleInlineCode",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(r.empty)return!1;let{from:o,to:s}=r;return t.doc.rangeHasMark(o,s,bS.type(e))?n?.(i.removeMark(o,s,bS.type(e))):(Object.keys(t.schema.marks).filter(e=>e!==bS.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(o,s,e)}),n?.(i.addMark(o,s,bS.type(e).create()))),!0});bd(bC,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});let bN=v4(e=>my(/(?:`)([^`]+)(?:`)$/,bS.type(e)));bd(bN,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});let bA=br("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{let t=e.get(vb);return()=>t.call(bC.key)}}});bd(bA.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),bd(bA.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});let bE=bo("link");bd(bE,{displayName:"Attr<link>",group:"Link"});let bM=bn("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(bE.key)(t),...t.attrs}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{let r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));bd(bM.mark,{displayName:"MarkSchema<link>",group:"Link"});let bT=v3("ToggleLink",e=>(t={})=>fl(bM.type(e),t));bd(bT,{displayName:"Command<toggleLinkCommand>",group:"Link"});let bI=v3("UpdateLink",e=>(t={})=>(n,r)=>{let i;if(!r)return!1;let o=-1,{selection:s}=n,{from:a,to:l}=s;if(n.doc.nodesBetween(a,a===l?l+1:l,(t,n)=>{if(bM.type(e).isInSet(t.marks))return i=t,o=n,!1}),!i)return!1;let c=i.marks.find(({type:t})=>t===bM.type(e));if(!c)return!1;let d=o,u=o+i.nodeSize,{tr:h}=n,p=bM.type(e).create({...c.attrs,...t});return!!p&&(r(h.removeMark(d,u,c).addMark(d,u,p).setSelection(new pz(h.selection.$anchor)).scrollIntoView()),!0)});bd(bI,{displayName:"Command<updateLinkCommand>",group:"Link"});let bL=v7("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root"),e.next(t.content)}}}));function bO(e){return uf(e,e=>"html"===e.type&&["<br />","<br>","<br >","<br/>"].includes(e.value?.trim()),(e,t)=>{if(!t.length)return;let n=t[t.length-1];if(!n)return;let r=n.children.indexOf(e);-1!==r&&n.children.splice(r,1)},!0)}bd(bL,{displayName:"NodeSchema<doc>",group:"Doc"});let bD=bs("remark-preserve-empty-line",()=>()=>bO);bd(bD.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),bd(bD.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});let bR=bi("paragraph");bd(bR,{displayName:"Attr<paragraph>",group:"Paragraph"});let bP=bt("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(bR.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{let r=e.get(y7),i=r.state?.doc.lastChild;t.openNode("paragraph"),(!n.content||0===n.content.size)&&n!==i&&function(e){let t=!1;try{e.get(bD.id),t=!0}catch{t=!1}return t}(e)?t.addNode("html",void 0,"<br />"):bc(t,n),t.closeNode()}}}));bd(bP.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),bd(bP.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});let b_=v3("TurnIntoText",e=>()=>fa(bP.type(e)));bd(b_,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});let bj=br("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{let t=e.get(vb);return()=>t.call(b_.key)}}});bd(bj.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),bd(bj.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});let bB=Array(6).fill(0).map((e,t)=>t+1),bz=be(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");bd(bz,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});let b$=bi("heading");bd(b$,{displayName:"Attr<heading>",group:"Heading"});let bF=bt("heading",e=>{let t=e.get(bz.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:bB.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw ht(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(b$.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{let r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),bc(e,t),e.closeNode()}}}});bd(bF.node,{displayName:"NodeSchema<heading>",group:"Heading"}),bd(bF.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});let bU=v4(e=>ms(/^(?<hashes>#+)\s$/,bF.type(e),t=>{let n=t.groups?.hashes?.length||0,{$from:r}=e.get(y7).state.selection,i=r.node();if("heading"===i.type.name){let e=Number(i.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));bd(bU,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});let bH=v3("WrapInHeading",e=>t=>(t??=1)<1?fa(bP.type(e)):fa(bF.type(e),{level:t}));bd(bH,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});let bW=v3("DowngradeHeading",e=>()=>(t,n,r)=>{let{$from:i}=t.selection,o=i.node();if(o.type!==bF.type(e)||!t.selection.empty||0!==i.parentOffset)return!1;let s=o.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...o.attrs,level:s})),!0):fa(bP.type(e))(t,n,r)});bd(bW,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});let bV=br("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{let t=e.get(vb);return()=>t.call(bH.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{let t=e.get(vb);return()=>t.call(bW.key)}}});bd(bV.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),bd(bV.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});let bG=bi("blockquote");bd(bG,{displayName:"Attr<blockquote>",group:"Blockquote"});let bq=bt("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(bG.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));bd(bq.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),bd(bq.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});let bK=v4(e=>mo(/^\s*>\s$/,bq.type(e)));bd(bK,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});let bJ=v3("WrapInBlockquote",e=>()=>fs(bq.type(e)));bd(bJ,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});let bX=br("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{let t=e.get(vb);return()=>t.call(bJ.key)}}});bd(bX.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),bd(bX.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});let bY=bi("codeBlock",()=>({pre:{},code:{}}));bd(bY,{displayName:"Attr<codeBlock>",group:"CodeBlock"});let bQ=bt("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{language:e.dataset.language}}}],toDOM:t=>{let n=e.get(bY.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{let r=t.lang??"",i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));bd(bQ.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),bd(bQ.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});let bZ=v4(e=>ms(/^```(?<language>[a-z]*)?[\s\n]$/,bQ.type(e),e=>({language:e.groups?.language??""})));bd(bZ,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});let b0=v3("CreateCodeBlock",e=>(t="")=>fa(bQ.type(e),{language:t}));bd(b0,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),bd(v3("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0)),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});let b1=br("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{let t=e.get(vb);return()=>t.call(b0.key)}}});bd(b1.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),bd(b1.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});let b2=bi("image");bd(b2,{displayName:"Attr<image>",group:"Image"});let b8=bt("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(b2.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{let r=t.url,i=t.alt,o=t.title;e.addNode(n,{src:r,alt:i,title:o})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));bd(b8.node,{displayName:"NodeSchema<image>",group:"Image"}),bd(b8.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});let b5=v3("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;let{src:i="",alt:o="",title:s=""}=t,a=b8.type(e).create({src:i,alt:o,title:s});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});bd(b5,{displayName:"Command<insertImageCommand>",group:"Image"});let b6=v3("UpdateImage",e=>(t={})=>(n,r)=>{let i=function(e,t){if(!(e instanceof pF))return;let{node:n,$from:r}=e;if(Array.isArray(t)&&t.includes(n.type)||n.type===t)return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}(n.selection,b8.type(e));if(!i)return!1;let{node:o,pos:s}=i,a={...o.attrs},{src:l,alt:c,title:d}=t;return void 0!==l&&(a.src=l),void 0!==c&&(a.alt=c),void 0!==d&&(a.title=d),r?.(n.tr.setNodeMarkup(s,void 0,a).scrollIntoView()),!0});bd(b6,{displayName:"Command<updateImageCommand>",group:"Image"}),bd(v4(e=>new mr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{let[o,s,a="",l]=n;return o?t.tr.replaceWith(r,i,b8.type(e).create({src:a,alt:s,title:l})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});let b3=bi("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));bd(b3,{displayName:"Attr<hardbreak>",group:"Hardbreak"});let b4=bt("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(b3.key)(t)," "]:["br",e.get(b3.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:!!t.data?.isInline})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));bd(b4.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),bd(b4.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});let b7=v3("InsertHardbreak",e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(!(r instanceof pz))return!1;if(r.empty){let e=r.$from.node();if(e.childCount>0&&e.lastChild?.type.name==="hardbreak")return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(pP.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta("hardbreak",!0).replaceSelectionWith(b4.type(e).create()).scrollIntoView()),!0});bd(b7,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});let b9=br("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{let t=e.get(vb);return()=>t.call(b7.key)}}});bd(b9.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),bd(b9.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});let xe=bi("hr");bd(xe,{displayName:"Attr<hr>",group:"Hr"});let xt=bt("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(xe.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));bd(xt.node,{displayName:"NodeSchema<hr>",group:"Hr"}),bd(xt.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});let xn=v4(e=>new mr(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{let{tr:o}=t;return n[0]&&o.replaceWith(r-1,i,xt.type(e).create()),o}));bd(xn,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});let xr=v3("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;let r=bP.node.type(e).create(),{tr:i,selection:o}=t,{from:s}=o,a=xt.type(e).create();if(!a)return!0;let l=i.replaceSelectionWith(a).insert(s,r),c=pP.findFrom(l.doc.resolve(s),1,!0);return!c||(n(l.setSelection(c).scrollIntoView()),!0)});bd(xr,{displayName:"Command<insertHrCommand>",group:"Hr"});let xi=bi("bulletList");bd(xi,{displayName:"Attr<bulletList>",group:"BulletList"});let xo=bt("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(xi.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"false";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));bd(xo.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),bd(xo.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});let xs=v4(e=>mo(/^\s*([-+*])\s$/,xo.type(e)));bd(xs,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});let xa=v3("WrapInBulletList",e=>()=>fs(xo.type(e)));bd(xa,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});let xl=br("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{let t=e.get(vb);return()=>t.call(xa.key)}}});bd(xl.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),bd(xl.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});let xc=bi("orderedList");bd(xc,{displayName:"Attr<orderedList>",group:"OrderedList"});let xd=bt("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(xc.key)(t),...1===t.attrs.order?{}:t.attrs.order,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{let r=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:"true"===t.attrs.spread}),e.next(t.content),e.closeNode()}}}));bd(xd.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),bd(xd.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});let xu=v4(e=>mo(/^\s*(\d+)\.\s$/,xd.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));bd(xu,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});let xh=v3("WrapInOrderedList",e=>()=>fs(xd.type(e)));bd(xh,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});let xp=br("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{let t=e.get(vb);return()=>t.call(xh.key)}}});bd(xp.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),bd(xp.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});let xf=bi("listItem");bd(xf,{displayName:"Attr<listItem>",group:"ListItem"});let xm=bt("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw ht(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(xf.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{let r=null!=t.label?`${t.label}.`:"•",i=null!=t.label?"ordered":"bullet",o=null!=t.spread?`${t.spread}`:"true";e.openNode(n,{label:r,listType:i,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));bd(xm.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),bd(xm.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});let xg=v3("SinkListItem",e=>()=>{var t;return t=xm.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let r=l.lastChild&&l.lastChild.type==a.type,i=hf.from(r?t.create():null),s=new hx(hf.from(t.create(null,hf.from(a.type.create(null,i)))),r?3:1,0),c=o.start,d=o.end;n(e.tr.step(new ph(c-(r?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0}});bd(xg,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});let xy=v3("LiftListItem",e=>()=>{var t;return t=xm.type(e),function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,e=>e.childCount>0&&e.firstChild.type==t);return!!o&&(!n||(r.node(o.depth-1).type==t?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new ph(o-1,s,o,s,new hx(hf.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new hL(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let a=pm(r);if(null==a)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return pk(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),t(i.scrollIntoView()),!0}(e,n,t,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!a,d+1,s.content.append(l?hf.empty:hf.from(i))))return!1;let u=o.pos,h=u+s.nodeSize;return r.step(new ph(u-!!a,h+ +!!l,u+1,h-1,new hx((a?hf.empty:hf.from(i.copy(hf.empty))).append(l?hf.empty:hf.from(i.copy(hf.empty))),+!a,+!l),+!a)),t(r.scrollIntoView()),!0}(e,n,o)))}});bd(xy,{displayName:"Command<liftListItemCommand>",group:"ListItem"});let xv=v3("SplitListItem",e=>()=>{var t;return t=xm.type(e),function(e,n){let{$from:r,$to:i,node:o}=e.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(i))return!1;let s=r.node(-1);if(s.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(3==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){let i=hf.empty,o=r.index(-1)?1:r.index(-2)?2:3;for(let e=r.depth-o;e>=r.depth-3;e--)i=hf.from(r.node(e).copy(i));let s=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;i=i.append(hf.from(t.createAndFill()));let a=r.before(r.depth-(o-1)),l=e.tr.replace(a,r.after(-s),new hx(i,4-o,0)),c=-1;l.doc.nodesBetween(a,l.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&l.setSelection(pP.near(l.doc.resolve(c))),n(l.scrollIntoView())}return!0}let a=i.pos==r.end()?s.contentMatchAt(0).defaultType:null,l=e.tr.delete(r.pos,i.pos),c=a?[null,{type:a}]:void 0;return!!px(l.doc,r.pos,2,c)&&(n&&n(l.split(r.pos,2,c).scrollIntoView()),!0)}});bd(xv,{displayName:"Command<splitListItemCommand>",group:"ListItem"});let xb=v3("LiftFirstListItem",e=>()=>(t,n,r)=>{let{selection:i}=t;if(!(i instanceof pz))return!1;let{empty:o,$from:s}=i;return!!o&&0===s.parentOffset&&s.node(-1).type===xm.type(e)&&p6(t,n,r)});bd(xb,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});let xx=br("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{let t=e.get(vb);return()=>t.call(xv.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{let t=e.get(vb);return()=>t.call(xg.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{let t=e.get(vb);return()=>t.call(xy.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{let t=e.get(vb);return()=>t.call(xb.key)}}});bd(xx.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),bd(xx.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});let xk=v7("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));bd(xk,{displayName:"NodeSchema<text>",group:"Text"});let xw=bi("html");bd(xw,{displayName:"Attr<html>",group:"Html"});let xS=bt("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{let n=document.createElement("span"),r={...e.get(xw.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>"html"===e,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));bd(xS.node,{displayName:"NodeSchema<html>",group:"Html"}),bd(xS.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});let xC=[bL,bR,bP,bz,b$,bF,b3,b4,bG,bq,bY,bQ,xe,xt,b2,b8,xi,xo,xc,xd,xf,xm,bu,bh,by,bv,bw,bS,bE,bM,xw,xS,xk].flat(),xN=[bK,xs,xu,bZ,xn,bU].flat(),xA=[bf,bm,bN,bx],xE=[b_,bJ,bH,bW,b0,b7,xr,b5,b6,xh,xa,xg,xv,xy,xb,bp,bC,bb,bT,bI,v3("IsMarkSelected",()=>e=>t=>{if(!e)return!1;let{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),v3("IsNoteSelected",()=>e=>t=>!!e&&((e,t)=>{let{selection:n,doc:r}=e;if(n instanceof pF)return{hasNode:n.node.type===t,pos:n.from,target:n.node};let{from:i,to:o}=n,s=!1,a=-1,l=null;return r.nodesBetween(i,o,(e,n)=>!l&&(e.type!==t||(s=!0,a=n,l=e,!1))),{hasNode:s,pos:a,target:l}})(t,e).hasNode),v3("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr,{$from:r,$to:i}=n.selection,{pos:o}=r,{pos:s}=i,a=o-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,s),t?.(n),!0)}),v3("SetBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr,{from:s,to:a}=o.selection;try{o.setBlockType(s,a,r,i)}catch{return!1}return n?.(o),!0}),v3("WrapInBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let{$from:e,$to:t}=o.selection,n=e.blockRange(t),s=n&&pg(n,r,i);if(!s)return!1;o=o.wrap(n,s)}catch{return!1}return n?.(o),!0}),v3("AddBlockType",()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let o=t.tr;try{let e=r instanceof hD?r:r.createAndFill(i);if(!e)return!1;o.replaceSelectionWith(e)}catch{return!1}return n?.(o),!0}),v3("SelectTextNearPos",()=>e=>(t,n)=>{let{pos:r}=e??{};if(null==r)return!1;let i=t.tr;try{let e,n=t.doc.resolve((e=t.doc.content.size,Math.min(Math.max(r,0),e)));i.setSelection(pz.near(n))}catch{return!1}return n?.(i.scrollIntoView()),!0})],xM=[bX,b1,b9,bV,xx,xp,xl,bj,bg,bA,bk].flat(),xT=bs("remarkAddOrderInList",()=>()=>e=>{um(e,"list",e=>{if(e.ordered){let t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});bd(xT.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),bd(xT.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});let xI=bs("remarkLineBreak",()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;um(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;let i=[],o=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){let n=s.index;o!==n&&i.push({type:"text",value:e.value.slice(o,n)}),i.push({type:"break",data:{isInline:!0}}),o=n+s[0].length,s=t.exec(e.value)}if(i.length>0&&r&&"number"==typeof n)return o<e.value.length&&i.push({type:"text",value:e.value.slice(o)}),r.children.splice(n,1,...i),n+i.length})});bd(xI.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),bd(xI.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});let xL=bs("remarkInlineLink",()=>bl);bd(xL.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),bd(xL.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});let xO=["root","blockquote","listItem"],xD=bs("remarkHTMLTransformer",()=>()=>e=>{(function e(t,n,r){if(t.children){let n=[];for(let r=0,i=t.children.length;r<i;r++){let i=t.children[r];if(i){let o=e(i,r,t);if(o)for(let e=0,t=o.length;e<t;e++){let t=o[e];t&&n.push(t)}}}t.children=n}return((e,t,n)=>("html"!==e.type||n&&xO.includes(n.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]))(t,n,r)})(e,0,null)[0]});bd(xD.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),bd(xD.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});let xR=bs("remarkMarker",()=>()=>(e,t)=>{um(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=t.value.charAt(e.position.start.offset)})});bd(xR.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),bd(xR.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});let xP=v9(()=>{let e=!1,t=new pZ({key:new p2("MILKDOWN_INLINE_NODES_CURSOR"),state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;let t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!!n&&!!r&&!!n.isInline&&!n.isText&&!!r.isInline&&!r.isText}},props:{handleDOMEvents:{compositionend:(n,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){let e=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,r)=>{if(t.getState(n.state)&&r instanceof InputEvent&&r.data&&!e){let e=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(t.getState(e)){let t=e.selection.$from.pos,n=document.createElement("span"),r=yM.widget(t,n,{side:-1}),i=document.createElement("span"),o=yM.widget(t,i);return setTimeout(()=>{n.contentEditable="true",i.contentEditable="true"}),yL.create(e.doc,[r,o])}return yL.empty}}});return t});bd(xP,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});let x_=v9(e=>new pZ({key:new p2("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;let[i]=t;if(!i)return;let[o]=i.steps;if(i.getMeta("hardbreak")){if(!(o instanceof pu))return;let{from:t}=o;return r.tr.setNodeMarkup(t,b4.type(e),void 0,[])}if(o instanceof pa){let t=r.tr,{from:n,to:i}=o;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===b4.type(e)&&(t=t.setNodeMarkup(r,b4.type(e),void 0,[]))}),t}}}));bd(x_,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});let xj=be(["table","code_block"],"hardbreakFilterNodes");bd(xj,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});let xB=v9(e=>{let t=e.get(xj.key);return new pZ({key:new p2("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{let r=e.getMeta("hardbreak"),[i]=e.steps;if(r&&i){let{from:e}=i,r=n.doc.resolve(e),o=r.depth,s=!0;for(;o>0;)t.includes(r.node(o).type.name)&&(s=!1),o--;return s}return!0}})});bd(xB,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});let xz=v9(e=>{let t=new p2("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;let r=e.get(bz.key),i=n.state.tr.setMeta("addToHistory",!1),o=!1,s={};n.state.doc.descendants((n,a)=>{if(n.type===bF.type(e)){if(0===n.textContent.trim().length)return;let e=n.attrs,l=r(n);s[l]?(s[l]+=1,l+=`-#${s[l]}`):s[l]=1,e.id!==l&&(o=!0,i.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:l}))}}),o&&n.dispatch(i)};return new pZ({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});bd(xz,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});let x$=v9(e=>new pZ({key:new p2("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;let i=xd.type(e),o=xo.type(e),s=xm.type(e),a=(e,t)=>{let n=!1,r=`${t+1}.`;return e.label!==r&&(e.label=r,n=!0),n},l=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===o){let n=e.maybeChild(0);n?.type===s&&"ordered"===n.attrs.listType&&(c=!0,l.setNodeMarkup(t,i,{spread:"true"}),e.descendants((e,t,n,r)=>{if(e.type===s){let n={...e.attrs};a(n,r)&&(l=l.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===s&&n?.type===i){let i={...e.attrs},o=!1;"ordered"!==i.listType&&(i.listType="ordered",o=!0),n?.maybeChild(0)&&(o=a(i,r)),o&&(l=l.setNodeMarkup(t,void 0,i),c=!0)}}),c?l.setMeta("addToHistory",!1):null}}));bd(x$,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});let xF=[xC,xN,xA,xE,xM,[x_,xj,xB,xP,xT,xL,xI,xD,xR,bD,xz,x$].flat()].flat(),xU=function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r};function xH(e){e.update(vX,e=>{let t=e.attributes;return{...e,attributes:e=>{let n="function"==typeof t?t(e):t;return{...n,class:xU("prose dark:prose-invert",n?.class||"","milkdown-theme-nord")}}}})}let xW=(0,et.createContext)({}),xV=()=>{let e=function(){let{dom:e,editor:t,setLoading:n,editorFactory:r}=(0,et.useContext)(xW),i=(0,et.useRef)(null);return(0,et.useEffect)(()=>{let o=i.current;if(!r||!o)return;e.current=o;let s=r(o);if(s)return n(!0),s.create().then(e=>{t.current=e}).finally(()=>{n(!1)}).catch(console.error),()=>{s.destroy().catch(console.error)}},[e,t,r,n]),i}();return et.default.createElement("div",{"data-milkdown-root":!0,ref:e})},xG=({children:e})=>{let t=(0,et.useRef)(void 0),[n,r]=(0,et.useState)(void 0),i=(0,et.useRef)(void 0),[o,s]=(0,et.useState)(!0),a=(0,et.useMemo)(()=>({loading:o,dom:t,editor:i,setLoading:s,editorFactory:n,setEditorFactory:r}),[o,n]);return et.default.createElement(xW.Provider,{value:a},e)};var xq=((w={}).docTypeError="docTypeError",w.contextNotFound="contextNotFound",w.timerNotFound="timerNotFound",w.ctxCallOutOfScope="ctxCallOutOfScope",w.createNodeInParserFail="createNodeInParserFail",w.stackOverFlow="stackOverFlow",w.parserMatchError="parserMatchError",w.serializerMatchError="serializerMatchError",w.getAtomFromSchemaFail="getAtomFromSchemaFail",w.expectDomTypeError="expectDomTypeError",w.callCommandBeforeEditorView="callCommandBeforeEditorView",w.missingRootElement="missingRootElement",w.missingNodeInSchema="missingNodeInSchema",w.missingMarkInSchema="missingMarkInSchema",w.ctxNotBind="ctxNotBind",w.missingYjsDoc="missingYjsDoc",w),xK=class extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}},xJ=(e,t)=>"function"==typeof t?"[Function]":t;function xX(){return new xK(xq.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function xY(){return new xK(xq.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function xQ(){return new xK(xq.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}var xZ=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){var n;throw n="string"==typeof e?e:e.name,new xK(xq.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}return t},this.remove=e=>{let t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},x0=class{#s=[];#l;#a=()=>{this.#s.forEach(e=>e(this.#l))};constructor(e,t,n){this.set=e=>{this.#l=e,this.#a()},this.get=()=>this.#l,this.update=e=>{this.#l=e(this.#l),this.#a()},this.type=n,this.#l=t,e.set(n.id,this)}on(e){return this.#s.push(e),()=>{this.#s=this.#s.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#s=this.#s.filter(t=>t!==e)}offAll(){this.#s=[]}},x1=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw xX()}}create(e,t=this._defaultValue){return new x0(e,t,this)}},x2=(e,t)=>new x1(e,t),x8=class{#p;#g;#y;#c=new Set;#d=new Set;#u=new Map;#h=new Map;constructor(e,t,n){this.read=()=>({metadata:this.#p,injectedSlices:[...this.#c].map(e=>({name:"string"==typeof e?e:e.name,value:this.#f(e)})),consumedSlices:[...this.#d].map(e=>({name:"string"==typeof e?e:e.name,value:this.#f(e)})),recordedTimers:[...this.#u].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#m(e)})),waitTimers:[...this.#h].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#m(e)}))}),this.onRecord=e=>{this.#u.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#u.delete(e)},this.onDone=e=>{let t=this.#u.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{let n=Date.now();t.finally(()=>{this.#h.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#c.add(e)},this.onRemove=e=>{this.#c.delete(e)},this.onUse=e=>{this.#d.add(e)},this.#g=e,this.#y=t,this.#p=n}#f=e=>this.#g.get(e).get();#m=e=>this.#y.get(e).status},x5=class e{#g;#y;#p;#v;constructor(t,n,r){this.produce=t=>t&&Object.keys(t).length?new e(this.#g,this.#y,{...t}):this,this.inject=(e,t)=>{let n=e.create(this.#g.sliceMap);return null!=t&&n.set(t),this.#v?.onInject(e),this},this.remove=e=>(this.#g.remove(e),this.#v?.onRemove(e),this),this.record=e=>(e.create(this.#y.store),this.#v?.onRecord(e),this),this.clearTimer=e=>(this.#y.remove(e),this.#v?.onClear(e),this),this.isInjected=e=>this.#g.has(e),this.isRecorded=e=>this.#y.has(e),this.use=e=>(this.#v?.onUse(e),this.#g.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#y.get(e),this.done=e=>{this.timer(e).done(),this.#v?.onDone(e)},this.wait=e=>{let t=this.timer(e).start();return this.#v?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#g=t,this.#y=n,this.#p=r,r&&(this.#v=new x8(t,n,r))}get meta(){return this.#p}get inspector(){return this.#v}},x6=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t){var n;throw n=e.name,new xK(xq.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},x3=class{#b=null;#x=null;#w;#k="pending";constructor(e,t){this.start=()=>(this.#b??=new Promise((e,t)=>{this.#x=t=>{t instanceof CustomEvent&&t.detail.id===this.#w&&(this.#k="resolved",this.#S(),t.stopImmediatePropagation(),e())},this.#C(()=>{"pending"===this.#k&&(this.#k="rejected"),this.#S(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#k="pending",addEventListener(this.type.name,this.#x)}),this.#b),this.done=()=>{dispatchEvent(new CustomEvent(this.type.name,{detail:{id:this.#w}}))},this.#w=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#k}#S=()=>{this.#x&&removeEventListener(this.type.name,this.#x)};#C=e=>{setTimeout(()=>{e()},this.type.timeout)}},x4=class{constructor(e,t=3e3){this.create=e=>new x3(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},x7=(e,t=3e3)=>new x4(e,t);let x9="u">typeof navigator?navigator:null,ke="u">typeof document?document:null,kt=x9&&x9.userAgent||"",kn=/Edge\/(\d+)/.exec(kt),kr=/MSIE \d/.exec(kt),ki=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(kt),ko=!!(kr||ki||kn);kr?document.documentMode:ki?ki[1]:kn&&kn[1],!ko&&/gecko\/(\d+)/i.test(kt)&&(/Firefox\/(\d+)/.exec(kt)||[0,0])[1];let ks=!ko&&/Chrome\/(\d+)/.exec(kt);function ka(e,t,n,r,i,o){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;let l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of i){let i=a.match.exec(l),c=i&&i[0]&&a.handler(s,i,t-(i[0].length-r.length),n);if(c)return!1!==a.undoable&&c.setMeta(o,{transform:c,from:t,to:n,text:r}),e.dispatch(c),!0}return!1}ks&&ks[1],!ko&&x9&&/Apple Computer/.test(x9.vendor)&&(/Mobile\/\w+/.test(kt)||x9&&x9.maxTouchPoints>2)||x9&&/Mac/.test(x9.platform),/Android \d/.test(kt),ke&&"webkitFontSmoothing"in ke.documentElement.style&&(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];let kl=new p2("MILKDOWN_CUSTOM_INPUTRULES");Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var kc=class{},kd=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw xY();return e}}},ku=class e extends kc{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},kh=class extends kd{#B=hv.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(ku.create(e,[],t)),this),this.closeNode=()=>{try{this.#z()}catch(e){console.error(e)}return this},this.addNode=(e,t,n)=>{try{this.#$(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>(this.#B=e.create(t).addToSet(this.#B),this),this.closeMark=e=>(this.#B=e.removeFromSet(this.#B),this),this.addText=e=>{try{let t=this.top();if(!t)throw xY();let n=t.pop(),r=this.schema.text(e,this.#B);if(!n)return t.push(r),this;let i=this.#F(n,r);if(i)return t.push(i),this;return t.push(n,r),this}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=this.#z();while(this.size())return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#U(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#H=e=>e.isText;#F=(e,t)=>{if(this.#H(e)&&this.#H(t)&&hv.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)};#W=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t){var n;throw n=e,new xK(xq.parserMatchError,`Cannot match target parser for node: ${JSON.stringify(n,xJ)}.`)}return t};#U=e=>{let t=this.#W(e);t.spec.parseMarkdown.runner(this,e,t)};#z=()=>{this.#B=hv.none;let e=this.close();return this.#$(e.type,e.attrs,e.content)};#$=(e,t,n)=>{let r=e.createAndFill(t,n,this.#B);if(!r){let r,i,o;throw r=`Cannot create node for ${"name"in e?e.name:e}`,i=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(i).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},o=[["[Description]",r],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:i(e):"null")]].reduce((e,[t,n])=>{let r=`${t}: ${i(n)}.`;return e.concat(r)},[]),new xK(xq.createNodeInParserFail,o.join("\n"))}return this.push(r),r}},kp=class e extends kc{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,i={})=>new e(t,n,r,i)}},kf=class extends kd{#B=hv.none;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.openNode=(e,t,n)=>(this.open(kp.create(e,void 0,t,n)),this),this.closeNode=()=>(this.#z(),this),this.addNode=(e,t,n,r)=>(this.#$(e,t,n,r),this),this.withMark=(e,t,n,r)=>(this.#V(e,t,n,r),this),this.closeMark=e=>(this.#G(e),this),this.build=()=>{let e=null;do e=this.#z();while(this.size())return e},this.next=e=>(Object.prototype.hasOwnProperty.call(e,"size")?e.forEach(e=>{this.#U(e)}):this.#U(e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.next(e),this),this.schema=e}#W=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t){var n;throw n=e.type,new xK(xq.serializerMatchError,`Cannot match target serializer for node: ${JSON.stringify(n,xJ)}.`)}return t};#q=e=>this.#W(e).spec.toMarkdown.runner(this,e);#K=(e,t)=>this.#W(e).spec.toMarkdown.runner(this,e,t);#U=e=>{let{marks:t}=e,n=e=>e.type.spec.priority??50;[...t].sort((e,t)=>n(e)-n(t)).every(t=>!this.#K(t,e))&&this.#q(e),t.forEach(e=>this.#G(e))};#J=(e,t)=>{if(e.type===t||e.children?.length!==1)return e;let n=e=>{if(e.type===t)return null!=e.value?null:e;if(e.children?.length!==1)return null;let[r]=e.children;return r?n(r):null},r=n(e);if(!r)return e;let i=r.children?[...r.children]:void 0,o={...e,children:i};return o.children=i,r.children=[o],r};#X=e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){let{children:n,...i}=t=this.#J(t,r.type),{children:o,...s}=r;if(t.type===r.type&&n&&o&&JSON.stringify(i)===JSON.stringify(s)){let t={...s,children:[...o,...n]};return e.slice(0,-1).concat(this.#X(t))}}return e.concat(t)},[])),e};#Y=e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t};#Q=(e,t)=>{let n="",r="",i=e.children,o=-1,s=-1;if(i){i&&i.forEach((e,t)=>{"text"===e.type&&e.value&&(o<0&&(o=t),s=t)});let e=i?.[s],t=i?.[o];if(e&&e.value.endsWith(" ")){let t=e.value,n=t.trimEnd();r=t.slice(n.length),e.value=n}if(t&&t.value.startsWith(" ")){let e=t.value,r=e.trimStart();n=e.slice(0,e.length-r.length),t.value=r}}n.length&&this.#$("text",void 0,n);let a=t();return r.length&&this.#$("text",void 0,r),a};#z=(e=!1)=>{let t=this.close(),n=()=>this.#$(t.type,t.children,t.value,t.props);return e?this.#Q(t,n):n()};#$=(e,t,n,r)=>{let i=kp.create(e,t,n,r),o=this.#X(this.#Y(i));return this.push(o),o};#V=(e,t,n,r)=>e.isInSet(this.#B)?this:(this.#B=e.addToSet(this.#B),this.openNode(t,n,{...r,isMark:!0}));#G=e=>{e.isInSet(this.#B)&&(this.#B=e.type.removeFromSet(this.#B),this.#z(!0))}};function km(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}var kg={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||"*",o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i+i),o(),a},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||"*",o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);return a+=s.move(n.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i),o(),a}},ky=x2({},"editorView"),kv=x2({},"editorState"),kb=x2([],"initTimer"),kx=x2({},"editor"),kk=x2([],"inputRules"),kw=x2([],"prosePlugins"),kS=x2([],"remarkPlugins"),kC=x2([],"nodeView"),kN=x2([],"markView"),kA=x2(uG().use(d4).use(f1),"remark"),kE=x2({handlers:kg,encode:[]},"remarkStringifyOptions"),kM=x7("ConfigReady"),kT=x7("InitReady"),kI=x7("SchemaReady"),kL=x2([],"schemaTimer"),kO=x2({},"schema"),kD=x2([],"nodes"),kR=x2([],"marks");function kP(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var k_=e=>(e.inject(kO,{}).inject(kD,[]).inject(kR,[]).inject(kL,[kT]).record(kI),async()=>{await e.waitTimers(kL);let t=e.get(kA),n=e.get(kS).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(kA,n);let r=new hK({nodes:Object.fromEntries(e.get(kD).map(([e,t])=>[e,kP(t)])),marks:Object.fromEntries(e.get(kR).map(([e,t])=>[e,kP(t)]))});return e.set(kO,r),e.done(kI),()=>{e.remove(kO).remove(kD).remove(kR).remove(kL).clearTimer(kI)}});km(k_,{displayName:"Schema"});var kj=class{constructor(){this.setCtx=e=>{this.#N=e},this.chain=()=>{if(null==this.#N)throw xQ();let e=this.#N,t=[],n=this.get.bind(this),r={run:()=>{let n=fc(...t),r=e.get(ky);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:(function(e,i){let o=n(e);return t.push(o(i)),r}).bind(this)};return r}}#g=new xZ;#N=null;get ctx(){return this.#N}create(e,t){let n=e.create(this.#g.sliceMap);return n.set(t),n}get(e){return this.#g.get(e).get()}remove(e){return this.#g.remove(e)}call(e,t){if(null==this.#N)throw xQ();let n=this.get(e)(t),r=this.#N.get(ky);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#N)throw xQ();let t=this.#N.get(ky);return e(t.state,t.dispatch,t)}},kB=x2(new kj,"commands"),kz=x2([kI],"commandsTimer"),k$=x7("CommandsReady"),kF=e=>{let t=new kj;return t.setCtx(e),e.inject(kB,t).inject(kz,[kI]).record(k$),async()=>(await e.waitTimers(kz),e.done(k$),()=>{e.remove(kB).remove(kz).clearTimer(k$)})};km(kF,{displayName:"Commands"});var kU=class{constructor(){this.setCtx=e=>{this.#N=e},this.add=e=>(this.#A.push(e),()=>{this.#A=this.#A.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){let r={key:e,onRun:()=>n};this.#A.push(r),t.push(()=>{this.#A=this.#A.filter(e=>e!==r)})}else this.#A.push(n),t.push(()=>{this.#A=this.#A.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=(ff.Backspace=fc(mi,p8,p3,p7),ff);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#A.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{let i=this.#N;if(null==i)throw xX();return fc(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#N=null;#A=[];get ctx(){return this.#N}},kH=x2(new kU,"keymap"),kW=x2([kI],"keymapTimer"),kV=x7("KeymapReady"),kG=e=>{let t=new kU;return t.setCtx(e),e.inject(kH,t).inject(kW,[kI]).record(kV),async()=>(await e.waitTimers(kW),e.done(kV),()=>{e.remove(kH).remove(kW).clearTimer(kV)})},kq=x7("ParserReady"),kK=()=>{throw xX()},kJ=x2(kK,"parser"),kX=x2([],"parserTimer"),kY=e=>(e.inject(kJ,kK).inject(kX,[kI]).record(kq),async()=>{await e.waitTimers(kX);let t=e.get(kA),n=e.get(kO);return e.set(kJ,kh.create(n,t)),e.done(kq),()=>{e.remove(kJ).remove(kX).clearTimer(kq)}});km(kY,{displayName:"Parser"});var kQ=x7("SerializerReady"),kZ=x2([],"serializerTimer"),k0=()=>{throw xX()},k1=x2(k0,"serializer"),k2=e=>(e.inject(k1,k0).inject(kZ,[kI]).record(kQ),async()=>{await e.waitTimers(kZ);let t=e.get(kA),n=e.get(kO);return e.set(k1,kf.create(n,t)),e.done(kQ),()=>{e.remove(k1).remove(kZ).clearTimer(kQ)}});km(k2,{displayName:"Serializer"});var k8=x2("","defaultValue"),k5=x2(e=>e,"stateOptions"),k6=x2([],"editorStateTimer"),k3=x7("EditorStateReady"),k4=new p2("MILKDOWN_STATE_TRACKER"),k7=e=>(e.inject(k8,"").inject(kv,{}).inject(k5,e=>e).inject(k6,[kq,kQ,k$,kV]).record(k3),async()=>{await e.waitTimers(k6);let t=e.get(kO),n=e.get(kJ),r=e.get(kk),i=e.get(k5),o=e.get(kw),s=function(e,t,n){var r;if("string"==typeof e)return t(e);if("html"===e.type)return hX.fromSchema(n).parse(e.dom);if("json"===e.type)return hD.fromJSON(n,e.value);throw r=e,new xK(xq.docTypeError,`Doc type error, unsupported type: ${JSON.stringify(r,xJ)}`)}(e.get(k8),n,t),a=e.get(kH),l=a.addBaseKeymap(),c=[...o,new pZ({key:k4,state:{init:()=>{},apply:(t,n,r,i)=>{e.set(kv,i)}}}),function({rules:e}){let t=new pZ({key:kl,isInputRules:!0,state:{init:()=>null,apply(e,t){let n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,i,o)=>ka(n,r,i,o,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&ka(n,r.pos,r.pos,"",e,t)}),!1)},handleKeyDown(n,r){if("Enter"!==r.key)return!1;let{$cursor:i}=n.state.selection;return!!i&&ka(n,i.pos,i.pos,"\n",e,t)}}});return t}({rules:r}),mE(a.build())];e.set(kw,c);let d=i({schema:t,doc:s,plugins:c}),u=pQ.create(d);return e.set(kv,u),e.done(k3),()=>{l(),e.remove(k8).remove(kv).remove(k5).remove(k6).clearTimer(k3)}});km(k7,{displayName:"EditorState"});var k9=x2([],"pasteRule"),we=x2([kI],"pasteRuleTimer"),wt=x7("PasteRuleReady"),wn=e=>(e.inject(k9,[]).inject(we,[kI]).record(wt),async()=>(await e.waitTimers(we),e.done(wt),()=>{e.remove(k9).remove(we).clearTimer(wt)}));km(wn,{displayName:"PasteRule"});var wr=x7("EditorViewReady"),wi=x2([],"editorViewTimer"),wo=x2({},"editorViewOptions"),ws=x2(null,"root"),wa=x2(null,"rootDOM"),wl=x2({},"rootAttrs"),wc=new p2("MILKDOWN_VIEW_CLEAR"),wd=e=>(e.inject(ws,document.body).inject(ky,{}).inject(wo,{}).inject(wa,null).inject(wl,{}).inject(wi,[k3,wt]).record(wr),async()=>{var t;await e.wait(kT);let n=e.get(ws)||document.body,r="string"==typeof n?document.querySelector(n):n;e.update(kw,t=>[new pZ({key:wc,view:t=>{let n,i=r?((n=document.createElement("div")).className="milkdown",r.appendChild(n),e.set(wa,n),Object.entries(e.get(wl)).forEach(([e,t])=>n.setAttribute(e,t)),n):void 0;if(i&&r){let e=t.dom;r.replaceChild(i,e),i.appendChild(e)}return{destroy:()=>{i?.parentNode&&i?.parentNode.replaceChild(t.dom,i),i?.remove()}}}}),...t]),await e.waitTimers(wi);let i=e.get(kv),o=e.get(wo),s=new y0(r,{state:i,nodeViews:Object.fromEntries(e.get(kC)),markViews:Object.fromEntries(e.get(kN)),transformPasted:(t,n,r)=>(e.get(k9).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...o});return(t=s.dom).classList.add("editor"),t.setAttribute("role","textbox"),e.set(ky,s),e.done(wr),()=>{s?.destroy(),e.remove(ws).remove(ky).remove(wo).remove(wa).remove(wl).remove(wi).clearTimer(wr)}});km(wd,{displayName:"EditorView"});var wu=((S={}).Idle="Idle",S.OnCreate="OnCreate",S.Created="Created",S.OnDestroy="OnDestroy",S.Destroyed="Destroyed",S);function wh(e){return t=>{let n=t.get(ky),r=t.get(kO),i=t.get(k1);if(!e)return i(n.state.doc);let o=n.state.doc.slice(e.from,e.to,!0),s=r.topNodeType.createAndFill(null,o.content);return s?i(s):(console.error("No document found"),"")}}function wp({value:e,onChange:t,onSave:n}){let r,i,o=(0,et.useRef)(t),s=(0,et.useRef)(n);o.current=t,s.current=n,function(e,t=[]){let n=(0,et.useContext)(xW),r=(0,et.useCallback)(e,t);(0,et.useLayoutEffect)(()=>{n.setEditorFactory(()=>r)},[n,r]),n.loading}(t=>v8.make().config(n=>{n.set(vY,t),n.set(vB,e)}).config(xH).use(xF),[]);let[a,l]=(r=(0,et.useContext)(xW),i=(0,et.useCallback)(()=>r.editor.current,[r.editor]),[r.loading,i]),c=(0,et.useRef)(null),d=(0,et.useRef)(null),u=(0,et.useCallback)(()=>{if(a)return;let e=l();if(e)try{let t=e.action(wh());o.current(t)}catch{}},[a,l]);return(0,et.useEffect)(()=>{let e=c.current?.querySelector(".ProseMirror");if(e)return d.current=new MutationObserver(()=>{u()}),d.current.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{d.current?.disconnect()}},[a,u]),(0,et.useEffect)(()=>{function e(e){if((e.metaKey||e.ctrlKey)&&"s"===e.key){if(e.preventDefault(),a)return;let t=l();if(t)try{let e=t.action(wh());s.current(e)}catch{}}}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,l]),(0,ee.jsx)("div",{ref:c,className:"milkdown-wrap flex-1 min-h-0 overflow-auto",children:(0,ee.jsx)(xV,{})})}function wf(e){return(0,ee.jsx)(xG,{children:(0,ee.jsx)(wp,{...e})})}(class e{constructor(){this.enableInspector=(e=!0)=>(this.#E=e,this),this.onStatusChange=e=>(this.#T=e,this),this.config=e=>(this.#M.push(e),this),this.removeConfig=e=>(this.#M=this.#M.filter(t=>t!==e),this),this.use=e=>{let t=[e].flat();return t.flat().forEach(e=>{this.#I.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#k===wu.Created&&this.#D(t,this.#I),this},this.remove=async e=>this.#k===wu.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#R([e].flat(),!0),this),this.create=async()=>(this.#k===wu.OnCreate||(this.#k===wu.Created&&await this.destroy(),this.#_(wu.OnCreate),this.#O(),this.#D([...this.#I.keys()],this.#I),await Promise.all([this.#j(this.#L),this.#j(this.#I)].flat()),this.#_(wu.Created)),this),this.destroy=async(e=!1)=>this.#k===wu.Destroyed||this.#k===wu.OnDestroy?this:this.#k===wu.OnCreate?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#M=[]),this.#_(wu.OnDestroy),await this.#R([...this.#I.keys()],e),await this.#P(),this.#_(wu.Destroyed),this),this.action=e=>e(this.#N),this.inspect=()=>this.#E?[...this.#L.values(),...this.#I.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#E=!1;#k=wu.Idle;#M=[];#T=()=>void 0;#g=new xZ;#y=new x6;#I=new Map;#L=new Map;#N=new x5(this.#g,this.#y);#O=()=>{var e,t;let n,r,i=(e=async e=>{await Promise.all(this.#M.map(t=>Promise.resolve(t(e))))},km(n=t=>(t.record(kM),async()=>(await e(t),t.done(kM),()=>{t.clearTimer(kM)})),{displayName:"Config"}),n),o=[k_,kY,k2,kF,kG,wn,k7,wd,(t=this,km(r=e=>(e.inject(kx,t).inject(kw,[]).inject(kS,[]).inject(kk,[]).inject(kC,[]).inject(kN,[]).inject(kE,{handlers:kg,encode:[]}).inject(kA,uG().use(d4).use(f1)).inject(kb,[kM]).record(kT),async()=>{await e.waitTimers(kb);let t=e.get(kE);return e.set(kA,uG().use(d4).use(f1,t)),e.done(kT),()=>{e.remove(kx).remove(kw).remove(kS).remove(kk).remove(kC).remove(kN).remove(kE).remove(kA).remove(kb).clearTimer(kT)}}),{displayName:"Init"}),r),i];this.#D(o,this.#L)};#D=(e,t)=>{e.forEach(e=>{let n=this.#N.produce(this.#E?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})};#R=(e,t=!1)=>Promise.all([e].flat().map(async e=>{let n=this.#I.get(e)?.cleanup;return(t?this.#I.delete(e):this.#I.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof n)?n():n}));#P=async()=>{await Promise.all([...this.#L.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#L.clear()};#_=e=>{this.#k=e,this.#T(e)};#j=e=>[...e.entries()].map(async([t,n])=>{let{ctx:r,handler:i}=n;if(!i)return;let o=await i();e.set(t,{ctx:r,handler:i,cleanup:o})});get ctx(){return this.#N}get status(){return this.#k}}),v6("abcedfghicklmn",10);let wm={"in-progress":"●",pending:"○",done:"✓",archived:"▪"},wg={"in-progress":"var(--yellow)",pending:"var(--dim)",done:"var(--green)",archived:"var(--dimmer)"};function wy({sessionName:e}){let{data:t,loading:n,refresh:r}=ei((0,et.useCallback)(()=>(0,er.fetchPlans)(e),[e]),1e4),[i,o]=(0,et.useState)("all"),[s,a]=(0,et.useState)(null),[l,c]=(0,et.useState)({content:"",authorship:null}),[d,u]=(0,et.useState)(!1),[h,p]=(0,et.useState)(!1),[f,m]=(0,et.useState)(""),[g,y]=(0,et.useState)(!1),v=(0,et.useMemo)(()=>t?"all"===i?t:t.filter(e=>e.status===i):[],[t,i]),b=(0,et.useMemo)(()=>t?.find(e=>e.path===s)??null,[t,s]);(0,et.useEffect)(()=>{if(!s){c({content:"",authorship:null}),p(!1);return}u(!0),p(!1),(0,er.fetchPlan)(e,s).then(e=>{c(e),m(e.content)}).catch(()=>c({content:"",authorship:null})).finally(()=>u(!1))},[s,e]),(0,et.useEffect)(()=>{!s&&v.length>0&&a(v[0].path)},[v,s]);let x=(0,et.useMemo)(()=>(function(e,t){let n=e.split("\n"),r=[],i="",o=[];for(let e of n){let n=e.match(/^#{1,4}\s+(.+)/);if(n){if(o.length>0||i){let e=t?.sections[i]??null;r.push({heading:i,content:o.join("\n"),author:e?.author??null,authorAt:e?.at??null})}i=n[1].trim(),o=[e]}else o.push(e)}if(o.length>0||i){let e=t?.sections[i]??null;r.push({heading:i,content:o.join("\n"),author:e?.author??null,authorAt:e?.at??null})}return r})(l.content,l.authorship),[l]);async function k(t){if(s){if(y(!0),await (0,er.savePlan)(e,s,t)){let t=await (0,er.fetchPlan)(e,s);c(t),m(t.content),p(!1)}y(!1)}}async function w(){!b||await (0,er.markPlanDone)(e,b.name)&&r()}if(n&&!t)return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"Loading plans..."});if(!t||0===t.length)return(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"No plan files found in plans/"});let S={};for(let e of t)S[e.status]=(S[e.status]??0)+1;return(0,ee.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,ee.jsxs)("div",{className:"w-[260px] shrink-0 border-r border-[var(--border)] flex flex-col min-h-0",children:[(0,ee.jsx)("div",{className:"flex items-center h-6 bg-[var(--surface)] border-b border-[var(--border)] text-[10px] shrink-0 px-1 gap-px",children:["all","in-progress","pending","done"].map(e=>(0,ee.jsx)("button",{onClick:()=>o(e),className:`px-1.5 py-0.5 transition-colors ${i===e?"text-[var(--accent)]":"text-[var(--dim)] hover:text-[var(--fg)]"}`,children:"all"===e?`all (${t.length})`:`${e} (${S[e]??0})`},e))}),(0,ee.jsx)("div",{className:"flex-1 overflow-y-auto",children:v.map(e=>{let t=s===e.path;return(0,ee.jsxs)("button",{onClick:()=>a(e.path),className:`w-full text-left px-2 py-1 flex items-start gap-1.5 transition-colors ${t?"bg-[rgba(255,255,255,0.04)] text-[var(--accent)]":"text-[var(--fg)] hover:bg-[rgba(255,255,255,0.02)]"}`,children:[(0,ee.jsx)("span",{className:"shrink-0 mt-0.5 text-[11px]",style:{color:wg[e.status]},children:wm[e.status]}),(0,ee.jsxs)("span",{className:"min-w-0",children:[(0,ee.jsx)("span",{className:"block truncate text-[12px]",children:e.name}),e.completed&&(0,ee.jsx)("span",{className:"block text-[10px] text-[var(--dimmer)]",children:e.completed})]})]},e.path)})})]}),(0,ee.jsx)("div",{className:"flex-1 flex flex-col min-h-0",children:d?(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"loading..."}):l.content||h?(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:"shrink-0 border-b border-[var(--border)] px-3 flex items-center h-7",children:[(0,ee.jsxs)("div",{className:"flex-1 flex items-center gap-2",children:[b&&(0,ee.jsxs)("span",{className:"text-[11px]",style:{color:wg[b.status]},children:[wm[b.status]," ",b.status]}),(0,ee.jsx)(u6,{authorship:l.authorship})]}),(0,ee.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[b&&"done"!==b.status&&!h&&(0,ee.jsx)("button",{onClick:w,className:"text-[11px] px-2 py-0.5 text-[var(--green)] border border-[var(--border)] hover:border-[var(--green)] transition-colors",children:"mark done"}),h&&(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("button",{onClick:()=>k(f),disabled:g,className:"text-[11px] px-2 py-0.5 text-[var(--bg)] bg-[var(--accent)] hover:opacity-90 disabled:opacity-50 transition-opacity",children:g?"saving...":"save"}),(0,ee.jsx)("span",{className:"text-[9px] text-[var(--dimmer)]",children:"cmd+S"})]}),(0,ee.jsx)("button",{onClick:()=>h?p(!1):void(m(l.content),p(!0)),className:`text-[11px] px-2 py-0.5 border border-[var(--border)] transition-colors ${h?"text-[var(--accent)] border-[var(--accent)]":"text-[var(--dim)] hover:text-[var(--fg)] hover:border-[var(--dim)]"}`,children:h?"view":"edit"})]})]}),h?(0,ee.jsx)(wf,{value:f,onChange:m,onSave:k},s):(0,ee.jsx)("div",{className:"flex-1 overflow-y-auto p-4 max-w-3xl",children:x.map((e,t)=>{var n;let r=!!(n=e.author)&&n.startsWith("ai"),i=e.author?r?"var(--ai-color)":"var(--human-color)":"transparent",o=e.author?r?"var(--ai-bg)":"var(--human-bg)":"transparent",s=function(e){if(!e)return"";try{let t=new Date(e),n=Date.now()-t.getTime();if(n<36e5)return`${Math.floor(n/6e4)}m ago`;if(n<864e5)return`${Math.floor(n/36e5)}h ago`;return`${Math.floor(n/864e5)}d ago`}catch{return""}}(e.authorAt);return(0,ee.jsxs)("div",{className:"plan-content",style:{borderLeft:e.author?`2px solid ${i}`:"2px solid transparent",paddingLeft:"12px",marginBottom:"4px",background:o,borderRadius:"2px"},children:[e.author&&e.heading&&(0,ee.jsxs)("div",{className:"flex items-center gap-2 mb-1 -mt-0.5",children:[(0,ee.jsx)("span",{className:"text-[9px] px-1 py-px rounded",style:{color:r?"var(--ai-color)":"var(--human-color)",background:r?"var(--ai-badge)":"var(--human-badge)"},children:e.author}),s&&(0,ee.jsx)("span",{className:"text-[9px] text-[var(--dimmer)]",children:s})]}),(0,ee.jsx)(u8,{children:e.content})]},`${e.heading}-${t}`)})})]}):(0,ee.jsx)("div",{className:"flex-1 flex items-center justify-center text-[var(--dim)]",children:"Select a plan to view"})})]})}function wv({project:e,lastUpdate:t,stale:n=!1}){let[r,i]=(0,et.useState)(Date.now()),[o,s]=(0,et.useState)(!1),a=(0,et.useRef)(t);(0,et.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,et.useEffect)(()=>{if(t&&t!==a.current){a.current=t,s(!0);let e=setTimeout(()=>s(!1),300);return()=>clearTimeout(e)}},[t]);let l=e.tasks.filter(e=>"done"===e.status).length,c=e.agents.filter(e=>e.isBusy).length,d=t?Math.max(0,Math.floor((r-t)/1e3)):0,u=new Date(r).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return(0,ee.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 h-6 bg-[var(--bg-weak)] border-t flex items-center px-3 text-[11px] z-20",children:[(0,ee.jsx)("span",{className:"text-[var(--accent)] font-medium",children:e.session}),(0,ee.jsx)("span",{className:"mx-2 text-[var(--dim)] opacity-30",children:"│"}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:[(0,ee.jsx)("span",{style:{color:c>0?"var(--yellow)":void 0},children:c}),"/",e.agents.length," agents"]}),(0,ee.jsx)("span",{className:"mx-2 text-[var(--dim)] opacity-30",children:"│"}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:[(0,ee.jsx)("span",{style:{color:l>0?"var(--green)":void 0},children:l}),"/",e.tasks.length," tasks"]}),(0,ee.jsx)("span",{className:"mx-2 text-[var(--dim)] opacity-30",children:"│"}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["updated ",d,"s ago"]}),(0,ee.jsx)("span",{className:"flex-1"}),(0,ee.jsx)("span",{className:"transition-opacity duration-300",style:{color:n?"var(--red)":"var(--green)",opacity:o?1:.6},children:"●"}),(0,ee.jsx)("span",{className:"text-[var(--dim)] ml-1.5",children:n?"stale":"live"}),(0,ee.jsx)("span",{className:"mx-2 text-[var(--dim)] opacity-30",children:"│"}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:u})]})}let wb=[{id:"kanban",label:"kanban"},{id:"agents",label:"agents"},{id:"diffs",label:"diffs"},{id:"plans",label:"plans"},{id:"validation",label:"validation"},{id:"metrics",label:"metrics"},{id:"activity",label:"activity"}];function wx(){let e=(0,en.usePathname)(),t=(0,en.useRouter)(),n=decodeURIComponent(e.replace(/^\/project\//,"").replace(/\/$/,"")),[r,i]=(0,et.useState)("kanban"),{data:o,error:s,stale:a,lastUpdate:l,refresh:c}=ei((0,et.useCallback)(()=>(0,er.fetchProject)(n),[n]),2e3),{data:d}=ei((0,et.useCallback)(()=>(0,er.fetchEvents)(n),[n]),3e3),{data:u}=ei((0,et.useCallback)(()=>(0,er.fetchMilestones)(n),[n]),3e3),{data:h}=ei((0,et.useCallback)(()=>(0,er.fetchMission)(n),[n]),5e3),{data:p}=ei((0,et.useCallback)(()=>(0,er.fetchSkills)(n),[n]),1e4);if(s)return(0,ee.jsx)("div",{className:"h-screen flex items-center justify-center text-[var(--red)]",children:"failed to load project"});if(!o)return(0,ee.jsx)("div",{className:"h-screen flex items-center justify-center text-[var(--dim)]",children:"loading..."});let f=o.tasks.filter(e=>"done"===e.status).length,m=o.tasks.length,g=m>0?Math.round(f/m*100):0,y=o.agents.filter(e=>e.isBusy).length;return(0,ee.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,ee.jsxs)("div",{className:"flex items-center justify-between px-4 h-7 bg-[var(--surface)] border-b border-[var(--border)] shrink-0",children:[(0,ee.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ee.jsx)("button",{onClick:()=>t.push("/"),className:"text-[var(--dim)] hover:text-[var(--fg)] transition-colors",children:"< esc"}),(0,ee.jsx)("span",{className:"text-[var(--border)]",children:"│"}),(0,ee.jsx)("span",{className:"text-[var(--accent)]",children:o.session}),o.mission&&(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("span",{className:"text-[var(--border)]",children:"│"}),(0,ee.jsx)("span",{className:"text-[var(--dim)] truncate",children:o.mission.title})]})]}),(0,ee.jsxs)("div",{className:"flex items-center gap-4 text-[var(--dim)]",children:[(0,ee.jsxs)("span",{children:[(0,ee.jsx)("span",{className:"text-[var(--green)]",children:y}),"/",o.agents.length," ","agents"]}),(0,ee.jsxs)("span",{children:[(0,ee.jsx)("span",{className:"text-[var(--green)]",children:f}),"/",m," tasks"]}),(0,ee.jsx)(eo.ProgressBar,{percent:g,width:10})]})]}),o.agents.length>0&&(0,ee.jsx)("div",{className:"flex items-center px-2 bg-[var(--surface)] border-b border-[var(--border)] shrink-0 overflow-x-auto",children:o.agents.map((e,t)=>(0,ee.jsx)(es,{agent:e},`${e.paneTitle}-${t}`))}),o.goals.length>0&&(0,ee.jsx)("div",{className:"flex items-center gap-4 px-4 h-6 bg-[var(--surface)] border-b border-[var(--border)] shrink-0 overflow-x-auto",children:o.goals.map(e=>{let t=o.tasks.filter(t=>t.goal===e.id),n=t.filter(e=>"done"===e.status).length,r=t.length>0?Math.round(n/t.length*100):0;return(0,ee.jsxs)("span",{className:"flex items-center gap-1.5 shrink-0",children:[(0,ee.jsx)("span",{className:"text-[var(--fg)] truncate max-w-[20ch]",children:e.title}),(0,ee.jsx)(eo.ProgressBar,{percent:r,width:4})]},e.id)})}),h&&(0,ee.jsxs)("div",{className:"flex items-center gap-4 px-4 h-6 bg-[var(--surface)] border-b border-[var(--border)] shrink-0",children:[(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:"mission:"}),(0,ee.jsx)("span",{className:"complete"===h.mission.status?"text-[var(--green)]":"active"===h.mission.status?"text-[var(--accent)]":"text-[var(--yellow)]",children:h.mission.status}),h.validationSummary.total>0&&(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("span",{className:"text-[var(--border)]",children:"│"}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:"assertions:"}),(0,ee.jsx)("span",{className:"text-[var(--green)]",children:h.validationSummary.passing}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:"/"}),(0,ee.jsx)("span",{children:h.validationSummary.total}),h.validationSummary.failing>0&&(0,ee.jsxs)("span",{className:"text-[var(--red)]",children:["(",h.validationSummary.failing," failing)"]})]}),h.mission.branch&&(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)("span",{className:"text-[var(--border)]",children:"│"}),(0,ee.jsx)("span",{className:"text-[var(--dim)]",children:h.mission.branch})]})]}),u&&u.length>0&&(0,ee.jsxs)("div",{className:"flex items-center gap-3 px-4 h-6 bg-[var(--surface)] border-b border-[var(--border)] shrink-0 overflow-x-auto",children:[(0,ee.jsx)("span",{className:"text-[var(--dim)] shrink-0",children:"milestones:"}),u.map(e=>{let t=e.taskCount>0?Math.round(e.tasksDone/e.taskCount*100):0,n="done"===e.status?"var(--green)":"active"===e.status?"var(--accent)":"validating"===e.status?"var(--yellow)":"var(--dim)";return(0,ee.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[(0,ee.jsx)("span",{style:{color:n},children:e.id}),(0,ee.jsx)("span",{className:"text-[var(--fg)] truncate max-w-[14ch]",children:e.title}),(0,ee.jsx)(eo.ProgressBar,{percent:t,width:3}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:[e.tasksDone,"/",e.taskCount]})]},e.id)})]}),p&&p.length>0&&(0,ee.jsxs)("div",{className:"flex items-center gap-2 px-4 h-6 bg-[var(--surface)] border-b border-[var(--border)] shrink-0 overflow-x-auto",children:[(0,ee.jsx)("span",{className:"text-[var(--dim)] shrink-0",children:"skills:"}),p.map(e=>(0,ee.jsx)("span",{className:"px-1.5 py-0 text-[10px] border border-[var(--border)] text-[var(--cyan)] shrink-0",title:e.specialties.join(", "),children:e.name},e.name))]}),(0,ee.jsx)("div",{className:"flex border-b border-[var(--border)] bg-[var(--surface)] shrink-0",children:wb.map(e=>(0,ee.jsx)("button",{onClick:()=>i(e.id),className:`px-4 h-7 transition-colors ${r===e.id?"text-[var(--accent)] border-b-2 border-[var(--accent)]":"text-[var(--dim)] hover:text-[var(--fg)]"}`,children:e.label},e.id))}),"kanban"===r&&(0,ee.jsx)(t6,{tasks:o.tasks,sessionName:o.session,agents:o.agents,goals:o.goals,onRefresh:c}),"diffs"===r&&(0,ee.jsx)(cc,{sessionName:o.session}),"plans"===r&&(0,ee.jsx)(wy,{sessionName:o.session}),"validation"===r&&(0,ee.jsx)(wE,{sessionName:o.session}),"metrics"===r&&(0,ee.jsx)(wA,{sessionName:o.session}),"activity"===r&&(0,ee.jsx)(ch,{events:d??[]}),"agents"===r&&(0,ee.jsxs)("div",{className:"flex-1 p-4 overflow-auto",children:[(0,ee.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:o.agents.map((e,t)=>(0,ee.jsx)(es,{agent:e},`${e.paneTitle}-${t}`))}),0===o.agents.length&&(0,ee.jsx)("div",{className:"flex items-center justify-center h-32 text-[var(--dim)]",children:"no agents in this session"})]}),(0,ee.jsx)(wv,{project:o,lastUpdate:l,stale:a})]})}let wk={passing:"var(--green)",failing:"var(--red)",pending:"var(--dim)",blocked:"var(--yellow)"};function ww(e){if(e<6e4)return`${Math.round(e/1e3)}s`;if(e<36e5)return`${Math.round(e/6e4)}m`;let t=Math.floor(e/36e5),n=Math.round(e%36e5/6e4);return`${t}h ${n}m`}function wS(e){return`${Math.round(100*e)}%`}function wC({label:e,value:t,color:n}){return(0,ee.jsxs)("div",{className:"px-3 py-2 bg-[var(--surface)] border border-[var(--border)]",children:[(0,ee.jsx)("div",{className:"text-[var(--dim)] text-[11px]",children:e}),(0,ee.jsx)("div",{className:"text-lg",style:{color:n??"var(--fg)"},children:t})]})}let wN={done:"var(--green)",active:"var(--accent)",validating:"var(--yellow)",locked:"var(--dim)"};function wA({sessionName:e}){let{data:t}=ei((0,et.useCallback)(()=>(0,er.fetchMetrics)(e),[e]),5e3);if(!t)return(0,ee.jsx)("div",{className:"flex-1 p-4 text-[var(--dim)]",children:"loading metrics..."});let n=t.agents.length>0?t.agents.reduce((e,t)=>e+t.utilization,0)/t.agents.length:0;return(0,ee.jsxs)("div",{className:"flex-1 p-4 overflow-auto space-y-4",children:[(0,ee.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[(0,ee.jsx)(wC,{label:"session duration",value:ww(t.session.durationMs)}),(0,ee.jsx)(wC,{label:"completion rate",value:wS(t.tasks.completionRate),color:t.tasks.completionRate>=.8?"var(--green)":"var(--yellow)"}),(0,ee.jsx)(wC,{label:"avg agent utilization",value:wS(n),color:n>=.5?"var(--green)":"var(--dim)"}),(0,ee.jsx)(wC,{label:"retry rate",value:wS(t.tasks.retryRate),color:t.tasks.retryRate>.2?"var(--red)":"var(--green)"})]}),(0,ee.jsxs)("div",{className:"flex gap-4 text-[12px] text-[var(--dim)]",children:[(0,ee.jsxs)("span",{children:["tasks: ",(0,ee.jsx)("span",{className:"text-[var(--fg)]",children:t.tasks.completed}),"/",t.tasks.total," done"]}),t.tasks.failed>0&&(0,ee.jsxs)("span",{children:["failed: ",(0,ee.jsx)("span",{className:"text-[var(--red)]",children:t.tasks.failed})]}),t.tasks.avgDurationMs>0&&(0,ee.jsxs)("span",{children:["avg: ",ww(t.tasks.avgDurationMs)]}),t.tasks.medianDurationMs>0&&(0,ee.jsxs)("span",{children:["median: ",ww(t.tasks.medianDurationMs)]}),t.tasks.p90DurationMs>0&&(0,ee.jsxs)("span",{children:["p90: ",ww(t.tasks.p90DurationMs)]})]}),t.tasks.byMilestone.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"milestones"}),(0,ee.jsx)("div",{className:"space-y-px",children:t.tasks.byMilestone.map(e=>{let t=e.taskCount>0?Math.round(e.completedCount/e.taskCount*100):0;return(0,ee.jsxs)("div",{className:"flex items-center gap-2 px-2 py-0.5 bg-[var(--surface)]",children:[(0,ee.jsx)("span",{style:{color:wN[e.status]??"var(--dim)"},className:"w-6 shrink-0",children:e.id}),(0,ee.jsx)("span",{className:"text-[var(--fg)] w-32 truncate shrink-0",children:e.title}),(0,ee.jsx)("span",{style:{color:wN[e.status]??"var(--dim)"},className:"w-20 shrink-0",children:e.status}),(0,ee.jsx)(eo.ProgressBar,{percent:t,width:8}),(0,ee.jsxs)("span",{className:"text-[var(--dim)] text-[11px] shrink-0",children:[e.completedCount,"/",e.taskCount]}),e.durationMs>0&&(0,ee.jsx)("span",{className:"text-[var(--dim)] text-[11px]",children:ww(e.durationMs)})]},e.id)})})]}),t.agents.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"agents"}),(0,ee.jsx)("div",{className:"space-y-px",children:[...t.agents].sort((e,t)=>t.utilization-e.utilization).map(e=>(0,ee.jsxs)("div",{className:"flex items-center gap-2 px-2 py-0.5 bg-[var(--surface)] text-[12px]",children:[(0,ee.jsx)("span",{className:"text-[var(--fg)] w-28 truncate shrink-0",children:e.name}),(0,ee.jsxs)("span",{className:"text-[var(--dim)] w-16 shrink-0",children:[e.taskCount," tasks"]}),(0,ee.jsx)("span",{className:"w-14 shrink-0",style:{color:e.utilization>=.5?"var(--green)":"var(--dim)"},children:wS(e.utilization)}),e.retryCount>0&&(0,ee.jsxs)("span",{className:"text-[var(--red)] shrink-0",children:[e.retryCount," retries"]}),e.specialties.length>0&&(0,ee.jsx)("span",{className:"text-[var(--cyan)] text-[10px] truncate",children:e.specialties.join(", ")})]},e.name))})]}),t.mission.title&&(0,ee.jsxs)("div",{className:"flex gap-3 text-[12px]",children:[(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["mission: ",(0,ee.jsx)("span",{className:"text-[var(--fg)]",children:t.mission.title})," [",t.mission.status,"]"]}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["milestones: ",t.mission.milestonesCompleted]}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["validation:"," ",(0,ee.jsx)("span",{className:"text-[var(--green)]",children:wS(t.mission.validationPassRate)})]}),(0,ee.jsxs)("span",{className:"text-[var(--dim)]",children:["wall clock: ",ww(t.mission.wallClockMs)]})]}),t.timeline.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"timeline"}),(0,ee.jsx)("div",{className:"space-y-px max-h-48 overflow-auto",children:t.timeline.slice(-20).map((e,t)=>(0,ee.jsxs)("div",{className:"flex items-center gap-3 px-2 py-0.5 bg-[var(--surface)] text-[11px] text-[var(--dim)]",children:[(0,ee.jsx)("span",{className:"w-20 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()}),(0,ee.jsxs)("span",{children:["done:",(0,ee.jsx)("span",{className:"text-[var(--green)]",children:e.completedTasks})]}),(0,ee.jsxs)("span",{children:["active:",(0,ee.jsx)("span",{className:"text-[var(--yellow)]",children:e.activeTasks})]}),(0,ee.jsxs)("span",{children:["busy:",(0,ee.jsx)("span",{className:"text-[var(--accent)]",children:e.busyAgents})]}),(0,ee.jsxs)("span",{children:["idle:",(0,ee.jsx)("span",{className:"text-[var(--fg)]",children:e.idleAgents})]})]},t))})]})]})}function wE({sessionName:e}){let{data:t}=ei((0,et.useCallback)(()=>(0,er.fetchValidation)(e),[e]),3e3),{data:n}=ei((0,et.useCallback)(()=>(0,er.fetchCoverage)(e),[e]),5e3);if(!t)return(0,ee.jsx)("div",{className:"flex-1 p-4 text-[var(--dim)]",children:"no validation contract found"});let r=t.state?Object.entries(t.state.assertions):[];return(0,ee.jsxs)("div",{className:"flex-1 p-4 overflow-auto space-y-4",children:[t.contract&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"contract"}),(0,ee.jsx)("pre",{className:"text-[var(--fg)] text-[12px] whitespace-pre-wrap bg-[var(--surface)] p-2 border border-[var(--border)]",children:t.contract})]}),r.length>0&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"assertions"}),(0,ee.jsx)("div",{className:"space-y-px",children:r.map(([e,t])=>(0,ee.jsxs)("div",{className:"flex items-center gap-2 px-2 py-0.5 bg-[var(--surface)]",children:[(0,ee.jsx)("span",{className:"text-[var(--fg)] w-32 shrink-0",children:e}),(0,ee.jsx)("span",{style:{color:wk[t.status]??"var(--dim)"},className:"w-16 shrink-0",children:t.status}),t.verifiedBy&&(0,ee.jsxs)("span",{className:"text-[var(--cyan)] text-[11px]",children:["@",t.verifiedBy]}),t.evidence&&(0,ee.jsx)("span",{className:"text-[var(--dim)] text-[11px] truncate",children:t.evidence})]},e))})]}),n&&(n.unclaimed.length>0||Object.keys(n.duplicates).length>0)&&(0,ee.jsxs)("div",{children:[(0,ee.jsx)("h3",{className:"text-[var(--accent)] mb-1",children:"coverage"}),n.unclaimed.length>0&&(0,ee.jsxs)("div",{className:"text-[var(--yellow)] text-[12px]",children:["unclaimed: ",n.unclaimed.join(", ")]}),Object.entries(n.duplicates).map(([e,t])=>(0,ee.jsxs)("div",{className:"text-[var(--dim)] text-[12px]",children:[e,": claimed by tasks ",t.join(", ")]},e))]})]})}e.s(["default",()=>wx],36508)}]);
|