somora 2026.930.1
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/LICENSE +21 -0
- package/README.md +364 -0
- package/bin/node-version.d.mts +3 -0
- package/bin/node-version.mjs +45 -0
- package/bin/somora.mjs +77 -0
- package/config.example.yaml +896 -0
- package/docs/agents.md +677 -0
- package/docs/api.md +3194 -0
- package/docs/browser.md +317 -0
- package/docs/builder.md +331 -0
- package/docs/cache-strategy.md +373 -0
- package/docs/compaction.md +253 -0
- package/docs/display.md +154 -0
- package/docs/dream-phases.md +891 -0
- package/docs/files.md +387 -0
- package/docs/imagegen.md +366 -0
- package/docs/images/somora-hero.png +0 -0
- package/docs/images/somora-mobile-2026-05-23.png +0 -0
- package/docs/images/somora-tui-2026-05-23.png +0 -0
- package/docs/images/somora-web-2026-05-23.png +0 -0
- package/docs/index.md +178 -0
- package/docs/lsp.md +93 -0
- package/docs/mcp.md +332 -0
- package/docs/memory.md +407 -0
- package/docs/mobile.md +310 -0
- package/docs/models.md +379 -0
- package/docs/projects.md +425 -0
- package/docs/realtime-voice.md +293 -0
- package/docs/resources.md +230 -0
- package/docs/sampling.md +128 -0
- package/docs/security.md +189 -0
- package/docs/sentinel.md +295 -0
- package/docs/setup.md +1217 -0
- package/docs/skills.md +501 -0
- package/docs/team.md +189 -0
- package/docs/thinking.md +463 -0
- package/docs/tmux.md +399 -0
- package/docs/tools.md +117 -0
- package/docs/videogen.md +191 -0
- package/docs/voice.md +288 -0
- package/docs/web.md +893 -0
- package/docs/wiki.md +583 -0
- package/npm-shrinkwrap.json +5670 -0
- package/package.json +116 -0
- package/src/attachments/store.ts +196 -0
- package/src/browser/change-stream.ts +31 -0
- package/src/browser/display.ts +108 -0
- package/src/browser/policy.ts +121 -0
- package/src/browser/screencast.ts +374 -0
- package/src/browser/service.ts +1337 -0
- package/src/browser/session.ts +15 -0
- package/src/browser/snapshot.ts +40 -0
- package/src/cli/auth.ts +117 -0
- package/src/cli/codex.ts +41 -0
- package/src/cli/lsp.ts +71 -0
- package/src/cli/resolvers/clawhub.ts +400 -0
- package/src/cli/setup.ts +835 -0
- package/src/cli/skill.ts +619 -0
- package/src/cli/somora.ts +548 -0
- package/src/cli/systemd-unit.ts +72 -0
- package/src/cli/team.ts +148 -0
- package/src/cli/tui/activity-stream.ts +121 -0
- package/src/cli/tui/api.ts +479 -0
- package/src/cli/tui/app.tsx +1169 -0
- package/src/cli/tui/autocomplete.tsx +55 -0
- package/src/cli/tui/commands.ts +913 -0
- package/src/cli/tui/dream-glyphs.ts +22 -0
- package/src/cli/tui/footer.tsx +15 -0
- package/src/cli/tui/format.ts +28 -0
- package/src/cli/tui/header.tsx +279 -0
- package/src/cli/tui/index.tsx +120 -0
- package/src/cli/tui/markdown.tsx +63 -0
- package/src/cli/tui/sampling.ts +162 -0
- package/src/cli/tui/separator.tsx +13 -0
- package/src/cli/tui/state.ts +42 -0
- package/src/cli/tui/stream.ts +330 -0
- package/src/cli/tui/thinking-text.ts +54 -0
- package/src/cli/tui/turn-views.tsx +499 -0
- package/src/cli/tui/types.ts +410 -0
- package/src/cli/tui/work-queue.ts +161 -0
- package/src/cli/update-args.ts +55 -0
- package/src/cli/wiki.ts +406 -0
- package/src/compaction/index.ts +28 -0
- package/src/compaction/midturn.ts +210 -0
- package/src/compaction/policy.ts +154 -0
- package/src/compaction/summarize.ts +691 -0
- package/src/compaction/template.ts +90 -0
- package/src/compaction/types.ts +148 -0
- package/src/config/loader.ts +276 -0
- package/src/config/reload.ts +43 -0
- package/src/config/types.ts +2292 -0
- package/src/dream/deep-actions.ts +324 -0
- package/src/dream/deep-dispatcher.ts +237 -0
- package/src/dream/deep-llm.ts +388 -0
- package/src/dream/deep-prompts.ts +106 -0
- package/src/dream/deep-runner.ts +757 -0
- package/src/dream/deep-skip-cache.ts +199 -0
- package/src/dream/deep-worker.ts +229 -0
- package/src/dream/json-salvage.ts +34 -0
- package/src/dream/judge.ts +188 -0
- package/src/dream/loop-state.ts +286 -0
- package/src/dream/lucid-actions.ts +303 -0
- package/src/dream/lucid-batches.ts +94 -0
- package/src/dream/lucid-prompt.ts +82 -0
- package/src/dream/lucid-runner.ts +744 -0
- package/src/dream/lucid-storage.ts +277 -0
- package/src/dream/lucid-structure.ts +102 -0
- package/src/dream/lucid-types.ts +137 -0
- package/src/dream/lucid-worker.ts +224 -0
- package/src/dream/rem-dedup.ts +502 -0
- package/src/dream/rem-extract.ts +782 -0
- package/src/dream/rem-reset-run.ts +67 -0
- package/src/dream/rem-runner.ts +696 -0
- package/src/dream/rem-worker.ts +527 -0
- package/src/dream/review-window.ts +71 -0
- package/src/dream/scheduler-state.ts +129 -0
- package/src/dream/storage.ts +497 -0
- package/src/dream/types.ts +133 -0
- package/src/dream/wiki-context.ts +133 -0
- package/src/engine/a2a.ts +33 -0
- package/src/engine/availability.ts +63 -0
- package/src/engine/claude-cli.ts +969 -0
- package/src/engine/codex-app-server-client.ts +294 -0
- package/src/engine/codex-bin.ts +49 -0
- package/src/engine/codex-cli.ts +1014 -0
- package/src/engine/codex-dynamic-tools.ts +239 -0
- package/src/engine/codex-home.ts +63 -0
- package/src/engine/codex-thread-config.ts +74 -0
- package/src/engine/context-budget.ts +257 -0
- package/src/engine/engine-meta-labels.ts +211 -0
- package/src/engine/grok-cli.ts +941 -0
- package/src/engine/inline-think.ts +59 -0
- package/src/engine/model-availability.ts +105 -0
- package/src/engine/openai-compatible.ts +2464 -0
- package/src/engine/reasoning-retry.ts +83 -0
- package/src/engine/registry.ts +13 -0
- package/src/engine/replay.ts +195 -0
- package/src/engine/sampling.ts +90 -0
- package/src/engine/thinking-params.ts +264 -0
- package/src/engine/types.ts +269 -0
- package/src/engine/user-tag.ts +24 -0
- package/src/imagegen/aspect.ts +128 -0
- package/src/imagegen/generate.ts +642 -0
- package/src/imagegen/references.ts +75 -0
- package/src/imagegen/types.ts +154 -0
- package/src/lsp/client.ts +183 -0
- package/src/lsp/fake-server.helper.mjs +42 -0
- package/src/lsp/format.ts +29 -0
- package/src/lsp/index.ts +21 -0
- package/src/lsp/manager.ts +238 -0
- package/src/lsp/registry.ts +151 -0
- package/src/mcp/config.ts +117 -0
- package/src/mcp/hub/audit.ts +55 -0
- package/src/mcp/hub/bridge.ts +115 -0
- package/src/mcp/hub/catalog.ts +69 -0
- package/src/mcp/hub/credentials.ts +406 -0
- package/src/mcp/hub/env-expand.ts +14 -0
- package/src/mcp/hub/manager.ts +770 -0
- package/src/mcp/hub/normalize.ts +213 -0
- package/src/mcp/server.ts +368 -0
- package/src/mcp/tool-schema.ts +20 -0
- package/src/media/capabilities.ts +392 -0
- package/src/media/records.ts +175 -0
- package/src/media/store.ts +217 -0
- package/src/media/types.ts +69 -0
- package/src/memory/chunking.ts +168 -0
- package/src/memory/embeddings.ts +262 -0
- package/src/memory/index.ts +15 -0
- package/src/memory/inject.ts +197 -0
- package/src/memory/manager.ts +996 -0
- package/src/memory/registry.ts +176 -0
- package/src/memory/rescan.ts +101 -0
- package/src/memory/retrieval.ts +586 -0
- package/src/memory/shared-index.ts +372 -0
- package/src/memory/slug.ts +39 -0
- package/src/memory/storage.ts +385 -0
- package/src/memory/watcher.ts +134 -0
- package/src/multimodal/blocks.ts +101 -0
- package/src/multimodal/dimensions.ts +214 -0
- package/src/multimodal/load.ts +86 -0
- package/src/multimodal/mime.ts +135 -0
- package/src/multimodal/pdf-render.ts +80 -0
- package/src/multimodal/user-content.ts +266 -0
- package/src/persona/files.ts +144 -0
- package/src/persona/loader.ts +598 -0
- package/src/persona/skill-gating-store.ts +59 -0
- package/src/persona/tool-gating-store.ts +113 -0
- package/src/projects/focus.ts +186 -0
- package/src/projects/prompt-block.ts +106 -0
- package/src/projects/scheme.ts +107 -0
- package/src/projects/store.ts +144 -0
- package/src/projects/types.ts +73 -0
- package/src/sentinel/dispatcher.ts +97 -0
- package/src/sentinel/schedule.ts +271 -0
- package/src/sentinel/scheduler.ts +840 -0
- package/src/sentinel/store.ts +259 -0
- package/src/sentinel/types.ts +221 -0
- package/src/server/activity-stream.ts +160 -0
- package/src/server/ask-calls.ts +137 -0
- package/src/server/ask-wait-graph.ts +171 -0
- package/src/server/async-tasks.ts +199 -0
- package/src/server/builder-busy.ts +86 -0
- package/src/server/builder-prompt.ts +204 -0
- package/src/server/builder-questions.ts +117 -0
- package/src/server/builder-session.ts +249 -0
- package/src/server/chat-aborts.ts +83 -0
- package/src/server/claude-config-dir.ts +71 -0
- package/src/server/claude-credential-sync.ts +454 -0
- package/src/server/env-file.ts +100 -0
- package/src/server/env.ts +115 -0
- package/src/server/heal-session.ts +151 -0
- package/src/server/history-page.ts +46 -0
- package/src/server/index.ts +7244 -0
- package/src/server/lockfile.ts +89 -0
- package/src/server/logger.ts +67 -0
- package/src/server/logs.ts +187 -0
- package/src/server/loopback-fetch.ts +130 -0
- package/src/server/openai-client.ts +89 -0
- package/src/server/prompt-assembly.ts +334 -0
- package/src/server/restart-reconcile.ts +139 -0
- package/src/server/run-turn-fallback.ts +275 -0
- package/src/server/run-turn-types.ts +91 -0
- package/src/server/run-turn.ts +1474 -0
- package/src/server/sanitize-assistant-text.ts +112 -0
- package/src/server/session-export.ts +220 -0
- package/src/server/session-queue.ts +376 -0
- package/src/server/session-workdir.ts +49 -0
- package/src/server/sse-h2-safe.ts +61 -0
- package/src/server/sse-liveness.ts +162 -0
- package/src/server/sse-serializer.ts +161 -0
- package/src/server/start-turn.ts +249 -0
- package/src/server/steer-inbox.ts +107 -0
- package/src/server/tls-keeper.ts +153 -0
- package/src/server/tool-format.ts +167 -0
- package/src/server/turn-framing.ts +52 -0
- package/src/server/turn-origin-kind.ts +74 -0
- package/src/server/turn-origin.ts +40 -0
- package/src/server/work-ledger.ts +975 -0
- package/src/server/workspace.ts +114 -0
- package/src/setup/config-edit.ts +201 -0
- package/src/setup/presets.ts +71 -0
- package/src/setup/prompt.ts +163 -0
- package/src/setup/tailscale.ts +44 -0
- package/src/skills/bin-checks.ts +227 -0
- package/src/skills/bootstrap.ts +347 -0
- package/src/skills/env-scope.ts +175 -0
- package/src/skills/gating.ts +71 -0
- package/src/skills/lint.ts +202 -0
- package/src/skills/load.ts +368 -0
- package/src/skills/path-helpers.ts +102 -0
- package/src/skills/registry.ts +178 -0
- package/src/ssh/exec.ts +142 -0
- package/src/ssh/index.ts +12 -0
- package/src/ssh/known-hosts.ts +109 -0
- package/src/ssh/pool.ts +307 -0
- package/src/storage/sessions.ts +602 -0
- package/src/team/render.ts +149 -0
- package/src/team/resolve.ts +122 -0
- package/src/team/store.ts +124 -0
- package/src/team/types.ts +111 -0
- package/src/team/write.ts +95 -0
- package/src/testing/isolated-home.mts +46 -0
- package/src/tmux/attention-watcher.ts +272 -0
- package/src/tmux/attention.ts +336 -0
- package/src/tmux/list.ts +91 -0
- package/src/tmux/origin-store.ts +102 -0
- package/src/tmux/tui-markers.ts +267 -0
- package/src/tools/agents/ask-cancel.ts +94 -0
- package/src/tools/agents/ask-result.ts +235 -0
- package/src/tools/agents/ask.ts +704 -0
- package/src/tools/agents/builder-dispatch.ts +217 -0
- package/src/tools/agents/images.ts +104 -0
- package/src/tools/agents/index.ts +42 -0
- package/src/tools/agents/long-task-timeouts.ts +39 -0
- package/src/tools/agents/session-list.ts +136 -0
- package/src/tools/agents/session-model.ts +106 -0
- package/src/tools/agents/spawn.ts +845 -0
- package/src/tools/agents/status.ts +589 -0
- package/src/tools/browser/index.ts +6 -0
- package/src/tools/browser/ops.ts +145 -0
- package/src/tools/browser/tools.ts +184 -0
- package/src/tools/builder/short-descriptions.ts +80 -0
- package/src/tools/builder/tools.ts +222 -0
- package/src/tools/docs/index.ts +1 -0
- package/src/tools/docs/tools.ts +228 -0
- package/src/tools/dream/index.ts +11 -0
- package/src/tools/dream/tools.ts +1002 -0
- package/src/tools/exec/allowlist.ts +233 -0
- package/src/tools/exec/background-detach.helper.mts +27 -0
- package/src/tools/exec/blacklist.ts +336 -0
- package/src/tools/exec/concurrency.ts +150 -0
- package/src/tools/exec/fit-output.ts +82 -0
- package/src/tools/exec/index.ts +7 -0
- package/src/tools/exec/internal-env.ts +89 -0
- package/src/tools/exec/job-store.ts +403 -0
- package/src/tools/exec/local.ts +649 -0
- package/src/tools/exec/remote.ts +399 -0
- package/src/tools/exec/tools.ts +934 -0
- package/src/tools/file/analyze.ts +378 -0
- package/src/tools/file/index.ts +2 -0
- package/src/tools/file/local.ts +707 -0
- package/src/tools/file/lsp-hook.ts +72 -0
- package/src/tools/file/persona-guard.ts +61 -0
- package/src/tools/file/policy.ts +292 -0
- package/src/tools/file/read-format.ts +129 -0
- package/src/tools/file/remote.ts +680 -0
- package/src/tools/file/replace.ts +507 -0
- package/src/tools/file/search-window.ts +224 -0
- package/src/tools/file/tools.ts +658 -0
- package/src/tools/file/write-scope.ts +182 -0
- package/src/tools/gating.ts +106 -0
- package/src/tools/image/budget.ts +82 -0
- package/src/tools/image/index.ts +7 -0
- package/src/tools/image/tools.ts +601 -0
- package/src/tools/index.ts +99 -0
- package/src/tools/memory/index.ts +12 -0
- package/src/tools/memory/tools.ts +399 -0
- package/src/tools/projects/index.ts +1 -0
- package/src/tools/projects/tools.ts +643 -0
- package/src/tools/registry.ts +427 -0
- package/src/tools/resources/index.ts +8 -0
- package/src/tools/resources/tools.ts +176 -0
- package/src/tools/resources/visibility.ts +60 -0
- package/src/tools/sentinel/index.ts +1 -0
- package/src/tools/sentinel/tools.ts +592 -0
- package/src/tools/skill/index.ts +4 -0
- package/src/tools/skill/tools.ts +285 -0
- package/src/tools/time/index.ts +5 -0
- package/src/tools/time/tools.ts +123 -0
- package/src/tools/tmux/index.ts +1 -0
- package/src/tools/tmux/local.ts +277 -0
- package/src/tools/tmux/remote.ts +168 -0
- package/src/tools/tmux/tools.ts +1064 -0
- package/src/tools/tool-output.ts +97 -0
- package/src/tools/types.ts +227 -0
- package/src/tools/video/index.ts +1 -0
- package/src/tools/video/tools.ts +425 -0
- package/src/tools/web/fetch.ts +337 -0
- package/src/tools/web/index.ts +4 -0
- package/src/tools/web/tools.ts +186 -0
- package/src/tools/wiki/index.ts +1 -0
- package/src/tools/wiki/tools.ts +445 -0
- package/src/tts/cache-gc.ts +128 -0
- package/src/tts/prepare-for-tts.ts +114 -0
- package/src/tts/service.ts +332 -0
- package/src/types/events.ts +695 -0
- package/src/types/turn-origin.ts +53 -0
- package/src/version.ts +21 -0
- package/src/videogen/dialects.ts +222 -0
- package/src/videogen/generate.ts +484 -0
- package/src/videogen/jobs.ts +178 -0
- package/src/videogen/runner.ts +125 -0
- package/src/videogen/wake.ts +119 -0
- package/src/voice/realtime/call.ts +948 -0
- package/src/voice/realtime/consult.ts +293 -0
- package/src/voice/realtime/fake-provider.ts +134 -0
- package/src/voice/realtime/manager.ts +384 -0
- package/src/voice/realtime/openai-provider.ts +471 -0
- package/src/voice/realtime/persona.ts +227 -0
- package/src/voice/realtime/session-match.ts +116 -0
- package/src/voice/realtime/types.ts +182 -0
- package/src/wiki/conflict.ts +113 -0
- package/src/wiki/explorer.ts +578 -0
- package/src/wiki/index-builder.ts +172 -0
- package/src/wiki/language.ts +134 -0
- package/src/wiki/log-builder.ts +150 -0
- package/src/wiki/map.ts +258 -0
- package/src/wiki/migration/analyze.ts +304 -0
- package/src/wiki/migration/execute.ts +689 -0
- package/src/wiki/migration/refine.ts +402 -0
- package/src/wiki/migration/store.ts +100 -0
- package/src/wiki/move-page.ts +57 -0
- package/src/wiki/structure-file.ts +192 -0
- package/src/wiki/taxonomy.ts +140 -0
- package/src/wiki/templates.ts +163 -0
- package/src/wiki/types.ts +133 -0
- package/templates/skills/README.md +24 -0
- package/templates/skills/_templates/api-wrapper/SKILL.md +26 -0
- package/templates/skills/_templates/cli-wrapper/BOOTSTRAP.md +32 -0
- package/templates/skills/_templates/cli-wrapper/SKILL.md +24 -0
- package/templates/skills/_templates/default/SKILL.md +25 -0
- package/templates/skills/builder-handover/SKILL.md +96 -0
- package/templates/skills/builder-handover/assets/ORDER.md +12 -0
- package/templates/skills/skill-author/SKILL.md +110 -0
- package/tsconfig.json +22 -0
- package/web/dist/assets/index-BaVv6pB2.js +631 -0
- package/web/dist/assets/index-BaVv6pB2.js.map +1 -0
- package/web/dist/assets/index-V3FV3Z25.css +32 -0
- package/web/dist/favicon.svg +8 -0
- package/web/dist/index.html +20 -0
- package/web/package.json +36 -0
- package/web/tsconfig.json +25 -0
- package/web-mobile/dist/apple-touch-icon.png +0 -0
- package/web-mobile/dist/assets/index-BqKt7IMx.css +1 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js +88 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js.map +1 -0
- package/web-mobile/dist/favicon.svg +8 -0
- package/web-mobile/dist/icon-192.png +0 -0
- package/web-mobile/dist/icon-512.png +0 -0
- package/web-mobile/dist/index.html +27 -0
- package/web-mobile/dist/manifest.webmanifest +32 -0
- package/web-mobile/dist/service-worker.js +90 -0
- package/web-mobile/package.json +28 -0
- package/web-mobile/tsconfig.json +25 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function cc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xf={exports:{}},xl={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Nb;function i2(){if(Nb)return xl;Nb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:c,ref:a!==void 0?a:null,props:o}}return xl.Fragment=t,xl.jsx=n,xl.jsxs=n,xl}var Ob;function r2(){return Ob||(Ob=1,Xf.exports=i2()),Xf.exports}var h=r2(),Zf={exports:{}},mt={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Db;function s2(){if(Db)return mt;Db=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),y=Symbol.iterator;function b(W){return W===null||typeof W!="object"?null:(W=y&&W[y]||W["@@iterator"],typeof W=="function"?W:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(W,I,E){this.props=W,this.context=I,this.refs=C,this.updater=E||w}k.prototype.isReactComponent={},k.prototype.setState=function(W,I){if(typeof W!="object"&&typeof W!="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,I,"setState")},k.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function j(){}j.prototype=k.prototype;function R(W,I,E){this.props=W,this.context=I,this.refs=C,this.updater=E||w}var L=R.prototype=new j;L.constructor=R,S(L,k.prototype),L.isPureReactComponent=!0;var q=Array.isArray;function O(){}var z={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function ie(W,I,E){var F=E.ref;return{$$typeof:e,type:W,key:I,ref:F!==void 0?F:null,props:E}}function D(W,I){return ie(W.type,I,W.props)}function A(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function M(W){var I={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(E){return I[E]})}var P=/\/+/g;function G(W,I){return typeof W=="object"&&W!==null&&W.key!=null?M(""+W.key):I.toString(36)}function H(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status=="string"?W.then(O,O):(W.status="pending",W.then(function(I){W.status==="pending"&&(W.status="fulfilled",W.value=I)},function(I){W.status==="pending"&&(W.status="rejected",W.reason=I)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function N(W,I,E,F,Y){var Z=typeof W;(Z==="undefined"||Z==="boolean")&&(W=null);var ve=!1;if(W===null)ve=!0;else switch(Z){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(W.$$typeof){case e:case t:ve=!0;break;case m:return ve=W._init,N(ve(W._payload),I,E,F,Y)}}if(ve)return Y=Y(W),ve=F===""?"."+G(W,0):F,q(Y)?(E="",ve!=null&&(E=ve.replace(P,"$&/")+"/"),N(Y,I,E,"",function(Fe){return Fe})):Y!=null&&(A(Y)&&(Y=D(Y,E+(Y.key==null||W&&W.key===Y.key?"":(""+Y.key).replace(P,"$&/")+"/")+ve)),I.push(Y)),1;ve=0;var Oe=F===""?".":F+":";if(q(W))for(var _e=0;_e<W.length;_e++)F=W[_e],Z=Oe+G(F,_e),ve+=N(F,I,E,Z,Y);else if(_e=b(W),typeof _e=="function")for(W=_e.call(W),_e=0;!(F=W.next()).done;)F=F.value,Z=Oe+G(F,_e++),ve+=N(F,I,E,Z,Y);else if(Z==="object"){if(typeof W.then=="function")return N(H(W),I,E,F,Y);throw I=String(W),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return ve}function $(W,I,E){if(W==null)return W;var F=[],Y=0;return N(W,F,"","",function(Z){return I.call(E,Z,Y++)}),F}function K(W){if(W._status===-1){var I=W._result;I=I(),I.then(function(E){(W._status===0||W._status===-1)&&(W._status=1,W._result=E)},function(E){(W._status===0||W._status===-1)&&(W._status=2,W._result=E)}),W._status===-1&&(W._status=0,W._result=I)}if(W._status===1)return W._result.default;throw W._result}var re=typeof reportError=="function"?reportError:function(W){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W=="object"&&W!==null&&typeof W.message=="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",W);return}console.error(W)},U={map:$,forEach:function(W,I,E){$(W,function(){I.apply(this,arguments)},E)},count:function(W){var I=0;return $(W,function(){I++}),I},toArray:function(W){return $(W,function(I){return I})||[]},only:function(W){if(!A(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};return mt.Activity=_,mt.Children=U,mt.Component=k,mt.Fragment=n,mt.Profiler=a,mt.PureComponent=R,mt.StrictMode=r,mt.Suspense=p,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,mt.__COMPILER_RUNTIME={__proto__:null,c:function(W){return z.H.useMemoCache(W)}},mt.cache=function(W){return function(){return W.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(W,I,E){if(W==null)throw Error("The argument must be a React element, but you passed "+W+".");var F=S({},W.props),Y=W.key;if(I!=null)for(Z in I.key!==void 0&&(Y=""+I.key),I)!J.call(I,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&I.ref===void 0||(F[Z]=I[Z]);var Z=arguments.length-2;if(Z===1)F.children=E;else if(1<Z){for(var ve=Array(Z),Oe=0;Oe<Z;Oe++)ve[Oe]=arguments[Oe+2];F.children=ve}return ie(W.type,Y,F)},mt.createContext=function(W){return W={$$typeof:c,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:o,_context:W},W},mt.createElement=function(W,I,E){var F,Y={},Z=null;if(I!=null)for(F in I.key!==void 0&&(Z=""+I.key),I)J.call(I,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(Y[F]=I[F]);var ve=arguments.length-2;if(ve===1)Y.children=E;else if(1<ve){for(var Oe=Array(ve),_e=0;_e<ve;_e++)Oe[_e]=arguments[_e+2];Y.children=Oe}if(W&&W.defaultProps)for(F in ve=W.defaultProps,ve)Y[F]===void 0&&(Y[F]=ve[F]);return ie(W,Z,Y)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(W){return{$$typeof:f,render:W}},mt.isValidElement=A,mt.lazy=function(W){return{$$typeof:m,_payload:{_status:-1,_result:W},_init:K}},mt.memo=function(W,I){return{$$typeof:d,type:W,compare:I===void 0?null:I}},mt.startTransition=function(W){var I=z.T,E={};z.T=E;try{var F=W(),Y=z.S;Y!==null&&Y(E,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(O,re)}catch(Z){re(Z)}finally{I!==null&&E.types!==null&&(I.types=E.types),z.T=I}},mt.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},mt.use=function(W){return z.H.use(W)},mt.useActionState=function(W,I,E){return z.H.useActionState(W,I,E)},mt.useCallback=function(W,I){return z.H.useCallback(W,I)},mt.useContext=function(W){return z.H.useContext(W)},mt.useDebugValue=function(){},mt.useDeferredValue=function(W,I){return z.H.useDeferredValue(W,I)},mt.useEffect=function(W,I){return z.H.useEffect(W,I)},mt.useEffectEvent=function(W){return z.H.useEffectEvent(W)},mt.useId=function(){return z.H.useId()},mt.useImperativeHandle=function(W,I,E){return z.H.useImperativeHandle(W,I,E)},mt.useInsertionEffect=function(W,I){return z.H.useInsertionEffect(W,I)},mt.useLayoutEffect=function(W,I){return z.H.useLayoutEffect(W,I)},mt.useMemo=function(W,I){return z.H.useMemo(W,I)},mt.useOptimistic=function(W,I){return z.H.useOptimistic(W,I)},mt.useReducer=function(W,I,E){return z.H.useReducer(W,I,E)},mt.useRef=function(W){return z.H.useRef(W)},mt.useState=function(W){return z.H.useState(W)},mt.useSyncExternalStore=function(W,I,E){return z.H.useSyncExternalStore(W,I,E)},mt.useTransition=function(){return z.H.useTransition()},mt.version="19.2.7",mt}var Lb;function cm(){return Lb||(Lb=1,Zf.exports=s2()),Zf.exports}var x=cm();const a2=cc(x);var Jf={exports:{}},Sl={},Qf={exports:{}},ep={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var zb;function o2(){return zb||(zb=1,(function(e){function t(N,$){var K=N.length;N.push($);e:for(;0<K;){var re=K-1>>>1,U=N[re];if(0<a(U,$))N[re]=$,N[K]=U,K=re;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var $=N[0],K=N.pop();if(K!==$){N[0]=K;e:for(var re=0,U=N.length,W=U>>>1;re<W;){var I=2*(re+1)-1,E=N[I],F=I+1,Y=N[F];if(0>a(E,K))F<U&&0>a(Y,E)?(N[re]=Y,N[F]=K,re=F):(N[re]=E,N[I]=K,re=I);else if(F<U&&0>a(Y,K))N[re]=Y,N[F]=K,re=F;else break e}}return $}function a(N,$){var K=N.sortIndex-$.sortIndex;return K!==0?K:N.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],d=[],m=1,_=null,y=3,b=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function L(N){for(var $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=N)r(d),$.sortIndex=$.expirationTime,t(p,$);else break;$=n(d)}}function q(N){if(S=!1,L(N),!w)if(n(p)!==null)w=!0,O||(O=!0,M());else{var $=n(d);$!==null&&H(q,$.startTime-N)}}var O=!1,z=-1,J=5,ie=-1;function D(){return C?!0:!(e.unstable_now()-ie<J)}function A(){if(C=!1,O){var N=e.unstable_now();ie=N;var $=!0;try{e:{w=!1,S&&(S=!1,j(z),z=-1),b=!0;var K=y;try{t:{for(L(N),_=n(p);_!==null&&!(_.expirationTime>N&&D());){var re=_.callback;if(typeof re=="function"){_.callback=null,y=_.priorityLevel;var U=re(_.expirationTime<=N);if(N=e.unstable_now(),typeof U=="function"){_.callback=U,L(N),$=!0;break t}_===n(p)&&r(p),L(N)}else r(p);_=n(p)}if(_!==null)$=!0;else{var W=n(d);W!==null&&H(q,W.startTime-N),$=!1}}break e}finally{_=null,y=K,b=!1}$=void 0}}finally{$?M():O=!1}}}var M;if(typeof R=="function")M=function(){R(A)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,G=P.port2;P.port1.onmessage=A,M=function(){G.postMessage(null)}}else M=function(){k(A,0)};function H(N,$){z=k(function(){N(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(N){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var K=y;y=$;try{return N()}finally{y=K}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(N,$){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var K=y;y=N;try{return $()}finally{y=K}},e.unstable_scheduleCallback=function(N,$,K){var re=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?re+K:re):K=re,N){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=K+U,N={id:m++,callback:$,priorityLevel:N,startTime:K,expirationTime:U,sortIndex:-1},K>re?(N.sortIndex=K,t(d,N),n(p)===null&&N===n(d)&&(S?(j(z),z=-1):S=!0,H(q,K-re))):(N.sortIndex=U,t(p,N),w||b||(w=!0,O||(O=!0,M()))),N},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(N){var $=y;return function(){var K=y;y=$;try{return N.apply(this,arguments)}finally{y=K}}}})(ep)),ep}var Bb;function l2(){return Bb||(Bb=1,Qf.exports=o2()),Qf.exports}var tp={exports:{}},Qn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var jb;function c2(){if(jb)return Qn;jb=1;var e=cm();function t(p){var d="https://react.dev/errors/"+p;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)d+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+p+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(p,d,m){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:_==null?null:""+_,children:p,containerInfo:d,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,d){if(p==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Qn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Qn.createPortal=function(p,d){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return o(p,d,null,m)},Qn.flushSync=function(p){var d=c.T,m=r.p;try{if(c.T=null,r.p=2,p)return p()}finally{c.T=d,r.p=m,r.d.f()}},Qn.preconnect=function(p,d){typeof p=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(p,d))},Qn.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Qn.preinit=function(p,d){if(typeof p=="string"&&d&&typeof d.as=="string"){var m=d.as,_=f(m,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;m==="style"?r.d.S(p,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:_,integrity:y,fetchPriority:b}):m==="script"&&r.d.X(p,{crossOrigin:_,integrity:y,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Qn.preinitModule=function(p,d){if(typeof p=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var m=f(d.as,d.crossOrigin);r.d.M(p,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(p)},Qn.preload=function(p,d){if(typeof p=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var m=d.as,_=f(m,d.crossOrigin);r.d.L(p,m,{crossOrigin:_,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Qn.preloadModule=function(p,d){if(typeof p=="string")if(d){var m=f(d.as,d.crossOrigin);r.d.m(p,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(p)},Qn.requestFormReset=function(p){r.d.r(p)},Qn.unstable_batchedUpdates=function(p,d){return p(d)},Qn.useFormState=function(p,d,m){return c.H.useFormState(p,d,m)},Qn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Qn.version="19.2.7",Qn}var Ib;function Dx(){if(Ib)return tp.exports;Ib=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),tp.exports=c2(),tp.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var Pb;function u2(){if(Pb)return Sl;Pb=1;var e=l2(),t=cm(),n=Dx();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var s=i,l=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(l=s.return),i=s.return;while(i)}return s.tag===3?l:null}function c(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function f(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(o(i)!==i)throw Error(r(188))}function d(i){var s=i.alternate;if(!s){if(s=o(i),s===null)throw Error(r(188));return s!==i?null:i}for(var l=i,u=s;;){var g=l.return;if(g===null)break;var v=g.alternate;if(v===null){if(u=g.return,u!==null){l=u;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===l)return p(g),i;if(v===u)return p(g),s;v=v.sibling}throw Error(r(188))}if(l.return!==u.return)l=g,u=v;else{for(var T=!1,B=g.child;B;){if(B===l){T=!0,l=g,u=v;break}if(B===u){T=!0,u=g,l=v;break}B=B.sibling}if(!T){for(B=v.child;B;){if(B===l){T=!0,l=v,u=g;break}if(B===u){T=!0,u=v,l=g;break}B=B.sibling}if(!T)throw Error(r(189))}}if(l.alternate!==u)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?i:s}function m(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=m(i),s!==null)return s;i=i.sibling}return null}var _=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),R=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function M(i){return i===null||typeof i!="object"?null:(i=A&&i[A]||i["@@iterator"],typeof i=="function"?i:null)}var P=Symbol.for("react.client.reference");function G(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===P?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case q:return"Suspense";case O:return"SuspenseList";case ie:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case R:return i.displayName||"Context";case j:return(i._context.displayName||"Context")+".Consumer";case L:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case z:return s=i.displayName||null,s!==null?s:G(i.type)||"Memo";case J:s=i._payload,i=i._init;try{return G(i(s))}catch{}}return null}var H=Array.isArray,N=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},re=[],U=-1;function W(i){return{current:i}}function I(i){0>U||(i.current=re[U],re[U]=null,U--)}function E(i,s){U++,re[U]=i.current,i.current=s}var F=W(null),Y=W(null),Z=W(null),ve=W(null);function Oe(i,s){switch(E(Z,s),E(Y,i),E(F,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?eb(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=eb(s),i=tb(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}I(F),E(F,i)}function _e(){I(F),I(Y),I(Z)}function Fe(i){i.memoizedState!==null&&E(ve,i);var s=F.current,l=tb(s,i.type);s!==l&&(E(Y,i),E(F,l))}function st(i){Y.current===i&&(I(F),I(Y)),ve.current===i&&(I(ve),_l._currentValue=K)}var ae,pe;function Xe(i){if(ae===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);ae=s&&s[1]||"",pe=-1<l.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+ae+i+pe}var nt=!1;function Pe(i,s){if(!i||nt)return"";nt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(me){var de=me}Reflect.construct(i,[],ke)}else{try{ke.call()}catch(me){de=me}i.call(ke.prototype)}}else{try{throw Error()}catch(me){de=me}(ke=i())&&typeof ke.catch=="function"&&ke.catch(function(){})}}catch(me){if(me&&de&&typeof me.stack=="string")return[me.stack,de.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),T=v[0],B=v[1];if(T&&B){var te=T.split(`
|
|
44
|
+
`),he=B.split(`
|
|
45
|
+
`);for(g=u=0;u<te.length&&!te[u].includes("DetermineComponentFrameRoot");)u++;for(;g<he.length&&!he[g].includes("DetermineComponentFrameRoot");)g++;if(u===te.length||g===he.length)for(u=te.length-1,g=he.length-1;1<=u&&0<=g&&te[u]!==he[g];)g--;for(;1<=u&&0<=g;u--,g--)if(te[u]!==he[g]){if(u!==1||g!==1)do if(u--,g--,0>g||te[u]!==he[g]){var ye=`
|
|
46
|
+
`+te[u].replace(" at new "," at ");return i.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",i.displayName)),ye}while(1<=u&&0<=g);break}}}finally{nt=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?Xe(l):""}function at(i,s){switch(i.tag){case 26:case 27:case 5:return Xe(i.type);case 16:return Xe("Lazy");case 13:return i.child!==s&&s!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Pe(i.type,!1);case 11:return Pe(i.type.render,!1);case 1:return Pe(i.type,!0);case 31:return Xe("Activity");default:return""}}function V(i){try{var s="",l=null;do s+=at(i,l),l=i,i=i.return;while(i);return s}catch(u){return`
|
|
47
|
+
Error generating stack: `+u.message+`
|
|
48
|
+
`+u.stack}}var ce=Object.prototype.hasOwnProperty,X=e.unstable_scheduleCallback,fe=e.unstable_cancelCallback,Le=e.unstable_shouldYield,Ge=e.unstable_requestPaint,Te=e.unstable_now,gt=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Q=e.unstable_LowPriority,ge=e.unstable_IdlePriority,Ae=e.log,Ne=e.unstable_setDisableYieldValue,Be=null,Ue=null;function We(i){if(typeof Ae=="function"&&Ne(i),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(Be,i)}catch{}}var $e=Math.clz32?Math.clz32:Xn,ft=Math.log,Bt=Math.LN2;function Xn(i){return i>>>=0,i===0?32:31-(ft(i)/Bt|0)|0}var Mn=256,Zn=262144,ii=4194304;function yn(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function ee(i,s,l){var u=i.pendingLanes;if(u===0)return 0;var g=0,v=i.suspendedLanes,T=i.pingedLanes;i=i.warmLanes;var B=u&134217727;return B!==0?(u=B&~v,u!==0?g=yn(u):(T&=B,T!==0?g=yn(T):l||(l=B&~i,l!==0&&(g=yn(l))))):(B=u&~v,B!==0?g=yn(B):T!==0?g=yn(T):l||(l=u&~i,l!==0&&(g=yn(l)))),g===0?0:s!==0&&s!==g&&(s&v)===0&&(v=g&-g,l=s&-s,v>=l||v===32&&(l&4194048)!==0)?s:g}function xe(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function He(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ut(){var i=ii;return ii<<=1,(ii&62914560)===0&&(ii=4194304),i}function Ht(i){for(var s=[],l=0;31>l;l++)s.push(i);return s}function Ot(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Ze(i,s,l,u,g,v){var T=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var B=i.entanglements,te=i.expirationTimes,he=i.hiddenUpdates;for(l=T&~l;0<l;){var ye=31-$e(l),ke=1<<ye;B[ye]=0,te[ye]=-1;var de=he[ye];if(de!==null)for(he[ye]=null,ye=0;ye<de.length;ye++){var me=de[ye];me!==null&&(me.lane&=-536870913)}l&=~ke}u!==0&&Ye(i,u,0),v!==0&&g===0&&i.tag!==0&&(i.suspendedLanes|=v&~(T&~s))}function Ye(i,s,l){i.pendingLanes|=s,i.suspendedLanes&=~s;var u=31-$e(s);i.entangledLanes|=s,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function ot(i,s){var l=i.entangledLanes|=s;for(i=i.entanglements;l;){var u=31-$e(l),g=1<<u;g&s|i[u]&s&&(i[u]|=s),l&=~g}}function Gt(i,s){var l=s&-s;return l=(l&42)!==0?1:Zt(l),(l&(i.suspendedLanes|s))!==0?0:l}function Zt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function nr(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function es(){var i=$.p;return i!==0?i:(i=window.event,i===void 0?32:kb(i.type))}function hr(i,s){var l=$.p;try{return $.p=i,s()}finally{$.p=l}}var Ui=Math.random().toString(36).slice(2),nn="__reactFiber$"+Ui,Dn="__reactProps$"+Ui,dr="__reactContainer$"+Ui,ts="__reactEvents$"+Ui,Hs="__reactListeners$"+Ui,Rr="__reactHandles$"+Ui,$s="__reactResources$"+Ui,fr="__reactMarker$"+Ui;function ns(i){delete i[nn],delete i[Dn],delete i[ts],delete i[Hs],delete i[Rr]}function ne(i){var s=i[nn];if(s)return s;for(var l=i.parentNode;l;){if(s=l[dr]||l[nn]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(i=lb(i);i!==null;){if(l=i[nn])return l;i=lb(i)}return s}i=l,l=i.parentNode}return null}function Ee(i){if(i=i[nn]||i[dr]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function qe(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function Je(i){var s=i[$s];return s||(s=i[$s]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Qe(i){i[fr]=!0}var un=new Set,rn={};function ri(i,s){Re(i,s),Re(i+"Capture",s)}function Re(i,s){for(rn[i]=s,i=0;i<s.length;i++)un.add(s[i])}var it=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),wt={},jt={};function gn(i){return ce.call(jt,i)?!0:ce.call(wt,i)?!1:it.test(i)?jt[i]=!0:(wt[i]=!0,!1)}function Jn(i,s,l){if(gn(s))if(l===null)i.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+l)}}function Ci(i,s,l){if(l===null)i.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+l)}}function pi(i,s,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(s,l,""+u)}}function Jt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ti(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Sc(i,s,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,v=u.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return g.call(this)},set:function(T){l=""+T,v.call(this,T)}}),Object.defineProperty(i,s,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(T){l=""+T},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Ca(i){if(!i._valueTracker){var s=Ti(i)?"checked":"value";i._valueTracker=Sc(i,s,""+i[s])}}function Ro(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var l=s.getValue(),u="";return i&&(u=Ti(i)?i.checked?"true":"false":i.value),i=u,i!==l?(s.setValue(i),!0):!1}function Ta(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Yh=/[\n"\\]/g;function gi(i){return i.replace(Yh,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function No(i,s,l,u,g,v,T,B){i.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.type=T:i.removeAttribute("type"),s!=null?T==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Jt(s)):i.value!==""+Jt(s)&&(i.value=""+Jt(s)):T!=="submit"&&T!=="reset"||i.removeAttribute("value"),s!=null?Ma(i,T,Jt(s)):l!=null?Ma(i,T,Jt(l)):u!=null&&i.removeAttribute("value"),g==null&&v!=null&&(i.defaultChecked=!!v),g!=null&&(i.checked=g&&typeof g!="function"&&typeof g!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?i.name=""+Jt(B):i.removeAttribute("name")}function Fs(i,s,l,u,g,v,T,B){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.type=v),s!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Ca(i);return}l=l!=null?""+Jt(l):"",s=s!=null?""+Jt(s):l,B||s===i.value||(i.value=s),i.defaultValue=s}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=B?i.checked:!!u,i.defaultChecked=!!u,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(i.name=T),Ca(i)}function Ma(i,s,l){s==="number"&&Ta(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function Un(i,s,l,u){if(i=i.options,s){s={};for(var g=0;g<l.length;g++)s["$"+l[g]]=!0;for(l=0;l<i.length;l++)g=s.hasOwnProperty("$"+i[l].value),i[l].selected!==g&&(i[l].selected=g),g&&u&&(i[l].defaultSelected=!0)}else{for(l=""+Jt(l),s=null,g=0;g<i.length;g++){if(i[g].value===l){i[g].selected=!0,u&&(i[g].defaultSelected=!0);return}s!==null||i[g].disabled||(s=i[g])}s!==null&&(s.selected=!0)}}function wc(i,s,l){if(s!=null&&(s=""+Jt(s),s!==i.value&&(i.value=s),l==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=l!=null?""+Jt(l):""}function Aa(i,s,l,u){if(s==null){if(u!=null){if(l!=null)throw Error(r(92));if(H(u)){if(1<u.length)throw Error(r(93));u=u[0]}l=u}l==null&&(l=""),s=l}l=Jt(s),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),Ca(i)}function ht(i,s){if(s){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=s;return}}i.textContent=s}var kc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bn(i,s,l){var u=s.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":u?i.setProperty(s,l):typeof l!="number"||l===0||kc.has(s)?s==="float"?i.cssFloat=l:i[s]=(""+l).trim():i[s]=l+"px"}function It(i,s,l){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var g in s)u=s[g],s.hasOwnProperty(g)&&l[g]!==u&&bn(i,g,u)}else for(var v in s)s.hasOwnProperty(v)&&bn(i,v,s[v])}function is(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nr=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Oo=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function rs(i){return Oo.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ie(){}var et=null;function _t(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Tt=null,on=null;function Hi(i){var s=Ee(i);if(s&&(i=s.stateNode)){var l=i[Dn]||null;e:switch(i=s.stateNode,s.type){case"input":if(No(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),s=l.name,l.type==="radio"&&s!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+gi(""+s)+'"][type="radio"]'),s=0;s<l.length;s++){var u=l[s];if(u!==i&&u.form===i.form){var g=u[Dn]||null;if(!g)throw Error(r(90));No(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<l.length;s++)u=l[s],u.form===i.form&&Ro(u)}break e;case"textarea":wc(i,l.value,l.defaultValue);break e;case"select":s=l.value,s!=null&&Un(i,!!l.multiple,s,!1)}}}var Do=!1;function Ec(i,s,l){if(Do)return i(s,l);Do=!0;try{var u=i(s);return u}finally{if(Do=!1,(Tt!==null||on!==null)&&(du(),Tt&&(s=Tt,i=on,on=Tt=null,Hi(s),i)))for(s=0;s<i.length;s++)Hi(i[s])}}function Lo(i,s){var l=i.stateNode;if(l===null)return null;var u=l[Dn]||null;if(u===null)return null;l=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(r(231,s,typeof l));return l}var Or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vh=!1;if(Or)try{var zo={};Object.defineProperty(zo,"passive",{get:function(){Vh=!0}}),window.addEventListener("test",zo,zo),window.removeEventListener("test",zo,zo)}catch{Vh=!1}var ss=null,Xh=null,Cc=null;function t_(){if(Cc)return Cc;var i,s=Xh,l=s.length,u,g="value"in ss?ss.value:ss.textContent,v=g.length;for(i=0;i<l&&s[i]===g[i];i++);var T=l-i;for(u=1;u<=T&&s[l-u]===g[v-u];u++);return Cc=g.slice(i,1<u?1-u:void 0)}function Tc(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Mc(){return!0}function n_(){return!1}function mi(i){function s(l,u,g,v,T){this._reactName=l,this._targetInst=g,this.type=u,this.nativeEvent=v,this.target=T,this.currentTarget=null;for(var B in i)i.hasOwnProperty(B)&&(l=i[B],this[B]=l?l(v):v[B]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Mc:n_,this.isPropagationStopped=n_,this}return _(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Mc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Mc)},persist:function(){},isPersistent:Mc}),s}var qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ac=mi(qs),Bo=_({},qs,{view:0,detail:0}),tE=mi(Bo),Zh,Jh,jo,Rc=_({},Bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ed,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==jo&&(jo&&i.type==="mousemove"?(Zh=i.screenX-jo.screenX,Jh=i.screenY-jo.screenY):Jh=Zh=0,jo=i),Zh)},movementY:function(i){return"movementY"in i?i.movementY:Jh}}),i_=mi(Rc),nE=_({},Rc,{dataTransfer:0}),iE=mi(nE),rE=_({},Bo,{relatedTarget:0}),Qh=mi(rE),sE=_({},qs,{animationName:0,elapsedTime:0,pseudoElement:0}),aE=mi(sE),oE=_({},qs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),lE=mi(oE),cE=_({},qs,{data:0}),r_=mi(cE),uE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hE={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fE(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=dE[i])?!!s[i]:!1}function ed(){return fE}var pE=_({},Bo,{key:function(i){if(i.key){var s=uE[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Tc(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?hE[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ed,charCode:function(i){return i.type==="keypress"?Tc(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Tc(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),gE=mi(pE),mE=_({},Rc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),s_=mi(mE),_E=_({},Bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ed}),vE=mi(_E),yE=_({},qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),bE=mi(yE),xE=_({},Rc,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),SE=mi(xE),wE=_({},qs,{newState:0,oldState:0}),kE=mi(wE),EE=[9,13,27,32],td=Or&&"CompositionEvent"in window,Io=null;Or&&"documentMode"in document&&(Io=document.documentMode);var CE=Or&&"TextEvent"in window&&!Io,a_=Or&&(!td||Io&&8<Io&&11>=Io),o_=" ",l_=!1;function c_(i,s){switch(i){case"keyup":return EE.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function u_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ra=!1;function TE(i,s){switch(i){case"compositionend":return u_(s);case"keypress":return s.which!==32?null:(l_=!0,o_);case"textInput":return i=s.data,i===o_&&l_?null:i;default:return null}}function ME(i,s){if(Ra)return i==="compositionend"||!td&&c_(i,s)?(i=t_(),Cc=Xh=ss=null,Ra=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return a_&&s.locale!=="ko"?null:s.data;default:return null}}var AE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function h_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!AE[i.type]:s==="textarea"}function d_(i,s,l,u){Tt?on?on.push(u):on=[u]:Tt=u,s=yu(s,"onChange"),0<s.length&&(l=new Ac("onChange","change",null,l,u),i.push({event:l,listeners:s}))}var Po=null,Uo=null;function RE(i){Yy(i,0)}function Nc(i){var s=qe(i);if(Ro(s))return i}function f_(i,s){if(i==="change")return s}var p_=!1;if(Or){var nd;if(Or){var id="oninput"in document;if(!id){var g_=document.createElement("div");g_.setAttribute("oninput","return;"),id=typeof g_.oninput=="function"}nd=id}else nd=!1;p_=nd&&(!document.documentMode||9<document.documentMode)}function m_(){Po&&(Po.detachEvent("onpropertychange",__),Uo=Po=null)}function __(i){if(i.propertyName==="value"&&Nc(Uo)){var s=[];d_(s,Uo,i,_t(i)),Ec(RE,s)}}function NE(i,s,l){i==="focusin"?(m_(),Po=s,Uo=l,Po.attachEvent("onpropertychange",__)):i==="focusout"&&m_()}function OE(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Nc(Uo)}function DE(i,s){if(i==="click")return Nc(s)}function LE(i,s){if(i==="input"||i==="change")return Nc(s)}function zE(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Mi=typeof Object.is=="function"?Object.is:zE;function Ho(i,s){if(Mi(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var l=Object.keys(i),u=Object.keys(s);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var g=l[u];if(!ce.call(s,g)||!Mi(i[g],s[g]))return!1}return!0}function v_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function y_(i,s){var l=v_(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=s&&u>=s)return{node:l,offset:s-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=v_(l)}}function b_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?b_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function x_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Ta(i.document);s instanceof i.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)i=s.contentWindow;else break;s=Ta(i.document)}return s}function rd(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var BE=Or&&"documentMode"in document&&11>=document.documentMode,Na=null,sd=null,$o=null,ad=!1;function S_(i,s,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ad||Na==null||Na!==Ta(u)||(u=Na,"selectionStart"in u&&rd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),$o&&Ho($o,u)||($o=u,u=yu(sd,"onSelect"),0<u.length&&(s=new Ac("onSelect","select",null,s,l),i.push({event:s,listeners:u}),s.target=Na)))}function Ws(i,s){var l={};return l[i.toLowerCase()]=s.toLowerCase(),l["Webkit"+i]="webkit"+s,l["Moz"+i]="moz"+s,l}var Oa={animationend:Ws("Animation","AnimationEnd"),animationiteration:Ws("Animation","AnimationIteration"),animationstart:Ws("Animation","AnimationStart"),transitionrun:Ws("Transition","TransitionRun"),transitionstart:Ws("Transition","TransitionStart"),transitioncancel:Ws("Transition","TransitionCancel"),transitionend:Ws("Transition","TransitionEnd")},od={},w_={};Or&&(w_=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function Ks(i){if(od[i])return od[i];if(!Oa[i])return i;var s=Oa[i],l;for(l in s)if(s.hasOwnProperty(l)&&l in w_)return od[i]=s[l];return i}var k_=Ks("animationend"),E_=Ks("animationiteration"),C_=Ks("animationstart"),jE=Ks("transitionrun"),IE=Ks("transitionstart"),PE=Ks("transitioncancel"),T_=Ks("transitionend"),M_=new Map,ld="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ld.push("scrollEnd");function ir(i,s){M_.set(i,s),ri(s,[i])}var Oc=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},$i=[],Da=0,cd=0;function Dc(){for(var i=Da,s=cd=Da=0;s<i;){var l=$i[s];$i[s++]=null;var u=$i[s];$i[s++]=null;var g=$i[s];$i[s++]=null;var v=$i[s];if($i[s++]=null,u!==null&&g!==null){var T=u.pending;T===null?g.next=g:(g.next=T.next,T.next=g),u.pending=g}v!==0&&A_(l,g,v)}}function Lc(i,s,l,u){$i[Da++]=i,$i[Da++]=s,$i[Da++]=l,$i[Da++]=u,cd|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function ud(i,s,l,u){return Lc(i,s,l,u),zc(i)}function Gs(i,s){return Lc(i,null,null,s),zc(i)}function A_(i,s,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var g=!1,v=i.return;v!==null;)v.childLanes|=l,u=v.alternate,u!==null&&(u.childLanes|=l),v.tag===22&&(i=v.stateNode,i===null||i._visibility&1||(g=!0)),i=v,v=v.return;return i.tag===3?(v=i.stateNode,g&&s!==null&&(g=31-$e(l),i=v.hiddenUpdates,u=i[g],u===null?i[g]=[s]:u.push(s),s.lane=l|536870912),v):null}function zc(i){if(50<ul)throw ul=0,bf=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var La={};function UE(i,s,l,u){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(i,s,l,u){return new UE(i,s,l,u)}function hd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Dr(i,s){var l=i.alternate;return l===null?(l=Ai(i.tag,s,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=s,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,s=i.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function R_(i,s){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,s=l.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Bc(i,s,l,u,g,v){var T=0;if(u=i,typeof i=="function")hd(i)&&(T=1);else if(typeof i=="string")T=WC(i,l,F.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ie:return i=Ai(31,l,s,g),i.elementType=ie,i.lanes=v,i;case S:return Ys(l.children,g,v,s);case C:T=8,g|=24;break;case k:return i=Ai(12,l,s,g|2),i.elementType=k,i.lanes=v,i;case q:return i=Ai(13,l,s,g),i.elementType=q,i.lanes=v,i;case O:return i=Ai(19,l,s,g),i.elementType=O,i.lanes=v,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case R:T=10;break e;case j:T=9;break e;case L:T=11;break e;case z:T=14;break e;case J:T=16,u=null;break e}T=29,l=Error(r(130,i===null?"null":typeof i,"")),u=null}return s=Ai(T,l,s,g),s.elementType=i,s.type=u,s.lanes=v,s}function Ys(i,s,l,u){return i=Ai(7,i,u,s),i.lanes=l,i}function dd(i,s,l){return i=Ai(6,i,null,s),i.lanes=l,i}function N_(i){var s=Ai(18,null,null,0);return s.stateNode=i,s}function fd(i,s,l){return s=Ai(4,i.children!==null?i.children:[],i.key,s),s.lanes=l,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var O_=new WeakMap;function Fi(i,s){if(typeof i=="object"&&i!==null){var l=O_.get(i);return l!==void 0?l:(s={value:i,source:s,stack:V(s)},O_.set(i,s),s)}return{value:i,source:s,stack:V(s)}}var za=[],Ba=0,jc=null,Fo=0,qi=[],Wi=0,as=null,pr=1,gr="";function Lr(i,s){za[Ba++]=Fo,za[Ba++]=jc,jc=i,Fo=s}function D_(i,s,l){qi[Wi++]=pr,qi[Wi++]=gr,qi[Wi++]=as,as=i;var u=pr;i=gr;var g=32-$e(u)-1;u&=~(1<<g),l+=1;var v=32-$e(s)+g;if(30<v){var T=g-g%5;v=(u&(1<<T)-1).toString(32),u>>=T,g-=T,pr=1<<32-$e(s)+g|l<<g|u,gr=v+i}else pr=1<<v|l<<g|u,gr=i}function pd(i){i.return!==null&&(Lr(i,1),D_(i,1,0))}function gd(i){for(;i===jc;)jc=za[--Ba],za[Ba]=null,Fo=za[--Ba],za[Ba]=null;for(;i===as;)as=qi[--Wi],qi[Wi]=null,gr=qi[--Wi],qi[Wi]=null,pr=qi[--Wi],qi[Wi]=null}function L_(i,s){qi[Wi++]=pr,qi[Wi++]=gr,qi[Wi++]=as,pr=s.id,gr=s.overflow,as=i}var Hn=null,Qt=null,Rt=!1,os=null,Ki=!1,md=Error(r(519));function ls(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qo(Fi(s,i)),md}function z_(i){var s=i.stateNode,l=i.type,u=i.memoizedProps;switch(s[nn]=i,s[Dn]=u,l){case"dialog":Et("cancel",s),Et("close",s);break;case"iframe":case"object":case"embed":Et("load",s);break;case"video":case"audio":for(l=0;l<dl.length;l++)Et(dl[l],s);break;case"source":Et("error",s);break;case"img":case"image":case"link":Et("error",s),Et("load",s);break;case"details":Et("toggle",s);break;case"input":Et("invalid",s),Fs(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Et("invalid",s);break;case"textarea":Et("invalid",s),Aa(s,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||s.textContent===""+l||u.suppressHydrationWarning===!0||Jy(s.textContent,l)?(u.popover!=null&&(Et("beforetoggle",s),Et("toggle",s)),u.onScroll!=null&&Et("scroll",s),u.onScrollEnd!=null&&Et("scrollend",s),u.onClick!=null&&(s.onclick=Ie),s=!0):s=!1,s||ls(i,!0)}function B_(i){for(Hn=i.return;Hn;)switch(Hn.tag){case 5:case 31:case 13:Ki=!1;return;case 27:case 3:Ki=!0;return;default:Hn=Hn.return}}function ja(i){if(i!==Hn)return!1;if(!Rt)return B_(i),Rt=!0,!1;var s=i.tag,l;if((l=s!==3&&s!==27)&&((l=s===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||zf(i.type,i.memoizedProps)),l=!l),l&&Qt&&ls(i),B_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Qt=ob(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Qt=ob(i)}else s===27?(s=Qt,Ss(i.type)?(i=Uf,Uf=null,Qt=i):Qt=s):Qt=Hn?Yi(i.stateNode.nextSibling):null;return!0}function Vs(){Qt=Hn=null,Rt=!1}function _d(){var i=os;return i!==null&&(bi===null?bi=i:bi.push.apply(bi,i),os=null),i}function qo(i){os===null?os=[i]:os.push(i)}var vd=W(null),Xs=null,zr=null;function cs(i,s,l){E(vd,s._currentValue),s._currentValue=l}function Br(i){i._currentValue=vd.current,I(vd)}function yd(i,s,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),i===l)break;i=i.return}}function bd(i,s,l,u){var g=i.child;for(g!==null&&(g.return=i);g!==null;){var v=g.dependencies;if(v!==null){var T=g.child;v=v.firstContext;e:for(;v!==null;){var B=v;v=g;for(var te=0;te<s.length;te++)if(B.context===s[te]){v.lanes|=l,B=v.alternate,B!==null&&(B.lanes|=l),yd(v.return,l,i),u||(T=null);break e}v=B.next}}else if(g.tag===18){if(T=g.return,T===null)throw Error(r(341));T.lanes|=l,v=T.alternate,v!==null&&(v.lanes|=l),yd(T,l,i),T=null}else T=g.child;if(T!==null)T.return=g;else for(T=g;T!==null;){if(T===i){T=null;break}if(g=T.sibling,g!==null){g.return=T.return,T=g;break}T=T.return}g=T}}function Ia(i,s,l,u){i=null;for(var g=s,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var T=g.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var B=g.type;Mi(g.pendingProps.value,T.value)||(i!==null?i.push(B):i=[B])}}else if(g===ve.current){if(T=g.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(i!==null?i.push(_l):i=[_l])}g=g.return}i!==null&&bd(s,i,l,u),s.flags|=262144}function Ic(i){for(i=i.firstContext;i!==null;){if(!Mi(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Zs(i){Xs=i,zr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function $n(i){return j_(Xs,i)}function Pc(i,s){return Xs===null&&Zs(i),j_(i,s)}function j_(i,s){var l=s._currentValue;if(s={context:s,memoizedValue:l,next:null},zr===null){if(i===null)throw Error(r(308));zr=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else zr=zr.next=s;return l}var HE=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){s.aborted=!0,i.forEach(function(l){return l()})}},$E=e.unstable_scheduleCallback,FE=e.unstable_NormalPriority,xn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xd(){return{controller:new HE,data:new Map,refCount:0}}function Wo(i){i.refCount--,i.refCount===0&&$E(FE,function(){i.controller.abort()})}var Ko=null,Sd=0,Pa=0,Ua=null;function qE(i,s){if(Ko===null){var l=Ko=[];Sd=0,Pa=Cf(),Ua={status:"pending",value:void 0,then:function(u){l.push(u)}}}return Sd++,s.then(I_,I_),s}function I_(){if(--Sd===0&&Ko!==null){Ua!==null&&(Ua.status="fulfilled");var i=Ko;Ko=null,Pa=0,Ua=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function WE(i,s){var l=[],u={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return i.then(function(){u.status="fulfilled",u.value=s;for(var g=0;g<l.length;g++)(0,l[g])(s)},function(g){for(u.status="rejected",u.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),u}var P_=N.S;N.S=function(i,s){Sy=Te(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&qE(i,s),P_!==null&&P_(i,s)};var Js=W(null);function wd(){var i=Js.current;return i!==null?i:Yt.pooledCache}function Uc(i,s){s===null?E(Js,Js.current):E(Js,s.pool)}function U_(){var i=wd();return i===null?null:{parent:xn._currentValue,pool:i}}var Ha=Error(r(460)),kd=Error(r(474)),Hc=Error(r(542)),$c={then:function(){}};function H_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function $_(i,s,l){switch(l=i[l],l===void 0?i.push(s):l!==s&&(s.then(Ie,Ie),s=l),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,q_(i),i;default:if(typeof s.status=="string")s.then(Ie,Ie);else{if(i=Yt,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(u){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=u}},function(u){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,q_(i),i}throw ea=s,Ha}}function Qs(i){try{var s=i._init;return s(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ea=l,Ha):l}}var ea=null;function F_(){if(ea===null)throw Error(r(459));var i=ea;return ea=null,i}function q_(i){if(i===Ha||i===Hc)throw Error(r(483))}var $a=null,Go=0;function Fc(i){var s=Go;return Go+=1,$a===null&&($a=[]),$_($a,i,s)}function Yo(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function qc(i,s){throw s.$$typeof===y?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function W_(i){function s(oe,se){if(i){var ue=oe.deletions;ue===null?(oe.deletions=[se],oe.flags|=16):ue.push(se)}}function l(oe,se){if(!i)return null;for(;se!==null;)s(oe,se),se=se.sibling;return null}function u(oe){for(var se=new Map;oe!==null;)oe.key!==null?se.set(oe.key,oe):se.set(oe.index,oe),oe=oe.sibling;return se}function g(oe,se){return oe=Dr(oe,se),oe.index=0,oe.sibling=null,oe}function v(oe,se,ue){return oe.index=ue,i?(ue=oe.alternate,ue!==null?(ue=ue.index,ue<se?(oe.flags|=67108866,se):ue):(oe.flags|=67108866,se)):(oe.flags|=1048576,se)}function T(oe){return i&&oe.alternate===null&&(oe.flags|=67108866),oe}function B(oe,se,ue,we){return se===null||se.tag!==6?(se=dd(ue,oe.mode,we),se.return=oe,se):(se=g(se,ue),se.return=oe,se)}function te(oe,se,ue,we){var rt=ue.type;return rt===S?ye(oe,se,ue.props.children,we,ue.key):se!==null&&(se.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===J&&Qs(rt)===se.type)?(se=g(se,ue.props),Yo(se,ue),se.return=oe,se):(se=Bc(ue.type,ue.key,ue.props,null,oe.mode,we),Yo(se,ue),se.return=oe,se)}function he(oe,se,ue,we){return se===null||se.tag!==4||se.stateNode.containerInfo!==ue.containerInfo||se.stateNode.implementation!==ue.implementation?(se=fd(ue,oe.mode,we),se.return=oe,se):(se=g(se,ue.children||[]),se.return=oe,se)}function ye(oe,se,ue,we,rt){return se===null||se.tag!==7?(se=Ys(ue,oe.mode,we,rt),se.return=oe,se):(se=g(se,ue),se.return=oe,se)}function ke(oe,se,ue){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return se=dd(""+se,oe.mode,ue),se.return=oe,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case b:return ue=Bc(se.type,se.key,se.props,null,oe.mode,ue),Yo(ue,se),ue.return=oe,ue;case w:return se=fd(se,oe.mode,ue),se.return=oe,se;case J:return se=Qs(se),ke(oe,se,ue)}if(H(se)||M(se))return se=Ys(se,oe.mode,ue,null),se.return=oe,se;if(typeof se.then=="function")return ke(oe,Fc(se),ue);if(se.$$typeof===R)return ke(oe,Pc(oe,se),ue);qc(oe,se)}return null}function de(oe,se,ue,we){var rt=se!==null?se.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return rt!==null?null:B(oe,se,""+ue,we);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:return ue.key===rt?te(oe,se,ue,we):null;case w:return ue.key===rt?he(oe,se,ue,we):null;case J:return ue=Qs(ue),de(oe,se,ue,we)}if(H(ue)||M(ue))return rt!==null?null:ye(oe,se,ue,we,null);if(typeof ue.then=="function")return de(oe,se,Fc(ue),we);if(ue.$$typeof===R)return de(oe,se,Pc(oe,ue),we);qc(oe,ue)}return null}function me(oe,se,ue,we,rt){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return oe=oe.get(ue)||null,B(se,oe,""+we,rt);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case b:return oe=oe.get(we.key===null?ue:we.key)||null,te(se,oe,we,rt);case w:return oe=oe.get(we.key===null?ue:we.key)||null,he(se,oe,we,rt);case J:return we=Qs(we),me(oe,se,ue,we,rt)}if(H(we)||M(we))return oe=oe.get(ue)||null,ye(se,oe,we,rt,null);if(typeof we.then=="function")return me(oe,se,ue,Fc(we),rt);if(we.$$typeof===R)return me(oe,se,ue,Pc(se,we),rt);qc(se,we)}return null}function Ve(oe,se,ue,we){for(var rt=null,Dt=null,tt=se,yt=se=0,At=null;tt!==null&&yt<ue.length;yt++){tt.index>yt?(At=tt,tt=null):At=tt.sibling;var Lt=de(oe,tt,ue[yt],we);if(Lt===null){tt===null&&(tt=At);break}i&&tt&&Lt.alternate===null&&s(oe,tt),se=v(Lt,se,yt),Dt===null?rt=Lt:Dt.sibling=Lt,Dt=Lt,tt=At}if(yt===ue.length)return l(oe,tt),Rt&&Lr(oe,yt),rt;if(tt===null){for(;yt<ue.length;yt++)tt=ke(oe,ue[yt],we),tt!==null&&(se=v(tt,se,yt),Dt===null?rt=tt:Dt.sibling=tt,Dt=tt);return Rt&&Lr(oe,yt),rt}for(tt=u(tt);yt<ue.length;yt++)At=me(tt,oe,yt,ue[yt],we),At!==null&&(i&&At.alternate!==null&&tt.delete(At.key===null?yt:At.key),se=v(At,se,yt),Dt===null?rt=At:Dt.sibling=At,Dt=At);return i&&tt.forEach(function(Ts){return s(oe,Ts)}),Rt&&Lr(oe,yt),rt}function ct(oe,se,ue,we){if(ue==null)throw Error(r(151));for(var rt=null,Dt=null,tt=se,yt=se=0,At=null,Lt=ue.next();tt!==null&&!Lt.done;yt++,Lt=ue.next()){tt.index>yt?(At=tt,tt=null):At=tt.sibling;var Ts=de(oe,tt,Lt.value,we);if(Ts===null){tt===null&&(tt=At);break}i&&tt&&Ts.alternate===null&&s(oe,tt),se=v(Ts,se,yt),Dt===null?rt=Ts:Dt.sibling=Ts,Dt=Ts,tt=At}if(Lt.done)return l(oe,tt),Rt&&Lr(oe,yt),rt;if(tt===null){for(;!Lt.done;yt++,Lt=ue.next())Lt=ke(oe,Lt.value,we),Lt!==null&&(se=v(Lt,se,yt),Dt===null?rt=Lt:Dt.sibling=Lt,Dt=Lt);return Rt&&Lr(oe,yt),rt}for(tt=u(tt);!Lt.done;yt++,Lt=ue.next())Lt=me(tt,oe,yt,Lt.value,we),Lt!==null&&(i&&Lt.alternate!==null&&tt.delete(Lt.key===null?yt:Lt.key),se=v(Lt,se,yt),Dt===null?rt=Lt:Dt.sibling=Lt,Dt=Lt);return i&&tt.forEach(function(n2){return s(oe,n2)}),Rt&&Lr(oe,yt),rt}function qt(oe,se,ue,we){if(typeof ue=="object"&&ue!==null&&ue.type===S&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:e:{for(var rt=ue.key;se!==null;){if(se.key===rt){if(rt=ue.type,rt===S){if(se.tag===7){l(oe,se.sibling),we=g(se,ue.props.children),we.return=oe,oe=we;break e}}else if(se.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===J&&Qs(rt)===se.type){l(oe,se.sibling),we=g(se,ue.props),Yo(we,ue),we.return=oe,oe=we;break e}l(oe,se);break}else s(oe,se);se=se.sibling}ue.type===S?(we=Ys(ue.props.children,oe.mode,we,ue.key),we.return=oe,oe=we):(we=Bc(ue.type,ue.key,ue.props,null,oe.mode,we),Yo(we,ue),we.return=oe,oe=we)}return T(oe);case w:e:{for(rt=ue.key;se!==null;){if(se.key===rt)if(se.tag===4&&se.stateNode.containerInfo===ue.containerInfo&&se.stateNode.implementation===ue.implementation){l(oe,se.sibling),we=g(se,ue.children||[]),we.return=oe,oe=we;break e}else{l(oe,se);break}else s(oe,se);se=se.sibling}we=fd(ue,oe.mode,we),we.return=oe,oe=we}return T(oe);case J:return ue=Qs(ue),qt(oe,se,ue,we)}if(H(ue))return Ve(oe,se,ue,we);if(M(ue)){if(rt=M(ue),typeof rt!="function")throw Error(r(150));return ue=rt.call(ue),ct(oe,se,ue,we)}if(typeof ue.then=="function")return qt(oe,se,Fc(ue),we);if(ue.$$typeof===R)return qt(oe,se,Pc(oe,ue),we);qc(oe,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,se!==null&&se.tag===6?(l(oe,se.sibling),we=g(se,ue),we.return=oe,oe=we):(l(oe,se),we=dd(ue,oe.mode,we),we.return=oe,oe=we),T(oe)):l(oe,se)}return function(oe,se,ue,we){try{Go=0;var rt=qt(oe,se,ue,we);return $a=null,rt}catch(tt){if(tt===Ha||tt===Hc)throw tt;var Dt=Ai(29,tt,null,oe.mode);return Dt.lanes=we,Dt.return=oe,Dt}finally{}}}var ta=W_(!0),K_=W_(!1),us=!1;function Ed(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cd(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function hs(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ds(i,s,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(zt&2)!==0){var g=u.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),u.pending=s,s=zc(i),A_(i,null,l),s}return Lc(i,u,s,l),zc(i)}function Vo(i,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194048)!==0)){var u=s.lanes;u&=i.pendingLanes,l|=u,s.lanes=l,ot(i,l)}}function Td(i,s){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var g=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var T={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?g=v=T:v=v.next=T,l=l.next}while(l!==null);v===null?g=v=s:v=v.next=s}else g=v=s;l={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=s:i.next=s,l.lastBaseUpdate=s}var Md=!1;function Xo(){if(Md){var i=Ua;if(i!==null)throw i}}function Zo(i,s,l,u){Md=!1;var g=i.updateQueue;us=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,B=g.shared.pending;if(B!==null){g.shared.pending=null;var te=B,he=te.next;te.next=null,T===null?v=he:T.next=he,T=te;var ye=i.alternate;ye!==null&&(ye=ye.updateQueue,B=ye.lastBaseUpdate,B!==T&&(B===null?ye.firstBaseUpdate=he:B.next=he,ye.lastBaseUpdate=te))}if(v!==null){var ke=g.baseState;T=0,ye=he=te=null,B=v;do{var de=B.lane&-536870913,me=de!==B.lane;if(me?(Mt&de)===de:(u&de)===de){de!==0&&de===Pa&&(Md=!0),ye!==null&&(ye=ye.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var Ve=i,ct=B;de=s;var qt=l;switch(ct.tag){case 1:if(Ve=ct.payload,typeof Ve=="function"){ke=Ve.call(qt,ke,de);break e}ke=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=ct.payload,de=typeof Ve=="function"?Ve.call(qt,ke,de):Ve,de==null)break e;ke=_({},ke,de);break e;case 2:us=!0}}de=B.callback,de!==null&&(i.flags|=64,me&&(i.flags|=8192),me=g.callbacks,me===null?g.callbacks=[de]:me.push(de))}else me={lane:de,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ye===null?(he=ye=me,te=ke):ye=ye.next=me,T|=de;if(B=B.next,B===null){if(B=g.shared.pending,B===null)break;me=B,B=me.next,me.next=null,g.lastBaseUpdate=me,g.shared.pending=null}}while(!0);ye===null&&(te=ke),g.baseState=te,g.firstBaseUpdate=he,g.lastBaseUpdate=ye,v===null&&(g.shared.lanes=0),_s|=T,i.lanes=T,i.memoizedState=ke}}function G_(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Y_(i,s){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)G_(l[i],s)}var Fa=W(null),Wc=W(0);function V_(i,s){i=Wr,E(Wc,i),E(Fa,s),Wr=i|s.baseLanes}function Ad(){E(Wc,Wr),E(Fa,Fa.current)}function Rd(){Wr=Wc.current,I(Fa),I(Wc)}var Ri=W(null),Gi=null;function fs(i){var s=i.alternate;E(mn,mn.current&1),E(Ri,i),Gi===null&&(s===null||Fa.current!==null||s.memoizedState!==null)&&(Gi=i)}function Nd(i){E(mn,mn.current),E(Ri,i),Gi===null&&(Gi=i)}function X_(i){i.tag===22?(E(mn,mn.current),E(Ri,i),Gi===null&&(Gi=i)):ps()}function ps(){E(mn,mn.current),E(Ri,Ri.current)}function Ni(i){I(Ri),Gi===i&&(Gi=null),I(mn)}var mn=W(0);function Kc(i){for(var s=i;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||If(l)||Pf(l)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var jr=0,vt=null,$t=null,Sn=null,Gc=!1,qa=!1,na=!1,Yc=0,Jo=0,Wa=null,KE=0;function hn(){throw Error(r(321))}function Od(i,s){if(s===null)return!1;for(var l=0;l<s.length&&l<i.length;l++)if(!Mi(i[l],s[l]))return!1;return!0}function Dd(i,s,l,u,g,v){return jr=v,vt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,N.H=i===null||i.memoizedState===null?Dv:Yd,na=!1,v=l(u,g),na=!1,qa&&(v=J_(s,l,u,g)),Z_(i),v}function Z_(i){N.H=tl;var s=$t!==null&&$t.next!==null;if(jr=0,Sn=$t=vt=null,Gc=!1,Jo=0,Wa=null,s)throw Error(r(300));i===null||wn||(i=i.dependencies,i!==null&&Ic(i)&&(wn=!0))}function J_(i,s,l,u){vt=i;var g=0;do{if(qa&&(Wa=null),Jo=0,qa=!1,25<=g)throw Error(r(301));if(g+=1,Sn=$t=null,i.updateQueue!=null){var v=i.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}N.H=Lv,v=s(l,u)}while(qa);return v}function GE(){var i=N.H,s=i.useState()[0];return s=typeof s.then=="function"?Qo(s):s,i=i.useState()[0],($t!==null?$t.memoizedState:null)!==i&&(vt.flags|=1024),s}function Ld(){var i=Yc!==0;return Yc=0,i}function zd(i,s,l){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~l}function Bd(i){if(Gc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Gc=!1}jr=0,Sn=$t=vt=null,qa=!1,Jo=Yc=0,Wa=null}function si(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?vt.memoizedState=Sn=i:Sn=Sn.next=i,Sn}function _n(){if($t===null){var i=vt.alternate;i=i!==null?i.memoizedState:null}else i=$t.next;var s=Sn===null?vt.memoizedState:Sn.next;if(s!==null)Sn=s,$t=i;else{if(i===null)throw vt.alternate===null?Error(r(467)):Error(r(310));$t=i,i={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Sn===null?vt.memoizedState=Sn=i:Sn=Sn.next=i}return Sn}function Vc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qo(i){var s=Jo;return Jo+=1,Wa===null&&(Wa=[]),i=$_(Wa,i,s),s=vt,(Sn===null?s.memoizedState:Sn.next)===null&&(s=s.alternate,N.H=s===null||s.memoizedState===null?Dv:Yd),i}function Xc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Qo(i);if(i.$$typeof===R)return $n(i)}throw Error(r(438,String(i)))}function jd(i){var s=null,l=vt.updateQueue;if(l!==null&&(s=l.memoCache),s==null){var u=vt.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),l===null&&(l=Vc(),vt.updateQueue=l),l.memoCache=s,l=s.data[s.index],l===void 0)for(l=s.data[s.index]=Array(i),u=0;u<i;u++)l[u]=D;return s.index++,l}function Ir(i,s){return typeof s=="function"?s(i):s}function Zc(i){var s=_n();return Id(s,$t,i)}function Id(i,s,l){var u=i.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=l;var g=i.baseQueue,v=u.pending;if(v!==null){if(g!==null){var T=g.next;g.next=v.next,v.next=T}s.baseQueue=g=v,u.pending=null}if(v=i.baseState,g===null)i.memoizedState=v;else{s=g.next;var B=T=null,te=null,he=s,ye=!1;do{var ke=he.lane&-536870913;if(ke!==he.lane?(Mt&ke)===ke:(jr&ke)===ke){var de=he.revertLane;if(de===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),ke===Pa&&(ye=!0);else if((jr&de)===de){he=he.next,de===Pa&&(ye=!0);continue}else ke={lane:0,revertLane:he.revertLane,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},te===null?(B=te=ke,T=v):te=te.next=ke,vt.lanes|=de,_s|=de;ke=he.action,na&&l(v,ke),v=he.hasEagerState?he.eagerState:l(v,ke)}else de={lane:ke,revertLane:he.revertLane,gesture:he.gesture,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},te===null?(B=te=de,T=v):te=te.next=de,vt.lanes|=ke,_s|=ke;he=he.next}while(he!==null&&he!==s);if(te===null?T=v:te.next=B,!Mi(v,i.memoizedState)&&(wn=!0,ye&&(l=Ua,l!==null)))throw l;i.memoizedState=v,i.baseState=T,i.baseQueue=te,u.lastRenderedState=v}return g===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Pd(i){var s=_n(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var u=l.dispatch,g=l.pending,v=s.memoizedState;if(g!==null){l.pending=null;var T=g=g.next;do v=i(v,T.action),T=T.next;while(T!==g);Mi(v,s.memoizedState)||(wn=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),l.lastRenderedState=v}return[v,u]}function Q_(i,s,l){var u=vt,g=_n(),v=Rt;if(v){if(l===void 0)throw Error(r(407));l=l()}else l=s();var T=!Mi(($t||g).memoizedState,l);if(T&&(g.memoizedState=l,wn=!0),g=g.queue,$d(nv.bind(null,u,g,i),[i]),g.getSnapshot!==s||T||Sn!==null&&Sn.memoizedState.tag&1){if(u.flags|=2048,Ka(9,{destroy:void 0},tv.bind(null,u,g,l,s),null),Yt===null)throw Error(r(349));v||(jr&127)!==0||ev(u,s,l)}return l}function ev(i,s,l){i.flags|=16384,i={getSnapshot:s,value:l},s=vt.updateQueue,s===null?(s=Vc(),vt.updateQueue=s,s.stores=[i]):(l=s.stores,l===null?s.stores=[i]:l.push(i))}function tv(i,s,l,u){s.value=l,s.getSnapshot=u,iv(s)&&rv(i)}function nv(i,s,l){return l(function(){iv(s)&&rv(i)})}function iv(i){var s=i.getSnapshot;i=i.value;try{var l=s();return!Mi(i,l)}catch{return!0}}function rv(i){var s=Gs(i,2);s!==null&&xi(s,i,2)}function Ud(i){var s=si();if(typeof i=="function"){var l=i;if(i=l(),na){We(!0);try{l()}finally{We(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:i},s}function sv(i,s,l,u){return i.baseState=l,Id(i,$t,typeof u=="function"?u:Ir)}function YE(i,s,l,u,g){if(eu(i))throw Error(r(485));if(i=s.action,i!==null){var v={payload:g,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){v.listeners.push(T)}};N.T!==null?l(!0):v.isTransition=!1,u(v),l=s.pending,l===null?(v.next=s.pending=v,av(s,v)):(v.next=l.next,s.pending=l.next=v)}}function av(i,s){var l=s.action,u=s.payload,g=i.state;if(s.isTransition){var v=N.T,T={};N.T=T;try{var B=l(g,u),te=N.S;te!==null&&te(T,B),ov(i,s,B)}catch(he){Hd(i,s,he)}finally{v!==null&&T.types!==null&&(v.types=T.types),N.T=v}}else try{v=l(g,u),ov(i,s,v)}catch(he){Hd(i,s,he)}}function ov(i,s,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){lv(i,s,u)},function(u){return Hd(i,s,u)}):lv(i,s,l)}function lv(i,s,l){s.status="fulfilled",s.value=l,cv(s),i.state=l,s=i.pending,s!==null&&(l=s.next,l===s?i.pending=null:(l=l.next,s.next=l,av(i,l)))}function Hd(i,s,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=l,cv(s),s=s.next;while(s!==u)}i.action=null}function cv(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function uv(i,s){return s}function hv(i,s){if(Rt){var l=Yt.formState;if(l!==null){e:{var u=vt;if(Rt){if(Qt){t:{for(var g=Qt,v=Ki;g.nodeType!==8;){if(!v){g=null;break t}if(g=Yi(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Qt=Yi(g.nextSibling),u=g.data==="F!";break e}}ls(u)}u=!1}u&&(s=l[0])}}return l=si(),l.memoizedState=l.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uv,lastRenderedState:s},l.queue=u,l=Rv.bind(null,vt,u),u.dispatch=l,u=Ud(!1),v=Gd.bind(null,vt,!1,u.queue),u=si(),g={state:s,dispatch:null,action:i,pending:null},u.queue=g,l=YE.bind(null,vt,g,v,l),g.dispatch=l,u.memoizedState=i,[s,l,!1]}function dv(i){var s=_n();return fv(s,$t,i)}function fv(i,s,l){if(s=Id(i,s,uv)[0],i=Zc(Ir)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=Qo(s)}catch(T){throw T===Ha?Hc:T}else u=s;s=_n();var g=s.queue,v=g.dispatch;return l!==s.memoizedState&&(vt.flags|=2048,Ka(9,{destroy:void 0},VE.bind(null,g,l),null)),[u,v,i]}function VE(i,s){i.action=s}function pv(i){var s=_n(),l=$t;if(l!==null)return fv(s,l,i);_n(),s=s.memoizedState,l=_n();var u=l.queue.dispatch;return l.memoizedState=i,[s,u,!1]}function Ka(i,s,l,u){return i={tag:i,create:l,deps:u,inst:s,next:null},s=vt.updateQueue,s===null&&(s=Vc(),vt.updateQueue=s),l=s.lastEffect,l===null?s.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,s.lastEffect=i),i}function gv(){return _n().memoizedState}function Jc(i,s,l,u){var g=si();vt.flags|=i,g.memoizedState=Ka(1|s,{destroy:void 0},l,u===void 0?null:u)}function Qc(i,s,l,u){var g=_n();u=u===void 0?null:u;var v=g.memoizedState.inst;$t!==null&&u!==null&&Od(u,$t.memoizedState.deps)?g.memoizedState=Ka(s,v,l,u):(vt.flags|=i,g.memoizedState=Ka(1|s,v,l,u))}function mv(i,s){Jc(8390656,8,i,s)}function $d(i,s){Qc(2048,8,i,s)}function XE(i){vt.flags|=4;var s=vt.updateQueue;if(s===null)s=Vc(),vt.updateQueue=s,s.events=[i];else{var l=s.events;l===null?s.events=[i]:l.push(i)}}function _v(i){var s=_n().memoizedState;return XE({ref:s,nextImpl:i}),function(){if((zt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function vv(i,s){return Qc(4,2,i,s)}function yv(i,s){return Qc(4,4,i,s)}function bv(i,s){if(typeof s=="function"){i=i();var l=s(i);return function(){typeof l=="function"?l():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function xv(i,s,l){l=l!=null?l.concat([i]):null,Qc(4,4,bv.bind(null,s,i),l)}function Fd(){}function Sv(i,s){var l=_n();s=s===void 0?null:s;var u=l.memoizedState;return s!==null&&Od(s,u[1])?u[0]:(l.memoizedState=[i,s],i)}function wv(i,s){var l=_n();s=s===void 0?null:s;var u=l.memoizedState;if(s!==null&&Od(s,u[1]))return u[0];if(u=i(),na){We(!0);try{i()}finally{We(!1)}}return l.memoizedState=[u,s],u}function qd(i,s,l){return l===void 0||(jr&1073741824)!==0&&(Mt&261930)===0?i.memoizedState=s:(i.memoizedState=l,i=ky(),vt.lanes|=i,_s|=i,l)}function kv(i,s,l,u){return Mi(l,s)?l:Fa.current!==null?(i=qd(i,l,u),Mi(i,s)||(wn=!0),i):(jr&42)===0||(jr&1073741824)!==0&&(Mt&261930)===0?(wn=!0,i.memoizedState=l):(i=ky(),vt.lanes|=i,_s|=i,s)}function Ev(i,s,l,u,g){var v=$.p;$.p=v!==0&&8>v?v:8;var T=N.T,B={};N.T=B,Gd(i,!1,s,l);try{var te=g(),he=N.S;if(he!==null&&he(B,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var ye=WE(te,u);el(i,s,ye,Li(i))}else el(i,s,u,Li(i))}catch(ke){el(i,s,{then:function(){},status:"rejected",reason:ke},Li())}finally{$.p=v,T!==null&&B.types!==null&&(T.types=B.types),N.T=T}}function ZE(){}function Wd(i,s,l,u){if(i.tag!==5)throw Error(r(476));var g=Cv(i).queue;Ev(i,g,s,K,l===null?ZE:function(){return Tv(i),l(u)})}function Cv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:K},next:null};var l={};return s.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:l},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Tv(i){var s=Cv(i);s.next===null&&(s=i.alternate.memoizedState),el(i,s.next.queue,{},Li())}function Kd(){return $n(_l)}function Mv(){return _n().memoizedState}function Av(){return _n().memoizedState}function JE(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var l=Li();i=hs(l);var u=ds(s,i,l);u!==null&&(xi(u,s,l),Vo(u,s,l)),s={cache:xd()},i.payload=s;return}s=s.return}}function QE(i,s,l){var u=Li();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},eu(i)?Nv(s,l):(l=ud(i,s,l,u),l!==null&&(xi(l,i,u),Ov(l,s,u)))}function Rv(i,s,l){var u=Li();el(i,s,l,u)}function el(i,s,l,u){var g={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(eu(i))Nv(s,g);else{var v=i.alternate;if(i.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var T=s.lastRenderedState,B=v(T,l);if(g.hasEagerState=!0,g.eagerState=B,Mi(B,T))return Lc(i,s,g,0),Yt===null&&Dc(),!1}catch{}finally{}if(l=ud(i,s,g,u),l!==null)return xi(l,i,u),Ov(l,s,u),!0}return!1}function Gd(i,s,l,u){if(u={lane:2,revertLane:Cf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},eu(i)){if(s)throw Error(r(479))}else s=ud(i,l,u,2),s!==null&&xi(s,i,2)}function eu(i){var s=i.alternate;return i===vt||s!==null&&s===vt}function Nv(i,s){qa=Gc=!0;var l=i.pending;l===null?s.next=s:(s.next=l.next,l.next=s),i.pending=s}function Ov(i,s,l){if((l&4194048)!==0){var u=s.lanes;u&=i.pendingLanes,l|=u,s.lanes=l,ot(i,l)}}var tl={readContext:$n,use:Xc,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useLayoutEffect:hn,useInsertionEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useSyncExternalStore:hn,useId:hn,useHostTransitionStatus:hn,useFormState:hn,useActionState:hn,useOptimistic:hn,useMemoCache:hn,useCacheRefresh:hn};tl.useEffectEvent=hn;var Dv={readContext:$n,use:Xc,useCallback:function(i,s){return si().memoizedState=[i,s===void 0?null:s],i},useContext:$n,useEffect:mv,useImperativeHandle:function(i,s,l){l=l!=null?l.concat([i]):null,Jc(4194308,4,bv.bind(null,s,i),l)},useLayoutEffect:function(i,s){return Jc(4194308,4,i,s)},useInsertionEffect:function(i,s){Jc(4,2,i,s)},useMemo:function(i,s){var l=si();s=s===void 0?null:s;var u=i();if(na){We(!0);try{i()}finally{We(!1)}}return l.memoizedState=[u,s],u},useReducer:function(i,s,l){var u=si();if(l!==void 0){var g=l(s);if(na){We(!0);try{l(s)}finally{We(!1)}}}else g=s;return u.memoizedState=u.baseState=g,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:g},u.queue=i,i=i.dispatch=QE.bind(null,vt,i),[u.memoizedState,i]},useRef:function(i){var s=si();return i={current:i},s.memoizedState=i},useState:function(i){i=Ud(i);var s=i.queue,l=Rv.bind(null,vt,s);return s.dispatch=l,[i.memoizedState,l]},useDebugValue:Fd,useDeferredValue:function(i,s){var l=si();return qd(l,i,s)},useTransition:function(){var i=Ud(!1);return i=Ev.bind(null,vt,i.queue,!0,!1),si().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,l){var u=vt,g=si();if(Rt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),Yt===null)throw Error(r(349));(Mt&127)!==0||ev(u,s,l)}g.memoizedState=l;var v={value:l,getSnapshot:s};return g.queue=v,mv(nv.bind(null,u,v,i),[i]),u.flags|=2048,Ka(9,{destroy:void 0},tv.bind(null,u,v,l,s),null),l},useId:function(){var i=si(),s=Yt.identifierPrefix;if(Rt){var l=gr,u=pr;l=(u&~(1<<32-$e(u)-1)).toString(32)+l,s="_"+s+"R_"+l,l=Yc++,0<l&&(s+="H"+l.toString(32)),s+="_"}else l=KE++,s="_"+s+"r_"+l.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Kd,useFormState:hv,useActionState:hv,useOptimistic:function(i){var s=si();s.memoizedState=s.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=l,s=Gd.bind(null,vt,!0,l),l.dispatch=s,[i,s]},useMemoCache:jd,useCacheRefresh:function(){return si().memoizedState=JE.bind(null,vt)},useEffectEvent:function(i){var s=si(),l={impl:i};return s.memoizedState=l,function(){if((zt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},Yd={readContext:$n,use:Xc,useCallback:Sv,useContext:$n,useEffect:$d,useImperativeHandle:xv,useInsertionEffect:vv,useLayoutEffect:yv,useMemo:wv,useReducer:Zc,useRef:gv,useState:function(){return Zc(Ir)},useDebugValue:Fd,useDeferredValue:function(i,s){var l=_n();return kv(l,$t.memoizedState,i,s)},useTransition:function(){var i=Zc(Ir)[0],s=_n().memoizedState;return[typeof i=="boolean"?i:Qo(i),s]},useSyncExternalStore:Q_,useId:Mv,useHostTransitionStatus:Kd,useFormState:dv,useActionState:dv,useOptimistic:function(i,s){var l=_n();return sv(l,$t,i,s)},useMemoCache:jd,useCacheRefresh:Av};Yd.useEffectEvent=_v;var Lv={readContext:$n,use:Xc,useCallback:Sv,useContext:$n,useEffect:$d,useImperativeHandle:xv,useInsertionEffect:vv,useLayoutEffect:yv,useMemo:wv,useReducer:Pd,useRef:gv,useState:function(){return Pd(Ir)},useDebugValue:Fd,useDeferredValue:function(i,s){var l=_n();return $t===null?qd(l,i,s):kv(l,$t.memoizedState,i,s)},useTransition:function(){var i=Pd(Ir)[0],s=_n().memoizedState;return[typeof i=="boolean"?i:Qo(i),s]},useSyncExternalStore:Q_,useId:Mv,useHostTransitionStatus:Kd,useFormState:pv,useActionState:pv,useOptimistic:function(i,s){var l=_n();return $t!==null?sv(l,$t,i,s):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:jd,useCacheRefresh:Av};Lv.useEffectEvent=_v;function Vd(i,s,l,u){s=i.memoizedState,l=l(u,s),l=l==null?s:_({},s,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var Xd={enqueueSetState:function(i,s,l){i=i._reactInternals;var u=Li(),g=hs(u);g.payload=s,l!=null&&(g.callback=l),s=ds(i,g,u),s!==null&&(xi(s,i,u),Vo(s,i,u))},enqueueReplaceState:function(i,s,l){i=i._reactInternals;var u=Li(),g=hs(u);g.tag=1,g.payload=s,l!=null&&(g.callback=l),s=ds(i,g,u),s!==null&&(xi(s,i,u),Vo(s,i,u))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var l=Li(),u=hs(l);u.tag=2,s!=null&&(u.callback=s),s=ds(i,u,l),s!==null&&(xi(s,i,l),Vo(s,i,l))}};function zv(i,s,l,u,g,v,T){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,v,T):s.prototype&&s.prototype.isPureReactComponent?!Ho(l,u)||!Ho(g,v):!0}function Bv(i,s,l,u){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,u),s.state!==i&&Xd.enqueueReplaceState(s,s.state,null)}function ia(i,s){var l=s;if("ref"in s){l={};for(var u in s)u!=="ref"&&(l[u]=s[u])}if(i=i.defaultProps){l===s&&(l=_({},l));for(var g in i)l[g]===void 0&&(l[g]=i[g])}return l}function jv(i){Oc(i)}function Iv(i){console.error(i)}function Pv(i){Oc(i)}function tu(i,s){try{var l=i.onUncaughtError;l(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function Uv(i,s,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Zd(i,s,l){return l=hs(l),l.tag=3,l.payload={element:null},l.callback=function(){tu(i,s)},l}function Hv(i){return i=hs(i),i.tag=3,i}function $v(i,s,l,u){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var v=u.value;i.payload=function(){return g(v)},i.callback=function(){Uv(s,l,u)}}var T=l.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(i.callback=function(){Uv(s,l,u),typeof g!="function"&&(vs===null?vs=new Set([this]):vs.add(this));var B=u.stack;this.componentDidCatch(u.value,{componentStack:B!==null?B:""})})}function eC(i,s,l,u,g){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=l.alternate,s!==null&&Ia(s,l,g,!0),l=Ri.current,l!==null){switch(l.tag){case 31:case 13:return Gi===null?fu():l.alternate===null&&dn===0&&(dn=3),l.flags&=-257,l.flags|=65536,l.lanes=g,u===$c?l.flags|=16384:(s=l.updateQueue,s===null?l.updateQueue=new Set([u]):s.add(u),wf(i,u,g)),!1;case 22:return l.flags|=65536,u===$c?l.flags|=16384:(s=l.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=s):(l=s.retryQueue,l===null?s.retryQueue=new Set([u]):l.add(u)),wf(i,u,g)),!1}throw Error(r(435,l.tag))}return wf(i,u,g),fu(),!1}if(Rt)return s=Ri.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,u!==md&&(i=Error(r(422),{cause:u}),qo(Fi(i,l)))):(u!==md&&(s=Error(r(423),{cause:u}),qo(Fi(s,l))),i=i.current.alternate,i.flags|=65536,g&=-g,i.lanes|=g,u=Fi(u,l),g=Zd(i.stateNode,u,g),Td(i,g),dn!==4&&(dn=2)),!1;var v=Error(r(520),{cause:u});if(v=Fi(v,l),cl===null?cl=[v]:cl.push(v),dn!==4&&(dn=2),s===null)return!0;u=Fi(u,l),l=s;do{switch(l.tag){case 3:return l.flags|=65536,i=g&-g,l.lanes|=i,i=Zd(l.stateNode,u,i),Td(l,i),!1;case 1:if(s=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(vs===null||!vs.has(v))))return l.flags|=65536,g&=-g,l.lanes|=g,g=Hv(g),$v(g,i,l,u),Td(l,g),!1}l=l.return}while(l!==null);return!1}var Jd=Error(r(461)),wn=!1;function Fn(i,s,l,u){s.child=i===null?K_(s,null,l,u):ta(s,i.child,l,u)}function Fv(i,s,l,u,g){l=l.render;var v=s.ref;if("ref"in u){var T={};for(var B in u)B!=="ref"&&(T[B]=u[B])}else T=u;return Zs(s),u=Dd(i,s,l,T,v,g),B=Ld(),i!==null&&!wn?(zd(i,s,g),Pr(i,s,g)):(Rt&&B&&pd(s),s.flags|=1,Fn(i,s,u,g),s.child)}function qv(i,s,l,u,g){if(i===null){var v=l.type;return typeof v=="function"&&!hd(v)&&v.defaultProps===void 0&&l.compare===null?(s.tag=15,s.type=v,Wv(i,s,v,u,g)):(i=Bc(l.type,null,u,s,s.mode,g),i.ref=s.ref,i.return=s,s.child=i)}if(v=i.child,!of(i,g)){var T=v.memoizedProps;if(l=l.compare,l=l!==null?l:Ho,l(T,u)&&i.ref===s.ref)return Pr(i,s,g)}return s.flags|=1,i=Dr(v,u),i.ref=s.ref,i.return=s,s.child=i}function Wv(i,s,l,u,g){if(i!==null){var v=i.memoizedProps;if(Ho(v,u)&&i.ref===s.ref)if(wn=!1,s.pendingProps=u=v,of(i,g))(i.flags&131072)!==0&&(wn=!0);else return s.lanes=i.lanes,Pr(i,s,g)}return Qd(i,s,l,u,g)}function Kv(i,s,l,u){var g=u.children,v=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,i!==null){for(u=s.child=i.child,g=0;u!==null;)g=g|u.lanes|u.childLanes,u=u.sibling;u=g&~v}else u=0,s.child=null;return Gv(i,s,v,l,u)}if((l&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&Uc(s,v!==null?v.cachePool:null),v!==null?V_(s,v):Ad(),X_(s);else return u=s.lanes=536870912,Gv(i,s,v!==null?v.baseLanes|l:l,l,u)}else v!==null?(Uc(s,v.cachePool),V_(s,v),ps(),s.memoizedState=null):(i!==null&&Uc(s,null),Ad(),ps());return Fn(i,s,g,l),s.child}function nl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Gv(i,s,l,u,g){var v=wd();return v=v===null?null:{parent:xn._currentValue,pool:v},s.memoizedState={baseLanes:l,cachePool:v},i!==null&&Uc(s,null),Ad(),X_(s),i!==null&&Ia(i,s,u,!0),s.childLanes=g,null}function nu(i,s){return s=ru({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Yv(i,s,l){return ta(s,i.child,null,l),i=nu(s,s.pendingProps),i.flags|=2,Ni(s),s.memoizedState=null,i}function tC(i,s,l){var u=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Rt){if(u.mode==="hidden")return i=nu(s,u),s.lanes=536870912,nl(null,i);if(Nd(s),(i=Qt)?(i=ab(i,Ki),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:as!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},l=N_(i),l.return=s,s.child=l,Hn=s,Qt=null)):i=null,i===null)throw ls(s);return s.lanes=536870912,null}return nu(s,u)}var v=i.memoizedState;if(v!==null){var T=v.dehydrated;if(Nd(s),g)if(s.flags&256)s.flags&=-257,s=Yv(i,s,l);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(wn||Ia(i,s,l,!1),g=(l&i.childLanes)!==0,wn||g){if(u=Yt,u!==null&&(T=Gt(u,l),T!==0&&T!==v.retryLane))throw v.retryLane=T,Gs(i,T),xi(u,i,T),Jd;fu(),s=Yv(i,s,l)}else i=v.treeContext,Qt=Yi(T.nextSibling),Hn=s,Rt=!0,os=null,Ki=!1,i!==null&&L_(s,i),s=nu(s,u),s.flags|=4096;return s}return i=Dr(i.child,{mode:u.mode,children:u.children}),i.ref=s.ref,s.child=i,i.return=s,i}function iu(i,s){var l=s.ref;if(l===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(i===null||i.ref!==l)&&(s.flags|=4194816)}}function Qd(i,s,l,u,g){return Zs(s),l=Dd(i,s,l,u,void 0,g),u=Ld(),i!==null&&!wn?(zd(i,s,g),Pr(i,s,g)):(Rt&&u&&pd(s),s.flags|=1,Fn(i,s,l,g),s.child)}function Vv(i,s,l,u,g,v){return Zs(s),s.updateQueue=null,l=J_(s,u,l,g),Z_(i),u=Ld(),i!==null&&!wn?(zd(i,s,v),Pr(i,s,v)):(Rt&&u&&pd(s),s.flags|=1,Fn(i,s,l,v),s.child)}function Xv(i,s,l,u,g){if(Zs(s),s.stateNode===null){var v=La,T=l.contextType;typeof T=="object"&&T!==null&&(v=$n(T)),v=new l(u,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Xd,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=u,v.state=s.memoizedState,v.refs={},Ed(s),T=l.contextType,v.context=typeof T=="object"&&T!==null?$n(T):La,v.state=s.memoizedState,T=l.getDerivedStateFromProps,typeof T=="function"&&(Vd(s,l,T,u),v.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(T=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),T!==v.state&&Xd.enqueueReplaceState(v,v.state,null),Zo(s,u,v,g),Xo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(i===null){v=s.stateNode;var B=s.memoizedProps,te=ia(l,B);v.props=te;var he=v.context,ye=l.contextType;T=La,typeof ye=="object"&&ye!==null&&(T=$n(ye));var ke=l.getDerivedStateFromProps;ye=typeof ke=="function"||typeof v.getSnapshotBeforeUpdate=="function",B=s.pendingProps!==B,ye||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(B||he!==T)&&Bv(s,v,u,T),us=!1;var de=s.memoizedState;v.state=de,Zo(s,u,v,g),Xo(),he=s.memoizedState,B||de!==he||us?(typeof ke=="function"&&(Vd(s,l,ke,u),he=s.memoizedState),(te=us||zv(s,l,te,u,de,he,T))?(ye||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=he),v.props=u,v.state=he,v.context=T,u=te):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{v=s.stateNode,Cd(i,s),T=s.memoizedProps,ye=ia(l,T),v.props=ye,ke=s.pendingProps,de=v.context,he=l.contextType,te=La,typeof he=="object"&&he!==null&&(te=$n(he)),B=l.getDerivedStateFromProps,(he=typeof B=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T!==ke||de!==te)&&Bv(s,v,u,te),us=!1,de=s.memoizedState,v.state=de,Zo(s,u,v,g),Xo();var me=s.memoizedState;T!==ke||de!==me||us||i!==null&&i.dependencies!==null&&Ic(i.dependencies)?(typeof B=="function"&&(Vd(s,l,B,u),me=s.memoizedState),(ye=us||zv(s,l,ye,u,de,me,te)||i!==null&&i.dependencies!==null&&Ic(i.dependencies))?(he||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,me,te),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,me,te)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||T===i.memoizedProps&&de===i.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&de===i.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=me),v.props=u,v.state=me,v.context=te,u=ye):(typeof v.componentDidUpdate!="function"||T===i.memoizedProps&&de===i.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&de===i.memoizedState||(s.flags|=1024),u=!1)}return v=u,iu(i,s),u=(s.flags&128)!==0,v||u?(v=s.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,i!==null&&u?(s.child=ta(s,i.child,null,g),s.child=ta(s,null,l,g)):Fn(i,s,l,g),s.memoizedState=v.state,i=s.child):i=Pr(i,s,g),i}function Zv(i,s,l,u){return Vs(),s.flags|=256,Fn(i,s,l,u),s.child}var ef={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tf(i){return{baseLanes:i,cachePool:U_()}}function nf(i,s,l){return i=i!==null?i.childLanes&~l:0,s&&(i|=Di),i}function Jv(i,s,l){var u=s.pendingProps,g=!1,v=(s.flags&128)!==0,T;if((T=v)||(T=i!==null&&i.memoizedState===null?!1:(mn.current&2)!==0),T&&(g=!0,s.flags&=-129),T=(s.flags&32)!==0,s.flags&=-33,i===null){if(Rt){if(g?fs(s):ps(),(i=Qt)?(i=ab(i,Ki),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:as!==null?{id:pr,overflow:gr}:null,retryLane:536870912,hydrationErrors:null},l=N_(i),l.return=s,s.child=l,Hn=s,Qt=null)):i=null,i===null)throw ls(s);return Pf(i)?s.lanes=32:s.lanes=536870912,null}var B=u.children;return u=u.fallback,g?(ps(),g=s.mode,B=ru({mode:"hidden",children:B},g),u=Ys(u,g,l,null),B.return=s,u.return=s,B.sibling=u,s.child=B,u=s.child,u.memoizedState=tf(l),u.childLanes=nf(i,T,l),s.memoizedState=ef,nl(null,u)):(fs(s),rf(s,B))}var te=i.memoizedState;if(te!==null&&(B=te.dehydrated,B!==null)){if(v)s.flags&256?(fs(s),s.flags&=-257,s=sf(i,s,l)):s.memoizedState!==null?(ps(),s.child=i.child,s.flags|=128,s=null):(ps(),B=u.fallback,g=s.mode,u=ru({mode:"visible",children:u.children},g),B=Ys(B,g,l,null),B.flags|=2,u.return=s,B.return=s,u.sibling=B,s.child=u,ta(s,i.child,null,l),u=s.child,u.memoizedState=tf(l),u.childLanes=nf(i,T,l),s.memoizedState=ef,s=nl(null,u));else if(fs(s),Pf(B)){if(T=B.nextSibling&&B.nextSibling.dataset,T)var he=T.dgst;T=he,u=Error(r(419)),u.stack="",u.digest=T,qo({value:u,source:null,stack:null}),s=sf(i,s,l)}else if(wn||Ia(i,s,l,!1),T=(l&i.childLanes)!==0,wn||T){if(T=Yt,T!==null&&(u=Gt(T,l),u!==0&&u!==te.retryLane))throw te.retryLane=u,Gs(i,u),xi(T,i,u),Jd;If(B)||fu(),s=sf(i,s,l)}else If(B)?(s.flags|=192,s.child=i.child,s=null):(i=te.treeContext,Qt=Yi(B.nextSibling),Hn=s,Rt=!0,os=null,Ki=!1,i!==null&&L_(s,i),s=rf(s,u.children),s.flags|=4096);return s}return g?(ps(),B=u.fallback,g=s.mode,te=i.child,he=te.sibling,u=Dr(te,{mode:"hidden",children:u.children}),u.subtreeFlags=te.subtreeFlags&65011712,he!==null?B=Dr(he,B):(B=Ys(B,g,l,null),B.flags|=2),B.return=s,u.return=s,u.sibling=B,s.child=u,nl(null,u),u=s.child,B=i.child.memoizedState,B===null?B=tf(l):(g=B.cachePool,g!==null?(te=xn._currentValue,g=g.parent!==te?{parent:te,pool:te}:g):g=U_(),B={baseLanes:B.baseLanes|l,cachePool:g}),u.memoizedState=B,u.childLanes=nf(i,T,l),s.memoizedState=ef,nl(i.child,u)):(fs(s),l=i.child,i=l.sibling,l=Dr(l,{mode:"visible",children:u.children}),l.return=s,l.sibling=null,i!==null&&(T=s.deletions,T===null?(s.deletions=[i],s.flags|=16):T.push(i)),s.child=l,s.memoizedState=null,l)}function rf(i,s){return s=ru({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function ru(i,s){return i=Ai(22,i,null,s),i.lanes=0,i}function sf(i,s,l){return ta(s,i.child,null,l),i=rf(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Qv(i,s,l){i.lanes|=s;var u=i.alternate;u!==null&&(u.lanes|=s),yd(i.return,s,l)}function af(i,s,l,u,g,v){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:g,treeForkCount:v}:(T.isBackwards=s,T.rendering=null,T.renderingStartTime=0,T.last=u,T.tail=l,T.tailMode=g,T.treeForkCount=v)}function ey(i,s,l){var u=s.pendingProps,g=u.revealOrder,v=u.tail;u=u.children;var T=mn.current,B=(T&2)!==0;if(B?(T=T&1|2,s.flags|=128):T&=1,E(mn,T),Fn(i,s,u,l),u=Rt?Fo:0,!B&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Qv(i,l,s);else if(i.tag===19)Qv(i,l,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(g){case"forwards":for(l=s.child,g=null;l!==null;)i=l.alternate,i!==null&&Kc(i)===null&&(g=l),l=l.sibling;l=g,l===null?(g=s.child,s.child=null):(g=l.sibling,l.sibling=null),af(s,!1,g,l,v,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=s.child,s.child=null;g!==null;){if(i=g.alternate,i!==null&&Kc(i)===null){s.child=g;break}i=g.sibling,g.sibling=l,l=g,g=i}af(s,!0,l,null,v,u);break;case"together":af(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function Pr(i,s,l){if(i!==null&&(s.dependencies=i.dependencies),_s|=s.lanes,(l&s.childLanes)===0)if(i!==null){if(Ia(i,s,l,!1),(l&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,l=Dr(i,i.pendingProps),s.child=l,l.return=s;i.sibling!==null;)i=i.sibling,l=l.sibling=Dr(i,i.pendingProps),l.return=s;l.sibling=null}return s.child}function of(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Ic(i)))}function nC(i,s,l){switch(s.tag){case 3:Oe(s,s.stateNode.containerInfo),cs(s,xn,i.memoizedState.cache),Vs();break;case 27:case 5:Fe(s);break;case 4:Oe(s,s.stateNode.containerInfo);break;case 10:cs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Nd(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(fs(s),s.flags|=128,null):(l&s.child.childLanes)!==0?Jv(i,s,l):(fs(s),i=Pr(i,s,l),i!==null?i.sibling:null);fs(s);break;case 19:var g=(i.flags&128)!==0;if(u=(l&s.childLanes)!==0,u||(Ia(i,s,l,!1),u=(l&s.childLanes)!==0),g){if(u)return ey(i,s,l);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),E(mn,mn.current),u)break;return null;case 22:return s.lanes=0,Kv(i,s,l,s.pendingProps);case 24:cs(s,xn,i.memoizedState.cache)}return Pr(i,s,l)}function ty(i,s,l){if(i!==null)if(i.memoizedProps!==s.pendingProps)wn=!0;else{if(!of(i,l)&&(s.flags&128)===0)return wn=!1,nC(i,s,l);wn=(i.flags&131072)!==0}else wn=!1,Rt&&(s.flags&1048576)!==0&&D_(s,Fo,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(i=Qs(s.elementType),s.type=i,typeof i=="function")hd(i)?(u=ia(i,u),s.tag=1,s=Xv(null,s,i,u,l)):(s.tag=0,s=Qd(null,s,i,u,l));else{if(i!=null){var g=i.$$typeof;if(g===L){s.tag=11,s=Fv(null,s,i,u,l);break e}else if(g===z){s.tag=14,s=qv(null,s,i,u,l);break e}}throw s=G(i)||i,Error(r(306,s,""))}}return s;case 0:return Qd(i,s,s.type,s.pendingProps,l);case 1:return u=s.type,g=ia(u,s.pendingProps),Xv(i,s,u,g,l);case 3:e:{if(Oe(s,s.stateNode.containerInfo),i===null)throw Error(r(387));u=s.pendingProps;var v=s.memoizedState;g=v.element,Cd(i,s),Zo(s,u,null,l);var T=s.memoizedState;if(u=T.cache,cs(s,xn,u),u!==v.cache&&bd(s,[xn],l,!0),Xo(),u=T.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:T.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=Zv(i,s,u,l);break e}else if(u!==g){g=Fi(Error(r(424)),s),qo(g),s=Zv(i,s,u,l);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Qt=Yi(i.firstChild),Hn=s,Rt=!0,os=null,Ki=!0,l=K_(s,null,u,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Vs(),u===g){s=Pr(i,s,l);break e}Fn(i,s,u,l)}s=s.child}return s;case 26:return iu(i,s),i===null?(l=db(s.type,null,s.pendingProps,null))?s.memoizedState=l:Rt||(l=s.type,i=s.pendingProps,u=bu(Z.current).createElement(l),u[nn]=s,u[Dn]=i,qn(u,l,i),Qe(u),s.stateNode=u):s.memoizedState=db(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Fe(s),i===null&&Rt&&(u=s.stateNode=cb(s.type,s.pendingProps,Z.current),Hn=s,Ki=!0,g=Qt,Ss(s.type)?(Uf=g,Qt=Yi(u.firstChild)):Qt=g),Fn(i,s,s.pendingProps.children,l),iu(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Rt&&((g=u=Qt)&&(u=OC(u,s.type,s.pendingProps,Ki),u!==null?(s.stateNode=u,Hn=s,Qt=Yi(u.firstChild),Ki=!1,g=!0):g=!1),g||ls(s)),Fe(s),g=s.type,v=s.pendingProps,T=i!==null?i.memoizedProps:null,u=v.children,zf(g,v)?u=null:T!==null&&zf(g,T)&&(s.flags|=32),s.memoizedState!==null&&(g=Dd(i,s,GE,null,null,l),_l._currentValue=g),iu(i,s),Fn(i,s,u,l),s.child;case 6:return i===null&&Rt&&((i=l=Qt)&&(l=DC(l,s.pendingProps,Ki),l!==null?(s.stateNode=l,Hn=s,Qt=null,i=!0):i=!1),i||ls(s)),null;case 13:return Jv(i,s,l);case 4:return Oe(s,s.stateNode.containerInfo),u=s.pendingProps,i===null?s.child=ta(s,null,u,l):Fn(i,s,u,l),s.child;case 11:return Fv(i,s,s.type,s.pendingProps,l);case 7:return Fn(i,s,s.pendingProps,l),s.child;case 8:return Fn(i,s,s.pendingProps.children,l),s.child;case 12:return Fn(i,s,s.pendingProps.children,l),s.child;case 10:return u=s.pendingProps,cs(s,s.type,u.value),Fn(i,s,u.children,l),s.child;case 9:return g=s.type._context,u=s.pendingProps.children,Zs(s),g=$n(g),u=u(g),s.flags|=1,Fn(i,s,u,l),s.child;case 14:return qv(i,s,s.type,s.pendingProps,l);case 15:return Wv(i,s,s.type,s.pendingProps,l);case 19:return ey(i,s,l);case 31:return tC(i,s,l);case 22:return Kv(i,s,l,s.pendingProps);case 24:return Zs(s),u=$n(xn),i===null?(g=wd(),g===null&&(g=Yt,v=xd(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=l),g=v),s.memoizedState={parent:u,cache:g},Ed(s),cs(s,xn,g)):((i.lanes&l)!==0&&(Cd(i,s),Zo(s,null,null,l),Xo()),g=i.memoizedState,v=s.memoizedState,g.parent!==u?(g={parent:u,cache:u},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),cs(s,xn,u)):(u=v.cache,cs(s,xn,u),u!==g.cache&&bd(s,[xn],l,!0))),Fn(i,s,s.pendingProps.children,l),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ur(i){i.flags|=4}function lf(i,s,l,u,g){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(g&335544128)===g)if(i.stateNode.complete)i.flags|=8192;else if(My())i.flags|=8192;else throw ea=$c,kd}else i.flags&=-16777217}function ny(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!_b(s))if(My())i.flags|=8192;else throw ea=$c,kd}function su(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?ut():536870912,i.lanes|=s,Xa|=s)}function il(i,s){if(!Rt)switch(i.tailMode){case"hidden":s=i.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function en(i){var s=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(s)for(var g=i.child;g!==null;)l|=g.lanes|g.childLanes,u|=g.subtreeFlags&65011712,u|=g.flags&65011712,g.return=i,g=g.sibling;else for(g=i.child;g!==null;)l|=g.lanes|g.childLanes,u|=g.subtreeFlags,u|=g.flags,g.return=i,g=g.sibling;return i.subtreeFlags|=u,i.childLanes=l,s}function iC(i,s,l){var u=s.pendingProps;switch(gd(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(s),null;case 1:return en(s),null;case 3:return l=s.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),Br(xn),_e(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(ja(s)?Ur(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,_d())),en(s),null;case 26:var g=s.type,v=s.memoizedState;return i===null?(Ur(s),v!==null?(en(s),ny(s,v)):(en(s),lf(s,g,null,u,l))):v?v!==i.memoizedState?(Ur(s),en(s),ny(s,v)):(en(s),s.flags&=-16777217):(i=i.memoizedProps,i!==u&&Ur(s),en(s),lf(s,g,i,u,l)),null;case 27:if(st(s),l=Z.current,g=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==u&&Ur(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return en(s),null}i=F.current,ja(s)?z_(s):(i=cb(g,u,l),s.stateNode=i,Ur(s))}return en(s),null;case 5:if(st(s),g=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==u&&Ur(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return en(s),null}if(v=F.current,ja(s))z_(s);else{var T=bu(Z.current);switch(v){case 1:v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=T.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?T.createElement("select",{is:u.is}):T.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?T.createElement(g,{is:u.is}):T.createElement(g)}}v[nn]=s,v[Dn]=u;e:for(T=s.child;T!==null;){if(T.tag===5||T.tag===6)v.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===s)break e;for(;T.sibling===null;){if(T.return===null||T.return===s)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}s.stateNode=v;e:switch(qn(v,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Ur(s)}}return en(s),lf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,l),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==u&&Ur(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Z.current,ja(s)){if(i=s.stateNode,l=s.memoizedProps,u=null,g=Hn,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}i[nn]=s,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||Jy(i.nodeValue,l)),i||ls(s,!0)}else i=bu(i).createTextNode(u),i[nn]=s,s.stateNode=i}return en(s),null;case 31:if(l=s.memoizedState,i===null||i.memoizedState!==null){if(u=ja(s),l!==null){if(i===null){if(!u)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[nn]=s}else Vs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;en(s),i=!1}else l=_d(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return s.flags&256?(Ni(s),s):(Ni(s),null);if((s.flags&128)!==0)throw Error(r(558))}return en(s),null;case 13:if(u=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(g=ja(s),u!==null&&u.dehydrated!==null){if(i===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[nn]=s}else Vs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;en(s),g=!1}else g=_d(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(Ni(s),s):(Ni(s),null)}return Ni(s),(s.flags&128)!==0?(s.lanes=l,s):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=s.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==g&&(u.flags|=2048)),l!==i&&l&&(s.child.flags|=8192),su(s,s.updateQueue),en(s),null);case 4:return _e(),i===null&&Rf(s.stateNode.containerInfo),en(s),null;case 10:return Br(s.type),en(s),null;case 19:if(I(mn),u=s.memoizedState,u===null)return en(s),null;if(g=(s.flags&128)!==0,v=u.rendering,v===null)if(g)il(u,!1);else{if(dn!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(v=Kc(i),v!==null){for(s.flags|=128,il(u,!1),i=v.updateQueue,s.updateQueue=i,su(s,i),s.subtreeFlags=0,i=l,l=s.child;l!==null;)R_(l,i),l=l.sibling;return E(mn,mn.current&1|2),Rt&&Lr(s,u.treeForkCount),s.child}i=i.sibling}u.tail!==null&&Te()>uu&&(s.flags|=128,g=!0,il(u,!1),s.lanes=4194304)}else{if(!g)if(i=Kc(v),i!==null){if(s.flags|=128,g=!0,i=i.updateQueue,s.updateQueue=i,su(s,i),il(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!Rt)return en(s),null}else 2*Te()-u.renderingStartTime>uu&&l!==536870912&&(s.flags|=128,g=!0,il(u,!1),s.lanes=4194304);u.isBackwards?(v.sibling=s.child,s.child=v):(i=u.last,i!==null?i.sibling=v:s.child=v,u.last=v)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Te(),i.sibling=null,l=mn.current,E(mn,g?l&1|2:l&1),Rt&&Lr(s,u.treeForkCount),i):(en(s),null);case 22:case 23:return Ni(s),Rd(),u=s.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(l&536870912)!==0&&(s.flags&128)===0&&(en(s),s.subtreeFlags&6&&(s.flags|=8192)):en(s),l=s.updateQueue,l!==null&&su(s,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==l&&(s.flags|=2048),i!==null&&I(Js),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),Br(xn),en(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function rC(i,s){switch(gd(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Br(xn),_e(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return st(s),null;case 31:if(s.memoizedState!==null){if(Ni(s),s.alternate===null)throw Error(r(340));Vs()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(Ni(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Vs()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return I(mn),null;case 4:return _e(),null;case 10:return Br(s.type),null;case 22:case 23:return Ni(s),Rd(),i!==null&&I(Js),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Br(xn),null;case 25:return null;default:return null}}function iy(i,s){switch(gd(s),s.tag){case 3:Br(xn),_e();break;case 26:case 27:case 5:st(s);break;case 4:_e();break;case 31:s.memoizedState!==null&&Ni(s);break;case 13:Ni(s);break;case 19:I(mn);break;case 10:Br(s.type);break;case 22:case 23:Ni(s),Rd(),i!==null&&I(Js);break;case 24:Br(xn)}}function rl(i,s){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var g=u.next;l=g;do{if((l.tag&i)===i){u=void 0;var v=l.create,T=l.inst;u=v(),T.destroy=u}l=l.next}while(l!==g)}}catch(B){Ut(s,s.return,B)}}function gs(i,s,l){try{var u=s.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var v=g.next;u=v;do{if((u.tag&i)===i){var T=u.inst,B=T.destroy;if(B!==void 0){T.destroy=void 0,g=s;var te=l,he=B;try{he()}catch(ye){Ut(g,te,ye)}}}u=u.next}while(u!==v)}}catch(ye){Ut(s,s.return,ye)}}function ry(i){var s=i.updateQueue;if(s!==null){var l=i.stateNode;try{Y_(s,l)}catch(u){Ut(i,i.return,u)}}}function sy(i,s,l){l.props=ia(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){Ut(i,s,u)}}function sl(i,s){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(g){Ut(i,s,g)}}function mr(i,s){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(g){Ut(i,s,g)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){Ut(i,s,g)}else l.current=null}function ay(i){var s=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(g){Ut(i,i.return,g)}}function cf(i,s,l){try{var u=i.stateNode;CC(u,i.type,l,s),u[Dn]=s}catch(g){Ut(i,i.return,g)}}function oy(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ss(i.type)||i.tag===4}function uf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||oy(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ss(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function hf(i,s,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,s?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,s):(s=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,s.appendChild(i),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=Ie));else if(u!==4&&(u===27&&Ss(i.type)&&(l=i.stateNode,s=null),i=i.child,i!==null))for(hf(i,s,l),i=i.sibling;i!==null;)hf(i,s,l),i=i.sibling}function au(i,s,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,s?l.insertBefore(i,s):l.appendChild(i);else if(u!==4&&(u===27&&Ss(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(au(i,s,l),i=i.sibling;i!==null;)au(i,s,l),i=i.sibling}function ly(i){var s=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);qn(s,u,l),s[nn]=i,s[Dn]=l}catch(v){Ut(i,i.return,v)}}var Hr=!1,kn=!1,df=!1,cy=typeof WeakSet=="function"?WeakSet:Set,Ln=null;function sC(i,s){if(i=i.containerInfo,Df=Tu,i=x_(i),rd(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var g=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var T=0,B=-1,te=-1,he=0,ye=0,ke=i,de=null;t:for(;;){for(var me;ke!==l||g!==0&&ke.nodeType!==3||(B=T+g),ke!==v||u!==0&&ke.nodeType!==3||(te=T+u),ke.nodeType===3&&(T+=ke.nodeValue.length),(me=ke.firstChild)!==null;)de=ke,ke=me;for(;;){if(ke===i)break t;if(de===l&&++he===g&&(B=T),de===v&&++ye===u&&(te=T),(me=ke.nextSibling)!==null)break;ke=de,de=ke.parentNode}ke=me}l=B===-1||te===-1?null:{start:B,end:te}}else l=null}l=l||{start:0,end:0}}else l=null;for(Lf={focusedElem:i,selectionRange:l},Tu=!1,Ln=s;Ln!==null;)if(s=Ln,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Ln=i;else for(;Ln!==null;){switch(s=Ln,v=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)g=i[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&v!==null){i=void 0,l=s,g=v.memoizedProps,v=v.memoizedState,u=l.stateNode;try{var Ve=ia(l.type,g);i=u.getSnapshotBeforeUpdate(Ve,v),u.__reactInternalSnapshotBeforeUpdate=i}catch(ct){Ut(l,l.return,ct)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,l=i.nodeType,l===9)jf(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":jf(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=s.sibling,i!==null){i.return=s.return,Ln=i;break}Ln=s.return}}function uy(i,s,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:Fr(i,l),u&4&&rl(5,l);break;case 1:if(Fr(i,l),u&4)if(i=l.stateNode,s===null)try{i.componentDidMount()}catch(T){Ut(l,l.return,T)}else{var g=ia(l.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(g,s,i.__reactInternalSnapshotBeforeUpdate)}catch(T){Ut(l,l.return,T)}}u&64&&ry(l),u&512&&sl(l,l.return);break;case 3:if(Fr(i,l),u&64&&(i=l.updateQueue,i!==null)){if(s=null,l.child!==null)switch(l.child.tag){case 27:case 5:s=l.child.stateNode;break;case 1:s=l.child.stateNode}try{Y_(i,s)}catch(T){Ut(l,l.return,T)}}break;case 27:s===null&&u&4&&ly(l);case 26:case 5:Fr(i,l),s===null&&u&4&&ay(l),u&512&&sl(l,l.return);break;case 12:Fr(i,l);break;case 31:Fr(i,l),u&4&&fy(i,l);break;case 13:Fr(i,l),u&4&&py(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=pC.bind(null,l),LC(i,l))));break;case 22:if(u=l.memoizedState!==null||Hr,!u){s=s!==null&&s.memoizedState!==null||kn,g=Hr;var v=kn;Hr=u,(kn=s)&&!v?qr(i,l,(l.subtreeFlags&8772)!==0):Fr(i,l),Hr=g,kn=v}break;case 30:break;default:Fr(i,l)}}function hy(i){var s=i.alternate;s!==null&&(i.alternate=null,hy(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&ns(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var sn=null,_i=!1;function $r(i,s,l){for(l=l.child;l!==null;)dy(i,s,l),l=l.sibling}function dy(i,s,l){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(Be,l)}catch{}switch(l.tag){case 26:kn||mr(l,s),$r(i,s,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:kn||mr(l,s);var u=sn,g=_i;Ss(l.type)&&(sn=l.stateNode,_i=!1),$r(i,s,l),pl(l.stateNode),sn=u,_i=g;break;case 5:kn||mr(l,s);case 6:if(u=sn,g=_i,sn=null,$r(i,s,l),sn=u,_i=g,sn!==null)if(_i)try{(sn.nodeType===9?sn.body:sn.nodeName==="HTML"?sn.ownerDocument.body:sn).removeChild(l.stateNode)}catch(v){Ut(l,s,v)}else try{sn.removeChild(l.stateNode)}catch(v){Ut(l,s,v)}break;case 18:sn!==null&&(_i?(i=sn,rb(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),ro(i)):rb(sn,l.stateNode));break;case 4:u=sn,g=_i,sn=l.stateNode.containerInfo,_i=!0,$r(i,s,l),sn=u,_i=g;break;case 0:case 11:case 14:case 15:gs(2,l,s),kn||gs(4,l,s),$r(i,s,l);break;case 1:kn||(mr(l,s),u=l.stateNode,typeof u.componentWillUnmount=="function"&&sy(l,s,u)),$r(i,s,l);break;case 21:$r(i,s,l);break;case 22:kn=(u=kn)||l.memoizedState!==null,$r(i,s,l),kn=u;break;default:$r(i,s,l)}}function fy(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{ro(i)}catch(l){Ut(s,s.return,l)}}}function py(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ro(i)}catch(l){Ut(s,s.return,l)}}function aC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new cy),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new cy),s;default:throw Error(r(435,i.tag))}}function ou(i,s){var l=aC(i);s.forEach(function(u){if(!l.has(u)){l.add(u);var g=gC.bind(null,i,u);u.then(g,g)}})}function vi(i,s){var l=s.deletions;if(l!==null)for(var u=0;u<l.length;u++){var g=l[u],v=i,T=s,B=T;e:for(;B!==null;){switch(B.tag){case 27:if(Ss(B.type)){sn=B.stateNode,_i=!1;break e}break;case 5:sn=B.stateNode,_i=!1;break e;case 3:case 4:sn=B.stateNode.containerInfo,_i=!0;break e}B=B.return}if(sn===null)throw Error(r(160));dy(v,T,g),sn=null,_i=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)gy(s,i),s=s.sibling}var rr=null;function gy(i,s){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:vi(s,i),yi(i),u&4&&(gs(3,i,i.return),rl(3,i),gs(5,i,i.return));break;case 1:vi(s,i),yi(i),u&512&&(kn||l===null||mr(l,l.return)),u&64&&Hr&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var g=rr;if(vi(s,i),yi(i),u&512&&(kn||l===null||mr(l,l.return)),u&4){var v=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,g=g.ownerDocument||g;t:switch(u){case"title":v=g.getElementsByTagName("title")[0],(!v||v[fr]||v[nn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(u),g.head.insertBefore(v,g.querySelector("head > title"))),qn(v,u,l),v[nn]=i,Qe(v),u=v;break e;case"link":var T=gb("link","href",g).get(u+(l.href||""));if(T){for(var B=0;B<T.length;B++)if(v=T[B],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){T.splice(B,1);break t}}v=g.createElement(u),qn(v,u,l),g.head.appendChild(v);break;case"meta":if(T=gb("meta","content",g).get(u+(l.content||""))){for(B=0;B<T.length;B++)if(v=T[B],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){T.splice(B,1);break t}}v=g.createElement(u),qn(v,u,l),g.head.appendChild(v);break;default:throw Error(r(468,u))}v[nn]=i,Qe(v),u=v}i.stateNode=u}else mb(g,i.type,i.stateNode);else i.stateNode=pb(g,u,i.memoizedProps);else v!==u?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,u===null?mb(g,i.type,i.stateNode):pb(g,u,i.memoizedProps)):u===null&&i.stateNode!==null&&cf(i,i.memoizedProps,l.memoizedProps)}break;case 27:vi(s,i),yi(i),u&512&&(kn||l===null||mr(l,l.return)),l!==null&&u&4&&cf(i,i.memoizedProps,l.memoizedProps);break;case 5:if(vi(s,i),yi(i),u&512&&(kn||l===null||mr(l,l.return)),i.flags&32){g=i.stateNode;try{ht(g,"")}catch(Ve){Ut(i,i.return,Ve)}}u&4&&i.stateNode!=null&&(g=i.memoizedProps,cf(i,g,l!==null?l.memoizedProps:g)),u&1024&&(df=!0);break;case 6:if(vi(s,i),yi(i),u&4){if(i.stateNode===null)throw Error(r(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(Ve){Ut(i,i.return,Ve)}}break;case 3:if(wu=null,g=rr,rr=xu(s.containerInfo),vi(s,i),rr=g,yi(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{ro(s.containerInfo)}catch(Ve){Ut(i,i.return,Ve)}df&&(df=!1,my(i));break;case 4:u=rr,rr=xu(i.stateNode.containerInfo),vi(s,i),yi(i),rr=u;break;case 12:vi(s,i),yi(i);break;case 31:vi(s,i),yi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ou(i,u)));break;case 13:vi(s,i),yi(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(cu=Te()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ou(i,u)));break;case 22:g=i.memoizedState!==null;var te=l!==null&&l.memoizedState!==null,he=Hr,ye=kn;if(Hr=he||g,kn=ye||te,vi(s,i),kn=ye,Hr=he,yi(i),u&8192)e:for(s=i.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(l===null||te||Hr||kn||ra(i)),l=null,s=i;;){if(s.tag===5||s.tag===26){if(l===null){te=l=s;try{if(v=te.stateNode,g)T=v.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{B=te.stateNode;var ke=te.memoizedProps.style,de=ke!=null&&ke.hasOwnProperty("display")?ke.display:null;B.style.display=de==null||typeof de=="boolean"?"":(""+de).trim()}}catch(Ve){Ut(te,te.return,Ve)}}}else if(s.tag===6){if(l===null){te=s;try{te.stateNode.nodeValue=g?"":te.memoizedProps}catch(Ve){Ut(te,te.return,Ve)}}}else if(s.tag===18){if(l===null){te=s;try{var me=te.stateNode;g?sb(me,!0):sb(te.stateNode,!1)}catch(Ve){Ut(te,te.return,Ve)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;l===s&&(l=null),s=s.return}l===s&&(l=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,ou(i,l))));break;case 19:vi(s,i),yi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ou(i,u)));break;case 30:break;case 21:break;default:vi(s,i),yi(i)}}function yi(i){var s=i.flags;if(s&2){try{for(var l,u=i.return;u!==null;){if(oy(u)){l=u;break}u=u.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var g=l.stateNode,v=uf(i);au(i,v,g);break;case 5:var T=l.stateNode;l.flags&32&&(ht(T,""),l.flags&=-33);var B=uf(i);au(i,B,T);break;case 3:case 4:var te=l.stateNode.containerInfo,he=uf(i);hf(i,he,te);break;default:throw Error(r(161))}}catch(ye){Ut(i,i.return,ye)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function my(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;my(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function Fr(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)uy(i,s.alternate,s),s=s.sibling}function ra(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:gs(4,s,s.return),ra(s);break;case 1:mr(s,s.return);var l=s.stateNode;typeof l.componentWillUnmount=="function"&&sy(s,s.return,l),ra(s);break;case 27:pl(s.stateNode);case 26:case 5:mr(s,s.return),ra(s);break;case 22:s.memoizedState===null&&ra(s);break;case 30:ra(s);break;default:ra(s)}i=i.sibling}}function qr(i,s,l){for(l=l&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,g=i,v=s,T=v.flags;switch(v.tag){case 0:case 11:case 15:qr(g,v,l),rl(4,v);break;case 1:if(qr(g,v,l),u=v,g=u.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(he){Ut(u,u.return,he)}if(u=v,g=u.updateQueue,g!==null){var B=u.stateNode;try{var te=g.shared.hiddenCallbacks;if(te!==null)for(g.shared.hiddenCallbacks=null,g=0;g<te.length;g++)G_(te[g],B)}catch(he){Ut(u,u.return,he)}}l&&T&64&&ry(v),sl(v,v.return);break;case 27:ly(v);case 26:case 5:qr(g,v,l),l&&u===null&&T&4&&ay(v),sl(v,v.return);break;case 12:qr(g,v,l);break;case 31:qr(g,v,l),l&&T&4&&fy(g,v);break;case 13:qr(g,v,l),l&&T&4&&py(g,v);break;case 22:v.memoizedState===null&&qr(g,v,l),sl(v,v.return);break;case 30:break;default:qr(g,v,l)}s=s.sibling}}function ff(i,s){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&Wo(l))}function pf(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Wo(i))}function sr(i,s,l,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)_y(i,s,l,u),s=s.sibling}function _y(i,s,l,u){var g=s.flags;switch(s.tag){case 0:case 11:case 15:sr(i,s,l,u),g&2048&&rl(9,s);break;case 1:sr(i,s,l,u);break;case 3:sr(i,s,l,u),g&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Wo(i)));break;case 12:if(g&2048){sr(i,s,l,u),i=s.stateNode;try{var v=s.memoizedProps,T=v.id,B=v.onPostCommit;typeof B=="function"&&B(T,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(te){Ut(s,s.return,te)}}else sr(i,s,l,u);break;case 31:sr(i,s,l,u);break;case 13:sr(i,s,l,u);break;case 23:break;case 22:v=s.stateNode,T=s.alternate,s.memoizedState!==null?v._visibility&2?sr(i,s,l,u):al(i,s):v._visibility&2?sr(i,s,l,u):(v._visibility|=2,Ga(i,s,l,u,(s.subtreeFlags&10256)!==0||!1)),g&2048&&ff(T,s);break;case 24:sr(i,s,l,u),g&2048&&pf(s.alternate,s);break;default:sr(i,s,l,u)}}function Ga(i,s,l,u,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=i,T=s,B=l,te=u,he=T.flags;switch(T.tag){case 0:case 11:case 15:Ga(v,T,B,te,g),rl(8,T);break;case 23:break;case 22:var ye=T.stateNode;T.memoizedState!==null?ye._visibility&2?Ga(v,T,B,te,g):al(v,T):(ye._visibility|=2,Ga(v,T,B,te,g)),g&&he&2048&&ff(T.alternate,T);break;case 24:Ga(v,T,B,te,g),g&&he&2048&&pf(T.alternate,T);break;default:Ga(v,T,B,te,g)}s=s.sibling}}function al(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var l=i,u=s,g=u.flags;switch(u.tag){case 22:al(l,u),g&2048&&ff(u.alternate,u);break;case 24:al(l,u),g&2048&&pf(u.alternate,u);break;default:al(l,u)}s=s.sibling}}var ol=8192;function Ya(i,s,l){if(i.subtreeFlags&ol)for(i=i.child;i!==null;)vy(i,s,l),i=i.sibling}function vy(i,s,l){switch(i.tag){case 26:Ya(i,s,l),i.flags&ol&&i.memoizedState!==null&&KC(l,rr,i.memoizedState,i.memoizedProps);break;case 5:Ya(i,s,l);break;case 3:case 4:var u=rr;rr=xu(i.stateNode.containerInfo),Ya(i,s,l),rr=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=ol,ol=16777216,Ya(i,s,l),ol=u):Ya(i,s,l));break;default:Ya(i,s,l)}}function yy(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function ll(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var u=s[l];Ln=u,xy(u,i)}yy(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)by(i),i=i.sibling}function by(i){switch(i.tag){case 0:case 11:case 15:ll(i),i.flags&2048&&gs(9,i,i.return);break;case 3:ll(i);break;case 12:ll(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,lu(i)):ll(i);break;default:ll(i)}}function lu(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var u=s[l];Ln=u,xy(u,i)}yy(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:gs(8,s,s.return),lu(s);break;case 22:l=s.stateNode,l._visibility&2&&(l._visibility&=-3,lu(s));break;default:lu(s)}i=i.sibling}}function xy(i,s){for(;Ln!==null;){var l=Ln;switch(l.tag){case 0:case 11:case 15:gs(8,l,s);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Wo(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Ln=u;else e:for(l=i;Ln!==null;){u=Ln;var g=u.sibling,v=u.return;if(hy(u),u===l){Ln=null;break e}if(g!==null){g.return=v,Ln=g;break e}Ln=v}}}var oC={getCacheForType:function(i){var s=$n(xn),l=s.data.get(i);return l===void 0&&(l=i(),s.data.set(i,l)),l},cacheSignal:function(){return $n(xn).controller.signal}},lC=typeof WeakMap=="function"?WeakMap:Map,zt=0,Yt=null,kt=null,Mt=0,Pt=0,Oi=null,ms=!1,Va=!1,gf=!1,Wr=0,dn=0,_s=0,sa=0,mf=0,Di=0,Xa=0,cl=null,bi=null,_f=!1,cu=0,Sy=0,uu=1/0,hu=null,vs=null,An=0,ys=null,Za=null,Kr=0,vf=0,yf=null,wy=null,ul=0,bf=null;function Li(){return(zt&2)!==0&&Mt!==0?Mt&-Mt:N.T!==null?Cf():es()}function ky(){if(Di===0)if((Mt&536870912)===0||Rt){var i=Zn;Zn<<=1,(Zn&3932160)===0&&(Zn=262144),Di=i}else Di=536870912;return i=Ri.current,i!==null&&(i.flags|=32),Di}function xi(i,s,l){(i===Yt&&(Pt===2||Pt===9)||i.cancelPendingCommit!==null)&&(Ja(i,0),bs(i,Mt,Di,!1)),Ot(i,l),((zt&2)===0||i!==Yt)&&(i===Yt&&((zt&2)===0&&(sa|=l),dn===4&&bs(i,Mt,Di,!1)),_r(i))}function Ey(i,s,l){if((zt&6)!==0)throw Error(r(327));var u=!l&&(s&127)===0&&(s&i.expiredLanes)===0||xe(i,s),g=u?hC(i,s):Sf(i,s,!0),v=u;do{if(g===0){Va&&!u&&bs(i,s,0,!1);break}else{if(l=i.current.alternate,v&&!cC(l)){g=Sf(i,s,!1),v=!1;continue}if(g===2){if(v=s,i.errorRecoveryDisabledLanes&v)var T=0;else T=i.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){s=T;e:{var B=i;g=cl;var te=B.current.memoizedState.isDehydrated;if(te&&(Ja(B,T).flags|=256),T=Sf(B,T,!1),T!==2){if(gf&&!te){B.errorRecoveryDisabledLanes|=v,sa|=v,g=4;break e}v=bi,bi=g,v!==null&&(bi===null?bi=v:bi.push.apply(bi,v))}g=T}if(v=!1,g!==2)continue}}if(g===1){Ja(i,0),bs(i,s,0,!0);break}e:{switch(u=i,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:bs(u,s,Di,!ms);break e;case 2:bi=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(g=cu+300-Te(),10<g)){if(bs(u,s,Di,!ms),ee(u,0,!0)!==0)break e;Kr=s,u.timeoutHandle=nb(Cy.bind(null,u,l,bi,hu,_f,s,Di,sa,Xa,ms,v,"Throttled",-0,0),g);break e}Cy(u,l,bi,hu,_f,s,Di,sa,Xa,ms,v,null,-0,0)}}break}while(!0);_r(i)}function Cy(i,s,l,u,g,v,T,B,te,he,ye,ke,de,me){if(i.timeoutHandle=-1,ke=s.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ie},vy(s,v,ke);var Ve=(v&62914560)===v?cu-Te():(v&4194048)===v?Sy-Te():0;if(Ve=GC(ke,Ve),Ve!==null){Kr=v,i.cancelPendingCommit=Ve(Ly.bind(null,i,s,v,l,u,g,T,B,te,ye,ke,null,de,me)),bs(i,v,T,!he);return}}Ly(i,s,v,l,u,g,T,B,te)}function cC(i){for(var s=i;;){var l=s.tag;if((l===0||l===11||l===15)&&s.flags&16384&&(l=s.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var g=l[u],v=g.getSnapshot;g=g.value;try{if(!Mi(v(),g))return!1}catch{return!1}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function bs(i,s,l,u){s&=~mf,s&=~sa,i.suspendedLanes|=s,i.pingedLanes&=~s,u&&(i.warmLanes|=s),u=i.expirationTimes;for(var g=s;0<g;){var v=31-$e(g),T=1<<v;u[v]=-1,g&=~T}l!==0&&Ye(i,l,s)}function du(){return(zt&6)===0?(hl(0),!1):!0}function xf(){if(kt!==null){if(Pt===0)var i=kt.return;else i=kt,zr=Xs=null,Bd(i),$a=null,Go=0,i=kt;for(;i!==null;)iy(i.alternate,i),i=i.return;kt=null}}function Ja(i,s){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,AC(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Kr=0,xf(),Yt=i,kt=l=Dr(i.current,null),Mt=s,Pt=0,Oi=null,ms=!1,Va=xe(i,s),gf=!1,Xa=Di=mf=sa=_s=dn=0,bi=cl=null,_f=!1,(s&8)!==0&&(s|=s&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=s;0<u;){var g=31-$e(u),v=1<<g;s|=i[g],u&=~v}return Wr=s,Dc(),l}function Ty(i,s){vt=null,N.H=tl,s===Ha||s===Hc?(s=F_(),Pt=3):s===kd?(s=F_(),Pt=4):Pt=s===Jd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Oi=s,kt===null&&(dn=1,tu(i,Fi(s,i.current)))}function My(){var i=Ri.current;return i===null?!0:(Mt&4194048)===Mt?Gi===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?i===Gi:!1}function Ay(){var i=N.H;return N.H=tl,i===null?tl:i}function Ry(){var i=N.A;return N.A=oC,i}function fu(){dn=4,ms||(Mt&4194048)!==Mt&&Ri.current!==null||(Va=!0),(_s&134217727)===0&&(sa&134217727)===0||Yt===null||bs(Yt,Mt,Di,!1)}function Sf(i,s,l){var u=zt;zt|=2;var g=Ay(),v=Ry();(Yt!==i||Mt!==s)&&(hu=null,Ja(i,s)),s=!1;var T=dn;e:do try{if(Pt!==0&&kt!==null){var B=kt,te=Oi;switch(Pt){case 8:xf(),T=6;break e;case 3:case 2:case 9:case 6:Ri.current===null&&(s=!0);var he=Pt;if(Pt=0,Oi=null,Qa(i,B,te,he),l&&Va){T=0;break e}break;default:he=Pt,Pt=0,Oi=null,Qa(i,B,te,he)}}uC(),T=dn;break}catch(ye){Ty(i,ye)}while(!0);return s&&i.shellSuspendCounter++,zr=Xs=null,zt=u,N.H=g,N.A=v,kt===null&&(Yt=null,Mt=0,Dc()),T}function uC(){for(;kt!==null;)Ny(kt)}function hC(i,s){var l=zt;zt|=2;var u=Ay(),g=Ry();Yt!==i||Mt!==s?(hu=null,uu=Te()+500,Ja(i,s)):Va=xe(i,s);e:do try{if(Pt!==0&&kt!==null){s=kt;var v=Oi;t:switch(Pt){case 1:Pt=0,Oi=null,Qa(i,s,v,1);break;case 2:case 9:if(H_(v)){Pt=0,Oi=null,Oy(s);break}s=function(){Pt!==2&&Pt!==9||Yt!==i||(Pt=7),_r(i)},v.then(s,s);break e;case 3:Pt=7;break e;case 4:Pt=5;break e;case 7:H_(v)?(Pt=0,Oi=null,Oy(s)):(Pt=0,Oi=null,Qa(i,s,v,7));break;case 5:var T=null;switch(kt.tag){case 26:T=kt.memoizedState;case 5:case 27:var B=kt;if(T?_b(T):B.stateNode.complete){Pt=0,Oi=null;var te=B.sibling;if(te!==null)kt=te;else{var he=B.return;he!==null?(kt=he,pu(he)):kt=null}break t}}Pt=0,Oi=null,Qa(i,s,v,5);break;case 6:Pt=0,Oi=null,Qa(i,s,v,6);break;case 8:xf(),dn=6;break e;default:throw Error(r(462))}}dC();break}catch(ye){Ty(i,ye)}while(!0);return zr=Xs=null,N.H=u,N.A=g,zt=l,kt!==null?0:(Yt=null,Mt=0,Dc(),dn)}function dC(){for(;kt!==null&&!Le();)Ny(kt)}function Ny(i){var s=ty(i.alternate,i,Wr);i.memoizedProps=i.pendingProps,s===null?pu(i):kt=s}function Oy(i){var s=i,l=s.alternate;switch(s.tag){case 15:case 0:s=Vv(l,s,s.pendingProps,s.type,void 0,Mt);break;case 11:s=Vv(l,s,s.pendingProps,s.type.render,s.ref,Mt);break;case 5:Bd(s);default:iy(l,s),s=kt=R_(s,Wr),s=ty(l,s,Wr)}i.memoizedProps=i.pendingProps,s===null?pu(i):kt=s}function Qa(i,s,l,u){zr=Xs=null,Bd(s),$a=null,Go=0;var g=s.return;try{if(eC(i,g,s,l,Mt)){dn=1,tu(i,Fi(l,i.current)),kt=null;return}}catch(v){if(g!==null)throw kt=g,v;dn=1,tu(i,Fi(l,i.current)),kt=null;return}s.flags&32768?(Rt||u===1?i=!0:Va||(Mt&536870912)!==0?i=!1:(ms=i=!0,(u===2||u===9||u===3||u===6)&&(u=Ri.current,u!==null&&u.tag===13&&(u.flags|=16384))),Dy(s,i)):pu(s)}function pu(i){var s=i;do{if((s.flags&32768)!==0){Dy(s,ms);return}i=s.return;var l=iC(s.alternate,s,Wr);if(l!==null){kt=l;return}if(s=s.sibling,s!==null){kt=s;return}kt=s=i}while(s!==null);dn===0&&(dn=5)}function Dy(i,s){do{var l=rC(i.alternate,i);if(l!==null){l.flags&=32767,kt=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!s&&(i=i.sibling,i!==null)){kt=i;return}kt=i=l}while(i!==null);dn=6,kt=null}function Ly(i,s,l,u,g,v,T,B,te){i.cancelPendingCommit=null;do gu();while(An!==0);if((zt&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(v=s.lanes|s.childLanes,v|=cd,Ze(i,l,v,T,B,te),i===Yt&&(kt=Yt=null,Mt=0),Za=s,ys=i,Kr=l,vf=v,yf=g,wy=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,mC(Se,function(){return Py(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=N.T,N.T=null,g=$.p,$.p=2,T=zt,zt|=4;try{sC(i,s,l)}finally{zt=T,$.p=g,N.T=u}}An=1,zy(),By(),jy()}}function zy(){if(An===1){An=0;var i=ys,s=Za,l=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||l){l=N.T,N.T=null;var u=$.p;$.p=2;var g=zt;zt|=4;try{gy(s,i);var v=Lf,T=x_(i.containerInfo),B=v.focusedElem,te=v.selectionRange;if(T!==B&&B&&B.ownerDocument&&b_(B.ownerDocument.documentElement,B)){if(te!==null&&rd(B)){var he=te.start,ye=te.end;if(ye===void 0&&(ye=he),"selectionStart"in B)B.selectionStart=he,B.selectionEnd=Math.min(ye,B.value.length);else{var ke=B.ownerDocument||document,de=ke&&ke.defaultView||window;if(de.getSelection){var me=de.getSelection(),Ve=B.textContent.length,ct=Math.min(te.start,Ve),qt=te.end===void 0?ct:Math.min(te.end,Ve);!me.extend&&ct>qt&&(T=qt,qt=ct,ct=T);var oe=y_(B,ct),se=y_(B,qt);if(oe&&se&&(me.rangeCount!==1||me.anchorNode!==oe.node||me.anchorOffset!==oe.offset||me.focusNode!==se.node||me.focusOffset!==se.offset)){var ue=ke.createRange();ue.setStart(oe.node,oe.offset),me.removeAllRanges(),ct>qt?(me.addRange(ue),me.extend(se.node,se.offset)):(ue.setEnd(se.node,se.offset),me.addRange(ue))}}}}for(ke=[],me=B;me=me.parentNode;)me.nodeType===1&&ke.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<ke.length;B++){var we=ke[B];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}Tu=!!Df,Lf=Df=null}finally{zt=g,$.p=u,N.T=l}}i.current=s,An=2}}function By(){if(An===2){An=0;var i=ys,s=Za,l=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||l){l=N.T,N.T=null;var u=$.p;$.p=2;var g=zt;zt|=4;try{uy(i,s.alternate,s)}finally{zt=g,$.p=u,N.T=l}}An=3}}function jy(){if(An===4||An===3){An=0,Ge();var i=ys,s=Za,l=Kr,u=wy;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?An=5:(An=0,Za=ys=null,Iy(i,i.pendingLanes));var g=i.pendingLanes;if(g===0&&(vs=null),nr(l),s=s.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(Be,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=N.T,g=$.p,$.p=2,N.T=null;try{for(var v=i.onRecoverableError,T=0;T<u.length;T++){var B=u[T];v(B.value,{componentStack:B.stack})}}finally{N.T=s,$.p=g}}(Kr&3)!==0&&gu(),_r(i),g=i.pendingLanes,(l&261930)!==0&&(g&42)!==0?i===bf?ul++:(ul=0,bf=i):ul=0,hl(0)}}function Iy(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,Wo(s)))}function gu(){return zy(),By(),jy(),Py()}function Py(){if(An!==5)return!1;var i=ys,s=vf;vf=0;var l=nr(Kr),u=N.T,g=$.p;try{$.p=32>l?32:l,N.T=null,l=yf,yf=null;var v=ys,T=Kr;if(An=0,Za=ys=null,Kr=0,(zt&6)!==0)throw Error(r(331));var B=zt;if(zt|=4,by(v.current),_y(v,v.current,T,l),zt=B,hl(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(Be,v)}catch{}return!0}finally{$.p=g,N.T=u,Iy(i,s)}}function Uy(i,s,l){s=Fi(l,s),s=Zd(i.stateNode,s,2),i=ds(i,s,2),i!==null&&(Ot(i,2),_r(i))}function Ut(i,s,l){if(i.tag===3)Uy(i,i,l);else for(;s!==null;){if(s.tag===3){Uy(s,i,l);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(vs===null||!vs.has(u))){i=Fi(l,i),l=Hv(2),u=ds(s,l,2),u!==null&&($v(l,u,s,i),Ot(u,2),_r(u));break}}s=s.return}}function wf(i,s,l){var u=i.pingCache;if(u===null){u=i.pingCache=new lC;var g=new Set;u.set(s,g)}else g=u.get(s),g===void 0&&(g=new Set,u.set(s,g));g.has(l)||(gf=!0,g.add(l),i=fC.bind(null,i,s,l),s.then(i,i))}function fC(i,s,l){var u=i.pingCache;u!==null&&u.delete(s),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,Yt===i&&(Mt&l)===l&&(dn===4||dn===3&&(Mt&62914560)===Mt&&300>Te()-cu?(zt&2)===0&&Ja(i,0):mf|=l,Xa===Mt&&(Xa=0)),_r(i)}function Hy(i,s){s===0&&(s=ut()),i=Gs(i,s),i!==null&&(Ot(i,s),_r(i))}function pC(i){var s=i.memoizedState,l=0;s!==null&&(l=s.retryLane),Hy(i,l)}function gC(i,s){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,g=i.memoizedState;g!==null&&(l=g.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(s),Hy(i,l)}function mC(i,s){return X(i,s)}var mu=null,eo=null,kf=!1,_u=!1,Ef=!1,xs=0;function _r(i){i!==eo&&i.next===null&&(eo===null?mu=eo=i:eo=eo.next=i),_u=!0,kf||(kf=!0,vC())}function hl(i,s){if(!Ef&&_u){Ef=!0;do for(var l=!1,u=mu;u!==null;){if(i!==0){var g=u.pendingLanes;if(g===0)var v=0;else{var T=u.suspendedLanes,B=u.pingedLanes;v=(1<<31-$e(42|i)+1)-1,v&=g&~(T&~B),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,Wy(u,v))}else v=Mt,v=ee(u,u===Yt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||xe(u,v)||(l=!0,Wy(u,v));u=u.next}while(l);Ef=!1}}function _C(){$y()}function $y(){_u=kf=!1;var i=0;xs!==0&&MC()&&(i=xs);for(var s=Te(),l=null,u=mu;u!==null;){var g=u.next,v=Fy(u,s);v===0?(u.next=null,l===null?mu=g:l.next=g,g===null&&(eo=l)):(l=u,(i!==0||(v&3)!==0)&&(_u=!0)),u=g}An!==0&&An!==5||hl(i),xs!==0&&(xs=0)}function Fy(i,s){for(var l=i.suspendedLanes,u=i.pingedLanes,g=i.expirationTimes,v=i.pendingLanes&-62914561;0<v;){var T=31-$e(v),B=1<<T,te=g[T];te===-1?((B&l)===0||(B&u)!==0)&&(g[T]=He(B,s)):te<=s&&(i.expiredLanes|=B),v&=~B}if(s=Yt,l=Mt,l=ee(i,i===s?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===s&&(Pt===2||Pt===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&fe(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||xe(i,l)){if(s=l&-l,s===i.callbackPriority)return s;switch(u!==null&&fe(u),nr(l)){case 2:case 8:l=be;break;case 32:l=Se;break;case 268435456:l=ge;break;default:l=Se}return u=qy.bind(null,i),l=X(l,u),i.callbackPriority=s,i.callbackNode=l,s}return u!==null&&u!==null&&fe(u),i.callbackPriority=2,i.callbackNode=null,2}function qy(i,s){if(An!==0&&An!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(gu()&&i.callbackNode!==l)return null;var u=Mt;return u=ee(i,i===Yt?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(Ey(i,u,s),Fy(i,Te()),i.callbackNode!=null&&i.callbackNode===l?qy.bind(null,i):null)}function Wy(i,s){if(gu())return null;Ey(i,s,!0)}function vC(){RC(function(){(zt&6)!==0?X(le,_C):$y()})}function Cf(){if(xs===0){var i=Pa;i===0&&(i=Mn,Mn<<=1,(Mn&261888)===0&&(Mn=256)),xs=i}return xs}function Ky(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:rs(""+i)}function Gy(i,s){var l=s.ownerDocument.createElement("input");return l.name=s.name,l.value=s.value,i.id&&l.setAttribute("form",i.id),s.parentNode.insertBefore(l,s),i=new FormData(i),l.parentNode.removeChild(l),i}function yC(i,s,l,u,g){if(s==="submit"&&l&&l.stateNode===g){var v=Ky((g[Dn]||null).action),T=u.submitter;T&&(s=(s=T[Dn]||null)?Ky(s.formAction):T.getAttribute("formAction"),s!==null&&(v=s,T=null));var B=new Ac("action","action",null,u,g);i.push({event:B,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(xs!==0){var te=T?Gy(g,T):new FormData(g);Wd(l,{pending:!0,data:te,method:g.method,action:v},null,te)}}else typeof v=="function"&&(B.preventDefault(),te=T?Gy(g,T):new FormData(g),Wd(l,{pending:!0,data:te,method:g.method,action:v},v,te))},currentTarget:g}]})}}for(var Tf=0;Tf<ld.length;Tf++){var Mf=ld[Tf],bC=Mf.toLowerCase(),xC=Mf[0].toUpperCase()+Mf.slice(1);ir(bC,"on"+xC)}ir(k_,"onAnimationEnd"),ir(E_,"onAnimationIteration"),ir(C_,"onAnimationStart"),ir("dblclick","onDoubleClick"),ir("focusin","onFocus"),ir("focusout","onBlur"),ir(jE,"onTransitionRun"),ir(IE,"onTransitionStart"),ir(PE,"onTransitionCancel"),ir(T_,"onTransitionEnd"),Re("onMouseEnter",["mouseout","mouseover"]),Re("onMouseLeave",["mouseout","mouseover"]),Re("onPointerEnter",["pointerout","pointerover"]),Re("onPointerLeave",["pointerout","pointerover"]),ri("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ri("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ri("onBeforeInput",["compositionend","keypress","textInput","paste"]),ri("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),SC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dl));function Yy(i,s){s=(s&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],g=u.event;u=u.listeners;e:{var v=void 0;if(s)for(var T=u.length-1;0<=T;T--){var B=u[T],te=B.instance,he=B.currentTarget;if(B=B.listener,te!==v&&g.isPropagationStopped())break e;v=B,g.currentTarget=he;try{v(g)}catch(ye){Oc(ye)}g.currentTarget=null,v=te}else for(T=0;T<u.length;T++){if(B=u[T],te=B.instance,he=B.currentTarget,B=B.listener,te!==v&&g.isPropagationStopped())break e;v=B,g.currentTarget=he;try{v(g)}catch(ye){Oc(ye)}g.currentTarget=null,v=te}}}}function Et(i,s){var l=s[ts];l===void 0&&(l=s[ts]=new Set);var u=i+"__bubble";l.has(u)||(Vy(s,i,2,!1),l.add(u))}function Af(i,s,l){var u=0;s&&(u|=4),Vy(l,i,u,s)}var vu="_reactListening"+Math.random().toString(36).slice(2);function Rf(i){if(!i[vu]){i[vu]=!0,un.forEach(function(l){l!=="selectionchange"&&(SC.has(l)||Af(l,!1,i),Af(l,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[vu]||(s[vu]=!0,Af("selectionchange",!1,s))}}function Vy(i,s,l,u){switch(kb(s)){case 2:var g=XC;break;case 8:g=ZC;break;default:g=Wf}l=g.bind(null,s,l,i),g=void 0,!Vh||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),u?g!==void 0?i.addEventListener(s,l,{capture:!0,passive:g}):i.addEventListener(s,l,!0):g!==void 0?i.addEventListener(s,l,{passive:g}):i.addEventListener(s,l,!1)}function Nf(i,s,l,u,g){var v=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var T=u.tag;if(T===3||T===4){var B=u.stateNode.containerInfo;if(B===g)break;if(T===4)for(T=u.return;T!==null;){var te=T.tag;if((te===3||te===4)&&T.stateNode.containerInfo===g)return;T=T.return}for(;B!==null;){if(T=ne(B),T===null)return;if(te=T.tag,te===5||te===6||te===26||te===27){u=v=T;continue e}B=B.parentNode}}u=u.return}Ec(function(){var he=v,ye=_t(l),ke=[];e:{var de=M_.get(i);if(de!==void 0){var me=Ac,Ve=i;switch(i){case"keypress":if(Tc(l)===0)break e;case"keydown":case"keyup":me=gE;break;case"focusin":Ve="focus",me=Qh;break;case"focusout":Ve="blur",me=Qh;break;case"beforeblur":case"afterblur":me=Qh;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=i_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=iE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=vE;break;case k_:case E_:case C_:me=aE;break;case T_:me=bE;break;case"scroll":case"scrollend":me=tE;break;case"wheel":me=SE;break;case"copy":case"cut":case"paste":me=lE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=s_;break;case"toggle":case"beforetoggle":me=kE}var ct=(s&4)!==0,qt=!ct&&(i==="scroll"||i==="scrollend"),oe=ct?de!==null?de+"Capture":null:de;ct=[];for(var se=he,ue;se!==null;){var we=se;if(ue=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||ue===null||oe===null||(we=Lo(se,oe),we!=null&&ct.push(fl(se,we,ue))),qt)break;se=se.return}0<ct.length&&(de=new me(de,Ve,null,l,ye),ke.push({event:de,listeners:ct}))}}if((s&7)===0){e:{if(de=i==="mouseover"||i==="pointerover",me=i==="mouseout"||i==="pointerout",de&&l!==et&&(Ve=l.relatedTarget||l.fromElement)&&(ne(Ve)||Ve[dr]))break e;if((me||de)&&(de=ye.window===ye?ye:(de=ye.ownerDocument)?de.defaultView||de.parentWindow:window,me?(Ve=l.relatedTarget||l.toElement,me=he,Ve=Ve?ne(Ve):null,Ve!==null&&(qt=o(Ve),ct=Ve.tag,Ve!==qt||ct!==5&&ct!==27&&ct!==6)&&(Ve=null)):(me=null,Ve=he),me!==Ve)){if(ct=i_,we="onMouseLeave",oe="onMouseEnter",se="mouse",(i==="pointerout"||i==="pointerover")&&(ct=s_,we="onPointerLeave",oe="onPointerEnter",se="pointer"),qt=me==null?de:qe(me),ue=Ve==null?de:qe(Ve),de=new ct(we,se+"leave",me,l,ye),de.target=qt,de.relatedTarget=ue,we=null,ne(ye)===he&&(ct=new ct(oe,se+"enter",Ve,l,ye),ct.target=ue,ct.relatedTarget=qt,we=ct),qt=we,me&&Ve)t:{for(ct=wC,oe=me,se=Ve,ue=0,we=oe;we;we=ct(we))ue++;we=0;for(var rt=se;rt;rt=ct(rt))we++;for(;0<ue-we;)oe=ct(oe),ue--;for(;0<we-ue;)se=ct(se),we--;for(;ue--;){if(oe===se||se!==null&&oe===se.alternate){ct=oe;break t}oe=ct(oe),se=ct(se)}ct=null}else ct=null;me!==null&&Xy(ke,de,me,ct,!1),Ve!==null&&qt!==null&&Xy(ke,qt,Ve,ct,!0)}}e:{if(de=he?qe(he):window,me=de.nodeName&&de.nodeName.toLowerCase(),me==="select"||me==="input"&&de.type==="file")var Dt=f_;else if(h_(de))if(p_)Dt=LE;else{Dt=OE;var tt=NE}else me=de.nodeName,!me||me.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?he&&is(he.elementType)&&(Dt=f_):Dt=DE;if(Dt&&(Dt=Dt(i,he))){d_(ke,Dt,l,ye);break e}tt&&tt(i,de,he),i==="focusout"&&he&&de.type==="number"&&he.memoizedProps.value!=null&&Ma(de,"number",de.value)}switch(tt=he?qe(he):window,i){case"focusin":(h_(tt)||tt.contentEditable==="true")&&(Na=tt,sd=he,$o=null);break;case"focusout":$o=sd=Na=null;break;case"mousedown":ad=!0;break;case"contextmenu":case"mouseup":case"dragend":ad=!1,S_(ke,l,ye);break;case"selectionchange":if(BE)break;case"keydown":case"keyup":S_(ke,l,ye)}var yt;if(td)e:{switch(i){case"compositionstart":var At="onCompositionStart";break e;case"compositionend":At="onCompositionEnd";break e;case"compositionupdate":At="onCompositionUpdate";break e}At=void 0}else Ra?c_(i,l)&&(At="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(At="onCompositionStart");At&&(a_&&l.locale!=="ko"&&(Ra||At!=="onCompositionStart"?At==="onCompositionEnd"&&Ra&&(yt=t_()):(ss=ye,Xh="value"in ss?ss.value:ss.textContent,Ra=!0)),tt=yu(he,At),0<tt.length&&(At=new r_(At,i,null,l,ye),ke.push({event:At,listeners:tt}),yt?At.data=yt:(yt=u_(l),yt!==null&&(At.data=yt)))),(yt=CE?TE(i,l):ME(i,l))&&(At=yu(he,"onBeforeInput"),0<At.length&&(tt=new r_("onBeforeInput","beforeinput",null,l,ye),ke.push({event:tt,listeners:At}),tt.data=yt)),yC(ke,i,he,l,ye)}Yy(ke,s)})}function fl(i,s,l){return{instance:i,listener:s,currentTarget:l}}function yu(i,s){for(var l=s+"Capture",u=[];i!==null;){var g=i,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=Lo(i,l),g!=null&&u.unshift(fl(i,g,v)),g=Lo(i,s),g!=null&&u.push(fl(i,g,v))),i.tag===3)return u;i=i.return}return[]}function wC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Xy(i,s,l,u,g){for(var v=s._reactName,T=[];l!==null&&l!==u;){var B=l,te=B.alternate,he=B.stateNode;if(B=B.tag,te!==null&&te===u)break;B!==5&&B!==26&&B!==27||he===null||(te=he,g?(he=Lo(l,v),he!=null&&T.unshift(fl(l,he,te))):g||(he=Lo(l,v),he!=null&&T.push(fl(l,he,te)))),l=l.return}T.length!==0&&i.push({event:s,listeners:T})}var kC=/\r\n?/g,EC=/\u0000|\uFFFD/g;function Zy(i){return(typeof i=="string"?i:""+i).replace(kC,`
|
|
49
|
+
`).replace(EC,"")}function Jy(i,s){return s=Zy(s),Zy(i)===s}function Ft(i,s,l,u,g,v){switch(l){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||ht(i,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&ht(i,""+u);break;case"className":Ci(i,"class",u);break;case"tabIndex":Ci(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ci(i,l,u);break;case"style":It(i,u,v);break;case"data":if(s!=="object"){Ci(i,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=rs(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(s!=="input"&&Ft(i,s,"name",g.name,g,null),Ft(i,s,"formEncType",g.formEncType,g,null),Ft(i,s,"formMethod",g.formMethod,g,null),Ft(i,s,"formTarget",g.formTarget,g,null)):(Ft(i,s,"encType",g.encType,g,null),Ft(i,s,"method",g.method,g,null),Ft(i,s,"target",g.target,g,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=rs(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=Ie);break;case"onScroll":u!=null&&Et("scroll",i);break;case"onScrollEnd":u!=null&&Et("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(g.children!=null)throw Error(r(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){i.removeAttribute("xlink:href");break}l=rs(""+u),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""+u):i.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Et("beforetoggle",i),Et("toggle",i),Jn(i,"popover",u);break;case"xlinkActuate":pi(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":pi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":pi(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":pi(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":pi(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":pi(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":pi(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":pi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":pi(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Jn(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Nr.get(l)||l,Jn(i,l,u))}}function Of(i,s,l,u,g,v){switch(l){case"style":It(i,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(g.children!=null)throw Error(r(60));i.innerHTML=l}}break;case"children":typeof u=="string"?ht(i,u):(typeof u=="number"||typeof u=="bigint")&&ht(i,""+u);break;case"onScroll":u!=null&&Et("scroll",i);break;case"onScrollEnd":u!=null&&Et("scrollend",i);break;case"onClick":u!=null&&(i.onclick=Ie);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rn.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),s=l.slice(2,g?l.length-7:void 0),v=i[Dn]||null,v=v!=null?v[l]:null,typeof v=="function"&&i.removeEventListener(s,v,g),typeof u=="function")){typeof v!="function"&&v!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(s,u,g);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):Jn(i,l,u)}}}function qn(i,s,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Et("error",i),Et("load",i);var u=!1,g=!1,v;for(v in l)if(l.hasOwnProperty(v)){var T=l[v];if(T!=null)switch(v){case"src":u=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Ft(i,s,v,T,l,null)}}g&&Ft(i,s,"srcSet",l.srcSet,l,null),u&&Ft(i,s,"src",l.src,l,null);return;case"input":Et("invalid",i);var B=v=T=g=null,te=null,he=null;for(u in l)if(l.hasOwnProperty(u)){var ye=l[u];if(ye!=null)switch(u){case"name":g=ye;break;case"type":T=ye;break;case"checked":te=ye;break;case"defaultChecked":he=ye;break;case"value":v=ye;break;case"defaultValue":B=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,s));break;default:Ft(i,s,u,ye,l,null)}}Fs(i,v,B,te,he,T,g,!1);return;case"select":Et("invalid",i),u=T=v=null;for(g in l)if(l.hasOwnProperty(g)&&(B=l[g],B!=null))switch(g){case"value":v=B;break;case"defaultValue":T=B;break;case"multiple":u=B;default:Ft(i,s,g,B,l,null)}s=v,l=T,i.multiple=!!u,s!=null?Un(i,!!u,s,!1):l!=null&&Un(i,!!u,l,!0);return;case"textarea":Et("invalid",i),v=g=u=null;for(T in l)if(l.hasOwnProperty(T)&&(B=l[T],B!=null))switch(T){case"value":u=B;break;case"defaultValue":g=B;break;case"children":v=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(r(91));break;default:Ft(i,s,T,B,l,null)}Aa(i,u,g,v);return;case"option":for(te in l)if(l.hasOwnProperty(te)&&(u=l[te],u!=null))switch(te){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ft(i,s,te,u,l,null)}return;case"dialog":Et("beforetoggle",i),Et("toggle",i),Et("cancel",i),Et("close",i);break;case"iframe":case"object":Et("load",i);break;case"video":case"audio":for(u=0;u<dl.length;u++)Et(dl[u],i);break;case"image":Et("error",i),Et("load",i);break;case"details":Et("toggle",i);break;case"embed":case"source":case"link":Et("error",i),Et("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(he in l)if(l.hasOwnProperty(he)&&(u=l[he],u!=null))switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:Ft(i,s,he,u,l,null)}return;default:if(is(s)){for(ye in l)l.hasOwnProperty(ye)&&(u=l[ye],u!==void 0&&Of(i,s,ye,u,l,void 0));return}}for(B in l)l.hasOwnProperty(B)&&(u=l[B],u!=null&&Ft(i,s,B,u,l,null))}function CC(i,s,l,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,T=null,B=null,te=null,he=null,ye=null;for(me in l){var ke=l[me];if(l.hasOwnProperty(me)&&ke!=null)switch(me){case"checked":break;case"value":break;case"defaultValue":te=ke;default:u.hasOwnProperty(me)||Ft(i,s,me,null,u,ke)}}for(var de in u){var me=u[de];if(ke=l[de],u.hasOwnProperty(de)&&(me!=null||ke!=null))switch(de){case"type":v=me;break;case"name":g=me;break;case"checked":he=me;break;case"defaultChecked":ye=me;break;case"value":T=me;break;case"defaultValue":B=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,s));break;default:me!==ke&&Ft(i,s,de,me,u,ke)}}No(i,T,B,te,he,ye,v,g);return;case"select":me=T=B=de=null;for(v in l)if(te=l[v],l.hasOwnProperty(v)&&te!=null)switch(v){case"value":break;case"multiple":me=te;default:u.hasOwnProperty(v)||Ft(i,s,v,null,u,te)}for(g in u)if(v=u[g],te=l[g],u.hasOwnProperty(g)&&(v!=null||te!=null))switch(g){case"value":de=v;break;case"defaultValue":B=v;break;case"multiple":T=v;default:v!==te&&Ft(i,s,g,v,u,te)}s=B,l=T,u=me,de!=null?Un(i,!!l,de,!1):!!u!=!!l&&(s!=null?Un(i,!!l,s,!0):Un(i,!!l,l?[]:"",!1));return;case"textarea":me=de=null;for(B in l)if(g=l[B],l.hasOwnProperty(B)&&g!=null&&!u.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:Ft(i,s,B,null,u,g)}for(T in u)if(g=u[T],v=l[T],u.hasOwnProperty(T)&&(g!=null||v!=null))switch(T){case"value":de=g;break;case"defaultValue":me=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&Ft(i,s,T,g,u,v)}wc(i,de,me);return;case"option":for(var Ve in l)if(de=l[Ve],l.hasOwnProperty(Ve)&&de!=null&&!u.hasOwnProperty(Ve))switch(Ve){case"selected":i.selected=!1;break;default:Ft(i,s,Ve,null,u,de)}for(te in u)if(de=u[te],me=l[te],u.hasOwnProperty(te)&&de!==me&&(de!=null||me!=null))switch(te){case"selected":i.selected=de&&typeof de!="function"&&typeof de!="symbol";break;default:Ft(i,s,te,de,u,me)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ct in l)de=l[ct],l.hasOwnProperty(ct)&&de!=null&&!u.hasOwnProperty(ct)&&Ft(i,s,ct,null,u,de);for(he in u)if(de=u[he],me=l[he],u.hasOwnProperty(he)&&de!==me&&(de!=null||me!=null))switch(he){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,s));break;default:Ft(i,s,he,de,u,me)}return;default:if(is(s)){for(var qt in l)de=l[qt],l.hasOwnProperty(qt)&&de!==void 0&&!u.hasOwnProperty(qt)&&Of(i,s,qt,void 0,u,de);for(ye in u)de=u[ye],me=l[ye],!u.hasOwnProperty(ye)||de===me||de===void 0&&me===void 0||Of(i,s,ye,de,u,me);return}}for(var oe in l)de=l[oe],l.hasOwnProperty(oe)&&de!=null&&!u.hasOwnProperty(oe)&&Ft(i,s,oe,null,u,de);for(ke in u)de=u[ke],me=l[ke],!u.hasOwnProperty(ke)||de===me||de==null&&me==null||Ft(i,s,ke,de,u,me)}function Qy(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function TC(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var g=l[u],v=g.transferSize,T=g.initiatorType,B=g.duration;if(v&&B&&Qy(T)){for(T=0,B=g.responseEnd,u+=1;u<l.length;u++){var te=l[u],he=te.startTime;if(he>B)break;var ye=te.transferSize,ke=te.initiatorType;ye&&Qy(ke)&&(te=te.responseEnd,T+=ye*(te<B?1:(B-he)/(te-he)))}if(--u,s+=8*(v+T)/(g.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Df=null,Lf=null;function bu(i){return i.nodeType===9?i:i.ownerDocument}function eb(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tb(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function zf(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Bf=null;function MC(){var i=window.event;return i&&i.type==="popstate"?i===Bf?!1:(Bf=i,!0):(Bf=null,!1)}var nb=typeof setTimeout=="function"?setTimeout:void 0,AC=typeof clearTimeout=="function"?clearTimeout:void 0,ib=typeof Promise=="function"?Promise:void 0,RC=typeof queueMicrotask=="function"?queueMicrotask:typeof ib<"u"?function(i){return ib.resolve(null).then(i).catch(NC)}:nb;function NC(i){setTimeout(function(){throw i})}function Ss(i){return i==="head"}function rb(i,s){var l=s,u=0;do{var g=l.nextSibling;if(i.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(g),ro(s);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")pl(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,pl(l);for(var v=l.firstChild;v;){var T=v.nextSibling,B=v.nodeName;v[fr]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=T}}else l==="body"&&pl(i.ownerDocument.body);l=g}while(l);ro(s)}function sb(i,s){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?s?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(s?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function jf(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var l=s;switch(s=s.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":jf(l),ns(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function OC(i,s,l,u){for(;i.nodeType===1;){var g=l;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[fr])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(v=i.getAttribute("rel"),v==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(v!==g.rel||i.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||i.getAttribute("title")!==(g.title==null?null:g.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(v=i.getAttribute("src"),(v!==(g.src==null?null:g.src)||i.getAttribute("type")!==(g.type==null?null:g.type)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&i.getAttribute("name")===v)return i}else return i;if(i=Yi(i.nextSibling),i===null)break}return null}function DC(i,s,l){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Yi(i.nextSibling),i===null))return null;return i}function ab(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Yi(i.nextSibling),i===null))return null;return i}function If(i){return i.data==="$?"||i.data==="$~"}function Pf(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function LC(i,s){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||l.readyState!=="loading")s();else{var u=function(){s(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function Yi(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Uf=null;function ob(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(s===0)return Yi(i.nextSibling);s--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||s++}i=i.nextSibling}return null}function lb(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(s===0)return i;s--}else l!=="/$"&&l!=="/&"||s++}i=i.previousSibling}return null}function cb(i,s,l){switch(s=bu(l),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function pl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);ns(i)}var Vi=new Map,ub=new Set;function xu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Gr=$.d;$.d={f:zC,r:BC,D:jC,C:IC,L:PC,m:UC,X:$C,S:HC,M:FC};function zC(){var i=Gr.f(),s=du();return i||s}function BC(i){var s=Ee(i);s!==null&&s.tag===5&&s.type==="form"?Tv(s):Gr.r(i)}var to=typeof document>"u"?null:document;function hb(i,s,l){var u=to;if(u&&typeof s=="string"&&s){var g=gi(s);g='link[rel="'+i+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),ub.has(g)||(ub.add(g),i={rel:i,crossOrigin:l,href:s},u.querySelector(g)===null&&(s=u.createElement("link"),qn(s,"link",i),Qe(s),u.head.appendChild(s)))}}function jC(i){Gr.D(i),hb("dns-prefetch",i,null)}function IC(i,s){Gr.C(i,s),hb("preconnect",i,s)}function PC(i,s,l){Gr.L(i,s,l);var u=to;if(u&&i&&s){var g='link[rel="preload"][as="'+gi(s)+'"]';s==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+gi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+gi(l.imageSizes)+'"]')):g+='[href="'+gi(i)+'"]';var v=g;switch(s){case"style":v=no(i);break;case"script":v=io(i)}Vi.has(v)||(i=_({rel:"preload",href:s==="image"&&l&&l.imageSrcSet?void 0:i,as:s},l),Vi.set(v,i),u.querySelector(g)!==null||s==="style"&&u.querySelector(gl(v))||s==="script"&&u.querySelector(ml(v))||(s=u.createElement("link"),qn(s,"link",i),Qe(s),u.head.appendChild(s)))}}function UC(i,s){Gr.m(i,s);var l=to;if(l&&i){var u=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+gi(u)+'"][href="'+gi(i)+'"]',v=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=io(i)}if(!Vi.has(v)&&(i=_({rel:"modulepreload",href:i},s),Vi.set(v,i),l.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ml(v)))return}u=l.createElement("link"),qn(u,"link",i),Qe(u),l.head.appendChild(u)}}}function HC(i,s,l){Gr.S(i,s,l);var u=to;if(u&&i){var g=Je(u).hoistableStyles,v=no(i);s=s||"default";var T=g.get(v);if(!T){var B={loading:0,preload:null};if(T=u.querySelector(gl(v)))B.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":s},l),(l=Vi.get(v))&&Hf(i,l);var te=T=u.createElement("link");Qe(te),qn(te,"link",i),te._p=new Promise(function(he,ye){te.onload=he,te.onerror=ye}),te.addEventListener("load",function(){B.loading|=1}),te.addEventListener("error",function(){B.loading|=2}),B.loading|=4,Su(T,s,u)}T={type:"stylesheet",instance:T,count:1,state:B},g.set(v,T)}}}function $C(i,s){Gr.X(i,s);var l=to;if(l&&i){var u=Je(l).hoistableScripts,g=io(i),v=u.get(g);v||(v=l.querySelector(ml(g)),v||(i=_({src:i,async:!0},s),(s=Vi.get(g))&&$f(i,s),v=l.createElement("script"),Qe(v),qn(v,"link",i),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function FC(i,s){Gr.M(i,s);var l=to;if(l&&i){var u=Je(l).hoistableScripts,g=io(i),v=u.get(g);v||(v=l.querySelector(ml(g)),v||(i=_({src:i,async:!0,type:"module"},s),(s=Vi.get(g))&&$f(i,s),v=l.createElement("script"),Qe(v),qn(v,"link",i),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function db(i,s,l,u){var g=(g=Z.current)?xu(g):null;if(!g)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(s=no(l.href),l=Je(g).hoistableStyles,u=l.get(s),u||(u={type:"style",instance:null,count:0,state:null},l.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=no(l.href);var v=Je(g).hoistableStyles,T=v.get(i);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(i,T),(v=g.querySelector(gl(i)))&&!v._p&&(T.instance=v,T.state.loading=5),Vi.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Vi.set(i,l),v||qC(g,i,l,T.state))),s&&u===null)throw Error(r(528,""));return T}if(s&&u!==null)throw Error(r(529,""));return null;case"script":return s=l.async,l=l.src,typeof l=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=io(l),l=Je(g).hoistableScripts,u=l.get(s),u||(u={type:"script",instance:null,count:0,state:null},l.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function no(i){return'href="'+gi(i)+'"'}function gl(i){return'link[rel="stylesheet"]['+i+"]"}function fb(i){return _({},i,{"data-precedence":i.precedence,precedence:null})}function qC(i,s,l,u){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=i.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),qn(s,"link",l),Qe(s),i.head.appendChild(s))}function io(i){return'[src="'+gi(i)+'"]'}function ml(i){return"script[async]"+i}function pb(i,s,l){if(s.count++,s.instance===null)switch(s.type){case"style":var u=i.querySelector('style[data-href~="'+gi(l.href)+'"]');if(u)return s.instance=u,Qe(u),u;var g=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Qe(u),qn(u,"style",g),Su(u,l.precedence,i),s.instance=u;case"stylesheet":g=no(l.href);var v=i.querySelector(gl(g));if(v)return s.state.loading|=4,s.instance=v,Qe(v),v;u=fb(l),(g=Vi.get(g))&&Hf(u,g),v=(i.ownerDocument||i).createElement("link"),Qe(v);var T=v;return T._p=new Promise(function(B,te){T.onload=B,T.onerror=te}),qn(v,"link",u),s.state.loading|=4,Su(v,l.precedence,i),s.instance=v;case"script":return v=io(l.src),(g=i.querySelector(ml(v)))?(s.instance=g,Qe(g),g):(u=l,(g=Vi.get(v))&&(u=_({},l),$f(u,g)),i=i.ownerDocument||i,g=i.createElement("script"),Qe(g),qn(g,"link",u),i.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,Su(u,l.precedence,i));return s.instance}function Su(i,s,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,v=g,T=0;T<u.length;T++){var B=u[T];if(B.dataset.precedence===s)v=B;else if(v!==g)break}v?v.parentNode.insertBefore(i,v.nextSibling):(s=l.nodeType===9?l.head:l,s.insertBefore(i,s.firstChild))}function Hf(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function $f(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var wu=null;function gb(i,s,l){if(wu===null){var u=new Map,g=wu=new Map;g.set(l,u)}else g=wu,u=g.get(l),u||(u=new Map,g.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),g=0;g<l.length;g++){var v=l[g];if(!(v[fr]||v[nn]||i==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var T=v.getAttribute(s)||"";T=i+T;var B=u.get(T);B?B.push(v):u.set(T,[v])}}return u}function mb(i,s,l){i=i.ownerDocument||i,i.head.insertBefore(l,s==="title"?i.querySelector("head > title"):null)}function WC(i,s,l){if(l===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function _b(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function KC(i,s,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=no(u.href),v=s.querySelector(gl(g));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=ku.bind(i),s.then(i,i)),l.state.loading|=4,l.instance=v,Qe(v);return}v=s.ownerDocument||s,u=fb(u),(g=Vi.get(g))&&Hf(u,g),v=v.createElement("link"),Qe(v);var T=v;T._p=new Promise(function(B,te){T.onload=B,T.onerror=te}),qn(v,"link",u),l.instance=v}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,s),(s=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=ku.bind(i),s.addEventListener("load",l),s.addEventListener("error",l))}}var Ff=0;function GC(i,s){return i.stylesheets&&i.count===0&&Cu(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&Cu(i,i.stylesheets),i.unsuspend){var v=i.unsuspend;i.unsuspend=null,v()}},6e4+s);0<i.imgBytes&&Ff===0&&(Ff=62500*TC());var g=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Cu(i,i.stylesheets),i.unsuspend)){var v=i.unsuspend;i.unsuspend=null,v()}},(i.imgBytes>Ff?50:800)+s);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function ku(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cu(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Eu=null;function Cu(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Eu=new Map,s.forEach(YC,i),Eu=null,ku.call(i))}function YC(i,s){if(!(s.state.loading&4)){var l=Eu.get(i);if(l)var u=l.get(null);else{l=new Map,Eu.set(i,l);for(var g=i.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var T=g[v];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(l.set(T.dataset.precedence,T),u=T)}u&&l.set(null,u)}g=s.instance,T=g.getAttribute("data-precedence"),v=l.get(T)||u,v===u&&l.set(null,g),l.set(T,g),this.count++,u=ku.bind(this),g.addEventListener("load",u),g.addEventListener("error",u),v?v.parentNode.insertBefore(g,v.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(g,i.firstChild)),s.state.loading|=4}}var _l={$$typeof:R,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function VC(i,s,l,u,g,v,T,B,te){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ht(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ht(0),this.hiddenUpdates=Ht(null),this.identifierPrefix=u,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function vb(i,s,l,u,g,v,T,B,te,he,ye,ke){return i=new VC(i,s,l,T,te,he,ye,ke,B),s=1,v===!0&&(s|=24),v=Ai(3,null,null,s),i.current=v,v.stateNode=i,s=xd(),s.refCount++,i.pooledCache=s,s.refCount++,v.memoizedState={element:u,isDehydrated:l,cache:s},Ed(v),i}function yb(i){return i?(i=La,i):La}function bb(i,s,l,u,g,v){g=yb(g),u.context===null?u.context=g:u.pendingContext=g,u=hs(s),u.payload={element:l},v=v===void 0?null:v,v!==null&&(u.callback=v),l=ds(i,u,s),l!==null&&(xi(l,i,s),Vo(l,i,s))}function xb(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<s?l:s}}function qf(i,s){xb(i,s),(i=i.alternate)&&xb(i,s)}function Sb(i){if(i.tag===13||i.tag===31){var s=Gs(i,67108864);s!==null&&xi(s,i,67108864),qf(i,67108864)}}function wb(i){if(i.tag===13||i.tag===31){var s=Li();s=Zt(s);var l=Gs(i,s);l!==null&&xi(l,i,s),qf(i,s)}}var Tu=!0;function XC(i,s,l,u){var g=N.T;N.T=null;var v=$.p;try{$.p=2,Wf(i,s,l,u)}finally{$.p=v,N.T=g}}function ZC(i,s,l,u){var g=N.T;N.T=null;var v=$.p;try{$.p=8,Wf(i,s,l,u)}finally{$.p=v,N.T=g}}function Wf(i,s,l,u){if(Tu){var g=Kf(u);if(g===null)Nf(i,s,u,Mu,l),Eb(i,u);else if(QC(g,i,s,l,u))u.stopPropagation();else if(Eb(i,u),s&4&&-1<JC.indexOf(i)){for(;g!==null;){var v=Ee(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var T=yn(v.pendingLanes);if(T!==0){var B=v;for(B.pendingLanes|=2,B.entangledLanes|=2;T;){var te=1<<31-$e(T);B.entanglements[1]|=te,T&=~te}_r(v),(zt&6)===0&&(uu=Te()+500,hl(0))}}break;case 31:case 13:B=Gs(v,2),B!==null&&xi(B,v,2),du(),qf(v,2)}if(v=Kf(u),v===null&&Nf(i,s,u,Mu,l),v===g)break;g=v}g!==null&&u.stopPropagation()}else Nf(i,s,u,null,l)}}function Kf(i){return i=_t(i),Gf(i)}var Mu=null;function Gf(i){if(Mu=null,i=ne(i),i!==null){var s=o(i);if(s===null)i=null;else{var l=s.tag;if(l===13){if(i=c(s),i!==null)return i;i=null}else if(l===31){if(i=f(s),i!==null)return i;i=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Mu=i,null}function kb(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(gt()){case le:return 2;case be:return 8;case Se:case Q:return 32;case ge:return 268435456;default:return 32}default:return 32}}var Yf=!1,ws=null,ks=null,Es=null,vl=new Map,yl=new Map,Cs=[],JC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Eb(i,s){switch(i){case"focusin":case"focusout":ws=null;break;case"dragenter":case"dragleave":ks=null;break;case"mouseover":case"mouseout":Es=null;break;case"pointerover":case"pointerout":vl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":yl.delete(s.pointerId)}}function bl(i,s,l,u,g,v){return i===null||i.nativeEvent!==v?(i={blockedOn:s,domEventName:l,eventSystemFlags:u,nativeEvent:v,targetContainers:[g]},s!==null&&(s=Ee(s),s!==null&&Sb(s)),i):(i.eventSystemFlags|=u,s=i.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),i)}function QC(i,s,l,u,g){switch(s){case"focusin":return ws=bl(ws,i,s,l,u,g),!0;case"dragenter":return ks=bl(ks,i,s,l,u,g),!0;case"mouseover":return Es=bl(Es,i,s,l,u,g),!0;case"pointerover":var v=g.pointerId;return vl.set(v,bl(vl.get(v)||null,i,s,l,u,g)),!0;case"gotpointercapture":return v=g.pointerId,yl.set(v,bl(yl.get(v)||null,i,s,l,u,g)),!0}return!1}function Cb(i){var s=ne(i.target);if(s!==null){var l=o(s);if(l!==null){if(s=l.tag,s===13){if(s=c(l),s!==null){i.blockedOn=s,hr(i.priority,function(){wb(l)});return}}else if(s===31){if(s=f(l),s!==null){i.blockedOn=s,hr(i.priority,function(){wb(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Au(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var l=Kf(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);et=u,l.target.dispatchEvent(u),et=null}else return s=Ee(l),s!==null&&Sb(s),i.blockedOn=l,!1;s.shift()}return!0}function Tb(i,s,l){Au(i)&&l.delete(s)}function e2(){Yf=!1,ws!==null&&Au(ws)&&(ws=null),ks!==null&&Au(ks)&&(ks=null),Es!==null&&Au(Es)&&(Es=null),vl.forEach(Tb),yl.forEach(Tb)}function Ru(i,s){i.blockedOn===s&&(i.blockedOn=null,Yf||(Yf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,e2)))}var Nu=null;function Mb(i){Nu!==i&&(Nu=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nu===i&&(Nu=null);for(var s=0;s<i.length;s+=3){var l=i[s],u=i[s+1],g=i[s+2];if(typeof u!="function"){if(Gf(u||l)===null)continue;break}var v=Ee(l);v!==null&&(i.splice(s,3),s-=3,Wd(v,{pending:!0,data:g,method:l.method,action:u},u,g))}}))}function ro(i){function s(te){return Ru(te,i)}ws!==null&&Ru(ws,i),ks!==null&&Ru(ks,i),Es!==null&&Ru(Es,i),vl.forEach(s),yl.forEach(s);for(var l=0;l<Cs.length;l++){var u=Cs[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<Cs.length&&(l=Cs[0],l.blockedOn===null);)Cb(l),l.blockedOn===null&&Cs.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var g=l[u],v=l[u+1],T=g[Dn]||null;if(typeof v=="function")T||Mb(l);else if(T){var B=null;if(v&&v.hasAttribute("formAction")){if(g=v,T=v[Dn]||null)B=T.formAction;else if(Gf(g)!==null)continue}else B=T.action;typeof B=="function"?l[u+1]=B:(l.splice(u,3),u-=3),Mb(l)}}}function Ab(){function i(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(T){return g=T})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,g=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function Vf(i){this._internalRoot=i}Ou.prototype.render=Vf.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var l=s.current,u=Li();bb(l,u,i,s,null,null)},Ou.prototype.unmount=Vf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;bb(i.current,2,null,i,null,null),du(),s[dr]=null}};function Ou(i){this._internalRoot=i}Ou.prototype.unstable_scheduleHydration=function(i){if(i){var s=es();i={blockedOn:null,target:i,priority:s};for(var l=0;l<Cs.length&&s!==0&&s<Cs[l].priority;l++);Cs.splice(l,0,i),l===0&&Cb(i)}};var Rb=t.version;if(Rb!=="19.2.7")throw Error(r(527,Rb,"19.2.7"));$.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=d(s),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var t2={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Du=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Du.isDisabled&&Du.supportsFiber)try{Be=Du.inject(t2),Ue=Du}catch{}}return Sl.createRoot=function(i,s){if(!a(i))throw Error(r(299));var l=!1,u="",g=jv,v=Iv,T=Pv;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(T=s.onRecoverableError)),s=vb(i,1,!1,null,null,l,u,null,g,v,T,Ab),i[dr]=s.current,Rf(i),new Vf(s)},Sl.hydrateRoot=function(i,s,l){if(!a(i))throw Error(r(299));var u=!1,g="",v=jv,T=Iv,B=Pv,te=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(T=l.onCaughtError),l.onRecoverableError!==void 0&&(B=l.onRecoverableError),l.formState!==void 0&&(te=l.formState)),s=vb(i,1,!0,s,l??null,u,g,te,v,T,B,Ab),s.context=yb(null),l=s.current,u=Li(),u=Zt(u),g=hs(u),g.callback=null,ds(l,g,u),l=u,s.current.lanes=l,Ot(s,l),_r(s),i[dr]=s.current,Rf(i),new Ou(s)},Sl.version="19.2.7",Sl}var Ub;function h2(){if(Ub)return Jf.exports;Ub=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jf.exports=u2(),Jf.exports}var d2=h2();const f2=cc(d2);async function bt(e,t){const n=await fetch(e,t);if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`${e} ${n.status}: ${r.slice(0,200)}`)}return await n.json()}const Me={logs:(e={})=>bt(`/logs?${new URLSearchParams(Object.entries(e).filter(([,t])=>t!==void 0&&t!=="").map(([t,n])=>[t,String(n)])).toString()}`),logsSince:(e,t={})=>bt(`/logs/since?${new URLSearchParams([["offset",String(e)],...Object.entries(t).filter(([,n])=>n!==void 0&&n!=="").map(([n,r])=>[n,String(r)])]).toString()}`),browserRestart:async e=>{const t=await fetch(`/browser/${encodeURIComponent(e)}/restart`,{method:"POST"}),n=await t.json();if(!t.ok)throw new Error(n.error??`HTTP ${t.status}`)},browserStatus:()=>bt("/browser/status"),browserControl:async(e,t,n)=>{const r=await fetch(`/browser/${encodeURIComponent(e)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:t,...n?{handoffId:n}:{}})});if(!r.ok)throw new Error((await r.json().catch(()=>({}))).error??`control ${r.status}`);return await r.json()},persona:e=>bt(`/agents/${encodeURIComponent(e)}/persona`),personaSave:async(e,t,n,r)=>{const a=await fetch(`/agents/${encodeURIComponent(e)}/persona/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,baseHash:r})});if(!a.ok){const o=await a.json().catch(()=>({})),c=new Error(o.error??`PUT persona ${a.status}`);throw c.status=a.status,c.currentContent=o.currentContent,c}return await a.json()},promptPreview:(e,t="main")=>bt(`/agents/${encodeURIComponent(e)}/prompt-preview?session=${encodeURIComponent(t)}`),voiceInstructions:(e,t="main")=>bt(`/voice/instructions?agent=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}`),teamGet:()=>bt("/team"),teamPreview:(e,t)=>bt("/team/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,agent:t})}),teamInit:async e=>bt("/team/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?{principal:e}:{})}),teamSave:async e=>{const t=await fetch("/team",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({})),r=new Error(n.error??`PUT /team ${t.status}`);throw r.issues=n.issues??[],r}return await t.json()},version:()=>bt("/version"),configStatus:()=>bt("/config/status"),reloadConfig:async()=>{const e=await fetch("/config/reload",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok?{ok:!0,changed:t.changed??[],restartRequired:t.restartRequired??[]}:{ok:!1,changed:[],restartRequired:[],error:t.error??`reload ${e.status}`}},restartServer:async()=>{const e=await fetch("/server/restart",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok?{ok:!0,expectedDowntimeSeconds:t.expectedDowntimeSeconds}:{ok:!1,error:t.error??`restart ${e.status}`}},hostStats:()=>bt("/host-stats"),agents:()=>bt("/agents"),tmuxSessions:()=>bt("/tmux/sessions").then(e=>e.sessions),sessions:e=>bt(`/agents/${encodeURIComponent(e)}/sessions`),loopState:()=>bt("/dream/loop-state"),dreamStates:()=>bt("/dream-states"),models:()=>bt("/models"),sessionModel:(e,t)=>bt(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/model`),setSessionModel:async(e,t,n)=>{const r=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/model`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:n})});if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`set-model ${r.status}: ${a.slice(0,200)}`)}},createSession:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:t})});if(n.status===409){const r=await n.json().catch(()=>({}));if(r.id)return{id:r.id,slug:r.slug??t}}if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`create-session ${n.status}: ${r.slice(0,200)}`)}return await n.json()},resetSession:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/reset`,{method:"POST"});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`reset ${n.status}: ${r.slice(0,200)}`)}return await n.json()},sessionThinking:(e,t)=>bt(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/thinking`),setSessionThinking:async(e,t,n)=>{const r=`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/thinking`,a=n==="default"?await fetch(r,{method:"DELETE"}):await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({level:n})});if(!a.ok){const o=await a.text().catch(()=>"");throw new Error(`set-thinking ${a.status}: ${o.slice(0,200)}`)}},sessionSampling:(e,t)=>bt(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/sampling`),setSessionSampling:async(e,t,n)=>{const r=`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/sampling`,a=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok){const o=await a.text().catch(()=>"");throw new Error(`set-sampling ${a.status}: ${o.slice(0,200)}`)}},clearSessionSampling:async(e,t)=>{const n=`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/sampling`,r=await fetch(n,{method:"DELETE"});if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`clear-sampling ${r.status}: ${a.slice(0,200)}`)}},history:(e,t,n)=>{const r=new URLSearchParams({agent:e,session:t});return(n==null?void 0:n.limit)!==void 0&&r.set("limit",String(n.limit)),(n==null?void 0:n.before)!==void 0&&r.set("before",String(n.before)),bt(`/chat/history?${r.toString()}`,n!=null&&n.signal?{signal:n.signal}:void 0)},dequeue:async e=>{const t=await fetch(`/chat/queue/${encodeURIComponent(e)}`,{method:"DELETE"});if(t.status===409)return{ok:!1,reason:"already_started"};if(t.status===404)return{ok:!1,reason:"unknown"};if(!t.ok)throw new Error(`dequeue failed: HTTP ${t.status}`);const n=await t.json();return{ok:!0,...n.kind?{kind:n.kind}:{},text:n.text??"",attachments:n.attachments??[]}},builderSession:(e,t,n)=>bt(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/builder`,n?{signal:n}:void 0),patchBuilder:async(e,t,n)=>{const r=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/builder`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`builder ${r.status}: ${(await r.text().catch(()=>"")).slice(0,200)}`);return await r.json()},builderGo:async(e,t,n)=>{const r=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/builder/go`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n?{note:n}:{})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`builder/go ${r.status}`)}return await r.json()},answerQuestion:async(e,t,n,r,a)=>{const o=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({questionId:n,answers:r,...a?{text:a}:{}})});if(!o.ok)throw new Error(`answer ${o.status}: ${(await o.text().catch(()=>"")).slice(0,200)}`)},sessionWork:(e,t,n)=>bt(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/work`,n?{signal:n}:void 0),send:async(e,t,n,r,a,o)=>{const c=await fetch("/chat/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:e,session:t,text:n,...o?{steer:!0}:{},...r&&r.length>0?{attachments:r.map(({hash:p,name:d,mime:m,size:_})=>({hash:p,name:d,mime:m,size:_}))}:{},...(a==null?void 0:a.inputModality)==="voice"?{input_modality:"voice"}:{},...a!=null&&a.sttProvider?{stt_provider:a.sttProvider}:{},...a!=null&&a.autoPlayRequested?{auto_play_requested:!0}:{}})});if(!c.ok){const p=await c.text().catch(()=>"");throw new Error(`chat/send ${c.status}: ${p.slice(0,200)}`)}const f=await c.json().catch(()=>({}));return{turnId:typeof f.turnId=="string"?f.turnId:"",steered:f.steered===!0,...typeof f.steerId=="string"?{steerId:f.steerId}:{}}},uploadAttachment:async e=>{const t=await fetch("/attachments",{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream","X-Somora-Filename":encodeURIComponent(e.name)},body:e});if(!t.ok){const n=await t.text().catch(()=>"");let r=n.slice(0,300);try{const a=JSON.parse(n);a.error&&(r=a.error)}catch{}throw new Error(`attachments ${t.status}: ${r}`)}return await t.json()},cancelSpawn:async e=>{const t=await fetch("/spawn-cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({task_id:e})});return t.ok?{ok:!0}:{ok:!1,error:(await t.json().catch(()=>({}))).error??`spawn-cancel ${t.status}`}},abort:async(e,t)=>{let n;try{n=await fetch(`/chat/abort?agent=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}`,{method:"POST"})}catch(r){throw new Error(`abort request failed: ${r instanceof Error?r.message:String(r)}`)}if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`abort ${n.status}${r?`: ${r.slice(0,200)}`:""}`)}return await n.json()},streamUrl:(e,t)=>`/chat/stream?agent=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}`,globalSessions:e=>{const t=e!=null&&e.includeArchived?"?include_archived=true":"";return bt(`/sessions${t}`,e!=null&&e.signal?{signal:e.signal}:void 0).then(n=>n.sessions)},archiveSession:async(e,t,n)=>{const r=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/archive`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n?{reason:n}:{})});if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`archive ${r.status}: ${a.slice(0,200)}`)}},unarchiveSession:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/unarchive`,{method:"POST"});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`unarchive ${n.status}: ${r.slice(0,200)}`)}},sessionExportUrl:(e,t,n)=>`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/export?format=${n}`,projectsFeature:async()=>{try{const e=await fetch("/projects/feature");return e.ok?await e.json():{enabled:!1,entityCount:0}}catch{return{enabled:!1,entityCount:0}}},projectEntities:async()=>{const e=await fetch("/projects/entities");return e.ok?(await e.json()).entities??[]:[]},projects:async(e=!1)=>{const n=await fetch(e?"/projects?includeArchived=true":"/projects");return n.ok?(await n.json()).projects??[]:[]},sessionProject:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/project`);return n.ok?await n.json():{agent:e,session:t,slug:null,project:null}},setSessionProject:async(e,t,n)=>{const r=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:n})});if(!r.ok){const a=await r.text().catch(()=>"");throw new Error(`set-project ${r.status}: ${a.slice(0,200)}`)}},clearSessionProject:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/project`,{method:"DELETE"});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(`clear-project ${n.status}: ${r.slice(0,200)}`)}},sentinelList:e=>{const t=new URLSearchParams;e!=null&&e.owner&&t.set("owner",e.owner),e!=null&&e.status&&t.set("status",e.status);const n=t.toString()?`?${t.toString()}`:"";return bt(`/sentinel/triggers${n}`)},sentinelGet:e=>bt(`/sentinel/triggers/${encodeURIComponent(e)}`).then(t=>t.trigger),sentinelHistory:(e,t=50)=>bt(`/sentinel/triggers/${encodeURIComponent(e)}/history?limit=${t}`).then(n=>n.entries),sentinelPause:async e=>{const t=await fetch(`/sentinel/triggers/${encodeURIComponent(e)}/pause`,{method:"POST"});if(!t.ok)throw new Error(`sentinel pause ${t.status}`)},sentinelResume:async e=>{const t=await fetch(`/sentinel/triggers/${encodeURIComponent(e)}/resume`,{method:"POST"});if(!t.ok)throw new Error(`sentinel resume ${t.status}`)},sentinelDelete:async e=>{const t=await fetch(`/sentinel/triggers/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`sentinel delete ${t.status}`)},sentinelTest:async e=>{const t=await fetch(`/sentinel/triggers/${encodeURIComponent(e)}/test`,{method:"POST"});if(!t.ok)throw new Error(`sentinel test ${t.status}`)},imagesStatus:()=>bt("/images/status"),imageCapabilities:e=>bt(`/images/models/${encodeURIComponent(e)}/capabilities`),imageCatalog:e=>bt(e?`/images/catalog?provider=${encodeURIComponent(e)}`:"/images/catalog"),images:(e={})=>{const t=new URLSearchParams;for(const[r,a]of Object.entries(e))a!==void 0&&a!==""&&t.set(r,String(a));const n=t.toString();return bt(`/images${n?`?${n}`:""}`)},generateImage:async e=>{const t=await fetch("/images/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error(n.error??`image generation failed (${t.status})`);return n},forgetImage:async e=>{const t=await fetch(`/media/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`forget item ${t.status}`)},media:(e={})=>{const t=new URLSearchParams;for(const[r,a]of Object.entries(e))a!==void 0&&a!==""&&t.set(r,String(a));const n=t.toString();return bt(`/media${n?`?${n}`:""}`)},videoStatus:()=>bt("/video/status"),generateVideo:async e=>{const t=await fetch("/video/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.job)throw new Error(n.error??`video generation failed (${t.status})`);return{job:n.job}},wikiStatus:()=>bt("/wiki/status"),wikiTree:()=>bt("/wiki/tree"),wikiPage:e=>bt(`/wiki/page?slug=${encodeURIComponent(e)}`),wikiGraph:(e,t)=>bt(e==="global"?"/wiki/graph?scope=global":`/wiki/graph?scope=local&slug=${encodeURIComponent(t??"")}`),wikiRefresh:async()=>{const e=await fetch("/wiki/refresh",{method:"POST"});if(!e.ok)throw new Error(`wiki refresh ${e.status}`)},agentTools:e=>bt(`/agents/${encodeURIComponent(e)}/tools`),setAgentTools:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/tools`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`set agent tools ${n.status}`)},agentSkills:e=>bt(`/agents/${encodeURIComponent(e)}/skills`),setAgentSkills:async(e,t)=>{const n=await fetch(`/agents/${encodeURIComponent(e)}/skills`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`set agent skills ${n.status}`)},mcpStatus:async()=>{const e=await fetch("/mcp/status");if(e.status===503)return{enabled:!1,servers:{}};if(!e.ok)throw new Error(`mcp status ${e.status}`);return await e.json()},mcpReconnect:async e=>{const t=await fetch(`/mcp/servers/${encodeURIComponent(e)}/reconnect`,{method:"POST"});if(!t.ok)throw new Error(`mcp reconnect ${t.status}`)}},p2={"codex-cli":{todo_list:"plan",model_switch:"model switch",thread_recreated:"thread recreated",tools_changed:"tools changed",contextCompaction:"codex compaction",error:"codex error",reconnecting:"reconnecting",transport_fallback:"transport fallback"},somora:{session_model:"model switched"},"openai-compatible":{context_compacted:"context compacted",doom_loop_notice:"loop noticed",doom_loop_stop:"loop stopped"}};function g2(e,t){var n;return((n=p2[e])==null?void 0:n[t])??t}function Lx(e){if(!e||typeof e!="object")return null;const t=e.items;if(!Array.isArray(t))return null;const n=[];for(const r of t){if(!r||typeof r!="object")continue;const a=r,o=typeof a.text=="string"?a.text:typeof a.content=="string"?a.content:"";if(!o)continue;let c;typeof a.status=="string"&&(a.status==="in_progress"||a.status==="completed"||a.status==="cancelled"||a.status==="pending")?c=a.status:typeof a.completed=="boolean"?c=a.completed?"completed":"pending":c="pending",n.push({content:o,status:c})}return n}function m2(e){const t=e.length;if(t===0)return"plan cleared";let n=0,r=0;for(const o of e)o.status==="completed"?n+=1:o.status==="in_progress"&&(r+=1);const a=[`${t} task${t===1?"":"s"}`];return n>0&&a.push(`${n} done`),r>0&&a.push(`${r} in progress`),a.join(" · ")}let _2=0;function Bs(e){return`${e}-${Date.now()}-${++_2}`}function v2(e){return e.startsWith("image/")?"image":e==="application/pdf"?"pdf":"text"}function zx(e,t){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r&&!(r.role!=="assistant"&&r.role!=="error")){if(t===void 0)return r.role==="assistant"?n:-1;if(r.turnId===t)return n}}return-1}function Bx(e,t,n,r){const a=zx(e,t),o=e.slice();if(a>=0){const c=o[a];if(c&&(c.role==="assistant"||c.role==="error"))return o[a]={...c,media:n},o}return o.push({id:Bs("h-media"),role:"assistant",ts:r,text:"",media:n,...t?{turnId:t}:{}}),o}function np(e){let t=[],n=null,r,a=null;for(const o of e){if(o.kind==="turn_start"){r=typeof o.turnId=="string"?o.turnId:void 0,a=null;continue}if(o.kind==="turn_end"){typeof o.turnId=="string"&&(r=o.turnId),a=null;continue}if(o.kind==="thinking_message"){typeof o.text=="string"&&o.text.length>0&&(a={text:o.text,...o.truncated?{truncated:!0}:{}});continue}if(o.kind==="model_fallback"){typeof o.requested=="string"&&typeof o.actual=="string"&&(n={requested:o.requested,actual:o.actual,reason:o.reason??""});continue}if(o.kind==="error"){t.push({id:Bs("h-err"),role:"error",ts:o.ts,text:typeof o.message=="string"?o.message:"turn failed",...r?{turnId:r}:{}});continue}if(o.kind==="assistant_message"&&typeof o.text=="string"){t.push({id:Bs("h-am"),role:"assistant",ts:o.ts,text:o.text,...r?{turnId:r}:{},...n?{fallback:n}:{},...a?{thinking:a}:{}}),n=null,a=null;continue}if(o.kind==="assistant_media"&&Array.isArray(o.media)&&o.media.length>0){t=Bx(t,typeof o.turnId=="string"?o.turnId:r,o.media,o.ts);continue}if(o.kind==="assistant_audio"&&o.audio){const c=zx(t,typeof o.turnId=="string"?o.turnId:r),f=c>=0?t[c]:void 0;f&&f.role==="assistant"&&(t[c]={...f,audio:{url:o.audio.url,mime:o.audio.mime,...o.audio.durationMs!==void 0?{durationMs:o.audio.durationMs}:{},cacheKey:o.audio.cacheKey}});continue}t.push(...y2(o))}return t}function y2(e){var t,n,r;if(e.kind==="user_message"&&typeof e.text=="string")return[{id:Bs("h-um"),role:"user",ts:e.ts,text:e.text,...e.from_agent?{fromAgent:e.from_agent}:{},...e.from_agent&&e.from_session?{fromSession:e.from_session}:{},...e.from_system?{fromSystem:e.from_system}:{},...e.origin?{origin:e.origin}:{},...((t=e.input)==null?void 0:t.modality)==="voice"?{inputModality:"voice"}:{},...((n=e.input)==null?void 0:n.source)==="realtime"||((r=e.input)==null?void 0:r.source)==="stt"?{voiceSource:e.input.source}:{},...e.attachments&&e.attachments.length>0?{attachments:e.attachments.map(a=>({hash:a.hash,name:a.name,mime:a.mime,size:a.size,kind:v2(a.mime)}))}:{}}];if(e.kind==="assistant_message"&&typeof e.text=="string")return[{id:Bs("h-am"),role:"assistant",ts:e.ts,text:e.text}];if(e.kind==="tool_call"&&e.tool)return[{id:Bs("h-tc"),role:"tool_call",ts:e.ts,toolCall:{tool:e.tool,...e.callId?{callId:e.callId}:{},...e.input?{input:e.input}:{}}}];if(e.kind==="tool_result"&&e.callId)return[{id:Bs("h-tr"),role:"tool_result",ts:e.ts,toolResult:{tool:"?",callId:e.callId,...e.output!==void 0?{output:e.output}:{}}}];if(e.kind==="engine_meta"&&typeof e.itemType=="string"){const a=e.engine??"unknown",o=g2(a,e.itemType);let c;if(a==="codex-cli"&&e.itemType==="todo_list"){const f=Lx(e.payload);f&&(c=m2(f))}return[{id:Bs("h-em"),role:"engine_meta",ts:e.ts,meta:{engine:a,itemType:e.itemType,label:o,...c?{summary:c}:{},payload:e.payload}}]}return[]}function Hb(e,t){const n=e.length>0?e[e.length-1].ts:0;return[...e,...t.filter(r=>r.ts>n)]}let b2=0;function zi(e){return`${e}-${Date.now()}-${++b2}`}const Wn=(e,t)=>`${e}::${t}`,Yp={streaming:!1,thinking:!1,loading:!1,connected:!1,usage:null,memory:null,project:null,lastFallback:null,primaryRestored:null},jx=x.createContext({projectsEnabled:null,subscribe:()=>()=>{},getMessages:()=>[],getStream:()=>Yp,subscribeSession:()=>()=>{},getSessionVersion:()=>0,send:async()=>{},subscribeAudio:()=>()=>{},subscribeTurnEvents:()=>()=>{},abort:async()=>({aborted:!1}),recall:async()=>null,loadOlder:async()=>!1,getHasMore:()=>!1,clearMessages:()=>{},refreshProject:async()=>{}}),$b=100,x2=100,Fb=400,S2=300,w2=1e3,Ix=x.createContext([]);function So(){return x.useContext(jx)}function k2(){return x.useContext(Ix)}function E2({children:e}){const[t,n]=x.useState({}),r=x.useRef(t);r.current=t;const[a,o]=x.useState({}),c=x.useRef(a);c.current=a;const f=x.useRef(new Map),p=x.useRef(new Map),d=x.useCallback(V=>{var ce;p.current.set(V,(p.current.get(V)??0)+1),(ce=f.current.get(V))==null||ce.forEach(X=>X())},[]),[m,_]=x.useState(null);x.useEffect(()=>{let V=!1;return Me.projectsFeature().then(ce=>{V||_(ce.enabled)}),()=>{V=!0}},[]);const y=x.useRef(new Map),b=x.useRef(new Map),w=x.useRef(new Map),S=x.useRef(new Map),C=x.useRef(new Map),k=x.useRef(new Map),j=x.useCallback((V,ce)=>{var X;(X=k.current.get(V))==null||X.forEach(fe=>fe(ce))},[]),R=x.useRef(new Map),L=x.useRef(new Map),q=x.useRef(new Map),[O,z]=x.useState(0),J=x.useRef(new Map),ie=x.useRef(new Map),D=x.useCallback((V,ce)=>{o(X=>{const fe=X[V]??Yp,Le={...fe,...ce};let Ge=!1;for(const Te of Object.keys(ce))if(fe[Te]!==Le[Te]){Ge=!0;break}return Ge?{...X,[V]:Le}:X})},[]),A=x.useCallback((V,ce)=>{n(X=>({...X,[V]:[...X[V]??[],ce]}))},[]),M=x.useCallback((V,ce)=>{const X=w.current.get(V);n(fe=>{const Le=fe[V]??[];if(!X)return{...fe,[V]:[...Le,ce]};const Ge=Le.findIndex(gt=>gt.id===X);if(Ge<0)return{...fe,[V]:[...Le,ce]};const Te=Le.slice();return Te.splice(Ge,0,ce),{...fe,[V]:Te}})},[]),P=x.useCallback((V,ce,X)=>{n(fe=>{const Le=fe[V];if(!Le)return fe;const Ge=Le.map(Te=>Te.id===ce&&Te.role==="assistant"?{...Te,...X}:Te);return{...fe,[V]:Ge}})},[]),G=x.useRef(new Set),H=x.useCallback((V,ce)=>{var Le,Ge;const X=Wn(V,ce),fe=y.current.get(X);!fe||!fe.loaded||(((Le=r.current[X])==null?void 0:Le.length)??0)<=Fb||(Ge=c.current[X])!=null&&Ge.streaming||G.current.has(X)||(G.current.add(X),Me.history(V,ce,{limit:S2,signal:fe.ac.signal}).then(Te=>{var gt;y.current.get(X)&&((gt=c.current[X])!=null&>.streaming||(n(le=>({...le,[X]:Hb(np(Te.events),le[X]??[])})),q.current.set(X,{hasMore:!!Te.hasMore,oldestTs:typeof Te.oldestTs=="number"?Te.oldestTs:null,inFlight:!1}),z(le=>le+1)))}).catch(Te=>{Te.name!=="AbortError"&&console.warn("[somora-web] row compaction failed",X,Te.message)}).finally(()=>G.current.delete(X)))},[]),N=x.useCallback((V,ce)=>{var fe;const X=Wn(V,ce);(((fe=r.current[X])==null?void 0:fe.length)??0)<=Fb||setTimeout(()=>H(V,ce),w2)},[H]),$=x.useCallback((V,ce)=>{const X=Wn(V,ce),fe=y.current.get(X);if(fe){fe.refs+=1;return}const Le=new EventSource(Me.streamUrl(V,ce)),Ge=new AbortController;y.current.set(X,{es:Le,refs:1,loaded:!1,ac:Ge}),b.current.set(X,Date.now());const Te=()=>b.current.set(X,Date.now());D(X,{connected:!1,loading:!0});const gt=Se=>{n(Q=>({...Q,[X]:Hb(np(Se),Q[X]??[])}))};Me.history(V,ce,{limit:$b,signal:Ge.signal}).then(Se=>{const Q=y.current.get(X);Q&&(Q.loaded=!0,gt(Se.events),typeof Se.oldestTs=="number"?q.current.set(X,{hasMore:!!Se.hasMore,oldestTs:Se.oldestTs,inFlight:!1}):q.current.set(X,{hasMore:!1,oldestTs:null,inFlight:!1}),z(ge=>ge+1),D(X,{loading:!1}))}).catch(Se=>{Se.name!=="AbortError"&&(D(X,{loading:!1}),console.warn("[somora-web] history load failed",X,Se.message))}),Me.sessionProject(V,ce).then(Se=>{y.current.get(X)&&D(X,{project:Se.project})}).catch(()=>{});function le(Se){try{return JSON.parse(Se.data)}catch{return null}}let be=!1;Le.addEventListener("open",()=>{if(Te(),D(X,{connected:!0}),!be){be=!0;return}Me.history(V,ce,{limit:$b,signal:Ge.signal}).then(Se=>{y.current.get(X)&>(Se.events)}).catch(()=>{})}),Le.addEventListener("error",()=>D(X,{connected:!1})),Le.addEventListener("heartbeat",()=>Te()),Le.addEventListener("status",Se=>{Te(),D(X,{connected:!0});const Q=le(Se);Q!=null&&Q.msg&&Q.msg!=="connected"&&console.info("[somora-web] status",X,Q.msg)}),Le.addEventListener("chat",Se=>{Te();const Q=le(Se);if(Q){if(Q.state==="delta"){D(X,{thinking:!1});let ge=w.current.get(X);const Ae=!ge;ge||(ge=zi("msg"),w.current.set(X,ge));const Ne=ge;n(Be=>{const Ue=Be[X]??[];if(Ae){const Bt=Ue.findIndex(ii=>ii.role==="user"&&ii.pending),Xn=S.current.get(X),Mn={id:Ne,role:"assistant",ts:Date.now(),text:Q.text,streaming:!0,...Xn?{turnId:Xn}:{}};if(Bt<0)return{...Be,[X]:[...Ue,Mn]};const Zn=Ue.slice();return Zn.splice(Bt,0,Mn),{...Be,[X]:Zn}}const We=Ue.findIndex(Bt=>Bt.id===Ne);if(We<0)return{...Be,[X]:[...Ue,{id:Ne,role:"assistant",ts:Date.now(),text:Q.text,streaming:!0,...S.current.has(X)?{turnId:S.current.get(X)}:{}}]};const $e=Ue.slice(),ft=$e[We];return!ft||ft.role!=="assistant"?Be:($e[We]={...ft,text:Q.text,streaming:!0},{...Be,[X]:$e})})}else if(Q.state==="final"){const ge=w.current.get(X)??zi("msg");w.current.delete(X),n(Ae=>{const Ne=Ae[X]??[],Be=Ne.findIndex(ft=>ft.id===ge),Ue=J.current.get(X);if(Be<0)return{...Ae,[X]:[...Ne,{id:ge,role:"assistant",ts:Date.now(),text:Q.text,...Ue?{fallback:Ue}:{},...S.current.has(X)?{turnId:S.current.get(X)}:{}}]};const We=Ne.slice(),$e=We[Be];return!$e||$e.role!=="assistant"?Ae:(We[Be]={...$e,text:Q.text,streaming:!1,...Ue?{fallback:Ue}:{}},{...Ae,[X]:We})})}}}),Le.addEventListener("thinking",Se=>{Te();const Q=le(Se);if(!Q||typeof Q.text!="string")return;const ge=Q.state==="final"?{text:Q.text,streaming:!1,...Q.truncated?{truncated:!0}:{}}:{text:Q.text,streaming:!0};let Ae=w.current.get(X);const Ne=!Ae;Ae||(Ae=zi("msg"),w.current.set(X,Ae));const Be=Ae;n(Ue=>{const We=Ue[X]??[],$e=We.findIndex(Xn=>Xn.id===Be);if($e<0){const Xn=S.current.get(X),Mn={id:Be,role:"assistant",ts:Date.now(),text:"",streaming:!0,thinking:ge,...Xn?{turnId:Xn}:{}},Zn=Ne?We.findIndex(yn=>yn.role==="user"&&yn.pending):-1;if(Zn<0)return{...Ue,[X]:[...We,Mn]};const ii=We.slice();return ii.splice(Zn,0,Mn),{...Ue,[X]:ii}}const ft=We[$e];if(!ft||ft.role!=="assistant")return Ue;const Bt=We.slice();return Bt[$e]={...ft,thinking:ge},{...Ue,[X]:Bt}})}),Le.addEventListener("model_fallback",Se=>{Te();const Q=le(Se);if(!Q||typeof Q.actual!="string")return;J.current.set(X,Q);const ge=w.current.get(X);ge&&n(Ae=>{const Ne=Ae[X];if(!Ne)return Ae;const Be=Ne.findIndex($e=>$e.id===ge),Ue=Be>=0?Ne[Be]:void 0;if(!Ue||Ue.role!=="assistant")return Ae;const We=Ne.slice();return We[Be]={...Ue,fallback:Q},{...Ae,[X]:We}})}),Le.addEventListener("agent",Se=>{Te();const Q=le(Se);if(Q){if(Q.phase==="start")D(X,{streaming:!0,thinking:!0,primaryRestored:null});else if(Q.phase==="end"){j(X,"turn_end");const ge=Q.fallback??J.current.get(X)??null;J.current.delete(X);const Ae=ie.current.get(X)??null;ie.current.set(X,ge),D(X,{streaming:!1,thinking:!1,...Q.usage?{usage:{...Q.usage,...Q.contextWindow?{contextWindow:Q.contextWindow}:{}}}:{},lastFallback:ge,primaryRestored:!ge&&Ae?Ae.requested:null}),n(Ne=>{const Be=Ne[X];if(!Be)return Ne;let Ue=!1;const We=Be.map($e=>{var ft,Bt;return $e.role==="assistant"&&($e.streaming||(ft=$e.thinking)!=null&&ft.streaming)?(Ue=!0,{...$e,streaming:!1,...(Bt=$e.thinking)!=null&&Bt.streaming?{thinking:{...$e.thinking,streaming:!1}}:{}}):$e});if(ge)for(let $e=We.length-1;$e>=0;$e-=1){const ft=We[$e];if(ft&&ft.role==="assistant"){ft.fallback||(We[$e]={...ft,fallback:ge},Ue=!0);break}}return Ue?{...Ne,[X]:We}:Ne}),w.current.delete(X),N(V,ce),Me.sessionProject(V,ce).then(Ne=>D(X,{project:Ne.project})).catch(()=>{})}}}),Le.addEventListener("session_model",()=>{Te(),j(X,"session_model")}),Le.addEventListener("project",()=>{Te(),Me.sessionProject(V,ce).then(Se=>D(X,{project:Se.project})).catch(()=>{})}),Le.addEventListener("memory",Se=>{Te();const Q=le(Se);if(!Q)return;const ge={count:Q.count,topScore:Q.topScore??null,refs:Q.refs,...Q.fullText!==void 0?{fullText:Q.fullText}:{}};D(X,{memory:ge}),M(X,{id:zi("mi"),role:"memory_inject",ts:Date.now(),memory:ge})}),Le.addEventListener("tool",Se=>{Te();const Q=le(Se);Q&&(Q.phase==="call"?M(X,{id:zi("tc"),role:"tool_call",ts:Date.now(),toolCall:{tool:Q.tool,...Q.summary?{summary:Q.summary}:{},...Q.details?{details:Q.details}:{}}}):Q.phase==="result"?M(X,{id:zi("tr"),role:"tool_result",ts:Date.now(),toolResult:{tool:Q.tool,...Q.summary?{summary:Q.summary}:{},...Q.details?{details:Q.details}:{}}}):Q.phase==="error"&&M(X,{id:zi("tr"),role:"tool_result",ts:Date.now(),toolResult:{tool:Q.tool,error:Q.error??"tool failed"}}))}),Le.addEventListener("engine_meta",Se=>{Te();const Q=le(Se);Q&&M(X,{id:zi("em"),role:"engine_meta",ts:Date.now(),meta:{engine:Q.engine,itemType:Q.itemType,label:Q.label,...Q.summary?{summary:Q.summary}:{},payload:Q.payload}})}),Le.addEventListener("assistant_media",Se=>{Te();const Q=le(Se);!Q||!Array.isArray(Q.media)||Q.media.length===0||n(ge=>{const Ae=ge[X]??[],Ne=Bx(Ae,Q.turnId,Q.media,Date.now());if(Ne.length>Ae.length){const Be=Ne[Ne.length-1],Ue=Ne.slice(0,-1),We=Ue.findIndex($e=>$e.role==="user"&&$e.pending);return We>=0?Ue.splice(We,0,Be):Ue.push(Be),{...ge,[X]:Ue}}return{...ge,[X]:Ne}})}),Le.addEventListener("turn_started",Se=>{Te();const Q=le(Se);if(!Q||typeof Q.turnId!="string")return;j(X,"turn_started"),S.current.set(X,Q.turnId);const ge=w.current.get(X);ge&&n(Ae=>{const Ne=Ae[X];if(!Ne)return Ae;const Be=Ne.findIndex($e=>$e.id===ge),Ue=Be>=0?Ne[Be]:void 0;if(!Ue||Ue.role!=="assistant"||Ue.turnId===Q.turnId)return Ae;const We=Ne.slice();return We[Be]={...Ue,turnId:Q.turnId},{...Ae,[X]:We}})}),Le.addEventListener("turn_error",Se=>{Te();const Q=le(Se);if(!Q||typeof Q.message!="string")return;const ge=Q.turnId??S.current.get(X),Ae={id:zi("err"),role:"error",ts:Date.now(),text:Q.message,...ge?{turnId:ge}:{}};n(Ne=>{const Be=Ne[X]??[],Ue=Be.findIndex($e=>$e.role==="user"&&$e.pending);if(Ue<0)return{...Ne,[X]:[...Be,Ae]};const We=Be.slice();return We.splice(Ue,0,Ae),{...Ne,[X]:We}})}),Le.addEventListener("turn_dequeued",Se=>{var ge;Te();const Q=le(Se);!Q||typeof Q.turnId!="string"||(j(X,"turn_dequeued"),(ge=L.current.get(X))==null||ge.delete(Q.turnId),n(Ae=>{const Ne=Ae[X];if(!Ne)return Ae;const Be=Ne.findIndex(We=>We.role==="user"&&We.turnId===Q.turnId);if(Be<0)return Ae;const Ue=Ne.slice();return Ue.splice(Be,1),{...Ae,[X]:Ue}}))}),Le.addEventListener("assistant_audio",Se=>{Te();const Q=le(Se);if(!Q)return;n(Ae=>{const Ne=Ae[X];if(!Ne||Ne.length===0)return Ae;let Be=-1;for(let $e=Ne.length-1;$e>=0;$e-=1){const ft=Ne[$e];if(ft&&ft.role==="assistant"){Be=$e;break}}if(Be<0)return Ae;const Ue=Ne[Be];if(!Ue||Ue.role!=="assistant")return Ae;const We=Ne.slice();return We[Be]={...Ue,audio:{url:Q.url,mime:Q.mime,...Q.durationMs!==void 0?{durationMs:Q.durationMs}:{},cacheKey:Q.cacheKey},turnId:Q.turnId},{...Ae,[X]:We}});const ge=C.current.get(X);ge==null||ge.forEach(Ae=>Ae(Q.url))}),Le.addEventListener("steer_queued",Se=>{Te();const Q=le(Se);!Q||!Q.steerId||n(ge=>{const Ae=ge[X]??[];return Ae.some(Ne=>Ne.role==="user"&&(Ne.steerId===Q.steerId||Ne.pending&&Ne.steer&&Ne.text===Q.text))?ge:{...ge,[X]:[...Ae,{id:zi("um"),role:"user",ts:Q.ts??Date.now(),text:Q.text,steer:!0,steerId:Q.steerId,pending:!0,...Q.origin?{origin:Q.origin}:{}}]}})}),Le.addEventListener("user_message",Se=>{Te();const Q=le(Se);if(Q){if(Q.steer){if(n(ge=>{const Ae=ge[X]??[];let Ne=Q.steer_id?Ae.findIndex(Be=>Be.role==="user"&&Be.steerId===Q.steer_id):-1;if(Ne<0&&(Ne=Ae.findIndex(Be=>Be.role==="user"&&Be.pending&&Be.steer&&Be.text===Q.text)),Ne>=0){const Be=Ae[Ne];if(Be.role!=="user")return ge;const{pending:Ue,queued:We,...$e}=Be,ft=Ae.slice();return ft[Ne]={...$e,steer:!0,ts:Q.ts??Be.ts},{...ge,[X]:ft}}return{...ge,[X]:[...Ae,{id:zi("um"),role:"user",ts:Q.ts??Date.now(),text:Q.text,steer:!0,...Q.steer_id?{steerId:Q.steer_id}:{},...Q.turnId?{turnId:Q.turnId}:{},...Q.from_agent?{fromAgent:Q.from_agent}:{},...Q.from_agent&&Q.from_session?{fromSession:Q.from_session}:{},...Q.origin?{origin:Q.origin}:{}}]}}),!Q.from_agent){const ge=R.current.get(X)??[],Ae=ge.indexOf(Q.text);Ae>=0&&(ge.splice(Ae,1),R.current.set(X,ge))}return}if(n(ge=>{var Ne,Be,Ue;const Ae=ge[X]??[];if(!Q.from_agent&&!Q.from_system){let We=Q.turnId?Ae.findIndex(ft=>ft.role==="user"&&ft.turnId===Q.turnId):-1;We<0&&(We=Ae.findIndex(ft=>ft.role==="user"&&ft.pending&&ft.text===Q.text));const $e=We>=0?Ae[We]:void 0;if($e&&$e.role==="user"){const{queued:ft,pending:Bt,...Xn}=$e,Mn=Ae.slice();return Mn[We]=Xn,{...ge,[X]:Mn}}}return{...ge,[X]:[...Ae,{id:zi("um"),role:"user",ts:Q.ts??Date.now(),text:Q.text,...Q.turnId?{turnId:Q.turnId}:{},...Q.from_agent?{fromAgent:Q.from_agent}:{},...Q.from_agent&&Q.from_session?{fromSession:Q.from_session}:{},...Q.from_system?{fromSystem:Q.from_system}:{},...Q.origin?{origin:Q.origin}:{},...((Ne=Q.input)==null?void 0:Ne.modality)==="voice"?{inputModality:"voice"}:{},...((Be=Q.input)==null?void 0:Be.source)==="realtime"||((Ue=Q.input)==null?void 0:Ue.source)==="stt"?{voiceSource:Q.input.source}:{}}]}}),Q.turnId){const ge=L.current.get(X);ge&&(ge.delete(Q.turnId),ge.size===0&&L.current.delete(X))}if(!Q.from_agent&&!Q.from_system){const ge=R.current.get(X)??[],Ae=ge.indexOf(Q.text);Ae>=0&&(ge.splice(Ae,1),R.current.set(X,ge))}}}),Le.addEventListener("turn_queued",Se=>{Te();const Q=le(Se);!Q||!Q.turnId||(j(X,"turn_queued"),n(ge=>{const Ae=ge[X]??[],Ne=Ae.findIndex(We=>We.role==="user"&&We.turnId===Q.turnId),Be=Ne>=0?Ae[Ne]:void 0;if(!Be||Be.role!=="user"){let We=L.current.get(X);return We||(We=new Map,L.current.set(X,We)),We.set(Q.turnId,Q.ahead),ge}const Ue=Ae.slice();return Ue[Ne]={...Be,queued:{ahead:Q.ahead}},{...ge,[X]:Ue}}))})},[D,A,M,P,N]),K=x.useCallback((V,ce)=>{const X=Wn(V,ce),fe=y.current.get(X);fe&&(fe.refs-=1,!(fe.refs>0)&&(fe.es.close(),fe.ac.abort(),y.current.delete(X),b.current.delete(X),w.current.delete(X),R.current.delete(X),L.current.delete(X),D(X,{connected:!1,streaming:!1,thinking:!1})))},[D]),re=x.useCallback((V,ce)=>{const X=Wn(V,ce),fe=y.current.get(X);if(!fe)return;const Le=fe.refs;fe.es.close(),fe.ac.abort(),y.current.delete(X),b.current.delete(X),$(V,ce);const Ge=y.current.get(X);Ge&&(Ge.refs=Le)},[$]);x.useEffect(()=>{const ce=()=>{const fe=Date.now();for(const Le of y.current.keys()){const Ge=b.current.get(Le)??0;if(fe-Ge<=45e3)continue;const Te=Le.indexOf("::");if(Te<0)continue;const gt=Le.slice(0,Te),le=Le.slice(Te+2);console.info("[somora-web] sse stale, reconnecting",Le,"gap=",fe-Ge,"ms"),re(gt,le)}},X=()=>{document.visibilityState==="visible"&&ce()};return document.addEventListener("visibilitychange",X),window.addEventListener("focus",ce),window.addEventListener("online",ce),()=>{document.removeEventListener("visibilitychange",X),window.removeEventListener("focus",ce),window.removeEventListener("online",ce)}},[re]);const U=x.useCallback((V,ce)=>($(V,ce),()=>K(V,ce)),[$,K]),W=x.useCallback((V,ce)=>r.current[Wn(V,ce)]??[],[]),I=x.useCallback((V,ce)=>c.current[Wn(V,ce)]??Yp,[]),E=x.useCallback((V,ce,X)=>{const fe=Wn(V,ce);let Le=f.current.get(fe);return Le||(Le=new Set,f.current.set(fe,Le)),Le.add(X),()=>{const Ge=f.current.get(fe);Ge&&(Ge.delete(X),Ge.size===0&&f.current.delete(fe))}},[]),F=x.useCallback((V,ce)=>p.current.get(Wn(V,ce))??0,[]),Y=x.useCallback(async(V,ce,X,fe,Le,Ge)=>{if(!X.trim()&&(!fe||fe.length===0))return;const Te=Wn(V,ce),gt=R.current.get(Te)??[];gt.push(X),R.current.set(Te,gt);const le=zi("local-user");A(Te,{id:le,role:"user",ts:Date.now(),text:X,pending:!0,...Ge?{steer:!0}:{},...fe&&fe.length>0?{attachments:fe.map(be=>({hash:be.hash,name:be.name,mime:be.mime,kind:be.kind,size:be.size}))}:{}});try{const{turnId:be,steered:Se,steerId:Q}=await Me.send(V,ce,X,fe,Le,Ge);if(Ge&&Se&&Q){n(ge=>{const Ae=ge[Te];return Ae?{...ge,[Te]:Ae.map(Ne=>Ne.id===le&&Ne.role==="user"?{...Ne,steer:!0,steerId:Q}:Ne)}:ge});return}if(Ge&&!Se&&n(ge=>{const Ae=ge[Te];return Ae?{...ge,[Te]:Ae.map(Ne=>Ne.id===le&&Ne.role==="user"?{...Ne,steer:!1}:Ne)}:ge}),be){const ge=L.current.get(Te),Ae=ge==null?void 0:ge.get(be);ge&&Ae!==void 0&&(ge.delete(be),ge.size===0&&L.current.delete(Te)),n(Ne=>{const Be=Ne[Te];if(!Be)return Ne;const Ue=Be.map(We=>We.id!==le||We.role!=="user"?We:{...We,turnId:be,...Ae!==void 0?{queued:{ahead:Ae}}:{}});return{...Ne,[Te]:Ue}})}}catch(be){const Se=R.current.get(Te)??[],Q=Se.indexOf(X);throw Q>=0&&(Se.splice(Q,1),R.current.set(Te,Se)),n(ge=>{const Ae=ge[Te];return Ae?{...ge,[Te]:Ae.filter(Ne=>Ne.id!==le)}:ge}),be}},[A]),Z=x.useCallback(async(V,ce)=>Me.abort(V,ce),[]),ve=x.useCallback(async(V,ce,X)=>{var le;const fe=Wn(V,ce),Ge=(r.current[fe]??[]).find(be=>be.id===X);if(!Ge||Ge.role!=="user"||!Ge.turnId)return null;const Te=Ge.turnId,gt=await Me.dequeue(Te);return gt.ok?((le=L.current.get(fe))==null||le.delete(Te),n(be=>{const Se=be[fe];if(!Se)return be;const Q=Se.findIndex(Ae=>Ae.id===X);if(Q<0)return be;const ge=Se.slice();return ge.splice(Q,1),{...be,[fe]:ge}}),{text:gt.text,attachments:gt.attachments}):(gt.reason==="already_started"&&n(be=>{const Se=be[fe];if(!Se)return be;const Q=Se.findIndex(Ue=>Ue.id===X),ge=Q>=0?Se[Q]:void 0;if(!ge||ge.role!=="user")return be;const{queued:Ae,...Ne}=ge,Be=Se.slice();return Be[Q]=Ne,{...be,[fe]:Be}}),null)},[]),Oe=x.useCallback((V,ce,X)=>{const fe=Wn(V,ce);let Le=C.current.get(fe);return Le||(Le=new Set,C.current.set(fe,Le)),Le.add(X),()=>{const Ge=C.current.get(fe);Ge&&(Ge.delete(X),Ge.size===0&&C.current.delete(fe))}},[]),_e=x.useCallback((V,ce,X)=>{const fe=Wn(V,ce);let Le=k.current.get(fe);return Le||(Le=new Set,k.current.set(fe,Le)),Le.add(X),()=>{const Ge=k.current.get(fe);Ge&&(Ge.delete(X),Ge.size===0&&k.current.delete(fe))}},[]),Fe=x.useCallback(async(V,ce)=>{const X=Wn(V,ce),fe=q.current.get(X);if(!fe)return!1;if(!fe.hasMore||fe.inFlight||fe.oldestTs===null)return fe.hasMore;const Le=y.current.get(X);fe.inFlight=!0,q.current.set(X,fe),z(Ge=>Ge+1);try{const Ge=await Me.history(V,ce,{limit:x2,before:fe.oldestTs,...Le?{signal:Le.ac.signal}:{}}),Te=np(Ge.events);Te.length>0&&n(le=>({...le,[X]:[...Te,...le[X]??[]]}));const gt={hasMore:!!Ge.hasMore,oldestTs:typeof Ge.oldestTs=="number"?Ge.oldestTs:fe.oldestTs,inFlight:!1};return q.current.set(X,gt),z(le=>le+1),gt.hasMore}catch(Ge){return fe.inFlight=!1,q.current.set(X,fe),z(Te=>Te+1),Ge.name==="AbortError"||console.warn("[somora-web] loadOlder failed",X,Ge.message),fe.hasMore}},[]),st=x.useCallback((V,ce)=>{var X;return((X=q.current.get(Wn(V,ce)))==null?void 0:X.hasMore)??!1},[]),ae=x.useCallback((V,ce)=>{const X=Wn(V,ce);n(fe=>({...fe,[X]:[]})),w.current.delete(X),R.current.delete(X),L.current.delete(X),D(X,{thinking:!1,streaming:!1,usage:null,memory:null}),q.current.set(X,{hasMore:!1,oldestTs:null,inFlight:!1}),z(fe=>fe+1)},[D]);x.useEffect(()=>()=>{for(const V of y.current.values())V.es.close(),V.ac.abort();y.current.clear()},[]);const pe=x.useCallback(async(V,ce)=>{const X=Wn(V,ce);try{const fe=await Me.sessionProject(V,ce);D(X,{project:fe.project})}catch{}},[D]),Xe=x.useRef([]),nt=x.useMemo(()=>{const V=Object.entries(a).filter(([,X])=>X.streaming).map(([X])=>X),ce=Xe.current;return ce.length===V.length&&ce.every((X,fe)=>X===V[fe])?ce:(Xe.current=V,V)},[a]),Pe=x.useRef({messages:{},streams:{},paginationTick:0});x.useLayoutEffect(()=>{const V=Pe.current;Pe.current={messages:t,streams:a,paginationTick:O};const ce=V.paginationTick!==O,X=new Set;for(const fe of f.current.keys())(ce||V.messages[fe]!==t[fe]||V.streams[fe]!==a[fe])&&X.add(fe);for(const fe of X)d(fe)},[t,a,O,d]);const at=x.useMemo(()=>({projectsEnabled:m,subscribe:U,getMessages:W,getStream:I,subscribeSession:E,getSessionVersion:F,send:Y,subscribeAudio:Oe,subscribeTurnEvents:_e,abort:Z,recall:ve,loadOlder:Fe,getHasMore:st,clearMessages:ae,refreshProject:pe}),[m,U,W,I,E,F,Y,Oe,_e,Z,ve,Fe,st,ae,pe]);return h.jsx(jx.Provider,{value:at,children:h.jsx(Ix.Provider,{value:nt,children:e})})}function C2(e,t){const n=So();return x.useEffect(()=>n.subscribe(e,t),[e,t]),x.useSyncExternalStore(x.useCallback(r=>n.subscribeSession(e,t,r),[n,e,t]),()=>n.getSessionVersion(e,t)),{messages:n.getMessages(e,t),...n.getStream(e,t),send:(r,a,o,c)=>n.send(e,t,r,a,o,c),abort:()=>n.abort(e,t),recall:r=>n.recall(e,t,r),loadOlder:()=>n.loadOlder(e,t),hasMore:n.getHasMore(e,t),clearMessages:()=>n.clearMessages(e,t),refreshProject:()=>n.refreshProject(e,t),subscribeAudio:r=>n.subscribeAudio(e,t,r),projectsEnabled:n.projectsEnabled}}const Px=x.createContext({enabled:!1,browsers:[],connected:!1,loaded:!1,refresh:()=>{}});function T2({children:e}){const[t,n]=x.useState({enabled:!1,browsers:[]}),[r,a]=x.useState(!1),[o,c]=x.useState(!1),[f,p]=x.useState(0);return x.useEffect(()=>{let d=!0,m=Date.now();a(!1);const _=new EventSource("/browser/stream");_.addEventListener("browsers",w=>{if(d)try{const S=JSON.parse(w.data);if(!Array.isArray(S.browsers)||typeof S.enabled!="boolean")return;n(S),c(!0),a(!0),m=Date.now()}catch{}}),_.addEventListener("heartbeat",()=>{m=Date.now()}),_.addEventListener("error",()=>{d&&a(!1)});const y=()=>{document.visibilityState==="visible"&&Date.now()-m>45e3&&p(w=>w+1)};document.addEventListener("visibilitychange",y),window.addEventListener("online",y);const b=setInterval(y,15e3);return()=>{d=!1,_.close(),clearInterval(b),document.removeEventListener("visibilitychange",y),window.removeEventListener("online",y)}},[f]),h.jsx(Px.Provider,{value:{...t,connected:r,loaded:o,refresh:()=>p(d=>d+1)},children:e})}const Nh=()=>x.useContext(Px);/**
|
|
50
|
+
* @license lucide-react v0.460.0 - ISC
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the ISC license.
|
|
53
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/const M2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ux=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
55
|
+
* @license lucide-react v0.460.0 - ISC
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the ISC license.
|
|
58
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
+
*/var A2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
60
|
+
* @license lucide-react v0.460.0 - ISC
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the ISC license.
|
|
63
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/const R2=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:c,...f},p)=>x.createElement("svg",{ref:p,...A2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ux("lucide",a),...f},[...c.map(([d,m])=>x.createElement(d,m)),...Array.isArray(o)?o:[o]]));/**
|
|
65
|
+
* @license lucide-react v0.460.0 - ISC
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the ISC license.
|
|
68
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
+
*/const De=(e,t)=>{const n=x.forwardRef(({className:r,...a},o)=>x.createElement(R2,{ref:o,iconNode:t,className:Ux(`lucide-${M2(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
|
|
70
|
+
* @license lucide-react v0.460.0 - ISC
|
|
71
|
+
*
|
|
72
|
+
* This source code is licensed under the ISC license.
|
|
73
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
74
|
+
*/const N2=De("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
75
|
+
* @license lucide-react v0.460.0 - ISC
|
|
76
|
+
*
|
|
77
|
+
* This source code is licensed under the ISC license.
|
|
78
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
+
*/const O2=De("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
|
|
80
|
+
* @license lucide-react v0.460.0 - ISC
|
|
81
|
+
*
|
|
82
|
+
* This source code is licensed under the ISC license.
|
|
83
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/const D2=De("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
85
|
+
* @license lucide-react v0.460.0 - ISC
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the ISC license.
|
|
88
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
89
|
+
*/const L2=De("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
90
|
+
* @license lucide-react v0.460.0 - ISC
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the ISC license.
|
|
93
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/const z2=De("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
95
|
+
* @license lucide-react v0.460.0 - ISC
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the ISC license.
|
|
98
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/const um=De("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
|
|
100
|
+
* @license lucide-react v0.460.0 - ISC
|
|
101
|
+
*
|
|
102
|
+
* This source code is licensed under the ISC license.
|
|
103
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
104
|
+
*/const B2=De("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
105
|
+
* @license lucide-react v0.460.0 - ISC
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the ISC license.
|
|
108
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/const Hx=De("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
110
|
+
* @license lucide-react v0.460.0 - ISC
|
|
111
|
+
*
|
|
112
|
+
* This source code is licensed under the ISC license.
|
|
113
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
+
*/const hm=De("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
115
|
+
* @license lucide-react v0.460.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/const j2=De("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
|
|
120
|
+
* @license lucide-react v0.460.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/const uc=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
125
|
+
* @license lucide-react v0.460.0 - ISC
|
|
126
|
+
*
|
|
127
|
+
* This source code is licensed under the ISC license.
|
|
128
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
+
*/const Xr=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
130
|
+
* @license lucide-react v0.460.0 - ISC
|
|
131
|
+
*
|
|
132
|
+
* This source code is licensed under the ISC license.
|
|
133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
+
*/const I2=De("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
135
|
+
* @license lucide-react v0.460.0 - ISC
|
|
136
|
+
*
|
|
137
|
+
* This source code is licensed under the ISC license.
|
|
138
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
+
*/const wo=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
140
|
+
* @license lucide-react v0.460.0 - ISC
|
|
141
|
+
*
|
|
142
|
+
* This source code is licensed under the ISC license.
|
|
143
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
+
*/const dm=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
145
|
+
* @license lucide-react v0.460.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/const P2=De("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
150
|
+
* @license lucide-react v0.460.0 - ISC
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the ISC license.
|
|
153
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
+
*/const U2=De("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
155
|
+
* @license lucide-react v0.460.0 - ISC
|
|
156
|
+
*
|
|
157
|
+
* This source code is licensed under the ISC license.
|
|
158
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
+
*/const H2=De("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
160
|
+
* @license lucide-react v0.460.0 - ISC
|
|
161
|
+
*
|
|
162
|
+
* This source code is licensed under the ISC license.
|
|
163
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
+
*/const $x=De("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/**
|
|
165
|
+
* @license lucide-react v0.460.0 - ISC
|
|
166
|
+
*
|
|
167
|
+
* This source code is licensed under the ISC license.
|
|
168
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
+
*/const Fx=De("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
170
|
+
* @license lucide-react v0.460.0 - ISC
|
|
171
|
+
*
|
|
172
|
+
* This source code is licensed under the ISC license.
|
|
173
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
+
*/const qx=De("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
175
|
+
* @license lucide-react v0.460.0 - ISC
|
|
176
|
+
*
|
|
177
|
+
* This source code is licensed under the ISC license.
|
|
178
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
+
*/const Wx=De("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
180
|
+
* @license lucide-react v0.460.0 - ISC
|
|
181
|
+
*
|
|
182
|
+
* This source code is licensed under the ISC license.
|
|
183
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
+
*/const $2=De("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
|
|
185
|
+
* @license lucide-react v0.460.0 - ISC
|
|
186
|
+
*
|
|
187
|
+
* This source code is licensed under the ISC license.
|
|
188
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
+
*/const F2=De("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
190
|
+
* @license lucide-react v0.460.0 - ISC
|
|
191
|
+
*
|
|
192
|
+
* This source code is licensed under the ISC license.
|
|
193
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
+
*/const q2=De("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
195
|
+
* @license lucide-react v0.460.0 - ISC
|
|
196
|
+
*
|
|
197
|
+
* This source code is licensed under the ISC license.
|
|
198
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
+
*/const Vp=De("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
200
|
+
* @license lucide-react v0.460.0 - ISC
|
|
201
|
+
*
|
|
202
|
+
* This source code is licensed under the ISC license.
|
|
203
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
+
*/const Ql=De("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
205
|
+
* @license lucide-react v0.460.0 - ISC
|
|
206
|
+
*
|
|
207
|
+
* This source code is licensed under the ISC license.
|
|
208
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
+
*/const W2=De("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/**
|
|
210
|
+
* @license lucide-react v0.460.0 - ISC
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the ISC license.
|
|
213
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/const hc=De("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
215
|
+
* @license lucide-react v0.460.0 - ISC
|
|
216
|
+
*
|
|
217
|
+
* This source code is licensed under the ISC license.
|
|
218
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
+
*/const Kx=De("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
220
|
+
* @license lucide-react v0.460.0 - ISC
|
|
221
|
+
*
|
|
222
|
+
* This source code is licensed under the ISC license.
|
|
223
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
+
*/const qb=De("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
|
|
225
|
+
* @license lucide-react v0.460.0 - ISC
|
|
226
|
+
*
|
|
227
|
+
* This source code is licensed under the ISC license.
|
|
228
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
+
*/const K2=De("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
230
|
+
* @license lucide-react v0.460.0 - ISC
|
|
231
|
+
*
|
|
232
|
+
* This source code is licensed under the ISC license.
|
|
233
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
+
*/const G2=De("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/**
|
|
235
|
+
* @license lucide-react v0.460.0 - ISC
|
|
236
|
+
*
|
|
237
|
+
* This source code is licensed under the ISC license.
|
|
238
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
+
*/const Gx=De("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
240
|
+
* @license lucide-react v0.460.0 - ISC
|
|
241
|
+
*
|
|
242
|
+
* This source code is licensed under the ISC license.
|
|
243
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
+
*/const Oh=De("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
245
|
+
* @license lucide-react v0.460.0 - ISC
|
|
246
|
+
*
|
|
247
|
+
* This source code is licensed under the ISC license.
|
|
248
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
+
*/const Y2=De("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
250
|
+
* @license lucide-react v0.460.0 - ISC
|
|
251
|
+
*
|
|
252
|
+
* This source code is licensed under the ISC license.
|
|
253
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
+
*/const V2=De("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
255
|
+
* @license lucide-react v0.460.0 - ISC
|
|
256
|
+
*
|
|
257
|
+
* This source code is licensed under the ISC license.
|
|
258
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
+
*/const Wb=De("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
|
|
260
|
+
* @license lucide-react v0.460.0 - ISC
|
|
261
|
+
*
|
|
262
|
+
* This source code is licensed under the ISC license.
|
|
263
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
+
*/const fm=De("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
|
|
265
|
+
* @license lucide-react v0.460.0 - ISC
|
|
266
|
+
*
|
|
267
|
+
* This source code is licensed under the ISC license.
|
|
268
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
+
*/const X2=De("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
|
|
270
|
+
* @license lucide-react v0.460.0 - ISC
|
|
271
|
+
*
|
|
272
|
+
* This source code is licensed under the ISC license.
|
|
273
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
+
*/const Xp=De("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
275
|
+
* @license lucide-react v0.460.0 - ISC
|
|
276
|
+
*
|
|
277
|
+
* This source code is licensed under the ISC license.
|
|
278
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
+
*/const Z2=De("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
280
|
+
* @license lucide-react v0.460.0 - ISC
|
|
281
|
+
*
|
|
282
|
+
* This source code is licensed under the ISC license.
|
|
283
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
+
*/const J2=De("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
285
|
+
* @license lucide-react v0.460.0 - ISC
|
|
286
|
+
*
|
|
287
|
+
* This source code is licensed under the ISC license.
|
|
288
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
+
*/const Q2=De("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
290
|
+
* @license lucide-react v0.460.0 - ISC
|
|
291
|
+
*
|
|
292
|
+
* This source code is licensed under the ISC license.
|
|
293
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
+
*/const Zp=De("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
295
|
+
* @license lucide-react v0.460.0 - ISC
|
|
296
|
+
*
|
|
297
|
+
* This source code is licensed under the ISC license.
|
|
298
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
299
|
+
*/const Kb=De("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
300
|
+
* @license lucide-react v0.460.0 - ISC
|
|
301
|
+
*
|
|
302
|
+
* This source code is licensed under the ISC license.
|
|
303
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
304
|
+
*/const eT=De("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
305
|
+
* @license lucide-react v0.460.0 - ISC
|
|
306
|
+
*
|
|
307
|
+
* This source code is licensed under the ISC license.
|
|
308
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
+
*/const tT=De("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
|
|
310
|
+
* @license lucide-react v0.460.0 - ISC
|
|
311
|
+
*
|
|
312
|
+
* This source code is licensed under the ISC license.
|
|
313
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
+
*/const Yx=De("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
315
|
+
* @license lucide-react v0.460.0 - ISC
|
|
316
|
+
*
|
|
317
|
+
* This source code is licensed under the ISC license.
|
|
318
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
319
|
+
*/const nT=De("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
|
|
320
|
+
* @license lucide-react v0.460.0 - ISC
|
|
321
|
+
*
|
|
322
|
+
* This source code is licensed under the ISC license.
|
|
323
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
+
*/const Gb=De("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
325
|
+
* @license lucide-react v0.460.0 - ISC
|
|
326
|
+
*
|
|
327
|
+
* This source code is licensed under the ISC license.
|
|
328
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
329
|
+
*/const Dh=De("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
|
|
330
|
+
* @license lucide-react v0.460.0 - ISC
|
|
331
|
+
*
|
|
332
|
+
* This source code is licensed under the ISC license.
|
|
333
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
334
|
+
*/const iT=De("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
|
|
335
|
+
* @license lucide-react v0.460.0 - ISC
|
|
336
|
+
*
|
|
337
|
+
* This source code is licensed under the ISC license.
|
|
338
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
339
|
+
*/const rT=De("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
340
|
+
* @license lucide-react v0.460.0 - ISC
|
|
341
|
+
*
|
|
342
|
+
* This source code is licensed under the ISC license.
|
|
343
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
344
|
+
*/const sT=De("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
|
|
345
|
+
* @license lucide-react v0.460.0 - ISC
|
|
346
|
+
*
|
|
347
|
+
* This source code is licensed under the ISC license.
|
|
348
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
+
*/const aT=De("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
|
|
350
|
+
* @license lucide-react v0.460.0 - ISC
|
|
351
|
+
*
|
|
352
|
+
* This source code is licensed under the ISC license.
|
|
353
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
354
|
+
*/const Lh=De("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
355
|
+
* @license lucide-react v0.460.0 - ISC
|
|
356
|
+
*
|
|
357
|
+
* This source code is licensed under the ISC license.
|
|
358
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
359
|
+
*/const ko=De("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/**
|
|
360
|
+
* @license lucide-react v0.460.0 - ISC
|
|
361
|
+
*
|
|
362
|
+
* This source code is licensed under the ISC license.
|
|
363
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
364
|
+
*/const oT=De("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
|
|
365
|
+
* @license lucide-react v0.460.0 - ISC
|
|
366
|
+
*
|
|
367
|
+
* This source code is licensed under the ISC license.
|
|
368
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
369
|
+
*/const lT=De("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
|
|
370
|
+
* @license lucide-react v0.460.0 - ISC
|
|
371
|
+
*
|
|
372
|
+
* This source code is licensed under the ISC license.
|
|
373
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
374
|
+
*/const Vx=De("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
|
|
375
|
+
* @license lucide-react v0.460.0 - ISC
|
|
376
|
+
*
|
|
377
|
+
* This source code is licensed under the ISC license.
|
|
378
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
379
|
+
*/const zh=De("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
380
|
+
* @license lucide-react v0.460.0 - ISC
|
|
381
|
+
*
|
|
382
|
+
* This source code is licensed under the ISC license.
|
|
383
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
384
|
+
*/const cT=De("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
385
|
+
* @license lucide-react v0.460.0 - ISC
|
|
386
|
+
*
|
|
387
|
+
* This source code is licensed under the ISC license.
|
|
388
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
389
|
+
*/const Bh=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
390
|
+
* @license lucide-react v0.460.0 - ISC
|
|
391
|
+
*
|
|
392
|
+
* This source code is licensed under the ISC license.
|
|
393
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
394
|
+
*/const uT=De("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
|
|
395
|
+
* @license lucide-react v0.460.0 - ISC
|
|
396
|
+
*
|
|
397
|
+
* This source code is licensed under the ISC license.
|
|
398
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
+
*/const tr=De("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
400
|
+
* @license lucide-react v0.460.0 - ISC
|
|
401
|
+
*
|
|
402
|
+
* This source code is licensed under the ISC license.
|
|
403
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
404
|
+
*/const hT=De("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
405
|
+
* @license lucide-react v0.460.0 - ISC
|
|
406
|
+
*
|
|
407
|
+
* This source code is licensed under the ISC license.
|
|
408
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
+
*/const Xx=De("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
410
|
+
* @license lucide-react v0.460.0 - ISC
|
|
411
|
+
*
|
|
412
|
+
* This source code is licensed under the ISC license.
|
|
413
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
414
|
+
*/const dT=De("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/**
|
|
415
|
+
* @license lucide-react v0.460.0 - ISC
|
|
416
|
+
*
|
|
417
|
+
* This source code is licensed under the ISC license.
|
|
418
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
419
|
+
*/const fT=De("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/**
|
|
420
|
+
* @license lucide-react v0.460.0 - ISC
|
|
421
|
+
*
|
|
422
|
+
* This source code is licensed under the ISC license.
|
|
423
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
424
|
+
*/const pT=De("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
|
|
425
|
+
* @license lucide-react v0.460.0 - ISC
|
|
426
|
+
*
|
|
427
|
+
* This source code is licensed under the ISC license.
|
|
428
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
429
|
+
*/const gT=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
430
|
+
* @license lucide-react v0.460.0 - ISC
|
|
431
|
+
*
|
|
432
|
+
* This source code is licensed under the ISC license.
|
|
433
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
434
|
+
*/const Zx=De("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
435
|
+
* @license lucide-react v0.460.0 - ISC
|
|
436
|
+
*
|
|
437
|
+
* This source code is licensed under the ISC license.
|
|
438
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
439
|
+
*/const Jx=De("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
440
|
+
* @license lucide-react v0.460.0 - ISC
|
|
441
|
+
*
|
|
442
|
+
* This source code is licensed under the ISC license.
|
|
443
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
444
|
+
*/const Qx=De("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
445
|
+
* @license lucide-react v0.460.0 - ISC
|
|
446
|
+
*
|
|
447
|
+
* This source code is licensed under the ISC license.
|
|
448
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
449
|
+
*/const mT=De("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
450
|
+
* @license lucide-react v0.460.0 - ISC
|
|
451
|
+
*
|
|
452
|
+
* This source code is licensed under the ISC license.
|
|
453
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
454
|
+
*/const eS=De("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
455
|
+
* @license lucide-react v0.460.0 - ISC
|
|
456
|
+
*
|
|
457
|
+
* This source code is licensed under the ISC license.
|
|
458
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
459
|
+
*/const Eo=De("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
460
|
+
* @license lucide-react v0.460.0 - ISC
|
|
461
|
+
*
|
|
462
|
+
* This source code is licensed under the ISC license.
|
|
463
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
464
|
+
*/const tS=De("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
465
|
+
* @license lucide-react v0.460.0 - ISC
|
|
466
|
+
*
|
|
467
|
+
* This source code is licensed under the ISC license.
|
|
468
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
469
|
+
*/const nS=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
470
|
+
* @license lucide-react v0.460.0 - ISC
|
|
471
|
+
*
|
|
472
|
+
* This source code is licensed under the ISC license.
|
|
473
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
474
|
+
*/const ui=De("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
475
|
+
* @license lucide-react v0.460.0 - ISC
|
|
476
|
+
*
|
|
477
|
+
* This source code is licensed under the ISC license.
|
|
478
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
479
|
+
*/const pm=De("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
480
|
+
* @license lucide-react v0.460.0 - ISC
|
|
481
|
+
*
|
|
482
|
+
* This source code is licensed under the ISC license.
|
|
483
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
484
|
+
*/const _T=De("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
485
|
+
* @license lucide-react v0.460.0 - ISC
|
|
486
|
+
*
|
|
487
|
+
* This source code is licensed under the ISC license.
|
|
488
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
489
|
+
*/const vT=De("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
490
|
+
* @license lucide-react v0.460.0 - ISC
|
|
491
|
+
*
|
|
492
|
+
* This source code is licensed under the ISC license.
|
|
493
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
494
|
+
*/const iS=De("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
495
|
+
* @license lucide-react v0.460.0 - ISC
|
|
496
|
+
*
|
|
497
|
+
* This source code is licensed under the ISC license.
|
|
498
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
499
|
+
*/const yT=De("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
500
|
+
* @license lucide-react v0.460.0 - ISC
|
|
501
|
+
*
|
|
502
|
+
* This source code is licensed under the ISC license.
|
|
503
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
504
|
+
*/const rS=De("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
505
|
+
* @license lucide-react v0.460.0 - ISC
|
|
506
|
+
*
|
|
507
|
+
* This source code is licensed under the ISC license.
|
|
508
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
509
|
+
*/const bT=De("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
|
510
|
+
* @license lucide-react v0.460.0 - ISC
|
|
511
|
+
*
|
|
512
|
+
* This source code is licensed under the ISC license.
|
|
513
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
514
|
+
*/const xT=De("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
|
|
515
|
+
* @license lucide-react v0.460.0 - ISC
|
|
516
|
+
*
|
|
517
|
+
* This source code is licensed under the ISC license.
|
|
518
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
519
|
+
*/const sS=De("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
520
|
+
* @license lucide-react v0.460.0 - ISC
|
|
521
|
+
*
|
|
522
|
+
* This source code is licensed under the ISC license.
|
|
523
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
524
|
+
*/const gh=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
525
|
+
* @license lucide-react v0.460.0 - ISC
|
|
526
|
+
*
|
|
527
|
+
* This source code is licensed under the ISC license.
|
|
528
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
529
|
+
*/const ec=De("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
|
|
530
|
+
* @license lucide-react v0.460.0 - ISC
|
|
531
|
+
*
|
|
532
|
+
* This source code is licensed under the ISC license.
|
|
533
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
534
|
+
*/const aS=De("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
|
|
535
|
+
* @license lucide-react v0.460.0 - ISC
|
|
536
|
+
*
|
|
537
|
+
* This source code is licensed under the ISC license.
|
|
538
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
539
|
+
*/const ST=De("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var dc=Dx();const go=100,mo=112,vo=24,oS="somora-desktop-icons",Jp=e=>`${e.col}:${e.row}`;function wT(e,t,n){const r=Math.max(1,Math.floor((e-vo*2)/go)),a=Math.max(1,Math.floor((t-vo*2)/mo)),o=Math.ceil(n/r);return{cols:r,rows:Math.max(a,o)}}function kT(e,t,n){return{col:Math.min(Math.max(e.col,0),t-1),row:Math.min(Math.max(e.row,0),n-1)}}function ET(e,t,n,r){let a=null,o=1/0;for(let c=0;c<t;c++)for(let f=0;f<n;f++){const p={col:c,row:f};if(r.has(Jp(p)))continue;if(!e)return p;const d=c-e.col,m=f-e.row,_=d*d+m*m;_<o&&(o=_,a=p)}return a}function Yb(e,t,n,r){const a=new Map;if(n<1||r<1)return a;const o=new Set,c=(p,d)=>{const m=d?kT(d,n,r):null,_=m&&!o.has(Jp(m))?m:ET(m,n,r,o);_&&(o.add(Jp(_)),a.set(p,_))},f=t.filter(p=>e[p]).sort((p,d)=>{const m=e[p],_=e[d];return m.col-_.col||m.row-_.row});for(const p of f)c(p,e[p]);for(const p of t)e[p]||c(p,null);return a}function CT(e,t,n,r){const a={...e,[n]:r},o=t.get(n);for(const[c,f]of t)if(c!==n&&f.col===r.col&&f.row===r.row){o&&(a[c]=o);break}return a}function TT(){try{const e=localStorage.getItem(oS);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t)){if(!a||typeof a!="object")continue;const{col:o,row:c}=a;typeof o!="number"||typeof c!="number"||!Number.isFinite(o)||!Number.isFinite(c)||o<0||c<0||(n[r]={col:Math.floor(o),row:Math.floor(c)})}return n}catch{return{}}}function MT(e,t){const[n,r]=x.useState({width:0,height:0});return x.useEffect(()=>{const a=e.current;if(!a)return;const o=new ResizeObserver(([c])=>{if(!c)return;const{width:f,height:p}=c.contentRect;r(d=>d.width===f&&d.height===p?d:{width:f,height:p})});return o.observe(a),()=>o.disconnect()},[e]),x.useMemo(()=>wT(n.width,n.height,t),[n.width,n.height,t])}function AT(e,t,n){const[r,a]=x.useState(TT),o=e.join(" "),c=x.useMemo(()=>Yb(r,e,t,n),[r,o,t,n]),f=x.useRef(!0);x.useEffect(()=>{if(f.current){f.current=!1;return}try{localStorage.setItem(oS,JSON.stringify(r))}catch{}},[r]);const p=x.useCallback((m,_)=>a(y=>CT(y,Yb(y,e,t,n),m,_)),[o,t,n]),d=x.useCallback(()=>a({}),[]);return{layout:c,place:p,reset:d}}const RT=5,ip=e=>vo+e*go,rp=e=>vo+e*mo;function NT({icons:e,loading:t,error:n}){const r=x.useRef(null),{cols:a,rows:o}=MT(r,e.length),c=e.map(C=>C.id),{layout:f,place:p}=AT(c,a,o),[d,m]=x.useState(null),_=o>0?{col:Math.floor(e.length/o),row:e.length%o}:{col:0,row:0},y=x.useRef(!1),b=x.useCallback((C,k)=>{if(C.button!==0)return;const j=r.current;if(!j)return;y.current=!1;const R=C.currentTarget.getBoundingClientRect(),L=j.getBoundingClientRect(),q=C.clientX-R.left,O=C.clientY-R.top,z=C.clientX,J=C.clientY;let ie=!1,D=f.get(k)??{col:0,row:0};const A=(H,N)=>{const $=H-q-L.left+j.scrollLeft,K=N-O-L.top+j.scrollTop;return{col:Math.min(Math.max(Math.round(($-vo)/go),0),a-1),row:Math.min(Math.max(Math.round((K-vo)/mo),0),o-1)}},M=H=>{for(const[N,$]of f)if(N!==k&&$.col===H.col&&$.row===H.row)return N;return null},P=H=>{if(!ie){if(Math.hypot(H.clientX-z,H.clientY-J)<RT)return;ie=!0,y.current=!0}D=A(H.clientX,H.clientY),m({id:k,grabX:q,grabY:O,x:H.clientX,y:H.clientY,target:D,swapWith:M(D)}),H.preventDefault()},G=()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G),ie&&p(k,D),m(null)};window.addEventListener("pointermove",P),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G)},[a,o,f,p]),w=x.useCallback((C,k)=>{if(!C.altKey)return;const j=f.get(k);if(!j)return;const L={ArrowLeft:{col:-1,row:0},ArrowRight:{col:1,row:0},ArrowUp:{col:0,row:-1},ArrowDown:{col:0,row:1}}[C.key];if(!L)return;const q={col:Math.min(Math.max(j.col+L.col,0),a-1),row:Math.min(Math.max(j.row+L.row,0),o-1)};q.col===j.col&&q.row===j.row||(C.preventDefault(),C.stopPropagation(),p(k,q))},[f,a,o,p]),S=x.useCallback(C=>{y.current&&(y.current=!1,C.preventDefault(),C.stopPropagation())},[]);return h.jsxs("div",{ref:r,className:d?"desktop-icons dragging":"desktop-icons",onClickCapture:S,children:[(t||n)&&h.jsx("div",{className:n?"desktop-icons-status error":"desktop-icons-status",style:{left:ip(_.col),top:rp(_.row)},...n?{title:n}:{},children:n?"server unreachable":"loading…"}),d&&h.jsx("div",{className:d.swapWith?"desktop-drop-target swap":"desktop-drop-target",style:{left:ip(d.target.col),top:rp(d.target.row),width:go,height:mo}}),e.map(C=>{const k=f.get(C.id);if(!k)return null;const j=(d==null?void 0:d.id)===C.id,R=(d==null?void 0:d.swapWith)===C.id;return j?dc.createPortal(h.jsx("div",{className:"desktop-icon in-hand","data-icon-id":C.id,style:{position:"fixed",left:d.x-d.grabX,top:d.y-d.grabY,width:go,height:mo},children:C.node},C.id),document.body,C.id):h.jsx("div",{className:"desktop-icon"+(R?" swap-partner":""),"data-icon-id":C.id,style:{left:ip(k.col),top:rp(k.row),width:go,height:mo},onPointerDown:L=>b(L,C.id),onKeyDown:L=>w(L,C.id),children:C.node},C.id)})]})}const Vb=["#5cf2d6","#9d8cff","#f5b942","#ff6b9d","#7fff95","#69b6ff"];function OT(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Vb[Math.abs(t)%Vb.length]}function Qp(e){return`linear-gradient(135deg, ${e}, ${DT(e,.5)})`}function DT(e,t){const n=e.match(/^#([0-9a-f]{6})$/i);if(!n)return e;const r=parseInt(n[1],16),a=r>>16&255,o=r>>8&255,c=r&255,f=d=>Math.round(d*(1-t));return"#"+(f(a)<<16|f(o)<<8|f(c)).toString(16).padStart(6,"0")}function tc(e){return e.color??OT(e.name)}function LT(e,t,n,r){return t?"offline":n===e?"loop-holder":r?"busy":"online"}function zT(e,t){var n;return t?t.lucid.active&&t.lucid.loopHolder===e?"lucid":t.deep.active?"deep":(n=t.rem[e])!=null&&n.active?"rem":null:null}function BT({agent:e,onClick:t,onContextMenu:n,offline:r,streaming:a,unread:o,loopHolder:c,active:f,dreamStates:p}){var w;const d=tc(e),m=LT(e.name,!!r,c,!!a),_=zT(e.name,p),y=((w=p==null?void 0:p.rem[e.name])==null?void 0:w.pendingCount)??0,b="agent-icon-glyph"+(_?` dream-active dream-${_}`:"");return h.jsxs("div",{role:"button",tabIndex:0,className:`agent-icon ${f?"active":""}${e.kind==="builder"?" is-builder":""}`,onClick:()=>t(e),...n?{onContextMenu:S=>n(e,S)}:{},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),t(e))},title:e.description,children:[h.jsxs("div",{className:b,style:{background:Qp(d),borderColor:`${d}40`,boxShadow:`0 6px 18px rgba(0,0,0,0.4), 0 0 0 1px ${d}20, inset 0 1px 0 rgba(255,255,255,0.08)`},children:[h.jsx("span",{style:{fontSize:30,lineHeight:1,filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.4))"},children:e.icon??"🤖"}),h.jsx("span",{className:`status-dot ${m}`}),m!=="busy"&&o&&h.jsx("span",{className:"agent-unread-dot","aria-label":"unread activity",title:"New activity in a session — open the chat to read"}),y>0&&h.jsx("span",{className:"rem-badge",title:`${y} REM dream${y===1?"":"s"} ready for review`,children:y>9?"9+":y})]}),h.jsx("div",{className:"agent-icon-label",children:e.name}),h.jsx("div",{className:"agent-icon-sub",children:(e.kind==="builder"?e.role&&e.role.trim().toLowerCase()!=="builder"?`builder · ${e.role}`:"builder":e.role??"agent").toLowerCase()})]})}const jT=/^[A-Za-z0-9_-]+$/;function IT(e){const t=e.trim();return t.length===0?{ok:!1,reason:"Type a name for the session."}:t==="main"?{ok:!1,reason:'"main" is the always-present default session.'}:jT.test(t)?{ok:!0,slug:t}:{ok:!1,reason:'Letters, digits, "-" and "_" only — no spaces.'}}function Lu(e){return e.trim().replace(/\s+/g,"-").replace(/[^A-Za-z0-9_-]/g,"")}const PT=260,UT=3;function HT({agent:e,x:t,y:n,onClose:r,onOpenSession:a,onOpenSessionsTool:o,onOpenConfig:c}){const f=x.useRef(null),p=x.useRef(null),[d,m]=x.useState({left:t,top:n}),[_,y]=x.useState(null),[b,w]=x.useState(null),[S,C]=x.useState(!1),[k,j]=x.useState(""),[R,L]=x.useState(null),[q,O]=x.useState(!1);x.useEffect(()=>{let D=!1;return Me.sessions(e.name).then(A=>{if(D)return;const M=A.filter(P=>!P.isMain).sort((P,G)=>(G.lastActivity??"").localeCompare(P.lastActivity??"")).slice(0,UT);y(M)}).catch(A=>{D||w(A.message)}),()=>{D=!0}},[e.name]),x.useLayoutEffect(()=>{const D=f.current;if(!D)return;const A=D.getBoundingClientRect(),M=Math.max(4,Math.min(t,window.innerWidth-A.width-4)),P=Math.max(4,Math.min(n,window.innerHeight-A.height-4));(M!==d.left||P!==d.top)&&m({left:M,top:P})},[t,n,S,_,R]),x.useEffect(()=>{function D(P){f.current&&f.current.contains(P.target)||r()}function A(P){P.key==="Escape"&&(P.stopPropagation(),r())}function M(P){if(f.current&&f.current.contains(P.target)){P.preventDefault();return}r()}return document.addEventListener("mousedown",D,!0),document.addEventListener("keydown",A,!0),document.addEventListener("contextmenu",M,!0),window.addEventListener("resize",r),()=>{document.removeEventListener("mousedown",D,!0),document.removeEventListener("keydown",A,!0),document.removeEventListener("contextmenu",M,!0),window.removeEventListener("resize",r)}},[r]),x.useEffect(()=>{var D;S&&((D=p.current)==null||D.focus())},[S]);const z=IT(k);async function J(){if(!(!z.ok||q)){O(!0),L(null);try{const D=await Me.createSession(e.name,z.slug);a(e,D.id,D.slug),r()}catch(D){L(D.message.replace(/^create session \d+:?\s*/i,"")||"Could not create the session."),O(!1)}}}const ie=h.jsxs("div",{ref:f,role:"menu","aria-label":`${e.name} menu`,"data-testid":"agent-context-menu",className:"agent-context-menu",style:{position:"fixed",left:d.left,top:d.top,zIndex:1e4,width:PT,background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",fontFamily:'"JetBrains Mono", monospace',fontSize:12,color:"var(--text-1)",padding:4},onMouseDown:D=>D.stopPropagation(),children:[h.jsxs("div",{style:FT,children:[h.jsx("span",{style:{fontSize:14},children:e.icon??"🤖"}),h.jsx("span",{style:{fontWeight:600,color:"var(--text-0)"},children:e.name}),e.role&&h.jsxs("span",{style:{color:"var(--text-3)"},children:["· ",e.role.toLowerCase()]})]}),h.jsx(wl,{icon:h.jsx(Yx,{size:13}),label:"Open main",testId:"agent-menu-open-main",onClick:()=>{a(e,"main","main"),r()}}),h.jsxs("div",{style:qT,children:[h.jsx(Fx,{size:11,className:"icon-inline"})," recent sessions"]}),_===null&&!b&&h.jsx("div",{style:sp,children:"Loading…"}),b&&h.jsxs("div",{style:{...sp,color:"var(--danger, #e5534b)"},children:[h.jsx(ui,{size:11,className:"icon-inline"})," ",b]}),_&&_.length===0&&h.jsx("div",{style:sp,children:"Only main so far."}),_==null?void 0:_.map(D=>h.jsx(wl,{icon:h.jsx("span",{style:{width:13,display:"inline-block"}}),label:D.slug,hint:$T(D.lastActivity),testId:`agent-menu-recent-${D.slug}`,onClick:()=>{a(e,D.id,D.slug),r()}},D.id)),h.jsx("div",{style:Xb}),S?h.jsxs("div",{style:{padding:"4px 6px 6px"},children:[h.jsx("div",{style:{color:"var(--text-3)",fontSize:11,marginBottom:4},children:"Name the new session"}),h.jsx("input",{ref:p,"data-testid":"agent-menu-session-name",value:k,placeholder:"e.g. research-notes",spellCheck:!1,autoComplete:"off",disabled:q,onChange:D=>{j(D.target.value),L(null)},onKeyDown:D=>{D.key==="Enter"?(D.preventDefault(),J()):D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),C(!1),j(""),L(null))},style:KT}),h.jsx("div",{"data-testid":"agent-menu-session-hint",style:{marginTop:4,fontSize:11,color:R||k&&!z.ok?"var(--danger, #e5534b)":"var(--text-3)",minHeight:14},children:R||(k.length===0?"Enter to create · Esc to cancel":z.ok?`Enter → opens "${z.slug}" in a new window`:z.reason)}),k.length>0&&Lu(k)!==k&&Lu(k).length>0&&!z.ok&&h.jsxs("button",{type:"button","data-testid":"agent-menu-session-suggest",onClick:()=>{var D;j(Lu(k)),(D=p.current)==null||D.focus()},style:GT,children:['use "',Lu(k),'"']})]}):h.jsx(wl,{icon:h.jsx(Bh,{size:13}),label:"New session…",testId:"agent-menu-new-session",onClick:()=>C(!0)}),h.jsx(wl,{icon:h.jsx(Q2,{size:13}),label:"All sessions…",testId:"agent-menu-all-sessions",onClick:()=>{o(),r()}}),h.jsx("div",{style:Xb}),h.jsx(wl,{icon:h.jsx(Jx,{size:13}),label:"Configure…",hint:"persona · prompt",testId:"agent-menu-configure",onClick:()=>{c(e),r()}})]});return dc.createPortal(ie,document.body)}function wl({icon:e,label:t,hint:n,onClick:r,testId:a}){return h.jsxs("div",{role:"menuitem",tabIndex:0,"data-testid":a,className:"agent-context-menu-item",onClick:r,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())},style:WT,children:[h.jsx("span",{style:{color:"var(--text-2)",display:"inline-flex"},children:e}),h.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&h.jsx("span",{style:{color:"var(--text-3)",fontSize:11},children:n})]})}function $T(e){if(!e)return"";const t=Date.parse(e);if(!Number.isFinite(t))return"";const n=Math.round((Date.now()-t)/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}const FT={display:"flex",alignItems:"center",gap:6,padding:"6px 8px 8px",borderBottom:"1px solid var(--line)",marginBottom:4},qT={padding:"6px 8px 2px",fontSize:10,letterSpacing:1,textTransform:"uppercase",color:"var(--text-3)"},WT={display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},Xb={height:1,background:"var(--line)",margin:"4px 6px"},sp={padding:"4px 8px",color:"var(--text-3)",fontSize:11},KT={width:"100%",boxSizing:"border-box",padding:"5px 6px",background:"var(--bg-1)",border:"1px solid var(--line-2)",borderRadius:3,color:"var(--text-0)",fontSize:12,fontFamily:'"JetBrains Mono", monospace',outline:"none"},GT={marginTop:4,padding:"2px 6px",background:"transparent",border:"1px solid var(--line-2)",borderRadius:3,color:"var(--text-2)",fontSize:11,fontFamily:"inherit",cursor:"pointer"};function ar({label:e,icon:t,active:n,onClick:r,badge:a}){return h.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())},className:n?"agent-icon active":"agent-icon",style:{width:88},children:[h.jsxs("div",{className:"agent-icon-glyph",style:{background:n?"linear-gradient(180deg, var(--bg-3), var(--bg-2))":"linear-gradient(180deg, var(--bg-2), var(--bg-1))",color:n?"var(--accent)":"var(--text-2)"},children:[t,a]}),h.jsx("div",{style:{fontFamily:'"JetBrains Mono", monospace',fontSize:11,color:n?"var(--text-1)":"var(--text-2)"},children:e})]})}function YT({size:e=18,color:t="currentColor",strokeWidth:n=1.6,className:r}){return h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",className:r,"aria-hidden":"true",children:[h.jsx("ellipse",{cx:"12",cy:"13.5",rx:"6.5",ry:"6.5"}),h.jsx("ellipse",{cx:"6",cy:"6.5",rx:"3",ry:"3.2"}),h.jsx("ellipse",{cx:"18",cy:"6.5",rx:"3",ry:"3.2"}),h.jsx("circle",{cx:"9.5",cy:"12.5",r:"0.7",fill:t,stroke:"none"}),h.jsx("circle",{cx:"14.5",cy:"12.5",r:"0.7",fill:t,stroke:"none"}),h.jsx("ellipse",{cx:"12",cy:"16",rx:"2",ry:"1.3"})]})}const Zb=/^\d{8}-\d{6}_/;function gm(e){return Zb.test(e)?e.replace(Zb,""):e}function VT(e){return gm(e)!==e}function XT({windows:e,onOpenBrowsers:t,focusedId:n,agents:r,onFocus:a,onAutoArrange:o,onSaveLayout:c,onRestoreLayout:f}){const d=Nh().browsers.filter($=>$.handoff),[m,_]=x.useState(new Date),[y,b]=x.useState(null),[w,S]=x.useState(!1),[C,k]=x.useState(null),[j,R]=x.useState(!1),[L,q]=x.useState(null),[O,z]=x.useState(null),[J,ie]=x.useState(null),D=x.useRef(null);x.useEffect(()=>{if(!J)return;const $=setTimeout(()=>ie(null),J.tone==="info"?6e3:12e3);return()=>clearTimeout($)},[J]),x.useEffect(()=>{if(!j)return;Me.configStatus().then(re=>z({loadedAt:re.loadedAt,changedOnDisk:re.changedOnDisk,restartAvailable:re.restartAvailable})).catch(()=>z(null));const $=re=>{D.current&&!D.current.contains(re.target)&&R(!1)},K=re=>{re.key==="Escape"&&R(!1)};return document.addEventListener("mousedown",$),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",K)}},[j]);const A=async()=>{q("reload");try{const $=await Me.reloadConfig();if(!$.ok){ie({text:`config not reloaded — ${$.error??"unknown error"}`,tone:"error"});return}const K=$.changed.length===0?"no changes":`changed: ${$.changed.join(", ")}`;$.restartRequired.length>0?ie({text:`config reloaded — ${K} · restart needed for: ${$.restartRequired.join(", ")}`,tone:"warn"}):ie({text:`config reloaded — ${K}`,tone:"info"})}catch($){ie({text:`config reload failed — ${$.message}`,tone:"error"})}finally{q(null),R(!1)}},M=async()=>{if(window.confirm("Restart somora? Every open chat stream and terminal drops for a few seconds.")){q("restart");try{const $=await Me.restartServer();if(!$.ok){ie({text:`restart refused — ${$.error??"unknown error"}`,tone:"error"});return}ie({text:"restarting somora — reconnecting…",tone:"warn"});const K=Date.now(),re=async()=>{if(Date.now()-K>9e4){ie({text:"somora did not come back within 90 s — check the service",tone:"error"});return}try{const U=await fetch("/health",{cache:"no-store"});if(U.ok){const W=await U.json();if(typeof W.serverUptimeMs=="number"&&W.serverUptimeMs<6e4){window.location.reload();return}}}catch{}setTimeout(re,1500)};setTimeout(re,2500)}catch($){ie({text:`restart failed — ${$.message}`,tone:"error"})}finally{q(null),R(!1)}}};x.useEffect(()=>{const $=setInterval(()=>_(new Date),3e4);return()=>clearInterval($)},[]),x.useEffect(()=>{Me.version().then($=>b($.version)).catch(()=>b(null))},[]),x.useEffect(()=>{let $=!0;const K=()=>{Me.hostStats().then(U=>{$&&k({cpuPct:U.cpu.percent,memPct:U.mem.percent})}).catch(()=>{})};K();const re=setInterval(K,5e3);return()=>{$=!1,clearInterval(re)}},[]),x.useEffect(()=>{const $=()=>S(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$),()=>document.removeEventListener("fullscreenchange",$)},[]);const P=typeof document<"u"&&typeof document.documentElement.requestFullscreen=="function"&&document.fullscreenEnabled!==!1,G=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},H=m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),N=m.toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"});return h.jsxs("div",{className:"taskbar",children:[h.jsxs("div",{className:"taskbar-logo",children:[h.jsx("div",{className:"taskbar-logo-mark",children:h.jsx(YT,{size:18,color:"#0a0e15",strokeWidth:1.8})}),h.jsxs("div",{children:[h.jsx("div",{className:"taskbar-logo-text",children:"somora"}),h.jsx("div",{className:"taskbar-logo-sub",children:y?`v${y}`:"—"})]})]}),d.length>0&&h.jsxs("button",{type:"button",className:"browser-attention",onClick:t,title:d.map($=>`${$.handoff.agent}: ${$.handoff.reason}`).join(`
|
|
540
|
+
`),children:["Browser · ",d.length," waiting for you"]}),h.jsx("div",{className:"taskbar-windows",children:e.map($=>{const K=$.kind==="chat"&&$.agentName?r.find(E=>E.name===$.agentName):void 0,re=K?tc(K):void 0,U=n===$.id&&!$.minimized,W=$.kind==="chat"&&$.agentName?`${$.agentName} · ${gm($.sessionId??"main")}`:$.title,I=$.kind==="chat"&&$.agentName?`${$.agentName} · ${$.sessionId??"main"}`:$.title;return h.jsxs("button",{type:"button",className:["taskbar-window",U?"focused":"",$.minimized?"minimized":""].filter(Boolean).join(" "),onClick:()=>a($.id),title:I,style:re?{"--row-color":re}:void 0,children:[h.jsx("span",{className:"taskbar-window-dot",style:re?{background:re,boxShadow:`0 0 6px ${re}88`}:void 0}),h.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[K&&h.jsx("span",{style:{fontSize:12},children:K.icon??"🤖"}),h.jsx("span",{className:"taskbar-window-title",children:W})]})]},$.id)})}),h.jsxs("div",{className:"taskbar-tools",children:[J&&h.jsx("span",{className:`taskbar-toast taskbar-toast-${J.tone}`,role:"status",title:J.text,children:J.text}),h.jsxs("div",{className:"taskbar-gear",ref:D,children:[h.jsx("button",{className:"taskbar-tool",type:"button",title:"Server: reload config, restart","aria-haspopup":"menu","aria-expanded":j,onClick:()=>R($=>!$),children:h.jsx(Jx,{size:14})}),j&&h.jsxs("div",{className:"taskbar-menu",role:"menu",children:[h.jsxs("button",{className:"taskbar-menu-item",type:"button",role:"menuitem",disabled:L!==null,onClick:()=>void A(),title:"Re-read ~/.somora/config.yaml and apply it without a restart",children:[h.jsx(tr,{size:13}),h.jsxs("span",{children:["Reload config",(O==null?void 0:O.changedOnDisk)&&h.jsx("em",{className:"taskbar-menu-hint",children:" · changed on disk"})]})]}),h.jsxs("button",{className:"taskbar-menu-item",type:"button",role:"menuitem",disabled:L!==null||(O==null?void 0:O.restartAvailable)===!1,onClick:()=>void M(),title:(O==null?void 0:O.restartAvailable)===!1?"somora is not running as the systemd user unit — restart it the way you started it":"Restart the somora service via systemd",children:[h.jsx(uT,{size:13}),h.jsx("span",{children:"Restart somora"})]}),h.jsxs("div",{className:"taskbar-menu-meta",children:[y?`v${y}`:"",O!=null&&O.loadedAt?` · config loaded ${new Date(O.loadedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:""]})]})]}),h.jsxs("button",{className:"taskbar-tool",type:"button",title:"Auto-arrange windows",onClick:o,children:[h.jsx(Y2,{size:14}),h.jsx("span",{children:"Arrange"})]}),h.jsxs("button",{className:"taskbar-tool",type:"button",title:"Save current layout",onClick:c,children:[h.jsx(Vx,{size:14}),h.jsx("span",{children:"Save"})]}),h.jsxs("button",{className:"taskbar-tool",type:"button",title:"Restore saved layout",onClick:f,children:[h.jsx(Qx,{size:14}),h.jsx("span",{children:"Restore"})]}),P&&h.jsxs("button",{className:"taskbar-tool",type:"button",title:w?"Exit fullscreen":"Enter fullscreen",onClick:G,children:[w?h.jsx(iT,{size:14}):h.jsx(tT,{size:14}),h.jsx("span",{children:w?"Windowed":"Fullscreen"})]})]}),h.jsxs("div",{className:"taskbar-stat",children:[h.jsxs("span",{title:"1-min CPU load average / cores. >100% = overloaded.",children:[h.jsx("b",{children:C?`${Math.round(C.cpuPct)}%`:"—"})," cpu"]}),h.jsxs("span",{title:"Host memory in use (MemAvailable on Linux, freemem fallback).",children:[h.jsx("b",{children:C?`${Math.round(C.memPct)}%`:"—"})," mem"]})]}),h.jsxs("div",{className:"taskbar-clock",children:[h.jsx("span",{children:H}),h.jsx("small",{children:N})]})]})}const mm=56,eg=320,tg=200,ZT=100;function ng(){return{w:window.innerWidth,h:window.innerHeight}}function _m(e){return Math.max(0,e.h-mm)}function JT(e,t,n,r){const a=Math.max(0,Math.min(r.w-ZT,e)),o=Math.max(0,_m(r)-n),c=Math.max(0,Math.min(o,t));return{x:a,y:c}}function QT(e,t,n,r,a){const o=Math.max(eg,a.w-e),c=Math.max(tg,_m(a)-t);return{w:Math.min(o,Math.max(eg,n)),h:Math.min(c,Math.max(tg,r))}}function eM(e,t){const n=Math.max(eg,t.w),r=Math.max(tg,_m(t)),a=Math.min(e.w,n),o=Math.min(e.h,r),c=Math.max(0,Math.min(e.x,n-a)),f=Math.max(0,Math.min(e.y,r-o));return c===e.x&&f===e.y&&a===e.w&&o===e.h?e:{...e,x:c,y:f,w:a,h:o}}const tM=16,zu=24;function nM(e){return e<=1?1:e<=4?2:3}function iM(e,t,n=tM){if(e<=0)return[];const r=nM(e),a=Math.ceil(e/r),o=Math.floor((t.w-n*(r-1))/r),c=r-1,f=e-1,p=c>0?Math.ceil(f/c):0;if(!(r*a!==e&&c>0&&c*p===f)){const w=Math.floor((t.h-n*(a-1))/a);return Array.from({length:e},(S,C)=>({x:t.x+C%r*(o+n),y:t.y+Math.floor(C/r)*(w+n),w:o,h:w}))}const m=t.x+o+n,_=t.w-o-n,y=Math.floor((_-n*(c-1))/c),b=Math.floor((t.h-n*(p-1))/p);return[{x:t.x,y:t.y,w:o,h:t.h},...Array.from({length:f},(w,S)=>({x:m+S%c*(y+n),y:t.y+Math.floor(S/c)*(b+n),w:y,h:b}))]}function rM(e,t){let n=!1;const r=e.map(a=>{const o=eM(a,t);return o!==a&&(n=!0),o});return n?r:e}function Kn({win:e,focused:t,onFocus:n,onClose:r,onMinimize:a,onMove:o,onResize:c,agentColor:f,children:p}){const d=x.useRef(null),m=x.useRef(null),_=f?{"--agent-color":f,"--agent-tint":`${f}10`,"--agent-tint-strong":`${f}1f`,"--agent-line":`${f}30`,"--agent-glow":`${f}55`,"--agent-accent":`linear-gradient(135deg, ${f}, ${f}88)`}:void 0,y=x.useCallback(w=>{var k;if(w.target.closest(".window-btn"))return;n(e.id);const C=(k=d.current)==null?void 0:k.getBoundingClientRect();C&&(m.current={type:"drag",offsetX:w.clientX-C.left,offsetY:w.clientY-C.top},w.preventDefault())},[n,e.id]),b=x.useCallback(w=>{n(e.id),m.current={type:"resize",startX:w.clientX,startY:w.clientY,startW:e.w,startH:e.h,startWinX:e.x,startWinY:e.y},w.preventDefault(),w.stopPropagation()},[n,e.id,e.w,e.h,e.x,e.y]);return x.useEffect(()=>{function w(C){const k=m.current;if(k){if(k.type==="drag"){const{x:j,y:R}=JT(C.clientX-k.offsetX,C.clientY-k.offsetY,e.h,ng());o(e.id,j,R)}else if(k.type==="resize"){const{w:j,h:R}=QT(k.startWinX,k.startWinY,k.startW+(C.clientX-k.startX),k.startH+(C.clientY-k.startY),ng());c(e.id,j,R)}}}function S(){m.current=null}return window.addEventListener("mousemove",w),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",S)}},[o,c,e.id,e.h]),h.jsxs("div",{ref:d,className:["window",t?"focused":"",e.minimized?"minimized":"",f?"agent-tinted":"",e.kind==="pin-note"?"pin-tinted":""].filter(Boolean).join(" "),style:{left:e.x,top:e.y,width:e.w,height:e.h,zIndex:e.z,..._},onMouseDown:()=>n(e.id),children:[h.jsxs("div",{className:"window-titlebar",onMouseDown:y,children:[h.jsxs("div",{className:"window-controls",children:[h.jsx("button",{type:"button",className:"window-btn close",title:"Close",onClick:w=>{w.stopPropagation(),r(e.id)}}),h.jsx("button",{type:"button",className:"window-btn min",title:"Minimize",onClick:w=>{w.stopPropagation(),a(e.id)}}),h.jsx("button",{type:"button",className:"window-btn max",title:"Maximize (TODO)",onClick:w=>w.stopPropagation()})]}),h.jsxs("div",{className:"window-title",children:[e.icon&&h.jsx("span",{className:"window-title-icon",children:e.icon}),h.jsx("span",{children:e.title}),e.meta&&h.jsxs("span",{className:"window-title-meta",children:["· ",e.meta]})]}),h.jsx("div",{className:"window-spacer"})]}),h.jsxs("div",{className:"window-body",children:[p,h.jsx("div",{className:"window-resize",onMouseDown:b})]})]})}function sM({browser:e,connected:t,onOpen:n}){var p,d;const[r,a]=x.useState(!1),[o,c]=x.useState(null),f=async()=>{a(!0),c(null);try{e.state==="stopped"&&await Me.browserRestart(e.view_id),n(e.view_id,e.agent)}catch(m){c(m.message)}finally{a(!1)}};return h.jsxs("div",{className:"browser-handoff-notice",role:"status",children:[h.jsxs("strong",{children:["Browser · ",(p=e.handoff)==null?void 0:p.agent," · ",e.state==="stopped"?"browser stopped":e.control==="human_control"?"waiting for you to hand back":"waiting for you"]}),h.jsx("span",{children:(d=e.handoff)==null?void 0:d.reason}),e.state==="stopped"&&h.jsx("span",{children:"Reopen the browser to continue. The previous page will not be replayed."}),!t&&h.jsx("span",{children:"Reconnecting — checking browser state…"}),h.jsx("button",{type:"button",disabled:r||!t,onClick:()=>void f(),children:r?"Opening…":e.state==="stopped"?"Reopen browser":"Open browser"}),o&&h.jsx("span",{role:"alert",children:o})]})}function aM(e,t){const[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(null),[p,d]=x.useState(!0),[m,_]=x.useState(0),y=x.useCallback(()=>_(b=>b+1),[]);return x.useEffect(()=>{let b=!1;return d(!0),Promise.all([Me.sessionModel(e,t).catch(()=>null),Me.sessionThinking(e,t).catch(()=>null),Me.sessionSampling(e,t).catch(()=>null)]).then(([w,S,C])=>{b||(r(w),o(S),f(C),d(!1))}),()=>{b=!0}},[e,t,m]),{model:n,thinking:a,sampling:c,loading:p,refresh:y}}function lS(){const[e,t]=x.useState([]),[n,r]=x.useState(!0),[a,o]=x.useState(null);return x.useEffect(()=>{let c=!1;return Me.agents().then(f=>{c||(t(f),r(!1))}).catch(f=>{c||(o(f.message),r(!1))}),()=>{c=!0}},[]),{agents:e,loading:n,error:a}}const pa=[.75,.9,1,1.1,1.25,1.5,1.75,2],ig=1,cS=pa[0],uS=pa[pa.length-1],hS="somora-chat-zoom";function Jb(e,t){let n=0,r=1/0;for(let o=0;o<pa.length;o++){const c=Math.abs(pa[o]-e);c<r&&(r=c,n=o)}const a=Math.min(Math.max(n+t,0),pa.length-1);return pa[a]}function oM(){try{const e=localStorage.getItem(hS);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t))typeof a!="number"||!Number.isFinite(a)||(n[r]=Math.min(Math.max(a,cS),uS));return n}catch{return{}}}let rg=oM();const sg=new Set,lM={};function cM(e){return sg.add(e),()=>{sg.delete(e)}}function ap(e,t){const n={...rg};t===ig?delete n[e]:n[e]=t,rg=n;try{localStorage.setItem(hS,JSON.stringify(n))}catch{}for(const r of sg)r()}function uM(e){const n=x.useSyncExternalStore(cM,()=>rg,()=>lM)[e]??ig,r=x.useCallback(()=>ap(e,Jb(n,1)),[e,n]),a=x.useCallback(()=>ap(e,Jb(n,-1)),[e,n]),o=x.useCallback(()=>ap(e,ig),[e]);return{zoom:n,zoomIn:r,zoomOut:a,resetZoom:o,canZoomIn:n<uS,canZoomOut:n>cS}}const dS=x.createContext(null);function hM({value:e,children:t}){return h.jsx(dS.Provider,{value:e,children:t})}function fS(){return x.useContext(dS)}function dM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gM={};function Qb(e,t){return(gM.jsx?pM:fM).test(e)}const mM=/[ \t\n\f\r]/g;function _M(e){return typeof e=="object"?e.type==="text"?e0(e.value):!1:e0(e)}function e0(e){return e.replace(mM,"")===""}class fc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}fc.prototype.normal={};fc.prototype.property={};fc.prototype.space=void 0;function pS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new fc(n,r,t)}function ag(e){return e.toLowerCase()}class Ei{constructor(t,n){this.attribute=n,this.property=t}}Ei.prototype.attribute="";Ei.prototype.booleanish=!1;Ei.prototype.boolean=!1;Ei.prototype.commaOrSpaceSeparated=!1;Ei.prototype.commaSeparated=!1;Ei.prototype.defined=!1;Ei.prototype.mustUseProperty=!1;Ei.prototype.number=!1;Ei.prototype.overloadedBoolean=!1;Ei.prototype.property="";Ei.prototype.spaceSeparated=!1;Ei.prototype.space=void 0;let vM=0;const pt=wa(),En=wa(),og=wa(),ze=wa(),Vt=wa(),ma=wa(),Ii=wa();function wa(){return 2**++vM}const lg=Object.freeze(Object.defineProperty({__proto__:null,boolean:pt,booleanish:En,commaOrSpaceSeparated:Ii,commaSeparated:ma,number:ze,overloadedBoolean:og,spaceSeparated:Vt},Symbol.toStringTag,{value:"Module"})),op=Object.keys(lg);class vm extends Ei{constructor(t,n,r,a){let o=-1;if(super(t,n),t0(this,"space",a),typeof r=="number")for(;++o<op.length;){const c=op[o];t0(this,op[o],(r&lg[c])===lg[c])}}}vm.prototype.defined=!0;function t0(e,t,n){n&&(e[t]=n)}function Co(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new vm(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[ag(r)]=r,n[ag(o.attribute)]=r}return new fc(t,n,e.space)}const gS=Co({properties:{ariaActiveDescendant:null,ariaAtomic:En,ariaAutoComplete:null,ariaBusy:En,ariaChecked:En,ariaColCount:ze,ariaColIndex:ze,ariaColSpan:ze,ariaControls:Vt,ariaCurrent:null,ariaDescribedBy:Vt,ariaDetails:null,ariaDisabled:En,ariaDropEffect:Vt,ariaErrorMessage:null,ariaExpanded:En,ariaFlowTo:Vt,ariaGrabbed:En,ariaHasPopup:null,ariaHidden:En,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vt,ariaLevel:ze,ariaLive:null,ariaModal:En,ariaMultiLine:En,ariaMultiSelectable:En,ariaOrientation:null,ariaOwns:Vt,ariaPlaceholder:null,ariaPosInSet:ze,ariaPressed:En,ariaReadOnly:En,ariaRelevant:null,ariaRequired:En,ariaRoleDescription:Vt,ariaRowCount:ze,ariaRowIndex:ze,ariaRowSpan:ze,ariaSelected:En,ariaSetSize:ze,ariaSort:null,ariaValueMax:ze,ariaValueMin:ze,ariaValueNow:ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mS(e,t){return t in e?e[t]:t}function _S(e,t){return mS(e,t.toLowerCase())}const yM=Co({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ma,acceptCharset:Vt,accessKey:Vt,action:null,allow:null,allowFullScreen:pt,allowPaymentRequest:pt,allowUserMedia:pt,alpha:pt,alt:null,as:null,async:pt,autoCapitalize:null,autoComplete:Vt,autoFocus:pt,autoPlay:pt,blocking:Vt,capture:null,charSet:null,checked:pt,cite:null,className:Vt,closedBy:null,colorSpace:null,cols:ze,colSpan:ze,command:null,commandFor:null,content:null,contentEditable:En,controls:pt,controlsList:Vt,coords:ze|ma,crossOrigin:null,data:null,dateTime:null,decoding:null,default:pt,defer:pt,dir:null,dirName:null,disabled:pt,download:og,draggable:En,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:pt,formTarget:null,headers:Vt,height:ze,hidden:og,high:ze,href:null,hrefLang:null,htmlFor:Vt,httpEquiv:Vt,id:null,imageSizes:null,imageSrcSet:null,inert:pt,inputMode:null,integrity:null,is:null,isMap:pt,itemId:null,itemProp:Vt,itemRef:Vt,itemScope:pt,itemType:Vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:pt,low:ze,manifest:null,max:null,maxLength:ze,media:null,method:null,min:null,minLength:ze,multiple:pt,muted:pt,name:null,nonce:null,noModule:pt,noValidate:pt,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:pt,optimum:ze,pattern:null,ping:Vt,placeholder:null,playsInline:pt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:pt,referrerPolicy:null,rel:Vt,required:pt,reversed:pt,rows:ze,rowSpan:ze,sandbox:Vt,scope:null,scoped:pt,seamless:pt,selected:pt,shadowRootClonable:pt,shadowRootCustomElementRegistry:pt,shadowRootDelegatesFocus:pt,shadowRootMode:null,shadowRootSerializable:pt,shape:null,size:ze,sizes:null,slot:null,span:ze,spellCheck:En,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ze,step:null,style:null,tabIndex:ze,target:null,title:null,translate:null,type:null,typeMustMatch:pt,useMap:null,value:En,width:ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vt,axis:null,background:null,bgColor:null,border:ze,borderColor:null,bottomMargin:ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:pt,declare:pt,event:null,face:null,frame:null,frameBorder:null,hSpace:ze,leftMargin:ze,link:null,longDesc:null,lowSrc:null,marginHeight:ze,marginWidth:ze,noResize:pt,noHref:pt,noShade:pt,noWrap:pt,object:null,profile:null,prompt:null,rev:null,rightMargin:ze,rules:null,scheme:null,scrolling:En,standby:null,summary:null,text:null,topMargin:ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:pt,disablePictureInPicture:pt,disableRemotePlayback:pt,exportParts:ma,part:Vt,prefix:null,property:null,results:ze,security:null,unselectable:null},space:"html",transform:_S}),bM=Co({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",maskType:"mask-type",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:Ii,accentHeight:ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ze,amplitude:ze,arabicForm:null,ascent:ze,attributeName:null,attributeType:null,azimuth:ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ze,by:null,calcMode:null,capHeight:ze,className:Vt,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:ze,diffuseConstant:ze,direction:null,display:null,dur:null,divisor:ze,dominantBaseline:null,download:pt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ze,enableBackground:null,end:null,event:null,exponent:ze,externalResourcesRequired:null,fill:null,fillOpacity:ze,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:ma,g2:ma,glyphName:ma,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ze,horizOriginX:ze,horizOriginY:ze,id:null,ideographic:ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ze,k:ze,k1:ze,k2:ze,k3:ze,k4:ze,kernelMatrix:Ii,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ze,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:ze,overlineThickness:ze,paintOrder:null,panose1:null,path:null,pathLength:ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ze,pointsAtY:ze,pointsAtZ:ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ii,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ii,rev:Ii,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ii,requiredFeatures:Ii,requiredFonts:Ii,requiredFormats:Ii,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:ze,specularExponent:ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ze,strikethroughThickness:ze,string:null,stroke:null,strokeDashArray:Ii,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ze,strokeOpacity:ze,strokeWidth:null,style:null,surfaceScale:ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ii,tabIndex:ze,tableValues:null,target:null,targetX:ze,targetY:ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ii,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ze,underlineThickness:ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ze,values:null,vAlphabetic:ze,vMathematical:ze,vectorEffect:null,vHanging:ze,vIdeographic:ze,version:null,vertAdvY:ze,vertOriginX:ze,vertOriginY:ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mS}),vS=Co({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),yS=Co({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_S}),bS=Co({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),xM={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"},SM=/[A-Z]/g,n0=/-[a-z]/g,wM=/^data[-\w.:]+$/i;function kM(e,t){const n=ag(t);let r=t,a=Ei;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&wM.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(n0,CM);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!n0.test(o)){let c=o.replace(SM,EM);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=vm}return new a(r,t)}function EM(e){return"-"+e.toLowerCase()}function CM(e){return e.charAt(1).toUpperCase()}const TM=pS([gS,yM,vS,yS,bS],"html"),ym=pS([gS,bM,vS,yS,bS],"svg");function MM(e){return e.join(" ").trim()}var so={},lp,i0;function AM(){if(i0)return lp;i0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
|
|
541
|
+
`,d="/",m="*",_="",y="comment",b="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var j=1,R=1;function L(G){var H=G.match(t);H&&(j+=H.length);var N=G.lastIndexOf(p);R=~N?G.length-N:R+G.length}function q(){var G={line:j,column:R};return function(H){return H.position=new O(G),ie(),H}}function O(G){this.start=G,this.end={line:j,column:R},this.source=k.source}O.prototype.content=C;function z(G){var H=new Error(k.source+":"+j+":"+R+": "+G);if(H.reason=G,H.filename=k.source,H.line=j,H.column=R,H.source=C,!k.silent)throw H}function J(G){var H=G.exec(C);if(H){var N=H[0];return L(N),C=C.slice(N.length),H}}function ie(){J(n)}function D(G){var H;for(G=G||[];H=A();)H!==!1&&G.push(H);return G}function A(){var G=q();if(!(d!=C.charAt(0)||m!=C.charAt(1))){for(var H=2;_!=C.charAt(H)&&(m!=C.charAt(H)||d!=C.charAt(H+1));)++H;if(H+=2,_===C.charAt(H-1))return z("End of comment missing");var N=C.slice(2,H-2);return R+=2,L(N),C=C.slice(H),R+=2,G({type:y,comment:N})}}function M(){var G=q(),H=J(r);if(H){if(A(),!J(a))return z("property missing ':'");var N=J(o),$=G({type:b,property:S(H[0].replace(e,_)),value:N?S(N[0].replace(e,_)):_});return J(c),$}}function P(){var G=[];D(G);for(var H;H=M();)H!==!1&&(G.push(H),D(G));return G}return ie(),P()}function S(C){return C?C.replace(f,_):_}return lp=w,lp}var r0;function RM(){if(r0)return so;r0=1;var e=so&&so.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(so,"__esModule",{value:!0}),so.default=n;const t=e(AM());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const c=(0,t.default)(r),f=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:d,value:m}=p;f?a(d,m,p):m&&(o=o||{},o[d]=m)}),o}return so}var kl={},s0;function NM(){if(s0)return kl;s0=1,Object.defineProperty(kl,"__esModule",{value:!0}),kl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(d){return!d||n.test(d)||e.test(d)},c=function(d,m){return m.toUpperCase()},f=function(d,m){return"".concat(m,"-")},p=function(d,m){return m===void 0&&(m={}),o(d)?d:(d=d.toLowerCase(),m.reactCompat?d=d.replace(a,f):d=d.replace(r,f),d.replace(t,c))};return kl.camelCase=p,kl}var El,a0;function OM(){if(a0)return El;a0=1;var e=El&&El.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(RM()),n=NM();function r(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,p){f&&p&&(c[(0,n.camelCase)(f,o)]=p)}),c}return r.default=r,El=r,El}var DM=OM();const LM=cc(DM),xS=SS("end"),bm=SS("start");function SS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function zM(e){const t=bm(e),n=xS(e);if(t&&n)return{start:t,end:n}}function Vl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?o0(e.position):"start"in e||"end"in e?o0(e):"line"in e||"column"in e?cg(e):""}function cg(e){return l0(e&&e.line)+":"+l0(e&&e.column)}function o0(e){return cg(e&&e.start)+"-"+cg(e&&e.end)}function l0(e){return e&&typeof e=="number"?e:1}class ni extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const p=r.indexOf(":");p===-1?o.ruleId=r:(o.source=r.slice(0,p),o.ruleId=r.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=Vl(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ni.prototype.file="";ni.prototype.name="";ni.prototype.reason="";ni.prototype.message="";ni.prototype.stack="";ni.prototype.column=void 0;ni.prototype.line=void 0;ni.prototype.ancestors=void 0;ni.prototype.cause=void 0;ni.prototype.fatal=void 0;ni.prototype.place=void 0;ni.prototype.ruleId=void 0;ni.prototype.source=void 0;const xm={}.hasOwnProperty,BM=new Map,jM=/[A-Z]/g,IM=new Set(["table","tbody","thead","tfoot","tr"]),PM=new Set(["td","th"]),wS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function UM(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=YM(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=GM(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ym:TM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=kS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function kS(e,t,n){if(t.type==="element")return HM(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $M(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qM(e,t,n);if(t.type==="mdxjsEsm")return FM(e,t);if(t.type==="root")return WM(e,t,n);if(t.type==="text")return KM(e,t)}function HM(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=ym,e.schema=a),e.ancestors.push(t);const o=CS(e,t.tagName,!1),c=VM(e,t);let f=wm(e,t);return IM.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!_M(p):!0})),ES(e,c,o,t),Sm(c,f),e.ancestors.pop(),e.schema=r,e.create(t,o,c,n)}function $M(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}nc(e,t.position)}function FM(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);nc(e,t.position)}function qM(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=ym,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:CS(e,t.name,!0),c=XM(e,t),f=wm(e,t);return ES(e,c,o,t),Sm(c,f),e.ancestors.pop(),e.schema=r,e.create(t,o,c,n)}function WM(e,t,n){const r={};return Sm(r,wm(e,t)),e.create(t,e.Fragment,r,n)}function KM(e,t){return t.value}function ES(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Sm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function GM(e,t,n){return r;function r(a,o,c,f){const d=Array.isArray(c.children)?n:t;return f?d(o,c,f):d(o,c)}}function YM(e,t){return n;function n(r,a,o,c){const f=Array.isArray(o.children),p=bm(r);return t(a,o,c,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function VM(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&xm.call(t.properties,a)){const o=ZM(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&PM.has(t.tagName)?r=f:n[c]=f}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function XM(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else nc(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const f=r.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else nc(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function wm(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:BM;for(;++r<t.children.length;){const o=t.children[r];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const d=a.get(p)||0;c=p+"-"+d,a.set(p,d+1)}}const f=kS(e,o,c);f!==void 0&&n.push(f)}return n}function ZM(e,t,n){const r=kM(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?dM(n):MM(n)),r.property==="style"){let a=typeof n=="object"?n:JM(e,String(n));return e.stylePropertyNameCase==="css"&&(a=QM(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?xM[r.property]||r.property:r.attribute,n]}}function JM(e,t){try{return LM(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new ni("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=wS+"#cannot-parse-style-attribute",a}}function CS(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=Qb(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}r=c}else r=Qb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return xm.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);nc(e)}function nc(e,t){const n=new ni("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=wS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function QM(e){const t={};let n;for(n in e)xm.call(e,n)&&(t[eA(n)]=e[n]);return t}function eA(e){let t=e.replace(jM,tA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function tA(e){return"-"+e.toLowerCase()}const cp={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"]},nA={};function km(e,t){const n=nA,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return TS(e,r,a)}function TS(e,t,n){if(iA(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return c0(e.children,t,n)}return Array.isArray(e)?c0(e,t,n):""}function c0(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=TS(e[a],t,n);return r.join("")}function iA(e){return!!(e&&typeof e=="object")}const u0=document.createElement("i");function Em(e){const t="&"+e+";";u0.innerHTML=t;const n=u0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pi(e,t,n,r){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)c=Array.from(r),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<r.length;)c=r.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Qi(e,t){return e.length>0?(Pi(e,e.length,0,t),e):t}const h0={}.hasOwnProperty;function MS(e){const t={};let n=-1;for(;++n<e.length;)rA(t,e[n]);return t}function rA(e,t){let n;for(n in t){const a=(h0.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){h0.call(a,c)||(a[c]=[]);const f=o[c];sA(a[c],Array.isArray(f)?f:f?[f]:[])}}}function sA(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Pi(e,0,0,r)}function AS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const li=Us(/[A-Za-z]/),ti=Us(/[\dA-Za-z]/),aA=Us(/[#-'*+\--9=?A-Z^-~]/);function mh(e){return e!==null&&(e<32||e===127)}const ug=Us(/\d/),oA=Us(/[\dA-Fa-f]/),lA=Us(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function Xt(e){return e!==null&&(e<0||e===32)}function Ct(e){return e===-2||e===-1||e===32}const jh=Us(new RegExp("\\p{P}|\\p{S}","u")),ya=Us(/\s/);function Us(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function To(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&ti(e.charCodeAt(n+1))&&ti(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(r,n),encodeURIComponent(c)),r=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Nt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return Ct(p)?(e.enter(n),f(p)):t(p)}function f(p){return Ct(p)&&o++<a?(e.consume(p),f):(e.exit(n),t(p))}}const cA={tokenize:uA};function uA(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Nt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return lt(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const hA={tokenize:dA},d0={tokenize:fA};function dA(e){const t=this,n=[];let r=0,a,o,c;return f;function f(R){if(r<n.length){const L=n[r];return t.containerState=L[1],e.attempt(L[0].continuation,p,d)(R)}return d(R)}function p(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&j();const L=t.events.length;let q=L,O;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){O=t.events[q][1].end;break}k(r);let z=L;for(;z<t.events.length;)t.events[z][1].end={...O},z++;return Pi(t.events,q+1,0,t.events.slice(L)),t.events.length=z,d(R)}return f(R)}function d(R){if(r===n.length){if(!a)return y(R);if(a.currentConstruct&&a.currentConstruct.concrete)return w(R);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(d0,m,_)(R)}function m(R){return a&&j(),k(r),y(R)}function _(R){return t.parser.lazy[t.now().line]=r!==n.length,c=t.now().offset,w(R)}function y(R){return t.containerState={},e.attempt(d0,b,w)(R)}function b(R){return r++,n.push([t.currentConstruct,t.containerState]),y(R)}function w(R){if(R===null){a&&j(),k(0),e.consume(R);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),S(R)}function S(R){if(R===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(R);return}return lt(R)?(e.consume(R),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(R),S)}function C(R,L){const q=t.sliceStream(R);if(L&&q.push(null),R.previous=o,o&&(o.next=R),o=R,a.defineSkip(R.start),a.write(q),t.parser.lazy[R.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<c&&(!a.events[O][1].end||a.events[O][1].end.offset>c))return;const z=t.events.length;let J=z,ie,D;for(;J--;)if(t.events[J][0]==="exit"&&t.events[J][1].type==="chunkFlow"){if(ie){D=t.events[J][1].end;break}ie=!0}for(k(r),O=z;O<t.events.length;)t.events[O][1].end={...D},O++;Pi(t.events,J+1,0,t.events.slice(z)),t.events.length=O}}function k(R){let L=n.length;for(;L-- >R;){const q=n[L];t.containerState=q[1],q[0].exit.call(t,e)}n.length=R}function j(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function fA(e,t,n){return Nt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yo(e){if(e===null||Xt(e)||ya(e))return 1;if(jh(e))return 2}function Ih(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const hg={name:"attention",resolveAll:pA,tokenize:gA};function pA(e,t){let n=-1,r,a,o,c,f,p,d,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const _={...e[r][1].end},y={...e[n][1].start};f0(_,-p),f0(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:_,end:{...e[r][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},o={type:p>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[r][1].end={...c.start},e[n][1].start={...f.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=Qi(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=Qi(d,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),d=Qi(d,Ih(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=Qi(d,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,d=Qi(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Pi(e,r-1,n-r+3,d),n=r+d.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function gA(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=yo(r);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===o)return e.consume(p),f;const d=e.exit("attentionSequence"),m=yo(p),_=!m||m===2&&a||n.includes(p),y=!a||a===2&&m||n.includes(r);return d._open=!!(o===42?_:_&&(a||!y)),d._close=!!(o===42?y:y&&(m||!_)),t(p)}}function f0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mA={name:"autolink",tokenize:_A};function _A(e,t,n){let r=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(b){return li(b)?(e.consume(b),c):b===64?n(b):d(b)}function c(b){return b===43||b===45||b===46||ti(b)?(r=1,f(b)):d(b)}function f(b){return b===58?(e.consume(b),r=0,p):(b===43||b===45||b===46||ti(b))&&r++<32?(e.consume(b),f):(r=0,d(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||mh(b)?n(b):(e.consume(b),p)}function d(b){return b===64?(e.consume(b),m):aA(b)?(e.consume(b),d):n(b)}function m(b){return ti(b)?_(b):n(b)}function _(b){return b===46?(e.consume(b),r=0,m):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||ti(b))&&r++<63){const w=b===45?y:_;return e.consume(b),w}return n(b)}}const pc={partial:!0,tokenize:vA};function vA(e,t,n){return r;function r(o){return Ct(o)?Nt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||lt(o)?t(o):n(o)}}const RS={continuation:{tokenize:bA},exit:xA,name:"blockQuote",tokenize:yA};function yA(e,t,n){const r=this;return a;function a(c){if(c===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Ct(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function bA(e,t,n){const r=this;return a;function a(c){return Ct(c)?Nt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(RS,t,n)(c)}}function xA(e){e.exit("blockQuote")}const NS={name:"characterEscape",tokenize:SA};function SA(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return lA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const OS={name:"characterReference",tokenize:wA};function wA(e,t,n){const r=this;let a=0,o,c;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),p}function p(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),o=31,c=ti,m(_))}function d(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=oA,m):(e.enter("characterReferenceValue"),o=7,c=ug,m(_))}function m(_){if(_===59&&a){const y=e.exit("characterReferenceValue");return c===ti&&!Em(r.sliceSerialize(y))?n(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(_)&&a++<o?(e.consume(_),m):n(_)}}const p0={partial:!0,tokenize:EA},g0={concrete:!0,name:"codeFenced",tokenize:kA};function kA(e,t,n){const r=this,a={partial:!0,tokenize:q};let o=0,c=0,f;return p;function p(O){return d(O)}function d(O){const z=r.events[r.events.length-1];return o=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(O)}function m(O){return O===f?(c++,e.consume(O),m):c<3?n(O):(e.exit("codeFencedFenceSequence"),Ct(O)?Nt(e,_,"whitespace")(O):_(O))}function _(O){return O===null||lt(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(p0,S,L)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(O))}function y(O){return O===null||lt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(O)):Ct(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Nt(e,b,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),y)}function b(O){return O===null||lt(O)?_(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(O))}function w(O){return O===null||lt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(O)):O===96&&O===f?n(O):(e.consume(O),w)}function S(O){return e.attempt(a,L,C)(O)}function C(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),k}function k(O){return o>0&&Ct(O)?Nt(e,j,"linePrefix",o+1)(O):j(O)}function j(O){return O===null||lt(O)?e.check(p0,S,L)(O):(e.enter("codeFlowValue"),R(O))}function R(O){return O===null||lt(O)?(e.exit("codeFlowValue"),j(O)):(e.consume(O),R)}function L(O){return e.exit("codeFenced"),t(O)}function q(O,z,J){let ie=0;return D;function D(H){return O.enter("lineEnding"),O.consume(H),O.exit("lineEnding"),A}function A(H){return O.enter("codeFencedFence"),Ct(H)?Nt(O,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):M(H)}function M(H){return H===f?(O.enter("codeFencedFenceSequence"),P(H)):J(H)}function P(H){return H===f?(ie++,O.consume(H),P):ie>=c?(O.exit("codeFencedFenceSequence"),Ct(H)?Nt(O,G,"whitespace")(H):G(H)):J(H)}function G(H){return H===null||lt(H)?(O.exit("codeFencedFence"),z(H)):J(H)}}}function EA(e,t,n){const r=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}const up={name:"codeIndented",tokenize:TA},CA={partial:!0,tokenize:MA};function TA(e,t,n){const r=this;return a;function a(d){return e.enter("codeIndented"),Nt(e,o,"linePrefix",5)(d)}function o(d){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?c(d):n(d)}function c(d){return d===null?p(d):lt(d)?e.attempt(CA,c,p)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||lt(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function p(d){return e.exit("codeIndented"),t(d)}}function MA(e,t,n){const r=this;return a;function a(c){return r.parser.lazy[r.now().line]?n(c):lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Nt(e,o,"linePrefix",5)(c)}function o(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):lt(c)?a(c):n(c)}}const AA={name:"codeText",previous:NA,resolve:RA,tokenize:OA};function RA(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function NA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OA(e,t,n){let r=0,a,o;return c;function c(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),r++,f):(e.exit("codeTextSequence"),p(_))}function p(_){return _===null?n(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),p):_===96?(o=e.enter("codeTextSequence"),a=0,m(_)):lt(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),d(_))}function d(_){return _===null||_===32||_===96||lt(_)?(e.exit("codeTextData"),p(_)):(e.consume(_),d)}function m(_){return _===96?(e.consume(_),a++,m):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(o.type="codeTextData",d(_))}}class DA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Cl(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Cl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Cl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Cl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Cl(this.left,n.reverse())}}}function Cl(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 DS(e){const t={};let n=-1,r,a,o,c,f,p,d;const m=new DA(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,LA(m,n)),n=t[n],d=!0);else if(r[1]._container){for(o=n,a=void 0;o--;)if(c=m.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(m.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(r[1].end={...m.get(a)[1].start},f=m.slice(a,n),f.unshift(r),m.splice(a,n-a+1,f))}}return Pi(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!d}function LA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,p=[],d={};let m,_,y=-1,b=n,w=0,S=0;const C=[S];for(;b;){for(;e.get(++a)[1]!==b;);o.push(a),b._tokenizer||(m=r.sliceStream(b),b.next||m.push(null),_&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(m),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),_=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(S=y+1,C.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),y=C.length;y--;){const k=f.slice(C[y],C[y+1]),j=o.pop();p.push([j,j+k.length-1]),e.splice(j,2,k)}for(p.reverse(),y=-1;++y<p.length;)d[w+p[y][0]]=w+p[y][1],w+=p[y][1]-p[y][0]-1;return d}const zA={resolve:jA,tokenize:IA},BA={partial:!0,tokenize:PA};function jA(e){return DS(e),e}function IA(e,t){let n;return r;function r(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):lt(f)?e.check(BA,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function PA(e,t,n){const r=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Nt(e,o,"linePrefix")}function o(c){if(c===null||lt(c))return n(c);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,n,t)(c)}}function LS(e,t,n,r,a,o,c,f,p){const d=p||Number.POSITIVE_INFINITY;let m=0;return _;function _(k){return k===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(k),e.exit(o),y):k===null||k===32||k===41||mh(k)?n(k):(e.enter(r),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),S(k))}function y(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(f),y(k)):k===null||k===60||lt(k)?n(k):(e.consume(k),k===92?w:b)}function w(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function S(k){return!m&&(k===null||k===41||Xt(k))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(r),t(k)):m<d&&k===40?(e.consume(k),m++,S):k===41?(e.consume(k),m--,S):k===null||k===32||k===40||mh(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function zS(e,t,n,r,a,o){const c=this;let f=0,p;return d;function d(b){return e.enter(r),e.enter(a),e.consume(b),e.exit(a),e.enter(o),m}function m(b){return f>999||b===null||b===91||b===93&&!p||b===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(o),e.enter(a),e.consume(b),e.exit(a),e.exit(r),t):lt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===null||b===91||b===93||lt(b)||f++>999?(e.exit("chunkString"),m(b)):(e.consume(b),p||(p=!Ct(b)),b===92?y:_)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,_):_(b)}}function BS(e,t,n,r,a,o){let c;return f;function f(y){return y===34||y===39||y===40?(e.enter(r),e.enter(a),e.consume(y),e.exit(a),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):(e.enter(o),d(y))}function d(y){return y===c?(e.exit(o),p(c)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Nt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===c||y===null||lt(y)?(e.exit("chunkString"),d(y)):(e.consume(y),y===92?_:m)}function _(y){return y===c||y===92?(e.consume(y),m):m(y)}}function Xl(e,t){let n;return r;function r(a){return lt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ct(a)?Nt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const UA={name:"definition",tokenize:$A},HA={partial:!0,tokenize:FA};function $A(e,t,n){const r=this;let a;return o;function o(b){return e.enter("definition"),c(b)}function c(b){return zS.call(r,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return a=ur(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return Xt(b)?Xl(e,d)(b):d(b)}function d(b){return LS(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function m(b){return e.attempt(HA,_,_)(b)}function _(b){return Ct(b)?Nt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||lt(b)?(e.exit("definition"),r.parser.defined.push(a),t(b)):n(b)}}function FA(e,t,n){return r;function r(f){return Xt(f)?Xl(e,a)(f):n(f)}function a(f){return BS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Ct(f)?Nt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||lt(f)?t(f):n(f)}}const qA={name:"hardBreakEscape",tokenize:WA};function WA(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return lt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const KA={name:"headingAtx",resolve:GA,tokenize:YA};function GA(e,t){let n=e.length-2,r=3,a,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Pi(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function YA(e,t,n){let r=0;return a;function a(m){return e.enter("atxHeading"),o(m)}function o(m){return e.enter("atxHeadingSequence"),c(m)}function c(m){return m===35&&r++<6?(e.consume(m),c):m===null||Xt(m)?(e.exit("atxHeadingSequence"),f(m)):n(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),p(m)):m===null||lt(m)?(e.exit("atxHeading"),t(m)):Ct(m)?Nt(e,f,"whitespace")(m):(e.enter("atxHeadingText"),d(m))}function p(m){return m===35?(e.consume(m),p):(e.exit("atxHeadingSequence"),f(m))}function d(m){return m===null||m===35||Xt(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),d)}}const VA=["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"],m0=["pre","script","style","textarea"],XA={concrete:!0,name:"htmlFlow",resolveTo:QA,tokenize:eR},ZA={partial:!0,tokenize:nR},JA={partial:!0,tokenize:tR};function QA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(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}function eR(e,t,n){const r=this;let a,o,c,f,p;return d;function d(E){return m(E)}function m(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),_}function _(E){return E===33?(e.consume(E),y):E===47?(e.consume(E),o=!0,S):E===63?(e.consume(E),a=3,r.interrupt?t:U):li(E)?(e.consume(E),c=String.fromCharCode(E),C):n(E)}function y(E){return E===45?(e.consume(E),a=2,b):E===91?(e.consume(E),a=5,f=0,w):li(E)?(e.consume(E),a=4,r.interrupt?t:U):n(E)}function b(E){return E===45?(e.consume(E),r.interrupt?t:U):n(E)}function w(E){const F="CDATA[";return E===F.charCodeAt(f++)?(e.consume(E),f===F.length?r.interrupt?t:M:w):n(E)}function S(E){return li(E)?(e.consume(E),c=String.fromCharCode(E),C):n(E)}function C(E){if(E===null||E===47||E===62||Xt(E)){const F=E===47,Y=c.toLowerCase();return!F&&!o&&m0.includes(Y)?(a=1,r.interrupt?t(E):M(E)):VA.includes(c.toLowerCase())?(a=6,F?(e.consume(E),k):r.interrupt?t(E):M(E)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):o?j(E):R(E))}return E===45||ti(E)?(e.consume(E),c+=String.fromCharCode(E),C):n(E)}function k(E){return E===62?(e.consume(E),r.interrupt?t:M):n(E)}function j(E){return Ct(E)?(e.consume(E),j):D(E)}function R(E){return E===47?(e.consume(E),D):E===58||E===95||li(E)?(e.consume(E),L):Ct(E)?(e.consume(E),R):D(E)}function L(E){return E===45||E===46||E===58||E===95||ti(E)?(e.consume(E),L):q(E)}function q(E){return E===61?(e.consume(E),O):Ct(E)?(e.consume(E),q):R(E)}function O(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),p=E,z):Ct(E)?(e.consume(E),O):J(E)}function z(E){return E===p?(e.consume(E),p=null,ie):E===null||lt(E)?n(E):(e.consume(E),z)}function J(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Xt(E)?q(E):(e.consume(E),J)}function ie(E){return E===47||E===62||Ct(E)?R(E):n(E)}function D(E){return E===62?(e.consume(E),A):n(E)}function A(E){return E===null||lt(E)?M(E):Ct(E)?(e.consume(E),A):n(E)}function M(E){return E===45&&a===2?(e.consume(E),N):E===60&&a===1?(e.consume(E),$):E===62&&a===4?(e.consume(E),W):E===63&&a===3?(e.consume(E),U):E===93&&a===5?(e.consume(E),re):lt(E)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(ZA,I,P)(E)):E===null||lt(E)?(e.exit("htmlFlowData"),P(E)):(e.consume(E),M)}function P(E){return e.check(JA,G,I)(E)}function G(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),H}function H(E){return E===null||lt(E)?P(E):(e.enter("htmlFlowData"),M(E))}function N(E){return E===45?(e.consume(E),U):M(E)}function $(E){return E===47?(e.consume(E),c="",K):M(E)}function K(E){if(E===62){const F=c.toLowerCase();return m0.includes(F)?(e.consume(E),W):M(E)}return li(E)&&c.length<8?(e.consume(E),c+=String.fromCharCode(E),K):M(E)}function re(E){return E===93?(e.consume(E),U):M(E)}function U(E){return E===62?(e.consume(E),W):E===45&&a===2?(e.consume(E),U):M(E)}function W(E){return E===null||lt(E)?(e.exit("htmlFlowData"),I(E)):(e.consume(E),W)}function I(E){return e.exit("htmlFlow"),t(E)}}function tR(e,t,n){const r=this;return a;function a(c){return lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}function nR(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(pc,t,n)}}const iR={name:"htmlText",tokenize:rR};function rR(e,t,n){const r=this;let a,o,c;return f;function f(U){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(U),p}function p(U){return U===33?(e.consume(U),d):U===47?(e.consume(U),q):U===63?(e.consume(U),R):li(U)?(e.consume(U),J):n(U)}function d(U){return U===45?(e.consume(U),m):U===91?(e.consume(U),o=0,w):li(U)?(e.consume(U),j):n(U)}function m(U){return U===45?(e.consume(U),b):n(U)}function _(U){return U===null?n(U):U===45?(e.consume(U),y):lt(U)?(c=_,$(U)):(e.consume(U),_)}function y(U){return U===45?(e.consume(U),b):_(U)}function b(U){return U===62?N(U):U===45?y(U):_(U)}function w(U){const W="CDATA[";return U===W.charCodeAt(o++)?(e.consume(U),o===W.length?S:w):n(U)}function S(U){return U===null?n(U):U===93?(e.consume(U),C):lt(U)?(c=S,$(U)):(e.consume(U),S)}function C(U){return U===93?(e.consume(U),k):S(U)}function k(U){return U===62?N(U):U===93?(e.consume(U),k):S(U)}function j(U){return U===null||U===62?N(U):lt(U)?(c=j,$(U)):(e.consume(U),j)}function R(U){return U===null?n(U):U===63?(e.consume(U),L):lt(U)?(c=R,$(U)):(e.consume(U),R)}function L(U){return U===62?N(U):R(U)}function q(U){return li(U)?(e.consume(U),O):n(U)}function O(U){return U===45||ti(U)?(e.consume(U),O):z(U)}function z(U){return lt(U)?(c=z,$(U)):Ct(U)?(e.consume(U),z):N(U)}function J(U){return U===45||ti(U)?(e.consume(U),J):U===47||U===62||Xt(U)?ie(U):n(U)}function ie(U){return U===47?(e.consume(U),N):U===58||U===95||li(U)?(e.consume(U),D):lt(U)?(c=ie,$(U)):Ct(U)?(e.consume(U),ie):N(U)}function D(U){return U===45||U===46||U===58||U===95||ti(U)?(e.consume(U),D):A(U)}function A(U){return U===61?(e.consume(U),M):lt(U)?(c=A,$(U)):Ct(U)?(e.consume(U),A):ie(U)}function M(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),a=U,P):lt(U)?(c=M,$(U)):Ct(U)?(e.consume(U),M):(e.consume(U),G)}function P(U){return U===a?(e.consume(U),a=void 0,H):U===null?n(U):lt(U)?(c=P,$(U)):(e.consume(U),P)}function G(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||Xt(U)?ie(U):(e.consume(U),G)}function H(U){return U===47||U===62||Xt(U)?ie(U):n(U)}function N(U){return U===62?(e.consume(U),e.exit("htmlTextData"),e.exit("htmlText"),t):n(U)}function $(U){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),K}function K(U){return Ct(U)?Nt(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):re(U)}function re(U){return e.enter("htmlTextData"),c(U)}}const Cm={name:"labelEnd",resolveAll:lR,resolveTo:cR,tokenize:uR},sR={tokenize:hR},aR={tokenize:dR},oR={tokenize:fR};function lR(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Pi(e,0,e.length,n),e}function cR(e,t){let n=e.length,r=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},m={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",p,t],["enter",d,t]],f=Qi(f,e.slice(o+1,o+r+3)),f=Qi(f,[["enter",m,t]]),f=Qi(f,Ih(t.parser.constructs.insideSpan.null,e.slice(o+r+4,c-3),t)),f=Qi(f,[["exit",m,t],e[c-2],e[c-1],["exit",d,t]]),f=Qi(f,e.slice(c+1)),f=Qi(f,[["exit",p,t]]),Pi(e,o,e.length,f),e}function uR(e,t,n){const r=this;let a=r.events.length,o,c;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){o=r.events[a][1];break}return f;function f(y){return o?o._inactive?_(y):(c=r.parser.defined.includes(ur(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt(sR,m,c?m:_)(y):y===91?e.attempt(aR,m,c?d:_)(y):c?m(y):_(y)}function d(y){return e.attempt(oR,m,_)(y)}function m(y){return t(y)}function _(y){return o._balanced=!0,n(y)}}function hR(e,t,n){return r;function r(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return Xt(_)?Xl(e,o)(_):o(_)}function o(_){return _===41?m(_):LS(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return Xt(_)?Xl(e,p)(_):m(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?BS(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):m(_)}function d(_){return Xt(_)?Xl(e,m)(_):m(_)}function m(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):n(_)}}function dR(e,t,n){const r=this;return a;function a(f){return zS.call(r,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return r.parser.defined.includes(ur(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function fR(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const pR={name:"labelStartImage",resolveAll:Cm.resolveAll,tokenize:gR};function gR(e,t,n){const r=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(f):t(f)}}const mR={name:"labelStartLink",resolveAll:Cm.resolveAll,tokenize:_R};function _R(e,t,n){const r=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const hp={name:"lineEnding",tokenize:vR};function vR(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Nt(e,t,"linePrefix")}}const nh={name:"thematicBreak",tokenize:yR};function yR(e,t,n){let r=0,a;return o;function o(d){return e.enter("thematicBreak"),c(d)}function c(d){return a=d,f(d)}function f(d){return d===a?(e.enter("thematicBreakSequence"),p(d)):r>=3&&(d===null||lt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function p(d){return d===a?(e.consume(d),r++,p):(e.exit("thematicBreakSequence"),Ct(d)?Nt(e,f,"whitespace")(d):f(d))}}const wi={continuation:{tokenize:wR},exit:ER,name:"list",tokenize:SR},bR={partial:!0,tokenize:CR},xR={partial:!0,tokenize:kR};function SR(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(b){const w=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:ug(b)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(nh,n,d)(b):d(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return ug(b)&&++c<10?(e.consume(b),p):(!r.interrupt||c<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),d(b)):n(b)}function d(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(pc,r.interrupt?n:m,e.attempt(bR,y,_))}function m(b){return r.containerState.initialBlankLine=!0,o++,y(b)}function _(b){return Ct(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function wR(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pc,a,o);function a(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Nt(e,t,"listItemIndent",r.containerState.size+1)(f)}function o(f){return r.containerState.furtherBlankLines||!Ct(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xR,t,c)(f))}function c(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,Nt(e,e.attempt(wi,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function kR(e,t,n){const r=this;return Nt(e,a,"listItemIndent",r.containerState.size+1);function a(o){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(o):n(o)}}function ER(e){e.exit(this.containerState.type)}function CR(e,t,n){const r=this;return Nt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=r.events[r.events.length-1];return!Ct(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const _0={name:"setextUnderline",resolveTo:TR,tokenize:MR};function TR(e,t){let n=e.length,r,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function MR(e,t,n){const r=this;let a;return o;function o(d){let m=r.events.length,_;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){_=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||_)?(e.enter("setextHeadingLine"),a=d,c(d)):n(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===a?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),Ct(d)?Nt(e,p,"lineSuffix")(d):p(d))}function p(d){return d===null||lt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const AR={tokenize:RR};function RR(e){const t=this,n=e.attempt(pc,r,e.attempt(this.parser.constructs.flowInitial,a,Nt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(zA,a)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const NR={resolveAll:IS()},OR=jS("string"),DR=jS("text");function jS(e){return{resolveAll:IS(e==="text"?LR:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(m){return d(m)?o(m):f(m)}function f(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),p}function p(m){return d(m)?(n.exit("data"),o(m)):(n.consume(m),p)}function d(m){if(m===null)return!0;const _=a[m];let y=-1;if(_)for(;++y<_.length;){const b=_[y];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function IS(e){return t;function t(n,r){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,r):n}}function LR(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let o=a.length,c=-1,f=0,p;for(;o--;){const d=a[o];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)p=!0,f++;else if(d!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const d={type:n===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:r.start._bufferIndex+c,_index:r.start._index+o,line:r.end.line,column:r.end.column-f,offset:r.end.offset-f},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const zR={42:wi,43:wi,45:wi,48:wi,49:wi,50:wi,51:wi,52:wi,53:wi,54:wi,55:wi,56:wi,57:wi,62:RS},BR={91:UA},jR={[-2]:up,[-1]:up,32:up},IR={35:KA,42:nh,45:[_0,nh],60:XA,61:_0,95:nh,96:g0,126:g0},PR={38:OS,92:NS},UR={[-5]:hp,[-4]:hp,[-3]:hp,33:pR,38:OS,42:hg,60:[mA,iR],91:mR,92:[qA,NS],93:Cm,95:hg,96:AA},HR={null:[hg,NR]},$R={null:[42,95]},FR={null:[]},qR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$R,contentInitial:BR,disable:FR,document:zR,flow:IR,flowInitial:jR,insideSpan:HR,string:PR,text:UR},Symbol.toStringTag,{value:"Module"}));function WR(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const p={attempt:z(q),check:z(O),consume:j,enter:R,exit:L,interrupt:z(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:_};let m=t.tokenize.call(d,p);return t.resolveAll&&o.push(t),d;function _(A){return c=Qi(c,A),C(),c[c.length-1]!==null?[]:(J(t,0),d.events=Ih(o,d.events,d),d.events)}function y(A,M){return GR(b(A),M)}function b(A){return KR(c,A)}function w(){const{_bufferIndex:A,_index:M,line:P,column:G,offset:H}=r;return{_bufferIndex:A,_index:M,line:P,column:G,offset:H}}function S(A){a[A.line]=A.column,D()}function C(){let A;for(;r._index<c.length;){const M=c[r._index];if(typeof M=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<M.length;)k(M.charCodeAt(r._bufferIndex));else k(M)}}function k(A){m=m(A)}function j(A){lt(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,D()):A!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=A}function R(A,M){const P=M||{};return P.type=A,P.start=w(),d.events.push(["enter",P,d]),f.push(P),P}function L(A){const M=f.pop();return M.end=w(),d.events.push(["exit",M,d]),M}function q(A,M){J(A,M.from)}function O(A,M){M.restore()}function z(A,M){return P;function P(G,H,N){let $,K,re,U;return Array.isArray(G)?I(G):"tokenize"in G?I([G]):W(G);function W(Z){return ve;function ve(Oe){const _e=Oe!==null&&Z[Oe],Fe=Oe!==null&&Z.null,st=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return I(st)(Oe)}}function I(Z){return $=Z,K=0,Z.length===0?N:E(Z[K])}function E(Z){return ve;function ve(Oe){return U=ie(),re=Z,Z.partial||(d.currentConstruct=Z),Z.name&&d.parser.constructs.disable.null.includes(Z.name)?Y():Z.tokenize.call(M?Object.assign(Object.create(d),M):d,p,F,Y)(Oe)}}function F(Z){return A(re,U),H}function Y(Z){return U.restore(),++K<$.length?E($[K]):N}}}function J(A,M){A.resolveAll&&!o.includes(A)&&o.push(A),A.resolve&&Pi(d.events,M,d.events.length-M,A.resolve(d.events.slice(M),d)),A.resolveTo&&(d.events=A.resolveTo(d.events,d))}function ie(){const A=w(),M=d.previous,P=d.currentConstruct,G=d.events.length,H=Array.from(f);return{from:G,restore:N};function N(){r=A,d.previous=M,d.currentConstruct=P,d.events.length=G,f=H,D()}}function D(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function KR(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(r,o)];else{if(c=e.slice(n,a),r>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(r):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function GR(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
542
|
+
`;break}case-3:{c=`\r
|
|
543
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,r.push(c)}return r.join("")}function YR(e){const r={constructs:MS([qR,...(e||{}).extensions||[]]),content:a(cA),defined:[],document:a(hA),flow:a(AR),lazy:{},string:a(OR),text:a(DR)};return r;function a(o){return c;function c(f){return WR(r,o,f)}}}function VR(e){for(;!DS(e););return e}const v0=/[\0\t\n\r]/g;function XR(){let e=1,t="",n=!0,r;return a;function a(o,c,f){const p=[];let d,m,_,y,b;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),_=0,t="",n&&(o.charCodeAt(0)===65279&&_++,n=void 0);_<o.length;){if(v0.lastIndex=_,d=v0.exec(o),y=d&&d.index!==void 0?d.index:o.length,b=o.charCodeAt(y),!d){t=o.slice(_);break}if(b===10&&_===y&&r)p.push(-3),r=void 0;else switch(r&&(p.push(-5),r=void 0),_<y&&(p.push(o.slice(_,y)),e+=y-_),b){case 0:{p.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,p.push(-2);e++<m;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:r=!0,e=1}_=y+1}return f&&(r&&p.push(-5),t&&p.push(t),p.push(null)),p}}const ZR=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JR(e){return e.replace(ZR,QR)}function QR(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return AS(n.slice(o?2:1),o?16:10)}return Em(n)||e}const PS={}.hasOwnProperty;function eN(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),tN(n)(VR(YR(n).document().write(XR()(e,t,!0))))}function tN(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ce),autolinkProtocol:ie,autolinkEmail:ie,atxHeading:o(nt),blockQuote:o(Fe),characterEscape:ie,characterReference:ie,codeFenced:o(st),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(st,c),codeText:o(ae,c),codeTextData:ie,data:ie,codeFlowValue:ie,definition:o(pe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Xe),hardBreakEscape:o(Pe),hardBreakTrailing:o(Pe),htmlFlow:o(at,c),htmlFlowData:ie,htmlText:o(at,c),htmlTextData:ie,image:o(V),label:c,link:o(ce),listItem:o(fe),listItemValue:y,listOrdered:o(X,_),listUnordered:o(X),paragraph:o(Le),reference:E,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(nt),strong:o(Ge),thematicBreak:o(gt)},exit:{atxHeading:p(),atxHeadingSequence:q,autolink:p(),autolinkEmail:_e,autolinkProtocol:Oe,blockQuote:p(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:Z,characterReference:ve,codeFenced:p(C),codeFencedFence:S,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:D,codeIndented:p(k),codeText:p(H),codeTextData:D,data:D,definition:p(),definitionDestinationString:L,definitionLabelString:j,definitionTitleString:R,emphasis:p(),hardBreakEscape:p(M),hardBreakTrailing:p(M),htmlFlow:p(P),htmlFlowData:D,htmlText:p(G),htmlTextData:D,image:p($),label:re,labelText:K,lineEnding:A,link:p(N),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:F,resourceDestinationString:U,resourceTitleString:W,resource:I,setextHeading:p(J),setextHeadingLineSequence:z,setextHeadingText:O,strong:p(),thematicBreak:p()}};US(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(le){let be={type:"root",children:[]};const Se={stack:[be],tokenStack:[],config:t,enter:f,exit:d,buffer:c,resume:m,data:n},Q=[];let ge=-1;for(;++ge<le.length;)if(le[ge][1].type==="listOrdered"||le[ge][1].type==="listUnordered")if(le[ge][0]==="enter")Q.push(ge);else{const Ae=Q.pop();ge=a(le,Ae,ge)}for(ge=-1;++ge<le.length;){const Ae=t[le[ge][0]];PS.call(Ae,le[ge][1].type)&&Ae[le[ge][1].type].call(Object.assign({sliceSerialize:le[ge][2].sliceSerialize},Se),le[ge][1])}if(Se.tokenStack.length>0){const Ae=Se.tokenStack[Se.tokenStack.length-1];(Ae[1]||y0).call(Se,void 0,Ae[0])}for(be.position={start:Ms(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Ms(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<t.transforms.length;)be=t.transforms[ge](be)||be;return be}function a(le,be,Se){let Q=be-1,ge=-1,Ae=!1,Ne,Be,Ue,We;for(;++Q<=Se;){const $e=le[Q];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?ge++:ge--,We=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(Ne&&!We&&!ge&&!Ue&&(Ue=Q),We=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:We=void 0}if(!ge&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||ge===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(Ne){let ft=Q;for(Be=void 0;ft--;){const Bt=le[ft];if(Bt[1].type==="lineEnding"||Bt[1].type==="lineEndingBlank"){if(Bt[0]==="exit")continue;Be&&(le[Be][1].type="lineEndingBlank",Ae=!0),Bt[1].type="lineEnding",Be=ft}else if(!(Bt[1].type==="linePrefix"||Bt[1].type==="blockQuotePrefix"||Bt[1].type==="blockQuotePrefixWhitespace"||Bt[1].type==="blockQuoteMarker"||Bt[1].type==="listItemIndent"))break}Ue&&(!Be||Ue<Be)&&(Ne._spread=!0),Ne.end=Object.assign({},Be?le[Be][1].start:$e[1].end),le.splice(Be||Q,0,["exit",Ne,$e[2]]),Q++,Se++}if($e[1].type==="listItemPrefix"){const ft={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};Ne=ft,le.splice(Q,0,["enter",ft,$e[2]]),Q++,Se++,Ue=void 0,We=!0}}}return le[be][1]._spread=Ae,Se}function o(le,be){return Se;function Se(Q){f.call(this,le(Q),Q),be&&be.call(this,Q)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(le,be,Se){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([be,Se||void 0]),le.position={start:Ms(be.start),end:void 0}}function p(le){return be;function be(Se){le&&le.call(this,Se),d.call(this,Se)}}function d(le,be){const Se=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==le.type&&(be?be.call(this,le,Q[0]):(Q[1]||y0).call(this,le,Q[0]));else throw new Error("Cannot close `"+le.type+"` ("+Vl({start:le.start,end:le.end})+"): it’s not open");Se.position.end=Ms(le.end)}function m(){return km(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),be=this.stack[this.stack.length-1];be.lang=le}function w(){const le=this.resume(),be=this.stack[this.stack.length-1];be.meta=le}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/(\r?\n|\r)$/g,"")}function j(le){const be=this.resume(),Se=this.stack[this.stack.length-1];Se.label=be,Se.identifier=ur(this.sliceSerialize(le)).toLowerCase()}function R(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function L(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function q(le){const be=this.stack[this.stack.length-1];if(!be.depth){const Se=this.sliceSerialize(le).length;be.depth=Se}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function z(le){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function ie(le){const Se=this.stack[this.stack.length-1].children;let Q=Se[Se.length-1];(!Q||Q.type!=="text")&&(Q=Te(),Q.position={start:Ms(le.start),end:void 0},Se.push(Q)),this.stack.push(Q)}function D(le){const be=this.stack.pop();be.value+=this.sliceSerialize(le),be.position.end=Ms(le.end)}function A(le){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=be.children[be.children.length-1];Se.position.end=Ms(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(ie.call(this,le),D.call(this,le))}function M(){this.data.atHardBreak=!0}function P(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function G(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function H(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function N(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function $(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function K(le){const be=this.sliceSerialize(le),Se=this.stack[this.stack.length-2];Se.label=JR(be),Se.identifier=ur(be).toLowerCase()}function re(){const le=this.stack[this.stack.length-1],be=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Q=le.children;Se.children=Q}else Se.alt=be}function U(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function W(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function I(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function F(le){const be=this.resume(),Se=this.stack[this.stack.length-1];Se.label=be,Se.identifier=ur(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function Y(le){this.data.characterReferenceType=le.type}function Z(le){const be=this.sliceSerialize(le),Se=this.data.characterReferenceType;let Q;Se?(Q=AS(be,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=Em(be);const ge=this.stack[this.stack.length-1];ge.value+=Q}function ve(le){const be=this.stack.pop();be.position.end=Ms(le.end)}function Oe(le){D.call(this,le);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(le)}function _e(le){D.call(this,le);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(le)}function Fe(){return{type:"blockquote",children:[]}}function st(){return{type:"code",lang:null,meta:null,value:""}}function ae(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xe(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function Pe(){return{type:"break"}}function at(){return{type:"html",value:""}}function V(){return{type:"image",title:null,url:"",alt:null}}function ce(){return{type:"link",title:null,url:"",children:[]}}function X(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function fe(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Le(){return{type:"paragraph",children:[]}}function Ge(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function gt(){return{type:"thematicBreak"}}}function Ms(e){return{line:e.line,column:e.column,offset:e.offset}}function US(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?US(e,r):nN(e,r)}}function nN(e,t){let n;for(n in t)if(PS.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function y0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vl({start:t.start,end:t.end})+") is still open")}function iN(e){const t=this;t.parser=n;function n(r){return eN(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rN(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sN(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
544
|
+
`}]}function aN(e,t){const n=t.value?t.value+`
|
|
545
|
+
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[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=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function oN(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lN(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cN(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=To(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let c,f=e.footnoteCounts.get(r);f===void 0?(f=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(r,f);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const d={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,d),e.applyData(t,d)}function uN(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hN(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function HS(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=r:a.push({type:"text",value:r}),a}function dN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return HS(e,t);const a={src:To(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function fN(e,t){const n={src:To(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function pN(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function gN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return HS(e,t);const a={href:To(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function mN(e,t){const n={href:To(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _N(e,t,n){const r=e.all(t),a=n?vN(n):$S(t),o={},c=[];if(typeof t.checked=="boolean"){const m=r[0];let _;m&&m.type==="element"&&m.tagName==="p"?_=m:(_={type:"element",tagName:"p",properties:{},children:[]},r.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<r.length;){const m=r[f];(a||f!==0||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
546
|
+
`}),m.type==="element"&&m.tagName==="p"&&!a?c.push(...m.children):c.push(m)}const p=r[r.length-1];p&&(a||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
547
|
+
`});const d={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,d),e.applyData(t,d)}function vN(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=$S(n[r])}return t}function $S(e){const t=e.spread;return t??e.children.length>1}function yN(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const c=r[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function bN(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xN(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function SN(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wN(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=bm(t.children[1]),p=xS(t.children[t.children.length-1]);f&&p&&(c.position={start:f,end:p}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function kN(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let p=-1;const d=[];for(;++p<f;){const _=t.children[p],y={},b=c?c[p]:void 0;b&&(y.align=b);let w={type:"element",tagName:o,properties:y,children:[]};_&&(w.children=e.all(_),e.patch(_,w),w=e.applyData(_,w)),d.push(w)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,m),e.applyData(t,m)}function EN(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const b0=9,x0=32;function CN(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(S0(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(S0(t.slice(a),a>0,!1)),o.join("")}function S0(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===b0||o===x0;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===b0||o===x0;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function TN(e,t){const n={type:"text",value:CN(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function MN(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const AN={blockquote:rN,break:sN,code:aN,delete:oN,emphasis:lN,footnoteReference:cN,heading:uN,html:hN,imageReference:dN,image:fN,inlineCode:pN,linkReference:gN,link:mN,listItem:_N,list:yN,paragraph:bN,root:xN,strong:SN,table:wN,tableCell:EN,tableRow:kN,text:TN,thematicBreak:MN,toml:Bu,yaml:Bu,definition:Bu,footnoteDefinition:Bu};function Bu(){}const FS=-1,Ph=0,Zl=1,_h=2,Tm=3,Mm=4,Am=5,Rm=6,qS=7,WS=8,KS=typeof self=="object"?self:globalThis,w0=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new KS[e](t)},RN=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Ph:case FS:return n(c,a);case Zl:{const f=n([],a);for(const p of c)f.push(r(p));return f}case _h:{const f=n({},a);for(const[p,d]of c)f[r(p)]=r(d);return f}case Tm:return n(new Date(c),a);case Mm:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case Am:{const f=n(new Map,a);for(const[p,d]of c)f.set(r(p),r(d));return f}case Rm:{const f=n(new Set,a);for(const p of c)f.add(r(p));return f}case qS:{const{name:f,message:p}=c;return n(typeof KS[f]=="function"?w0(f,p):new Error(p),a)}case WS:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(w0(o,c),a)};return r},k0=e=>RN(new Map,e)(0),ha="",{toString:NN}={},{keys:ON}=Object,Tl=e=>{const t=typeof e;if(t!=="object"||!e)return[Ph,t];const n=NN.call(e).slice(8,-1);switch(n){case"Array":return[Zl,ha];case"Object":return[_h,ha];case"Date":return[Tm,ha];case"RegExp":return[Mm,ha];case"Map":return[Am,ha];case"Set":return[Rm,ha];case"DataView":return[Zl,n]}return n.includes("Array")?[Zl,n]:e instanceof Error?[qS,e.name||"Error"]:[_h,n]},ju=([e,t])=>e===Ph&&(t==="function"||t==="symbol"),DN=(e,t,n,r)=>{const a=(c,f)=>{const p=r.push(c)-1;return n.set(f,p),p},o=c=>{if(n.has(c))return n.get(c);let[f,p]=Tl(c);switch(f){case Ph:{let m=c;switch(p){case"bigint":f=WS,m=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);m=null;break;case"undefined":return a([FS],c)}return a([f,m],c)}case Zl:{if(p){let y=c;return p==="DataView"?y=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(y=new Uint8Array(c)),a([p,[...y]],c)}const m=[],_=a([f,m],c);for(const y of c)m.push(o(y));return _}case _h:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const m=[],_=a([f,m],c);for(const y of ON(c))(e||!ju(Tl(c[y])))&&m.push([o(y),o(c[y])]);return _}case Tm:return a([f,isNaN(c.getTime())?ha:c.toISOString()],c);case Mm:{const{source:m,flags:_}=c;return a([f,{source:m,flags:_}],c)}case Am:{const m=[],_=a([f,m],c);for(const[y,b]of c)(e||!(ju(Tl(y))||ju(Tl(b))))&&m.push([o(y),o(b)]);return _}case Rm:{const m=[],_=a([f,m],c);for(const y of c)(e||!ju(Tl(y)))&&m.push(o(y));return _}}const{message:d}=c;return a([f,{name:p,message:d}],c)};return o},E0=(e,{json:t,lossy:n}={})=>{const r=[];return DN(!(t||n),!!t,new Map,r)(e),r},vh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?k0(E0(e,t)):structuredClone(e):(e,t)=>k0(E0(e,t));function LN(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function zN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function BN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||LN,r=e.options.footnoteBackLabel||zN,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[p]);if(!d)continue;const m=e.all(d),_=String(d.identifier).toUpperCase(),y=To(_.toLowerCase());let b=0;const w=[],S=e.footnoteCounts.get(_);for(;S!==void 0&&++b<=S;){w.length>0&&w.push({type:"text",value:" "});let j=typeof n=="string"?n:n(p,b);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(p,b),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const C=m[m.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const j=C.children[C.children.length-1];j&&j.type==="text"?j.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else m.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(m,!0)};e.patch(d,k),f.push(k)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...vh(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
548
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
549
|
+
`}]}}const gc=(function(e){if(e==null)return UN;if(typeof e=="function")return Uh(e);if(typeof e=="object")return Array.isArray(e)?jN(e):IN(e);if(typeof e=="string")return PN(e);throw new Error("Expected function, string, or object as test")});function jN(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=gc(e[n]);return Uh(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function IN(e){const t=e;return Uh(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function PN(e){return Uh(t);function t(n){return n&&n.type===e}}function Uh(e){return t;function t(n,r,a){return!!(HN(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function UN(){return!0}function HN(e){return e!==null&&typeof e=="object"&&"type"in e}const GS=[],$N=!0,dg=!1,FN="skip";function YS(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=gc(a),c=r?-1:1;f(e,void 0,[])();function f(p,d,m){const _=p&&typeof p=="object"?p:{};if(typeof _.type=="string"){const b=typeof _.tagName=="string"?_.tagName:typeof _.name=="string"?_.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=GS,w,S,C;if((!t||o(p,d,m[m.length-1]||void 0))&&(b=qN(n(p,m)),b[0]===dg))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==FN)for(S=(r?k.children.length:-1)+c,C=m.concat(k);S>-1&&S<k.children.length;){const j=k.children[S];if(w=f(j,S,C)(),w[0]===dg)return w;S=typeof w[1]=="number"?w[1]:S+c}}return b}}}function qN(e){return Array.isArray(e)?e:typeof e=="number"?[$N,e]:e==null?GS:[e]}function Hh(e,t,n,r){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=r),YS(e,o,f,a);function f(p,d){const m=d[d.length-1],_=m?m.children.indexOf(p):void 0;return c(p,_,m)}}const fg={}.hasOwnProperty,WN={};function KN(e,t){const n=t||WN,r=new Map,a=new Map,o=new Map,c={...AN,...n.handlers},f={all:d,applyData:YN,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:GN,wrap:XN};return Hh(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const _=m.type==="definition"?r:a,y=String(m.identifier).toUpperCase();_.has(y)||_.set(y,m)}}),f;function p(m,_){const y=m.type,b=f.handlers[y];if(fg.call(f.handlers,y)&&b)return b(f,m,_);if(f.options.passThrough&&f.options.passThrough.includes(y)){if("children"in m){const{children:S,...C}=m,k=vh(C);return k.children=f.all(m),k}return vh(m)}return(f.options.unknownHandler||VN)(f,m,_)}function d(m){const _=[];if("children"in m){const y=m.children;let b=-1;for(;++b<y.length;){const w=f.one(y[b],m);if(w){if(b&&y[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=C0(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=C0(S.value))}Array.isArray(w)?_.push(...w):_.push(w)}}}return _}}function GN(e,t){e.position&&(t.position=zM(e))}function YN(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const c="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,vh(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function VN(e,t){const n=t.data||{},r="value"in t&&!(fg.call(n,"hProperties")||fg.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)}function XN(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
550
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
551
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
552
|
+
`}),n}function C0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function T0(e,t){const n=KN(e,t),r=n.one(e,void 0),a=BN(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
553
|
+
`},a),o}function ZN(e,t){return e&&"run"in e?async function(n,r){const a=T0(n,{file:r,...t});await e.run(a,r)}:function(n,r){return T0(n,{file:r,...e||t})}}function M0(e){if(e)throw e}var dp,A0;function JN(){if(A0)return dp;A0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},o=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var m=e.call(d,"constructor"),_=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!_)return!1;var y;for(y in d);return typeof y>"u"||e.call(d,y)},c=function(d,m){n&&m.name==="__proto__"?n(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},f=function(d,m){if(m==="__proto__")if(e.call(d,m)){if(r)return r(d,m).value}else return;return d[m]};return dp=function p(){var d,m,_,y,b,w,S=arguments[0],C=1,k=arguments.length,j=!1;for(typeof S=="boolean"&&(j=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(d=arguments[C],d!=null)for(m in d)_=f(S,m),y=f(d,m),S!==y&&(j&&y&&(o(y)||(b=a(y)))?(b?(b=!1,w=_&&a(_)?_:[]):w=_&&o(_)?_:{},c(S,{name:m,newValue:p(j,w,y)})):typeof y<"u"&&c(S,{name:m,newValue:y}));return S},dp}var QN=JN();const fp=cc(QN);function pg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function eO(){const e=[],t={run:n,use:r};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(p,...d){const m=e[++o];let _=-1;if(p){c(p);return}for(;++_<a.length;)(d[_]===null||d[_]===void 0)&&(d[_]=a[_]);a=d,m?tO(m,f)(...d):c(null,...d)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function tO(e,t){let n;return r;function r(...c){const f=e.length>c.length;let p;f&&c.push(a);try{p=e.apply(this,c)}catch(d){const m=d;if(f&&n)throw m;return a(m)}f||(p&&p.then&&typeof p.then=="function"?p.then(o,a):p instanceof Error?a(p):o(p))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const Er={basename:nO,dirname:iO,extname:rO,join:sO,sep:"/"};function nO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');mc(e);let n=0,r=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(r=a):(f=-1,r=c));return n===r?r=c:r<0&&(r=e.length),e.slice(n,r)}function iO(e){if(mc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function rO(e){mc(e);let t=e.length,n=-1,r=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){r=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function sO(...e){let t=-1,n;for(;++t<e.length;)mc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aO(n)}function aO(e){mc(e);const t=e.codePointAt(0)===47;let n=oO(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function oO(e,t){let n="",r=0,a=-1,o=0,c=-1,f,p;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",r=0):(n=n.slice(0,p),r=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",r=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),r=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function mc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lO={cwd:cO};function cO(){return"/"}function gg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uO(e){if(typeof e=="string")e=new URL(e);else if(!gg(e)){const t=new 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(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return hO(e)}function hO(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const pp=["history","path","basename","stem","extname","dirname"];class VS{constructor(t){let n;t?gg(t)?n={path:t}:typeof t=="string"||dO(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":lO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<pp.length;){const o=pp[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)pp.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Er.basename(this.path):void 0}set basename(t){mp(t,"basename"),gp(t,"basename"),this.path=Er.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Er.dirname(this.path):void 0}set dirname(t){R0(this.basename,"dirname"),this.path=Er.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Er.extname(this.path):void 0}set extname(t){if(gp(t,"extname"),R0(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Er.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){gg(t)&&(t=uO(t)),mp(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Er.basename(this.path,this.extname):void 0}set stem(t){mp(t,"stem"),gp(t,"stem"),this.path=Er.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ni(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function gp(e,t){if(e&&e.includes(Er.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Er.sep+"`")}function mp(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function R0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fO=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),pO={}.hasOwnProperty;class Nm extends fO{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=eO()}copy(){const t=new Nm;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(fp(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(yp("data",this.frozen),this.namespace[t]=n,this):pO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Iu(t),r=this.parser||this.Parser;return _p("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_p("process",this.parser||this.Parser),vp("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Iu(t),p=r.parse(f);r.run(p,f,function(m,_,y){if(m||!_||!y)return d(m);const b=_,w=r.stringify(b,y);_O(w)?y.value=w:y.result=w,d(m,y)});function d(m,_){m||!_?c(m):o?o(_):n(void 0,_)}}}processSync(t){let n=!1,r;return this.freeze(),_p("processSync",this.parser||this.Parser),vp("processSync",this.compiler||this.Compiler),this.process(t,a),O0("processSync","process",n),r;function a(o,c){n=!0,M0(o),r=c}}run(t,n,r){N0(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(c,f){const p=Iu(n);a.run(t,p,d);function d(m,_,y){const b=_||t;m?f(m):c?c(b):r(void 0,b,y)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),O0("runSync","run",r),a;function o(c,f){M0(c),a=f,r=!0}}stringify(t,n){this.freeze();const r=Iu(n),a=this.compiler||this.Compiler;return vp("stringify",a),N0(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(yp("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(d){if(typeof d=="function")p(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[m,..._]=d;p(m,_)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new 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");f(d.plugins),d.settings&&(a.settings=fp(!0,a.settings,d.settings))}function f(d){let m=-1;if(d!=null)if(Array.isArray(d))for(;++m<d.length;){const _=d[m];o(_)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function p(d,m){let _=-1,y=-1;for(;++_<r.length;)if(r[_][0]===d){y=_;break}if(y===-1)r.push([d,...m]);else if(m.length>0){let[b,...w]=m;const S=r[y][1];pg(S)&&pg(b)&&(b=fp(!0,S,b)),r[y]=[d,b,...w]}}}}const gO=new Nm().freeze();function _p(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function vp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function N0(e){if(!pg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function O0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Iu(e){return mO(e)?e:new VS(e)}function mO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _O(e){return typeof e=="string"||vO(e)}function vO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",D0=[],L0={allowDangerousHtml:!0},bO=/^(https?|ircs?|mailto|xmpp)$/i,xO=[{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:"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 Om(e){const t=SO(e),n=wO(e);return kO(t.runSync(t.parse(n),n),e)}function SO(e){const t=e.rehypePlugins||D0,n=e.remarkPlugins||D0,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...L0}:L0;return gO().use(iN).use(n).use(ZN,r).use(t)}function wO(e){const t=e.children||"",n=new VS;return typeof t=="string"&&(n.value=t),n}function kO(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,p=t.urlTransform||EO;for(const m of xO)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+yO+m.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Hh(e,d),UM(e,{Fragment:h.Fragment,components:a,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function d(m,_,y){if(m.type==="raw"&&y&&typeof _=="number")return c?y.children.splice(_,1):y.children[_]={type:"text",value:m.value},_;if(m.type==="element"){let b;for(b in cp)if(Object.hasOwn(cp,b)&&Object.hasOwn(m.properties,b)){const w=m.properties[b],S=cp[b];(S===null||S.includes(m.tagName))&&(m.properties[b]=p(String(w||""),b,m))}}if(m.type==="element"){let b=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!b&&r&&typeof _=="number"&&(b=!r(m,_,y)),b&&y&&typeof _=="number")return f&&m.children?y.children.splice(_,1,...m.children):y.children.splice(_,1),_}}}function EO(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||bO.test(e.slice(0,t))?e:""}function z0(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function CO(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function TO(e,t,n){const a=gc((n||{}).ignore||[]),o=MO(t);let c=-1;for(;++c<o.length;)YS(e,"text",f);function f(d,m){let _=-1,y;for(;++_<m.length;){const b=m[_],w=y?y.children:void 0;if(a(b,w?w.indexOf(b):void 0,y))return;y=b}if(y)return p(d,m)}function p(d,m){const _=m[m.length-1],y=o[c][0],b=o[c][1];let w=0;const C=_.children.indexOf(d);let k=!1,j=[];y.lastIndex=0;let R=y.exec(d.value);for(;R;){const L=R.index,q={index:R.index,input:R.input,stack:[...m,d]};let O=b(...R,q);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?y.lastIndex=L+1:(w!==L&&j.push({type:"text",value:d.value.slice(w,L)}),Array.isArray(O)?j.push(...O):O&&j.push(O),w=L+R[0].length,k=!0),!y.global)break;R=y.exec(d.value)}return k?(w<d.value.length&&j.push({type:"text",value:d.value.slice(w)}),_.children.splice(C,1,...j)):j=[d],C+j.length}}function MO(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([AO(a[0]),RO(a[1])])}return t}function AO(e){return typeof e=="string"?new RegExp(CO(e),"g"):e}function RO(e){return typeof e=="function"?e:function(){return e}}const bp="phrasing",xp=["autolink","link","image","label"];function NO(){return{transforms:[IO],enter:{literalAutolink:DO,literalAutolinkEmail:Sp,literalAutolinkHttp:Sp,literalAutolinkWww:Sp},exit:{literalAutolink:jO,literalAutolinkEmail:BO,literalAutolinkHttp:LO,literalAutolinkWww:zO}}}function OO(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bp,notInConstruct:xp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bp,notInConstruct:xp},{character:":",before:"[ps]",after:"\\/",inConstruct:bp,notInConstruct:xp}]}}function DO(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Sp(e){this.config.enter.autolinkProtocol.call(this,e)}function LO(e){this.config.exit.autolinkProtocol.call(this,e)}function zO(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function BO(e){this.config.exit.autolinkEmail.call(this,e)}function jO(e){this.exit(e)}function IO(e){TO(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,PO],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),UO]],{ignore:["link","linkReference"]})}function PO(e,t,n,r,a){let o="";if(!XS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!HO(n)))return!1;const c=$O(n+r);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function UO(e,t,n,r){return!XS(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function HO(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function $O(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=z0(e,"(");let o=z0(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function XS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ya(n)||jh(n))&&(!t||n!==47)}ZS.peek=ZO;function FO(){this.buffer()}function qO(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function WO(){this.buffer()}function KO(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function GO(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YO(e){this.exit(e)}function VO(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function XO(e){this.exit(e)}function ZO(){return"["}function ZS(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function JO(){return{enter:{gfmFootnoteCallString:FO,gfmFootnoteCall:qO,gfmFootnoteDefinitionLabelString:WO,gfmFootnoteDefinition:KO},exit:{gfmFootnoteCallString:GO,gfmFootnoteCall:YO,gfmFootnoteDefinitionLabelString:VO,gfmFootnoteDefinition:XO}}}function QO(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ZS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,c){const f=o.createTracker(c);let p=f.move("[^");const d=o.enter("footnoteDefinition"),m=o.enter("label");return p+=f.move(o.safe(o.associationId(r),{before:p,after:"]"})),m(),p+=f.move("]:"),r.children&&r.children.length>0&&(f.shift(4),p+=f.move((t?`
|
|
554
|
+
`:" ")+o.indentLines(o.containerFlow(r,f.current()),t?JS:eD))),d(),p}}function eD(e,t,n){return t===0?e:JS(e,t,n)}function JS(e,t,n){return(n?"":" ")+e}const tD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];QS.peek=aD;function nD(){return{canContainEols:["delete"],enter:{strikethrough:rD},exit:{strikethrough:sD}}}function iD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:tD}],handlers:{delete:QS}}}function rD(e){this.enter({type:"delete",children:[]},e)}function sD(e){this.exit(e)}function QS(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function aD(){return"~"}function oD(e){return e.length}function lD(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||oD,o=[],c=[],f=[],p=[];let d=0,m=-1;for(;++m<e.length;){const S=[],C=[];let k=-1;for(e[m].length>d&&(d=e[m].length);++k<e[m].length;){const j=cD(e[m][k]);if(n.alignDelimiters!==!1){const R=a(j);C[k]=R,(p[k]===void 0||R>p[k])&&(p[k]=R)}S.push(j)}c[m]=S,f[m]=C}let _=-1;if(typeof r=="object"&&"length"in r)for(;++_<d;)o[_]=B0(r[_]);else{const S=B0(r);for(;++_<d;)o[_]=S}_=-1;const y=[],b=[];for(;++_<d;){const S=o[_];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let j=n.alignDelimiters===!1?1:Math.max(1,p[_]-C.length-k.length);const R=C+"-".repeat(j)+k;n.alignDelimiters!==!1&&(j=C.length+j+k.length,j>p[_]&&(p[_]=j),b[_]=j),y[_]=R}c.splice(1,0,y),f.splice(1,0,b),m=-1;const w=[];for(;++m<c.length;){const S=c[m],C=f[m];_=-1;const k=[];for(;++_<d;){const j=S[_]||"";let R="",L="";if(n.alignDelimiters!==!1){const q=p[_]-(C[_]||0),O=o[_];O===114?R=" ".repeat(q):O===99?q%2?(R=" ".repeat(q/2+.5),L=" ".repeat(q/2-.5)):(R=" ".repeat(q/2),L=R):L=" ".repeat(q)}n.delimiterStart!==!1&&!_&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||_)&&k.push(" "),n.alignDelimiters!==!1&&k.push(R),k.push(j),n.alignDelimiters!==!1&&k.push(L),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||_!==d-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
|
|
555
|
+
`)}function cD(e){return e==null?"":String(e)}function B0(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function uD(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),hD);return a(),c}function hD(e,t,n){return">"+(n?"":" ")+e}function dD(e,t){return j0(e,t.inConstruct,!0)&&!j0(e,t.notInConstruct,!1)}function j0(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function I0(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
556
|
+
`&&dD(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
557
|
+
`}function fD(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>c&&(c=o):o=1,a=r+t.length,r=n.indexOf(t,a);return c}function pD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function gD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function mD(e,t,n,r){const a=gD(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(pD(e,n)){const _=n.enter("codeIndented"),y=n.indentLines(o,_D);return _(),y}const f=n.createTracker(r),p=a.repeat(Math.max(fD(o,a)+1,3)),d=n.enter("codeFenced");let m=f.move(p);if(e.lang){const _=n.enter(`codeFencedLang${c}`);m+=f.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...f.current()})),_()}if(e.lang&&e.meta){const _=n.enter(`codeFencedMeta${c}`);m+=f.move(" "),m+=f.move(n.safe(e.meta,{before:m,after:`
|
|
558
|
+
`,encode:["`"],...f.current()})),_()}return m+=f.move(`
|
|
559
|
+
`),o&&(m+=f.move(o+`
|
|
560
|
+
`)),m+=f.move(p),d(),m}function _D(e,t,n){return(n?"":" ")+e}function Dm(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function vD(e,t,n,r){const a=Dm(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const p=n.createTracker(r);let d=p.move("[");return d+=p.move(n.safe(n.associationId(e),{before:d,after:"]",...p.current()})),d+=p.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(n.safe(e.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(f=n.enter("destinationRaw"),d+=p.move(n.safe(e.url,{before:d,after:e.title?" ":`
|
|
561
|
+
`,...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),d+=p.move(" "+a),d+=p.move(n.safe(e.title,{before:d,after:a,...p.current()})),d+=p.move(a),f()),c(),d}function yD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ic(e){return"&#x"+e.toString(16).toUpperCase()+";"}function yh(e,t,n){const r=yo(e),a=yo(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ew.peek=bD;function ew(e,t,n,r){const a=yD(n),o=n.enter("emphasis"),c=n.createTracker(r),f=c.move(a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const d=p.charCodeAt(0),m=yh(r.before.charCodeAt(r.before.length-1),d,a);m.inside&&(p=ic(d)+p.slice(1));const _=p.charCodeAt(p.length-1),y=yh(r.after.charCodeAt(0),_,a);y.inside&&(p=p.slice(0,-1)+ic(_));const b=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},f+p+b}function bD(e,t,n){return n.options.emphasis||"*"}function xD(e,t){let n=!1;return Hh(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,dg}),!!((!e.depth||e.depth<3)&&km(e)&&(t.options.setext||n))}function SD(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(xD(e,n)){const m=n.enter("headingSetext"),_=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:`
|
|
562
|
+
`,after:`
|
|
563
|
+
`});return _(),m(),y+`
|
|
564
|
+
`+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
565
|
+
`))+1))}const c="#".repeat(a),f=n.enter("headingAtx"),p=n.enter("phrasing");o.move(c+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
|
|
566
|
+
`,...o.current()});return/^[\t ]/.test(d)&&(d=ic(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,n.options.closeAtx&&(d+=" "+c),p(),f(),d}tw.peek=wD;function tw(e){return e.value||""}function wD(){return"<"}nw.peek=kD;function nw(e,t,n,r){const a=Dm(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const p=n.createTracker(r);let d=p.move("![");return d+=p.move(n.safe(e.alt,{before:d,after:"]",...p.current()})),d+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(n.safe(e.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(f=n.enter("destinationRaw"),d+=p.move(n.safe(e.url,{before:d,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),d+=p.move(" "+a),d+=p.move(n.safe(e.title,{before:d,after:a,...p.current()})),d+=p.move(a),f()),d+=p.move(")"),c(),d}function kD(){return"!"}iw.peek=ED;function iw(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(r);let p=f.move("![");const d=n.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(d+"]["),c();const m=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=m,o(),a==="full"||!d||d!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function ED(){return"!"}rw.peek=CD;function rw(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let p;if(c.atBreak)for(;p=f.exec(r);){let d=p.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(p.index+1)}}return a+r+a}function CD(){return"`"}function sw(e,t){const n=km(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}aw.peek=TD;function aw(e,t,n,r){const a=Dm(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(r);let f,p;if(sw(e,n)){const m=n.stack;n.stack=[],f=n.enter("autolink");let _=c.move("<");return _+=c.move(n.containerPhrasing(e,{before:_,after:">",...c.current()})),_+=c.move(">"),f(),n.stack=m,_}f=n.enter("link"),p=n.enter("label");let d=c.move("[");return d+=c.move(n.containerPhrasing(e,{before:d,after:"](",...c.current()})),d+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(p=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),d+=c.move(" "+a),d+=c.move(n.safe(e.title,{before:d,after:a,...c.current()})),d+=c.move(a),p()),d+=c.move(")"),f(),d}function TD(e,t,n){return sw(e,n)?"<":"["}ow.peek=MD;function ow(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(r);let p=f.move("[");const d=n.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(d+"]["),c();const m=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=m,o(),a==="full"||!d||d!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function MD(){return"["}function Lm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function AD(e){const t=Lm(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function RD(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function lw(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function ND(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?RD(n):Lm(n);const f=e.ordered?c==="."?")":".":AD(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),lw(n)===c&&m){let _=-1;for(;++_<e.children.length;){const y=e.children[_];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=f),n.bulletCurrent=c;const d=n.containerFlow(e,r);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),d}function OD(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function DD(e,t,n,r){const a=OD(n);let o=n.bulletCurrent||Lm(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(r);f.move(o+" ".repeat(c-o.length)),f.shift(c);const p=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,f.current()),m);return p(),d;function m(_,y,b){return y?(b?"":" ".repeat(c))+_:(b?o:o+" ".repeat(c-o.length))+_}}function LD(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,r);return o(),a(),c}const zD=gc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function BD(e,t,n,r){return(e.children.some(function(c){return zD(c)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function jD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}cw.peek=ID;function cw(e,t,n,r){const a=jD(n),o=n.enter("strong"),c=n.createTracker(r),f=c.move(a+a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const d=p.charCodeAt(0),m=yh(r.before.charCodeAt(r.before.length-1),d,a);m.inside&&(p=ic(d)+p.slice(1));const _=p.charCodeAt(p.length-1),y=yh(r.after.charCodeAt(0),_,a);y.inside&&(p=p.slice(0,-1)+ic(_));const b=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},f+p+b}function ID(e,t,n){return n.options.strong||"*"}function PD(e,t,n,r){return n.safe(e.value,r)}function UD(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function HD(e,t,n){const r=(lw(n)+(n.options.ruleSpaces?" ":"")).repeat(UD(n));return n.options.ruleSpaces?r.slice(0,-1):r}const uw={blockquote:uD,break:I0,code:mD,definition:vD,emphasis:ew,hardBreak:I0,heading:SD,html:tw,image:nw,imageReference:iw,inlineCode:rw,link:aw,linkReference:ow,list:ND,listItem:DD,paragraph:LD,root:BD,strong:cw,text:PD,thematicBreak:HD};function $D(){return{enter:{table:FD,tableData:P0,tableHeader:P0,tableRow:WD},exit:{codeText:KD,table:qD,tableData:wp,tableHeader:wp,tableRow:wp}}}function FD(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function qD(e){this.exit(e),this.data.inTable=void 0}function WD(e){this.enter({type:"tableRow",children:[]},e)}function wp(e){this.exit(e)}function P0(e){this.enter({type:"tableCell",children:[]},e)}function KD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,GD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function GD(e,t){return t==="|"?t:e}function YD(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
567
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:c,tableCell:p,tableRow:f}};function c(b,w,S,C){return d(m(b,S,C),b.align)}function f(b,w,S,C){const k=_(b,S,C),j=d([k]);return j.slice(0,j.indexOf(`
|
|
568
|
+
`))}function p(b,w,S,C){const k=S.enter("tableCell"),j=S.enter("phrasing"),R=S.containerPhrasing(b,{...C,before:o,after:o});return j(),k(),R}function d(b,w){return lD(b,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function m(b,w,S){const C=b.children;let k=-1;const j=[],R=w.enter("table");for(;++k<C.length;)j[k]=_(C[k],w,S);return R(),j}function _(b,w,S){const C=b.children;let k=-1;const j=[],R=w.enter("tableRow");for(;++k<C.length;)j[k]=p(C[k],b,w,S);return R(),j}function y(b,w,S){let C=uw.inlineCode(b,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function VD(){return{exit:{taskListCheckValueChecked:U0,taskListCheckValueUnchecked:U0,paragraph:ZD}}}function XD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:JD}}}function U0(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ZD(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function JD(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(r);o&&f.move(c);let p=uw.listItem(e,t,n,{...r,...f.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),p;function d(m){return m+c}}function QD(){return[NO(),JO(),nD(),$D(),VD()]}function e3(e){return{extensions:[OO(),QO(e),iD(),YD(e),XD()]}}const t3={tokenize:o3,partial:!0},hw={tokenize:l3,partial:!0},dw={tokenize:c3,partial:!0},fw={tokenize:u3,partial:!0},n3={tokenize:h3,partial:!0},pw={name:"wwwAutolink",tokenize:s3,previous:mw},gw={name:"protocolAutolink",tokenize:a3,previous:_w},Zr={name:"emailAutolink",tokenize:r3,previous:vw},Ar={};function i3(){return{text:Ar}}let aa=48;for(;aa<123;)Ar[aa]=Zr,aa++,aa===58?aa=65:aa===91&&(aa=97);Ar[43]=Zr;Ar[45]=Zr;Ar[46]=Zr;Ar[95]=Zr;Ar[72]=[Zr,gw];Ar[104]=[Zr,gw];Ar[87]=[Zr,pw];Ar[119]=[Zr,pw];function r3(e,t,n){const r=this;let a,o;return c;function c(_){return!mg(_)||!vw.call(r,r.previous)||zm(r.events)?n(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return mg(_)?(e.consume(_),f):_===64?(e.consume(_),p):n(_)}function p(_){return _===46?e.check(n3,m,d)(_):_===45||_===95||ti(_)?(o=!0,e.consume(_),p):m(_)}function d(_){return e.consume(_),a=!0,p}function m(_){return o&&a&&li(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):n(_)}}function s3(e,t,n){const r=this;return a;function a(c){return c!==87&&c!==119||!mw.call(r,r.previous)||zm(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(t3,e.attempt(hw,e.attempt(dw,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function a3(e,t,n){const r=this;let a="",o=!1;return c;function c(_){return(_===72||_===104)&&_w.call(r,r.previous)&&!zm(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):n(_)}function f(_){if(li(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const y=a.toLowerCase();if(y==="http"||y==="https")return e.consume(_),p}return n(_)}function p(_){return _===47?(e.consume(_),o?d:(o=!0,p)):n(_)}function d(_){return _===null||mh(_)||Xt(_)||ya(_)||jh(_)?n(_):e.attempt(hw,e.attempt(dw,m),n)(_)}function m(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function o3(e,t,n){let r=0;return a;function a(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),a):c===46&&r===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function l3(e,t,n){let r,a,o;return c;function c(d){return d===46||d===95?e.check(fw,p,f)(d):d===null||Xt(d)||ya(d)||d!==45&&jh(d)?p(d):(o=!0,e.consume(d),c)}function f(d){return d===95?r=!0:(a=r,r=void 0),e.consume(d),c}function p(d){return a||r||!o?n(d):t(d)}}function c3(e,t){let n=0,r=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&r<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(fw,t,o)(c):c===null||Xt(c)||ya(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&r++,e.consume(c),a}}function u3(e,t,n){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Xt(f)||ya(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Xt(f)||ya(f)?t(f):r(f)}function o(f){return li(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),r):li(f)?(e.consume(f),c):n(f)}}function h3(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return ti(o)?n(o):t(o)}}function mw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Xt(e)}function _w(e){return!li(e)}function vw(e){return!(e===47||mg(e))}function mg(e){return e===43||e===45||e===46||e===95||ti(e)}function zm(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const d3={tokenize:b3,partial:!0};function f3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:_3,continuation:{tokenize:v3},exit:y3}},text:{91:{name:"gfmFootnoteCall",tokenize:m3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:p3,resolveTo:g3}}}}function p3(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;a--;){const p=r.events[a][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!c||!c._balanced)return n(p);const d=ur(r.sliceSerialize({start:c.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function g3(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...f),e}function m3(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,c;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),p}function p(_){return _!==94?n(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(_){if(o>999||_===93&&!c||_===null||_===91||Xt(_))return n(_);if(_===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return a.includes(ur(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return Xt(_)||(c=!0),o++,e.consume(_),_===92?m:d}function m(_){return _===91||_===92||_===93?(e.consume(_),o++,d):d(_)}}function _3(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,c=0,f;return p;function p(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(w)}function m(w){if(c>999||w===93&&!f||w===null||w===91||Xt(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=ur(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Xt(w)||(f=!0),c++,e.consume(w),w===92?_:m}function _(w){return w===91||w===92||w===93?(e.consume(w),c++,m):m(w)}function y(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(o)||a.push(o),Nt(e,b,"gfmFootnoteDefinitionWhitespace")):n(w)}function b(w){return t(w)}}function v3(e,t,n){return e.check(pc,t,e.attempt(d3,t,n))}function y3(e){e.exit("gfmFootnoteDefinition")}function b3(e,t,n){const r=this;return Nt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function x3(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(c,f){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let d=p;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[p][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[p][1].end)},_={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[p][1].start)},y=[["enter",m,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",_,f]],b=f.parser.constructs.insideSpan.null;b&&Pi(y,y.length,0,Ih(b,c.slice(d+1,p),f)),Pi(y,y.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",m,f]]),Pi(c,d-1,p-d+3,y),p=d+y.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,f,p){const d=this.previous,m=this.events;let _=0;return y;function y(w){return d===126&&m[m.length-1][1].type!=="characterEscape"?p(w):(c.enter("strikethroughSequenceTemporary"),b(w))}function b(w){const S=yo(d);if(w===126)return _>1?p(w):(c.consume(w),_++,b);if(_<2&&!n)return p(w);const C=c.exit("strikethroughSequenceTemporary"),k=yo(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,f(w)}}}class S3{constructor(){this.map=[]}add(t,n,r){w3(this,t,n,r)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0}}function w3(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function k3(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function E3(){return{flow:{null:{name:"table",tokenize:C3,resolveAll:T3}}}}function C3(e,t,n){const r=this;let a=0,o=0,c;return f;function f(D){let A=r.events.length-1;for(;A>-1;){const G=r.events[A][1].type;if(G==="lineEnding"||G==="linePrefix")A--;else break}const M=A>-1?r.events[A][1].type:null,P=M==="tableHead"||M==="tableRow"?O:p;return P===O&&r.parser.lazy[r.now().line]?n(D):P(D)}function p(D){return e.enter("tableHead"),e.enter("tableRow"),d(D)}function d(D){return D===124||(c=!0,o+=1),m(D)}function m(D){return D===null?n(D):lt(D)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),b):n(D):Ct(D)?Nt(e,m,"whitespace")(D):(o+=1,c&&(c=!1,a+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,m):(e.enter("data"),_(D)))}function _(D){return D===null||D===124||Xt(D)?(e.exit("data"),m(D)):(e.consume(D),D===92?y:_)}function y(D){return D===92||D===124?(e.consume(D),_):_(D)}function b(D){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(D):(e.enter("tableDelimiterRow"),c=!1,Ct(D)?Nt(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):w(D))}function w(D){return D===45||D===58?C(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),S):q(D)}function S(D){return Ct(D)?Nt(e,C,"whitespace")(D):C(D)}function C(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),k):D===45?(o+=1,k(D)):D===null||lt(D)?L(D):q(D)}function k(D){return D===45?(e.enter("tableDelimiterFiller"),j(D)):q(D)}function j(D){return D===45?(e.consume(D),j):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(D))}function R(D){return Ct(D)?Nt(e,L,"whitespace")(D):L(D)}function L(D){return D===124?w(D):D===null||lt(D)?!c||a!==o?q(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):q(D)}function q(D){return n(D)}function O(D){return e.enter("tableRow"),z(D)}function z(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),z):D===null||lt(D)?(e.exit("tableRow"),t(D)):Ct(D)?Nt(e,z,"whitespace")(D):(e.enter("data"),J(D))}function J(D){return D===null||D===124||Xt(D)?(e.exit("data"),z(D)):(e.consume(D),D===92?ie:J)}function ie(D){return D===92||D===124?(e.consume(D),J):J(D)}}function T3(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,p=0,d,m,_;const y=new S3;for(;++n<e.length;){const b=e[n],w=b[1];b[0]==="enter"?w.type==="tableHead"?(f=!1,p!==0&&(H0(y,t,p,d,m),m=void 0,p=0),d={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},y.add(n,0,[["enter",d,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,_=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,m={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},y.add(n,0,[["enter",m,t]])),a=w.type==="tableDelimiterRow"?2:m?3:1):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],_=Pu(y,t,o,a,void 0,_),o=[0,0,0,0]),c[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(c[0]=c[1],_=Pu(y,t,o,a,void 0,_)),o=c,c=[o[1],n,0,0])):w.type==="tableHead"?(f=!0,p=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],_=Pu(y,t,o,a,n,_)):c[1]!==0&&(_=Pu(y,t,c,a,n,_)),a=0):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&H0(y,t,p,d,m),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=k3(t.events,n))}return e}function Pu(e,t,n,r,a,o){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},uo(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=uo(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=uo(t.events,n[2]),m=uo(t.events,n[3]),_={type:f,start:Object.assign({},d),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",_,t]]),r!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",_,t]])}return a!==void 0&&(o.end=Object.assign({},uo(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function H0(e,t,n,r,a){const o=[],c=uo(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),r.end=Object.assign({},c),o.push(["exit",r,t]),e.add(n+1,0,o)}function uo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const M3={name:"tasklistCheck",tokenize:R3};function A3(){return{text:{91:M3}}}function R3(e,t,n){const r=this;return a;function a(p){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return Xt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(p)}function f(p){return lt(p)?t(p):Ct(p)?e.check({tokenize:N3},t,n)(p):n(p)}}function N3(e,t,n){return Nt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function O3(e){return MS([i3(),f3(),x3(e),E3(),A3()])}const D3={};function Bm(e){const t=this,n=e||D3,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(O3(n)),o.push(QD()),c.push(e3(n))}const $0=(function(e,t,n){const r=gc(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),ka=(function(e){if(e==null)return B3;if(typeof e=="string")return z3(e);if(typeof e=="object")return L3(e);if(typeof e=="function")return jm(e);throw new Error("Expected function, string, or array as `test`")});function L3(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ka(e[n]);return jm(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function z3(e){return jm(t);function t(n){return n.tagName===e}}function jm(e){return t;function t(n,r,a){return!!(j3(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function B3(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function j3(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const F0=/\n/g,q0=/[\t ]+/g,_g=ka("br"),W0=ka(W3),I3=ka("p"),K0=ka("tr"),P3=ka(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",q3,K3]),yw=ka(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function U3(e,t){const n=t||{},r="children"in e?e.children:[],a=yw(e),o=Sw(e,{whitespace:n.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...xw(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<r.length;)c.push(...bw(r[f],e,{whitespace:o,breakBefore:f?void 0:a,breakAfter:f<r.length-1?_g(r[f+1]):a}));const p=[];let d;for(f=-1;++f<c.length;){const m=c[f];typeof m=="number"?d!==void 0&&m>d&&(d=m):m&&(d!==void 0&&d>-1&&p.push(`
|
|
569
|
+
`.repeat(d)||" "),d=-1,p.push(m))}return p.join("")}function bw(e,t,n){return e.type==="element"?H3(e,t,n):e.type==="text"?n.whitespace==="normal"?xw(e,n):$3(e):[]}function H3(e,t,n){const r=Sw(e,n),a=e.children||[];let o=-1,c=[];if(P3(e))return c;let f,p;for(_g(e)||K0(e)&&$0(t,e,K0)?p=`
|
|
570
|
+
`:I3(e)?(f=2,p=2):yw(e)&&(f=1,p=1);++o<a.length;)c=c.concat(bw(a[o],e,{whitespace:r,breakBefore:o?void 0:f,breakAfter:o<a.length-1?_g(a[o+1]):p}));return W0(e)&&$0(t,e,W0)&&c.push(" "),f&&c.unshift(f),p&&c.push(p),c}function xw(e,t){const n=String(e.value),r=[],a=[];let o=0;for(;o<=n.length;){F0.lastIndex=o;const p=F0.exec(n),d=p&&"index"in p?p.index:n.length;r.push(F3(n.slice(o,d).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),o===0?t.breakBefore:!0,d===n.length?t.breakAfter:!0)),o=d+1}let c=-1,f;for(;++c<r.length;)r[c].charCodeAt(r[c].length-1)===8203||c<r.length-1&&r[c+1].charCodeAt(0)===8203?(a.push(r[c]),f=void 0):r[c]?(typeof f=="number"&&a.push(f),a.push(r[c]),f=0):(c===0||c===r.length-1)&&a.push(0);return a}function $3(e){return[String(e.value)]}function F3(e,t,n){const r=[];let a=0,o;for(;a<e.length;){q0.lastIndex=a;const c=q0.exec(e);o=c?c.index:e.length,!a&&!o&&c&&!t&&r.push(""),a!==o&&r.push(e.slice(a,o)),a=c?o+c[0].length:o}return a!==o&&!n&&r.push(""),r.join(" ")}function Sw(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function q3(e){return!!(e.properties||{}).hidden}function W3(e){return e.tagName==="td"||e.tagName==="th"}function K3(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function G3(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},m={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},_={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},b=t.optional(a)+e.IDENT_RE+"\\s*\\(",w=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],S=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],k=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],L={type:S,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},q={className:"function.dispatch",relevance:0,keywords:{_hint:k},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},O=[q,_,f,n,e.C_BLOCK_COMMENT_MODE,m,d],z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:O.concat([{begin:/\(/,end:/\)/,keywords:L,contains:O.concat(["self"]),relevance:0}]),relevance:0},J={className:"function",begin:"("+c+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,relevance:0},{begin:b,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,m]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,d,m,f,{begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,d,m,f]}]},f,n,e.C_BLOCK_COMMENT_MODE,_]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(z,J,q,O,[_,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Y3(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=G3(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function V3(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),c={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,a]};a.contains.push(f);const p={match:/\\"/},d={className:"string",begin:/'/,end:/'/},m={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],b=e.SHEBANG({binary:`(${y.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},S=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],k={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],R=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],L=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],q=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:S,literal:C,built_in:[...j,...R,"set","shopt",...L,...q]},contains:[b,e.SHEBANG(),w,_,o,c,k,f,p,d,m,n]}}function X3(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",c="("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},m={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},_={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},b=t.optional(a)+e.IDENT_RE+"\\s*\\(",C={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},k=[_,f,n,e.C_BLOCK_COMMENT_MODE,m,d],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:C,contains:k.concat([{begin:/\(/,end:/\)/,keywords:C,contains:k.concat(["self"]),relevance:0}]),relevance:0},R={begin:"("+c+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:C,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:C,relevance:0},{begin:b,returnBegin:!0,contains:[e.inherit(y,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,d,m,f,{begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,d,m,f]}]},f,n,e.C_BLOCK_COMMENT_MODE,_]};return{name:"C",aliases:["h"],keywords:C,disableAutodetect:!0,illegal:"</",contains:[].concat(j,R,k,[_,{begin:e.IDENT_RE+"::",keywords:C},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:_,strings:d,keywords:C}}}function Z3(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",c="(?!struct)("+r+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},m={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},_={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},y={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},b=t.optional(a)+e.IDENT_RE+"\\s*\\(",w=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],S=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],k=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],L={type:S,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},q={className:"function.dispatch",relevance:0,keywords:{_hint:k},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},O=[q,_,f,n,e.C_BLOCK_COMMENT_MODE,m,d],z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:L,contains:O.concat([{begin:/\(/,end:/\)/,keywords:L,contains:O.concat(["self"]),relevance:0}]),relevance:0},J={className:"function",begin:"("+c+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:L,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:L,relevance:0},{begin:b,returnBegin:!0,contains:[y],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,m]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,d,m,f,{begin:/\(/,end:/\)/,keywords:L,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,d,m,f]}]},f,n,e.C_BLOCK_COMMENT_MODE,_]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:L,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(z,J,q,O,[_,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:L,contains:["self",f]},{begin:e.IDENT_RE+"::",keywords:L},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function J3(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],c={keyword:a.concat(o),built_in:t,literal:r},f=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),p={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},m={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},_=e.inherit(m,{illegal:/\n/}),y={className:"subst",begin:/\{/,end:/\}/,keywords:c},b=e.inherit(y,{illegal:/\n/}),w={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,b]},S={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]},C=e.inherit(S,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},b]});y.contains=[S,w,m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.C_BLOCK_COMMENT_MODE],b.contains=[C,w,_,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const k={variants:[d,S,w,m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},j={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},R=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",L={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:c,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},k,p,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,j,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,j,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+R+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:c,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,j],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,relevance:0,contains:[k,p,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},L]}}const Q3=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),eL=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],tL=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],nL=[...eL,...tL],iL=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),rL=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),sL=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),aL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function oL(e){const t=e.regex,n=Q3(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="and or not only",o=/@-?\w[\w]*(-\w+)*/,c="[a-zA-Z-][a-zA-Z0-9_-]*",f=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+c,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+rL.join("|")+")"},{begin:":(:)?("+sL.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+aL.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...f,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...f,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:iL.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...f,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+nL.join("|")+")\\b"}]}}function lL(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function cL(e){const o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:o,illegal:/["']/}]}]}}function uL(e){const t=e.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function hL(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},c={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},f={begin:/\[/,end:/\]/,contains:[r,o,a,c,n,"self"],relevance:0},p=/[A-Za-z0-9_-]+/,d=/"(\\"|[^"])*"/,m=/'[^']*'/,_=t.either(p,d,m),y=t.concat(_,"(\\s*\\.\\s*",_,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:y,className:"attr",starts:{end:/$/,contains:[r,f,o,a,c,n]}}]}}var ho="[0-9](_*[0-9])*",Uu=`\\.(${ho})`,Hu="[0-9a-fA-F](_*[0-9a-fA-F])*",G0={className:"number",variants:[{begin:`(\\b(${ho})((${Uu})|\\.)?|(${Uu}))[eE][+-]?(${ho})[fFdD]?\\b`},{begin:`\\b(${ho})((${Uu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Uu})[fFdD]?\\b`},{begin:`\\b(${ho})[fFdD]\\b`},{begin:`\\b0[xX]((${Hu})\\.?|(${Hu})?\\.(${Hu}))[pP][+-]?(${ho})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Hu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ww(e,t,n){return n===-1?"":e.replace(t,r=>ww(e,t,n-1))}function dL(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+ww("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),p={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},m={className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:p,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:p,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,G0,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},G0,d]}}const Y0="[A-Za-z$_][0-9A-Za-z$_]*",fL=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],pL=["true","false","null","undefined","NaN","Infinity"],kw=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ew=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Cw=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],gL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],mL=[].concat(Cw,kw,Ew);function _L(e){const t=e.regex,n=(K,{after:re})=>{const U="</"+K[0].slice(1);return K.input.indexOf(U,re)!==-1},r=Y0,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,re)=>{const U=K[0].length+K.index,W=K.input[U];if(W==="<"||W===","){re.ignoreMatch();return}W===">"&&(n(K,{after:U})||re.ignoreMatch());let I;const E=K.input.substring(U);if(I=E.match(/^\s*=/)){re.ignoreMatch();return}if((I=E.match(/^\s+extends\s+/))&&I.index===0){re.ignoreMatch();return}}},f={$pattern:Y0,keyword:fL,literal:pL,built_in:mL,"variable.language":gL},p="[0-9](_?[0-9])*",d=`\\.(${p})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${d})|\\.)?|(${d}))[eE][+-]?(${p})\\b`},{begin:`\\b(${m})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:f,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,w,S,C,{match:/\$\d+/},_];y.contains=R.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(R)});const L=[].concat(j,y.contains),q=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(L)}]),O={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:q},z={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...kw,...Ew]}},ie={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(K){return t.concat("(?!",K.join("|"),")")}const P={match:t.concat(/\b/,M([...Cw,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},G={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",$={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:q,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ie,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,w,S,C,j,{match:/\$\d+/},_,J,{scope:"attr",match:r+t.lookahead(":"),relevance:0},$,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:q}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},G,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},P,A,z,H,{match:/\$[(.]/}]}}function vL(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,a,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var fo="[0-9](_*[0-9])*",$u=`\\.(${fo})`,Fu="[0-9a-fA-F](_*[0-9a-fA-F])*",yL={className:"number",variants:[{begin:`(\\b(${fo})((${$u})|\\.)?|(${$u}))[eE][+-]?(${fo})[fFdD]?\\b`},{begin:`\\b(${fo})((${$u})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${$u})[fFdD]?\\b`},{begin:`\\b(${fo})[fFdD]\\b`},{begin:`\\b0[xX]((${Fu})\\.?|(${Fu})?\\.(${Fu}))[pP][+-]?(${fo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Fu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function bL(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},c={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,a]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,a]}]};a.contains.push(c);const f={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},p={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(c,{className:"string"}),"self"]}]},d=yL,m=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),_={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},y=_;return y.variants[1].contains=[_],_.variants[1].contains=[y],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,m,n,r,f,p,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[_,e.C_LINE_COMMENT_MODE,m],relevance:0},e.C_LINE_COMMENT_MODE,m,f,p,c,e.C_NUMBER_MODE]},m]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},f,p]},c,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
571
|
+
`},d]}}const xL=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),SL=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],wL=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],kL=[...SL,...wL],EL=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Tw=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Mw=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),CL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),TL=Tw.concat(Mw).sort().reverse();function ML(e){const t=xL(e),n=TL,r="and or not only",a="[\\w-]+",o="("+a+"|@\\{"+a+"\\})",c=[],f=[],p=function(R){return{className:"string",begin:"~?"+R+".*?"+R}},d=function(R,L,q){return{className:R,begin:L,relevance:q}},m={$pattern:/[a-z-]+/,keyword:r,attribute:EL.join(" ")},_={begin:"\\(",end:"\\)",contains:f,keywords:m,relevance:0};f.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p("'"),p('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,_,d("variable","@@?"+a,10),d("variable","@\\{"+a+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const y=f.concat({begin:/\{/,end:/\}/,contains:c}),b={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(f)},w={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+CL.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:f}}]},S={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:m,returnEnd:!0,contains:f,relevance:0}},C={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:y}},k={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,d("keyword","all\\b"),d("variable","@\\{"+a+"\\}"),{begin:"\\b("+kL.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,d("selector-tag",o,0),d("selector-id","#"+o),d("selector-class","\\."+o,0),d("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Tw.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Mw.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},t.FUNCTION_DISPATCH]},j={begin:a+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[k]};return c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,S,C,j,w,k,b,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:c}}function AL(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},a=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function RL(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},a={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},c={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,a,o,c]}}function NL(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},m={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},_=e.inherit(d,{contains:[]}),y=e.inherit(m,{contains:[]});d.contains.push(y),m.contains.push(_);let b=[n,p];return[d,m,_,y].forEach(k=>{k.contains=k.contains.concat(b)}),b=b.concat(d,m),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:b},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:b}]}]},n,o,d,m,{className:"quote",begin:"^>\\s+",contains:b,end:"$"},a,r,p,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function OL(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,f={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},p={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:f,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+p.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:p,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function DL(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},c={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},p={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},d={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},m=[e.BACKSLASH_ESCAPE,o,p],_=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],y=(S,C,k="\\1")=>{const j=k==="\\1"?k:t.concat(k,C);return t.concat(t.concat("(?:",S,")"),C,/(?:\\.|[^\\\/])*?/,j,/(?:\\.|[^\\\/])*?/,k,r)},b=(S,C,k)=>t.concat(t.concat("(?:",S,")"),C,/(?:\\.|[^\\\/])*?/,k,r),w=[p,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),c,{className:"string",contains:m,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:y("s|tr|y",t.either(..._,{capture:!0}))},{begin:y("s|tr|y","\\(","\\)")},{begin:y("s|tr|y","\\[","\\]")},{begin:y("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:b("(?:m|qr)?",/\//,/\//)},{begin:b("m|qr",t.either(..._,{capture:!0}),/\1/)},{begin:b("m|qr",/\(/,/\)/)},{begin:b("m|qr",/\[/,/\]/)},{begin:b("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,f,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=w,c.contains=w,{name:"Perl",aliases:["pl","pm"],keywords:a,contains:w}}function LL(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),a=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=t.concat(/[A-Z]+/,n),c={scope:"variable",match:"\\$+"+r},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},p={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=e.inherit(e.APOS_STRING_MODE,{illegal:null}),m=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(p)}),_={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(p),"on:begin":(G,H)=>{H.data._beginMatch=G[1]||G[2]},"on:end":(G,H)=>{H.data._beginMatch!==G[1]&&H.ignoreMatch()}},y=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),b=`[
|
|
572
|
+
]`,w={scope:"string",variants:[m,d,_,y]},S={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},C=["false","null","true"],k=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],j=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],L={keyword:k,literal:(G=>{const H=[];return G.forEach(N=>{H.push(N),N.toLowerCase()===N?H.push(N.toUpperCase()):H.push(N.toLowerCase())}),H})(C),built_in:j},q=G=>G.map(H=>H.replace(/\|\d+$/,"")),O={variants:[{match:[/new/,t.concat(b,"+"),t.concat("(?!",q(j).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},z=t.concat(r,"\\b(?!\\()"),J={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),z],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),z],scope:{1:"title.class",3:"variable.constant"}},{match:[a,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},ie={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},D={relevance:0,begin:/\(/,end:/\)/,keywords:L,contains:[ie,c,J,e.C_BLOCK_COMMENT_MODE,w,S,O]},A={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",q(k).join("\\b|"),"|",q(j).join("\\b|"),"\\b)"),r,t.concat(b,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[D]};D.contains.push(A);const M=[ie,J,e.C_BLOCK_COMMENT_MODE,w,S,O],P={begin:t.concat(/#\[\s*\\?/,t.either(a,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:C,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:C,keyword:["new","array"]},contains:["self",...M]},...M,{scope:"meta",variants:[{match:a},{match:o}]}]};return{case_insensitive:!1,keywords:L,contains:[P,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},f,{scope:"variable.language",match:/\$this\b/},c,A,J,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},O,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:L,contains:["self",P,c,J,e.C_BLOCK_COMMENT_MODE,w,S]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},w,S]}}function zL(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function BL(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function jL(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],f={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:f,illegal:/#/},m={begin:/\{\{/,relevance:0},_={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,m,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,m,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,m,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,m,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y="[0-9](_?[0-9])*",b=`(\\b(${y}))?\\.(${y})|\\b(${y})\\.`,w=`\\b|${r.join("|")}`,S={className:"number",relevance:0,variants:[{begin:`(\\b(${y})|(${b}))[eE][+-]?(${y})[jJ]?(?=${w})`},{begin:`(${b})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${y})[jJ](?=${w})`}]},C={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:f,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},k={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:["self",p,S,_,e.HASH_COMMENT_MODE]}]};return d.contains=[_,S,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:f,illegal:/(<\/|\?)|=>/,contains:[p,S,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,C,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[k]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[S,k,_]}]}}function IL(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function PL(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function UL(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(r,/(::\w+)*/),c={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},f={className:"doctag",begin:"@[A-Za-z]+"},p={begin:"#<",end:">"},d=[e.COMMENT("#","$",{contains:[f]}),e.COMMENT("^=begin","^=end",{contains:[f],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],m={className:"subst",begin:/#\{/,end:/\}/,keywords:c},_={className:"string",contains:[e.BACKSLASH_ESCAPE,m],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,m]})]}]},y="[1-9](_?[0-9])*|0",b="[0-9](_?[0-9])*",w={className:"number",relevance:0,variants:[{begin:`\\b(${y})(\\.(${b}))?([eE][+-]?(${b})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},S={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:c}]},O=[_,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:c},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:c},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[_,{begin:n}],relevance:0},w,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:c},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,m],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(p,d),relevance:0}].concat(p,d);m.contains=O,S.contains=O;const D=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:c,contains:O}}];return d.unshift(p),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:c,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(D).concat(d).concat(O)}}function HL(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),a=t.concat(n,e.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,t.lookahead(/\s*\(/))},c="([ui](8|16|32|64|128|size)|f(32|64))?",f=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],p=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],m=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:m,keyword:f,literal:p,built_in:d},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+c},{begin:"\\b0o([0-7_]+)"+c},{begin:"\\b0x([A-Fa-f0-9_]+)"+c},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+c}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:m}},{className:"punctuation",begin:"->"},o]}}const $L=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),FL=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],qL=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],WL=[...FL,...qL],KL=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),GL=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),YL=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),VL=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function XL(e){const t=$L(e),n=YL,r=GL,a="@[a-z-]+",o="and or not only",f={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+WL.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},f,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+VL.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,f,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:KL.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},f,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function ZL(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function JL(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],c=["double precision","large object","with timezone","without timezone"],f=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],p=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],m=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],_=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],y=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],b=m,w=[...d,...p].filter(q=>!m.includes(q)),S={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},C={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},k={match:t.concat(/\b/,t.either(...b),/\s*\(/),relevance:0,keywords:{built_in:b}};function j(q){return t.concat(/\b/,t.either(...q.map(O=>O.replace(/\s+/,"\\s+"))),/\b/)}const R={scope:"keyword",match:j(y),relevance:0};function L(q,{exceptions:O,when:z}={}){const J=z;return O=O||[],q.map(ie=>ie.match(/\|\d+$/)||O.includes(ie)?ie:J(ie)?`${ie}|0`:ie)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:L(w,{when:q=>q.length<3}),literal:o,type:f,built_in:_},contains:[{scope:"type",match:j(c)},R,k,S,r,a,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,C]}}function Aw(e){return e?typeof e=="string"?e:e.source:null}function Ml(e){return Kt("(?=",e,")")}function Kt(...e){return e.map(n=>Aw(n)).join("")}function QL(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function oi(...e){return"("+(QL(e).capture?"":"?:")+e.map(r=>Aw(r)).join("|")+")"}const Im=e=>Kt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ez=["Protocol","Type"].map(Im),V0=["init","self"].map(Im),tz=["Any","Self"],kp=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],X0=["false","nil","true"],nz=["assignment","associativity","higherThan","left","lowerThan","none","right"],iz=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Z0=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Rw=oi(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Nw=oi(Rw,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ep=Kt(Rw,Nw,"*"),Ow=oi(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),bh=oi(Ow,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Sr=Kt(Ow,bh,"*"),qu=Kt(/[A-Z]/,bh,"*"),rz=["attached","autoclosure",Kt(/convention\(/,oi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Kt(/objc\(/,Sr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],sz=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function az(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,oi(...ez,...V0)],className:{2:"keyword"}},o={match:Kt(/\./,oi(...kp)),relevance:0},c=kp.filter(Pe=>typeof Pe=="string").concat(["_|0"]),f=kp.filter(Pe=>typeof Pe!="string").concat(tz).map(Im),p={variants:[{className:"keyword",match:oi(...f,...V0)}]},d={$pattern:oi(/\b\w+/,/#\w+/),keyword:c.concat(iz),literal:X0},m=[a,o,p],_={match:Kt(/\./,oi(...Z0)),relevance:0},y={className:"built_in",match:Kt(/\b/,oi(...Z0),/(?=\()/)},b=[_,y],w={match:/->/,relevance:0},S={className:"operator",relevance:0,variants:[{match:Ep},{match:`\\.(\\.|${Nw})+`}]},C=[w,S],k="([0-9]_*)+",j="([0-9a-fA-F]_*)+",R={className:"number",relevance:0,variants:[{match:`\\b(${k})(\\.(${k}))?([eE][+-]?(${k}))?\\b`},{match:`\\b0x(${j})(\\.(${j}))?([pP][+-]?(${k}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},L=(Pe="")=>({className:"subst",variants:[{match:Kt(/\\/,Pe,/[0\\tnr"']/)},{match:Kt(/\\/,Pe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),q=(Pe="")=>({className:"subst",match:Kt(/\\/,Pe,/[\t ]*(?:[\r\n]|\r\n)/)}),O=(Pe="")=>({className:"subst",label:"interpol",begin:Kt(/\\/,Pe,/\(/),end:/\)/}),z=(Pe="")=>({begin:Kt(Pe,/"""/),end:Kt(/"""/,Pe),contains:[L(Pe),q(Pe),O(Pe)]}),J=(Pe="")=>({begin:Kt(Pe,/"/),end:Kt(/"/,Pe),contains:[L(Pe),O(Pe)]}),ie={className:"string",variants:[z(),z("#"),z("##"),z("###"),J(),J("#"),J("##"),J("###")]},D=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],A={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:D},M=Pe=>{const at=Kt(Pe,/\//),V=Kt(/\//,Pe);return{begin:at,end:V,contains:[...D,{scope:"comment",begin:`#(?!.*${V})`,end:/$/}]}},P={scope:"regexp",variants:[M("###"),M("##"),M("#"),A]},G={match:Kt(/`/,Sr,/`/)},H={className:"variable",match:/\$\d+/},N={className:"variable",match:`\\$${bh}+`},$=[G,H,N],K={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:sz,contains:[...C,R,ie]}]}},re={scope:"keyword",match:Kt(/@/,oi(...rz),Ml(oi(/\(/,/\s+/)))},U={scope:"meta",match:Kt(/@/,Sr)},W=[K,re,U],I={match:Ml(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Kt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,bh,"+")},{className:"type",match:qu,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Kt(/\s+&\s+/,Ml(qu)),relevance:0}]},E={begin:/</,end:/>/,keywords:d,contains:[...r,...m,...W,w,I]};I.contains.push(E);const F={match:Kt(Sr,/\s*:/),keywords:"_|0",relevance:0},Y={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",F,...r,P,...m,...b,...C,R,ie,...$,...W,I]},Z={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,I]},ve={begin:oi(Ml(Kt(Sr,/\s*:/)),Ml(Kt(Sr,/\s+/,Sr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Sr}]},Oe={begin:/\(/,end:/\)/,keywords:d,contains:[ve,...r,...m,...C,R,ie,...W,I,Y],endsParent:!0,illegal:/["']/},_e={match:[/(func|macro)/,/\s+/,oi(G.match,Sr,Ep)],className:{1:"keyword",3:"title.function"},contains:[Z,Oe,t],illegal:[/\[/,/%/]},Fe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Z,Oe,t],illegal:/\[|%/},st={match:[/operator/,/\s+/,Ep],className:{1:"keyword",3:"title"}},ae={begin:[/precedencegroup/,/\s+/,qu],className:{1:"keyword",3:"title"},contains:[I],keywords:[...nz,...X0],end:/}/},pe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Xe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},nt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Sr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[Z,...m,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:qu},...m],relevance:0}]};for(const Pe of ie.variants){const at=Pe.contains.find(ce=>ce.label==="interpol");at.keywords=d;const V=[...m,...b,...C,R,ie,...$];at.contains=[...V,{begin:/\(/,end:/\)/,contains:["self",...V]}]}return{name:"Swift",keywords:d,contains:[...r,_e,Fe,pe,Xe,nt,st,ae,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},P,...m,...b,...C,R,ie,...$,...W,I,Y]}}const xh="[A-Za-z$_][0-9A-Za-z$_]*",Dw=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Lw=["true","false","null","undefined","NaN","Infinity"],zw=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Bw=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],jw=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Iw=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Pw=[].concat(jw,zw,Bw);function oz(e){const t=e.regex,n=(K,{after:re})=>{const U="</"+K[0].slice(1);return K.input.indexOf(U,re)!==-1},r=xh,a={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,re)=>{const U=K[0].length+K.index,W=K.input[U];if(W==="<"||W===","){re.ignoreMatch();return}W===">"&&(n(K,{after:U})||re.ignoreMatch());let I;const E=K.input.substring(U);if(I=E.match(/^\s*=/)){re.ignoreMatch();return}if((I=E.match(/^\s+extends\s+/))&&I.index===0){re.ignoreMatch();return}}},f={$pattern:xh,keyword:Dw,literal:Lw,built_in:Pw,"variable.language":Iw},p="[0-9](_?[0-9])*",d=`\\.(${p})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${d})|\\.)?|(${d}))[eE][+-]?(${p})\\b`},{begin:`\\b(${m})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:f,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},C={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},j={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,w,S,C,{match:/\$\d+/},_];y.contains=R.concat({begin:/\{/,end:/\}/,keywords:f,contains:["self"].concat(R)});const L=[].concat(j,y.contains),q=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:f,contains:["self"].concat(L)}]),O={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:q},z={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...zw,...Bw]}},ie={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(K){return t.concat("(?!",K.join("|"),")")}const P={match:t.concat(/\b/,M([...jw,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},G={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",$={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:f,exports:{PARAMS_CONTAINS:q,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ie,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,w,S,C,j,{match:/\$\d+/},_,J,{scope:"attr",match:r+t.lookahead(":"),relevance:0},$,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[j,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:q}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:o},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},G,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},P,A,z,H,{match:/\$[(.]/}]}}function lz(e){const t=e.regex,n=oz(e),r=xh,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},c={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[n.exports.CLASS_REFERENCE]},f={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:xh,keyword:Dw.concat(p),literal:Lw,built_in:Pw.concat(a),"variable.language":Iw},m={className:"meta",begin:"@"+r},_=(S,C,k)=>{const j=S.contains.findIndex(R=>R.label===C);if(j===-1)throw new Error("can not find mode to replace");S.contains.splice(j,1,k)};Object.assign(n.keywords,d),n.exports.PARAMS_CONTAINS.push(m);const y=n.contains.find(S=>S.scope==="attr"),b=Object.assign({},y,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,y,b]),n.contains=n.contains.concat([m,o,c,b]),_(n,"shebang",e.SHEBANG()),_(n,"use_strict",f);const w=n.contains.find(S=>S.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function cz(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,c=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,f=/\d{1,2}(:\d{1,2}){1,2}/,p={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,a),/ *#/)},{begin:t.concat(/# */,f,/ *#/)},{begin:t.concat(/# */,c,/ *#/)},{begin:t.concat(/# */,t.either(o,a),/ +/,t.either(c,f),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},m={className:"label",begin:/^\w+:/},_=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),y=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,p,d,m,_,y,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[y]}]}}function uz(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],a={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},c={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},f={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},p={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,c,a,e.QUOTE_STRING_MODE,p,d,f]}}function hz(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},c=e.inherit(o,{begin:/\(/,end:/\)/}),f=e.inherit(e.APOS_STRING_MODE,{className:"string"}),p=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,p,f,c,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,c,p,f]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[p]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function dz(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},c={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,a]},f=e.inherit(c,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),y={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},b={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},w={begin:/\{/,end:/\}/,contains:[b],illegal:"\\n",relevance:0},S={begin:"\\[",end:"\\]",contains:[b],illegal:"\\n",relevance:0},C=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},y,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},w,S,o,c],k=[...C];return k.pop(),k.push(f),b.contains=k,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:C}}const fz={arduino:Y3,bash:V3,c:X3,cpp:Z3,csharp:J3,css:oL,diff:lL,go:cL,graphql:uL,ini:hL,java:dL,javascript:_L,json:vL,kotlin:bL,less:ML,lua:AL,makefile:RL,markdown:NL,objectivec:OL,perl:DL,php:LL,"php-template":zL,plaintext:BL,python:jL,"python-repl":IL,r:PL,ruby:UL,rust:HL,scss:XL,shell:ZL,sql:JL,swift:az,typescript:lz,vbnet:cz,wasm:uz,xml:hz,yaml:dz};var Cp,J0;function pz(){if(J0)return Cp;J0=1;function e(ee){return ee instanceof Map?ee.clear=ee.delete=ee.set=function(){throw new Error("map is read-only")}:ee instanceof Set&&(ee.add=ee.clear=ee.delete=function(){throw new Error("set is read-only")}),Object.freeze(ee),Object.getOwnPropertyNames(ee).forEach(xe=>{const He=ee[xe],ut=typeof He;(ut==="object"||ut==="function")&&!Object.isFrozen(He)&&e(He)}),ee}class t{constructor(xe){xe.data===void 0&&(xe.data={}),this.data=xe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(ee){return ee.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(ee,...xe){const He=Object.create(null);for(const ut in ee)He[ut]=ee[ut];return xe.forEach(function(ut){for(const Ht in ut)He[Ht]=ut[Ht]}),He}const a="</span>",o=ee=>!!ee.scope,c=(ee,{prefix:xe})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const He=ee.split(".");return[`${xe}${He.shift()}`,...He.map((ut,Ht)=>`${ut}${"_".repeat(Ht+1)}`)].join(" ")}return`${xe}${ee}`};class f{constructor(xe,He){this.buffer="",this.classPrefix=He.classPrefix,xe.walk(this)}addText(xe){this.buffer+=n(xe)}openNode(xe){if(!o(xe))return;const He=c(xe.scope,{prefix:this.classPrefix});this.span(He)}closeNode(xe){o(xe)&&(this.buffer+=a)}value(){return this.buffer}span(xe){this.buffer+=`<span class="${xe}">`}}const p=(ee={})=>{const xe={children:[]};return Object.assign(xe,ee),xe};class d{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(xe){this.top.children.push(xe)}openNode(xe){const He=p({scope:xe});this.add(He),this.stack.push(He)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(xe){return this.constructor._walk(xe,this.rootNode)}static _walk(xe,He){return typeof He=="string"?xe.addText(He):He.children&&(xe.openNode(He),He.children.forEach(ut=>this._walk(xe,ut)),xe.closeNode(He)),xe}static _collapse(xe){typeof xe!="string"&&xe.children&&(xe.children.every(He=>typeof He=="string")?xe.children=[xe.children.join("")]:xe.children.forEach(He=>{d._collapse(He)}))}}class m extends d{constructor(xe){super(),this.options=xe}addText(xe){xe!==""&&this.add(xe)}startScope(xe){this.openNode(xe)}endScope(){this.closeNode()}__addSublanguage(xe,He){const ut=xe.root;He&&(ut.scope=`language:${He}`),this.add(ut)}toHTML(){return new f(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _(ee){return ee?typeof ee=="string"?ee:ee.source:null}function y(ee){return S("(?=",ee,")")}function b(ee){return S("(?:",ee,")*")}function w(ee){return S("(?:",ee,")?")}function S(...ee){return ee.map(He=>_(He)).join("")}function C(ee){const xe=ee[ee.length-1];return typeof xe=="object"&&xe.constructor===Object?(ee.splice(ee.length-1,1),xe):{}}function k(...ee){return"("+(C(ee).capture?"":"?:")+ee.map(ut=>_(ut)).join("|")+")"}function j(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function R(ee,xe){const He=ee&&ee.exec(xe);return He&&He.index===0}const L=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function q(ee,{joinWith:xe}){let He=0;return ee.map(ut=>{He+=1;const Ht=He;let Ot=_(ut),Ze="";for(;Ot.length>0;){const Ye=L.exec(Ot);if(!Ye){Ze+=Ot;break}Ze+=Ot.substring(0,Ye.index),Ot=Ot.substring(Ye.index+Ye[0].length),Ye[0][0]==="\\"&&Ye[1]?Ze+="\\"+String(Number(Ye[1])+Ht):(Ze+=Ye[0],Ye[0]==="("&&He++)}return Ze}).map(ut=>`(${ut})`).join(xe)}const O=/\b\B/,z="[a-zA-Z]\\w*",J="[a-zA-Z_]\\w*",ie="\\b\\d+(\\.\\d+)?",D="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",A="\\b(0b[01]+)",M="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",P=(ee={})=>{const xe=/^#![ ]*\//;return ee.binary&&(ee.begin=S(xe,/.*\b/,ee.binary,/\b.*/)),r({scope:"meta",begin:xe,end:/$/,relevance:0,"on:begin":(He,ut)=>{He.index!==0&&ut.ignoreMatch()}},ee)},G={begin:"\\\\[\\s\\S]",relevance:0},H={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[G]},N={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[G]},$={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},K=function(ee,xe,He={}){const ut=r({scope:"comment",begin:ee,end:xe,contains:[]},He);ut.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ht=k("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ut.contains.push({begin:S(/[ ]+/,"(",Ht,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ut},re=K("//","$"),U=K("/\\*","\\*/"),W=K("#","$"),I={scope:"number",begin:ie,relevance:0},E={scope:"number",begin:D,relevance:0},F={scope:"number",begin:A,relevance:0},Y={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[G,{begin:/\[/,end:/\]/,relevance:0,contains:[G]}]},Z={scope:"title",begin:z,relevance:0},ve={scope:"title",begin:J,relevance:0},Oe={begin:"\\.\\s*"+J,relevance:0};var Fe=Object.freeze({__proto__:null,APOS_STRING_MODE:H,BACKSLASH_ESCAPE:G,BINARY_NUMBER_MODE:F,BINARY_NUMBER_RE:A,COMMENT:K,C_BLOCK_COMMENT_MODE:U,C_LINE_COMMENT_MODE:re,C_NUMBER_MODE:E,C_NUMBER_RE:D,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(xe,He)=>{He.data._beginMatch=xe[1]},"on:end":(xe,He)=>{He.data._beginMatch!==xe[1]&&He.ignoreMatch()}})},HASH_COMMENT_MODE:W,IDENT_RE:z,MATCH_NOTHING_RE:O,METHOD_GUARD:Oe,NUMBER_MODE:I,NUMBER_RE:ie,PHRASAL_WORDS_MODE:$,QUOTE_STRING_MODE:N,REGEXP_MODE:Y,RE_STARTERS_RE:M,SHEBANG:P,TITLE_MODE:Z,UNDERSCORE_IDENT_RE:J,UNDERSCORE_TITLE_MODE:ve});function st(ee,xe){ee.input[ee.index-1]==="."&&xe.ignoreMatch()}function ae(ee,xe){ee.className!==void 0&&(ee.scope=ee.className,delete ee.className)}function pe(ee,xe){xe&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=st,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function Xe(ee,xe){Array.isArray(ee.illegal)&&(ee.illegal=k(...ee.illegal))}function nt(ee,xe){if(ee.match){if(ee.begin||ee.end)throw new Error("begin & end are not supported with match");ee.begin=ee.match,delete ee.match}}function Pe(ee,xe){ee.relevance===void 0&&(ee.relevance=1)}const at=(ee,xe)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const He=Object.assign({},ee);Object.keys(ee).forEach(ut=>{delete ee[ut]}),ee.keywords=He.keywords,ee.begin=S(He.beforeMatch,y(He.begin)),ee.starts={relevance:0,contains:[Object.assign(He,{endsParent:!0})]},ee.relevance=0,delete He.beforeMatch},V=["of","and","for","in","not","or","if","then","parent","list","value"],ce="keyword";function X(ee,xe,He=ce){const ut=Object.create(null);return typeof ee=="string"?Ht(He,ee.split(" ")):Array.isArray(ee)?Ht(He,ee):Object.keys(ee).forEach(function(Ot){Object.assign(ut,X(ee[Ot],xe,Ot))}),ut;function Ht(Ot,Ze){xe&&(Ze=Ze.map(Ye=>Ye.toLowerCase())),Ze.forEach(function(Ye){const ot=Ye.split("|");ut[ot[0]]=[Ot,fe(ot[0],ot[1])]})}}function fe(ee,xe){return xe?Number(xe):Le(ee)?0:1}function Le(ee){return V.includes(ee.toLowerCase())}const Ge={},Te=ee=>{console.error(ee)},gt=(ee,...xe)=>{console.log(`WARN: ${ee}`,...xe)},le=(ee,xe)=>{Ge[`${ee}/${xe}`]||(console.log(`Deprecated as of ${ee}. ${xe}`),Ge[`${ee}/${xe}`]=!0)},be=new Error;function Se(ee,xe,{key:He}){let ut=0;const Ht=ee[He],Ot={},Ze={};for(let Ye=1;Ye<=xe.length;Ye++)Ze[Ye+ut]=Ht[Ye],Ot[Ye+ut]=!0,ut+=j(xe[Ye-1]);ee[He]=Ze,ee[He]._emit=Ot,ee[He]._multi=!0}function Q(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw Te("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),be;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw Te("beginScope must be object"),be;Se(ee,ee.begin,{key:"beginScope"}),ee.begin=q(ee.begin,{joinWith:""})}}function ge(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw Te("skip, excludeEnd, returnEnd not compatible with endScope: {}"),be;if(typeof ee.endScope!="object"||ee.endScope===null)throw Te("endScope must be object"),be;Se(ee,ee.end,{key:"endScope"}),ee.end=q(ee.end,{joinWith:""})}}function Ae(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function Ne(ee){Ae(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),Q(ee),ge(ee)}function Be(ee){function xe(Ze,Ye){return new RegExp(_(Ze),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Ye?"g":""))}class He{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ye,ot){ot.position=this.position++,this.matchIndexes[this.matchAt]=ot,this.regexes.push([ot,Ye]),this.matchAt+=j(Ye)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ye=this.regexes.map(ot=>ot[1]);this.matcherRe=xe(q(Ye,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ye){this.matcherRe.lastIndex=this.lastIndex;const ot=this.matcherRe.exec(Ye);if(!ot)return null;const Gt=ot.findIndex((nr,es)=>es>0&&nr!==void 0),Zt=this.matchIndexes[Gt];return ot.splice(0,Gt),Object.assign(ot,Zt)}}class ut{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ye){if(this.multiRegexes[Ye])return this.multiRegexes[Ye];const ot=new He;return this.rules.slice(Ye).forEach(([Gt,Zt])=>ot.addRule(Gt,Zt)),ot.compile(),this.multiRegexes[Ye]=ot,ot}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ye,ot){this.rules.push([Ye,ot]),ot.type==="begin"&&this.count++}exec(Ye){const ot=this.getMatcher(this.regexIndex);ot.lastIndex=this.lastIndex;let Gt=ot.exec(Ye);if(this.resumingScanAtSamePosition()&&!(Gt&&Gt.index===this.lastIndex)){const Zt=this.getMatcher(0);Zt.lastIndex=this.lastIndex+1,Gt=Zt.exec(Ye)}return Gt&&(this.regexIndex+=Gt.position+1,this.regexIndex===this.count&&this.considerAll()),Gt}}function Ht(Ze){const Ye=new ut;return Ze.contains.forEach(ot=>Ye.addRule(ot.begin,{rule:ot,type:"begin"})),Ze.terminatorEnd&&Ye.addRule(Ze.terminatorEnd,{type:"end"}),Ze.illegal&&Ye.addRule(Ze.illegal,{type:"illegal"}),Ye}function Ot(Ze,Ye){const ot=Ze;if(Ze.isCompiled)return ot;[ae,nt,Ne,at].forEach(Zt=>Zt(Ze,Ye)),ee.compilerExtensions.forEach(Zt=>Zt(Ze,Ye)),Ze.__beforeBegin=null,[pe,Xe,Pe].forEach(Zt=>Zt(Ze,Ye)),Ze.isCompiled=!0;let Gt=null;return typeof Ze.keywords=="object"&&Ze.keywords.$pattern&&(Ze.keywords=Object.assign({},Ze.keywords),Gt=Ze.keywords.$pattern,delete Ze.keywords.$pattern),Gt=Gt||/\w+/,Ze.keywords&&(Ze.keywords=X(Ze.keywords,ee.case_insensitive)),ot.keywordPatternRe=xe(Gt,!0),Ye&&(Ze.begin||(Ze.begin=/\B|\b/),ot.beginRe=xe(ot.begin),!Ze.end&&!Ze.endsWithParent&&(Ze.end=/\B|\b/),Ze.end&&(ot.endRe=xe(ot.end)),ot.terminatorEnd=_(ot.end)||"",Ze.endsWithParent&&Ye.terminatorEnd&&(ot.terminatorEnd+=(Ze.end?"|":"")+Ye.terminatorEnd)),Ze.illegal&&(ot.illegalRe=xe(Ze.illegal)),Ze.contains||(Ze.contains=[]),Ze.contains=[].concat(...Ze.contains.map(function(Zt){return We(Zt==="self"?Ze:Zt)})),Ze.contains.forEach(function(Zt){Ot(Zt,ot)}),Ze.starts&&Ot(Ze.starts,Ye),ot.matcher=Ht(ot),ot}if(ee.compilerExtensions||(ee.compilerExtensions=[]),ee.contains&&ee.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ee.classNameAliases=r(ee.classNameAliases||{}),Ot(ee)}function Ue(ee){return ee?ee.endsWithParent||Ue(ee.starts):!1}function We(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(xe){return r(ee,{variants:null},xe)})),ee.cachedVariants?ee.cachedVariants:Ue(ee)?r(ee,{starts:ee.starts?r(ee.starts):null}):Object.isFrozen(ee)?r(ee):ee}var $e="11.11.1";class ft extends Error{constructor(xe,He){super(xe),this.name="HTMLInjectionError",this.html=He}}const Bt=n,Xn=r,Mn=Symbol("nomatch"),Zn=7,ii=function(ee){const xe=Object.create(null),He=Object.create(null),ut=[];let Ht=!0;const Ot="Could not find the language '{}', did you forget to load/include a language module?",Ze={disableAutodetect:!0,name:"Plain text",contains:[]};let Ye={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:m};function ot(Re){return Ye.noHighlightRe.test(Re)}function Gt(Re){let it=Re.className+" ";it+=Re.parentNode?Re.parentNode.className:"";const wt=Ye.languageDetectRe.exec(it);if(wt){const jt=ne(wt[1]);return jt||(gt(Ot.replace("{}",wt[1])),gt("Falling back to no-highlight mode for this block.",Re)),jt?wt[1]:"no-highlight"}return it.split(/\s+/).find(jt=>ot(jt)||ne(jt))}function Zt(Re,it,wt){let jt="",gn="";typeof it=="object"?(jt=Re,wt=it.ignoreIllegals,gn=it.language):(le("10.7.0","highlight(lang, code, ...args) has been deprecated."),le("10.7.0",`Please use highlight(code, options) instead.
|
|
573
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),gn=Re,jt=it),wt===void 0&&(wt=!0);const Jn={code:jt,language:gn};rn("before:highlight",Jn);const Ci=Jn.result?Jn.result:nr(Jn.language,Jn.code,wt);return Ci.code=Jn.code,rn("after:highlight",Ci),Ci}function nr(Re,it,wt,jt){const gn=Object.create(null);function Jn(Ie,et){return Ie.keywords[et]}function Ci(){if(!ht.keywords){bn.addText(It);return}let Ie=0;ht.keywordPatternRe.lastIndex=0;let et=ht.keywordPatternRe.exec(It),_t="";for(;et;){_t+=It.substring(Ie,et.index);const Tt=Un.case_insensitive?et[0].toLowerCase():et[0],on=Jn(ht,Tt);if(on){const[Hi,Do]=on;if(bn.addText(_t),_t="",gn[Tt]=(gn[Tt]||0)+1,gn[Tt]<=Zn&&(is+=Do),Hi.startsWith("_"))_t+=et[0];else{const Ec=Un.classNameAliases[Hi]||Hi;Ti(et[0],Ec)}}else _t+=et[0];Ie=ht.keywordPatternRe.lastIndex,et=ht.keywordPatternRe.exec(It)}_t+=It.substring(Ie),bn.addText(_t)}function pi(){if(It==="")return;let Ie=null;if(typeof ht.subLanguage=="string"){if(!xe[ht.subLanguage]){bn.addText(It);return}Ie=nr(ht.subLanguage,It,!0,kc[ht.subLanguage]),kc[ht.subLanguage]=Ie._top}else Ie=hr(It,ht.subLanguage.length?ht.subLanguage:null);ht.relevance>0&&(is+=Ie.relevance),bn.__addSublanguage(Ie._emitter,Ie.language)}function Jt(){ht.subLanguage!=null?pi():Ci(),It=""}function Ti(Ie,et){Ie!==""&&(bn.startScope(et),bn.addText(Ie),bn.endScope())}function Sc(Ie,et){let _t=1;const Tt=et.length-1;for(;_t<=Tt;){if(!Ie._emit[_t]){_t++;continue}const on=Un.classNameAliases[Ie[_t]]||Ie[_t],Hi=et[_t];on?Ti(Hi,on):(It=Hi,Ci(),It=""),_t++}}function Ca(Ie,et){return Ie.scope&&typeof Ie.scope=="string"&&bn.openNode(Un.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(Ti(It,Un.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),It=""):Ie.beginScope._multi&&(Sc(Ie.beginScope,et),It="")),ht=Object.create(Ie,{parent:{value:ht}}),ht}function Ro(Ie,et,_t){let Tt=R(Ie.endRe,_t);if(Tt){if(Ie["on:end"]){const on=new t(Ie);Ie["on:end"](et,on),on.isMatchIgnored&&(Tt=!1)}if(Tt){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return Ro(Ie.parent,et,_t)}function Ta(Ie){return ht.matcher.regexIndex===0?(It+=Ie[0],1):(rs=!0,0)}function Yh(Ie){const et=Ie[0],_t=Ie.rule,Tt=new t(_t),on=[_t.__beforeBegin,_t["on:begin"]];for(const Hi of on)if(Hi&&(Hi(Ie,Tt),Tt.isMatchIgnored))return Ta(et);return _t.skip?It+=et:(_t.excludeBegin&&(It+=et),Jt(),!_t.returnBegin&&!_t.excludeBegin&&(It=et)),Ca(_t,Ie),_t.returnBegin?0:et.length}function gi(Ie){const et=Ie[0],_t=it.substring(Ie.index),Tt=Ro(ht,Ie,_t);if(!Tt)return Mn;const on=ht;ht.endScope&&ht.endScope._wrap?(Jt(),Ti(et,ht.endScope._wrap)):ht.endScope&&ht.endScope._multi?(Jt(),Sc(ht.endScope,Ie)):on.skip?It+=et:(on.returnEnd||on.excludeEnd||(It+=et),Jt(),on.excludeEnd&&(It=et));do ht.scope&&bn.closeNode(),!ht.skip&&!ht.subLanguage&&(is+=ht.relevance),ht=ht.parent;while(ht!==Tt.parent);return Tt.starts&&Ca(Tt.starts,Ie),on.returnEnd?0:et.length}function No(){const Ie=[];for(let et=ht;et!==Un;et=et.parent)et.scope&&Ie.unshift(et.scope);Ie.forEach(et=>bn.openNode(et))}let Fs={};function Ma(Ie,et){const _t=et&&et[0];if(It+=Ie,_t==null)return Jt(),0;if(Fs.type==="begin"&&et.type==="end"&&Fs.index===et.index&&_t===""){if(It+=it.slice(et.index,et.index+1),!Ht){const Tt=new Error(`0 width match regex (${Re})`);throw Tt.languageName=Re,Tt.badRule=Fs.rule,Tt}return 1}if(Fs=et,et.type==="begin")return Yh(et);if(et.type==="illegal"&&!wt){const Tt=new Error('Illegal lexeme "'+_t+'" for mode "'+(ht.scope||"<unnamed>")+'"');throw Tt.mode=ht,Tt}else if(et.type==="end"){const Tt=gi(et);if(Tt!==Mn)return Tt}if(et.type==="illegal"&&_t==="")return It+=`
|
|
574
|
+
`,1;if(Oo>1e5&&Oo>et.index*3)throw new Error("potential infinite loop, way more iterations than matches");return It+=_t,_t.length}const Un=ne(Re);if(!Un)throw Te(Ot.replace("{}",Re)),new Error('Unknown language: "'+Re+'"');const wc=Be(Un);let Aa="",ht=jt||wc;const kc={},bn=new Ye.__emitter(Ye);No();let It="",is=0,Nr=0,Oo=0,rs=!1;try{if(Un.__emitTokens)Un.__emitTokens(it,bn);else{for(ht.matcher.considerAll();;){Oo++,rs?rs=!1:ht.matcher.considerAll(),ht.matcher.lastIndex=Nr;const Ie=ht.matcher.exec(it);if(!Ie)break;const et=it.substring(Nr,Ie.index),_t=Ma(et,Ie);Nr=Ie.index+_t}Ma(it.substring(Nr))}return bn.finalize(),Aa=bn.toHTML(),{language:Re,value:Aa,relevance:is,illegal:!1,_emitter:bn,_top:ht}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:Re,value:Bt(it),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:Nr,context:it.slice(Nr-100,Nr+100),mode:Ie.mode,resultSoFar:Aa},_emitter:bn};if(Ht)return{language:Re,value:Bt(it),illegal:!1,relevance:0,errorRaised:Ie,_emitter:bn,_top:ht};throw Ie}}function es(Re){const it={value:Bt(Re),illegal:!1,relevance:0,_top:Ze,_emitter:new Ye.__emitter(Ye)};return it._emitter.addText(Re),it}function hr(Re,it){it=it||Ye.languages||Object.keys(xe);const wt=es(Re),jt=it.filter(ne).filter(qe).map(Jt=>nr(Jt,Re,!1));jt.unshift(wt);const gn=jt.sort((Jt,Ti)=>{if(Jt.relevance!==Ti.relevance)return Ti.relevance-Jt.relevance;if(Jt.language&&Ti.language){if(ne(Jt.language).supersetOf===Ti.language)return 1;if(ne(Ti.language).supersetOf===Jt.language)return-1}return 0}),[Jn,Ci]=gn,pi=Jn;return pi.secondBest=Ci,pi}function Ui(Re,it,wt){const jt=it&&He[it]||wt;Re.classList.add("hljs"),Re.classList.add(`language-${jt}`)}function nn(Re){let it=null;const wt=Gt(Re);if(ot(wt))return;if(rn("before:highlightElement",{el:Re,language:wt}),Re.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Re);return}if(Re.children.length>0&&(Ye.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Re)),Ye.throwUnescapedHTML))throw new ft("One of your code blocks includes unescaped HTML.",Re.innerHTML);it=Re;const jt=it.textContent,gn=wt?Zt(jt,{language:wt,ignoreIllegals:!0}):hr(jt);Re.innerHTML=gn.value,Re.dataset.highlighted="yes",Ui(Re,wt,gn.language),Re.result={language:gn.language,re:gn.relevance,relevance:gn.relevance},gn.secondBest&&(Re.secondBest={language:gn.secondBest.language,relevance:gn.secondBest.relevance}),rn("after:highlightElement",{el:Re,result:gn,text:jt})}function Dn(Re){Ye=Xn(Ye,Re)}const dr=()=>{Rr(),le("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ts(){Rr(),le("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Hs=!1;function Rr(){function Re(){Rr()}if(document.readyState==="loading"){Hs||window.addEventListener("DOMContentLoaded",Re,!1),Hs=!0;return}document.querySelectorAll(Ye.cssSelector).forEach(nn)}function $s(Re,it){let wt=null;try{wt=it(ee)}catch(jt){if(Te("Language definition for '{}' could not be registered.".replace("{}",Re)),Ht)Te(jt);else throw jt;wt=Ze}wt.name||(wt.name=Re),xe[Re]=wt,wt.rawDefinition=it.bind(null,ee),wt.aliases&&Ee(wt.aliases,{languageName:Re})}function fr(Re){delete xe[Re];for(const it of Object.keys(He))He[it]===Re&&delete He[it]}function ns(){return Object.keys(xe)}function ne(Re){return Re=(Re||"").toLowerCase(),xe[Re]||xe[He[Re]]}function Ee(Re,{languageName:it}){typeof Re=="string"&&(Re=[Re]),Re.forEach(wt=>{He[wt.toLowerCase()]=it})}function qe(Re){const it=ne(Re);return it&&!it.disableAutodetect}function Je(Re){Re["before:highlightBlock"]&&!Re["before:highlightElement"]&&(Re["before:highlightElement"]=it=>{Re["before:highlightBlock"](Object.assign({block:it.el},it))}),Re["after:highlightBlock"]&&!Re["after:highlightElement"]&&(Re["after:highlightElement"]=it=>{Re["after:highlightBlock"](Object.assign({block:it.el},it))})}function Qe(Re){Je(Re),ut.push(Re)}function un(Re){const it=ut.indexOf(Re);it!==-1&&ut.splice(it,1)}function rn(Re,it){const wt=Re;ut.forEach(function(jt){jt[wt]&&jt[wt](it)})}function ri(Re){return le("10.7.0","highlightBlock will be removed entirely in v12.0"),le("10.7.0","Please use highlightElement now."),nn(Re)}Object.assign(ee,{highlight:Zt,highlightAuto:hr,highlightAll:Rr,highlightElement:nn,highlightBlock:ri,configure:Dn,initHighlighting:dr,initHighlightingOnLoad:ts,registerLanguage:$s,unregisterLanguage:fr,listLanguages:ns,getLanguage:ne,registerAliases:Ee,autoDetection:qe,inherit:Xn,addPlugin:Qe,removePlugin:un}),ee.debugMode=function(){Ht=!1},ee.safeMode=function(){Ht=!0},ee.versionString=$e,ee.regex={concat:S,lookahead:y,either:k,optional:w,anyNumberOfTimes:b};for(const Re in Fe)typeof Fe[Re]=="object"&&e(Fe[Re]);return Object.assign(ee,Fe),ee},yn=ii({});return yn.newInstance=()=>ii({}),Cp=yn,yn.HighlightJS=yn,yn.default=yn,Cp}var gz=pz();const mz=cc(gz),Q0={},_z="hljs-";function vz(e){const t=mz.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:a,register:o,registerAlias:c,registered:f};function n(p,d,m){const _=m||Q0,y=typeof _.prefix=="string"?_.prefix:_z;if(!t.getLanguage(p))throw new Error("Unknown language: `"+p+"` is not registered");t.configure({__emitter:yz,classPrefix:y});const b=t.highlight(d,{ignoreIllegals:!0,language:p});if(b.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:b.errorRaised});const w=b._emitter.root,S=w.data;return S.language=b.language,S.relevance=b.relevance,w}function r(p,d){const _=(d||Q0).subset||a();let y=-1,b=0,w;for(;++y<_.length;){const S=_[y];if(!t.getLanguage(S))continue;const C=n(S,p,d);C.data&&C.data.relevance!==void 0&&C.data.relevance>b&&(b=C.data.relevance,w=C)}return w||{type:"root",children:[],data:{language:void 0,relevance:b}}}function a(){return t.listLanguages()}function o(p,d){if(typeof p=="string")t.registerLanguage(p,d);else{let m;for(m in p)Object.hasOwn(p,m)&&t.registerLanguage(m,p[m])}}function c(p,d){if(typeof p=="string")t.registerAliases(typeof d=="string"?d:[...d],{languageName:p});else{let m;for(m in p)if(Object.hasOwn(p,m)){const _=p[m];t.registerAliases(typeof _=="string"?_:[..._],{languageName:m})}}}function f(p){return!!t.getLanguage(p)}}class yz{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],a=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:a}):r.children.push(...a)}openNode(t){const n=this,r=t.split(".").map(function(c,f){return f?c+"_".repeat(f):n.options.classPrefix+c}),a=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const bz={};function Pm(e){const t=e||bz,n=t.aliases,r=t.detect||!1,a=t.languages||fz,o=t.plainText,c=t.prefix,f=t.subset;let p="hljs";const d=vz(a);if(n&&d.registerAlias(n),c){const m=c.indexOf("-");p=m===-1?c:c.slice(0,m)}return function(m,_){Hh(m,"element",function(y,b,w){if(y.tagName!=="code"||!w||w.type!=="element"||w.tagName!=="pre")return;const S=xz(y);if(S===!1||!S&&!r||S&&o&&o.includes(S))return;Array.isArray(y.properties.className)||(y.properties.className=[]),y.properties.className.includes(p)||y.properties.className.unshift(p);const C=U3(y,{whitespace:"pre"});let k;try{k=S?d.highlight(S,C,{prefix:c}):d.highlightAuto(C,{prefix:c,subset:f})}catch(j){const R=j;if(S&&/Unknown language/.test(R.message)){_.message("Cannot highlight as `"+S+"`, it’s not registered",{ancestors:[w,y],cause:R,place:y.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw R}!S&&k.data&&k.data.language&&y.properties.className.push("language-"+k.data.language),k.children.length>0&&(y.children=k.children)})}}function xz(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const a=String(t[n]);if(a==="no-highlight"||a==="nohighlight")return!1;!r&&a.slice(0,5)==="lang-"&&(r=a.slice(5)),!r&&a.slice(0,9)==="language-"&&(r=a.slice(9))}return r}const Uw=x.createContext(null);function Sz({open:e,children:t}){return h.jsx(Uw.Provider,{value:e,children:t})}function Hw(){return x.useContext(Uw)}const $w=/^(~|\/(home|Users|var|opt|tmp|etc|mnt|root))(\/|$)/,wz=[Bm],kz=[Pm],Ez={pre:({children:e})=>h.jsx("pre",{style:{maxWidth:"100%",overflowX:"auto"},children:e}),img:({src:e,alt:t})=>{const n=typeof e=="string"?e:void 0,r=n&&$w.test(n)?`/files/raw?path=${encodeURIComponent(n)}`:n;return h.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:h.jsx("img",{src:r,alt:typeof t=="string"?t:"",style:{maxWidth:"100%",maxHeight:360,borderRadius:6,cursor:"pointer"}})})},table:({children:e})=>h.jsx("div",{className:"chat-msg-table-scroll",children:h.jsx("table",{children:e})})};function Cz({content:e}){const t=Hw(),n=x.useMemo(()=>({...Ez,a:({href:r,children:a})=>{if(typeof r=="string"&&$w.test(r)){const c=f=>{var d;if(f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey)return;const p=(d=window.getSelection)==null?void 0:d.call(window);p&&p.toString().length>0||(f.preventDefault(),f.stopPropagation(),t?t(r):console.warn("[somora] FileView opener unavailable:",r))};return h.jsx("a",{href:r,draggable:!1,onMouseUp:c,onClick:f=>{f.preventDefault(),f.stopPropagation()},title:`open ${r} in FileView`,children:a})}return h.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",draggable:!1,children:a})}}),[t]);return h.jsx(Om,{remarkPlugins:wz,rehypePlugins:kz,components:n,children:e})}const Um=x.memo(Cz);function Tz(e){if(e.summary)return e.summary;if(!e.input)return"";const t=e.input,n=r=>typeof t[r]=="string"?t[r]:void 0;switch(e.tool){case"memory_search":case"memory_get":return n("query")??n("reference")??"";case"memory_write":case"memory_edit":case"memory_delete":return n("slug")??"";case"wiki_edit":case"wiki_create":case"wiki_delete":return n("wikiPath")??"";case"dream_run":return`phase=${n("phase")??"?"}`;case"dream_apply":case"dream_dismiss":case"dream_get":case"dream_review":return n("dream_id")??"";case"file_read":case"file_write":case"file_patch":case"file_list":return n("path")??"";case"file_search":return n("pattern")??"";case"exec":return n("command")??"";case"web_search":return n("query")??"";case"web_fetch":return n("url")??"";case"somora_docs_read":return n("topic")??"";case"time_now":return"";default:return Object.values(t).find(a=>typeof a=="string")??""}}function Mz(e){if(e.details)return e.details;if(e.input)try{return JSON.stringify(e.input,null,2)}catch{return String(e.input)}return"(no input)"}function Az(e){if(e.error)return e.error;if(e.summary)return e.summary;if(e.output===void 0||e.output===null)return"(no output)";if(typeof e.output=="string")return e.output;try{return JSON.stringify(e.output)}catch{return String(e.output)}}function Rz(e){if(e.details)return e.details;if(e.error)return e.error;if(e.output===void 0||e.output===null)return"(no output)";if(typeof e.output=="string")return e.output;try{return JSON.stringify(e.output,null,2)}catch{return String(e.output)}}function Fw(e,t){return e.length<=t?e:e.slice(0,t)+"…"}const qw={background:"var(--bg-3)",border:"1px solid var(--line)",borderRadius:5,margin:"3px 0",fontFamily:'"JetBrains Mono", monospace',fontSize:11,width:"100%",maxWidth:"100%",minWidth:0},Ww={all:"unset",cursor:"pointer",width:"100%",display:"flex",alignItems:"center",gap:6,padding:"4px 8px",color:"var(--text-1)",boxSizing:"border-box"},Kw={margin:0,padding:"6px 8px",borderTop:"1px solid var(--line)",background:"var(--bg-1)",color:"var(--text-1)",fontSize:10.5,whiteSpace:"pre-wrap",overflowX:"auto",overflowY:"auto",maxHeight:240,wordBreak:"break-word",overflowWrap:"anywhere"};function Nz({toolCall:e}){const[t,n]=x.useState(!1),r=x.useMemo(()=>Fw(Tz(e),100),[e]),a=x.useMemo(()=>Mz(e),[e]);return h.jsxs("div",{style:qw,children:[h.jsxs("button",{type:"button",style:Ww,onClick:()=>n(o=>!o),children:[t?h.jsx(Xr,{size:11}):h.jsx(wo,{size:11}),h.jsx("span",{style:{color:"var(--accent)",fontWeight:600},children:e.tool}),r&&h.jsx("span",{style:{color:"var(--text-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:r})]}),t&&h.jsx("pre",{style:Kw,children:a})]})}function Oz({toolResult:e}){const[t,n]=x.useState(!1),r=x.useMemo(()=>Fw(Az(e),120),[e]),a=x.useMemo(()=>Rz(e),[e]),o=!!e.error;return h.jsxs("div",{style:{...qw,borderColor:o?"var(--danger)":"var(--line)"},children:[h.jsxs("button",{type:"button",style:Ww,onClick:()=>n(c=>!c),children:[t?h.jsx(Xr,{size:11}):h.jsx(wo,{size:11}),o?h.jsx(ui,{size:11,style:{color:"var(--danger)"}}):h.jsx($2,{size:11,style:{color:"var(--ok)"}}),h.jsx("span",{style:{color:o?"var(--danger)":"var(--text-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:r})]}),t&&h.jsx("pre",{style:Kw,children:a})]})}const Dz={background:"var(--bg-3)",border:"1px solid var(--line)",borderRadius:5,margin:"3px 0",fontFamily:'"JetBrains Mono", monospace',fontSize:11,width:"100%",maxWidth:"100%",minWidth:0,opacity:.78},Lz={all:"unset",cursor:"pointer",width:"100%",display:"flex",alignItems:"center",gap:6,padding:"4px 8px",color:"var(--text-1)",boxSizing:"border-box"},zz={margin:0,padding:"6px 8px",borderTop:"1px solid var(--line)",background:"var(--bg-1)",color:"var(--text-1)",fontSize:10.5,whiteSpace:"pre-wrap",overflowX:"auto",overflowY:"auto",maxHeight:240,wordBreak:"break-word",overflowWrap:"anywhere"},Bz={completed:"✓",in_progress:"→",pending:"○",cancelled:"⊘"},jz={completed:"var(--ok, #4caf50)",in_progress:"var(--accent)",pending:"var(--text-2)",cancelled:"var(--text-2)"};function Iz({meta:e}){const[t,n]=x.useState(!1),r=x.useMemo(()=>e.engine==="codex-cli"&&e.itemType==="todo_list"?Lx(e.payload):null,[e.engine,e.itemType,e.payload]),a=x.useMemo(()=>{try{return JSON.stringify(e.payload,null,2)}catch{return String(e.payload)}},[e.payload]);return h.jsxs("div",{style:Dz,title:`${e.engine} · ${e.itemType}`,children:[h.jsxs("button",{type:"button",style:Lz,onClick:()=>n(o=>!o),children:[t?h.jsx(Xr,{size:11}):h.jsx(wo,{size:11}),h.jsx(J2,{size:12,style:{color:"var(--text-2)"}}),h.jsxs("span",{style:{color:"var(--text-2)",fontWeight:600},children:[e.engine.replace("-cli","")," · ",e.label]}),e.summary&&h.jsx("span",{style:{color:"var(--text-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,fontStyle:"italic"},children:e.summary})]}),t&&h.jsx("div",{style:zz,children:r?h.jsx("ul",{style:{margin:0,paddingLeft:0,listStyle:"none"},children:r.map((o,c)=>h.jsxs("li",{style:{display:"flex",gap:6,padding:"1px 0"},children:[h.jsx("span",{style:{color:jz[o.status]??"var(--text-2)",width:12,flexShrink:0},children:Bz[o.status]??"○"}),h.jsx("span",{style:{color:o.status==="completed"?"var(--text-2)":"var(--text-1)",textDecoration:o.status==="cancelled"?"line-through":"none"},children:o.content})]},c))}):h.jsx("pre",{style:{margin:0},children:a})})]})}const e1=80;function Gw(e){return e.replace(/^\[[^\]]*\]\s*/,"").trim()}function Yw(e){return e.replace(/^agent:/,"").replace(/^profile:/,"profile ")}function Pz(e){var t,n;return((n=(t=e.match(/^name:\s*(.+)$/im))==null?void 0:t[1])==null?void 0:n.trim())??""}function Uz(e){var t;return((t=e.match(/Session '([^']+)'/))==null?void 0:t[1])??""}function Hz(e){var t;return Yw(((t=e.match(/browser '([^']+)'/))==null?void 0:t[1])??"")}function $z(e){var t;return((t=e.match(/Task '([^']+)'/))==null?void 0:t[1])??""}function Fz(e){var t;return((t=/^\[agent answer\]\s*(\w+)/.exec(e))==null?void 0:t[1])??""}function qz(e){var t;return((t=Gw(e).split(`
|
|
575
|
+
`)[0])==null?void 0:t.trim())??""}function Wz(e){switch(e){case"sentinel":case"tmux":case"browser":case"voice":case"a2a":case"subagent":case"job":return e;default:return null}}function Kz(e){switch(e.kind){case"sentinel":case"tmux":case"browser":case"voice":return e.kind;case"wake":return e.about;default:return null}}function Gz(e){if(e.fromAgent)return null;const t=e.origin,n=t?Kz(t):Wz(e.fromSystem);if(!n)return null;const r=e.text??"",a=Gw(r);switch(n){case"sentinel":return{kind:n,glyph:"🔔",label:"Sentinel",subtitle:(t==null?void 0:t.kind)==="sentinel"&&t.triggerName||Pz(r),...(t==null?void 0:t.kind)==="sentinel"?{detail:t.triggerId}:{},ariaLabel:"Sentinel trigger",body:a};case"tmux":{const o=(t==null?void 0:t.kind)==="tmux"?t.tmuxSession+(t.tmuxKind?` · ${t.tmuxKind}`:""):Uz(r);return{kind:n,glyph:"🖥",label:"tmux",subtitle:o,ariaLabel:"tmux attention wake",body:a}}case"browser":{let o;if((t==null?void 0:t.kind)==="browser"){const c=Yw(t.viewId),f=t.cause==="activity"?"activity":"handed back";o=c?`${c} · ${f}`:f}else{const c=Hz(r),f=/handoff [a-z0-9]/i.test(r)?"handed back":"handed back after your changes";o=c?`${c} · ${f}`:f}return{kind:n,glyph:"🌐",label:"browser",subtitle:o,ariaLabel:"browser hand-back wake",body:a}}case"voice":return{kind:n,glyph:"🎙",label:"voice",subtitle:a.length>e1?`${a.slice(0,e1)}…`:a,...(t==null?void 0:t.kind)==="voice"?{detail:t.consultId}:{},ariaLabel:"voice channel question",body:a};case"a2a":return{kind:n,glyph:"↩",label:"agent answer",subtitle:Fz(r),...(t==null?void 0:t.kind)==="wake"?{detail:t.ref}:{},ariaLabel:"answer from an agent you asked",body:a};case"subagent":return{kind:n,glyph:"🤖",label:"subagent",subtitle:(t==null?void 0:t.kind)==="wake"&&t.ref?t.ref:$z(r),ariaLabel:"subagent finished",body:a};case"job":return{kind:n,glyph:"🎬",label:"video",subtitle:qz(r),...(t==null?void 0:t.kind)==="wake"?{detail:t.ref}:{},ariaLabel:"video render finished",body:a}}}function vg(e,t){switch(e){case"human":return{glyph:"💬",label:"message",icon:"human"};case"agent":return{glyph:"📨",label:"agent ask",icon:"agent"};case"subagent":return{glyph:"🤖",label:"sub-agent",icon:"subagent"};case"sentinel":return{glyph:"🔔",label:"sentinel",icon:"sentinel"};case"tmux":return{glyph:"🖥",label:"tmux",icon:"tmux"};case"browser":return{glyph:"🌐",label:"browser",icon:"browser"};case"voice":return{glyph:"🎙",label:"voice",icon:"voice"};case"wake":switch(t){case"a2a":return{glyph:"↩",label:"agent answer",icon:"a2a"};case"subagent":return{glyph:"🤖",label:"sub-agent result",icon:"subagent"};case"job":return{glyph:"🎬",label:"video",icon:"job"};default:return{glyph:"↩",label:"wake",icon:"a2a"}}default:return{glyph:"•",label:e||"unknown",icon:"human"}}}function Yz(e){return e?"human"in e?"you":"voiceCall"in e?"voice":`from ${e.agent}`:""}function Vz(e,t){switch(e){case"a2a":return t?`answer from ${t.agent} arriving`:"agent answer arriving";case"subagent":return"sub-agent result arriving";case"job":return"video arriving";default:return"result arriving"}}function t1(e){const t=Math.max(0,Math.floor((Number.isFinite(e)?e:0)/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return n>0?`${n}h ${String(r).padStart(2,"0")}m`:r>0?`${r}m ${String(a).padStart(2,"0")}s`:`${a}s`}function Xz(e){const t=[];return e.waiting>0&&t.push(`waiting ${e.waiting}`),e.running&&t.push("running"),e.arriving>0&&t.push(`${e.arriving} arriving`),e.subagents>0&&t.push(e.subagents===1?"1 sub-agent":`${e.subagents} sub-agents`),e.asks>0&&t.push(e.asks===1?"1 ask":`${e.asks} asks`),t.join(" · ")}function Zz(e){const t=e.indexOf("/");return t<0?e:e.slice(t+1)}const Jz=x.memo(function({msg:t,agentColor:n,agentIcon:r,peerAgents:a,isPinned:o,onPinClick:c,onAbort:f,onRecall:p,showThinking:d=!0}){var j;if(t.role==="tool_call")return h.jsx(Nz,{toolCall:t.toolCall});if(t.role==="error")return h.jsx(a4,{text:t.text,ts:t.ts,media:t.media});if(t.role==="tool_result")return h.jsx(Oz,{toolResult:t.toolResult});if(t.role==="engine_meta"&&t.meta.itemType==="voice_handover")return h.jsx(i4,{text:typeof t.meta.payload=="object"&&t.meta.payload&&"text"in t.meta.payload?String(t.meta.payload.text??""):t.meta.summary??"",ts:t.ts});if(t.role==="engine_meta"&&t.meta.itemType==="voice_spoken")return h.jsx(n4,{text:typeof t.meta.payload=="object"&&t.meta.payload&&"text"in t.meta.payload?String(t.meta.payload.text??""):t.meta.summary??"",ts:t.ts});if(t.role==="engine_meta")return h.jsx(Iz,{meta:t.meta});if(t.role==="memory_inject")return h.jsx(h4,{memory:t.memory});if(t.role==="user"){const R=Gz({origin:t.origin,fromSystem:t.fromSystem,fromAgent:t.fromAgent,text:t.text});if(R)return R.kind==="voice"?h.jsx(r4,{pres:R,ts:t.ts}):h.jsx(t4,{pres:R,ts:t.ts})}const m=t.role==="user"&&t.inputModality==="voice",_=m&&t.voiceSource==="realtime",y=t.role==="user"&&!!t.fromAgent,b=y&&t.fromAgent?a==null?void 0:a.get(t.fromAgent):void 0,w=t.role==="user"&&t.fromAgent&&t.fromSession?s4(t.fromSession):void 0,S=t.role==="user"&&w&&w!=="main"?`${t.fromAgent} · ${w}`:void 0;if(t.role==="user"){const R=b==null?void 0:b.color,L=b==null?void 0:b.icon;return h.jsx("div",{className:`chat-msg-row ${y?"peer-agent":"user"}`,children:h.jsxs("div",{className:"chat-msg",children:[h.jsx("div",{className:"chat-msg-avatar",style:y&&R?{background:`linear-gradient(135deg, ${R}, ${R}88)`,fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"}:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:y?L??"🤖":_?h.jsx(ko,{size:12}):m?h.jsx(Dh,{size:12}):h.jsx(iS,{size:12})}),h.jsxs("div",{className:"chat-msg-meta-col",children:[t.text&&h.jsx(n1,{text:t.text,isPinned:!1}),h.jsxs("div",{className:`chat-msg-bubble ${y?"peer-bubble":""}`,style:y&&R?{whiteSpace:"pre-wrap",display:"flex",flexDirection:"column",gap:t.attachments&&t.attachments.length>0?6:0,background:`${R}1f`,borderColor:`${R}30`}:{whiteSpace:"pre-wrap",display:"flex",flexDirection:"column",gap:t.attachments&&t.attachments.length>0?6:0},children:[t.attachments&&t.attachments.length>0&&h.jsx(c4,{attachments:t.attachments}),t.text&&h.jsx("span",{children:t.text})]}),h.jsx(yg,{ts:t.ts,queued:t.queued,...t.steer?{steer:t.pending?"pending":"applied"}:{},...S?{origin:S}:{},...t.queued&&!y&&p?{onRecall:()=>p(t.id)}:{}})]})]})})}const C=!t.streaming&&!!t.text,k=t.streaming===!0&&!!f;return h.jsx("div",{className:"chat-msg-row agent",children:h.jsxs("div",{className:"chat-msg",children:[h.jsx("div",{className:"chat-msg-avatar",style:{background:n?`linear-gradient(135deg, ${n}, ${n}88)`:"var(--bg-3)",fontSize:14,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:r??"🤖"}),h.jsxs("div",{className:"chat-msg-meta-col",children:[k&&f&&h.jsx(l4,{onAbort:f}),C&&h.jsx(n1,{text:t.text??"",isPinned:!!o,...c?{onPinClick:c}:{}}),h.jsxs("div",{className:"chat-msg-bubble agent-bubble",style:{position:"relative"},children:[t.thinking&&d&&h.jsx(Qz,{thinking:t.thinking,hasText:!!t.text}),t.text?h.jsx(Um,{content:t.text}):(!((j=t.thinking)!=null&&j.streaming)||!d)&&h.jsx("span",{style:{color:"var(--text-3)"},children:"…"}),t.streaming&&h.jsx("span",{style:{display:"inline-block",width:6,height:12,marginLeft:2,verticalAlign:"middle",background:"var(--text-2)",animation:"somora-cursor-blink 1s steps(1) infinite"}}),t.role==="assistant"&&t.media&&t.media.length>0&&h.jsx(Vw,{media:t.media}),t.role==="assistant"&&t.audio&&h.jsx(o4,{url:t.audio.url}),t.role==="assistant"&&t.fallback&&h.jsxs("span",{className:"fallback-chip",title:t.fallback.hops&&t.fallback.hops.length>1?`Answered by ${t.fallback.actual} after ${t.fallback.hops.length} models failed before producing anything:
|
|
576
|
+
`+t.fallback.hops.map((R,L)=>`${L+1}. ${R.model}: ${R.reason}`).join(`
|
|
577
|
+
`):`Answered by the fallback model ${t.fallback.actual} — the primary ${t.fallback.requested}: ${t.fallback.reason}`,children:["⇄ fallback · ",Zz(t.fallback.actual)]})]}),h.jsx(yg,{ts:t.ts})]})]})})});function Qz({thinking:e,hasText:t}){const[n,r]=x.useState(null),a=e.streaming===!0,c=n??(a&&!t);let f=e.text;return a&&(f=e.text.split(`
|
|
578
|
+
`).slice(-6).join(`
|
|
579
|
+
`)),h.jsxs("div",{className:`thinking-block ${c?"open":""} ${a?"streaming":""}`,children:[h.jsxs("button",{type:"button",className:"thinking-head",onClick:()=>r(!c),title:c?"Hide thinking":"Show thinking","aria-expanded":c,children:[h.jsx("span",{className:"thinking-label",children:"🧠 thinking"}),a&&h.jsx("span",{className:"thinking-pulse","aria-label":"thinking in progress",children:"…"}),h.jsx("span",{className:"thinking-chevron",children:c?h.jsx(dm,{size:12}):h.jsx(Xr,{size:12})})]}),c&&h.jsx("div",{className:`thinking-body ${a?"tail":"full"}`,children:h.jsxs("div",{className:"thinking-text",children:[f,!a&&e.truncated&&h.jsx("span",{className:"thinking-truncated",children:" (truncated by the server)"})]})})]})}const e4={sentinel:um,tmux:eS,browser:Oh,subagent:Hx,a2a:Wx,job:$x,voice:ko};function t4({pres:e,ts:t}){const[n,r]=x.useState(!1),a=e4[e.kind],o=_c(t),c=e.body.length>0;return h.jsxs("div",{className:"sentinel-divider-wrap",children:[h.jsxs("div",{className:`sentinel-divider ${c?"expandable":""}`,"aria-label":e.ariaLabel,...c?{role:"button",tabIndex:0,title:n?"Hide the full text":"Show the full text","aria-expanded":n,onClick:()=>r(f=>!f),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r(p=>!p))}}:{},children:[h.jsx("span",{className:"sentinel-divider-rule"}),h.jsxs("span",{className:"sentinel-divider-body",children:[h.jsx(a,{size:12}),h.jsx("span",{className:"sentinel-divider-label",children:e.label}),e.subtitle&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"sentinel-divider-sep",children:"·"}),h.jsx("span",{className:"sentinel-divider-name",children:e.subtitle})]}),e.detail&&h.jsx("span",{className:"sentinel-divider-detail",title:e.detail,children:e.detail}),h.jsx("span",{className:"sentinel-divider-sep",children:"·"}),h.jsx("span",{className:"sentinel-divider-time",children:o}),c&&h.jsx("span",{className:"sentinel-divider-chevron",children:n?h.jsx(dm,{size:11}):h.jsx(Xr,{size:11})})]}),h.jsx("span",{className:"sentinel-divider-rule"})]}),n&&h.jsx("pre",{className:"sentinel-divider-full",children:e.body})]})}function n4({text:e,ts:t}){return e?h.jsxs("div",{className:"voice-spoken","aria-label":"spoken aloud",children:[h.jsx(rS,{size:11}),h.jsx("span",{className:"voice-spoken-text",children:e}),h.jsx("span",{className:"voice-spoken-time",children:_c(t)})]}):null}function i4({text:e,ts:t}){if(!e)return null;const n=e.replace(/^\[voice\]\s*/,"").trim();return h.jsxs("div",{className:"voice-spoken","aria-label":"call handed over",children:[h.jsx(ko,{size:11}),h.jsx("span",{className:"voice-spoken-text",children:n}),h.jsx("span",{className:"voice-spoken-time",children:_c(t)})]})}function r4({pres:e,ts:t}){return h.jsxs("div",{className:"voice-note","aria-label":e.ariaLabel,children:[h.jsxs("div",{className:"voice-note-head",children:[h.jsx(ko,{size:12}),h.jsx("span",{className:"voice-note-label",children:e.label}),h.jsx("span",{className:"voice-note-time",children:_c(t)})]}),h.jsx("div",{className:"voice-note-body",children:e.body})]})}function yg({ts:e,queued:t,steer:n,origin:r,onRecall:a}){return!e&&!t&&!r&&!n?null:h.jsxs("span",{className:"chat-msg-time",children:[n&&h.jsxs("span",{className:"chat-msg-queued chat-msg-steer",title:n==="pending"?"Handed to the running turn — delivered before its next step":"Delivered into the running turn, before its next step",children:[h.jsx(ec,{size:10}),h.jsx("span",{children:n==="pending"?"steering…":"steered"})]}),t&&h.jsxs("span",{className:"chat-msg-queued",title:"Waiting for the previous turn to finish",children:[h.jsx(fm,{size:10}),h.jsx("span",{children:"queued"}),t.ahead>1&&h.jsxs("span",{children:["· ",t.ahead-1," ahead"]}),a&&h.jsxs("button",{type:"button",className:"chat-msg-recall",onClick:a,title:"Take this message back into the composer to edit it","aria-label":"Edit queued message",children:[h.jsx(pm,{size:10}),h.jsx("span",{children:"edit"})]}),h.jsx("span",{className:"chat-msg-queued-sep",children:"·"})]}),r&&h.jsxs("span",{className:"chat-msg-origin",title:"Sending agent · its session",children:[r,h.jsx("span",{className:"chat-msg-queued-sep",children:"·"})]}),e?_c(e):""]})}function s4(e){const t=/^\d{8}-\d{6}_(.+)$/.exec(e);return t?t[1]:e}function a4({text:e,ts:t,media:n}){return h.jsx("div",{className:"chat-msg-row error",role:"alert",children:h.jsxs("div",{className:"chat-msg",children:[h.jsx("div",{className:"chat-msg-avatar chat-msg-avatar-error",children:h.jsx(ui,{size:12})}),h.jsxs("div",{className:"chat-msg-meta-col",children:[h.jsxs("div",{className:"chat-msg-bubble error-bubble",children:[h.jsx("div",{className:"chat-msg-error-label",children:"Turn failed"}),h.jsx("div",{className:"chat-msg-error-text",children:e}),n&&n.length>0&&h.jsx(Vw,{media:n})]}),h.jsx(yg,{ts:t})]})]})})}function _c(e){if(!e)return"";const t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),a=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0");if(r)return`${a}:${o}`;const c=String(t.getDate()).padStart(2,"0"),f=String(t.getMonth()+1).padStart(2,"0");return`${c}.${f}. ${a}:${o}`}function o4({url:e}){const t=x.useRef(null),[n,r]=x.useState(!1);function a(){if(t.current&&n){t.current.pause(),t.current.currentTime=0,r(!1);return}const o=new Audio(e);t.current=o,o.onended=()=>{r(!1),t.current=null},o.onerror=()=>{r(!1),t.current=null},o.play().then(()=>r(!0),()=>r(!1))}return h.jsxs("button",{type:"button",onClick:a,title:n?"Stop":"Play voice reply",style:{marginTop:6,background:"transparent",border:"1px solid var(--border-2)",borderRadius:4,color:"var(--text-2)",cursor:"pointer",fontSize:12,padding:"3px 8px",display:"inline-flex",alignItems:"center",gap:4},children:[n?h.jsx(Lh,{size:12}):h.jsx(zh,{size:12}),h.jsx("span",{children:n?"Stop":"Play"})]})}function l4({onAbort:e}){return h.jsx("div",{className:"bubble-actions bubble-stop",onMouseDown:t=>t.stopPropagation(),children:h.jsx("button",{type:"button",className:"bubble-action-btn bubble-stop-btn",title:"Stop generating",onClick:e,"aria-label":"Stop generating",children:h.jsx(Eo,{size:11,fill:"currentColor"})})})}function n1({text:e,isPinned:t,onPinClick:n}){const[r,a]=x.useState(!1);async function o(){try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{}}return h.jsxs("div",{className:`bubble-actions ${t?"has-pinned":""}`,onMouseDown:c=>c.stopPropagation(),children:[h.jsx("button",{type:"button",className:"bubble-action-btn",title:r?"Copied":"Copy message",onClick:o,"aria-label":"Copy message",children:r?h.jsx(uc,{size:12}):h.jsx(qx,{size:12})}),n&&h.jsx("button",{type:"button",className:`bubble-action-btn pin-btn ${t?"active":""}`,title:t?"Unpin":"Pin this message",onClick:n,"aria-label":t?"Unpin message":"Pin message","aria-pressed":t,children:h.jsx(Vx,{size:12,fill:t?"currentColor":"none"})})]})}function Vw({media:e}){const t=e.filter(r=>r.type==="image"),n=e.filter(r=>r.type==="video");return t.length===0&&n.length===0?null:h.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:8},children:[t.map(r=>h.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",title:r.prompt,style:{display:"block",lineHeight:0},children:h.jsx("img",{src:r.url,alt:r.prompt,loading:"lazy",style:{maxWidth:t.length>1?168:320,maxHeight:320,borderRadius:6,border:"1px solid var(--line)",display:"block"},onError:a=>{a.currentTarget.style.display="none"}})},r.id)),n.map(r=>h.jsx("video",{controls:!0,preload:"metadata",...r.thumbUrl?{poster:r.thumbUrl}:{},src:r.url,title:r.prompt,style:{maxWidth:n.length>1?260:380,maxHeight:320,borderRadius:6,border:"1px solid var(--line)",display:"block",background:"#000"}},r.id))]})}function c4({attachments:e}){return h.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:e.map(t=>h.jsxs("div",{title:`${t.name} (${u4(t.size)})`,style:{display:"flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:4,background:"rgba(0,0,0,0.18)",fontFamily:'"JetBrains Mono", monospace',fontSize:10,maxWidth:220},children:[t.kind==="image"?h.jsx("img",{src:`/attachments/${t.hash}`,alt:t.name,style:{width:24,height:24,objectFit:"cover",borderRadius:2},onError:n=>{n.currentTarget.style.display="none"}}):t.kind==="pdf"?h.jsx(hc,{size:12}):h.jsx(Kx,{size:12}),h.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]},t.hash+t.name))})}function u4(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} kB`:`${(e/(1024*1024)).toFixed(1)} MB`}function h4({memory:e}){const[t,n]=x.useState(!1),a=e.refs.slice(0,3),o=e.refs.length-a.length,c=f=>f.startsWith("wiki/")?"var(--accent)":f.startsWith("memory/")?"var(--text-1)":(f.startsWith("vault/"),"var(--text-2)");return h.jsxs("div",{style:{margin:"4px 12px 4px 28px",fontFamily:'"JetBrains Mono", monospace',fontSize:11,color:"var(--text-2)",display:"flex",flexDirection:"column",gap:4},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[h.jsx(hm,{size:11,style:{color:"var(--accent-2, #c084fc)"}}),h.jsxs("span",{style:{color:"var(--accent-2, #c084fc)",fontWeight:600},children:["memory · ",e.count," hit",e.count===1?"":"s"]}),typeof e.topScore=="number"&&h.jsxs("span",{style:{color:"var(--text-3)"},title:"top hybrid score",children:["top ",e.topScore.toFixed(2)]}),a.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{color:"var(--line-2)"},children:"·"}),a.map(f=>h.jsx("span",{title:f,style:{color:c(f),whiteSpace:"nowrap"},children:f},f)),o>0&&h.jsxs("span",{style:{color:"var(--text-3)"},children:["+",o," more"]})]}),e.fullText&&h.jsx("button",{type:"button",onClick:()=>n(f=>!f),title:t?"collapse full inject text":"expand full inject text",style:{all:"unset",cursor:"pointer",marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:2,color:"var(--text-3)"},children:t?h.jsx(dm,{size:11}):h.jsx(Xr,{size:11})})]}),t&&e.fullText&&h.jsx("pre",{style:{margin:0,maxHeight:220,overflow:"auto",background:"var(--surface-1)",border:"1px solid var(--line-2)",borderRadius:4,padding:6,fontSize:10,lineHeight:1.4,whiteSpace:"pre-wrap",color:"var(--text-1)"},children:e.fullText})]})}const $h=["temperature","top_p","top_k","min_p","frequency_penalty","presence_penalty","repetition_penalty","seed","stop"],d4={temperature:"0–2 · randomness, 1 = model default",top_p:"0–1 · nucleus sampling cutoff",top_k:"integer ≥ 1 · candidate pool size",min_p:"0–1 · minimum relative token probability",frequency_penalty:"-2–2 · penalise repeated tokens by count",presence_penalty:"-2–2 · penalise tokens already present",repetition_penalty:"> 0 · multiplicative repetition penalty",seed:"integer · deterministic sampling seed",stop:"comma-separated stop sequences"},Tp=`usage: /sampling [key=value …|default] — keys: ${$h.join(" ")} · value "null" or "-" removes a key`,f4="usage: /temp <0–2>|default";function ao(e,t,n){const r=Number(t),a=n.min!==void 0&&n.max!==void 0?` between ${n.min} and ${n.max}`:n.gtZero?" greater than 0":"",o=`${n.int?"an integer":"a number"}${a}`;return t.trim()===""||!Number.isFinite(r)?{ok:!1,error:`${e} must be ${o}`}:n.int&&!Number.isInteger(r)?{ok:!1,error:`${e} must be ${o}`}:n.min!==void 0&&r<n.min?{ok:!1,error:`${e} must be ${o}`}:n.max!==void 0&&r>n.max?{ok:!1,error:`${e} must be ${o}`}:n.gtZero&&r<=0?{ok:!1,error:`${e} must be ${o}`}:{ok:!0,value:r}}function Xw(e,t){switch(e){case"temperature":return ao(e,t,{min:0,max:2});case"top_p":case"min_p":return ao(e,t,{min:0,max:1});case"top_k":return ao(e,t,{min:1,int:!0});case"frequency_penalty":case"presence_penalty":return ao(e,t,{min:-2,max:2});case"repetition_penalty":return ao(e,t,{gtZero:!0});case"seed":return ao(e,t,{int:!0});case"stop":{const n=t.split(",").map(r=>r.trim()).filter(r=>r.length>0);return n.length===0?{ok:!1,error:"stop needs at least one sequence"}:{ok:!0,value:n.length===1?n[0]:n}}}}function p4(e){return $h.includes(e)}function i1(e){const t={},n=e.map(r=>r.trim()).filter(r=>r.length>0);if(n.length===0)return{ok:!1,error:"no key=value pairs given"};for(const r of n){const a=r.indexOf("=");if(a<=0)return{ok:!1,error:`expected key=value, got "${r}"`};const o=r.slice(0,a).trim().toLowerCase(),c=r.slice(a+1).trim();if(!p4(o))return{ok:!1,error:`unknown key "${o}"`};if(c==="null"||c==="-"){t[o]=null;continue}const f=Xw(o,c);if(!f.ok)return{ok:!1,error:f.error};t[o]=f.value}return{ok:!0,params:t}}function Sh(e){if(!e)return"(engine default)";const t=[];for(const n of $h){if(!(n in e))continue;const r=e[n];r!==void 0&&(r===null?t.push(`${n}=-`):Array.isArray(r)?t.push(`${n}=${r.join(",")}`):t.push(`${n}=${String(r)}`))}return t.length?t.join(" "):"(engine default)"}const g4=[{name:"/model",usage:"/model <ref>",hint:"switch model for this session"},{name:"/session",usage:"/session <slug>",hint:"switch to another session of this agent"},{name:"/new",usage:"/new <slug>",hint:"create a new session and switch to it"},{name:"/thinking",usage:"/thinking <level>",hint:"off | low | medium | high | default"},{name:"/sampling",usage:"/sampling [key=value …|default]",hint:"temperature, top_p, top_k, … for this session (openai-compatible engine only)"},{name:"/temp",usage:"/temp <0–2>|default",hint:"shorthand for /sampling temperature=<n>"},{name:"/verbose",usage:"/verbose thinking on|off",hint:"show or hide the thinking block above replies (this session, display only)"},{name:"/projekt",usage:"/projekt <slug>",hint:'pin a project to this session (or "unlink" to clear)'},{name:"/project",usage:"/project <slug>",hint:"alias of /projekt"},{name:"/reset",usage:"/reset YES",hint:"archive this session, force REM dream — type YES to confirm"}];function m4({agent:e,draft:t,keyEvent:n,onAccept:r,onDismiss:a}){const{projectsEnabled:o}=So(),[c,f]=x.useState(null),[p,d]=x.useState(null),[m,_]=x.useState(null),[y,b]=x.useState(0),w=x.useRef(null),S=x.useMemo(()=>g4.filter(k=>o||k.name!=="/projekt"&&k.name!=="/project"),[o]);x.useEffect(()=>{t.startsWith("/model ")&&c===null&&Me.models().then(f).catch(()=>f([]))},[t,c]),x.useEffect(()=>{t.startsWith("/session ")&&p===null&&Me.sessions(e).then(d).catch(()=>d([]))},[t,e,p]),x.useEffect(()=>{(t.startsWith("/projekt ")||t.startsWith("/project "))&&m===null&&Me.projects().then(_).catch(()=>_([]))},[t,m]);const C=x.useMemo(()=>{const k=t.trimStart();if(!k.startsWith("/"))return[];const j=k.indexOf(" ");if(j===-1){const q=k.toLowerCase();return S.filter(O=>O.name.startsWith(q)).map(O=>({commit:`${O.name} `,label:O.usage,detail:O.hint}))}const R=k.slice(0,j).toLowerCase(),L=k.slice(j+1);if(R==="/model"){if(!c)return[{commit:t,label:"loading models…"}];const q=L.toLowerCase();return c.filter(O=>O.ref.toLowerCase().includes(q)||O.alias&&O.alias.toLowerCase().includes(q)||O.id.toLowerCase().includes(q)).map(O=>({commit:`/model ${O.ref}`,label:O.ref,detail:`${O.engine} · ctx ${_4(O.contextWindow)} · ${O.capabilities.join(",")}`,resolved:{kind:"model",ref:O.ref}}))}if(R==="/session"){if(!p)return[{commit:t,label:"loading sessions…"}];const q=L.toLowerCase();return p.filter(O=>O.slug.toLowerCase().includes(q)).map(O=>({commit:`/session ${O.slug}`,label:O.slug,detail:`${O.messageCount} msgs · last ${v4(O.lastActivity)}`,resolved:{kind:"session",slug:O.slug}}))}if(R==="/new"){const q=L.trim();return q?q==="main"?[{commit:t,label:'"main" is reserved — pick another slug'}]:[{commit:`/new ${q}`,label:`create session "${q}"`,detail:"POST /agents/.../sessions, then switch this window to it",resolved:{kind:"new",slug:q}}]:[{commit:t,label:"type a slug — e.g. /new debug-session"}]}if(R==="/reset")return L.trim()!=="YES"?[{commit:"/reset YES",label:'type "YES" to confirm reset',detail:"archives current session jsonl + forces REM dream over the just-closed range"}]:[{commit:"/reset YES",label:"reset session NOW",detail:"session jsonl moves to <session>-archive, REM dream spawns over it",resolved:{kind:"reset"}}];if(R==="/thinking"){const q=["off","low","medium","high","default"],O=L.toLowerCase();return q.filter(z=>z.startsWith(O)).map(z=>({commit:`/thinking ${z}`,label:z,detail:z==="default"?"inherit from persona / engine default":z==="off"?"disable thinking":`effort: ${z}`,resolved:{kind:"thinking",level:z}}))}if(R==="/verbose"){const q=L.trim().toLowerCase();return["on","off"].filter(O=>`thinking ${O}`.startsWith(q)||q.startsWith(`thinking ${O}`)).map(O=>({commit:`/verbose thinking ${O}`,label:`thinking ${O}`,detail:O==="on"?"show the 🧠 thinking block above replies in this session":"hide the thinking block in this session (still captured + exported)",resolved:{kind:"verbose",topic:"thinking",value:O}}))}if(R==="/sampling"){const q=L.replace(/^\s+/,""),O=q.split(/\s+/).filter(P=>P.length>0),z=/\s$/.test(q),J=z?"":O[O.length-1]??"",ie=z?O:O.slice(0,-1),D=ie.length?`${ie.join(" ")} `:"",A=[];if(O.length===0&&A.push({commit:"/sampling",label:"show current sampling params",detail:"effective values + where they come from",resolved:{kind:"sampling-show"}}),ie.length===0&&(J===""||"default".startsWith(J.toLowerCase())||J==="-")&&A.push({commit:"/sampling default",label:"default",detail:"clear the session override, fall back to persona / model default",resolved:{kind:"sampling-clear"}}),J.includes("=")){const P=i1(O);return P.ok?A.push({commit:`/sampling ${O.join(" ")}`,label:`set ${Sh(P.params)}`,detail:'merges into the session override · "-" removes a key',resolved:{kind:"sampling",params:P.params}}):A.push({commit:t,label:P.error,detail:Tp}),A}const M=J.toLowerCase();for(const P of $h)P.startsWith(M)&&A.push({commit:`/sampling ${D}${P}=`,label:`${P}=`,detail:d4[P]});if(ie.length>0&&J===""){const P=i1(ie);A.unshift(P.ok?{commit:`/sampling ${ie.join(" ")}`,label:`set ${Sh(P.params)}`,detail:'merges into the session override · "-" removes a key',resolved:{kind:"sampling",params:P.params}}:{commit:t,label:P.error,detail:Tp})}return A.length===0&&A.push({commit:t,label:`unknown key "${J}"`,detail:Tp}),A}if(R==="/temp"){const q=L.trim(),O=[{v:"0.2",hint:"focused · near-deterministic"},{v:"0.7",hint:"balanced"},{v:"1.0",hint:"model default · creative"}],z=q.toLowerCase(),J=[];for(const ie of O)ie.v.startsWith(z)&&J.push({commit:`/temp ${ie.v}`,label:ie.v,detail:ie.hint,resolved:{kind:"sampling",params:{temperature:Number(ie.v)}}});if((!q||"default".startsWith(z)||q==="-")&&J.push({commit:"/temp default",label:"default",detail:"remove only the temperature override (other sampling keys stay)",resolved:{kind:"sampling",params:{temperature:null}}}),q&&!O.some(ie=>ie.v===q)&&q!=="default"&&q!=="-"){const ie=Xw("temperature",q);J.unshift(ie.ok?{commit:`/temp ${q}`,label:`temperature=${q}`,detail:"PUT { temperature } into the session override",resolved:{kind:"sampling",params:{temperature:ie.value}}}:{commit:t,label:ie.error,detail:f4})}return J}if(R==="/projekt"||R==="/project"){if(!o)return[];const q=[],O=L.trim().toLowerCase();if((!O||"unlink".startsWith(O)||"off".startsWith(O)||"clear".startsWith(O)||O==="-")&&q.push({commit:`${R} unlink`,label:"unlink — clear pinned project for this session",resolved:{kind:"projekt-unlink"}}),!m)return q.push({commit:t,label:"loading projects…"}),q;for(const z of m)(!O||z.slug.toLowerCase().includes(O)||z.name.toLowerCase().includes(O)||z.entity.toLowerCase().includes(O))&&q.push({commit:`${R} ${z.slug}`,label:z.name,detail:`${z.entity}${z.tags.length?` · ${z.tags.join(", ")}`:""} · ${z.paths.length} path${z.paths.length===1?"":"s"}`,resolved:{kind:"projekt",slug:z.slug}});return q}return[]},[t,c,p,m,o,S]);return x.useEffect(()=>{b(k=>C.length===0?0:Math.min(k,C.length-1))},[C.length]),x.useEffect(()=>{if(n&&n.nonce!==w.current)if(w.current=n.nonce,n.key==="ArrowDown")b(k=>C.length===0?0:(k+1)%C.length);else if(n.key==="ArrowUp")b(k=>C.length===0?0:(k-1+C.length)%C.length);else if(n.key==="Enter"||n.key==="Tab"){const k=C[y];k&&k.commit!==t?r({commit:k.commit,...k.resolved?{resolved:k.resolved}:{}}):k!=null&&k.resolved&&r({commit:k.commit,resolved:k.resolved})}else n.key==="Escape"&&a()},[n,C,y,t,r,a]),C.length===0?null:h.jsx("div",{className:"slash-popup",style:{position:"absolute",bottom:"100%",left:8,right:8,marginBottom:4,background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:6,boxShadow:"0 4px 16px rgba(0,0,0,0.4)",maxHeight:240,overflowY:"auto",zIndex:10,fontFamily:'"JetBrains Mono", monospace',fontSize:12},children:C.map((k,j)=>h.jsxs("div",{onMouseDown:R=>{R.preventDefault(),!(k.commit===t&&!k.resolved)&&r({commit:k.commit,...k.resolved?{resolved:k.resolved}:{}})},onMouseEnter:()=>b(j),style:{padding:"6px 10px",cursor:k.resolved||k.commit!==t?"pointer":"default",background:j===y?"var(--bg-3)":"transparent",borderBottom:j===C.length-1?"none":"1px solid var(--line-2)"},children:[h.jsx("div",{style:{color:"var(--text-1)"},children:k.label}),k.detail&&h.jsx("div",{style:{color:"var(--text-3)",fontSize:10,marginTop:2},children:k.detail})]},`${k.commit}-${j}`))})}function _4(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function v4(e){const t=Date.parse(e);if(!t)return"?";const n=Date.now()-t;return n<6e4?"just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function y4({items:e,onRemove:t}){return e.length===0?null:h.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,padding:"6px 8px",borderTop:"1px solid var(--line)",background:"var(--bg-2)"},children:e.map(n=>h.jsx(b4,{item:n,onRemove:()=>t(n.id)},n.id))})}function b4({item:e,onRemove:t}){var c,f;const n=((c=e.ref)==null?void 0:c.kind)==="image"||e.mimeHint&&e.mimeHint.startsWith("image/"),r=((f=e.ref)==null?void 0:f.kind)==="pdf"||e.mimeHint==="application/pdf",a=e.state==="error",o=e.state==="uploading";return h.jsxs("div",{title:a?e.error:`${e.name} (${r1(e.size)})`,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px 4px 4px",borderRadius:6,border:`1px solid ${a?"var(--danger)":"var(--line-2)"}`,background:"var(--bg-3)",opacity:o?.65:1,maxWidth:220,position:"relative",fontFamily:'"JetBrains Mono", monospace',fontSize:11},children:[h.jsx("div",{style:{width:32,height:32,borderRadius:4,background:"var(--bg-1)",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"},children:n&&e.previewUrl?h.jsx("img",{src:e.previewUrl,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):n?h.jsx(Xp,{size:16}):r?h.jsx(hc,{size:16}):h.jsx(Kx,{size:16})}),h.jsxs("div",{style:{overflow:"hidden",minWidth:0,flex:1},children:[h.jsx("div",{style:{color:a?"var(--danger)":"var(--text-1)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),h.jsx("div",{style:{color:"var(--text-3)",fontSize:10},children:a?"failed":o?"uploading…":r1(e.size)})]}),h.jsx("button",{type:"button",onClick:t,title:o?"cancel upload":"remove attachment",style:{all:"unset",cursor:"pointer",padding:2,color:"var(--text-3)",flex:"0 0 auto"},children:h.jsx(gh,{size:12})})]})}function r1(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} kB`:`${(e/(1024*1024)).toFixed(1)} MB`}function x4(){return typeof navigator>"u"||!navigator.mediaDevices?!1:typeof navigator.mediaDevices.getDisplayMedia=="function"}function S4({onCaptured:e}){const[t,n]=x.useState(!1);if(!x4())return null;async function r(){if(t)return;n(!0);let a=null;try{a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:1},audio:!1});const o=a.getVideoTracks()[0];if(!o)throw new Error("no video track");const c=o.getSettings(),f=c.width??1280,p=c.height??720,d=await w4(a,f,p),m=new Date().toISOString().replace(/[-:]/g,"").replace(/\..+$/,"").replace("T","-"),_=new File([d],`screenshot-${m}.png`,{type:"image/png"});e(_)}catch(o){console.info("[somora-web] screenshot cancelled or failed:",o.message)}finally{a==null||a.getTracks().forEach(o=>o.stop()),n(!1)}}return h.jsx("button",{type:"button",className:"chat-icon-btn",title:"Screenshot a window / tab / screen",onClick:r,disabled:t,children:h.jsx(j2,{size:14})})}async function w4(e,t,n){const r=document.createElement("video");r.srcObject=e,r.muted=!0,r.playsInline=!0,await r.play(),await new Promise(c=>requestAnimationFrame(()=>c()));const a=document.createElement("canvas");a.width=r.videoWidth||t,a.height=r.videoHeight||n;const o=a.getContext("2d");if(!o)throw new Error("canvas 2d context unavailable");return o.drawImage(r,0,0,a.width,a.height),new Promise((c,f)=>{a.toBlob(p=>{p?c(p):f(new Error("canvas.toBlob returned null"))},"image/png")})}function k4(){return!(typeof navigator>"u"||!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!="function"||typeof window>"u"||typeof window.MediaRecorder>"u")}function E4({onTranscript:e}){const[t,n]=x.useState(null),[r,a]=x.useState("idle"),o=x.useRef(null),c=x.useRef(null),f=x.useRef([]);if(x.useEffect(()=>{let S=!1;return fetch("/stt/config").then(C=>C.ok?C.json():{enabled:!1}).then(C=>{S||n(!!C.enabled)}).catch(()=>{S||n(!1)}),()=>{S=!0}},[]),x.useEffect(()=>()=>{var S;(S=c.current)==null||S.getTracks().forEach(C=>C.stop()),c.current=null,o.current=null},[]),!k4()||!t)return null;async function p(){try{const S=await navigator.mediaDevices.getUserMedia({audio:!0});c.current=S;const C=new MediaRecorder(S);o.current=C,f.current=[],C.ondataavailable=k=>{k.data.size>0&&f.current.push(k.data)},C.onstop=async()=>{const k=new Blob(f.current,{type:C.mimeType||"audio/webm"});await m(k)},C.start(),a("recording")}catch(S){console.info("[somora-web] mic capture denied/failed:",S.message),_()}}function d(){const S=o.current;S&&S.state==="recording"?(a("transcribing"),S.stop()):_()}async function m(S){try{const C=new FormData,k=C4(S.type);C.append("file",new File([S],k,{type:S.type}));const j=await fetch("/stt/transcribe",{method:"POST",body:C});if(!j.ok){const q=await j.text().catch(()=>"");console.warn("[somora-web] stt request failed:",j.status,q);return}const L=((await j.json()).text??"").trim();L&&e(L)}catch(C){console.warn("[somora-web] stt error:",C.message)}finally{_()}}function _(){var S;(S=c.current)==null||S.getTracks().forEach(C=>C.stop()),c.current=null,o.current=null,f.current=[],a("idle")}const y=()=>{r==="idle"?p():r==="recording"&&d()},b=r==="idle"?"Voice input (click to record)":r==="recording"?"Stop recording":"Transcribing…",w=r==="transcribing"?h.jsx(Zp,{size:14,className:"somora-spin"}):h.jsx(Dh,{size:14,className:r==="recording"?"somora-mic-active":void 0});return h.jsx("button",{type:"button",className:"chat-icon-btn",title:b,onClick:y,disabled:r==="transcribing",children:w})}function C4(e){return e.includes("webm")?"recording.webm":e.includes("ogg")?"recording.ogg":e.includes("mp4")||e.includes("m4a")?"recording.m4a":e.includes("wav")?"recording.wav":e.includes("mpeg")?"recording.mp3":"recording.bin"}function T4({open:e,onClose:t,anchorRect:n,model:r,thinking:a,showThinking:o,onToggleShowThinking:c,onSlash:f}){const[p,d]=x.useState("idle"),[m,_]=x.useState(!1),[y,b]=x.useState(null),[w,S]=x.useState(""),C=x.useRef(null);x.useEffect(()=>{e||(d("idle"),_(!1),S(""))},[e]),x.useEffect(()=>{if(!e)return;function A(G){if(C.current&&!C.current.contains(G.target)){if(n){const{clientX:H,clientY:N}=G;if(H>=n.left&&H<=n.right&&N>=n.top&&N<=n.bottom)return}t()}}function M(G){G.key==="Escape"&&t()}const P=setTimeout(()=>{document.addEventListener("mousedown",A),document.addEventListener("keydown",M)},0);return()=>{clearTimeout(P),document.removeEventListener("mousedown",A),document.removeEventListener("keydown",M)}},[e,t,n]),x.useEffect(()=>{!m||y!==null||Me.models().then(b).catch(()=>b([]))},[m,y]);const k=x.useMemo(()=>{if(!y)return null;if(!w.trim())return y;const A=w.toLowerCase();return y.filter(M=>(M.alias??"").toLowerCase().includes(A)||M.id.toLowerCase().includes(A)||M.engine.toLowerCase().includes(A)||M.provider.toLowerCase().includes(A))},[y,w]);if(!e||!n)return null;const j=Math.round(n.bottom+6),R=Math.round(window.innerWidth-n.right);async function L(A){_(!1),await f({kind:"model",ref:A}),t()}async function q(A){await f({kind:"thinking",level:A}),t()}async function O(){d("pending");try{await f({kind:"reset"})}finally{d("idle"),t()}}const z=r?r.alias??`${r.provider}/${r.modelId}`:"—",J=(a==null?void 0:a.effective)??"off",ie=(a==null?void 0:a.source)==="session-override"?"session override":(a==null?void 0:a.source)==="persona-default"?"persona default":"engine default",D=h.jsxs("div",{ref:C,role:"menu",className:"chat-menu-popover",style:{position:"fixed",top:j,right:R,zIndex:1e3,width:280,background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",fontFamily:'"JetBrains Mono", monospace',fontSize:12,color:"var(--text-1)"},children:[h.jsxs(Mp,{title:"MODEL",children:[h.jsx(a1,{label:"current",value:z}),r&&h.jsxs(Ap,{children:[r.engine," · ",Math.round(r.contextWindow/1e3),"k context",r.source==="session-override"?" · session override":""]}),h.jsx(M4,{label:"Switch model…",open:m,onClick:()=>_(A=>!A)}),m&&h.jsxs("div",{style:{marginTop:4},children:[h.jsx("input",{type:"text",placeholder:"filter…",value:w,onChange:A=>S(A.target.value),autoFocus:!0,style:R4}),h.jsxs("div",{style:{maxHeight:200,overflowY:"auto",marginTop:4},children:[k===null&&h.jsx("div",{style:o1,children:"loading…"}),k!==null&&k.length===0&&h.jsx("div",{style:o1,children:"no models match"}),k==null?void 0:k.map(A=>{const M=r?A.id===r.modelId&&A.provider===r.provider:!1;return h.jsxs("div",{onClick:()=>L(A.ref),style:{...N4,background:M?"var(--bg-3)":"transparent"},onMouseEnter:P=>{M||(P.currentTarget.style.background="var(--bg-3)")},onMouseLeave:P=>{M||(P.currentTarget.style.background="transparent")},children:[h.jsx("span",{style:{color:M?"var(--accent)":"var(--text-3)"},children:M?"●":"○"}),h.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-1)"},children:A.alias??A.id}),h.jsx("span",{style:{color:"var(--text-3)",fontSize:10},children:A.engine})]},`${A.provider}/${A.id}`)})]})]})]}),h.jsx(s1,{}),h.jsxs(Mp,{title:"THINKING",children:[h.jsx(a1,{label:"current",value:J}),h.jsx(Ap,{children:ie}),h.jsx("div",{style:{display:"flex",gap:3,marginTop:6},children:["off","low","medium","high"].map(A=>{const M=J===A;return h.jsx("button",{type:"button",onClick:()=>q(A),style:{...O4,background:M?"var(--accent)":"var(--bg-1)",color:M?"#0a1010":"var(--text-2)",borderColor:M?"var(--accent)":"var(--line-2)",fontWeight:M?700:400},children:A},A)})}),h.jsx("div",{onClick:()=>q("default"),style:{...Hm,marginTop:4,color:"var(--text-3)",fontSize:11},title:"Remove session override, fall back to persona / engine default",children:"Reset to default"}),h.jsx(A4,{className:"thinking-visibility-row",label:"Show thinking in replies",checked:o,onClick:c,title:"Display only, this session — the text is still captured and exported. Same as /verbose thinking on|off"})]}),h.jsx(s1,{}),h.jsxs(Mp,{title:"DANGER ZONE",tone:"danger",children:[p==="idle"&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",onClick:()=>d("confirming"),style:D4,children:[h.jsx(ui,{size:12}),h.jsx("span",{children:"Reset session"})]}),h.jsxs(Ap,{children:["Archives the current chat (kept as ",h.jsx("code",{style:B4,children:"-archive"}),") and starts fresh. REM extracts memory from the archived content if enabled for this agent."]})]}),p!=="idle"&&h.jsxs("div",{style:{padding:8,border:"1px solid var(--danger)",borderRadius:4,background:"rgba(248, 113, 113, 0.08)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[h.jsx(ui,{size:12,style:{color:"var(--danger)"}}),h.jsx("strong",{style:{color:"var(--danger)"},children:"confirm reset"})]}),h.jsx("div",{style:{fontSize:11,color:"var(--text-1)",marginBottom:8,lineHeight:1.4},children:"The current chat will be archived. Continue?"}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{type:"button",onClick:()=>d("idle"),disabled:p==="pending",style:L4,children:"Cancel"}),h.jsx("button",{type:"button",onClick:O,disabled:p==="pending",style:z4,children:p==="pending"?"Resetting…":"Confirm reset"})]})]})]})]});return dc.createPortal(D,document.body)}function Mp({title:e,tone:t,children:n}){return h.jsxs("div",{style:{padding:"8px 10px"},children:[h.jsx("div",{style:{fontSize:9,letterSpacing:1.4,color:t==="danger"?"var(--danger)":"var(--text-3)",marginBottom:4,fontWeight:700},children:e}),n]})}function s1(){return h.jsx("div",{style:{borderTop:"1px solid var(--line-2)"}})}function a1({label:e,value:t}){return h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[h.jsx("span",{style:{fontSize:10,color:"var(--text-3)"},children:e}),h.jsx("span",{style:{fontSize:12,color:"var(--text-0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}function Ap({children:e}){return h.jsx("div",{style:{fontSize:10,color:"var(--text-3)",marginTop:3,lineHeight:1.4},children:e})}function M4({label:e,open:t,onClick:n}){return h.jsxs("div",{onClick:n,style:Hm,onMouseEnter:r=>r.currentTarget.style.background="var(--bg-3)",onMouseLeave:r=>r.currentTarget.style.background="transparent",children:[h.jsx("span",{children:e}),h.jsx(Xr,{size:12,style:{transform:t?"rotate(180deg)":"none",transition:"transform 0.12s"}})]})}function A4({label:e,checked:t,onClick:n,title:r,className:a}){return h.jsxs("div",{className:a,role:"menuitemcheckbox","aria-checked":t,onClick:n,title:r,style:{...Hm,justifyContent:"flex-start",gap:6,fontSize:11},onMouseEnter:o=>o.currentTarget.style.background="var(--bg-3)",onMouseLeave:o=>o.currentTarget.style.background="transparent",children:[t?h.jsx(mT,{size:12,style:{color:"var(--accent)"}}):h.jsx(Eo,{size:12,style:{color:"var(--text-3)"}}),h.jsx("span",{children:e})]})}const Hm={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"5px 6px",marginTop:6,cursor:"pointer",borderRadius:3,color:"var(--text-1)",background:"transparent",transition:"background 0.12s"},R4={width:"100%",boxSizing:"border-box",padding:"4px 6px",background:"var(--bg-1)",border:"1px solid var(--line-2)",borderRadius:3,color:"var(--text-0)",fontSize:11,fontFamily:'"JetBrains Mono", monospace',outline:"none"},o1={padding:6,color:"var(--text-3)",fontSize:11},N4={display:"flex",alignItems:"center",gap:6,padding:"4px 6px",cursor:"pointer",borderRadius:3,fontSize:11},O4={all:"unset",flex:1,textAlign:"center",padding:"4px 0",border:"1px solid var(--line-2)",borderRadius:3,cursor:"pointer",fontSize:11,fontFamily:'"JetBrains Mono", monospace'},D4={all:"unset",display:"flex",alignItems:"center",justifyContent:"center",gap:6,width:"100%",boxSizing:"border-box",padding:"6px 8px",background:"rgba(248, 113, 113, 0.08)",border:"1px solid var(--danger)",borderRadius:4,color:"var(--danger)",cursor:"pointer",fontSize:11,fontWeight:600,fontFamily:'"JetBrains Mono", monospace',transition:"background 0.12s"},L4={all:"unset",flex:1,textAlign:"center",padding:"5px 0",background:"var(--bg-1)",border:"1px solid var(--line-2)",borderRadius:3,cursor:"pointer",color:"var(--text-1)",fontSize:11,fontFamily:'"JetBrains Mono", monospace'},z4={all:"unset",flex:1,textAlign:"center",padding:"5px 0",background:"var(--danger)",borderRadius:3,cursor:"pointer",color:"#fff",fontSize:11,fontWeight:700,fontFamily:'"JetBrains Mono", monospace'},B4={background:"var(--bg-1)",padding:"0 3px",borderRadius:2,fontSize:10};function j4({agent:e,session:t,project:n,onMutated:r}){const[a,o]=x.useState(!1),[c,f]=x.useState(null),p=x.useRef(null),d=()=>{var m;if(a){o(!1);return}f(((m=p.current)==null?void 0:m.getBoundingClientRect())??null),o(!0)};if(n){const m=n.color??"#8b8b8b";return h.jsxs(h.Fragment,{children:[h.jsxs("button",{ref:p,type:"button",title:`Project: ${n.name}
|
|
580
|
+
entity: ${n.entity}
|
|
581
|
+
${n.paths.length} pointer${n.paths.length===1?"":"s"}`,"aria-expanded":a,"aria-haspopup":"menu",onClick:d,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",background:`${m}22`,border:`1px solid ${m}66`,color:m,borderRadius:4,fontFamily:'"JetBrains Mono", monospace',fontSize:10,maxWidth:200,height:20,boxSizing:"border-box",lineHeight:1},children:[n.archived?h.jsx(G2,{size:11}):h.jsx(K2,{size:11}),h.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:n.name})]}),h.jsx(l1,{open:a,onClose:()=>o(!1),anchorRect:c,agent:e,session:t,current:n,onMutated:r})]})}return h.jsxs(h.Fragment,{children:[h.jsx("button",{ref:p,type:"button",className:"chat-icon-btn",title:"Link a project to this session","aria-expanded":a,"aria-haspopup":"menu",onClick:d,children:h.jsx(Gx,{size:14})}),h.jsx(l1,{open:a,onClose:()=>o(!1),anchorRect:c,agent:e,session:t,current:null,onMutated:r})]})}function l1({open:e,onClose:t,anchorRect:n,agent:r,session:a,current:o,onMutated:c}){const[f,p]=x.useState(null),[d,m]=x.useState(""),[_,y]=x.useState(!1),[b,w]=x.useState(null),S=x.useRef(null);x.useEffect(()=>{if(!e)return;function z(D){if(S.current&&!S.current.contains(D.target)){if(n){const{clientX:A,clientY:M}=D;if(A>=n.left&&A<=n.right&&M>=n.top&&M<=n.bottom)return}t()}}function J(D){D.key==="Escape"&&t()}const ie=setTimeout(()=>{document.addEventListener("mousedown",z),document.addEventListener("keydown",J)},0);return()=>{clearTimeout(ie),document.removeEventListener("mousedown",z),document.removeEventListener("keydown",J)}},[e,t,n]),x.useEffect(()=>{if(!e){p(null),m(""),w(null);return}Me.projects().then(z=>p(z)).catch(z=>w(z.message))},[e]);const C=x.useMemo(()=>{if(!f)return[];const z=d.trim().toLowerCase(),J=f.filter(D=>o&&D.slug===o.slug?!1:z?D.slug.includes(z)||D.name.toLowerCase().includes(z)||D.entity.toLowerCase().includes(z)||D.tags.some(A=>A.toLowerCase().includes(z)):!0),ie=new Map;for(const D of J)ie.has(D.entity)||ie.set(D.entity,[]),ie.get(D.entity).push(D);return Array.from(ie.entries()).sort((D,A)=>D[0].localeCompare(A[0]))},[f,d,o]);async function k(z){if(!_){y(!0),w(null);try{await Me.setSessionProject(r,a,z),c(),t()}catch(J){w(J.message)}finally{y(!1)}}}async function j(){if(!_){y(!0),w(null);try{await Me.clearSessionProject(r,a),c(),t()}catch(z){w(z.message)}finally{y(!1)}}}if(!e||!n)return null;const R=260,L=Math.max(8,n.right-R),q=n.bottom+4,O=h.jsxs("div",{ref:S,className:"slash-popup",role:"menu",style:{position:"fixed",top:q,left:L,width:R,maxHeight:"60vh",overflow:"auto",background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",zIndex:9999,fontFamily:'"JetBrains Mono", monospace',fontSize:11},children:[o&&h.jsxs("div",{style:{padding:"8px 10px",borderBottom:"1px solid var(--line-2)",background:"var(--bg-3)"},children:[h.jsx("div",{style:{color:"var(--text-3)",fontSize:9,marginBottom:2},children:"CURRENTLY PINNED"}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{style:{width:8,height:8,borderRadius:2,background:o.color??"var(--text-2)",flexShrink:0}}),h.jsx("span",{style:{color:"var(--text-1)",flex:1},children:o.name}),h.jsx("span",{style:{color:"var(--text-3)",fontSize:9},children:o.entity})]}),h.jsx("button",{type:"button",disabled:_,onClick:j,style:{all:"unset",cursor:_?"wait":"pointer",marginTop:6,padding:"2px 8px",fontSize:10,color:"var(--warn)",border:"1px solid var(--warn)",borderRadius:3,opacity:_?.5:1},children:"Unlink project"})]}),h.jsx("div",{style:{padding:"6px 10px",borderBottom:"1px solid var(--line-2)"},children:h.jsx("input",{type:"text",autoFocus:!0,placeholder:"search projects…",value:d,onChange:z=>m(z.target.value),style:{width:"100%",background:"var(--bg-1)",border:"1px solid var(--line)",borderRadius:3,padding:"3px 6px",color:"var(--text-1)",fontFamily:"inherit",fontSize:11,outline:"none"}})}),b&&h.jsx("div",{style:{padding:"6px 10px",color:"var(--error)",fontSize:10},children:b}),f===null&&!b&&h.jsx("div",{style:{padding:"8px 10px",color:"var(--text-3)"},children:"loading…"}),f!==null&&f.length===0&&h.jsxs("div",{style:{padding:"8px 10px",color:"var(--text-3)",fontSize:10},children:["no projects configured.",h.jsx("br",{}),"tell your agent to ",h.jsx("code",{children:"project_create"})," one, or add to ",h.jsx("code",{children:"~/.somora/projects/"}),"."]}),C.map(([z,J])=>h.jsxs("div",{children:[h.jsx("div",{style:{padding:"4px 10px",fontSize:9,color:"var(--text-3)",background:"var(--bg-2)",borderTop:"1px solid var(--line-2)",textTransform:"uppercase",letterSpacing:"0.08em"},children:z}),J.map(ie=>h.jsxs("button",{type:"button",disabled:_,onClick:()=>k(ie.slug),style:{all:"unset",display:"flex",alignItems:"center",gap:6,width:"100%",boxSizing:"border-box",padding:"6px 10px",cursor:_?"wait":"pointer",opacity:_?.5:1,borderBottom:"1px solid var(--line-2)"},onMouseEnter:D=>D.currentTarget.style.background="var(--bg-3)",onMouseLeave:D=>D.currentTarget.style.background="transparent",children:[h.jsx("span",{style:{width:8,height:8,borderRadius:2,background:ie.color??"var(--text-2)",flexShrink:0}}),h.jsx("span",{style:{color:"var(--text-1)",flex:1},children:ie.name}),h.jsxs("span",{style:{color:"var(--text-3)",fontSize:9},children:[ie.paths.length," ",ie.paths.length===1?"path":"paths"]})]},ie.slug))]},z)),f!==null&&f.length>0&&C.length===0&&h.jsxs("div",{style:{padding:"6px 10px",color:"var(--text-3)",fontSize:10},children:['no projects match "',d,'"']})]});return dc.createPortal(O,document.body)}const bg={human:iS,agent:Zx,sentinel:um,tmux:eS,browser:Oh,subagent:Hx,a2a:Wx,job:$x,voice:ko};function I4(e){return e?{waiting:e.queued.length,running:e.active!==null||e.busy,arriving:e.pendingWakes.length,subagents:e.children.filter(t=>t.kind==="subagent").length,asks:e.children.filter(t=>t.kind!=="subagent").length}:{waiting:0,running:!1,arriving:0,subagents:0,asks:0}}function P4({work:e,open:t,onToggle:n,color:r}){const a=x.useRef(null),o=Xz(I4(e));return o?h.jsxs("button",{ref:a,type:"button",className:"work-badge",title:"What this session is doing and what waits behind it","aria-haspopup":"dialog","aria-expanded":t,onClick:()=>{var c;return n(((c=a.current)==null?void 0:c.getBoundingClientRect())??null)},style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4,fontSize:9,fontFamily:'"JetBrains Mono", monospace',letterSpacing:"0.05em",textTransform:"uppercase",padding:"1px 6px",borderRadius:3,color:t?r:"var(--text-2)",background:t?`${r}25`:"var(--bg-2)",border:t?`1px solid ${r}55`:"1px solid var(--line-2)",whiteSpace:"nowrap"},children:[h.jsx(fm,{size:9}),h.jsx("span",{children:o})]}):null}function U4({open:e,onClose:t,anchorRect:n,work:r,onStop:a,onRemove:o,onStopChild:c,onOpenSession:f}){const p=x.useRef(null),[d,m]=x.useState(null),[_,y]=x.useState(null);x.useEffect(()=>{e||(m(null),y(null))},[e]),x.useEffect(()=>{if(!d)return;const z=setTimeout(()=>m(null),4e3);return()=>clearTimeout(z)},[d]),x.useEffect(()=>{if(!e)return;function z(D){if(p.current&&!p.current.contains(D.target)){if(n){const{clientX:A,clientY:M}=D;if(A>=n.left&&A<=n.right&&M>=n.top&&M<=n.bottom)return}t()}}function J(D){D.key==="Escape"&&t()}const ie=setTimeout(()=>{document.addEventListener("mousedown",z),document.addEventListener("keydown",J)},0);return()=>{clearTimeout(ie),document.removeEventListener("mousedown",z),document.removeEventListener("keydown",J)}},[e,t,n]);const b=x.useMemo(()=>r?{running:r.active,busyWithoutItem:r.busy&&!r.active,waiting:r.queued,arriving:r.pendingWakes,children:r.children}:null,[r]);if(!e||!n)return null;const w=340,S=Math.round(n.bottom+6),C=Math.round(Math.min(n.left,Math.max(8,window.innerWidth-w-8))),k=(r==null?void 0:r.asOf)??Date.now();async function j(z){if(z.id){y(z.id);try{const J=await o(z);m(J)}finally{y(null)}}}async function R(z){if(!(!z.id||!c)){y(z.id);try{m(await c(z))}finally{y(null)}}}function L(z,J){f==null||f(z,J),t()}const q=!b||!b.running&&!b.busyWithoutItem&&b.waiting.length===0&&b.arriving.length===0&&b.children.length===0,O=h.jsxs("div",{ref:p,role:"dialog","aria-label":"Session work queue",className:"work-queue-popover",style:{position:"fixed",top:S,left:C,zIndex:1e3,width:w,maxHeight:"min(70vh, 520px)",overflowY:"auto",background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",fontFamily:'"JetBrains Mono", monospace',fontSize:11,color:"var(--text-1)"},children:[d&&h.jsx("div",{role:"status",style:{padding:"6px 10px",fontSize:10,color:"var(--warn)",borderBottom:"1px solid var(--line-2)",background:"rgba(210, 153, 34, 0.08)"},children:d}),q&&h.jsx("div",{style:{padding:"10px",color:"var(--text-3)",fontSize:10},children:"nothing waiting, nothing running"}),(b==null?void 0:b.running)&&h.jsx(Al,{title:"RUNNING",children:h.jsx(c1,{item:b.running,meta:`since ${t1(k-(b.running.startedAt??b.running.enqueuedAt))}`,trailing:h.jsx(u1,{onClick:a})})}),(b==null?void 0:b.busyWithoutItem)&&h.jsx(Al,{title:"RUNNING",children:h.jsxs("div",{style:ih,children:[h.jsx("span",{style:{...xg,color:"var(--text-2)"},children:"a turn"}),h.jsx("span",{style:rh,children:"started before the queue view existed"}),h.jsx(u1,{onClick:a})]})}),b&&b.waiting.length>0&&h.jsxs(h.Fragment,{children:[b.running&&h.jsx(Rp,{}),h.jsx(Al,{title:"WAITING",children:b.waiting.map((z,J)=>h.jsx(c1,{item:z,position:z.position??J+1,requester:Yz(z.requester),meta:`waited ${t1(k-z.enqueuedAt)}`,trailing:z.id?h.jsx("button",{type:"button",onClick:()=>void j(z),disabled:_===z.id,title:z.kind==="human"?"Take this message back into the composer":"Remove from the queue — the requester sees it as failed","aria-label":"Remove from the queue",style:{...sh,opacity:_===z.id?.4:1},children:h.jsx(gh,{size:12})}):null},z.id??`w-${J}`))})]}),b&&b.arriving.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(Rp,{}),h.jsx(Al,{title:"ARRIVING",children:b.arriving.map((z,J)=>{const ie=vg("wake",z.about),D=bg[ie.icon];return h.jsxs("div",{style:ih,children:[h.jsx(D,{size:12,style:{color:"var(--text-2)",flexShrink:0}}),h.jsx("span",{style:{...rh,color:"var(--text-1)"},children:Vz(z.about,z.target)}),z.state==="failed"&&h.jsx("span",{style:{color:"var(--danger)",fontSize:10},children:"failed"})]},z.id??`a-${J}`)})})]}),b&&b.children.length>0&&h.jsxs(h.Fragment,{children:[h.jsx(Rp,{}),h.jsx(Al,{title:"FROM HERE",children:b.children.map((z,J)=>{const ie=vg(z.kind,z.about),D=bg[ie.icon],A=z.target,M=!!(f&&A);return h.jsxs("div",{role:M?"button":void 0,tabIndex:M?0:void 0,title:M?`Open ${A.agent} · ${A.session}`:void 0,onClick:M?()=>L(A.agent,A.session):void 0,onKeyDown:M?P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),L(A.agent,A.session))}:void 0,style:{...ih,cursor:M?"pointer":"default"},onMouseEnter:P=>{M&&(P.currentTarget.style.background="var(--bg-3)")},onMouseLeave:P=>{P.currentTarget.style.background="transparent"},children:[h.jsx(D,{size:12,style:{color:"var(--text-2)",flexShrink:0}}),h.jsx("span",{style:xg,children:ie.label}),h.jsx("span",{style:rh,children:A?`${A.agent} · ${A.session}`:z.preview}),h.jsx("span",{style:{color:z.state==="running"?"var(--accent)":"var(--text-3)",fontSize:10,flexShrink:0},children:z.state}),z.id&&z.state==="queued"&&h.jsx("button",{type:"button",onClick:P=>{P.stopPropagation(),j(z)},disabled:_===z.id,title:"Remove it before it starts — this session is told it will not run","aria-label":"Remove from the target's queue",style:{...sh,opacity:_===z.id?.4:1},children:h.jsx(gh,{size:12})}),z.id&&z.state==="running"&&c&&h.jsx("button",{type:"button",onClick:P=>{P.stopPropagation(),R(z)},disabled:_===z.id,title:z.kind==="subagent"?"Stop this sub-agent and everything it started":"Stop the turn this question is running as","aria-label":"Stop",style:{...sh,color:"var(--danger)",opacity:_===z.id?.4:1},children:h.jsx(Eo,{size:11,fill:"currentColor"})})]},z.id??`c-${J}`)})})]})]});return dc.createPortal(O,document.body)}function c1({item:e,position:t,requester:n,meta:r,trailing:a}){const o=vg(e.kind,e.about),c=bg[o.icon];return h.jsxs("div",{style:ih,title:e.preview||void 0,children:[t!==void 0&&h.jsx("span",{style:{color:"var(--text-3)",fontSize:10,width:14,textAlign:"right",flexShrink:0},children:t}),h.jsx(c,{size:12,style:{color:"var(--text-2)",flexShrink:0}}),h.jsx("span",{style:xg,children:o.label}),h.jsx("span",{style:rh,children:e.preview||h.jsx("span",{style:{color:"var(--text-3)"},children:"(no text)"})}),n&&h.jsx("span",{style:{color:"var(--text-3)",fontSize:10,flexShrink:0},children:n}),h.jsx("span",{style:{color:"var(--text-3)",fontSize:10,flexShrink:0},children:r}),a]})}function u1({onClick:e}){return h.jsx("button",{type:"button",onClick:e,title:"Stop the running turn","aria-label":"Stop the running turn",style:{...sh,color:"var(--danger)"},children:h.jsx(Eo,{size:11,fill:"currentColor"})})}function Al({title:e,children:t}){return h.jsxs("div",{style:{padding:"8px 10px"},children:[h.jsx("div",{style:{fontSize:9,letterSpacing:1.4,color:"var(--text-3)",marginBottom:4,fontWeight:700},children:e}),t]})}function Rp(){return h.jsx("div",{style:{borderTop:"1px solid var(--line-2)"}})}const ih={display:"flex",alignItems:"center",gap:6,padding:"4px 4px",borderRadius:3,minWidth:0,transition:"background 0.12s"},xg={color:"var(--text-0)",fontSize:10,flexShrink:0},rh={flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-2)",fontSize:10},sh={all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:3,color:"var(--text-2)",flexShrink:0},H4=2e3;function $4(e,t,n){const{subscribeTurnEvents:r}=So(),[a,o]=x.useState(null),c=x.useRef(!1),f=x.useRef(!1),p=x.useRef(!0),d=x.useCallback(()=>{if(c.current){f.current=!0;return}c.current=!0,Me.builderSession(e,t).then(m=>{p.current&&o(m)}).catch(()=>{}).finally(()=>{c.current=!1,f.current&&(f.current=!1,d())})},[e,t,n]);return x.useEffect(()=>(p.current=!0,o(null),d(),()=>{p.current=!1}),[d]),x.useEffect(()=>r(e,t,()=>d()),[r,e,t,d]),x.useEffect(()=>{const m=setInterval(d,H4);return()=>clearInterval(m)},[n,d]),{data:a,refresh:d}}const F4=640;function q4({agent:e,session:t,hostRef:n,onCollapsedChange:r}){const{data:a,refresh:o}=$4(e,t,!0),[c,f]=x.useState(null),[p,d]=x.useState(null),m=(a==null?void 0:a.state)??null,_=`somora.web.builderPanel.collapsed.${e}`,[y,b]=x.useState(()=>{try{return window.localStorage.getItem(_)==="1"}catch{return!1}}),[w,S]=x.useState(!1);x.useEffect(()=>{const L=n.current;if(!L||typeof ResizeObserver>"u")return;let q;try{q=new ResizeObserver(()=>{const O=L.getBoundingClientRect().width;S(O<F4)}),q.observe(L)}catch{}return()=>q==null?void 0:q.disconnect()},[n]);const C=y||w;x.useEffect(()=>{r(C)},[C,r]);const k=()=>{b(L=>{const q=!L;try{window.localStorage.setItem(_,q?"1":"0")}catch{}return q})},j=async L=>{f("patch");try{await Me.patchBuilder(e,t,L),o()}catch(q){d(q.message)}finally{f(null)}},R=async()=>{f("go");try{await Me.builderGo(e,t),o()}catch(L){d(L.message)}finally{f(null)}};if(x.useEffect(()=>{if(!p)return;const L=setTimeout(()=>d(null),6e3);return()=>clearTimeout(L)},[p]),C){const L=(m==null?void 0:m.todos.filter(q=>q.status!=="completed"&&q.status!=="cancelled").length)??0;return h.jsxs("aside",{className:"builder-panel is-collapsed","aria-label":"Builder panel (collapsed)",children:[h.jsx("button",{type:"button",className:"builder-panel-toggle",title:w&&!y?"Window too narrow for the panel — widen it":`Show the builder panel${L?` (${L} open task${L===1?"":"s"})`:""}`,onClick:k,children:h.jsx(I2,{size:14})}),(a==null?void 0:a.question)&&h.jsx(ec,{size:12,style:{color:"var(--accent, #d9a400)",marginTop:6}})]})}return h.jsxs("aside",{className:"builder-panel","aria-label":"Builder panel",children:[h.jsxs("div",{className:"builder-panel-head",children:[h.jsxs("div",{className:"builder-panel-topline",children:[h.jsxs("div",{className:"builder-panel-title",children:[h.jsx(ec,{size:12})," Builder"]}),h.jsx("button",{type:"button",className:"builder-panel-toggle",title:"Hide the builder panel",onClick:k,children:h.jsx(wo,{size:14})})]}),(a==null?void 0:a.turn)&&h.jsx(K4,{turn:a.turn}),m?h.jsxs("div",{className:"builder-panel-switches",children:[h.jsx("button",{type:"button",className:`builder-switch${m.mode==="attended"?" is-on":""}`,title:m.mode==="attended"?"Attended: the builder may ask you questions here. Click for unattended.":"Unattended: the builder decides on its own and notes decisions in the report. Click for attended.",disabled:c!==null,onClick:()=>j({mode:m.mode==="attended"?"unattended":"attended"}),children:m.mode}),h.jsx("button",{type:"button",className:`builder-switch${m.phase==="plan"?" is-plan":" is-build"}`,title:m.phase==="plan"?"Plan phase: read-only, writes only the plan file. Press Go to start building.":"Build phase: edits, runs, tests. Click to go back to planning.",disabled:c!==null,onClick:()=>j({phase:m.phase==="plan"?"build":"plan"}),children:m.phase}),m.phase==="plan"&&h.jsxs("button",{type:"button",className:"builder-go",title:"Approve the plan and start building (sends the Go into the session)",disabled:c!==null,onClick:R,children:[h.jsx(zh,{size:11,fill:"currentColor"})," Go"]})]}):h.jsx("div",{className:"builder-panel-muted",children:"No builder state yet — it appears with the first message."}),(m==null?void 0:m.planPath)&&h.jsxs("div",{className:"builder-panel-muted",title:m.planPath,children:["plan: ",h.jsx("code",{children:m.planPath.split("/").slice(-2).join("/")})]})]}),(a==null?void 0:a.question)&&h.jsx(W4,{agent:e,session:t,q:a.question,onDone:o}),h.jsxs("div",{className:"builder-todos",children:[h.jsxs("div",{className:"builder-section-title",children:["Tasks",m&&m.todos.length>0?` · ${m.todos.filter(L=>L.status==="completed").length}/${m.todos.length}`:""]}),!m||m.todos.length===0?h.jsx("div",{className:"builder-panel-muted",children:"The builder writes its task list here (todo_write)."}):h.jsx("ul",{className:"builder-todo-list",children:m.todos.map((L,q)=>h.jsxs("li",{className:`builder-todo is-${L.status}`,children:[L.status==="completed"?h.jsx(uc,{size:12}):L.status==="in_progress"?h.jsx(U2,{size:12}):h.jsx(H2,{size:12}),h.jsx("span",{children:L.content})]},`${q}-${L.content}`))})]}),p&&h.jsx("div",{className:"builder-panel-notice",children:p})]})}function W4({agent:e,session:t,q:n,onDone:r}){const[a,o]=x.useState([]),[c,f]=x.useState(""),[p,d]=x.useState(!1),[m,_]=x.useState(null),y=S=>{o(C=>n.multiple?C.includes(S)?C.filter(k=>k!==S):[...C,S]:[S])},b=async()=>{if(!(a.length===0&&!c.trim())){d(!0),_(null);try{await Me.answerQuestion(e,t,n.questionId,a,c.trim()||void 0),r()}catch(S){_(S.message)}finally{d(!1)}}},w=Math.max(0,Math.round((n.expiresAt-Date.now())/6e4));return h.jsxs("div",{className:"builder-question",children:[h.jsx("div",{className:"builder-section-title",children:n.header??"Question"}),h.jsx("div",{className:"builder-question-text",children:n.question}),h.jsx("div",{className:"builder-question-options",children:n.options.map(S=>h.jsxs("button",{type:"button",className:`builder-option${a.includes(S.label)?" is-chosen":""}`,title:S.description??"",disabled:p,onClick:()=>y(S.label),children:[S.label,S.description&&h.jsx("small",{children:S.description})]},S.label))}),h.jsx("textarea",{className:"builder-question-free",placeholder:"or answer in your own words…",rows:2,value:c,disabled:p,onChange:S=>f(S.target.value)}),h.jsxs("div",{className:"builder-question-foot",children:[h.jsxs("span",{className:"builder-panel-muted",children:[w," min left"]}),h.jsx("button",{type:"button",className:"builder-go",disabled:p||a.length===0&&!c.trim(),onClick:b,children:"Answer"})]}),m&&h.jsx("div",{className:"builder-panel-notice",children:m})]})}function h1(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return n>0?`${n}:${String(r).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${r}:${String(a).padStart(2,"0")}`}function K4({turn:e}){const[t,n]=x.useState(()=>Date.now());x.useEffect(()=>{const a=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(a)},[]);const r=e.lastToolAt?t-e.lastToolAt:0;return h.jsxs("div",{className:"builder-panel-progress",title:`Turn ${e.turnId}`,children:[h.jsx("span",{className:"builder-panel-progress-dot"}),"running for ",h1(t-e.startedAt)," · ",e.toolCalls," tool call",e.toolCalls===1?"":"s",e.lastTool&&h.jsxs(h.Fragment,{children:[" · ",h.jsx("code",{children:e.lastTool}),r>6e4&&h.jsxs("span",{className:"builder-panel-progress-idle",children:[" ",h1(r)," ago"]})]})]})}const G4=3e3;function Y4(e,t,n){const{subscribeTurnEvents:r}=So(),[a,o]=x.useState(null),c=x.useRef(!1),f=x.useRef(!1),p=x.useRef(!0),d=x.useCallback(()=>{if(c.current){f.current=!0;return}c.current=!0,Me.sessionWork(e,t).then(m=>{p.current&&o(m)}).catch(()=>{}).finally(()=>{c.current=!1,f.current&&(f.current=!1,d())})},[e,t]);return x.useEffect(()=>(p.current=!0,o(null),d(),()=>{p.current=!1}),[d]),x.useEffect(()=>r(e,t,()=>d()),[r,e,t,d]),x.useEffect(()=>{if(!n)return;const m=setInterval(d,G4);return()=>clearInterval(m)},[n,d]),{work:a,refresh:d}}function Rl(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function V4({agent:e,sessionId:t,windowFocused:n,onSwitchSession:r,pinnedMsgIds:a,onPin:o,onUnpin:c,onOpenBrowser:f,onOpenSession:p}){var Hs,Rr,$s,fr,ns;const d=Nh(),m=d.browsers.filter(ne=>{var Ee;return((Ee=ne.handoff)==null?void 0:Ee.agent)===e.name&&ne.handoff.session===t}),_=tc(e),{model:y,thinking:b,refresh:w}=aM(e.name,t),S=C2(e.name,t),{subscribeTurnEvents:C}=So();x.useEffect(()=>C(e.name,t,ne=>{(ne==="session_model"||ne==="turn_started"||ne==="turn_end")&&w()}),[C,e.name,t,w]);const k=fS(),{agents:j}=lS(),R=x.useMemo(()=>{const ne=new Map;for(const Ee of j)ne.set(Ee.name,{color:tc(Ee),...Ee.icon?{icon:Ee.icon}:{}});return ne},[j]),L=`somora.web.showTools.${e.name}::${t}`,[q,O]=x.useState(()=>{try{return window.localStorage.getItem(L)==="1"}catch{return!1}});x.useEffect(()=>{try{window.localStorage.setItem(L,q?"1":"0")}catch{}},[q,L]);const z=`somora.web.showMemory.${e.name}::${t}`,[J,ie]=x.useState(()=>{try{return window.localStorage.getItem(z)==="1"}catch{return!1}});x.useEffect(()=>{try{window.localStorage.setItem(z,J?"1":"0")}catch{}},[J,z]);const D=`somora.web.showThinking.${e.name}::${t}`,[A,M]=x.useState(()=>{try{return window.localStorage.getItem(D)!=="0"}catch{return!0}});x.useEffect(()=>{try{window.localStorage.setItem(D,A?"1":"0")}catch{}},[A,D]);const P=`somora.voice.autoPlay.${e.name}::${t}`,[G,H]=x.useState(!1),[N,$]=x.useState(!0),[K,re]=x.useState(!1),[U,W]=x.useState(e.steering===!0),I=x.useRef(null),[E,F]=x.useState(!1);x.useEffect(()=>{let ne=!1;return fetch("/tts/config").then(Ee=>Ee.ok?Ee.json():{enabled:!1}).then(Ee=>{var Qe;if(ne)return;const qe=!!Ee.enabled;if(H(qe),!qe)return;const Je=((Qe=Ee.clients)==null?void 0:Qe.web)??{};$(Je.allowUserOverride!==!1);try{const un=window.localStorage.getItem(P);re(un==="1"||un==="0"?un==="1":!!Je.autoPlayVoiceReplies)}catch{re(!!Je.autoPlayVoiceReplies)}}).catch(()=>{ne||H(!1)}),()=>{ne=!0}},[P]),x.useEffect(()=>{if(G)try{window.localStorage.setItem(P,K?"1":"0")}catch{}},[K,P,G]);const Y=x.useRef(!1),[Z,ve]=x.useState(""),Oe=Z.trimStart().startsWith("/"),[_e,Fe]=x.useState(null),st=x.useRef(0),[ae,pe]=x.useState(null),[Xe,nt]=x.useState([]),[Pe,at]=x.useState(!1),V=x.useRef(null),{zoom:ce,zoomIn:X,zoomOut:fe,resetZoom:Le,canZoomIn:Ge,canZoomOut:Te}=uM(e.name),gt=Math.round(ce*100),le=x.useRef(null),be=x.useRef(null),Se=x.useRef(!0),Q=x.useRef(!1),ge=x.useRef(null),Ae=x.useRef(null),[Ne,Be]=x.useState(!1),[Ue,We]=x.useState(null),[$e,ft]=x.useState(!1),[Bt,Xn]=x.useState(null),{work:Mn,refresh:Zn}=Y4(e.name,t,$e);x.useLayoutEffect(()=>{const ne=ge.current;if(!ne)return;ne.style.height="0px";const Ee=ne.scrollHeight;Ee<=120?(ne.style.height=Ee+"px",ne.style.overflowY="hidden"):(ne.style.height="120px",ne.style.overflowY="auto")},[Z]);const ii=x.useCallback(()=>{const ne=le.current;if(!ne)return;if(ne.scrollHeight-ne.scrollTop-ne.clientHeight<120&&(Se.current=!0),ne.scrollTop<60&&S.hasMore){const qe=ne.scrollHeight,Je=ne.scrollTop;S.loadOlder().then(()=>{requestAnimationFrame(()=>{const Qe=le.current;if(!Qe)return;const un=Qe.scrollHeight-qe;un>0&&(Qe.scrollTop=Je+un)})})}},[S]),yn=x.useCallback(()=>{const ne=le.current;if(!ne)return;ne.scrollHeight-ne.scrollTop-ne.clientHeight>120&&(Se.current=!1)},[]);x.useLayoutEffect(()=>{if(!Se.current||Q.current)return;const ne=be.current;if(ne)ne.scrollIntoView({block:"end"});else{const Je=le.current;Je&&(Je.scrollTop=Je.scrollHeight)}let Ee=0;const qe=requestAnimationFrame(()=>{if(Q.current)return;const Je=be.current;Je&&Je.scrollIntoView({block:"end"}),Ee=requestAnimationFrame(()=>{if(Q.current)return;const Qe=be.current;Qe&&Qe.scrollIntoView({block:"end"})})});return()=>{cancelAnimationFrame(qe),Ee&&cancelAnimationFrame(Ee)}},[S.messages,S.streaming,S.thinking,ce]),x.useEffect(()=>{const ne=le.current;if(!ne)return;let Ee;const qe=Qe=>{const un=Qe.target;un&&un.closest("pre, table")&&(Q.current=!0,Ee&&clearTimeout(Ee))},Je=()=>{Q.current&&(Ee&&clearTimeout(Ee),Ee=setTimeout(()=>{Q.current=!1},300))};return ne.addEventListener("pointerdown",qe,!0),window.addEventListener("pointerup",Je,!0),window.addEventListener("pointercancel",Je,!0),()=>{ne.removeEventListener("pointerdown",qe,!0),window.removeEventListener("pointerup",Je,!0),window.removeEventListener("pointercancel",Je,!0),Ee&&clearTimeout(Ee)}},[]),x.useEffect(()=>{var Ee,qe;if(!n)return;const ne=(Ee=window.getSelection)==null?void 0:Ee.call(window);ne&&ne.toString().length>0||(qe=ge.current)==null||qe.focus()},[n]);const ee=k==null?void 0:k.postSeen;x.useEffect(()=>{n&&(ee==null||ee(e.name,t))},[n,e.name,t,ee]),x.useEffect(()=>{ee==null||ee(e.name,t)},[e.name,t]),x.useEffect(()=>{var ne;S.streaming||n&&((ne=ge.current)==null||ne.focus())},[S.streaming,n]);const xe=x.useCallback(ne=>{ne instanceof HTMLElement&&(ne.closest("button")||ne.closest("a")||ne.closest("input")||ne.closest("textarea")||ne.closest("pre"))||setTimeout(()=>{var qe,Je;const Ee=(qe=window.getSelection)==null?void 0:qe.call(window);Ee&&Ee.toString().length>0||(Je=ge.current)==null||Je.focus()},0)},[]),He=x.useMemo(()=>S.messages.filter(ne=>{const Ee=ne.role==="engine_meta"&&ne.meta.engine==="voice";return!(!q&&!Ee&&(ne.role==="tool_call"||ne.role==="tool_result"||ne.role==="engine_meta")||!J&&ne.role==="memory_inject")}),[S.messages,q,J]),ut=x.useCallback(async ne=>{try{if(ne.kind==="model")await Me.setSessionModel(e.name,t,ne.ref),w(),pe({text:`model → ${ne.ref}`,tone:"info"});else if(ne.kind==="thinking")await Me.setSessionThinking(e.name,t,ne.level),w(),pe({text:`thinking → ${ne.level}`,tone:"info"});else if(ne.kind==="verbose")M(ne.value==="on"),pe({text:`verbose thinking → ${ne.value}`,tone:"info"});else if(ne.kind==="sampling"){await Me.setSessionSampling(e.name,t,ne.params),w();const Ee=await Me.sessionSampling(e.name,t).catch(()=>null),qe=Ee&&!Ee.engineSupportsSampling?" (dormant — engine ignores sampling)":"";pe({text:`sampling → ${Sh(Ee?Ee.effective:ne.params)}${qe}`,tone:"info"})}else if(ne.kind==="sampling-clear")await Me.clearSessionSampling(e.name,t),w(),pe({text:"sampling override cleared",tone:"info"});else if(ne.kind==="sampling-show"){const Ee=await Me.sessionSampling(e.name,t),qe=Ee.source==="session-override"?"session override":Ee.source==="persona-default"?"persona default":Ee.source==="model-default"?"model default":"engine default",Je=Ee.engineSupportsSampling?"":" · dormant: engine ignores sampling";pe({text:`sampling: ${Sh(Ee.effective)} · ${qe}${Je}`,tone:"info"})}else if(ne.kind==="session")r==null||r(ne.slug),pe({text:`switched to session "${ne.slug}"`,tone:"info"});else if(ne.kind==="new")await Me.createSession(e.name,ne.slug),r==null||r(ne.slug),pe({text:`created + switched to "${ne.slug}"`,tone:"info"});else if(ne.kind==="reset"){const Ee=await Me.resetSession(e.name,t);S.clearMessages(),pe({text:Ee.archivedId?`reset → archived as ${Ee.archivedId} · REM scheduled`:"reset → session was empty, nothing to archive",tone:"info"})}else ne.kind==="projekt"?(await Me.setSessionProject(e.name,t,ne.slug),S.refreshProject(),pe({text:`project pinned: ${ne.slug}`,tone:"info"})):ne.kind==="projekt-unlink"&&(await Me.clearSessionProject(e.name,t),S.refreshProject(),pe({text:"project unlinked",tone:"info"}))}catch(Ee){pe({text:`error: ${Ee.message}`,tone:"error"})}},[e.name,t,r,w,S]);x.useEffect(()=>{if(!ae)return;const ne=setTimeout(()=>pe(null),3500);return()=>clearTimeout(ne)},[ae]);const Ht=x.useRef(null);x.useEffect(()=>{const ne=S.lastFallback,Ee=Ht.current;Ht.current=ne,ne&&!Ee&&pe({text:`⇄ primary model ${ne.requested} unavailable — answering with ${ne.actual}`,tone:"info"})},[S.lastFallback]),x.useEffect(()=>{S.primaryRestored&&pe({text:`✓ primary model ${S.primaryRestored} is back`,tone:"info"})},[S.primaryRestored]);const Ot=x.useCallback(ne=>{const Ee=Array.from(ne);if(Ee.length===0)return;const qe=Ee.map(Je=>{const Qe=`up-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,un=Je.type.startsWith("image/")?URL.createObjectURL(Je):void 0;return{id:Qe,...un?{previewUrl:un}:{},state:"uploading",name:Je.name||"unnamed",size:Je.size,mimeHint:Je.type}});nt(Je=>[...Je,...qe]),Ee.forEach((Je,Qe)=>{const un=qe[Qe].id;Me.uploadAttachment(Je).then(rn=>{nt(ri=>ri.map(Re=>Re.id===un?{...Re,state:"ready",ref:rn}:Re))}).catch(rn=>{nt(ri=>ri.map(Re=>Re.id===un?{...Re,state:"error",error:rn.message}:Re))})})},[]),Ze=x.useCallback(ne=>{nt(Ee=>{const qe=Ee.find(Je=>Je.id===ne);return qe!=null&&qe.previewUrl&&URL.revokeObjectURL(qe.previewUrl),Ee.filter(Je=>Je.id!==ne)})},[]),Ye=x.useCallback(ne=>{const Ee=ne.clipboardData;if(!Ee)return;const qe=[];for(const Je of Array.from(Ee.items))if(Je.kind==="file"){const Qe=Je.getAsFile();Qe&&qe.push(Qe)}qe.length>0&&(ne.preventDefault(),Ot(qe))},[Ot]),ot=x.useCallback(ne=>{ne==null||ne.preventDefault();const Ee=Z.trim(),qe=Xe.filter(rn=>rn.state==="ready"&&rn.ref).map(rn=>rn.ref);if(Xe.some(rn=>rn.state==="uploading")){pe({text:"wait — attachment still uploading",tone:"info"});return}if(!Ee&&qe.length===0||Ee.startsWith("/"))return;const Qe=Y.current;Y.current=!1,ve(""),Xe.forEach(rn=>rn.previewUrl&&URL.revokeObjectURL(rn.previewUrl)),nt([]);const un=Qe&&G?{inputModality:"voice",autoPlayRequested:K}:void 0;S.send(Ee,qe.length>0?qe:void 0,un,S.streaming&&U).catch(rn=>{console.error("[somora-web] send failed",rn.message),pe({text:`send failed: ${rn.message}`,tone:"error"}),ve(ri=>ri||Ee)})},[Z,S,Xe,G,K,U]),Gt=x.useCallback((ne,Ee)=>{if(ve(qe=>qe.trim()?`${qe.replace(/\s+$/,"")}
|
|
582
|
+
${ne}`:ne),Ee.length>0){const qe=Je=>Je.startsWith("image/")?"image":Je==="application/pdf"?"pdf":"text";nt(Je=>[...Je,...Ee.map(Qe=>({id:`recall-${Qe.hash}-${Date.now()}`,state:"ready",name:Qe.name,size:Qe.size,mimeHint:Qe.mime,ref:{hash:Qe.hash,name:Qe.name,mime:Qe.mime,size:Qe.size,kind:qe(Qe.mime)}}))])}requestAnimationFrame(()=>{const qe=ge.current;qe&&(qe.focus(),qe.setSelectionRange(qe.value.length,qe.value.length))})},[]),Zt=x.useCallback(ne=>{(async()=>{try{const Ee=await S.recall(ne);if(!Ee){pe({text:"That message already started — use Stop to interrupt it",tone:"info"});return}Gt(Ee.text,Ee.attachments)}catch(Ee){pe({text:`Could not take the message back: ${Ee.message}`,tone:"error"})}})()},[S,Gt]),nr=x.useCallback(async ne=>{if(!ne.id)return"This entry has no id — an older server queued it";const Ee=ne.id;try{if(ne.kind==="human"){const Je=S.messages.find(Qe=>Qe.role==="user"&&Qe.turnId===Ee);if(Je){const Qe=await S.recall(Je.id);return Qe?(Gt(Qe.text,Qe.attachments),null):"That message already started — use Stop to interrupt it"}}const qe=await Me.dequeue(Ee);return qe.ok?(ne.kind==="human"&&qe.text&&Gt(qe.text,qe.attachments),null):qe.reason==="already_started"?"That entry already started — use Stop to interrupt it":"Nothing waits under that id any more"}catch(qe){return`Could not remove it: ${qe.message}`}finally{Zn()}},[S,Gt,Zn]),es=x.useCallback(async ne=>{if(!ne.id)return"This entry has no id — an older server queued it";try{if(ne.kind==="subagent"){const qe=await Me.cancelSpawn(ne.id);return qe.ok?null:qe.error??"could not stop the sub-agent"}return ne.target?(await Me.abort(ne.target.agent,ne.target.session)).aborted?null:"Nothing was running there any more":"This entry has no target session to stop"}catch(Ee){return Ee instanceof Error?Ee.message:String(Ee)}},[]),hr=x.useCallback(()=>{(async()=>{try{(await S.abort()).aborted||pe({text:"Nothing to stop — no active turn",tone:"info"})}catch(ne){pe({text:`Stop failed: ${ne.message}`,tone:"error"})}})()},[S]);x.useEffect(()=>G?S.subscribeAudio(Ee=>{if(K)try{new Audio(Ee).play()}catch{}}):void 0,[G,K,S]);const Ui=(y==null?void 0:y.alias)??(y==null?void 0:y.modelId)??"—",nn=(b==null?void 0:b.effective)&&b.effective!=="off",Dn=nn&&(b==null?void 0:b.modelSupportsReasoning),dr=nn&&!(b!=null&&b.modelSupportsReasoning),ts=e.kind==="builder";return h.jsxs("div",{ref:I,className:ts?`chat chat-with-panel${E?" panel-collapsed":""}`:"chat",onMouseDown:ne=>xe(ne.target),onDragEnter:ne=>{Array.from(ne.dataTransfer.types).includes("Files")&&(ne.preventDefault(),at(!0))},onDragOver:ne=>{Array.from(ne.dataTransfer.types).includes("Files")&&ne.preventDefault()},onDragLeave:ne=>{const Ee=ne.relatedTarget;(!Ee||!ne.currentTarget.contains(Ee))&&at(!1)},onDrop:ne=>{ne.preventDefault(),at(!1),ne.dataTransfer.files&&ne.dataTransfer.files.length>0&&Ot(ne.dataTransfer.files)},style:{position:"relative"},children:[Pe&&h.jsx("div",{style:{position:"absolute",inset:0,zIndex:50,background:`${_}22`,border:`2px dashed ${_}`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",fontFamily:'"JetBrains Mono", monospace',fontSize:14,color:_},children:"drop to attach"}),h.jsxs("div",{className:"chat-header",children:[h.jsx("div",{className:"chat-avatar agent-bg",style:{background:Qp(_)},children:h.jsx("span",{style:{fontSize:20,lineHeight:1,filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.3))"},children:e.icon??"🤖"})}),h.jsxs("div",{className:"chat-header-info",children:[h.jsxs("div",{className:"chat-header-name",style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx("span",{children:e.name}),e.role&&h.jsx("span",{style:{fontSize:9,fontFamily:'"JetBrains Mono", monospace',color:_,background:`${_}15`,border:`1px solid ${_}40`,padding:"1px 6px",borderRadius:3,letterSpacing:"0.05em",textTransform:"uppercase"},children:e.role}),S.streaming&&h.jsx("span",{style:{fontSize:9,fontFamily:'"JetBrains Mono", monospace',color:"var(--accent)",letterSpacing:"0.05em",textTransform:"uppercase"},children:"streaming…"}),h.jsx(P4,{work:Mn,open:$e,color:_,onToggle:ne=>{if($e){ft(!1);return}Xn(ne),ft(!0),Zn()}})]}),h.jsxs("div",{className:"chat-header-meta",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",fontFamily:'"JetBrains Mono", monospace',fontSize:10},children:[h.jsx("span",{children:gm(t)}),VT(t)&&h.jsx("span",{style:{color:"var(--text-3, var(--text-2))",opacity:.7},title:"session id",children:t}),h.jsx(oa,{}),h.jsx("span",{title:(y==null?void 0:y.modelId)??"no model resolved",style:{color:"var(--text-1)"},children:Ui}),S.lastFallback&&h.jsxs(h.Fragment,{children:[h.jsx(oa,{}),h.jsxs("span",{style:{color:"var(--warn)"},title:`Last turn was answered by the fallback model ${S.lastFallback.actual}: ${S.lastFallback.reason}`,children:["⇄ ",S.lastFallback.actual.slice(S.lastFallback.actual.indexOf("/")+1)]})]}),Dn&&h.jsxs(h.Fragment,{children:[h.jsx(oa,{}),h.jsxs("span",{style:{color:"var(--accent)"},title:b!=null&&b.wire?`thinking: ${b.effective} — this model receives '${b.wire}' (reasoning.levels in config)`:`thinking: ${b==null?void 0:b.effective}`,children:["🧠 ",b==null?void 0:b.effective,b!=null&&b.wire?h.jsxs("span",{style:{color:"var(--text-2)"},children:["→",b.wire]}):null]})]}),dr&&h.jsxs(h.Fragment,{children:[h.jsx(oa,{}),h.jsxs("span",{style:{color:"var(--text-2)"},title:"thinking level is set but the active model has no 'reasoning' capability — switch model, or run /thinking off",children:["thinking=",b==null?void 0:b.effective," ",h.jsx("span",{style:{color:"var(--warn)"},children:"(dormant)"})]})]}),h.jsx(oa,{}),h.jsxs("button",{type:"button",onClick:()=>O(ne=>!ne),title:q?"tool-call rendering on":"tool-call rendering off",style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:3,padding:"0 4px",borderRadius:3,background:q?`${_}25`:"transparent",border:q?`1px solid ${_}55`:"1px solid var(--line)",color:q?_:"var(--text-2)"},children:[h.jsx(sS,{size:10}),h.jsx("span",{children:"tools"})]}),h.jsxs("button",{type:"button",onClick:()=>ie(ne=>!ne),title:J?"memory-inject banner on":"memory-inject banner off",style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:3,padding:"0 4px",borderRadius:3,background:J?`${_}25`:"transparent",border:J?`1px solid ${_}55`:"1px solid var(--line)",color:J?_:"var(--text-2)"},children:[h.jsx(hm,{size:10}),h.jsx("span",{children:"memory"})]}),G&&N&&h.jsxs("button",{type:"button",onClick:()=>re(ne=>!ne),title:K?"voice auto-play on (mic input ⇒ spoken reply)":"voice auto-play off (mic input ⇒ text only)",style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:3,padding:"0 4px",borderRadius:3,background:K?`${_}25`:"transparent",border:K?`1px solid ${_}55`:"1px solid var(--line)",color:K?_:"var(--text-2)"},children:[K?h.jsx(rS,{size:10}):h.jsx(bT,{size:10}),h.jsx("span",{children:"voice"})]}),h.jsx(oa,{}),(Hs=S.usage)!=null&&Hs.context_tokens&&S.usage.contextWindow?h.jsx("span",{style:{color:S.usage.context_tokens/S.usage.contextWindow>.9?"var(--danger, #f85149)":S.usage.context_tokens/S.usage.contextWindow>.75?"var(--warn, #d29922)":"var(--text-2)"},title:S.usage.context_tokens>S.usage.contextWindow?`the last request carried ${S.usage.context_tokens.toLocaleString()} tokens — MORE than the ${S.usage.contextWindow.toLocaleString()} configured for this model. The number on the right is what the engine really sent, so the configured contextWindow is too small (see docs/models.md).`:`context filled: ${S.usage.context_tokens.toLocaleString()} of ${S.usage.contextWindow.toLocaleString()} tokens in the last request of this turn`,children:S.usage.context_tokens>S.usage.contextWindow?`▣ >100% (${Rl(S.usage.context_tokens)})`:`▣ ${Math.round(S.usage.context_tokens/S.usage.contextWindow*100)}%`}):null,h.jsxs("span",{style:{color:"var(--text-2)"},title:"prompt tokens spent this turn, summed over every request of the turn (cached part dimmed)",children:["Σ↑ ",Rl((Rr=S.usage)==null?void 0:Rr.tokens_in),($s=S.usage)!=null&&$s.tokens_in_cached?h.jsxs("span",{style:{color:"var(--text-3)"},children:[" ","(",Rl(S.usage.tokens_in_cached),"¢)"]}):null]}),h.jsxs("span",{style:{color:"var(--text-2)"},title:"completion tokens",children:["↓ ",Rl((fr=S.usage)==null?void 0:fr.tokens_out),(ns=S.usage)!=null&&ns.tokens_out_reasoning?h.jsxs("span",{style:{color:"var(--accent)"},children:[" ","(",S.usage.tokens_out_reasoning_estimated?"~":"",Rl(S.usage.tokens_out_reasoning),"🧠)"]}):null]}),h.jsx(oa,{}),h.jsxs("span",{style:{color:S.connected?"var(--ok)":"var(--text-3)"},title:S.connected?"SSE stream connected":"SSE stream disconnected",children:["● ",S.connected?"connected":"offline"]})]})]}),h.jsxs("div",{className:"chat-header-actions",children:[h.jsxs("div",{className:"chat-zoom",role:"group","aria-label":"Chat text size",children:[h.jsx("button",{type:"button",className:"chat-icon-btn",title:`Smaller chat text (${gt}%)`,"aria-label":"Smaller chat text",disabled:!Te,onClick:fe,children:h.jsx(ST,{size:14})}),ce!==1&&h.jsxs("button",{type:"button",className:"chat-zoom-level",title:"Reset chat text to 100%",onClick:Le,children:[gt,"%"]}),h.jsx("button",{type:"button",className:"chat-icon-btn",title:`Larger chat text (${gt}%)`,"aria-label":"Larger chat text",disabled:!Ge,onClick:X,children:h.jsx(aS,{size:14})})]}),S.projectsEnabled&&h.jsx(j4,{agent:e.name,session:t,project:S.project,onMutated:()=>void S.refreshProject()}),h.jsx("button",{ref:Ae,type:"button",className:"chat-icon-btn",title:"Session actions","aria-expanded":Ne,"aria-haspopup":"menu",onClick:()=>{var ne;if(Ne){Be(!1);return}We(((ne=Ae.current)==null?void 0:ne.getBoundingClientRect())??null),Be(!0)},children:h.jsx(q2,{size:14})})]})]}),f&&m.map(ne=>h.jsx(sM,{browser:ne,connected:d.connected,onOpen:f},ne.handoff.id)),h.jsx(T4,{open:Ne,onClose:()=>Be(!1),anchorRect:Ue,model:y,thinking:b,showThinking:A,onToggleShowThinking:()=>M(ne=>!ne),onSlash:ut}),h.jsx(U4,{open:$e,onClose:()=>ft(!1),anchorRect:Bt,work:Mn,onStop:hr,onRemove:nr,onStopChild:es,onOpenSession:p}),h.jsxs("div",{className:"chat-body",style:{zoom:ce},ref:le,onScroll:ii,onWheel:ne=>{ne.deltaY<0&&yn()},onTouchMove:yn,children:[S.hasMore&&!S.loading&&h.jsx("div",{style:{textAlign:"center",padding:"8px 0",fontFamily:'"JetBrains Mono", monospace',fontSize:10},children:h.jsx("button",{type:"button",onClick:()=>{const ne=le.current;if(!ne)return;const Ee=ne.scrollHeight,qe=ne.scrollTop;S.loadOlder().then(()=>{requestAnimationFrame(()=>{const Je=le.current;if(!Je)return;const Qe=Je.scrollHeight-Ee;Qe>0&&(Je.scrollTop=qe+Qe)})})},style:{all:"unset",cursor:"pointer",padding:"2px 8px",borderRadius:3,border:"1px solid var(--line-2)",color:"var(--text-2)"},children:"↑ load older"})}),S.loading?h.jsx("div",{style:{color:"var(--text-3)",textAlign:"center",padding:"24px 0",fontSize:11},children:"loading history…"}):He.length===0?h.jsx("div",{style:{color:"var(--text-3)",textAlign:"center",padding:"24px 0",fontSize:11},children:"no messages yet — say hi"}):He.map(ne=>{const Ee=(a==null?void 0:a.has(ne.id))??!1,qe=o?()=>{if(!(ne.role!=="assistant"||!ne.text)){if(Ee){c==null||c(ne.id);return}o({msgId:ne.id,text:ne.text,agentName:e.name,...e.icon?{agentIcon:e.icon}:{},..._?{agentColor:_}:{},sessionId:t,sessionLabel:t==="main"?"main":t,ts:ne.ts,pinnedAt:Date.now()})}}:void 0;return h.jsx(Jz,{msg:ne,agentColor:_,agentIcon:e.icon,peerAgents:R,isPinned:Ee,onAbort:hr,onRecall:Zt,showThinking:A,...qe?{onPinClick:qe}:{}},ne.id)}),S.thinking&&!S.streaming&&h.jsxs("div",{className:"chat-msg agent",children:[h.jsx("div",{className:"chat-msg-avatar",style:{background:Qp(_),fontSize:14},children:e.icon??"🤖"}),h.jsx("div",{children:h.jsx("div",{className:"chat-msg-bubble",style:{color:"var(--text-2)"},children:h.jsxs("span",{style:{animation:"somora-cursor-blink 1.2s infinite"},children:[e.name," denkt nach…"]})})})]}),h.jsx("div",{ref:be,"aria-hidden":"true"})]}),h.jsx(y4,{items:Xe,onRemove:Ze}),h.jsxs("form",{className:"chat-input",onSubmit:ot,style:{position:"relative"},children:[ae&&h.jsx("div",{style:{position:"absolute",bottom:"100%",left:8,right:8,marginBottom:4,padding:"4px 10px",borderRadius:4,background:ae.tone==="error"?"var(--danger)":"var(--bg-3)",color:ae.tone==="error"?"#fff":"var(--text-1)",fontFamily:'"JetBrains Mono", monospace',fontSize:11,border:`1px solid ${ae.tone==="error"?"var(--danger)":"var(--line-2)"}`,zIndex:9},children:ae.text}),Oe&&!S.streaming&&h.jsx(m4,{agent:e.name,draft:Z,keyEvent:_e,onAccept:({commit:ne,resolved:Ee})=>{var qe,Je;Ee?(ve(""),ut(Ee),(qe=ge.current)==null||qe.focus()):(ve(ne),(Je=ge.current)==null||Je.focus())},onDismiss:()=>ve("")}),h.jsx("input",{ref:V,type:"file",multiple:!0,style:{display:"none"},onChange:ne=>{ne.target.files&&Ot(ne.target.files),ne.target.value=""}}),h.jsx("button",{type:"button",className:"chat-icon-btn",title:"Attach files (or drag & drop / paste)",onClick:()=>{var ne;return(ne=V.current)==null?void 0:ne.click()},children:h.jsx(aT,{size:14})}),h.jsx(S4,{onCaptured:ne=>Ot([ne])}),h.jsx("textarea",{ref:ge,className:"chat-textarea",rows:1,placeholder:`Message ${e.name}… (try /)`,value:Z,onChange:ne=>ve(ne.target.value),onPaste:Ye,onKeyDown:ne=>{if(Oe&&(ne.key==="ArrowDown"||ne.key==="ArrowUp"||ne.key==="Escape"||ne.key==="Tab"||ne.key==="Enter"&&!ne.shiftKey)){ne.preventDefault(),st.current+=1,Fe({key:ne.key,nonce:st.current});return}ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),ot())},style:{overflowY:"hidden"}}),h.jsx(E4,{onTranscript:ne=>{var Ee;ve(qe=>qe.trim()?`${qe.replace(/\s+$/,"")} ${ne}`:ne),Y.current=!0,(Ee=ge.current)==null||Ee.focus()}}),S.streaming&&h.jsxs("button",{type:"button",className:"chat-send chat-send-steer",title:U?"Steering on: the next message goes into the running turn before its next step. Click to queue instead.":"Queue: the next message waits until this turn is done. Click to steer it into the running turn.","aria-label":U?"Steering on":"Steering off","aria-pressed":U,onClick:()=>W(ne=>!ne),children:[U?h.jsx(ec,{size:13}):h.jsx(fm,{size:13}),h.jsx("span",{children:U?"steer":"queue"})]}),S.streaming&&h.jsx("button",{type:"button",className:"chat-send chat-send-stop",title:"Stop generating","aria-label":"Stop generating",onClick:hr,children:h.jsx(Eo,{size:14,fill:"currentColor"})}),h.jsx("button",{type:"submit",className:"chat-send",title:"Send","aria-label":"Send",disabled:!Z.trim(),children:h.jsx(Zx,{size:14})})]}),ts&&h.jsx(q4,{agent:e.name,session:t,hostRef:I,onCollapsedChange:F})]})}function oa(){return h.jsx("span",{style:{color:"var(--line-2)"},children:"·"})}function X4({onAttach:e}){const[t,n]=x.useState(null),[r,a]=x.useState(null),o=x.useCallback(async()=>{try{const c=await Me.tmuxSessions();n(c),a(null)}catch(c){a(c.message)}},[]);return x.useEffect(()=>{o();const c=setInterval(()=>void o(),5e3);return()=>clearInterval(c)},[o]),h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:'"JetBrains Mono", monospace'},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:"1px solid var(--line)",fontSize:11,color:"var(--text-2)"},children:[h.jsx("span",{children:t===null?"loading…":t.length===0?"no tmux sessions":`${t.length} session${t.length===1?"":"s"}`}),h.jsx("button",{type:"button",onClick:()=>void o(),title:"refresh",style:{all:"unset",cursor:"pointer",color:"var(--text-3)",display:"inline-flex",alignItems:"center",gap:4},children:h.jsx(tr,{size:11})})]}),h.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6},children:[r&&h.jsx("div",{style:{color:"var(--danger)",fontSize:11,padding:8},children:r}),t===null&&!r?h.jsx("div",{style:{color:"var(--text-3)",textAlign:"center",padding:24,fontSize:11},children:"loading…"}):t&&t.length===0?h.jsxs("div",{style:{color:"var(--text-3)",textAlign:"center",padding:24,fontSize:11},children:[h.jsx("div",{children:"no tmux sessions running on this host"}),h.jsxs("div",{style:{marginTop:8,color:"var(--text-3)"},children:["ask an agent to create one — `tmux(","{","action:'create',name:'…'","}",")`"]})]}):(t??[]).map(c=>h.jsx(Z4,{session:c,onAttach:()=>e(c.name)},c.name))]})]})}function Z4({session:e,onAttach:t}){const n=J4(e.lastActivityEpoch);return h.jsxs("div",{onClick:t,title:`attach to ${e.name}`,style:{cursor:"pointer",padding:"8px 10px",borderRadius:4,marginBottom:4,background:"var(--bg-3)",border:"1px solid var(--line-2)",display:"flex",flexDirection:"column",gap:4},onMouseEnter:r=>{r.currentTarget.style.background="var(--bg-2)"},onMouseLeave:r=>{r.currentTarget.style.background="var(--bg-3)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx(tS,{size:12,style:{color:"var(--accent)"}}),h.jsx("span",{style:{color:"var(--text-1)",fontSize:12,fontWeight:600},children:e.name}),h.jsxs("span",{style:{color:"var(--text-3)",fontSize:10},children:["· ",e.windows," window",e.windows===1?"":"s"]}),e.activeCommand&&h.jsxs("span",{style:{color:"var(--text-2)",fontSize:10},children:[h.jsx(N2,{size:10,style:{display:"inline",marginRight:2}}),e.activeCommand]}),h.jsx("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontSize:10},children:n})]}),h.jsx("div",{style:{fontSize:10,color:"var(--text-3)"},children:e.origin?`↳ from ${e.origin.agent}${e.origin.session?" · "+e.origin.session:""}`:"↳ orphan (created outside somora)"})]})}function J4(e){if(!e)return"never attached";const t=Date.now()-e*1e3;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}/**
|
|
583
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
584
|
+
* @license MIT
|
|
585
|
+
*
|
|
586
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
587
|
+
* @license MIT
|
|
588
|
+
*
|
|
589
|
+
* Originally forked from (with the author's permission):
|
|
590
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
591
|
+
* http://bellard.org/jslinux/
|
|
592
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
593
|
+
*/var Zw=Object.defineProperty,Q4=Object.getOwnPropertyDescriptor,eB=(e,t)=>{for(var n in t)Zw(e,n,{get:t[n],enumerable:!0})},pn=(e,t,n,r)=>{for(var a=r>1?void 0:r?Q4(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(r?c(t,n,a):c(a))||a);return r&&a&&Zw(t,n,a),a},Ke=(e,t)=>(n,r)=>t(n,r,e),d1="Terminal input",Sg={get:()=>d1,set:e=>d1=e},f1="Too much output to announce, navigate to rows manually to read",wg={get:()=>f1,set:e=>f1=e};function tB(e){return e.replace(/\r?\n/g,"\r")}function nB(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function iB(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function rB(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");Jw(a,t,n,r)}}function Jw(e,t,n,r){e=tB(e),e=nB(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Qw(e,t,n){let r=n.getBoundingClientRect(),a=e.clientX-r.left-10,o=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function p1(e,t,n,r,a){Qw(e,t,n),a&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Ls(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Fh(e,t=0,n=e.length){let r="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,r+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r}var sB=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[r++]=(this._interim-55296)*1024+o-56320+65536:(t[r++]=this._interim,t[r++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,r;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[r++]=(c-55296)*1024+f-56320+65536:(t[r++]=c,t[r++]=f);continue}c!==65279&&(t[r++]=c)}return r}},aB=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,a,o,c,f,p=0,d=0;if(this.interim[0]){let y=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)b<<=6,b|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-w;for(;d<k;){if(d>=n)return 0;if(S=e[d++],(S&192)!==128){d--,y=!0;break}else this.interim[w++]=S,b<<=6,b|=S&63}y||(C===2?b<128?d--:t[r++]=b:C===3?b<2048||b>=55296&&b<=57343||b===65279||(t[r++]=b):b<65536||b>1114111||(t[r++]=b)),this.interim.fill(0)}let m=n-4,_=d;for(;_<n;){for(;_<m&&!((a=e[_])&128)&&!((o=e[_+1])&128)&&!((c=e[_+2])&128)&&!((f=e[_+3])&128);)t[r++]=a,t[r++]=o,t[r++]=c,t[r++]=f,_+=4;if(a=e[_++],a<128)t[r++]=a;else if((a&224)===192){if(_>=n)return this.interim[0]=a,r;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(a&31)<<6|o&63,p<128){_--;continue}t[r++]=p}else if((a&240)===224){if(_>=n)return this.interim[0]=a,r;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,r;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(a&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[r++]=p}else if((a&248)===240){if(_>=n)return this.interim[0]=a,r;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,r;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,r;if(f=e[_++],(f&192)!==128){_--;continue}if(p=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,p<65536||p>1114111)continue;t[r++]=p}}return r}},ek="",js=" ",vc=class tk{constructor(){this.fg=0,this.bg=0,this.extended=new wh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new tk;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},wh=class nk{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new nk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},er=class ik extends vc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wh,this.combinedData=""}static fromCharData(t){let n=new ik;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ls(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(r-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},g1="di$target",kg="di$dependencies",Np=new Map;function oB(e){return e[kg]||[]}function Pn(e){if(Np.has(e))return Np.get(e);let t=function(n,r,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");lB(t,n,a)};return t._id=e,Np.set(e,t),t}function lB(e,t,n){t[g1]===t?t[kg].push({id:e,index:n}):(t[kg]=[{id:e,index:n}],t[g1]=t)}var hi=Pn("BufferService"),rk=Pn("CoreMouseService"),Ea=Pn("CoreService"),cB=Pn("CharsetService"),$m=Pn("InstantiationService"),sk=Pn("LogService"),di=Pn("OptionsService"),ak=Pn("OscLinkService"),uB=Pn("UnicodeService"),yc=Pn("DecorationService"),Eg=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var m;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],a=this._optionsService.rawOptions.linkHandler,o=new er,c=n.getTrimmedLength(),f=-1,p=-1,d=!1;for(let _=0;_<c;_++)if(!(p===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=_,f=o.extended.urlId;continue}else d=o.extended.urlId!==f;else p!==-1&&(d=!0);if(d||p!==-1&&_===c-1){let y=(m=this._oscLinkService.getLinkData(f))==null?void 0:m.uri;if(y){let b={start:{x:p+1,y:e},end:{x:_+(!d&&_===c-1?1:0),y:e}},w=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let S=new URL(y);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||r.push({text:y,range:b,activate:(S,C)=>a?a.activate(S,C,b):hB(S,C),hover:(S,C)=>{var k;return(k=a==null?void 0:a.hover)==null?void 0:k.call(a,S,C,b)},leave:(S,C)=>{var k;return(k=a==null?void 0:a.leave)==null?void 0:k.call(a,S,C,b)}})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=_,f=o.extended.urlId):(p=-1,f=-1)}}t(r)}};Eg=pn([Ke(0,hi),Ke(1,di),Ke(2,ak)],Eg);function hB(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
594
|
+
|
|
595
|
+
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var qh=Pn("CharSizeService"),Jr=Pn("CoreBrowserService"),Fm=Pn("MouseService"),Qr=Pn("RenderService"),dB=Pn("SelectionService"),ok=Pn("CharacterJoinerService"),Mo=Pn("ThemeService"),lk=Pn("LinkProviderService"),fB=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?m1.isErrorNoTelemetry(e)?new m1(e.message+`
|
|
596
|
+
|
|
597
|
+
`+e.stack):new Error(e.message+`
|
|
598
|
+
|
|
599
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},pB=new fB;function ah(e){gB(e)||pB.onUnexpectedError(e)}var Cg="Canceled";function gB(e){return e instanceof mB?!0:e instanceof Error&&e.name===Cg&&e.message===Cg}var mB=class extends Error{constructor(){super(Cg),this.name=this.message}};function _B(e){return new Error(`Illegal argument: ${e}`)}var m1=class Tg extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Tg)return t;let n=new Tg;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Mg=class ck extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,ck.prototype)}};function Bi(e,t=0){return e[e.length-(1+t)]}var vB;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function r(o){return o>0}e.isGreaterThan=r;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vB||(vB={}));function yB(e,t){let n=this,r=!1,a;return function(){return r||(r=!0,t||(a=e.apply(n,arguments))),a}}var uk;(e=>{function t(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*a(L){yield L}e.single=a;function o(L){return t(L)?L:a(L)}e.wrap=o;function c(L){return L||n}e.from=c;function*f(L){for(let q=L.length-1;q>=0;q--)yield L[q]}e.reverse=f;function p(L){return!L||L[Symbol.iterator]().next().done===!0}e.isEmpty=p;function d(L){return L[Symbol.iterator]().next().value}e.first=d;function m(L,q){let O=0;for(let z of L)if(q(z,O++))return!0;return!1}e.some=m;function _(L,q){for(let O of L)if(q(O))return O}e.find=_;function*y(L,q){for(let O of L)q(O)&&(yield O)}e.filter=y;function*b(L,q){let O=0;for(let z of L)yield q(z,O++)}e.map=b;function*w(L,q){let O=0;for(let z of L)yield*q(z,O++)}e.flatMap=w;function*S(...L){for(let q of L)yield*q}e.concat=S;function C(L,q,O){let z=O;for(let J of L)z=q(z,J);return z}e.reduce=C;function*k(L,q,O=L.length){for(q<0&&(q+=L.length),O<0?O+=L.length:O>L.length&&(O=L.length);q<O;q++)yield L[q]}e.slice=k;function j(L,q=Number.POSITIVE_INFINITY){let O=[];if(q===0)return[O,L];let z=L[Symbol.iterator]();for(let J=0;J<q;J++){let ie=z.next();if(ie.done)return[O,e.empty()];O.push(ie.value)}return[O,{[Symbol.iterator](){return z}}]}e.consume=j;async function R(L){let q=[];for await(let O of L)q.push(O);return Promise.resolve(q)}e.asyncToArray=R})(uk||(uk={}));function ba(e){if(uk.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function bB(...e){return an(()=>ba(e))}function an(e){return{dispose:yB(()=>{e()})}}var hk=class dk{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ba(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?dk.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};hk.DISABLE_DISPOSED_WARNING=!1;var Ps=hk,St=class{constructor(){this._store=new Ps,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};St.None=Object.freeze({dispose(){}});var bo=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Vr=typeof window=="object"?window:globalThis,Ag=class Rg{constructor(t){this.element=t,this.next=Rg.Undefined,this.prev=Rg.Undefined}};Ag.Undefined=new Ag(void 0);var ln=Ag,_1=class{constructor(){this._first=ln.Undefined,this._last=ln.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ln.Undefined}clear(){let e=this._first;for(;e!==ln.Undefined;){let t=e.next;e.prev=ln.Undefined,e.next=ln.Undefined,e=t}this._first=ln.Undefined,this._last=ln.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ln(e);if(this._first===ln.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==ln.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ln.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ln.Undefined&&e.next!==ln.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ln.Undefined&&e.next===ln.Undefined?(this._first=ln.Undefined,this._last=ln.Undefined):e.next===ln.Undefined?(this._last=this._last.prev,this._last.next=ln.Undefined):e.prev===ln.Undefined&&(this._first=this._first.next,this._first.prev=ln.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ln.Undefined;)yield e.element,e=e.next}},xB=globalThis.performance&&typeof globalThis.performance.now=="function",SB=class fk{static create(t){return new fk(t)}constructor(t){this._now=xB&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Vn;(e=>{e.None=()=>St.None;function t(M,P){return _(M,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function n(M){return(P,G=null,H)=>{let N=!1,$;return $=M(K=>{if(!N)return $?$.dispose():N=!0,P.call(G,K)},null,H),N&&$.dispose(),$}}e.once=n;function r(M,P,G){return d((H,N=null,$)=>M(K=>H.call(N,P(K)),null,$),G)}e.map=r;function a(M,P,G){return d((H,N=null,$)=>M(K=>{P(K),H.call(N,K)},null,$),G)}e.forEach=a;function o(M,P,G){return d((H,N=null,$)=>M(K=>P(K)&&H.call(N,K),null,$),G)}e.filter=o;function c(M){return M}e.signal=c;function f(...M){return(P,G=null,H)=>{let N=bB(...M.map($=>$(K=>P.call(G,K))));return m(N,H)}}e.any=f;function p(M,P,G,H){let N=G;return r(M,$=>(N=P(N,$),N),H)}e.reduce=p;function d(M,P){let G,H={onWillAddFirstListener(){G=M(N.fire,N)},onDidRemoveLastListener(){G==null||G.dispose()}},N=new je(H);return P==null||P.add(N),N.event}function m(M,P){return P instanceof Array?P.push(M):P&&P.add(M),M}function _(M,P,G=100,H=!1,N=!1,$,K){let re,U,W,I=0,E,F={leakWarningThreshold:$,onWillAddFirstListener(){re=M(Z=>{I++,U=P(U,Z),H&&!W&&(Y.fire(U),U=void 0),E=()=>{let ve=U;U=void 0,W=void 0,(!H||I>1)&&Y.fire(ve),I=0},typeof G=="number"?(clearTimeout(W),W=setTimeout(E,G)):W===void 0&&(W=0,queueMicrotask(E))})},onWillRemoveListener(){N&&I>0&&(E==null||E())},onDidRemoveLastListener(){E=void 0,re.dispose()}},Y=new je(F);return K==null||K.add(Y),Y.event}e.debounce=_;function y(M,P=0,G){return e.debounce(M,(H,N)=>H?(H.push(N),H):[N],P,void 0,!0,void 0,G)}e.accumulate=y;function b(M,P=(H,N)=>H===N,G){let H=!0,N;return o(M,$=>{let K=H||!P($,N);return H=!1,N=$,K},G)}e.latch=b;function w(M,P,G){return[e.filter(M,P,G),e.filter(M,H=>!P(H),G)]}e.split=w;function S(M,P=!1,G=[],H){let N=G.slice(),$=M(U=>{N?N.push(U):re.fire(U)});H&&H.add($);let K=()=>{N==null||N.forEach(U=>re.fire(U)),N=null},re=new je({onWillAddFirstListener(){$||($=M(U=>re.fire(U)),H&&H.add($))},onDidAddFirstListener(){N&&(P?setTimeout(K):K())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return H&&H.add(re),re.event}e.buffer=S;function C(M,P){return(G,H,N)=>{let $=P(new j);return M(function(K){let re=$.evaluate(K);re!==k&&G.call(H,re)},void 0,N)}}e.chain=C;let k=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(G=>(P(G),G)),this}filter(P){return this.steps.push(G=>P(G)?G:k),this}reduce(P,G){let H=G;return this.steps.push(N=>(H=P(H,N),H)),this}latch(P=(G,H)=>G===H){let G=!0,H;return this.steps.push(N=>{let $=G||!P(N,H);return G=!1,H=N,$?N:k}),this}evaluate(P){for(let G of this.steps)if(P=G(P),P===k)break;return P}}function R(M,P,G=H=>H){let H=(...re)=>K.fire(G(...re)),N=()=>M.on(P,H),$=()=>M.removeListener(P,H),K=new je({onWillAddFirstListener:N,onDidRemoveLastListener:$});return K.event}e.fromNodeEventEmitter=R;function L(M,P,G=H=>H){let H=(...re)=>K.fire(G(...re)),N=()=>M.addEventListener(P,H),$=()=>M.removeEventListener(P,H),K=new je({onWillAddFirstListener:N,onDidRemoveLastListener:$});return K.event}e.fromDOMEventEmitter=L;function q(M){return new Promise(P=>n(M)(P))}e.toPromise=q;function O(M){let P=new je;return M.then(G=>{P.fire(G)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=O;function z(M,P){return M(G=>P.fire(G))}e.forward=z;function J(M,P,G){return P(G),M(H=>P(H))}e.runAndSubscribe=J;class ie{constructor(P,G){this._observable=P,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new je(H),G&&G.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,G){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(M,P){return new ie(M,P).emitter.event}e.fromObservable=D;function A(M){return(P,G,H)=>{let N=0,$=!1,K={beginUpdate(){N++},endUpdate(){N--,N===0&&(M.reportChanges(),$&&($=!1,P.call(G)))},handlePossibleChange(){},handleChange(){$=!0}};M.addObserver(K),M.reportChanges();let re={dispose(){M.removeObserver(K)}};return H instanceof Ps?H.add(re):Array.isArray(H)&&H.push(re),re}}e.fromObservableLight=A})(Vn||(Vn={}));var Ng=class Og{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Og._idPool++}`,Og.all.add(this)}start(t){this._stopWatch=new SB,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Ng.all=new Set,Ng._idPool=0;var wB=Ng,kB=-1,pk=class gk{constructor(t,n,r=(gk._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let p=new TB(f,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,a]of this._stacks)(!t||n<a)&&(t=[r,a],n=a);return t}};pk._idPool=1;var EB=pk,CB=class mk{constructor(t){this.value=t}static create(){let t=new Error;return new mk(t.stack??"")}print(){console.warn(this.value.split(`
|
|
600
|
+
`).slice(2).join(`
|
|
601
|
+
`))}},TB=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},MB=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},AB=0,Op=class{constructor(e){this.value=e,this.id=AB++}},RB=2,NB,je=class{constructor(e){var t,n,r,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new EB((e==null?void 0:e.onListenerError)??ah,((n=this._options)==null?void 0:n.leakWarningThreshold)??kB):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new wB(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var c,f,p,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let _=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(_);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new MB(`${_}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((c=this._options)==null?void 0:c.onListenerError)||ah)(b),St.None}if(this._disposed)return St.None;t&&(e=e.bind(t));let r=new Op(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=CB.create(),a=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Op?(this._deliveryQueue??(this._deliveryQueue=new OB),this._listeners=[this._listeners,r]):this._listeners.push(r):((p=(f=this._options)==null?void 0:f.onWillAddFirstListener)==null||p.call(f,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let o=an(()=>{a==null||a(),this._removeListener(r)});return n instanceof Ps?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(e){var a,o,c,f;if((o=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||o.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(f=(c=this._options)==null?void 0:c.onDidRemoveLastListener)==null||f.call(c,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*RB<=t.length){let p=0;for(let d=0;d<t.length;d++)t[d]?t[p++]=t[d]:r&&(this._deliveryQueue.end--,p<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=p}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||ah;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,a;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Op)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},OB=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Dg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new je,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new je,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Dg.INSTANCE=new Dg;var qm=Dg;function DB(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}qm.INSTANCE.onDidChangeZoomLevel;function LB(e){return qm.INSTANCE.getZoomFactor(e)}qm.INSTANCE.onDidChangeFullscreen;var Ao=typeof navigator=="object"?navigator.userAgent:"",Lg=Ao.indexOf("Firefox")>=0,zB=Ao.indexOf("AppleWebKit")>=0,Wm=Ao.indexOf("Chrome")>=0,BB=!Wm&&Ao.indexOf("Safari")>=0;Ao.indexOf("Electron/")>=0;Ao.indexOf("Android")>=0;var Dp=!1;if(typeof Vr.matchMedia=="function"){let e=Vr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Vr.matchMedia("(display-mode: fullscreen)");Dp=e.matches,DB(Vr,e,({matches:n})=>{Dp&&t.matches||(Dp=n)})}var _o="en",zg=!1,Bg=!1,oh=!1,_k=!1,Wu,lh=_o,v1=_o,jB,lr,_a=globalThis,Yn,Rx;typeof _a.vscode<"u"&&typeof _a.vscode.process<"u"?Yn=_a.vscode.process:typeof process<"u"&&typeof((Rx=process==null?void 0:process.versions)==null?void 0:Rx.node)=="string"&&(Yn=process);var Nx,IB=typeof((Nx=Yn==null?void 0:Yn.versions)==null?void 0:Nx.electron)=="string",PB=IB&&(Yn==null?void 0:Yn.type)==="renderer",Ox;if(typeof Yn=="object"){zg=Yn.platform==="win32",Bg=Yn.platform==="darwin",oh=Yn.platform==="linux",oh&&Yn.env.SNAP&&Yn.env.SNAP_REVISION,Yn.env.CI||Yn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wu=_o,lh=_o;let e=Yn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wu=t.userLocale,v1=t.osLocale,lh=t.resolvedLanguage||_o,jB=(Ox=t.languagePack)==null?void 0:Ox.translationsConfigFile}catch{}_k=!0}else typeof navigator=="object"&&!PB?(lr=navigator.userAgent,zg=lr.indexOf("Windows")>=0,Bg=lr.indexOf("Macintosh")>=0,(lr.indexOf("Macintosh")>=0||lr.indexOf("iPad")>=0||lr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,oh=lr.indexOf("Linux")>=0,(lr==null?void 0:lr.indexOf("Mobi"))>=0,lh=globalThis._VSCODE_NLS_LANGUAGE||_o,Wu=navigator.language.toLowerCase(),v1=Wu):console.error("Unable to resolve platform.");var vk=zg,Tr=Bg,UB=oh,y1=_k,Mr=lr,As=lh,HB;(e=>{function t(){return As}e.value=t;function n(){return As.length===2?As==="en":As.length>=3?As[0]==="e"&&As[1]==="n"&&As[2]==="-":!1}e.isDefaultVariant=n;function r(){return As==="en"}e.isDefault=r})(HB||(HB={}));var $B=typeof _a.postMessage=="function"&&!_a.importScripts;(()=>{if($B){let e=[];_a.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,a=e.length;r<a;r++){let o=e[r];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),o.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),_a.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var FB=!!(Mr&&Mr.indexOf("Chrome")>=0);Mr&&Mr.indexOf("Firefox")>=0;!FB&&Mr&&Mr.indexOf("Safari")>=0;Mr&&Mr.indexOf("Edg/")>=0;Mr&&Mr.indexOf("Android")>=0;var oo=typeof navigator=="object"?navigator:{};y1||document.queryCommandSupported&&document.queryCommandSupported("copy")||oo&&oo.clipboard&&oo.clipboard.writeText,y1||oo&&oo.clipboard&&oo.clipboard.readText;var Km=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Lp=new Km,b1=new Km,x1=new Km,qB=new Array(230),yk;(e=>{function t(f){return Lp.keyCodeToStr(f)}e.toString=t;function n(f){return Lp.strToKeyCode(f)}e.fromString=n;function r(f){return b1.keyCodeToStr(f)}e.toUserSettingsUS=r;function a(f){return x1.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return b1.strToKeyCode(f)||x1.strToKeyCode(f)}e.fromUserSettings=o;function c(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Lp.keyCodeToStr(f)}e.toElectronAccelerator=c})(yk||(yk={}));var WB=class bk{constructor(t,n,r,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof bk&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${r}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new KB([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},KB=class{constructor(e){if(e.length===0)throw _B("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function GB(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return yk.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Lg)switch(t){case 59:return 85;case 60:if(UB)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Tr)return 57;break}else if(zB&&(Tr&&t===93||!Tr&&t===92))return 57;return qB[t]||0}var YB=Tr?256:2048,VB=512,XB=1024,ZB=Tr?2048:256,S1=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=GB(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=YB),this.altKey&&(t|=VB),this.shiftKey&&(t|=XB),this.metaKey&&(t|=ZB),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WB(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},w1=new WeakMap;function JB(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var QB=class{static getSameOriginWindowChain(e){let t=w1.get(e);if(!t){t=[],w1.set(e,t);let n=e,r;do r=JB(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,r+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,r+=f.left}return{top:n,left:r}}},Ku=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=QB.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},k1=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Wm){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Lg&&!Tr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")BB&&vk?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Lg&&!Tr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},xk=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ej;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof tj?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xk})})(ej||(ej={}));var tj=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?xk:(this._emitter||(this._emitter=new je),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gm=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Mg("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Mg("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},nj=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Mg("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=an(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ij;(e=>{async function t(r){let a,o=await Promise.all(r.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(r){return new Promise(async(a,o)=>{try{await r(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(ij||(ij={}));var E1=class Zi{static fromArray(t){return new Zi(n=>{n.emitMany(t)})}static fromPromise(t){return new Zi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Zi(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Zi(async n=>{await Promise.all(t.map(async r=>{for await(let a of r)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new je,queueMicrotask(async()=>{let r={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(r)),this.resolve()}catch(a){this.reject(a)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Vn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Zi(async r=>{for await(let a of t)r.emitOne(n(a))})}map(t){return Zi.map(this,t)}static filter(t,n){return new Zi(async r=>{for await(let a of t)n(a)&&r.emitOne(a)})}filter(t){return Zi.filter(this,t)}static coalesce(t){return Zi.filter(t,n=>!!n)}coalesce(){return Zi.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Zi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};E1.EMPTY=E1.fromArray([]);var{getWindow:Cr,getWindowId:rj,onDidRegisterWindow:sj}=(function(){let e=new Map,t={window:Vr,disposables:new Ps};e.set(Vr.vscodeWindowId,t);let n=new je,r=new je,a=new je;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:r.event,registerWindow(c){if(e.has(c.vscodeWindowId))return St.None;let f=new Ps,p={window:c,disposables:f.add(new Ps)};return e.set(c.vscodeWindowId,p),f.add(an(()=>{e.delete(c.vscodeWindowId),r.fire(c)})),f.add(dt(c,zn.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(p),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var d;let f=c;if((d=f==null?void 0:f.ownerDocument)!=null&&d.defaultView)return f.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:Vr},getDocument(c){return Cr(c).document}}})(),aj=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function dt(e,t,n,r){return new aj(e,t,n,r)}var C1=function(e,t,n,r){return dt(e,t,n,r)},Ym,oj=class extends nj{constructor(e){super(),this.defaultTarget=e&&Cr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},T1=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ah(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),r.set(o,!0);c.length>0;)c.sort(T1.sort),c.shift().execute();r.set(o,!1)};Ym=(o,c,f=0)=>{let p=rj(o),d=new T1(c,f),m=e.get(p);return m||(m=[],e.set(p,m)),m.push(d),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>a(p))),d}})();function lj(e){let t=e.getBoundingClientRect(),n=Cr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var zn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},cj=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Si(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Si(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Si(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Si(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Si(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Si(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Si(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Si(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Si(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Si(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Si(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Si(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Si(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Si(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Si(e){return typeof e=="number"?`${e}px`:e}function Jl(e){return new cj(e)}var Sk=class{constructor(){this._hooks=new Ps,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(an(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Cr(e)}this._hooks.add(dt(o,zn.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(dt(o,zn.POINTER_UP,c=>this.stopMonitoring(!0)))}};function uj(e,t,n){let r=null,a=null;if(typeof n.value=="function"?(r="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[r]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var wr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(wr||(wr={}));var Pl=class ei extends St{constructor(){super(),this.dispatched=!1,this.targets=new _1,this.ignoreTargets=new _1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Vn.runAndSubscribe(sj,({window:t,disposables:n})=>{n.add(dt(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(dt(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(dt(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Vr,disposables:this._store}))}static addTarget(t){if(!ei.isTouchDevice())return St.None;ei.INSTANCE||(ei.INSTANCE=new ei);let n=ei.INSTANCE.targets.push(t);return an(n)}static ignoreTarget(t){if(!ei.isTouchDevice())return St.None;ei.INSTANCE||(ei.INSTANCE=new ei);let n=ei.INSTANCE.ignoreTargets.push(t);return an(n)}static isTouchDevice(){return"ontouchstart"in Vr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,a=t.targetTouches.length;r<a;r++){let o=t.targetTouches.item(r);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(wr.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let p=this.activeTouches[f.identifier],d=Date.now()-p.initialTimeStamp;if(d<ei.HOLD_DELAY&&Math.abs(p.initialPageX-Bi(p.rollingPageX))<30&&Math.abs(p.initialPageY-Bi(p.rollingPageY))<30){let m=this.newGestureEvent(wr.Tap,p.initialTarget);m.pageX=Bi(p.rollingPageX),m.pageY=Bi(p.rollingPageY),this.dispatchEvent(m)}else if(d>=ei.HOLD_DELAY&&Math.abs(p.initialPageX-Bi(p.rollingPageX))<30&&Math.abs(p.initialPageY-Bi(p.rollingPageY))<30){let m=this.newGestureEvent(wr.Contextmenu,p.initialTarget);m.pageX=Bi(p.rollingPageX),m.pageY=Bi(p.rollingPageY),this.dispatchEvent(m)}else if(a===1){let m=Bi(p.rollingPageX),_=Bi(p.rollingPageY),y=Bi(p.rollingTimestamps)-p.rollingTimestamps[0],b=m-p.rollingPageX[0],w=_-p.rollingPageY[0],S=[...this.targets].filter(C=>p.initialTarget instanceof Node&&C.contains(p.initialTarget));this.inertia(t,S,r,Math.abs(b)/y,b>0?1:-1,m,Math.abs(w)/y,w>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(wr.End,p.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===wr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>ei.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===wr.Change||t.type===wr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==r;)a++,o=o.parentElement;n.push([a,r])}n.sort((r,a)=>r[0]-a[0]);for(let[r,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,a,o,c,f,p,d){this.handle=Ym(t,()=>{let m=Date.now(),_=m-r,y=0,b=0,w=!0;a+=ei.SCROLL_FRICTION*_,f+=ei.SCROLL_FRICTION*_,a>0&&(w=!1,y=o*a*_),f>0&&(w=!1,b=p*f*_);let S=this.newGestureEvent(wr.Change);S.translationX=y,S.translationY=b,n.forEach(C=>C.dispatchEvent(S)),w||this.inertia(t,n,m,a,o,c+y,f,p,d+b)})}onTouchMove(t){let n=Date.now();for(let r=0,a=t.changedTouches.length;r<a;r++){let o=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent(wr.Change,c.initialTarget);f.translationX=o.pageX-Bi(c.rollingPageX),f.translationY=o.pageY-Bi(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Pl.SCROLL_FRICTION=-.005,Pl.HOLD_DELAY=700,Pl.CLEAR_TAP_COUNT_TIME=400,pn([uj],Pl,"isTouchDevice",1);var hj=Pl,Vm=class extends St{onclick(e,t){this._register(dt(e,zn.CLICK,n=>t(new Ku(Cr(e),n))))}onmousedown(e,t){this._register(dt(e,zn.MOUSE_DOWN,n=>t(new Ku(Cr(e),n))))}onmouseover(e,t){this._register(dt(e,zn.MOUSE_OVER,n=>t(new Ku(Cr(e),n))))}onmouseleave(e,t){this._register(dt(e,zn.MOUSE_LEAVE,n=>t(new Ku(Cr(e),n))))}onkeydown(e,t){this._register(dt(e,zn.KEY_DOWN,n=>t(new S1(n))))}onkeyup(e,t){this._register(dt(e,zn.KEY_UP,n=>t(new S1(n))))}oninput(e,t){this._register(dt(e,zn.INPUT,t))}onblur(e,t){this._register(dt(e,zn.BLUR,t))}onfocus(e,t){this._register(dt(e,zn.FOCUS,t))}onchange(e,t){this._register(dt(e,zn.CHANGE,t))}ignoreGesture(e){return hj.ignoreTarget(e)}},M1=11,dj=class extends Vm{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=M1+"px",this.domNode.style.height=M1+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Sk),this._register(C1(this.bgDomNode,zn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(C1(this.domNode,zn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new oj),this._pointerdownScheduleRepeatTimer=this._register(new Gm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Cr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},fj=class jg{constructor(t,n,r,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>r&&(a=r-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=r,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new jg(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new jg(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:p}}},pj=class extends St{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new je),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new fj(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new R1(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=R1.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},A1=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function zp(e,t){let n=t-e;return function(r){return e+n*_j(r)}}function gj(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var R1=class Ig{constructor(t,n,r,a){this.from=t,this.to=n,this.duration=a,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let a,o;return t<n?(a=t+.75*r,o=n-.75*r):(a=t-.75*r,o=n+.75*r),gj(zp(t,a),zp(o,n),.33)}return zp(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),a=this.scrollTop(n);return new A1(r,a,!1)}return new A1(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Ig.start(t,n,r)}static start(t,n,r){r=r+10;let a=Date.now()-10;return new Ig(t,n,a,r)}};function mj(e){return Math.pow(e,3)}function _j(e){return 1-mj(1-e)}var vj=class extends St{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gm)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},yj=140,wk=class extends Vm{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new vj(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Sk),this._shouldRender=!0,this.domNode=Jl(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(dt(this.domNode.domNode,zn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new dj(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Jl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(dt(this.slider.domNode,zn.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=lj(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(vk&&c>yj){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},kk=class Pg{constructor(t,n,r,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Pg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,a,o){let c=Math.max(0,r-t),f=Math.max(0,c-2*n),p=a>0&&a>r;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(r*f/a))),m=(f-d)/(a-r),_=o*m;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(d),computedSliderRatio:m,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Pg._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},bj=class extends wk{constructor(e,t,n){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kk(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},xj=class extends wk{constructor(e,t,n){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new kk(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Sj=500,N1=50,wj=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Ug=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-r);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Wm){let n=Cr(t.browserEvent),r=LB(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let a=null,o=new wj(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),p=Math.max(Math.min(a,c),1),d=Math.max(Math.min(o,f),1),m=Math.max(a,c),_=Math.max(o,f);m%p===0&&_%d===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ug.INSTANCE=new Ug;var kj=Ug,Ej=class extends Vm{constructor(e,t,n){super(),this._onScroll=this._register(new je),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new je),this.onWillScroll=this._onWillScroll.event,this._options=Tj(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let r={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new xj(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new bj(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Jl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Jl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Jl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Gm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ba(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Tr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new k1(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ba(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new k1(n))};this._mouseWheelToDispose.push(dt(this._listenOnDomNode,zn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=kj.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!Tr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),d={};if(o){let m=N1*o,_=p.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(d,_)}if(c){let m=N1*c,_=p.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(d,_)}d=this._scrollable.validateScrollPosition(d),(p.scrollLeft!==d.scrollLeft||p.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Sj)}},Cj=class extends Ej{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Tj(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Tr&&(t.className+=" mac"),t}var Hg=class extends St{constructor(e,t,n,r,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new je),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new pj({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Ym(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Cj(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Vn.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(an(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(an(()=>this._styleElement.remove())),this._register(Vn.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
602
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Hg=pn([Ke(2,hi),Ke(3,Jr),Ke(4,rk),Ke(5,Mo),Ke(6,di),Ke(7,Qr)],Hg);var $g=class extends St{constructor(e,t,n,r,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=a,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(an(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};$g=pn([Ke(1,hi),Ke(2,Jr),Ke(3,yc),Ke(4,Qr)],$g);var Mj=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},vr={full:0,left:0,center:0,right:0},Rs={full:0,left:0,center:0,right:0},Nl={full:0,left:0,center:0,right:0},kh=class extends St{constructor(e,t,n,r,a,o,c,f){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new Mj,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(an(()=>{var m;return(m=this._canvas)==null?void 0:m.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Rs.full=this._canvas.width,Rs.left=e,Rs.center=t,Rs.right=e,this._refreshDrawHeightConstants(),Nl.full=1,Nl.left=1,Nl.center=1+Rs.left,Nl.right=1+Rs.left+Rs.center}_refreshDrawHeightConstants(){vr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);vr.left=t,vr.center=t,vr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Nl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-vr[e.position||"full"]/2),Rs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+vr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};kh=pn([Ke(2,hi),Ke(3,yc),Ke(4,Qr),Ke(5,di),Ke(6,Mo),Ke(7,Jr)],kh);var Ce;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
603
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(Ce||(Ce={}));var ch;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(ch||(ch={}));var Ek;(e=>e.ST=`${Ce.ESC}\\`)(Ek||(Ek={}));var Fg=class{constructor(e,t,n,r,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=a,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Ce.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Fg=pn([Ke(2,hi),Ke(3,di),Ke(4,Ea),Ke(5,Qr)],Fg);var Bn=0,jn=0,In=0,fn=0,O1={css:"#00000000",rgba:0},Tn;(e=>{function t(a,o,c,f){return f!==void 0?`#${la(a)}${la(o)}${la(c)}${la(f)}`:`#${la(a)}${la(o)}${la(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function r(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=r})(Tn||(Tn={}));var tn;(e=>{function t(p,d){if(fn=(d.rgba&255)/255,fn===1)return{css:d.css,rgba:d.rgba};let m=d.rgba>>24&255,_=d.rgba>>16&255,y=d.rgba>>8&255,b=p.rgba>>24&255,w=p.rgba>>16&255,S=p.rgba>>8&255;Bn=b+Math.round((m-b)*fn),jn=w+Math.round((_-w)*fn),In=S+Math.round((y-S)*fn);let C=Tn.toCss(Bn,jn,In),k=Tn.toRgba(Bn,jn,In);return{css:C,rgba:k}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function r(p,d,m){let _=uh.ensureContrastRatio(p.rgba,d.rgba,m);if(_)return Tn.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function a(p){let d=(p.rgba|255)>>>0;return[Bn,jn,In]=uh.toChannels(d),{css:Tn.toCss(Bn,jn,In),rgba:d}}e.opaque=a;function o(p,d){return fn=Math.round(d*255),[Bn,jn,In]=uh.toChannels(p.rgba),{css:Tn.toCss(Bn,jn,In,fn),rgba:Tn.toRgba(Bn,jn,In,fn)}}e.opacity=o;function c(p,d){return fn=p.rgba&255,o(p,fn*d/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(tn||(tn={}));var cn;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Bn=parseInt(a.slice(1,2).repeat(2),16),jn=parseInt(a.slice(2,3).repeat(2),16),In=parseInt(a.slice(3,4).repeat(2),16),Tn.toColor(Bn,jn,In);case 5:return Bn=parseInt(a.slice(1,2).repeat(2),16),jn=parseInt(a.slice(2,3).repeat(2),16),In=parseInt(a.slice(3,4).repeat(2),16),fn=parseInt(a.slice(4,5).repeat(2),16),Tn.toColor(Bn,jn,In,fn);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Bn=parseInt(o[1]),jn=parseInt(o[2]),In=parseInt(o[3]),fn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Tn.toColor(Bn,jn,In,fn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Bn,jn,In,fn]=t.getImageData(0,0,1,1).data,fn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Tn.toRgba(Bn,jn,In,fn),css:a}}e.toColor=r})(cn||(cn={}));var ai;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,a,o){let c=r/255,f=a/255,p=o/255,d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),m=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return d*.2126+m*.7152+_*.0722}e.relativeLuminance2=n})(ai||(ai={}));var uh;(e=>{function t(c,f){if(fn=(f&255)/255,fn===1)return f;let p=f>>24&255,d=f>>16&255,m=f>>8&255,_=c>>24&255,y=c>>16&255,b=c>>8&255;return Bn=_+Math.round((p-_)*fn),jn=y+Math.round((d-y)*fn),In=b+Math.round((m-b)*fn),Tn.toRgba(Bn,jn,In)}e.blend=t;function n(c,f,p){let d=ai.relativeLuminance(c>>8),m=ai.relativeLuminance(f>>8);if(Yr(d,m)<p){if(m<d){let b=r(c,f,p),w=Yr(d,ai.relativeLuminance(b>>8));if(w<p){let S=a(c,f,p),C=Yr(d,ai.relativeLuminance(S>>8));return w>C?b:S}return b}let _=a(c,f,p),y=Yr(d,ai.relativeLuminance(_>>8));if(y<p){let b=r(c,f,p),w=Yr(d,ai.relativeLuminance(b>>8));return y>w?_:b}return _}}e.ensureContrastRatio=n;function r(c,f,p){let d=c>>24&255,m=c>>16&255,_=c>>8&255,y=f>>24&255,b=f>>16&255,w=f>>8&255,S=Yr(ai.relativeLuminance2(y,b,w),ai.relativeLuminance2(d,m,_));for(;S<p&&(y>0||b>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=Yr(ai.relativeLuminance2(y,b,w),ai.relativeLuminance2(d,m,_));return(y<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=r;function a(c,f,p){let d=c>>24&255,m=c>>16&255,_=c>>8&255,y=f>>24&255,b=f>>16&255,w=f>>8&255,S=Yr(ai.relativeLuminance2(y,b,w),ai.relativeLuminance2(d,m,_));for(;S<p&&(y<255||b<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Yr(ai.relativeLuminance2(y,b,w),ai.relativeLuminance2(d,m,_));return(y<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(uh||(uh={}));function la(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Yr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Aj=class extends vc{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Eh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new er}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),p=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==p){if(d-a>1){let m=this._getJoinedRanges(r,c,o,t,a);for(let _=0;_<m.length;_++)n.push(m[_])}a=d,c=o,f=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||js.length}if(this._bufferService.cols-a>1){let d=this._getJoinedRanges(r,c,o,t,a);for(let m=0;m<d.length;m++)n.push(d[m])}return n}_getJoinedRanges(e,t,n,r,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let p=this._characterJoiners[f].handler(o);for(let d=0;d<p.length;d++)Eh._mergeRanges(c,p[d])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,r,a),c}_stringRangesToCellRanges(e,t,n){let r=0,a=!1,o=0,c=e[r];if(c){for(let f=n;f<this._bufferService.cols;f++){let p=t.getWidth(f),d=t.getString(f).length||js.length;if(p!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++r],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=d}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let a=e[r];if(n){if(t[1]<=a[0])return e[r-1][1]=t[1],e;if(t[1]<=a[1])return e[r-1][1]=Math.max(t[1],a[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=a[0])return e.splice(r,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Eh=pn([Ke(0,hi)],Eh);function Rj(e){return 57508<=e&&e<=57558}function Nj(e){return 9472<=e&&e<=9631}function Oj(e){return Rj(e)||Nj(e)}function Dj(){return{css:{canvas:Gu(),cell:Gu()},device:{canvas:Gu(),cell:Gu(),char:{width:0,height:0,left:0,top:0}}}}function Gu(){return{width:0,height:0}}var qg=class{constructor(e,t,n,r,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new er,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,a,o,c,f,p,d,m){let _=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let S,C=0,k="",j=0,R=0,L=0,q=0,O=!1,z=0,J=!1,ie=0,D=0,A=[],M=d!==-1&&m!==-1;for(let P=0;P<w;P++){e.loadCell(P,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let H=!1,N=P>=D,$=P,K=this._workCell;if(y.length>0&&P===y[0][0]&&N){let pe=y.shift(),Xe=this._isCellInSelection(pe[0],t);for(j=pe[0]+1;j<pe[1];j++)N&&(N=Xe===this._isCellInSelection(j,t));N&&(N=!n||o<pe[0]||o>=pe[1]),N?(H=!0,K=new Aj(this._workCell,e.translateToString(!0,pe[0],pe[1]),pe[1]-pe[0]),$=pe[1]-1,G=K.getWidth()):D=pe[1]}let re=this._isCellInSelection(P,t),U=n&&P===o,W=M&&P>=d&&P<=m,I=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,pe=>{I=!0});let E=K.getChars()||js;if(E===" "&&(K.isUnderline()||K.isOverline())&&(E=" "),ie=G*f-p.get(E,K.isBold(),K.isItalic()),!S)S=this._document.createElement("span");else if(C&&(re&&J||!re&&!J&&K.bg===R)&&(re&&J&&b.selectionForeground||K.fg===L)&&K.extended.ext===q&&W===O&&ie===z&&!U&&!H&&!I&&N){K.isInvisible()?k+=js:k+=E,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(R=K.bg,L=K.fg,q=K.extended.ext,O=W,z=ie,J=re,H&&o>=P&&o<=$&&(o=P),!this._coreService.isCursorHidden&&U&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&A.push("xterm-cursor-blink"),A.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(K.isBold()&&A.push("xterm-bold"),K.isItalic()&&A.push("xterm-italic"),K.isDim()&&A.push("xterm-dim"),K.isInvisible()?k=js:k=K.getChars()||js,K.isUnderline()&&(A.push(`xterm-underline-${K.extended.underlineStyle}`),k===" "&&(k=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${vc.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let pe=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&pe<8&&(pe+=8),S.style.textDecorationColor=b.ansi[pe].css}K.isOverline()&&(A.push("xterm-overline"),k===" "&&(k=" ")),K.isStrikethrough()&&A.push("xterm-strikethrough"),W&&(S.style.textDecoration="underline");let F=K.getFgColor(),Y=K.getFgColorMode(),Z=K.getBgColor(),ve=K.getBgColorMode(),Oe=!!K.isInverse();if(Oe){let pe=F;F=Z,Z=pe;let Xe=Y;Y=ve,ve=Xe}let _e,Fe,st=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,pe=>{pe.options.layer!=="top"&&st||(pe.backgroundColorRGB&&(ve=50331648,Z=pe.backgroundColorRGB.rgba>>8&16777215,_e=pe.backgroundColorRGB),pe.foregroundColorRGB&&(Y=50331648,F=pe.foregroundColorRGB.rgba>>8&16777215,Fe=pe.foregroundColorRGB),st=pe.options.layer==="top")}),!st&&re&&(_e=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,Z=_e.rgba>>8&16777215,ve=50331648,st=!0,b.selectionForeground&&(Y=50331648,F=b.selectionForeground.rgba>>8&16777215,Fe=b.selectionForeground)),st&&A.push("xterm-decoration-top");let ae;switch(ve){case 16777216:case 33554432:ae=b.ansi[Z],A.push(`xterm-bg-${Z}`);break;case 50331648:ae=Tn.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(S,`background-color:#${D1((Z>>>0).toString(16),"0",6)}`);break;case 0:default:Oe?(ae=b.foreground,A.push("xterm-bg-257")):ae=b.background}switch(_e||K.isDim()&&(_e=tn.multiplyOpacity(ae,.5)),Y){case 16777216:case 33554432:K.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(S,ae,b.ansi[F],K,_e,void 0)||A.push(`xterm-fg-${F}`);break;case 50331648:let pe=Tn.toColor(F>>16&255,F>>8&255,F&255);this._applyMinimumContrast(S,ae,pe,K,_e,Fe)||this._addStyle(S,`color:#${D1(F.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,ae,b.foreground,K,_e,Fe)||Oe&&A.push("xterm-fg-257")}A.length&&(S.className=A.join(" "),A.length=0),!U&&!H&&!I&&N?C++:S.textContent=k,ie!==this.defaultSpacing&&(S.style.letterSpacing=`${ie}px`),_.push(S),P=$}return S&&C&&(S.textContent=k),_}_applyMinimumContrast(e,t,n,r,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Oj(r.getCode()))return!1;let c=this._getContrastCache(r),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);f=tn.ensureContrastRatio(a||t,o||n,p),c.setColor((a||t).rgba,(o||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};qg=pn([Ke(1,ok),Ke(2,di),Ke(3,Jr),Ke(4,Ea),Ke(5,yc),Ke(6,Mo)],qg);function D1(e,t,n){for(;e.length<n;)e=t+e;return e}var Lj=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,r,a,o],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(a),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let c=this._measure(e,0);return c>0&&(this._flat[r]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},zj=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),p=Math.min(c,e.rows-1);if(f>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Bj(){return new zj}var Bp="xterm-dom-renderer-owner-",Xi="xterm-rows",Yu="xterm-fg-",L1="xterm-bg-",Ol="xterm-focus",Vu="xterm-selection",jj=1,Wg=class extends St{constructor(e,t,n,r,a,o,c,f,p,d,m,_,y,b){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=d,this._bufferService=m,this._coreService=_,this._coreBrowserService=y,this._themeService=b,this._terminalClass=jj++,this._rowElements=[],this._selectionRenderModel=Bj(),this.onRequestRedraw=this._register(new je).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Xi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Vu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Dj(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(qg,document),this._element.classList.add(Bp+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(an(()=>{this._element.classList.remove(Bp+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Lj(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Xi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Xi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Xi} .xterm-dim { color: ${tn.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Xi}.${Ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Xi}.${Ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Xi}.${Ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Xi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Xi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Xi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Xi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Xi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Vu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Vu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Vu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Yu}${o} { color: ${c.css}; }${this._terminalSelector} .${Yu}${o}.xterm-dim { color: ${tn.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${L1}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Yu}257 { color: ${tn.opaque(e.background).css}; }${this._terminalSelector} .${Yu}257.xterm-dim { color: ${tn.multiplyOpacity(tn.opaque(e.background),.5).css}; }${this._terminalSelector} .${L1}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ol),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ol),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];f.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=r===o?e[0]:0,d=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,p,d));let m=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==c){let _=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,r=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${r*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let d=p+n.ydisp,m=this._rowElements[p],_=n.lines.get(d);if(!m||!_)break;m.replaceChildren(...this._rowFactory.createRow(_,d,d===r,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Bp}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,a,o){n<0&&(e=0),r<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),r=Math.max(Math.min(r,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,p=f.ybase+f.y,d=Math.min(f.x,a-1),m=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=n;b<=r;++b){let w=b+f.ydisp,S=this._rowElements[b],C=f.lines.get(w);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,w,w===p,_,y,d,m,this.dimensions.css.cell.width,this._widthCache,o?b===n?e:0:-1,o?(b===r?t:a)-1:-1))}}};Wg=pn([Ke(7,$m),Ke(8,qh),Ke(9,di),Ke(10,hi),Ke(11,Ea),Ke(12,Jr),Ke(13,Mo)],Wg);var Kg=class extends St{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new je),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Pj(this._optionsService))}catch{this._measureStrategy=this._register(new Ij(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Kg=pn([Ke(2,di)],Kg);var Ck=class extends St{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Ij=class extends Ck{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Pj=class extends Ck{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Uj=class extends St{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Hj(this._window)),this._onDprChange=this._register(new je),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new je),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Vn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(dt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(dt(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Hj=class extends St{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new bo),this._onDprChange=this._register(new je),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(an(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=dt(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},$j=class extends St{constructor(){super(),this.linkProviders=[],this._register(an(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Xm(e,t,n){let r=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-r.left-o,t.clientY-r.top-c]}function Fj(e,t,n,r,a,o,c,f,p){if(!o)return;let d=Xm(e,t,n);if(d)return d[0]=Math.ceil((d[0]+(p?c/2:0))/c),d[1]=Math.ceil(d[1]/f),d[0]=Math.min(Math.max(d[0],1),r+(p?1:0)),d[1]=Math.min(Math.max(d[1],1),a),d}var Gg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,a){return Fj(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=Xm(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Gg=pn([Ke(0,Qr),Ke(1,qh)],Gg);var qj=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Tk={};eB(Tk,{getSafariVersion:()=>Kj,isChromeOS:()=>Nk,isFirefox:()=>Mk,isIpad:()=>Gj,isIphone:()=>Yj,isLegacyEdge:()=>Wj,isLinux:()=>Zm,isMac:()=>Ch,isNode:()=>Wh,isSafari:()=>Ak,isWindows:()=>Rk});var Wh=typeof process<"u"&&"title"in process,bc=Wh?"node":navigator.userAgent,xc=Wh?"node":navigator.platform,Mk=bc.includes("Firefox"),Wj=bc.includes("Edge"),Ak=/^((?!chrome|android).)*safari/i.test(bc);function Kj(){if(!Ak)return 0;let e=bc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ch=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(xc),Gj=xc==="iPad",Yj=xc==="iPhone",Rk=["Windows","Win16","Win32","WinCE"].includes(xc),Zm=xc.indexOf("Linux")>=0,Nk=/\bCrOS\b/.test(bc),Ok=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=a}this.clear()}},Vj=class extends Ok{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Xj=class extends Ok{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Th=!Wh&&"requestIdleCallback"in window?Xj:Vj,Zj=class{constructor(){this._queue=new Th}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Yg=class extends St{constructor(e,t,n,r,a,o,c,f,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new bo),this._pausedResizeTask=new Zj,this._observerDisposable=this._register(new bo),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new je),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new je),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new je),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new je),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qj((d,m)=>this._renderRows(d,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Jj(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(an(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=an(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Yg=pn([Ke(2,di),Ke(3,qh),Ke(4,Ea),Ke(5,yc),Ke(6,hi),Ke(7,Jr),Ke(8,Mo)],Yg);var Jj=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Qj(e,t,n,r){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return nI(a,o,e,t,n,r)+Kh(o,t,n,r)+iI(a,o,e,t,n,r);let c;if(o===t)return c=a>e?"D":"C",sc(Math.abs(a-e),rc(c,r));c=o>t?"D":"C";let f=Math.abs(o-t),p=tI(o>t?e:a,n)+(f-1)*n.cols+1+eI(o>t?a:e);return sc(p,rc(c,r))}function eI(e,t){return e-1}function tI(e,t){return t.cols-e}function nI(e,t,n,r,a,o){return Kh(t,r,a,o).length===0?"":sc(Lk(e,t,e,t-xa(t,a),!1,a).length,rc("D",o))}function Kh(e,t,n,r){let a=e-xa(e,n),o=t-xa(t,n),c=Math.abs(a-o)-rI(e,t,n);return sc(c,rc(Dk(e,t),r))}function iI(e,t,n,r,a,o){let c;Kh(t,r,a,o).length>0?c=r-xa(r,a):c=t;let f=r,p=sI(e,t,n,r,a,o);return sc(Lk(e,c,n,f,p==="C",a).length,rc(p,o))}function rI(e,t,n){var c;let r=0,a=e-xa(e,n),o=t-xa(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=Dk(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&r++}return r}function xa(e,t){let n=0,r=t.buffer.lines.get(e),a=r==null?void 0:r.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),a=r==null?void 0:r.isWrapped;return n}function sI(e,t,n,r,a,o){let c;return Kh(n,r,a,o).length>0?c=r-xa(r,a):c=t,e<n&&c<=r||e>=n&&c<r?"C":"D"}function Dk(e,t){return e>t?"A":"B"}function Lk(e,t,n,r,a,o){let c=e,f=t,p="";for(;(c!==n||f!==r)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(p+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return p+o.buffer.translateBufferLineToString(f,!1,e,c)}function rc(e,t){let n=t?"O":"[";return Ce.ESC+n+e}function sc(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var aI=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function z1(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var jp=50,oI=15,lI=50,cI=500,uI=" ",hI=new RegExp(uI,"g"),Vg=class extends St{constructor(e,t,n,r,a,o,c,f,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new er,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new je),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new je),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new je),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new je),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new aI(this._bufferService),this._activeSelectionMode=0,this._register(an(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);r.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?r[r.length-1]+=f:r.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=c:r.push(c)}}return r.map(a=>a.replace(hI," ")).join(Rk?`\r
|
|
604
|
+
`:`
|
|
605
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Zm&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=z1(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Xm(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-jp),jp),t/=jp,t/Math.abs(t)+Math.round(t*(oI-1)))}shouldForceSelection(e){return Ch?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),lI)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Ch&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<cI&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=Qj(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let a=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==r&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),p=f,d=e[0]-f,m=0,_=0,y=0,b=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let C=e[0],k=e[0];o.getWidth(C)===0&&(m++,C--),o.getWidth(k)===2&&(_++,k++);let j=o.getString(k).length;for(j>1&&(b+=j-1,p+=j-1);C>0&&f>0&&!this._isCharWordSeparator(o.loadCell(C-1,this._workCell));){o.loadCell(C-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,C--):R>1&&(y+=R-1,f-=R-1),f--,C--}for(;k<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,k++):R>1&&(b+=R-1,p+=R-1),p++,k++}}p++;let w=f+d-m+y,S=Math.min(this._bufferService.cols,p-f+m+_-y-b);if(!(!t&&c.slice(f,p).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let C=a.lines.get(e[1]-1);if(C&&o.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let j=this._bufferService.cols-k.start;w-=j,S+=j}}}if(r&&w+S===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let C=a.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=z1(n,this._bufferService.cols)}};Vg=pn([Ke(3,hi),Ke(4,Ea),Ke(5,Fm),Ke(6,di),Ke(7,Qr),Ke(8,Jr)],Vg);var B1=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},j1=class{constructor(){this._color=new B1,this._css=new B1}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Rn=Object.freeze((()=>{let e=[cn.toColor("#2e3436"),cn.toColor("#cc0000"),cn.toColor("#4e9a06"),cn.toColor("#c4a000"),cn.toColor("#3465a4"),cn.toColor("#75507b"),cn.toColor("#06989a"),cn.toColor("#d3d7cf"),cn.toColor("#555753"),cn.toColor("#ef2929"),cn.toColor("#8ae234"),cn.toColor("#fce94f"),cn.toColor("#729fcf"),cn.toColor("#ad7fa8"),cn.toColor("#34e2e2"),cn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:Tn.toCss(r,a,o),rgba:Tn.toRgba(r,a,o)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Tn.toCss(r,r,r),rgba:Tn.toRgba(r,r,r)})}return e})()),da=cn.toColor("#ffffff"),Ul=cn.toColor("#000000"),I1=cn.toColor("#ffffff"),P1=Ul,Dl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},dI=da,Xg=class extends St{constructor(e){super(),this._optionsService=e,this._contrastCache=new j1,this._halfContrastCache=new j1,this._onChangeColors=this._register(new je),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:da,background:Ul,cursor:I1,cursorAccent:P1,selectionForeground:void 0,selectionBackgroundTransparent:Dl,selectionBackgroundOpaque:tn.blend(Ul,Dl),selectionInactiveBackgroundTransparent:Dl,selectionInactiveBackgroundOpaque:tn.blend(Ul,Dl),scrollbarSliderBackground:tn.opacity(da,.2),scrollbarSliderHoverBackground:tn.opacity(da,.4),scrollbarSliderActiveBackground:tn.opacity(da,.5),overviewRulerBorder:da,ansi:Rn.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Wt(e.foreground,da),t.background=Wt(e.background,Ul),t.cursor=tn.blend(t.background,Wt(e.cursor,I1)),t.cursorAccent=tn.blend(t.background,Wt(e.cursorAccent,P1)),t.selectionBackgroundTransparent=Wt(e.selectionBackground,Dl),t.selectionBackgroundOpaque=tn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Wt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=tn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Wt(e.selectionForeground,O1):void 0,t.selectionForeground===O1&&(t.selectionForeground=void 0),tn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=tn.opacity(t.selectionBackgroundTransparent,.3)),tn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=tn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Wt(e.scrollbarSliderBackground,tn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Wt(e.scrollbarSliderHoverBackground,tn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Wt(e.scrollbarSliderActiveBackground,tn.opacity(t.foreground,.5)),t.overviewRulerBorder=Wt(e.overviewRulerBorder,dI),t.ansi=Rn.slice(),t.ansi[0]=Wt(e.black,Rn[0]),t.ansi[1]=Wt(e.red,Rn[1]),t.ansi[2]=Wt(e.green,Rn[2]),t.ansi[3]=Wt(e.yellow,Rn[3]),t.ansi[4]=Wt(e.blue,Rn[4]),t.ansi[5]=Wt(e.magenta,Rn[5]),t.ansi[6]=Wt(e.cyan,Rn[6]),t.ansi[7]=Wt(e.white,Rn[7]),t.ansi[8]=Wt(e.brightBlack,Rn[8]),t.ansi[9]=Wt(e.brightRed,Rn[9]),t.ansi[10]=Wt(e.brightGreen,Rn[10]),t.ansi[11]=Wt(e.brightYellow,Rn[11]),t.ansi[12]=Wt(e.brightBlue,Rn[12]),t.ansi[13]=Wt(e.brightMagenta,Rn[13]),t.ansi[14]=Wt(e.brightCyan,Rn[14]),t.ansi[15]=Wt(e.brightWhite,Rn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Wt(e.extendedAnsi[r],Rn[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Xg=pn([Ke(0,di)],Xg);function Wt(e,t){if(e!==void 0)try{return cn.toColor(e)}catch{}return t}var fI=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},pI=class{constructor(){this._services=new fI,this._services.set($m,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=oB(e).sort((o,c)=>o.index-c.index),r=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(c)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},gI={trace:0,debug:1,info:2,warn:3,error:4,off:5},mI="xterm.js: ",Zg=class extends St{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=gI[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":mI)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Zg=pn([Ke(0,di)],Zg);var U1=class extends St{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new je),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new je),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new je),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},xt=3,Cn=Object.freeze(new vc),Xu=0,Ip=2,Hl=class zk{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*xt);let a=n||er.fromCharData([0,ek,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*xt+0],r=n&2097151;return[this._data[t*xt+1],n&2097152?this._combined[t]:r?Ls(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*xt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*xt+0]=t|2097152|n[2]<<22):this._data[t*xt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*xt+0]>>22}hasWidth(t){return this._data[t*xt+0]&12582912}getFg(t){return this._data[t*xt+1]}getBg(t){return this._data[t*xt+2]}hasContent(t){return this._data[t*xt+0]&4194303}getCodePoint(t){let n=this._data[t*xt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*xt+0]&2097152}getString(t){let n=this._data[t*xt+0];return n&2097152?this._combined[t]:n&2097151?Ls(n&2097151):""}isProtected(t){return this._data[t*xt+2]&536870912}loadCell(t,n){return Xu=t*xt,n.content=this._data[Xu+0],n.fg=this._data[Xu+1],n.bg=this._data[Xu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*xt+0]=n.content,this._data[t*xt+1]=n.fg,this._data[t*xt+2]=n.bg}setCellFromCodepoint(t,n,r,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*xt+0]=n|r<<22,this._data[t*xt+1]=a.fg,this._data[t*xt+2]=a.bg}addCodepointToCell(t,n,r){let a=this._data[t*xt+0];a&2097152?this._combined[t]+=Ls(n):a&2097151?(this._combined[t]=Ls(a&2097151)+Ls(n),a&=-2097152,a|=2097152):a=n|1<<22,r&&(a&=-12582913,a|=r<<22),this._data[t*xt+0]=a}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let a=new er;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,r)}else for(let a=t;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let a=new er;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,r)}else for(let a=t;a<this.length;++a)this.setCell(a,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Ip<this._data.buffer.byteLength;let r=t*xt;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,r*4*Ip<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ip<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new zk(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*xt+0]&4194303)return t+(this._data[t*xt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*xt+0]&4194303||this._data[t*xt+2]&50331648)return t+(this._data[t*xt+0]>>22);return 0}copyCellsFrom(t,n,r,a,o){let c=t._data;if(o)for(let p=a-1;p>=0;p--){for(let d=0;d<xt;d++)this._data[(r+p)*xt+d]=c[(n+p)*xt+d];c[(n+p)*xt+2]&268435456&&(this._extendedAttrs[r+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let d=0;d<xt;d++)this._data[(r+p)*xt+d]=c[(n+p)*xt+d];c[(n+p)*xt+2]&268435456&&(this._extendedAttrs[r+p]=t._extendedAttrs[n+p])}let f=Object.keys(t._combined);for(let p=0;p<f.length;p++){let d=parseInt(f[p],10);d>=n&&(this._combined[d-n+r]=t._combined[d])}}translateToString(t,n,r,a){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<r;){let c=this._data[n*xt+0],f=c&2097151,p=c&2097152?this._combined[n]:f?Ls(f):js;if(o+=p,a)for(let d=0;d<p.length;++d)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function _I(e,t,n,r,a,o){let c=[];for(let f=0;f<e.length-1;f++){let p=f,d=e.get(++p);if(!d.isWrapped)continue;let m=[e.get(f)];for(;p<e.length&&d.isWrapped;)m.push(d),d=e.get(++p);if(!o&&r>=f&&r<p){f+=m.length-1;continue}let _=0,y=ac(m,_,t),b=1,w=0;for(;b<m.length;){let C=ac(m,b,t),k=C-w,j=n-y,R=Math.min(k,j);m[_].copyCellsFrom(m[b],w,y,R,!1),y+=R,y===n&&(_++,y=0),w+=R,w===C&&(b++,w=0),y===0&&_!==0&&m[_-1].getWidth(n-1)===2&&(m[_].copyCellsFrom(m[_-1],n-1,y++,1,!1),m[_-1].setCell(n-1,a))}m[_].replaceCells(y,n,a);let S=0;for(let C=m.length-1;C>0&&(C>_||m[C].getTrimmedLength()===0);C--)S++;S>0&&(c.push(f+m.length-S),c.push(S)),f+=m.length-1}return c}function vI(e,t){let n=[],r=0,a=t[r],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++r];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++r]}else n.push(c);return{layout:n,countRemoved:o}}function yI(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function bI(e,t,n){let r=[],a=e.map((p,d)=>ac(e,d,t)).reduce((p,d)=>p+d),o=0,c=0,f=0;for(;f<a;){if(a-f<n){r.push(a-f);break}o+=n;let p=ac(e,c,t);o>p&&(o-=p,c++);let d=e[c].getWidth(o-1)===2;d&&o--;let m=d?n-1:n;r.push(m),f+=m}return r}function ac(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return r&&a?n-1:n}var Bk=class jk{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=jk._nextId++,this._onDispose=this.register(new je),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ba(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Bk._nextId=1;var xI=Bk,On={},fa=On.B;On[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};On.A={"#":"£"};On.B=void 0;On[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};On.C=On[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};On.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};On.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};On.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};On.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};On.E=On[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};On.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};On.H=On[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};On["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var H1=4294967295,$1=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Cn.clone(),this.savedCharset=fa,this.markers=[],this._nullCell=er.fromCharData([0,ek,1,0]),this._whitespaceCell=er.fromCharData([0,js,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Th,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new U1(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new wh),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new wh),this._whitespaceCell}getBlankLine(e,t){return new Hl(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>H1?H1:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Cn);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new U1(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Cn),r=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)r+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Hl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Hl(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=_I(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Cn),n);if(r.length>0){let a=vI(this.lines,r);yI(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Cn),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Hl(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Cn),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let p=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),p.unshift(f);if(!n){let R=this.ybase+this.y;if(R>=c&&R<c+p.length)continue}let d=p[p.length-1].getTrimmedLength(),m=bI(p,this._cols,e),_=m.length-p.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+_):y=Math.max(0,this.lines.length-this.lines.maxLength+_);let b=[];for(let R=0;R<_;R++){let L=this.getBlankLine(Cn,!0);b.push(L)}b.length>0&&(a.push({start:c+p.length+o,newLines:b}),o+=b.length),p.push(...b);let w=m.length-1,S=m[w];S===0&&(w--,S=m[w]);let C=p.length-_-1,k=d;for(;C>=0;){let R=Math.min(k,S);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[C],k-R,S-R,R,!0),S-=R,S===0&&(w--,S=m[w]),k-=R,k===0){C--;let L=Math.max(C,0);k=ac(p,L,this._cols)}}for(let R=0;R<p.length;R++)m[R]<e&&p[R].setCell(m[R],r);let j=_-y;for(;j-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let S=0;S<this.lines.length;S++)f.push(this.lines.get(S));let p=this.lines.length,d=p-1,m=0,_=a[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let y=0;for(let S=Math.min(this.lines.maxLength-1,p+o-1);S>=0;S--)if(_&&_.start>d+y){for(let C=_.newLines.length-1;C>=0;C--)this.lines.set(S--,_.newLines[C]);S++,c.push({index:d+1,amount:_.newLines.length}),y+=_.newLines.length,_=a[++m]}else this.lines.set(S,f[d--]);let b=0;for(let S=c.length-1;S>=0;S--)c[S].index+=b,this.lines.onInsertEmitter.fire(c[S]),b+=c[S].amount;let w=Math.max(0,p+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,r){let a=this.lines.get(e);return a?a.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new xI(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},SI=class extends St{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new je),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new $1(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new $1(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Ik=2,Pk=1,Jg=class extends St{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new je),this.onResize=this._onResize.event,this._onScroll=this._register(new je),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ik),this.rows=Math.max(e.rawOptions.rows||0,Pk),this.buffers=this._register(new SI(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Jg=pn([Ke(0,di)],Jg);var lo={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Ch,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},wI=["normal","bold","100","200","300","400","500","600","700","800","900"],kI=class extends St{constructor(e){super(),this._onOptionChange=this._register(new je),this.onOptionChange=this._onOptionChange.event;let t={...lo};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(an(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in lo))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in lo))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=lo[e]),!EI(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=lo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=wI.includes(t)?t:lo[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function EI(e){return e==="block"||e==="underline"||e==="bar"}function $l(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&$l(e[r],t-1);return n}var F1=Object.freeze({insertMode:!1}),q1=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Qg=class extends St{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new je),this.onData=this._onData.event,this._onUserInput=this._register(new je),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new je),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new je),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=$l(F1),this.decPrivateModes=$l(q1)}reset(){this.modes=$l(F1),this.decPrivateModes=$l(q1)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Qg=pn([Ke(0,hi),Ke(1,sk),Ke(2,di)],Qg);var W1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Pp(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Up=String.fromCharCode,K1={DEFAULT:e=>{let t=[Pp(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Up(t[0])}${Up(t[1])}${Up(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Pp(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Pp(e,!0)};${e.x};${e.y}${t}`}},em=class extends St{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new je),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(W1))this.addProtocol(r,W1[r]);for(let r of Object.keys(K1))this.addEncoding(r,K1[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=r+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};em=pn([Ke(0,hi),Ke(1,Ea),Ke(2,di)],em);var Hp=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],CI=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Nn;function TI(e,t){let n=0,r=t.length-1,a;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(a=n+r>>1,e>t[a][1])n=a+1;else if(e<t[a][0])r=a-1;else return!0;return!1}var MI=class{constructor(){if(this.version="6",!Nn){Nn=new Uint8Array(65536),Nn.fill(1),Nn[0]=0,Nn.fill(0,1,32),Nn.fill(0,127,160),Nn.fill(2,4352,4448),Nn[9001]=2,Nn[9002]=2,Nn.fill(2,11904,42192),Nn[12351]=1,Nn.fill(2,44032,55204),Nn.fill(2,63744,64256),Nn.fill(2,65040,65050),Nn.fill(2,65072,65136),Nn.fill(2,65280,65377),Nn.fill(2,65504,65511);for(let e=0;e<Hp.length;++e)Nn.fill(0,Hp[e][0],Hp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Nn[e]:TI(e,CI)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let a=ga.extractWidth(t);a===0?r=!1:a>n&&(n=a)}return ga.createPropertyValue(0,n,r)}},ga=class hh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new je,this.onChange=this._onChange.event;let t=new MI;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let d=t.charCodeAt(o);56320<=d&&d<=57343?c=(c-55296)*1024+d-56320+65536:n+=this.wcwidth(d)}let f=this.charProperties(c,r),p=hh.extractWidth(f);hh.extractShouldJoin(f)&&(p-=hh.extractWidth(r)),n+=p,r=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},AI=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function G1(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ll=2147483647,RI=256,Uk=class tm{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>RI)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new tm;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let a=t[r];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new tm(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ll?Ll:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ll?Ll:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-r>0&&(t[n]=this._subParams.slice(r,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,a=r[n-1];r[n-1]=~a?Math.min(a*10+t,Ll):t}},zl=[],NI=class{constructor(){this._state=0,this._active=zl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=zl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||zl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Fh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=zl,this._id=-1,this._state=0}}},ji=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Fh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Bl=[],OI=class{constructor(){this._handlers=Object.create(null),this._active=Bl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Bl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Bl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Bl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Fh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Bl,this._ident=0}},Fl=new Uk;Fl.addParam(0);var Y1=class{constructor(e){this._handler=e,this._data="",this._params=Fl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Fl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Fh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Fl,this._data="",this._hitLimit=!1,n));return this._params=Fl,this._data="",this._hitLimit=!1,t}},DI=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|r}},Ji=160,LI=(function(){let e=new DI(4095),t=Array.apply(null,Array(256)).map((f,p)=>p),n=(f,p)=>t.slice(f,p),r=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(r,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ji,0,2,0),e.add(Ji,8,5,8),e.add(Ji,6,0,6),e.add(Ji,11,0,11),e.add(Ji,13,13,13),e})(),zI=class extends St{constructor(e=LI){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Uk,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(an(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new NI),this._dcsParser=this._register(new OI),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(e,t,n){let r=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(r!==24&&r!==26,n),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],c=this._oscParser.end(r!==24&&r!==26,n),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(r=e[f],a=this._transitions.table[this.currentState<<8|(r<160?r:Ji)],a>>4){case 2:for(let y=f+1;;++y){if(y>=t||(r=e[y])<32||r>126&&r<Ji){this._printHandler(e,f,y),f=y-1;break}if(++y>=t||(r=e[y])<32||r>126&&r<Ji){this._printHandler(e,f,y),f=y-1;break}if(++y>=t||(r=e[y])<32||r>126&&r<Ji){this._printHandler(e,f,y),f=y-1;break}if(++y>=t||(r=e[y])<32||r>126&&r<Ji){this._printHandler(e,f,y),f=y-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|r],d=p?p.length-1:-1;for(;d>=0&&(c=p[d](this._params),c!==!0);d--)if(c instanceof Promise)return this._preserveStack(3,p,d,a,f),c;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++f<t&&(r=e[f])>47&&r<60);f--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],_=m?m.length-1:-1;for(;_>=0&&(c=m[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,m,_,a,f),c;_<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let y=f+1;;++y)if(y>=t||(r=e[y])===24||r===26||r===27||r>127&&r<Ji){this._dcsParser.put(e,f,y),f=y-1;break}break;case 14:if(c=this._dcsParser.unhook(r!==24&&r!==26),c)return this._preserveStack(6,[],0,a,f),c;r===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let y=f+1;;y++)if(y>=t||(r=e[y])<32||r>127&&r<Ji){this._oscParser.put(e,f,y),f=y-1;break}break;case 6:if(c=this._oscParser.end(r!==24&&r!==26),c)return this._preserveStack(5,[],0,a,f),c;r===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},BI=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,jI=/^[\da-f]+$/;function V1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=BI.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),jI.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);r[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return r}}function $p(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function II(e,t=16){let[n,r,a]=e;return`rgb:${$p(n,t)}/${$p(r,t)}/${$p(a,t)}`}var PI={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ns=131072,X1=10;function Z1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var J1=5e3,Q1=0,UI=class extends St{constructor(e,t,n,r,a,o,c,f,p=new zI){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new sB,this._utf8Decoder=new aB,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Cn.clone(),this._eraseAttrDataInternal=Cn.clone(),this._onRequestBell=this._register(new je),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new je),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new je),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new je),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new je),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new je),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new je),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new je),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new je),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new je),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new je),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new je),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new je),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new nm(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:m.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,m,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:m,data:_})}),this._parser.setDcsHandlerFallback((d,m,_)=>{m==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:m,payload:_})}),this._parser.setPrintHandler((d,m,_)=>this.print(d,m,_)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(Ce.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ce.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ce.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ce.HT,()=>this.tab()),this._parser.setExecuteHandler(Ce.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ce.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ch.IND,()=>this.index()),this._parser.setExecuteHandler(ch.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ch.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ji(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new ji(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new ji(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new ji(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new ji(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new ji(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new ji(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new ji(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new ji(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new ji(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new ji(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new ji(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in On)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Y1((d,m)=>this.requestStatusString(d,m)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),J1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${J1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ns&&(o=this._parseStack.position+Ns)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ns&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ns))),c||this._dirtyRowTracker.clearRange(),e.length>Ns)for(let d=o;d<e.length;d+=Ns){let m=d+Ns<e.length?d+Ns:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(d,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,m),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,a,_,d),this._logSlowResolvingAsync(n),n}else if(!c){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,a,d,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let r,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,m=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let y=this._parser.precedingJoinState;for(let b=t;b<n;++b){if(r=e[b],r<127&&o){let k=o[String.fromCharCode(r)];k&&(r=k.charCodeAt(0))}let w=this._unicodeService.charProperties(r,y);a=ga.extractWidth(w);let S=ga.extractShouldJoin(w),C=S?ga.extractWidth(y):0;if(y=w,c&&this._onA11yChar.fire(Ls(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-C>f){if(p){let k=_,j=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&_ instanceof Hl&&_.copyCellsFrom(k,j,0,C,!1);j<f;)k.setCellFromCodepoint(j++,0,1,m)}else if(this._activeBuffer.x=f-1,a===2)continue}if(S&&this._activeBuffer.x){let k=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-k,r,a);for(let j=a-C;--j>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(d&&(_.insertCells(this._activeBuffer.x,a-C,this._activeBuffer.getNullCell(m)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,m)),_.setCellFromCodepoint(this._activeBuffer.x++,r,a,m),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=y,this._activeBuffer.x<f&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Z1(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Y1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ji(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),r&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Cn));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=ga.extractWidth(t),a=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let d=0;d<o.length;){let m=o.codePointAt(d)||0;c[f++]=m,d+=m>65535?2:1}let p=f;for(let d=1;d<n;++d)c.copyWithin(p,0,f),p+=f;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Ce.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ce.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ce.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ce.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ce.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,fa),this._charsetService.setgCharset(1,fa),this._charsetService.setgCharset(2,fa),this._charsetService.setgCharset(3,fa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:p}=this._bufferService,{active:d,alt:m}=f,_=this._optionsService.rawOptions,y=(S,C)=>(c.triggerDataEvent(`${Ce.ESC}[${t?"":"?"}${S};${C}$y`),!0),b=S=>S?1:2,w=e.params[0];return t?w===2?y(w,4):w===4?y(w,b(c.modes.insertMode)):w===12?y(w,3):w===20?y(w,b(_.convertEol)):y(w,0):w===1?y(w,b(r.applicationCursorKeys)):w===3?y(w,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?y(w,b(r.origin)):w===7?y(w,b(r.wraparound)):w===8?y(w,3):w===9?y(w,b(a==="X10")):w===12?y(w,b(_.cursorBlink)):w===25?y(w,b(!c.isCursorHidden)):w===45?y(w,b(r.reverseWraparound)):w===66?y(w,b(r.applicationKeypad)):w===67?y(w,4):w===1e3?y(w,b(a==="VT200")):w===1002?y(w,b(a==="DRAG")):w===1003?y(w,b(a==="ANY")):w===1004?y(w,b(r.sendFocus)):w===1005?y(w,4):w===1006?y(w,b(o==="SGR")):w===1015?y(w,4):w===1016?y(w,b(o==="SGR_PIXELS")):w===1048?y(w,1):w===47||w===1047||w===1049?y(w,b(d===m)):w===2004?y(w,b(r.bracketedPasteMode)):w===2026?y(w,b(r.synchronizedOutput)):y(w,0)}_updateAttrColor(e,t,n,r,a){return t===2?(e|=50331648,e&=-16777216,e|=vc.fromColorRGB([n,r,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],a=0,o=0;do{if(r[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do r[1]===5&&(a=1),r[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<r.length);break}if(r[1]===5&&o+a>=2||r[1]===2&&o+a>=5)break;r[1]&&(a=1)}while(++o+t<e.length&&o+a<r.length);for(let c=2;c<r.length;++c)r[c]===-1&&(r[c]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Cn.fg,e.bg=Cn.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Cn.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Cn.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Cn.fg&16777215,r.bg&=-67108864,r.bg|=Cn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ce.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ce.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ce.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Cn.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Z1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Ce.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>X1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>X1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),a=n.shift();if(/^\d+$/.exec(r)){let o=parseInt(r);if(ex(o))if(a==="?")t.push({type:0,index:o});else{let c=V1(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(r=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=V1(n[r]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let a=parseInt(n[r]);ex(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,fa),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(PI[e[0]],On[e[1]]||fa),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Cn.clone(),this._eraseAttrDataInternal=Cn.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new er;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${Ce.ESC}${c}${Ce.ESC}\\`),!0),r=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},nm=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Q1=e,e=t,t=Q1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};nm=pn([Ke(0,hi)],nm);function ex(e){return 0<=e&&e<256}var HI=5e7,tx=12,$I=50,FI=class extends St{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new je),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>HI)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],a=this._action(r,t);if(a){let c=f=>performance.now()-n>=tx?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=tx)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$I&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},im=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(p,f)),this._dataByLinkId.set(p.id,p),p.id}let n=e,r=this._getEntryIdKey(n),a=this._entriesWithId.get(r);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};im=pn([Ke(0,hi)],im);var nx=!1,qI=class extends St{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new bo),this._onBinary=this._register(new je),this.onBinary=this._onBinary.event,this._onData=this._register(new je),this.onData=this._onData.event,this._onLineFeed=this._register(new je),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new je),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new je),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new je),this._instantiationService=new pI,this.optionsService=this._register(new kI(e)),this._instantiationService.setService(di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Jg)),this._instantiationService.setService(hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Zg)),this._instantiationService.setService(sk,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Qg)),this._instantiationService.setService(Ea,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(em)),this._instantiationService.setService(rk,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ga)),this._instantiationService.setService(uB,this.unicodeService),this._charsetService=this._instantiationService.createInstance(AI),this._instantiationService.setService(cB,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(im),this._instantiationService.setService(ak,this._oscLinkService),this._inputHandler=this._register(new UI(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Vn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Vn.forward(this._bufferService.onResize,this._onResize)),this._register(Vn.forward(this.coreService.onData,this._onData)),this._register(Vn.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new FI((t,n)=>this._inputHandler.parse(t,n))),this._register(Vn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new je),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!nx&&(this._logService.warn("writeSync is unreliable and will be removed soon."),nx=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Ik),t=Math.max(t,Pk),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(G1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(G1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=an(()=>{for(let t of e)t.dispose()})}}},WI={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function KI(e,t,n,r){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=Ce.ESC+"OA":a.key=Ce.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=Ce.ESC+"OD":a.key=Ce.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=Ce.ESC+"OC":a.key=Ce.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=Ce.ESC+"OB":a.key=Ce.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":Ce.DEL,e.altKey&&(a.key=Ce.ESC+a.key);break;case 9:if(e.shiftKey){a.key=Ce.ESC+"[Z";break}a.key=Ce.HT,a.cancel=!0;break;case 13:a.key=e.altKey?Ce.ESC+Ce.CR:Ce.CR,a.cancel=!0;break;case 27:a.key=Ce.ESC,e.altKey&&(a.key=Ce.ESC+Ce.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=Ce.ESC+"[1;"+(o+1)+"D":t?a.key=Ce.ESC+"OD":a.key=Ce.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=Ce.ESC+"[1;"+(o+1)+"C":t?a.key=Ce.ESC+"OC":a.key=Ce.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=Ce.ESC+"[1;"+(o+1)+"A":t?a.key=Ce.ESC+"OA":a.key=Ce.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=Ce.ESC+"[1;"+(o+1)+"B":t?a.key=Ce.ESC+"OB":a.key=Ce.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=Ce.ESC+"[2~");break;case 46:o?a.key=Ce.ESC+"[3;"+(o+1)+"~":a.key=Ce.ESC+"[3~";break;case 36:o?a.key=Ce.ESC+"[1;"+(o+1)+"H":t?a.key=Ce.ESC+"OH":a.key=Ce.ESC+"[H";break;case 35:o?a.key=Ce.ESC+"[1;"+(o+1)+"F":t?a.key=Ce.ESC+"OF":a.key=Ce.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=Ce.ESC+"[5;"+(o+1)+"~":a.key=Ce.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=Ce.ESC+"[6;"+(o+1)+"~":a.key=Ce.ESC+"[6~";break;case 112:o?a.key=Ce.ESC+"[1;"+(o+1)+"P":a.key=Ce.ESC+"OP";break;case 113:o?a.key=Ce.ESC+"[1;"+(o+1)+"Q":a.key=Ce.ESC+"OQ";break;case 114:o?a.key=Ce.ESC+"[1;"+(o+1)+"R":a.key=Ce.ESC+"OR";break;case 115:o?a.key=Ce.ESC+"[1;"+(o+1)+"S":a.key=Ce.ESC+"OS";break;case 116:o?a.key=Ce.ESC+"[15;"+(o+1)+"~":a.key=Ce.ESC+"[15~";break;case 117:o?a.key=Ce.ESC+"[17;"+(o+1)+"~":a.key=Ce.ESC+"[17~";break;case 118:o?a.key=Ce.ESC+"[18;"+(o+1)+"~":a.key=Ce.ESC+"[18~";break;case 119:o?a.key=Ce.ESC+"[19;"+(o+1)+"~":a.key=Ce.ESC+"[19~";break;case 120:o?a.key=Ce.ESC+"[20;"+(o+1)+"~":a.key=Ce.ESC+"[20~";break;case 121:o?a.key=Ce.ESC+"[21;"+(o+1)+"~":a.key=Ce.ESC+"[21~";break;case 122:o?a.key=Ce.ESC+"[23;"+(o+1)+"~":a.key=Ce.ESC+"[23~";break;case 123:o?a.key=Ce.ESC+"[24;"+(o+1)+"~":a.key=Ce.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=Ce.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=Ce.DEL:e.keyCode===219?a.key=Ce.ESC:e.keyCode===220?a.key=Ce.FS:e.keyCode===221&&(a.key=Ce.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let f=(c=WI[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=Ce.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(p);e.shiftKey&&(d=d.toUpperCase()),a.key=Ce.ESC+d}else if(e.keyCode===32)a.key=Ce.ESC+(e.ctrlKey?Ce.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),a.key=Ce.ESC+p,a.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=Ce.US),e.key==="@"&&(a.key=Ce.NUL));break}return a}var vn=0,GI=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Th,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Th,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<r.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[a]=e[t],t++):r[a]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(vn=this._search(t),vn===-1)||this._getKey(this._array[vn])!==t)return!1;do if(this._array[vn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vn),!0;while(++vn<this._array.length&&this._getKey(this._array[vn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),r=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[r++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vn=this._search(e),!(vn<0||vn>=this._array.length)&&this._getKey(this._array[vn])===e))do yield this._array[vn];while(++vn<this._array.length&&this._getKey(this._array[vn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vn=this._search(e),!(vn<0||vn>=this._array.length)&&this._getKey(this._array[vn])===e))do t(this._array[vn]);while(++vn<this._array.length&&this._getKey(this._array[vn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,a=this._getKey(this._array[r]);if(a>e)n=r-1;else if(a<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Fp=0,ix=0,YI=class extends St{constructor(){super(),this._decorations=new GI(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new je),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new je),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(an(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new VI(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,a=0;for(let o of this._decorations.getKeyIterator(t))r=o.options.x??0,a=r+(o.options.width??1),e>=r&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,a=>{Fp=a.options.x??0,ix=Fp+(a.options.width??1),e>=Fp&&e<ix&&(!n||(a.options.layer??"bottom")===n)&&r(a)})}},VI=class extends Ps{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new je),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new je),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=cn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=cn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},XI=1e3,ZI=class{constructor(e,t=XI){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=r-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},rx=20,Mh=class extends St{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ZI(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
606
|
+
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(dt(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(an(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<rx+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
607
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===rx+1&&(this._liveRegion.textContent+=wg.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",p=(n.ydisp+a+1).toString(),d=this._rowElements[a];d&&(f.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=f,this._rowColumns.set(d,c)),d.setAttribute("aria-posinset",p),d.setAttribute("aria-setsize",r),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==r)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((f=r.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:p,offset:d})=>{let m=p instanceof Text?p.parentNode:p,_=parseInt(m==null?void 0:m.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(m);if(!y)return console.warn("columns is null. Race condition?"),null;let b=d<y.length?y[d]:y.slice(-1)[0]+1;return b>=this._terminal.cols&&(++_,b=0),{row:_,column:b}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Mh=pn([Ke(1,$m),Ke(2,Jr),Ke(3,Qr)],Mh);var rm=class extends St{constructor(e,t,n,r,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new je),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new je),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(an(()=>{var o;ba(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(dt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(dt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(dt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(dt(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let a=n[r];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,a;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var d,m;if(this._isMouseOut)return;let p=f==null?void 0:f.map(_=>({link:_}));(d=this._activeProviderReplies)==null||d.set(o,p),n=this._checkLinkProviderResult(o,e,n),((m=this._activeProviderReplies)==null?void 0:m.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let a=t.get(r);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let d=f;d<=p;d++){if(n.has(d)){a.splice(o--,1);break}n.add(d)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&r){let c=r.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(p=>this._linkAtPosition(p.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&JI(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ba(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,a,o;(r=this._currentLink)!=null&&r.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(r,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,a){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:a}}};rm=pn([Ke(1,Fm),Ke(2,Qr),Ke(3,hi),Ke(4,lk)],rm);function JI(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var QI=class extends qI{constructor(e={}){super(e),this._linkifier=this._register(new bo),this.browser=Tk,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new bo),this._onCursorMove=this._register(new je),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new je),this.onKey=this._onKey.event,this._onRender=this._register(new je),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new je),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new je),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new je),this.onBell=this._onBell.event,this._onFocus=this._register(new je),this._onBlur=this._register(new je),this._onA11yCharEmitter=this._register(new je),this._onA11yTabEmitter=this._register(new je),this._onWillOpen=this._register(new je),this._setup(),this._decorationService=this._instantiationService.createInstance(YI),this._instantiationService.setService(yc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($j),this._instantiationService.setService(lk,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Eg)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Vn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Vn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Vn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Vn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(an(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let a=tn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Ce.ESC}]${r};${II(a)}${Ek.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Tn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Tn.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Mh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ce.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ce.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(dt(this.element,"copy",t=>{this.hasSelection()&&iB(t,this._selectionService)}));let e=t=>rB(t,this.textarea,this.coreService,this.optionsService);this._register(dt(this.textarea,"paste",e)),this._register(dt(this.element,"paste",e)),Mk?this._register(dt(this.element,"mousedown",t=>{t.button===2&&p1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(dt(this.element,"contextmenu",t=>{p1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Zm&&this._register(dt(this.element,"auxclick",t=>{t.button===1&&Qw(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(dt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(dt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(dt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(dt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(dt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(dt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(dt(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((a=this.element)==null?void 0:a.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(dt(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Sg.get()),Nk||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Uj,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Jr,this._coreBrowserService),this._register(dt(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(dt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Kg,this._document,this._helperContainer),this._instantiationService.setService(qh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Xg),this._instantiationService.setService(Mo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Eh),this._instantiationService.setService(ok,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Yg,this.rows,this.screenElement)),this._instantiationService.setService(Qr,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Fg,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Gg),this._instantiationService.setService(Fm,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rm,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Hg,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Vg,this.element,this.screenElement,r)),this._instantiationService.setService(dB,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Vn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance($g,this.screenElement)),this._register(dt(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Mh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Wg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var d,m,_,y,b;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,f=o.button<3?o.button:3;break;case"mousedown":p=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(y=(_=(m=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:m.device)==null?void 0:_.cell)==null?void 0:y.height,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;p=w<0?0:1,f=4;break;default:return!1}return p===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(t.addEventListener("mousemove",a.mousemove),r.mousemove=a.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),r.wheel=a.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(dt(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(dt(t,"wheel",o=>{var c,f,p,d,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(d=(p=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:p.cell)==null?void 0:d.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(o,!0);let _=Ce.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Jw(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=KI(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Ce.ETX||n.key===Ce.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(e5(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Cn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(Ce.ESC+"[I"):this.coreService.triggerDataEvent(Ce.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Ce.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Ce.ESC}[6;${a};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function e5(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var t5=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},n5=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new er)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},sx=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new n5(t)}getNullCell(){return new er}},i5=class extends St{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new je),this.onBufferChange=this._onBufferChange.event,this._normal=new sx(this._core.buffers.normal,"normal"),this._alternate=new sx(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},r5=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},s5=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},a5=["cols","rows"],yr=0,o5=class extends St{constructor(e){super(),this._core=this._register(new QI(e)),this._addonManager=this._register(new t5),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(e){if(a5.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new r5(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new s5(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new i5(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
608
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Sg.get()},set promptLabel(e){Sg.set(e)},get tooMuchOutput(){return wg.get()},set tooMuchOutput(e){wg.set(e)}}}_verifyIntegers(...e){for(yr of e)if(yr===1/0||isNaN(yr)||yr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(yr of e)if(yr&&(yr===1/0||isNaN(yr)||yr%1!==0||yr<0))throw new Error("This API only accepts positive integers")}};/**
|
|
609
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
610
|
+
* @license MIT
|
|
611
|
+
*
|
|
612
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
613
|
+
* @license MIT
|
|
614
|
+
*
|
|
615
|
+
* Originally forked from (with the author's permission):
|
|
616
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
617
|
+
* http://bellard.org/jslinux/
|
|
618
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
619
|
+
*/var l5=2,c5=1,u5=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var _;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,p=c.right+c.left,d=r-f,m=a-p-t;return{cols:Math.max(l5,Math.floor(m/e.css.cell.width)),rows:Math.max(c5,Math.floor(d/e.css.cell.height))}}};const ax=6e4,h5=1e4,d5=15e3;function Hk({attachPath:e,busyLabel:t="terminal"}){const n=x.useRef(null),[r,a]=x.useState("connecting"),[o,c]=x.useState(null);return x.useEffect(()=>{const f=n.current;if(!f)return;const p=new o5({fontFamily:'"JetBrains Mono", "SF Mono", Menlo, monospace',fontSize:13,lineHeight:1.2,cursorBlink:!0,theme:{background:"#0a0e15",foreground:"#e7ecf2",cursor:"#5cf2d6",selectionBackground:"#3a4250"},scrollback:5e3,allowProposedApi:!0}),d=new u5;p.loadAddon(d),p.open(f),d.fit();const _=`${window.location.origin.replace(/^http/,"ws")}${e}`;let y=null,b=!1,w=null,S=0,C=0,k=!1;function j(){if(!(!y||y.readyState!==WebSocket.OPEN))try{y.send(JSON.stringify({type:"resize",cols:p.cols,rows:p.rows}))}catch{}}function R(){if(b||w)return;k||(k=!0,p.write(`\r
|
|
620
|
+
\x1B[33m[somora] ${t} connection lost — reconnecting…\x1B[0m\r
|
|
621
|
+
`)),a("reconnecting");const D=Math.min(1e3*2**S,d5);S+=1,w=setTimeout(()=>{w=null,q()},D)}function L(){if(b)return;const D=y;if(y=null,D){D.onopen=D.onmessage=D.onclose=D.onerror=null;try{D.close()}catch{}}R()}function q(){if(b)return;const D=new WebSocket(_);D.binaryType="arraybuffer",y=D,D.onopen=()=>{b||y!==D||(S=0,k=!1,C=Date.now(),a("open"),c(null),j())},D.onmessage=A=>{if(y!==D)return;C=Date.now();const M=A.data;if(M instanceof ArrayBuffer)p.write(new Uint8Array(M));else if(typeof M=="string"){try{const P=JSON.parse(M);if(P.type==="ping")try{D.send('{"type":"pong"}')}catch{}if(typeof P.type=="string")return}catch{}p.write(M)}},D.onclose=A=>{if(!(b||y!==D)){if(y=null,A.code===1e3||A.code===1008||A.code===1011){a("closed"),c(A.reason||`code ${A.code}`),p.write(`\r
|
|
622
|
+
\x1B[33m[somora] ${t} closed: ${A.reason||`code ${A.code}`}\x1B[0m\r
|
|
623
|
+
`);return}R()}},D.onerror=()=>{b||y!==D||c("connection failed")}}const O=setInterval(()=>{b||!y||y.readyState!==WebSocket.OPEN||Date.now()-C>ax&&L()},h5);function z(){document.visibilityState!=="visible"||b||y&&y.readyState===WebSocket.OPEN&&Date.now()-C<=ax||(w&&(clearTimeout(w),w=null),L())}document.addEventListener("visibilitychange",z),q();const J=p.onData(D=>{if(!(!y||y.readyState!==WebSocket.OPEN))try{y.send(new TextEncoder().encode(D))}catch{}}),ie=new ResizeObserver(()=>{try{d.fit(),j()}catch{}});return ie.observe(f),p.focus(),()=>{b=!0,document.removeEventListener("visibilitychange",z),clearInterval(O),w&&clearTimeout(w),ie.disconnect(),J.dispose();try{y==null||y.close()}catch{}p.dispose()}},[e,t]),h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#0a0e15",position:"relative"},children:[h.jsx("div",{ref:n,style:{flex:1,minHeight:0,minWidth:0,padding:6}}),r!=="open"&&h.jsxs("div",{style:{position:"absolute",top:8,right:12,fontFamily:'"JetBrains Mono", monospace',fontSize:10,padding:"2px 6px",borderRadius:3,background:r==="error"||r==="closed"?"var(--danger)":"var(--bg-3)",color:r==="error"||r==="closed"?"#fff":"var(--text-2)",border:"1px solid var(--line-2)",pointerEvents:"none"},children:[r,o?` · ${o}`:""]})]})}function f5({tmuxName:e}){return h.jsx(Hk,{attachPath:`/tmux/attach?session=${encodeURIComponent(e)}`,busyLabel:"tmux attach"})}function $k(e){if(e.state==="stopped")return{text:"stopped",tone:"muted"};switch(e.control){case"handoff_requested":return{text:"waiting for you",tone:"warn"};case"human_control":return{text:"human controls",tone:"info"};case"paused":return{text:"paused",tone:"muted"};default:return{text:"agent controls",tone:"ok"}}}function Jm(e){return e.ephemeral?`${e.agent} (temporary)`:e.agent}function Fk(e){return e.browser_id.startsWith("profile:")?`shared profile ${e.profile}`:"own profile"}const ox={ok:"var(--ok, #3fb950)",warn:"var(--warn, #d29922)",info:"var(--accent, #58a6ff)",muted:"var(--text-3)"};function p5({onOpen:e}){const t=Nh(),n=t.loaded?t.browsers:null,r=t.warnings??[],[a,o]=x.useState(null),[c,f]=x.useState(null),p=t.refresh,d=async m=>{f(m.view_id),o(null);try{m.state==="stopped"&&await Me.browserRestart(m.view_id),e(m.view_id,Jm(m))}catch(_){o(_.message)}finally{f(null)}};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:'"JetBrains Mono", monospace'},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:"1px solid var(--line)",fontSize:11,color:"var(--text-2)"},children:[h.jsx("span",{children:n===null?"loading…":n.length===0?"no browser running — an agent starts one with the browser tool":`${n.length} browser session${n.length===1?"":"s"}`}),h.jsx("button",{type:"button",onClick:()=>void p(),title:"refresh",style:{all:"unset",cursor:"pointer",color:"var(--text-3)",display:"inline-flex",alignItems:"center",gap:4},children:h.jsx(tr,{size:11})})]}),!t.connected&&h.jsx("div",{role:"status",style:{padding:12,fontSize:11,color:"var(--text-3)"},children:"Reconnecting to browser status…"}),a&&h.jsx("div",{style:{padding:12,color:"var(--danger, #f85149)",fontSize:11},children:a}),r.map(m=>h.jsx("div",{style:{padding:"8px 12px",color:"var(--warn, #d29922)",fontSize:11,borderBottom:"1px solid var(--line)"},children:m},m)),h.jsx("div",{style:{flex:1,overflowY:"auto",padding:6},children:(n??[]).map(m=>h.jsx(g5,{browser:m,busy:c!==null,opening:c===m.view_id,disabled:!t.connected,onOpen:()=>void d(m)},m.view_id))})]})}function g5({browser:e,busy:t,opening:n,disabled:r,onOpen:a}){const o=$k(e),c=e.tabs[0],f=n?"opening…":e.state==="stopped"?"stopped · reopen":o.text;return h.jsxs("div",{onClick:r||t?void 0:a,title:`open ${e.view_id}`,style:{cursor:r||t?"default":"pointer",padding:"8px 10px",borderRadius:4,marginBottom:4,background:"var(--bg-3)",border:"1px solid var(--line-2)",display:"flex",flexDirection:"column",gap:4,opacity:e.state==="running"?1:.6},onMouseEnter:p=>{p.currentTarget.style.background="var(--bg-2)"},onMouseLeave:p=>{p.currentTarget.style.background="var(--bg-3)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx(Oh,{size:12,style:{color:ox[o.tone]}}),h.jsx("span",{style:{color:"var(--text-1)",fontSize:12,fontWeight:600},children:Jm(e)}),h.jsxs("span",{style:{color:"var(--text-3)",fontSize:10},children:["· ",e.tabs.length," tab",e.tabs.length===1?"":"s"]}),h.jsx("span",{style:{marginLeft:"auto",color:ox[o.tone],fontSize:10,whiteSpace:"nowrap"},children:f})]}),h.jsxs("div",{style:{fontSize:10,color:"var(--text-3)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["↳ ",Fk(e),c?` · ${c.title||c.url}`:"",e.handoff?` · ${e.handoff.reason}`:""]})]})}const m5=[{value:20,label:"debug"},{value:30,label:"info"},{value:40,label:"warn"},{value:50,label:"error"}],_5=2e3;function v5(e){return e>=60?"fatal":e>=50?"error":e>=40?"warn":e>=30?"info":e>=20?"debug":"trace"}function y5(e){return e>=50?"var(--danger, #f85149)":e>=40?"var(--warn, #d29922)":e>=30?"var(--text-1)":"var(--text-3)"}function b5(e){const t=new Date(e),n=r=>String(r).padStart(2,"0");return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function x5(e){const t=new Set(["pid","hostname","time","level","msg","agent","session"]),n=[];for(const[r,a]of Object.entries(e)){if(t.has(r)||a===void 0||a===null)continue;const o=typeof a=="string"?a:JSON.stringify(a);if(n.push(`${r}=${o.length>120?`${o.slice(0,120)}…`:o}`),n.length>=8)break}return n.join(" ")}function S5(){const[e,t]=x.useState([]),[n,r]=x.useState([]),[a,o]=x.useState(""),[c,f]=x.useState(30),[p,d]=x.useState(""),[m,_]=x.useState(!0),[y,b]=x.useState(null),[w,S]=x.useState(!0),C=x.useRef(0),k=x.useRef(null),j=x.useRef(!0),R=x.useCallback(()=>({...a?{day:a}:{},minLevel:c,...p.trim()?{q:p.trim()}:{}}),[a,c,p]),L=x.useCallback(async()=>{S(!0);try{const z=await Me.logs({...R(),limit:500});t(z.lines),r(z.days),C.current=z.offset,!a&&z.day&&o(z.day),b(null)}catch(z){b(z.message)}finally{S(!1)}},[R,a]);x.useEffect(()=>{L()},[L]),x.useEffect(()=>{if(!m)return;let z=!0;const J=setInterval(()=>{Me.logsSince(C.current,R()).then(ie=>{z&&(C.current=ie.offset,ie.lines.length!==0&&t(D=>[...D,...ie.lines].slice(-2e3)))}).catch(()=>{})},_5);return()=>{z=!1,clearInterval(J)}},[m,R]),x.useEffect(()=>{const z=k.current;!z||!j.current||(z.scrollTop=z.scrollHeight)},[e]);const q=()=>{const z=k.current;z&&(j.current=z.scrollHeight-z.scrollTop-z.clientHeight<40)},O={background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:4,color:"var(--text-1)",fontSize:11,padding:"2px 6px",fontFamily:"inherit"};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:'"JetBrains Mono", monospace'},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 12px",borderBottom:"1px solid var(--line)",fontSize:11,color:"var(--text-2)",flexWrap:"wrap"},children:[h.jsxs("select",{value:a,onChange:z=>o(z.target.value),style:O,title:"which day",children:[n.length===0&&h.jsx("option",{value:"",children:"no log yet"}),n.map(z=>h.jsx("option",{value:z,children:z},z))]}),h.jsx("select",{value:c,onChange:z=>f(Number(z.target.value)),style:O,title:"minimum level",children:m5.map(z=>h.jsxs("option",{value:z.value,children:[z.label," and up"]},z.value))}),h.jsx("input",{value:p,onChange:z=>d(z.target.value),placeholder:"filter text (agent, tool, error…)",style:{...O,flex:1,minWidth:120}}),h.jsxs("button",{type:"button",onClick:()=>_(z=>!z),style:{...O,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4},title:m?"stop following new lines":"follow new lines",children:[m?h.jsx(Lh,{size:11}):h.jsx(zh,{size:11}),m?"following":"paused"]}),h.jsx("button",{type:"button",onClick:()=>void L(),style:{...O,cursor:"pointer",display:"inline-flex"},title:"reload",children:h.jsx(tr,{size:11})})]}),y&&h.jsx("div",{style:{padding:12,color:"var(--danger, #f85149)",fontSize:11},children:y}),h.jsx("div",{ref:k,onScroll:q,style:{flex:1,overflow:"auto",padding:"6px 8px"},children:w&&e.length===0?h.jsx("div",{style:{color:"var(--text-3)",fontSize:11,padding:16,textAlign:"center"},children:"loading…"}):e.length===0?h.jsx("div",{style:{color:"var(--text-3)",fontSize:11,padding:16,textAlign:"center"},children:"nothing matches — try a lower level or clear the filter"}):e.map((z,J)=>h.jsxs("div",{style:{display:"flex",gap:8,fontSize:10,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[h.jsx("span",{style:{color:"var(--text-3)"},children:b5(z.ts)}),h.jsx("span",{style:{color:y5(z.level),width:38,flexShrink:0},children:v5(z.level)}),z.agent&&h.jsx("span",{style:{color:"var(--accent, #58a6ff)"},children:z.agent}),h.jsx("span",{style:{color:"var(--text-1)"},children:z.msg}),h.jsx("span",{style:{color:"var(--text-3)"},children:x5(z.fields)})]},`${z.ts}-${J}`))})]})}const w5=250,k5=8e4;function E5({viewId:e}){const[t,n]=x.useState("connecting"),[r,a]=x.useState(null),[o,c]=x.useState(null),[f,p]=x.useState(null),[d]=x.useState(()=>`v-${Math.random().toString(36).slice(2,8)}`),[m,_]=x.useState(""),[y,b]=x.useState(null),[w,S]=x.useState(null),C=x.useRef(null),k=x.useRef(null),j=x.useRef(null),R=x.useRef(null),L=x.useRef(null),q=x.useRef(null),O=x.useRef(null),z=x.useRef(0),J=t==="open"&&(o==null?void 0:o.control)==="human_control"&&o.human_by===d,ie=x.useCallback(F=>{const Y=C.current;if(!Y||Y.readyState!==WebSocket.OPEN)return;const Z=L.current;Y.send(JSON.stringify({...Z?{frameTab:Z.tabId,generation:Z.generation}:{},...F}))},[]);x.useEffect(()=>{let F=!1,Y=null,Z=null,ve=0,Oe=Date.now();const _e=window.location.origin.replace(/^http/,"ws");function Fe(){if(F||Z)return;const pe=Math.min(15e3,500*2**Math.min(ve,5));ve++,n("connecting"),Z=setTimeout(()=>{Z=null,st()},pe)}function st(){if(F)return;const pe=O.current,Xe=pe?`&tab=${encodeURIComponent(pe)}`:"";L.current=null,b(null);const nt=new WebSocket(`${_e}/browser/attach?view=${encodeURIComponent(e)}${Xe}&viewer=${d}`);nt.binaryType="arraybuffer",Y=nt,C.current=nt,nt.onopen=()=>{F||Y!==nt||(ve=0,Oe=Date.now(),n("open"),a(null))},nt.onmessage=Pe=>{if(Y!==nt)return;if(Oe=Date.now(),Pe.data instanceof ArrayBuffer){try{if(Pe.data.byteLength<4)return;const ce=new DataView(Pe.data).getUint32(0);if(ce>65536||ce+4>=Pe.data.byteLength)return;const X=JSON.parse(new TextDecoder().decode(new Uint8Array(Pe.data,4,ce)));if(O.current&&X.tabId!==O.current||X.generation<z.current||X.cssWidth<=0||X.cssHeight<=0)return;const fe=new Blob([new Uint8Array(Pe.data,4+ce)],{type:"image/jpeg"}),Le=URL.createObjectURL(fe);q.current&&URL.revokeObjectURL(q.current),q.current=Le,L.current=X,b({url:Le,meta:X})}catch{}return}if(typeof Pe.data!="string")return;let at;try{at=JSON.parse(Pe.data)}catch{return}if(at.type==="ping"){nt.send('{"type":"pong"}');return}if(at.type==="ready"||at.type==="tabs"){const V=at.browser;c(V),typeof at.tabId=="string"&&(O.current=at.tabId,p(at.tabId));const ce=V.tabs.find(X=>X.tab_id===O.current);z.current=(ce==null?void 0:ce.generation)??0,L.current&&(L.current.tabId!==O.current||L.current.generation<z.current)&&(L.current=null,b(null));return}if(at.type==="control"){const V=at.control;c(ce=>ce&&{...ce,control:V.mode,human_by:V.humanBy,handoff:V.handoff});return}(at.type==="notice"||at.type==="error")&&(S(String(at.text??"")),setTimeout(()=>S(null),4e3))},nt.onclose=Pe=>{if(!(F||Y!==nt)){if(Y=null,C.current=null,Pe.code===1008||Pe.code===4001){O.current=null,L.current=null,n("closed"),a(Pe.reason||`code ${Pe.code}`);return}Fe()}},nt.onerror=()=>{F||Y!==nt||a("connection failed")}}st();const ae=setInterval(()=>{if(Y&&Date.now()-Oe>k5){const pe=Y;Y=null,C.current=null,pe.onopen=pe.onmessage=pe.onclose=pe.onerror=null;try{pe.close()}catch{}Fe()}},1e4);return()=>{F=!0,clearInterval(ae),Z&&clearTimeout(Z);const pe=Y;if(Y=null,C.current=null,pe){pe.onopen=pe.onmessage=pe.onclose=pe.onerror=null;try{pe.close()}catch{}}q.current&&URL.revokeObjectURL(q.current)}},[e,d]);const D=x.useRef(!1);x.useEffect(()=>{if(D.current)return;const F=o==null?void 0:o.tabs.find(Y=>Y.tab_id===f);F&&_(F.url)},[o,f]),x.useEffect(()=>{const F=k.current;if(!F)return;let Y=null;const Z=new ResizeObserver(()=>{J&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{const ve=F.getBoundingClientRect();ve.width>100&&ve.height>100&&ie({type:"resize",width:Math.round(ve.width),height:Math.round(ve.height)})},w5))});return Z.observe(F),()=>{Z.disconnect(),Y&&clearTimeout(Y)}},[J,ie]);const A=x.useCallback(F=>{const Y=j.current,Z=L.current;if(!Y||!Z)return null;const ve=Y.getBoundingClientRect();if(ve.width===0||ve.height===0)return null;const Oe=(F.clientX-ve.left)/ve.width*Z.cssWidth,_e=(F.clientY-ve.top)/ve.height*Z.cssHeight;return Oe<0||_e<0||Oe>Z.cssWidth||_e>Z.cssHeight?null:{x:Math.round(Oe),y:Math.round(_e)}},[]),M=F=>{var Z;if((Z=R.current)==null||Z.focus(),!J)return;const Y=A(F);Y&&ie({type:"click",...Y,button:F.button===2?"right":"left",clickCount:F.detail||1})},P=F=>{if(!J)return;const Y=A(F);Y&&ie({type:"mousemove",...Y})},G=x.useRef(0),H=F=>{if(!J)return;F.preventDefault();const Y=Date.now();if(Y-G.current<40)return;G.current=Y;const Z=A(F)??{x:10,y:10};ie({type:"wheel",...Z,deltaX:Math.round(F.deltaX),deltaY:Math.round(F.deltaY)})},N=x.useRef(!1),$=F=>{if(!J||N.current)return;const Y=F.key;Y.length===1&&!F.ctrlKey&&!F.metaKey&&!F.altKey||(F.ctrlKey||F.metaKey)&&Y.toLowerCase()==="v"||Y==="Unidentified"||Y==="Dead"||Y==="Process"||(F.preventDefault(),ie({type:"key",key:Y,ctrl:F.ctrlKey,alt:F.altKey,shift:F.shiftKey,meta:F.metaKey}))},K=F=>{const Y=F.currentTarget;if(N.current)return;const Z=Y.value;Y.value="",!(!J||!Z)&&ie({type:"text",text:Z})},re=F=>{if(!J)return;F.preventDefault();const Y=F.clipboardData.getData("text");Y&&ie({type:"text",text:Y})},U=()=>{var F;ie({type:"control",mode:"human"}),(F=R.current)==null||F.focus()},W=()=>{var F;return ie({type:"control",mode:"agent",handoffId:(F=o==null?void 0:o.handoff)==null?void 0:F.id})},I=o?$k(o):null,E=(o==null?void 0:o.tabs)??[];return h.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1 1 auto",height:"100%",minHeight:0,background:"var(--bg-2)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 10px",borderBottom:"1px solid var(--line)",fontSize:11,fontFamily:'"JetBrains Mono", monospace'},children:[h.jsx("span",{style:{color:"var(--text-2)"},children:o?`${Jm(o)} · ${Fk(o)}`:e}),I&&h.jsxs("span",{style:{color:I.tone==="warn"?"var(--warn, #d29922)":I.tone==="info"?"var(--accent, #58a6ff)":"var(--text-3)"},children:["· ",J?"you control":I.text]}),(o==null?void 0:o.handoff)&&o.control!=="human_control"&&h.jsxs("span",{style:{color:"var(--warn, #d29922)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:360},title:o.handoff.reason,children:[o.handoff.agent,": ",o.handoff.reason]}),h.jsx("span",{style:{flex:1}}),h.jsx("span",{style:{color:t==="open"?"var(--ok, #3fb950)":"var(--text-3)"},children:t==="open"?"● live":t==="connecting"?"○ connecting…":`○ ${r??"closed"}`}),J?h.jsxs("button",{type:"button",onClick:W,className:"browser-btn browser-btn-primary",title:"Give control back to the agent (wakes it if it asked for you or if you changed something)",children:[h.jsx(Wb,{size:12})," Hand back"]}):h.jsxs("button",{type:"button",disabled:t!=="open",onClick:U,className:"browser-btn",title:"Take control: your clicks and typing go to the page; the agent is paused",children:[h.jsx(Wb,{size:12})," Take over"]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--line)",overflowX:"auto",fontSize:11},children:[E.map(F=>h.jsxs("span",{className:`browser-tab${F.tab_id===f?" active":""}`,onClick:()=>{L.current=null,b(null),O.current=F.tab_id,z.current=F.generation,ie({type:"tab",tabId:F.tab_id})},title:F.url,children:[h.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:160},children:F.title||F.url||"about:blank"}),J&&h.jsx(gh,{size:11,style:{marginLeft:4,opacity:.6},onClick:Y=>{Y.stopPropagation(),ie({type:"closetab",tabId:F.tab_id})}})]},F.tab_id)),J&&h.jsx("button",{type:"button",className:"browser-btn",onClick:()=>ie({type:"newtab"}),title:"New tab",style:{padding:"2px 6px"},children:h.jsx(Bh,{size:12})})]}),h.jsxs("form",{onSubmit:F=>{if(F.preventDefault(),D.current=!1,!J){S("Take over the browser first to navigate.");return}const Y=/^[a-z]+:\/\//i.test(m)?m:`https://${m}`;ie({type:"navigate",url:Y})},style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--line)"},children:[h.jsx("button",{type:"button",className:"browser-btn",disabled:!J,onClick:()=>ie({type:"back"}),title:"Back",children:h.jsx(L2,{size:13})}),h.jsx("button",{type:"button",className:"browser-btn",disabled:!J,onClick:()=>ie({type:"forward"}),title:"Forward",children:h.jsx(z2,{size:13})}),h.jsx("button",{type:"button",className:"browser-btn",disabled:!J,onClick:()=>ie({type:"reload"}),title:"Reload",children:h.jsx(hT,{size:13})}),h.jsx("input",{value:m,onChange:F=>{D.current=!0,_(F.target.value)},onBlur:()=>{D.current=!1},readOnly:!J,spellCheck:!1,style:{flex:1,font:'12px "JetBrains Mono", monospace',padding:"4px 8px",border:"1px solid var(--line)",borderRadius:4,background:"var(--bg-1)",color:"var(--text-1)"}})]}),h.jsxs("div",{ref:k,className:`browser-stage${J?" controlling":""}`,onClick:M,onContextMenu:F=>F.preventDefault(),onMouseMove:P,onWheel:H,children:[y?h.jsx("img",{ref:j,src:y.url,alt:"",draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}}):h.jsx("div",{style:{color:"var(--text-3)",fontSize:12,padding:20},children:t==="closed"?r??"closed":"waiting for the first frame…"}),h.jsx("textarea",{ref:R,onKeyDown:$,onInput:K,onPaste:re,onCompositionStart:()=>{N.current=!0},onCompositionEnd:F=>{N.current=!1;const Y=F.currentTarget.value;F.currentTarget.value="",J&&Y&&ie({type:"text",text:Y})},"aria-label":"browser keyboard input",style:{position:"absolute",left:-9999,top:0,width:1,height:1,opacity:0}}),w&&h.jsx("div",{className:"browser-notice",children:w})]}),h.jsxs("div",{style:{padding:"3px 10px",borderTop:"1px solid var(--line)",fontSize:10,color:"var(--text-3)",fontFamily:'"JetBrains Mono", monospace',display:"flex",gap:12},children:[h.jsx("span",{children:f??"–"}),y&&h.jsxs("span",{children:[y.meta.cssWidth,"×",y.meta.cssHeight," · gen ",y.meta.generation," · #",y.meta.seq]}),h.jsx("span",{style:{flex:1}}),h.jsx("span",{children:J?"you control · click the picture, type, paste":"watching · take over to interact"})]})]})}function C5(){return h.jsx(Hk,{attachPath:"/terminal/attach",busyLabel:"shell"})}const T5={rem:"var(--dream-rem)",deep:"var(--dream-deep)",lucid:"var(--dream-lucid)"};function qp({phase:e,size:t=12,title:n}){const r=T5[e],a=e==="rem"?hm:e==="deep"?Z2:dT;return h.jsx("span",{title:n,style:{display:"inline-flex",alignItems:"center",color:r},children:h.jsx(a,{size:t})})}function M5({onOpenChat:e}){const[t,n]=x.useState([]),[r,a]=x.useState(!0),[o,c]=x.useState(null),[f,p]=x.useState("active"),[d,m]=x.useState(""),[_,y]=x.useState(new Set),[b,w]=x.useState(new Set),[S,C]=x.useState(new Set),[k,j]=x.useState("lastActivity"),[R,L]=x.useState("desc"),[q,O]=x.useState(new Set),[z,J]=x.useState(!0),{projectsEnabled:ie}=So(),[D,A]=x.useState({});x.useEffect(()=>{ie&&Me.projects(!0).then(E=>{const F={};for(const Y of E)F[Y.slug]=Y;A(F)}).catch(()=>{})},[ie]);const M=x.useCallback(async E=>{c(null);try{const F=await Me.globalSessions({includeArchived:!0,...E?{signal:E}:{}});n(F),a(!1)}catch(F){if(F.name==="AbortError")return;c(F.message),a(!1)}},[]);x.useEffect(()=>{const E=new AbortController;return M(E.signal),()=>E.abort()},[M]),x.useEffect(()=>{if(!z)return;const E=setInterval(()=>void M(),6e4);return()=>clearInterval(E)},[z,M]);const P=x.useMemo(()=>{const E=new Set;for(const F of t)E.add(F.agent);return[...E].sort()},[t]),G=x.useMemo(()=>{const E=new Set;for(const F of t)F.engine&&E.add(F.engine);return[...E].sort()},[t]),H=fS(),N=x.useMemo(()=>H?t.map(E=>{const F=H.marks[`${E.agent}::${E.sessionId}`];return F?{...E,unreadAt:F.unreadAt??E.unreadAt??null,seenAt:F.seenAt??E.seenAt??null}:E}):t,[t,H]),$=x.useMemo(()=>{let E=N;if(f==="active"?E=E.filter(Y=>!Y.isArchived):f==="archived"&&(E=E.filter(Y=>Y.isArchived)),_.size>0&&(E=E.filter(Y=>_.has(Y.agent))),b.size>0&&(E=E.filter(Y=>Y.engine&&b.has(Y.engine))),S.size>0&&(E=E.filter(Y=>S.has(Y.dream.status))),d.trim()){const Y=d.trim().toLowerCase();E=E.filter(Z=>Z.slug.toLowerCase().includes(Y)||Z.agent.toLowerCase().includes(Y)||Z.sessionId.toLowerCase().includes(Y))}return[...E].sort((Y,Z)=>{const ve=R==="asc"?1:-1;switch(k){case"lastActivity":return ve*(Y.lastActivity??"").localeCompare(Z.lastActivity??"");case"messageCount":return ve*(Y.messageCount-Z.messageCount);case"byteSize":return ve*(Y.byteSize-Z.byteSize);case"agent":return ve*Y.agent.localeCompare(Z.agent)}})},[N,f,_,b,S,d,k,R]),K=x.useMemo(()=>{const E=t.length,F=t.filter(Oe=>Oe.liveSubscribers>0).length,Y=t.filter(Oe=>Oe.isArchived).length,Z=t.filter(Oe=>Oe.dream.status==="dreamed").length,ve=t.filter(Oe=>Oe.dream.status==="partial").length;return{all:E,live:F,archived:Y,dreamed:Z,partial:ve}},[t]),re=(E,F)=>{const Y=new Set(E);return Y.has(F)?Y.delete(F):Y.add(F),Y},U=x.useCallback(async E=>{try{if(E.isArchived)await Me.unarchiveSession(E.agent,E.sessionId);else{if(E.isMain){alert("Can't archive a 'main' session directly. Use /reset to spawn an archived copy.");return}await Me.archiveSession(E.agent,E.sessionId)}await M()}catch(F){console.error("[somora-web] (un)archive failed",F),c(F.message)}},[M]),W=x.useCallback(async()=>{const E=$.filter(F=>q.has(Zu(F))&&!F.isMain);for(const F of E)try{F.isArchived?await Me.unarchiveSession(F.agent,F.sessionId):await Me.archiveSession(F.agent,F.sessionId)}catch(Y){console.warn("[somora-web] bulk archive skipped",F.agent,F.sessionId,Y)}O(new Set),await M()},[$,q,M]),I=$.length>0&&$.every(E=>q.has(Zu(E)));return h.jsxs("div",{style:{padding:12,fontFamily:'"JetBrains Mono", monospace',fontSize:12,color:"var(--text-1)",height:"100%",display:"flex",flexDirection:"column",minHeight:0},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8,flexWrap:"wrap"},children:[h.jsx("div",{style:{fontWeight:600,fontSize:14},children:"Sessions"}),h.jsxs("div",{style:{color:"var(--text-2)"},children:[K.all," total · ",K.live," live · ",K.archived," archived · ",K.dreamed," dreamed · ",K.partial," partial"]}),h.jsx("div",{style:{flex:1}}),h.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,color:"var(--text-2)"},children:[h.jsx("input",{type:"checkbox",checked:z,onChange:E=>J(E.target.checked)}),"auto 60s"]}),h.jsx("button",{type:"button",className:"chat-icon-btn",title:"Reload",onClick:()=>void M(),children:h.jsx(tr,{size:14})})]}),h.jsx("div",{style:{display:"flex",gap:4,marginBottom:8},children:["active","archived","all"].map(E=>h.jsx("button",{type:"button",onClick:()=>p(E),style:{padding:"4px 10px",border:"1px solid var(--bg-3)",background:f===E?"var(--bg-3)":"transparent",color:f===E?"var(--text-1)":"var(--text-2)",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:E==="active"?`Active (${t.filter(F=>!F.isArchived).length})`:E==="archived"?`Archived (${K.archived})`:`All (${t.length})`},E))}),h.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[h.jsx("input",{type:"text",placeholder:"search slug / agent / id",value:d,onChange:E=>m(E.target.value),style:{padding:"4px 8px",background:"var(--bg-2)",border:"1px solid var(--bg-3)",color:"var(--text-1)",fontFamily:"inherit",fontSize:11,minWidth:200}}),h.jsx(Wp,{label:"agent",options:P,selected:_,onToggle:E=>y(F=>re(F,E))}),G.length>0&&h.jsx(Wp,{label:"engine",options:G,selected:b,onToggle:E=>w(F=>re(F,E))}),h.jsx(Wp,{label:"REM",options:["dreamed","partial","never"],selected:S,onToggle:E=>C(F=>re(F,E))})]}),q.size>0&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"var(--bg-2)",border:"1px solid var(--accent)",marginBottom:8},children:[h.jsxs("span",{children:[q.size," selected"]}),h.jsx("button",{type:"button",onClick:()=>void W(),style:{padding:"4px 10px",background:"var(--accent)",color:"var(--bg-1)",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:f==="archived"?"Unarchive selected":"Archive selected"}),h.jsx("button",{type:"button",onClick:()=>O(new Set),style:{padding:"4px 10px",background:"transparent",color:"var(--text-2)",border:"1px solid var(--bg-3)",cursor:"pointer",fontFamily:"inherit",fontSize:11},children:"Clear"})]}),o&&h.jsxs("div",{style:{color:"var(--warn)",padding:8,marginBottom:8},children:["Error: ",o]}),r?h.jsx("div",{style:{color:"var(--text-2)",padding:8},children:"Loading…"}):$.length===0?h.jsx("div",{style:{color:"var(--text-2)",padding:8},children:"No sessions match."}):h.jsx("div",{style:{overflow:"auto",flex:1,minHeight:0},children:h.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[h.jsx("thead",{children:h.jsxs("tr",{style:{color:"var(--text-2)",textAlign:"left"},children:[h.jsx("th",{style:Ds,children:h.jsx("input",{type:"checkbox",checked:I,onChange:E=>{E.target.checked?O(new Set($.filter(F=>!F.isMain).map(Zu))):O(new Set)}})}),h.jsx(Qu,{label:"Agent",onClick:()=>Ju(j,L,k,R,"agent"),active:k==="agent",dir:R}),h.jsx("th",{style:Ds,children:"Slug"}),ie&&h.jsx("th",{style:Ds,children:"Project"}),h.jsx("th",{style:Ds,children:"Engine"}),h.jsx("th",{style:Ds,children:"Status"}),h.jsx(Qu,{label:"Last activity",onClick:()=>Ju(j,L,k,R,"lastActivity"),active:k==="lastActivity",dir:R}),h.jsx(Qu,{label:"Msgs",onClick:()=>Ju(j,L,k,R,"messageCount"),active:k==="messageCount",dir:R}),h.jsx(Qu,{label:"Size",onClick:()=>Ju(j,L,k,R,"byteSize"),active:k==="byteSize",dir:R}),h.jsx("th",{style:Ds,children:"REM"}),h.jsx("th",{style:Ds})]})}),h.jsx("tbody",{children:$.map(E=>{const F=Zu(E),Y=q.has(F);return h.jsxs("tr",{style:{borderTop:"1px solid var(--bg-3)",background:Y?"var(--bg-2)":"transparent",cursor:"pointer"},onClick:Z=>{Z.target.closest("input,button")||e({agent:E.agent,sessionId:E.sessionId,agentLabel:`${E.agent} · ${E.slug}`})},children:[h.jsx("td",{style:or,onClick:Z=>Z.stopPropagation(),children:!E.isMain&&h.jsx("input",{type:"checkbox",checked:Y,onChange:()=>O(Z=>re(Z,F))})}),h.jsxs("td",{style:{...or,color:E.agentColor??"var(--text-1)"},children:[E.agentIcon?`${E.agentIcon} `:"",E.agent]}),h.jsxs("td",{style:or,title:E.sessionId,children:[E.slug,E.isMain?" ★":"",A5(E)&&h.jsx("span",{className:"session-unread-dot","aria-label":"unread activity",title:`New activity since ${lx(E.unreadAt??null)}`,style:{marginLeft:6}}),!E.isMain&&E.sessionId!==E.slug&&h.jsx("div",{style:{fontSize:10,color:"var(--text-2)",fontFamily:'"JetBrains Mono", monospace',opacity:.7},children:E.sessionId})]}),ie&&h.jsx("td",{style:or,children:h.jsx(D5,{slug:E.projectSlug,project:E.projectSlug?D[E.projectSlug]:void 0})}),h.jsx("td",{style:{...or,color:"var(--text-2)"},children:E.engine??"—"}),h.jsx("td",{style:or,children:h.jsx(N5,{row:E})}),h.jsx("td",{style:{...or,color:"var(--text-2)"},children:lx(E.lastActivity)}),h.jsx("td",{style:{...or,textAlign:"right"},children:E.messageCount}),h.jsx("td",{style:{...or,textAlign:"right",color:"var(--text-2)"},children:R5(E.byteSize)}),h.jsx("td",{style:or,children:h.jsx(O5,{row:E})}),h.jsx("td",{style:or,onClick:Z=>Z.stopPropagation(),children:h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{type:"button",className:"chat-icon-btn",title:"Open chat",onClick:()=>e({agent:E.agent,sessionId:E.sessionId,agentLabel:`${E.agent} · ${E.slug}`}),children:h.jsx(Yx,{size:12})}),!E.isMain&&h.jsx("button",{type:"button",className:"chat-icon-btn",title:E.isArchived?"Unarchive":"Archive",onClick:()=>void U(E),children:E.isArchived?h.jsx(O2,{size:12}):h.jsx(D2,{size:12})}),h.jsx("a",{className:"chat-icon-btn",title:"Export as Markdown",href:Me.sessionExportUrl(E.agent,E.sessionId,"markdown"),download:`${E.agent}-${E.slug}.md`,children:h.jsx(hc,{size:12})}),h.jsx("a",{className:"chat-icon-btn",title:"Export as JSONL",href:Me.sessionExportUrl(E.agent,E.sessionId,"json"),download:`${E.agent}-${E.slug}.jsonl`,children:h.jsx(W2,{size:12})})]})})]},F)})})]})})]})}function Zu(e){return`${e.agent}:${e.sessionId}`}function Ju(e,t,n,r,a){n===a?t(r==="asc"?"desc":"asc"):(e(a),t("desc"))}function A5(e){return e.unreadAt?e.seenAt?e.unreadAt>e.seenAt:!0:!1}function R5(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function lx(e){if(!e)return"—";const t=new Date(e).getTime(),n=Date.now()-t;if(n<0)return e.slice(0,16);const r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r} min ago`;const a=Math.floor(r/60);if(a<24)return`${a}h ago`;const o=Math.floor(a/24);return o<7?`${o}d ago`:o<60?`${Math.floor(o/7)}w ago`:e.slice(0,10)}function N5({row:e}){return h.jsxs("span",{style:{display:"inline-flex",gap:4,alignItems:"center"},children:[e.liveSubscribers>0&&h.jsx("span",{title:`${e.liveSubscribers} live subscriber(s)`,style:{color:"#4ade80"},children:"●"}),e.isArchived&&h.jsx("span",{title:"archived",children:"📦"}),e.isMain&&h.jsx("span",{title:"main session",style:{color:"var(--accent)"},children:"★"})]})}function O5({row:e}){const{status:t,lagEvents:n}=e.dream;return t==="dreamed"?h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2},children:[h.jsx(qp,{phase:"rem",size:11,title:"fully dreamed"})," ✓"]}):t==="partial"?h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--warn)"},children:[h.jsx(qp,{phase:"rem",size:11,title:`${n} new events since last REM`})," ⚠",n]}):h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--text-2)"},children:[h.jsx(qp,{phase:"rem",size:11,title:"never dreamed"})," ○"]})}function Wp({label:e,options:t,selected:n,onToggle:r}){return h.jsxs("div",{style:{display:"inline-flex",gap:2,alignItems:"center"},children:[h.jsxs("span",{style:{color:"var(--text-2)",marginRight:4},children:[e,":"]}),t.map(a=>{const o=n.has(a);return h.jsx("button",{type:"button",onClick:()=>r(a),style:{padding:"2px 6px",border:"1px solid var(--bg-3)",background:o?"var(--accent)":"transparent",color:o?"var(--bg-1)":"var(--text-2)",cursor:"pointer",fontFamily:"inherit",fontSize:10},children:a},a)})]})}const Ds={padding:"6px 8px",fontSize:10,fontWeight:500,whiteSpace:"nowrap"},or={padding:"6px 8px",whiteSpace:"nowrap"};function Qu({label:e,onClick:t,active:n,dir:r}){return h.jsxs("th",{style:{...Ds,cursor:"pointer"},onClick:t,children:[e,n?r==="asc"?" ↑":" ↓":""]})}function D5({slug:e,project:t}){if(!e)return h.jsx("span",{style:{color:"var(--text-3)"},children:"—"});if(!t)return h.jsx("span",{style:{color:"var(--text-3)",fontStyle:"italic"},title:"project not loaded",children:e});const n=t.color??"var(--text-2)";return h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"1px 6px",background:`${typeof n=="string"&&n.startsWith("#")?`${n}22`:"transparent"}`,border:`1px solid ${typeof n=="string"&&n.startsWith("#")?`${n}55`:"var(--line)"}`,borderRadius:3,color:n,fontSize:10},title:`entity: ${t.entity}${t.archived?" (archived)":""}`,children:[h.jsx("span",{style:{width:6,height:6,borderRadius:1,background:n}}),t.name,t.archived?" ⚠":""]})}const L5=5e3;function z5(){const[e,t]=x.useState(null),[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(null),p=x.useCallback(async()=>{try{const y=await Me.sentinelList();t(y.triggers),f(null)}catch(y){f(y.message)}},[]),d=x.useCallback(async y=>{try{const b=await Me.sentinelHistory(y);o(b)}catch{o([])}},[]);x.useEffect(()=>{p();const y=setInterval(()=>void p(),L5);return()=>clearInterval(y)},[p]),x.useEffect(()=>{n?d(n):o(null)},[n,d]);const m=x.useMemo(()=>n?(e==null?void 0:e.find(y=>y.id===n))??null:null,[n,e]),_=x.useCallback(async(y,b)=>{try{if(y==="pause")await Me.sentinelPause(b);else if(y==="resume")await Me.sentinelResume(b);else if(y==="delete"){if(!confirm(`Delete trigger '${b}'? This removes its history.`))return;await Me.sentinelDelete(b),n===b&&r(null)}else y==="test"&&(await Me.sentinelTest(b),setTimeout(()=>{d(b),p()},1500));p()}catch(w){alert(`${y} failed: ${w.message}`)}},[p,d,n]);return h.jsxs("div",{style:{display:"flex",height:"100%",fontFamily:'"JetBrains Mono", monospace',fontSize:11},children:[h.jsxs("div",{style:{width:m?"45%":"100%",borderRight:m?"1px solid var(--line)":"none",display:"flex",flexDirection:"column",overflow:"hidden"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:"1px solid var(--line)",color:"var(--text-2)"},children:[h.jsx("span",{children:e===null?"loading…":e.length===0?"no triggers":`${e.length} trigger${e.length===1?"":"s"}`}),h.jsx("button",{type:"button",onClick:()=>void p(),title:"refresh",style:{all:"unset",cursor:"pointer",color:"var(--text-3)",display:"inline-flex",alignItems:"center",gap:4},children:h.jsx(tr,{size:11})})]}),h.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6},children:[c&&h.jsx("div",{style:{color:"var(--danger)",fontSize:11,padding:8},children:c}),e===null&&!c?h.jsx("div",{style:{color:"var(--text-3)",textAlign:"center",padding:24},children:"loading…"}):e&&e.length===0?h.jsxs("div",{style:{color:"var(--text-3)",textAlign:"center",padding:24},children:[h.jsx("div",{children:"no triggers installed"}),h.jsxs("div",{style:{marginTop:8},children:["ask an agent to set one up:",h.jsx("br",{}),h.jsx("em",{style:{color:"var(--text-2)"},children:'"erinner mich morgen 10 Uhr…"'})]})]}):(e??[]).map(y=>h.jsx(B5,{trigger:y,selected:y.id===n,onSelect:()=>r(y.id)},y.id))]})]}),m&&h.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:h.jsx(j5,{trigger:m,history:a,onAction:y=>void _(y,m.id),onClose:()=>r(null)})})]})}function B5({trigger:e,selected:t,onSelect:n}){return h.jsxs("div",{onClick:n,style:{cursor:"pointer",padding:"8px 10px",borderRadius:4,marginBottom:4,background:t?"var(--bg-2)":"var(--bg-3)",border:`1px solid ${t?"var(--accent)":"var(--line-2)"}`,display:"flex",flexDirection:"column",gap:3},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx(qk,{status:e.status}),h.jsx("span",{style:{color:"var(--text-1)",fontWeight:600},children:e.name}),h.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontSize:10},children:[e.fireCount,"× fired"]})]}),h.jsx("div",{style:{color:"var(--text-2)",fontSize:10},children:Wk(e)}),h.jsxs("div",{style:{color:"var(--text-3)",fontSize:10},children:["owner: ",h.jsx("strong",{style:{color:"var(--text-2)"},children:e.ownerAgent}),e.ownerAgent!==e.dispatch.agent&&h.jsxs(h.Fragment,{children:[" ","→ dispatches to ",h.jsx("strong",{style:{color:"var(--text-2)"},children:e.dispatch.agent})]})," · ","session: ",e.dispatch.session]}),e.nextFireAt&&h.jsxs("div",{style:{color:"var(--text-3)",fontSize:10},children:["next: ",oc(e.nextFireAt)," (",P5(e.nextFireAt),")"]}),e.statusReason&&h.jsx("div",{style:{color:"var(--danger)",fontSize:10},children:e.statusReason})]})}function qk({status:e}){switch(e){case"active":return h.jsx(Fx,{size:12,style:{color:"var(--accent)"}});case"paused":return h.jsx(Lh,{size:12,style:{color:"var(--text-3)"}});case"error":return h.jsx(ui,{size:12,style:{color:"var(--danger)"}});case"completed":return h.jsx(P2,{size:12,style:{color:"var(--text-3)"}})}}function Wk(e){if(e.source.type!=="time")return e.source.type;const t=e.source.spec;switch(t.type){case"at":return`Once at ${oc(t.iso)}`;case"every":return`Every ${t.interval}`;case"daily":return`Daily at ${t.time}`;case"weekly":return`Weekly on ${t.day} at ${t.time}`;case"cron":return`Cron "${t.expression}"`}}function j5({trigger:e,history:t,onAction:n,onClose:r}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--line)"},children:[h.jsx(qk,{status:e.status}),h.jsx("span",{style:{color:"var(--text-1)",fontWeight:600,fontSize:12},children:e.name}),h.jsxs("span",{style:{color:"var(--text-3)",fontSize:10},children:["· ",e.id]}),h.jsx("button",{type:"button",onClick:r,title:"close detail",style:{all:"unset",cursor:"pointer",color:"var(--text-3)",marginLeft:"auto",fontSize:14},children:"✕"})]}),h.jsxs("div",{style:{padding:12,flex:1,overflowY:"auto"},children:[h.jsx(co,{title:"Schedule",children:Wk(e)}),e.intent&&h.jsx(co,{title:"Intent",children:e.intent}),h.jsxs(co,{title:"Dispatch",children:["agent: ",h.jsx("code",{children:e.dispatch.agent}),h.jsx("br",{}),"session: ",h.jsx("code",{children:e.dispatch.session}),h.jsx("br",{}),"prompt:",h.jsx("div",{style:{marginTop:4,padding:8,background:"var(--bg-3)",border:"1px solid var(--line-2)",borderRadius:4,whiteSpace:"pre-wrap",color:"var(--text-2)",fontSize:10,maxHeight:100,overflowY:"auto"},children:e.dispatch.prompt})]}),e.policy&&(e.policy.cooldownMs||e.policy.maxFiresPerDay)&&h.jsxs(co,{title:"Policy",children:[e.policy.cooldownMs!==void 0&&h.jsxs(h.Fragment,{children:["cooldown: ",Math.round(e.policy.cooldownMs/1e3),"s",h.jsx("br",{})]}),e.policy.maxFiresPerDay!==void 0&&h.jsxs(h.Fragment,{children:["max fires/day: ",e.policy.maxFiresPerDay]})]}),h.jsxs(co,{title:"Stats",children:["fires: ",e.fireCount,e.lastSuccessAt&&h.jsxs(h.Fragment,{children:[h.jsx("br",{}),"last success: ",oc(e.lastSuccessAt)]}),e.lastErrorAt&&h.jsxs(h.Fragment,{children:[h.jsx("br",{}),"last error: ",oc(e.lastErrorAt)]}),e.errorStreak>0&&h.jsxs(h.Fragment,{children:[h.jsx("br",{}),h.jsxs("span",{style:{color:"var(--danger)"},children:["error streak: ",e.errorStreak]})]})]}),h.jsx(co,{title:"History (last 50 fires)",children:t===null?h.jsx("span",{style:{color:"var(--text-3)"},children:"loading…"}):t.length===0?h.jsx("span",{style:{color:"var(--text-3)"},children:"no fires yet"}):h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:t.map((a,o)=>h.jsx(I5,{entry:a},o))})})]}),h.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--line)",display:"flex",gap:8},children:[h.jsx(eh,{icon:h.jsx(ec,{size:12}),label:"test now",color:"var(--accent)",onClick:()=>n("test")}),e.status==="paused"||e.status==="error"?h.jsx(eh,{icon:h.jsx(zh,{size:12}),label:"resume",color:"var(--accent)",onClick:()=>n("resume")}):e.status==="active"?h.jsx(eh,{icon:h.jsx(Lh,{size:12}),label:"pause",color:"var(--text-2)",onClick:()=>n("pause")}):null,h.jsx(eh,{icon:h.jsx(nS,{size:12}),label:"delete",color:"var(--danger)",onClick:()=>n("delete")})]})]})}function co({title:e,children:t}){return h.jsxs("div",{style:{marginBottom:12},children:[h.jsx("div",{style:{color:"var(--text-3)",fontSize:9,textTransform:"uppercase",letterSpacing:.5,marginBottom:4},children:e}),h.jsx("div",{style:{color:"var(--text-1)",fontSize:11},children:t})]})}function I5({entry:e}){const t=e.outcome==="success"?"var(--accent)":e.outcome==="error"?"var(--danger)":"var(--text-3)";return h.jsxs("div",{style:{padding:"4px 6px",background:"var(--bg-3)",border:"1px solid var(--line-2)",borderRadius:3,fontSize:10},children:[h.jsx("span",{style:{color:t},children:e.outcome}),e.catchUp&&h.jsx("span",{style:{color:"var(--text-3)"},children:" · catch-up"}),e.testMode&&h.jsx("span",{style:{color:"var(--text-3)"},children:" · test"})," · ",h.jsx("span",{style:{color:"var(--text-2)"},children:oc(e.firedAt)}),e.skipReason&&h.jsx("div",{style:{color:"var(--text-3)"},children:e.skipReason}),e.error&&h.jsx("div",{style:{color:"var(--danger)",whiteSpace:"pre-wrap"},children:e.error})]})}function eh({icon:e,label:t,color:n,onClick:r}){return h.jsxs("button",{type:"button",onClick:r,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",border:`1px solid ${n}`,borderRadius:3,color:n,fontSize:10},children:[e,t]})}function oc(e){try{return new Date(e).toLocaleString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return e}}function P5(e){try{const t=new Date(e).getTime()-Date.now();return t<0?"past due":t<6e4?`in ${Math.round(t/1e3)}s`:t<36e5?`in ${Math.round(t/6e4)}m`:t<864e5?`in ${Math.round(t/36e5)}h`:`in ${Math.round(t/864e5)}d`}catch{return""}}const U5=/\[\[([^\]|#\n]+)(?:#[^\]|\n]*)?(?:\|([^\]\n]*))?\]\]/g,H5=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`+[^`\n]*`+)/g;function $5(e,t){const n=o=>o.replace(U5,(c,f,p)=>{const d=f.trim(),m=(p??d).trim()||d,_=t[d],y=m.replace(/[[\]]/g,"");return _?`[${y}](wiki:${encodeURIComponent(_)})`:`[${y}](wiki-broken:${encodeURIComponent(d)})`}),r=[];let a=0;for(const o of e.matchAll(H5)){const c=o.index??0;r.push(n(e.slice(a,c))),r.push(o[0]),a=c+o[0].length}return r.push(n(e.slice(a))),r.join("")}function F5(e,t){var n,r=1;e==null&&(e=0),t==null&&(t=0);function a(){var o,c=n.length,f,p=0,d=0;for(o=0;o<c;++o)f=n[o],p+=f.x,d+=f.y;for(p=(p/c-e)*r,d=(d/c-t)*r,o=0;o<c;++o)f=n[o],f.x-=p,f.y-=d}return a.initialize=function(o){n=o},a.x=function(o){return arguments.length?(e=+o,a):e},a.y=function(o){return arguments.length?(t=+o,a):t},a.strength=function(o){return arguments.length?(r=+o,a):r},a}function q5(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Kk(this.cover(t,n),t,n,e)}function Kk(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var a,o=e._root,c={data:r},f=e._x0,p=e._y0,d=e._x1,m=e._y1,_,y,b,w,S,C,k,j;if(!o)return e._root=c,e;for(;o.length;)if((S=t>=(_=(f+d)/2))?f=_:d=_,(C=n>=(y=(p+m)/2))?p=y:m=y,a=o,!(o=o[k=C<<1|S]))return a[k]=c,e;if(b=+e._x.call(null,o.data),w=+e._y.call(null,o.data),t===b&&n===w)return c.next=o,a?a[k]=c:e._root=c,e;do a=a?a[k]=new Array(4):e._root=new Array(4),(S=t>=(_=(f+d)/2))?f=_:d=_,(C=n>=(y=(p+m)/2))?p=y:m=y;while((k=C<<1|S)===(j=(w>=y)<<1|b>=_));return a[j]=o,a[k]=c,e}function W5(e){var t,n,r=e.length,a,o,c=new Array(r),f=new Array(r),p=1/0,d=1/0,m=-1/0,_=-1/0;for(n=0;n<r;++n)isNaN(a=+this._x.call(null,t=e[n]))||isNaN(o=+this._y.call(null,t))||(c[n]=a,f[n]=o,a<p&&(p=a),a>m&&(m=a),o<d&&(d=o),o>_&&(_=o));if(p>m||d>_)return this;for(this.cover(p,d).cover(m,_),n=0;n<r;++n)Kk(this,c[n],f[n],e[n]);return this}function K5(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,a=this._x1,o=this._y1;if(isNaN(n))a=(n=Math.floor(e))+1,o=(r=Math.floor(t))+1;else{for(var c=a-n||1,f=this._root,p,d;n>e||e>=a||r>t||t>=o;)switch(d=(t<r)<<1|e<n,p=new Array(4),p[d]=f,f=p,c*=2,d){case 0:a=n+c,o=r+c;break;case 1:n=a-c,o=r+c;break;case 2:a=n+c,r=o-c;break;case 3:n=a-c,r=o-c;break}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=r,this._x1=a,this._y1=o,this}function G5(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Y5(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function ci(e,t,n,r,a){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=a}function V5(e,t,n){var r,a=this._x0,o=this._y0,c,f,p,d,m=this._x1,_=this._y1,y=[],b=this._root,w,S;for(b&&y.push(new ci(b,a,o,m,_)),n==null?n=1/0:(a=e-n,o=t-n,m=e+n,_=t+n,n*=n);w=y.pop();)if(!(!(b=w.node)||(c=w.x0)>m||(f=w.y0)>_||(p=w.x1)<a||(d=w.y1)<o))if(b.length){var C=(c+p)/2,k=(f+d)/2;y.push(new ci(b[3],C,k,p,d),new ci(b[2],c,k,C,d),new ci(b[1],C,f,p,k),new ci(b[0],c,f,C,k)),(S=(t>=k)<<1|e>=C)&&(w=y[y.length-1],y[y.length-1]=y[y.length-1-S],y[y.length-1-S]=w)}else{var j=e-+this._x.call(null,b.data),R=t-+this._y.call(null,b.data),L=j*j+R*R;if(L<n){var q=Math.sqrt(n=L);a=e-q,o=t-q,m=e+q,_=t+q,r=b.data}}return r}function X5(e){if(isNaN(m=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e)))return this;var t,n=this._root,r,a,o,c=this._x0,f=this._y0,p=this._x1,d=this._y1,m,_,y,b,w,S,C,k;if(!n)return this;if(n.length)for(;;){if((w=m>=(y=(c+p)/2))?c=y:p=y,(S=_>=(b=(f+d)/2))?f=b:d=b,t=n,!(n=n[C=S<<1|w]))return this;if(!n.length)break;(t[C+1&3]||t[C+2&3]||t[C+3&3])&&(r=t,k=C)}for(;n.data!==e;)if(a=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,a?(o?a.next=o:delete a.next,this):t?(o?t[C]=o:delete t[C],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[k]=n:this._root=n),this):(this._root=o,this)}function Z5(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function J5(){return this._root}function Q5(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function e6(e){var t=[],n,r=this._root,a,o,c,f,p;for(r&&t.push(new ci(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,o=n.x0,c=n.y0,f=n.x1,p=n.y1)&&r.length){var d=(o+f)/2,m=(c+p)/2;(a=r[3])&&t.push(new ci(a,d,m,f,p)),(a=r[2])&&t.push(new ci(a,o,m,d,p)),(a=r[1])&&t.push(new ci(a,d,c,f,m)),(a=r[0])&&t.push(new ci(a,o,c,d,m))}return this}function t6(e){var t=[],n=[],r;for(this._root&&t.push(new ci(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var a=r.node;if(a.length){var o,c=r.x0,f=r.y0,p=r.x1,d=r.y1,m=(c+p)/2,_=(f+d)/2;(o=a[0])&&t.push(new ci(o,c,f,m,_)),(o=a[1])&&t.push(new ci(o,m,f,p,_)),(o=a[2])&&t.push(new ci(o,c,_,m,d)),(o=a[3])&&t.push(new ci(o,m,_,p,d))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function n6(e){return e[0]}function i6(e){return arguments.length?(this._x=e,this):this._x}function r6(e){return e[1]}function s6(e){return arguments.length?(this._y=e,this):this._y}function Qm(e,t,n){var r=new e_(t??n6,n??r6,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function e_(e,t,n,r,a,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=a,this._y1=o,this._root=void 0}function cx(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var fi=Qm.prototype=e_.prototype;fi.copy=function(){var e=new e_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=cx(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var a=0;a<4;++a)(r=t.source[a])&&(r.length?n.push({source:r,target:t.target[a]=new Array(4)}):t.target[a]=cx(r));return e};fi.add=q5;fi.addAll=W5;fi.cover=K5;fi.data=G5;fi.extent=Y5;fi.find=V5;fi.remove=X5;fi.removeAll=Z5;fi.root=J5;fi.size=Q5;fi.visit=e6;fi.visitAfter=t6;fi.x=i6;fi.y=s6;function va(e){return function(){return e}}function Is(e){return(e()-.5)*1e-6}function a6(e){return e.x+e.vx}function o6(e){return e.y+e.vy}function l6(e){var t,n,r,a=1,o=1;typeof e!="function"&&(e=va(e==null?1:+e));function c(){for(var d,m=t.length,_,y,b,w,S,C,k=0;k<o;++k)for(_=Qm(t,a6,o6).visitAfter(f),d=0;d<m;++d)y=t[d],S=n[y.index],C=S*S,b=y.x+y.vx,w=y.y+y.vy,_.visit(j);function j(R,L,q,O,z){var J=R.data,ie=R.r,D=S+ie;if(J){if(J.index>y.index){var A=b-J.x-J.vx,M=w-J.y-J.vy,P=A*A+M*M;P<D*D&&(A===0&&(A=Is(r),P+=A*A),M===0&&(M=Is(r),P+=M*M),P=(D-(P=Math.sqrt(P)))/P*a,y.vx+=(A*=P)*(D=(ie*=ie)/(C+ie)),y.vy+=(M*=P)*D,J.vx-=A*(D=1-D),J.vy-=M*D)}return}return L>b+D||O<b-D||q>w+D||z<w-D}}function f(d){if(d.data)return d.r=n[d.data.index];for(var m=d.r=0;m<4;++m)d[m]&&d[m].r>d.r&&(d.r=d[m].r)}function p(){if(t){var d,m=t.length,_;for(n=new Array(m),d=0;d<m;++d)_=t[d],n[_.index]=+e(_,d,t)}}return c.initialize=function(d,m){t=d,r=m,p()},c.iterations=function(d){return arguments.length?(o=+d,c):o},c.strength=function(d){return arguments.length?(a=+d,c):a},c.radius=function(d){return arguments.length?(e=typeof d=="function"?d:va(+d),p(),c):e},c}function c6(e){return e.index}function ux(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function u6(e){var t=c6,n=_,r,a=va(30),o,c,f,p,d,m=1;e==null&&(e=[]);function _(C){return 1/Math.min(f[C.source.index],f[C.target.index])}function y(C){for(var k=0,j=e.length;k<m;++k)for(var R=0,L,q,O,z,J,ie,D;R<j;++R)L=e[R],q=L.source,O=L.target,z=O.x+O.vx-q.x-q.vx||Is(d),J=O.y+O.vy-q.y-q.vy||Is(d),ie=Math.sqrt(z*z+J*J),ie=(ie-o[R])/ie*C*r[R],z*=ie,J*=ie,O.vx-=z*(D=p[R]),O.vy-=J*D,q.vx+=z*(D=1-D),q.vy+=J*D}function b(){if(c){var C,k=c.length,j=e.length,R=new Map(c.map((q,O)=>[t(q,O,c),q])),L;for(C=0,f=new Array(k);C<j;++C)L=e[C],L.index=C,typeof L.source!="object"&&(L.source=ux(R,L.source)),typeof L.target!="object"&&(L.target=ux(R,L.target)),f[L.source.index]=(f[L.source.index]||0)+1,f[L.target.index]=(f[L.target.index]||0)+1;for(C=0,p=new Array(j);C<j;++C)L=e[C],p[C]=f[L.source.index]/(f[L.source.index]+f[L.target.index]);r=new Array(j),w(),o=new Array(j),S()}}function w(){if(c)for(var C=0,k=e.length;C<k;++C)r[C]=+n(e[C],C,e)}function S(){if(c)for(var C=0,k=e.length;C<k;++C)o[C]=+a(e[C],C,e)}return y.initialize=function(C,k){c=C,d=k,b()},y.links=function(C){return arguments.length?(e=C,b(),y):e},y.id=function(C){return arguments.length?(t=C,y):t},y.iterations=function(C){return arguments.length?(m=+C,y):m},y.strength=function(C){return arguments.length?(n=typeof C=="function"?C:va(+C),w(),y):n},y.distance=function(C){return arguments.length?(a=typeof C=="function"?C:va(+C),S(),y):a},y}var h6={value:()=>{}};function Gk(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new dh(n)}function dh(e){this._=e}function d6(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}dh.prototype=Gk.prototype={constructor:dh,on:function(e,t){var n=this._,r=d6(e+"",n),a,o=-1,c=r.length;if(arguments.length<2){for(;++o<c;)if((a=(e=r[o]).type)&&(a=f6(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<c;)if(a=(e=r[o]).type)n[a]=hx(n[a],e.name,t);else if(t==null)for(a in n)n[a]=hx(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new dh(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,o;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,a=o.length;r<a;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,o=r.length;a<o;++a)r[a].value.apply(t,n)}};function f6(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function hx(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=h6,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var xo=0,ql=0,jl=0,Yk=1e3,Ah,Wl,Rh=0,Sa=0,Gh=0,lc=typeof performance=="object"&&performance.now?performance:Date,Vk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xk(){return Sa||(Vk(p6),Sa=lc.now()+Gh)}function p6(){Sa=0}function sm(){this._call=this._time=this._next=null}sm.prototype=Zk.prototype={constructor:sm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xk():+n)+(t==null?0:+t),!this._next&&Wl!==this&&(Wl?Wl._next=this:Ah=this,Wl=this),this._call=e,this._time=n,am()},stop:function(){this._call&&(this._call=null,this._time=1/0,am())}};function Zk(e,t,n){var r=new sm;return r.restart(e,t,n),r}function g6(){Xk(),++xo;for(var e=Ah,t;e;)(t=Sa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xo}function dx(){Sa=(Rh=lc.now())+Gh,xo=ql=0;try{g6()}finally{xo=0,_6(),Sa=0}}function m6(){var e=lc.now(),t=e-Rh;t>Yk&&(Gh-=t,Rh=e)}function _6(){for(var e,t=Ah,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ah=n);Wl=e,am(r)}function am(e){if(!xo){ql&&(ql=clearTimeout(ql));var t=e-Sa;t>24?(e<1/0&&(ql=setTimeout(dx,e-lc.now()-Gh)),jl&&(jl=clearInterval(jl))):(jl||(Rh=lc.now(),jl=setInterval(m6,Yk)),xo=1,Vk(dx))}}const v6=1664525,y6=1013904223,fx=4294967296;function b6(){let e=1;return()=>(e=(v6*e+y6)%fx)/fx}function x6(e){return e.x}function S6(e){return e.y}var w6=10,k6=Math.PI*(3-Math.sqrt(5));function E6(e){var t,n=1,r=.001,a=1-Math.pow(r,1/300),o=0,c=.6,f=new Map,p=Zk(_),d=Gk("tick","end"),m=b6();e==null&&(e=[]);function _(){y(),d.call("tick",t),n<r&&(p.stop(),d.call("end",t))}function y(S){var C,k=e.length,j;S===void 0&&(S=1);for(var R=0;R<S;++R)for(n+=(o-n)*a,f.forEach(function(L){L(n)}),C=0;C<k;++C)j=e[C],j.fx==null?j.x+=j.vx*=c:(j.x=j.fx,j.vx=0),j.fy==null?j.y+=j.vy*=c:(j.y=j.fy,j.vy=0);return t}function b(){for(var S=0,C=e.length,k;S<C;++S){if(k=e[S],k.index=S,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),isNaN(k.x)||isNaN(k.y)){var j=w6*Math.sqrt(.5+S),R=S*k6;k.x=j*Math.cos(R),k.y=j*Math.sin(R)}(isNaN(k.vx)||isNaN(k.vy))&&(k.vx=k.vy=0)}}function w(S){return S.initialize&&S.initialize(e,m),S}return b(),t={tick:y,restart:function(){return p.restart(_),t},stop:function(){return p.stop(),t},nodes:function(S){return arguments.length?(e=S,b(),f.forEach(w),t):e},alpha:function(S){return arguments.length?(n=+S,t):n},alphaMin:function(S){return arguments.length?(r=+S,t):r},alphaDecay:function(S){return arguments.length?(a=+S,t):+a},alphaTarget:function(S){return arguments.length?(o=+S,t):o},velocityDecay:function(S){return arguments.length?(c=1-S,t):1-c},randomSource:function(S){return arguments.length?(m=S,f.forEach(w),t):m},force:function(S,C){return arguments.length>1?(C==null?f.delete(S):f.set(S,w(C)),t):f.get(S)},find:function(S,C,k){var j=0,R=e.length,L,q,O,z,J;for(k==null?k=1/0:k*=k,j=0;j<R;++j)z=e[j],L=S-z.x,q=C-z.y,O=L*L+q*q,O<k&&(J=z,k=O);return J},on:function(S,C){return arguments.length>1?(d.on(S,C),t):d.on(S)}}}function C6(){var e,t,n,r,a=va(-30),o,c=1,f=1/0,p=.81;function d(b){var w,S=e.length,C=Qm(e,x6,S6).visitAfter(_);for(r=b,w=0;w<S;++w)t=e[w],C.visit(y)}function m(){if(e){var b,w=e.length,S;for(o=new Array(w),b=0;b<w;++b)S=e[b],o[S.index]=+a(S,b,e)}}function _(b){var w=0,S,C,k=0,j,R,L;if(b.length){for(j=R=L=0;L<4;++L)(S=b[L])&&(C=Math.abs(S.value))&&(w+=S.value,k+=C,j+=C*S.x,R+=C*S.y);b.x=j/k,b.y=R/k}else{S=b,S.x=S.data.x,S.y=S.data.y;do w+=o[S.data.index];while(S=S.next)}b.value=w}function y(b,w,S,C){if(!b.value)return!0;var k=b.x-t.x,j=b.y-t.y,R=C-w,L=k*k+j*j;if(R*R/p<L)return L<f&&(k===0&&(k=Is(n),L+=k*k),j===0&&(j=Is(n),L+=j*j),L<c&&(L=Math.sqrt(c*L)),t.vx+=k*b.value*r/L,t.vy+=j*b.value*r/L),!0;if(b.length||L>=f)return;(b.data!==t||b.next)&&(k===0&&(k=Is(n),L+=k*k),j===0&&(j=Is(n),L+=j*j),L<c&&(L=Math.sqrt(c*L)));do b.data!==t&&(R=o[b.data.index]*r/L,t.vx+=k*R,t.vy+=j*R);while(b=b.next)}return d.initialize=function(b,w){e=b,n=w,m()},d.strength=function(b){return arguments.length?(a=typeof b=="function"?b:va(+b),m(),d):a},d.distanceMin=function(b){return arguments.length?(c=b*b,d):Math.sqrt(c)},d.distanceMax=function(b){return arguments.length?(f=b*b,d):Math.sqrt(f)},d.theta=function(b){return arguments.length?(p=b*b,d):Math.sqrt(p)},d}const px=.2,gx=6,T6=1.4;function M6(e){let t=0;for(let n=0;n<e.length;n++)t=(t*31+e.charCodeAt(n))%360;return t}function mx(e,t){return t?9:Math.min(8,3+Math.sqrt(e))}function _x(e,t,n){return Math.max(t,Math.min(n,e))}function A6({graph:e,activeSlug:t,onOpen:n,expanded:r,onToggleExpand:a}){var A;const o=x.useRef(null),c=x.useRef(null),f=x.useRef(null),p=x.useRef(null),[d,m]=x.useState({w:320,h:320}),[,_]=x.useState(0),[y,b]=x.useState(null),[w,S]=x.useState({k:1,tx:0,ty:0}),C=x.useRef(null),{nodes:k,links:j}=x.useMemo(()=>{const M=e.nodes.map(H=>({...H})),P=new Map(M.map(H=>[H.id,H])),G=[];for(const H of e.edges){const N=P.get(H.from),$=P.get(H.to);N&&$&&G.push({source:N,target:$,type:H.type})}return{nodes:M,links:G}},[e]);x.useEffect(()=>{S({k:1,tx:0,ty:0})},[e]),x.useEffect(()=>{const M=o.current;if(!M)return;const P=new ResizeObserver(G=>{var N;const H=(N=G[0])==null?void 0:N.contentRect;H&&H.width>0&&H.height>0&&m({w:Math.floor(H.width),h:Math.floor(H.height)})});return P.observe(M),()=>P.disconnect()},[]),x.useEffect(()=>{if(k.length===0)return;const M=d.w/2,P=d.h/2,G=k.length>120?-140:-260,H=E6(k).force("charge",C6().strength(G)).force("center",F5(M,P)).force("collide",l6(K=>mx(K.degree,K.id===t)+4)).force("link",u6(j).id(K=>K.id).distance(k.length>120?45:70).strength(.35)).alphaMin(.02).stop();f.current=H;const N=k.find(K=>K.id===t);N&&(N.fx=M,N.fy=P);const $=()=>{H.tick(),_(K=>K+1),H.alpha()>H.alphaMin()?p.current=requestAnimationFrame($):p.current=null};return H.alpha(1),p.current=requestAnimationFrame($),()=>{p.current!==null&&cancelAnimationFrame(p.current),p.current=null,H.stop(),f.current=null}},[k,j,d.w,d.h,t]);const R=x.useCallback(M=>n(M),[n]),L=x.useCallback(M=>{var N;M.preventDefault();const P=(N=c.current)==null?void 0:N.getBoundingClientRect();if(!P)return;const G=M.clientX-P.left,H=M.clientY-P.top;S($=>{const K=M.deltaY<0?1.15:.8695652173913044,re=_x($.k*K,px,gx),U=(G-$.tx)/$.k,W=(H-$.ty)/$.k;return{k:re,tx:G-U*re,ty:H-W*re}})},[]),q=x.useCallback(M=>{S(P=>{const G=_x(P.k*M,px,gx),H=d.w/2,N=d.h/2,$=(H-P.tx)/P.k,K=(N-P.ty)/P.k;return{k:G,tx:H-$*G,ty:N-K*G}})},[d.w,d.h]),O=x.useCallback(()=>S({k:1,tx:0,ty:0}),[]),z=x.useCallback(M=>{M.target.closest("[data-node]")||(C.current={active:!0,moved:!1,x:M.clientX,y:M.clientY},M.currentTarget.setPointerCapture(M.pointerId))},[]),J=x.useCallback(M=>{const P=C.current;if(!(P!=null&&P.active))return;const G=M.clientX-P.x,H=M.clientY-P.y;(Math.abs(G)>2||Math.abs(H)>2)&&(P.moved=!0),P.x=M.clientX,P.y=M.clientY,S(N=>({...N,tx:N.tx+G,ty:N.ty+H}))},[]),ie=x.useCallback(M=>{C.current&&(C.current.active=!1);try{M.currentTarget.releasePointerCapture(M.pointerId)}catch{}},[]);if(e.nodes.length===0)return h.jsx("div",{className:"wiki-graph-empty",children:"No connections — this page links nothing and nothing links to it."});const D=w.k>=T6||k.length<=30;return h.jsxs("div",{className:"wiki-graph",ref:o,children:[h.jsx("svg",{ref:c,width:d.w,height:d.h,role:"img","aria-label":"Wiki link graph",onWheel:L,onPointerDown:z,onPointerMove:J,onPointerUp:ie,style:{cursor:(A=C.current)!=null&&A.active?"grabbing":"grab",touchAction:"none"},children:h.jsxs("g",{transform:`translate(${w.tx},${w.ty}) scale(${w.k})`,children:[h.jsx("g",{children:j.map((M,P)=>{const G=M.source,H=M.target;if(G.x==null||H.x==null)return null;const N=y!==null&&(G.id===y||H.id===y),$=t!==null&&(G.id===t||H.id===t);return h.jsx("line",{x1:G.x,y1:G.y??0,x2:H.x,y2:H.y??0,stroke:N||$?"var(--accent)":"var(--line-2)",strokeOpacity:N?.9:$?.55:.28,strokeWidth:(N?1.6:1)/w.k,strokeDasharray:M.type==="related"?`${3/w.k} ${3/w.k}`:void 0},`${G.id}->${H.id}-${M.type}-${P}`)})}),h.jsx("g",{children:k.map(M=>{if(M.x==null||M.y==null)return null;const P=M.id===t,G=M.id===y,H=mx(M.degree,P),N=M6(M.folder);return h.jsxs("g",{"data-node":!0,transform:`translate(${M.x},${M.y})`,style:{cursor:"pointer"},onMouseEnter:()=>b(M.id),onMouseLeave:()=>b($=>$===M.id?null:$),onClick:()=>{var $;($=C.current)!=null&&$.moved||R(M.id)},children:[h.jsx("circle",{r:H,fill:P?"var(--accent)":`hsl(${N} 45% 55%)`,fillOpacity:P?1:G?.95:.75,stroke:P||G?"var(--text-1)":"transparent",strokeWidth:(P?2:1)/w.k}),(P||G||D)&&h.jsx("text",{x:H+4/w.k,y:4/w.k,fontSize:11/w.k,fill:P||G?"var(--text-1)":"var(--text-2)",style:{pointerEvents:"none"},children:M.label.length>32?`${M.label.slice(0,32)}…`:M.label})]},M.id)})})]})}),h.jsxs("div",{className:"wiki-graph-controls",children:[h.jsx("button",{className:"wiki-graph-ctl",title:"Zoom in",onClick:()=>q(1.3),children:h.jsx(Bh,{size:14})}),h.jsx("button",{className:"wiki-graph-ctl",title:"Zoom out",onClick:()=>q(1/1.3),children:h.jsx(rT,{size:14})}),h.jsx("button",{className:"wiki-graph-ctl",title:"Reset view",onClick:O,children:h.jsx(fT,{size:14})}),a&&h.jsx("button",{className:"wiki-graph-ctl",title:r?"Collapse graph":"Expand graph",onClick:a,children:h.jsx(eT,{size:14})})]}),e.truncated&&h.jsxs("div",{className:"wiki-graph-note",children:["Showing the ",e.nodes.length," most-connected pages."]})]})}const R6=x.memo(A6),N6=[Bm],O6=[Pm];function D6({slug:e,onSlugChange:t}){const[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(null),[p,d]=x.useState("local"),[m,_]=x.useState(null),[y,b]=x.useState(!1),[w,S]=x.useState(()=>new Set),[C,k]=x.useState(""),[j,R]=x.useState(!1),L=e??null,q=x.useCallback(async()=>{try{const M=await Me.wikiTree();r(M),_(null)}catch(M){_(M.message)}},[]);x.useEffect(()=>{q()},[q]),x.useEffect(()=>{if(!L){o(null);return}let M=!1;return(async()=>{try{const P=await Me.wikiPage(L);M||(o(P),_(null))}catch(P){M||_(`Seite '${L}': ${P.message}`)}})(),()=>{M=!0}},[L]),x.useEffect(()=>{if(p==="local"&&!L){f(null);return}let M=!1;return(async()=>{try{const P=await Me.wikiGraph(p,L??void 0);M||f(P)}catch{M||f(null)}})(),()=>{M=!0}},[p,L]);const O=x.useCallback(M=>{t(M);const P=M.split("/");P.length>1&&S(G=>{const H=new Set(G);for(let N=1;N<P.length;N++)H.add(P.slice(0,N).join("/"));return H})},[t]),z=x.useCallback(async()=>{b(!0);try{await Me.wikiRefresh(),await q(),L&&o(await Me.wikiPage(L)),f(await Me.wikiGraph(p,L??void 0))}catch(M){_(M.message)}finally{b(!1)}},[L,q,p]),J=x.useMemo(()=>a?$5(a.markdown,a.linkTargets):"",[a]),ie=x.useMemo(()=>({pre:({children:M})=>h.jsx("pre",{style:{maxWidth:"100%",overflowX:"auto"},children:M}),table:({children:M})=>h.jsx("div",{style:{overflowX:"auto"},children:h.jsx("table",{children:M})}),a:({href:M,children:P})=>{if(typeof M=="string"&&M.startsWith("wiki:")){const G=decodeURIComponent(M.slice(5));return h.jsx("a",{href:"#",className:"wiki-link",draggable:!1,onClick:H=>{H.preventDefault(),O(G)},children:P})}if(typeof M=="string"&&M.startsWith("wiki-broken:")){const G=decodeURIComponent(M.slice(12));return h.jsx("span",{className:"wiki-link-broken",title:`No such page '${G}'`,children:P})}return h.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",draggable:!1,children:P})}}),[O]),D=x.useMemo(()=>{if(!n)return null;const M=C.trim().toLowerCase();if(!M)return n.nodes;const P=G=>{if(G.type==="page")return G.title.toLowerCase().includes(M)||G.slug.toLowerCase().includes(M)?G:null;const H=G.children.map(P).filter(N=>N!==null);return H.length?{...G,children:H}:null};return n.nodes.map(P).filter(G=>G!==null)},[n,C]),A=C.trim()?null:w;return h.jsxs("div",{className:"wiki-root",children:[h.jsxs("div",{className:"wiki-col wiki-col-tree",children:[h.jsxs("div",{className:"wiki-tree-head",children:[h.jsx("input",{className:"wiki-filter",placeholder:"filter…",value:C,onChange:M=>k(M.target.value)}),h.jsx("button",{className:"wiki-icon-btn",title:"Re-scan",disabled:y,onClick:()=>void z(),children:h.jsx(tr,{size:14,className:y?"wiki-spin":void 0})})]}),h.jsxs("div",{className:"wiki-tree",children:[D===null&&h.jsx("div",{className:"wiki-muted",children:"Loading…"}),(D==null?void 0:D.length)===0&&h.jsx("div",{className:"wiki-muted",children:"no matches"}),D==null?void 0:D.map(M=>h.jsx(Jk,{node:M,depth:0,open:A,activeSlug:L,onToggle:P=>S(G=>{const H=new Set(G);return H.has(P)?H.delete(P):H.add(P),H}),onOpen:O},M.type==="dir"?`d:${M.path}`:`p:${M.slug}`))]}),n&&h.jsxs("div",{className:"wiki-tree-foot",children:[n.pages," pages"]})]}),h.jsxs("div",{className:"wiki-col wiki-col-reader",children:[m&&h.jsx("div",{className:"wiki-error",children:m}),!a&&!m&&h.jsx("div",{className:"wiki-muted wiki-pad",children:"Select a page on the left."}),a&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wiki-page-head",children:[h.jsx("span",{className:"wiki-page-slug",children:a.slug}),h.jsxs("span",{className:"wiki-page-meta-right",children:[typeof a.frontmatter.type=="string"&&h.jsx("span",{className:"wiki-chip",children:a.frontmatter.type}),h.jsx("span",{className:"wiki-page-date",children:new Date(a.mtimeMs).toLocaleDateString()})]})]}),h.jsx("div",{className:"wiki-page-body",children:h.jsx(Om,{remarkPlugins:N6,rehypePlugins:O6,components:ie,children:J})})]})]}),h.jsxs("div",{className:j?"wiki-col wiki-col-graph expanded":"wiki-col wiki-col-graph",children:[h.jsxs("div",{className:"wiki-graph-head",children:[h.jsx(sT,{size:14}),h.jsx("button",{className:p==="local"?"wiki-tab active":"wiki-tab",title:"Just this page and its direct neighbours",onClick:()=>d("local"),children:"This page"}),h.jsx("button",{className:p==="global"?"wiki-tab active":"wiki-tab",title:"The whole wiki at once",onClick:()=>d("global"),children:"Whole wiki"})]}),h.jsx("div",{className:"wiki-graph-wrap",children:c?h.jsx(R6,{graph:c,activeSlug:L,onOpen:O,expanded:j,onToggleExpand:()=>R(M=>!M)}):h.jsx("div",{className:"wiki-graph-empty",children:p==="local"?"Select a page on the left.":"Loading…"})}),a&&!j&&h.jsxs("div",{className:"wiki-links-panel",children:[h.jsx(vx,{title:"links to",items:a.links,onOpen:O}),h.jsx(vx,{title:"backlinks",items:a.backlinks,onOpen:O}),a.unresolved.length>0&&h.jsxs("div",{className:"wiki-link-group",children:[h.jsxs("div",{className:"wiki-link-title",children:["broken (",a.unresolved.length,")"]}),a.unresolved.map(M=>h.jsx("div",{className:"wiki-link-broken-row",title:"No such page",children:M},M))]})]})]})]})}function vx({title:e,items:t,onOpen:n}){return t.length===0?null:h.jsxs("div",{className:"wiki-link-group",children:[h.jsxs("div",{className:"wiki-link-title",children:[e," (",t.length,")"]}),t.map(r=>h.jsx("div",{className:"wiki-link-row",title:r.slug,onClick:()=>n(r.slug),children:r.title},r.slug))]})}function Jk({node:e,depth:t,open:n,activeSlug:r,onToggle:a,onOpen:o}){if(e.type==="page")return h.jsxs("div",{className:r===e.slug?"wiki-node wiki-page active":"wiki-node wiki-page",style:{paddingLeft:6+t*12},title:e.description||e.slug,onClick:()=>o(e.slug),children:[h.jsx(hc,{size:13}),h.jsx("span",{className:"wiki-node-label",children:e.title})]});const c=n===null||n.has(e.path);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"wiki-node wiki-dir",style:{paddingLeft:6+t*12},onClick:()=>a(e.path),children:[c?h.jsx(Xr,{size:13}):h.jsx(wo,{size:13}),h.jsx(Gx,{size:13}),h.jsx("span",{className:"wiki-node-label",children:e.name})]}),c&&e.children.map(f=>h.jsx(Jk,{node:f,depth:t+1,open:n,activeSlug:r,onToggle:a,onOpen:o},f.type==="dir"?`d:${f.path}`:`p:${f.slug}`))]})}const L6=x.memo(D6);function yx(e,t){if(t.length===0)return[...e];const n=new Set(t.map(a=>a.name));if(!t.some(a=>a.visible))return e.filter(a=>!n.has(a));const r=[...e];for(const a of t)r.includes(a.name)||r.push(a.name);return r}const Qk="somora-abilities-expanded",bx="\0skills";function z6(){try{const e=localStorage.getItem(Qk);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string")):new Set}catch{return new Set}}const B6={display:"flex",alignItems:"center",gap:6,fontFamily:'"JetBrains Mono", monospace',fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"var(--text-2)",marginBottom:4,cursor:"pointer",userSelect:"none"};function xx({groupKey:e,label:t,total:n,hidden:r,expanded:a,onToggleExpanded:o,onToggleAll:c,children:f}){const p=n>0&&r===n,d=r>0&&r<n;return h.jsxs("div",{style:{marginBottom:14},children:[h.jsxs("div",{style:B6,onClick:o,children:[a?h.jsx(Xr,{size:13}):h.jsx(wo,{size:13}),h.jsx("span",{"data-testid":`tools-group-toggle-${e}`,title:c?p?"Show all in this group":"Hide all in this group":void 0,onClick:m=>{m.stopPropagation(),c==null||c()},style:{display:"inline-flex",cursor:c?"pointer":"not-allowed",color:p?"var(--text-2)":"var(--accent)",opacity:d?.55:1},children:p?h.jsx(Vp,{size:14}):h.jsx(Ql,{size:14})}),h.jsx("span",{style:{color:r===n&&n>0?"var(--text-2)":"var(--text-1)"},children:t}),h.jsxs("span",{style:{textTransform:"none",letterSpacing:0,opacity:.75},children:[n,r>0?` · ${r} hidden`:""]})]}),a&&f]})}function j6(){var P,G,H;const[e,t]=x.useState([]),[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(null),[p,d]=x.useState(null),[m,_]=x.useState(null),[y,b]=x.useState(!1),[w,S]=x.useState(z6);x.useEffect(()=>{try{localStorage.setItem(Qk,JSON.stringify([...w]))}catch{}},[w]);const C=x.useCallback(N=>{S($=>{const K=new Set($);return K.delete(N)||K.add(N),K})},[]);x.useEffect(()=>{Me.agents().then(N=>{t(N),r($=>{var K;return $??((K=N[0])==null?void 0:K.name)??null})}).catch(N=>_(N.message)),Me.mcpStatus().then(d).catch(()=>d(null))},[]);const k=x.useCallback(async N=>{try{const[$,K]=await Promise.all([Me.agentTools(N),Me.agentSkills(N)]);o($),f(K),_(null)}catch($){_($.message)}},[]);x.useEffect(()=>{n&&k(n)},[n,k]);const j=(a==null?void 0:a.kind)==="builder",R=x.useMemo(()=>new Set((a==null?void 0:a.kindDefaults)??[]),[a]),L=x.useMemo(()=>{if(!a)return[];if(j){const $=a.tools.filter(re=>R.has(re.name)),K=a.tools.filter(re=>!R.has(re.name));return[["builder tools",$],["more (off unless switched on)",K]]}const N=new Map;for(const $ of a.tools){if($.toolset==="builder")continue;const K=$.mcpServer?`mcp: ${$.mcpServer}`:$.toolset,re=N.get(K);re?re.push($):N.set(K,[$])}return[...N.entries()].sort(([$],[K])=>{const re=$.startsWith("mcp: ")?1:0,U=K.startsWith("mcp: ")?1:0;return re-U||$.localeCompare(K)})},[a,j,R]),q=x.useCallback(async N=>{var W,I;if(!n||!a||a.hasPatternRules||y)return;const $=j?N.filter(E=>R.has(E.name)):N,K=j?N.filter(E=>!R.has(E.name)):[],re=yx(((W=a.gating)==null?void 0:W.deny)??[],$);let U=((I=a.gating)==null?void 0:I.allow)??[];for(const E of K)U=E.visible?U.filter(F=>F!==E.name):U.includes(E.name)?U:[...U,E.name];b(!0);try{await Me.setAgentTools(n,{deny:re,allow:U}),await k(n)}catch(E){_(E.message)}finally{b(!1)}},[n,a,y,k,j,R]),O=x.useCallback((N,$)=>void q([{name:N,visible:$}]),[q]),z=x.useCallback(N=>void q(N),[q]),J=x.useCallback(async N=>{var re,U;if(!n||!c||c.hasPatternRules||y)return;let $=((re=c.gating)==null?void 0:re.deny)??[],K=((U=c.gating)==null?void 0:U.allow)??[];if(c.kind==="builder")for(const W of N)K=W.visible?K.filter(I=>I!==W.name):K.includes(W.name)?K:[...K,W.name];else $=yx($,N);b(!0);try{await Me.setAgentSkills(n,{deny:$,allow:K}),await k(n)}catch(W){_(W.message)}finally{b(!1)}},[n,c,y,k]),ie=x.useCallback((N,$)=>void J([{name:N,visible:$}]),[J]),D=x.useCallback(()=>void J((c==null?void 0:c.skills)??[]),[J,c]),A=!!(a!=null&&a.hasPatternRules)||y,M=!!(c!=null&&c.hasPatternRules)||y;return h.jsxs("div",{style:{display:"flex",height:"100%",fontSize:13},children:[h.jsx("div",{style:{width:150,borderRight:"1px solid var(--bg-3)",padding:8,overflowY:"auto",flexShrink:0},children:e.map(N=>h.jsxs("div",{"data-testid":`tools-agent-${N.name}`,onClick:()=>r(N.name),style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",background:n===N.name?"var(--bg-3)":"transparent",color:n===N.name?"var(--text-1)":"var(--text-2)"},children:[N.icon?`${N.icon} `:"",N.name]},N.name))}),h.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[m&&h.jsxs("div",{style:{color:"var(--danger, #e5534b)",marginBottom:8},children:[h.jsx(ui,{size:14,className:"icon-inline"})," ",m]}),(a==null?void 0:a.hasPatternRules)&&h.jsxs("div",{style:{background:"var(--bg-2)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"8px 10px",marginBottom:10,color:"var(--text-2)"},children:[h.jsx(ui,{size:14,className:"icon-inline"})," This agent's"," ",h.jsx("code",{children:"agent.yaml"})," carries hand-written pattern rules (",[...((P=a.gating)==null?void 0:P.deny.filter(N=>N.includes("*")||N.startsWith("toolset:")))??[],...(((G=a.gating)==null?void 0:G.allow)??[]).map(N=>`allow:${N}`)].join(", "),") — the matrix is read-only. Edit the file to change them."]}),!a&&!m&&h.jsx("div",{style:{color:"var(--text-2)"},children:"Loading…"}),L.map(([N,$])=>h.jsx(xx,{groupKey:N,label:N,total:$.length,hidden:$.filter(K=>!K.visible).length,expanded:w.has(N),onToggleExpanded:()=>C(N),onToggleAll:A?void 0:()=>z($),children:$.map(K=>h.jsxs("div",{"data-testid":`tools-row-${K.name}`,style:{display:"flex",alignItems:"center",gap:8,padding:"4px 6px",borderRadius:4,opacity:K.visible?1:.45},title:K.description,children:[h.jsx("span",{"data-testid":`tools-toggle-${K.name}`,onClick:()=>O(K.name,K.visible),style:{cursor:A?"not-allowed":"pointer",color:K.visible?"var(--accent)":"var(--text-2)",display:"inline-flex"},children:K.visible?h.jsx(Ql,{size:15}):h.jsx(Vp,{size:15})}),h.jsx("span",{style:{fontFamily:'"JetBrains Mono", monospace',color:K.visible?"var(--text-1)":"var(--text-2)"},children:K.name})]},K.name))},N)),c&&h.jsx("div",{style:{marginTop:18,borderTop:"1px solid var(--bg-3)",paddingTop:12},children:h.jsxs(xx,{groupKey:"skills-section",label:h.jsxs(h.Fragment,{children:[h.jsx(Qx,{size:12,className:"icon-inline"})," skills"]}),total:c.skills.length,hidden:c.skills.filter(N=>!N.visible).length,expanded:w.has(bx),onToggleExpanded:()=>C(bx),onToggleAll:M||c.skills.length===0?void 0:D,children:[c.hasPatternRules&&h.jsxs("div",{style:{background:"var(--bg-2)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"8px 10px",marginBottom:8,color:"var(--text-2)"},children:[h.jsx(ui,{size:14,className:"icon-inline"})," This agent's"," ",h.jsx("code",{children:"agent.yaml"})," carries a hand-written skill allow-list (",(((H=c.gating)==null?void 0:H.allow)??[]).join(", "),") — the skill matrix is read-only. Edit the file to change it."]}),c.skills.length===0&&h.jsxs("div",{style:{color:"var(--text-2)"},children:["No skills installed — see ",h.jsx("code",{children:"docs/skills.md"}),"."]}),c.skills.map(N=>h.jsxs("div",{"data-testid":`skills-row-${N.name}`,style:{display:"flex",alignItems:"center",gap:8,padding:"4px 6px",borderRadius:4,opacity:N.visible?1:.45},title:N.available?N.description:`${N.description}
|
|
624
|
+
|
|
625
|
+
unavailable on this host: ${N.unavailableReason??"requirements not met"}`,children:[h.jsx("span",{"data-testid":`skills-toggle-${N.name}`,onClick:()=>ie(N.name,N.visible),style:{cursor:M?"not-allowed":"pointer",color:N.visible?"var(--accent)":"var(--text-2)",display:"inline-flex"},children:N.visible?h.jsx(Ql,{size:15}):h.jsx(Vp,{size:15})}),h.jsx("span",{style:{fontFamily:'"JetBrains Mono", monospace',color:N.visible?"var(--text-1)":"var(--text-2)"},children:N.name}),!N.available&&h.jsx("span",{style:{fontSize:11,color:"var(--warn, #d29922)"},children:"unavailable"})]},N.name))]})})]}),h.jsxs("div",{style:{width:230,borderLeft:"1px solid var(--bg-3)",padding:12,overflowY:"auto",flexShrink:0},children:[h.jsxs("div",{style:{fontFamily:'"JetBrains Mono", monospace',fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"var(--text-2)",marginBottom:6},children:[h.jsx(cT,{size:12,className:"icon-inline"})," MCP servers"]}),!(p!=null&&p.enabled)&&h.jsxs("div",{style:{color:"var(--text-2)"},children:["None configured — add ",h.jsx("code",{children:"mcp.servers"})," to config.yaml."]}),(p==null?void 0:p.enabled)&&Object.entries(p.servers).map(([N,$])=>h.jsxs("div",{"data-testid":`mcp-server-${N}`,style:{border:"1px solid var(--bg-3)",borderRadius:6,padding:8,marginBottom:8},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{style:{width:8,height:8,borderRadius:4,background:$.state==="connected"?"var(--ok, #3fb950)":$.state==="pending"?"var(--warn, #d29922)":"var(--danger, #e5534b)"}}),h.jsx("span",{style:{fontFamily:'"JetBrains Mono", monospace'},children:N}),h.jsx("span",{"data-testid":`mcp-reconnect-${N}`,title:"Reconnect",onClick:()=>void Me.mcpReconnect(N).then(()=>Me.mcpStatus().then(d)).catch(K=>_(K.message)),style:{marginLeft:"auto",cursor:"pointer",color:"var(--text-2)"},children:h.jsx(tr,{size:13})})]}),h.jsxs("div",{style:{color:"var(--text-2)",fontSize:12,marginTop:4},children:[$.state," · ",$.toolCount," tool",$.toolCount===1?"":"s",$.transport?` · ${$.transport}`:""]}),$.lastError&&h.jsx("div",{style:{color:"var(--danger, #e5534b)",fontSize:11,marginTop:4},children:$.lastError.slice(0,120)})]},N))]})]})}function I6(e){const t=Object.keys(e),n=[],r=(a,o,c)=>{for(const f of t)e[f].reports_to!==a||c.has(f)||(c.add(f),n.push({name:f,depth:o}),r(f,o+1,c))};r("principal",0,new Set);for(const a of t)n.some(o=>o.name===a)||n.push({name:a,depth:0});return n}function om(e,t,n){var o;let r=n;const a=new Set;for(;r&&r!=="principal"&&!a.has(r);){if(r===t)return!0;a.add(r),r=(o=e[r])==null?void 0:o.reports_to}return!1}function Sx(e,t,n){return!e.agents[t]||n!=="principal"&&(!e.agents[n]||om(e.agents,t,n))?null:{...e,agents:{...e.agents,[t]:{...e.agents[t],reports_to:n}}}}function P6(e,t){var a;const n=((a=e.agents[t])==null?void 0:a.reports_to)??"principal",r={};for(const[o,c]of Object.entries(e.agents))o!==t&&(r[o]=c.reports_to===t?{...c,reports_to:n}:c);return{...e,agents:r}}const Kp=e=>JSON.parse(JSON.stringify(e)),Kl={fontFamily:'"JetBrains Mono", monospace'},Gl={...Kl,fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"var(--text-2)",marginBottom:4},kr={width:"100%",boxSizing:"border-box",background:"var(--bg-1)",color:"var(--text-0)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"6px 8px",fontSize:13},ca=(e=!1,t=!1)=>({display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:6,fontSize:12,cursor:t?"default":"pointer",opacity:t?.5:1,background:e?"var(--accent)":"var(--bg-2)",color:e?"var(--bg-0)":"var(--text-1)",border:`1px solid ${e?"var(--accent)":"var(--bg-3)"}`});function br({title:e,hint:t,children:n}){return h.jsxs("div",{style:{marginBottom:12},children:[h.jsx("div",{style:Gl,children:e}),n,t&&h.jsx("div",{style:{fontSize:11,color:"var(--text-3)",marginTop:3},children:t})]})}function wx({values:e,onChange:t,placeholder:n,testId:r}){const[a,o]=x.useState(""),c=()=>{const f=a.trim().replace(/,+$/,"").trim();f&&t([...e,f]),o("")};return h.jsxs("div",{"data-testid":r,style:{...kr,display:"flex",flexWrap:"wrap",gap:6,padding:6,cursor:"text"},children:[e.map((f,p)=>h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"var(--bg-3)",borderRadius:999,padding:"2px 8px",fontSize:12},children:[f,h.jsx("button",{type:"button","aria-label":`remove ${f}`,onClick:()=>t(e.filter((d,m)=>m!==p)),style:{background:"none",border:0,color:"var(--text-2)",cursor:"pointer",padding:0,lineHeight:1},children:"✕"})]},`${f}-${p}`)),h.jsx("input",{value:a,placeholder:e.length===0?n:"",onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"||f.key===","?(f.preventDefault(),c()):f.key==="Backspace"&&a===""&&e.length>0&&t(e.slice(0,-1))},onBlur:c,style:{flex:1,minWidth:120,background:"transparent",border:0,outline:"none",color:"var(--text-0)",fontSize:13}})]})}function U6(){var Y,Z,ve,Oe,_e,Fe,st;const[e,t]=x.useState([]),[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(""),[p,d]=x.useState("principal"),[m,_]=x.useState(null),[y,b]=x.useState(null),[w,S]=x.useState(null),[C,k]=x.useState([]),[j,R]=x.useState(!1),[L,q]=x.useState(null),O=x.useRef(null),z=ae=>{O.current=ae},[J,ie]=x.useState(""),D=x.useRef(null),A=a!==null&&JSON.stringify(a)!==c,M=x.useMemo(()=>new Map(e.map(ae=>[ae.name,ae])),[e]),P=x.useCallback(async()=>{try{const[ae,pe]=await Promise.all([Me.teamGet(),Me.agents()]);if(r(ae),t(pe),ae.file){const Xe=Kp(ae.file);o(Xe),f(JSON.stringify(Xe)),_(nt=>nt??Object.keys(Xe.agents)[0]??null)}else o(null),f("");S(null)}catch(ae){S(ae.message)}},[]);x.useEffect(()=>{P()},[P]),x.useEffect(()=>{if(!a||!m){b(null);return}return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Me.teamPreview(a,m).then(ae=>b({block:ae.block,chars:ae.chars??ae.block.length,softMax:ae.softMaxChars??3e3,issues:ae.issues??[],warnings:ae.warnings??[]})).catch(ae=>S(ae.message))},350),()=>{D.current&&clearTimeout(D.current)}},[a,m]);const G=ae=>o(pe=>pe&&ae(pe)),H=(ae,pe)=>G(Xe=>({...Xe,agents:{...Xe.agents,[ae]:{...Xe.agents[ae],...pe}}})),N=async()=>{if(a){R(!0),k([]),q(null);try{const ae=await Me.teamSave(a);if(r(ae),ae.file){const pe=Kp(ae.file);o(pe),f(JSON.stringify(pe))}q(`Saved${ae.backup?" — previous version kept as a backup":""}. Agents see it on their next turn.`)}catch(ae){const pe=ae;pe.issues&&pe.issues.length>0?k(pe.issues):S(pe.message)}finally{R(!1)}}},$=()=>{if(n!=null&&n.file){const ae=Kp(n.file);o(ae),f(JSON.stringify(ae))}k([])},K=async()=>{R(!0);try{await Me.teamInit(J.trim()||void 0),await P(),d("principal")}catch(ae){S(ae.message)}finally{R(!1)}},re=ae=>{const pe=O.current;pe&&(o(Xe=>Xe&&(Sx(Xe,pe,ae)??Xe)),z(null))};if(w&&!n)return h.jsxs("div",{style:{padding:16,color:"var(--danger)"},children:[h.jsx(ui,{size:14,className:"icon-inline"})," ",w]});if(!n)return h.jsx("div",{style:{padding:16,color:"var(--text-2)"},children:"Loading…"});if(!n.exists)return h.jsxs("div",{style:{padding:20,maxWidth:520,color:"var(--text-1)"},"data-testid":"team-empty",children:[h.jsx("h3",{style:{margin:"0 0 8px"},children:"No team yet"}),h.jsxs("p",{style:{color:"var(--text-2)",lineHeight:1.5},children:["A team file tells every agent who is who, who reports to whom and who to involve for what — rendered into each agent's prompt from its own seat. Start with all ",e.length," agents reporting to you, then arrange them here."]}),h.jsx(br,{title:"Your name (the principal)",children:h.jsx("input",{style:kr,value:J,placeholder:"e.g. Ada",onChange:ae=>ie(ae.target.value)})}),h.jsxs("button",{type:"button",style:ca(!0,j),disabled:j,onClick:()=>void K(),"data-testid":"team-init",children:[h.jsx(Bh,{size:14})," Create team.yaml from ",e.length," agents"]}),h.jsxs("p",{style:{color:"var(--text-3)",fontSize:12,marginTop:14},children:["Same as ",h.jsx("code",{children:"somora team init"})," in a terminal. The file lives at ",h.jsx("code",{children:n.path}),"."]})]});if(!a)return h.jsxs("div",{style:{padding:20,color:"var(--text-1)"},"data-testid":"team-invalid",children:[h.jsx("h3",{style:{margin:"0 0 8px",color:"var(--danger)"},children:"team.yaml is invalid"}),h.jsxs("p",{style:{color:"var(--text-2)"},children:["The server keeps the last valid team in force. Fix the file by hand (",n.path,") — the problems:"]}),h.jsx("ul",{children:n.issues.map((ae,pe)=>h.jsxs("li",{children:[h.jsx("code",{children:ae.path}),": ",ae.message]},pe))}),h.jsxs("button",{type:"button",style:ca(),onClick:()=>void P(),children:[h.jsx(tr,{size:14})," Reload"]})]});const U=I6(a.agents),W=e.filter(ae=>!a.agents[ae.name]),I=p&&p!=="principal"&&a.agents[p]?p:p==="principal"?"principal":null,E=I&&I!=="principal"?a.agents[I]:null,F=(ae,pe)=>{const Xe=a.agents[ae],nt=M.get(ae),Pe=Xe.active===!1,at=I===ae;return h.jsxs("div",{"data-testid":`team-card-${ae}`,draggable:!0,onDragStart:()=>z(ae),onDragEnd:()=>z(null),onDragOver:V=>{const ce=O.current;ce&&ce!==ae&&!om(a.agents,ce,ae)&&V.preventDefault()},onDrop:V=>{V.preventDefault(),re(ae)},onClick:()=>{d(ae),_(ae)},style:{marginLeft:14+pe*22,marginBottom:6,padding:"6px 8px",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:8,opacity:Pe?.5:1,background:at?"var(--bg-3)":"var(--bg-2)",border:"1px solid var(--bg-3)",borderLeft:`3px solid ${(nt==null?void 0:nt.color)??"var(--bg-3)"}`,outline:at?`1px solid ${(nt==null?void 0:nt.color)??"var(--accent)"}`:"none",outlineOffset:-1},children:[h.jsx(V2,{size:12,style:{color:"var(--text-3)"}}),h.jsx("span",{style:{fontSize:16},children:(nt==null?void 0:nt.icon)??"🤖"}),h.jsx("span",{style:{fontWeight:600,color:"var(--text-0)"},children:ae}),h.jsx("span",{style:{color:"var(--text-2)",fontSize:12},children:Xe.title??(nt==null?void 0:nt.role)??""}),Pe&&h.jsx("span",{style:{...Kl,fontSize:10,color:"var(--warn)",marginLeft:"auto"},children:"INACTIVE"})]},ae)};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},"data-testid":"team-window",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--bg-3)"},children:[h.jsx("span",{style:{...Kl,fontSize:11,color:"var(--text-3)"},children:n.path}),h.jsx("span",{style:{flex:1}}),A&&h.jsx("span",{style:{fontSize:12,color:"var(--warn)"},children:"unsaved changes"}),!A&&L&&h.jsxs("span",{style:{fontSize:12,color:"var(--ok)"},children:[h.jsx(uc,{size:12,className:"icon-inline"})," ",L]}),h.jsxs("button",{type:"button",style:ca(!1,!A||j),disabled:!A||j,onClick:$,title:"Discard unsaved changes",children:[h.jsx(pm,{size:13})," Discard"]}),h.jsx("button",{type:"button",style:ca(!1,j),disabled:j,onClick:()=>void P(),title:"Reload from disk",children:h.jsx(tr,{size:13})}),h.jsxs("button",{type:"button","data-testid":"team-save",style:ca(!0,!A||j),disabled:!A||j,onClick:()=>void N(),children:[h.jsx(Xx,{size:13})," Save"]})]}),(w||C.length>0||(((Y=n.warnings)==null?void 0:Y.length)??0)>0)&&h.jsxs("div",{style:{padding:"6px 12px",borderBottom:"1px solid var(--bg-3)",fontSize:12},children:[w&&h.jsxs("div",{style:{color:"var(--danger)"},children:[h.jsx(ui,{size:12,className:"icon-inline"})," ",w]}),C.map((ae,pe)=>h.jsxs("div",{style:{color:"var(--danger)"},"data-testid":"team-issue",children:["not saved — ",h.jsx("code",{children:ae.path}),": ",ae.message]},pe)),(Z=n.warnings)==null?void 0:Z.map((ae,pe)=>h.jsx("div",{style:{color:"var(--warn)"},children:ae},pe))]}),h.jsxs("div",{style:{display:"flex",flex:1,minHeight:0},children:[h.jsxs("div",{style:{width:320,flexShrink:0,borderRight:"1px solid var(--bg-3)",padding:10,overflowY:"auto"},children:[h.jsx("div",{style:{...Gl,marginBottom:0},children:"Org chart"}),h.jsx("div",{style:{fontSize:11,color:"var(--text-3)",marginBottom:8},children:"Drag a card onto its new superior — or onto you."}),h.jsxs("div",{"data-testid":"team-card-principal",onDragOver:ae=>{O.current&&ae.preventDefault()},onDrop:ae=>{ae.preventDefault(),re("principal")},onClick:()=>d("principal"),style:{padding:"8px 10px",borderRadius:8,marginBottom:8,cursor:"pointer",background:I==="principal"?"var(--bg-3)":"var(--bg-2)",border:`1px solid ${I==="principal"?"var(--accent)":"var(--bg-3)"}`},children:[h.jsxs("div",{style:{fontWeight:700,color:"var(--text-0)"},children:["👤 ",a.principal.name||"Principal"]}),h.jsxs("div",{style:{fontSize:12,color:"var(--text-2)"},children:[a.principal.title??"Principal"," · human"]})]}),U.map(ae=>F(ae.name,ae.depth)),W.length>0&&h.jsxs("div",{style:{marginTop:14},children:[h.jsx("div",{style:Gl,children:"Not in the chart"}),W.map(ae=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",color:"var(--text-2)",fontSize:13},children:[h.jsx("span",{children:ae.icon??"🤖"}),h.jsx("span",{children:ae.name}),h.jsx("span",{style:{fontSize:11},children:ae.role??""}),h.jsxs("button",{type:"button","data-testid":`team-add-${ae.name}`,style:{...ca(),marginLeft:"auto",padding:"2px 8px"},onClick:()=>{G(pe=>({...pe,agents:{...pe.agents,[ae.name]:{reports_to:"principal",...ae.role?{title:ae.role}:{}}}})),d(ae.name),_(ae.name)},children:[h.jsx(vT,{size:12})," add"]})]},ae.name)),h.jsx("div",{style:{fontSize:11,color:"var(--text-3)",marginTop:4},children:'Until added, colleagues see these under "Not in the org chart yet".'})]})]}),h.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[h.jsxs("div",{style:{padding:12,overflowY:"auto",flex:1,minHeight:0},children:[I==="principal"&&h.jsxs("div",{"data-testid":"team-form-principal",children:[h.jsx(br,{title:"Name",hint:"How the agents should refer to you.",children:h.jsx("input",{style:kr,value:a.principal.name,onChange:ae=>G(pe=>({...pe,principal:{...pe.principal,name:ae.target.value}}))})}),h.jsx(br,{title:"Title",children:h.jsx("input",{style:kr,value:a.principal.title??"",placeholder:"Principal",onChange:ae=>G(pe=>({...pe,principal:{...pe.principal,...ae.target.value?{title:ae.target.value}:{title:void 0}}}))})}),h.jsx(br,{title:"About",hint:"One to three sentences. Personal detail stays in the agents' USER.md.",children:h.jsx("textarea",{style:{...kr,minHeight:64},value:a.principal.about??"",onChange:ae=>G(pe=>({...pe,principal:{...pe.principal,...ae.target.value?{about:ae.target.value}:{about:void 0}}}))})}),h.jsx(br,{title:"Rules — one per line",hint:"Rendered verbatim at the end of every agent's block. Empty = somora's four defaults.",children:h.jsx("textarea",{style:{...kr,minHeight:110},value:(a.rules??[]).join(`
|
|
626
|
+
`),onChange:ae=>{const pe=ae.target.value.split(`
|
|
627
|
+
`);G(Xe=>({...Xe,rules:pe}))},onBlur:()=>G(ae=>{const pe=(ae.rules??[]).map(Xe=>Xe.trim()).filter(Boolean);return pe.length>0?{...ae,rules:pe}:{...ae,rules:void 0}})})})]}),E&&I&&I!=="principal"&&h.jsxs("div",{"data-testid":`team-form-${I}`,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12},children:[h.jsx("span",{style:{fontSize:22},children:((ve=M.get(I))==null?void 0:ve.icon)??"🤖"}),h.jsxs("div",{children:[h.jsx("div",{style:{fontWeight:700,color:"var(--text-0)"},children:I}),h.jsx("div",{style:{fontSize:12,color:"var(--text-2)"},children:(Oe=M.get(I))==null?void 0:Oe.description})]}),h.jsx("span",{style:{flex:1}}),h.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-1)",cursor:"pointer"},title:"Off = temporarily out of the team: stays in the chart greyed out, colleagues are told not to involve it",children:[h.jsx("input",{type:"checkbox","data-testid":"team-active",checked:E.active!==!1,onChange:ae=>H(I,ae.target.checked?{active:void 0}:{active:!1})}),"active"]}),h.jsxs("button",{type:"button",style:ca(),title:"Remove from the chart (the agent itself stays)",onClick:()=>{G(ae=>P6(ae,I)),d("principal")},children:[h.jsx(_T,{size:12})," remove"]})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[h.jsx(br,{title:"Title",hint:`Default: "${((_e=M.get(I))==null?void 0:_e.role)??((Fe=M.get(I))==null?void 0:Fe.description)??I}" from AGENTS.md`,children:h.jsx("input",{style:kr,value:E.title??"",placeholder:((st=M.get(I))==null?void 0:st.role)??"",onChange:ae=>H(I,{title:ae.target.value||void 0})})}),h.jsx(br,{title:"Reports to",children:h.jsxs("select",{"data-testid":"team-reports-to",style:kr,value:E.reports_to,onChange:ae=>G(pe=>Sx(pe,I,ae.target.value)??pe),children:[h.jsxs("option",{value:"principal",children:[a.principal.name||"Principal"," (principal)"]}),Object.keys(a.agents).filter(ae=>ae!==I&&!om(a.agents,I,ae)).map(ae=>h.jsx("option",{value:ae,children:ae},ae))]})})]}),h.jsx(br,{title:"Involve for",hint:"Short trigger phrases — what colleagues bring here. Enter adds a phrase.",children:h.jsx(wx,{testId:"team-involve",values:E.involve_for??[],placeholder:"e.g. library docs, framework comparisons",onChange:ae=>H(I,{involve_for:ae.length?ae:void 0})})}),h.jsx(br,{title:"Not for",hint:"What NOT to bring here.",children:h.jsx(wx,{testId:"team-notfor",values:E.not_for??[],placeholder:"e.g. media, finance",onChange:ae=>H(I,{not_for:ae.length?ae:void 0})})}),h.jsx(br,{title:"Notes",hint:"Optional nuance, rendered after the phrases (max 600 characters).",children:h.jsx("textarea",{style:{...kr,minHeight:56},maxLength:600,value:E.notes??"",onChange:ae=>H(I,{notes:ae.target.value||void 0})})})]}),!I&&h.jsx("div",{style:{color:"var(--text-2)"},children:"Select a card on the left."})]}),h.jsxs("div",{style:{borderTop:"1px solid var(--bg-3)",flex:"0 0 46%",minHeight:280,display:"flex",flexDirection:"column"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px"},children:[h.jsx(Ql,{size:13,style:{color:"var(--text-2)"}}),h.jsx("span",{style:{...Gl,marginBottom:0},children:"Preview — what"}),h.jsx("select",{"data-testid":"team-preview-agent",value:m??"",onChange:ae=>_(ae.target.value),style:{...kr,width:"auto",padding:"2px 6px",fontSize:12},children:[...Object.keys(a.agents),...W.map(ae=>ae.name)].map(ae=>h.jsx("option",{value:ae,children:ae},ae))}),h.jsxs("span",{style:{...Gl,marginBottom:0},children:["sees",A?" (draft)":""]}),h.jsx("span",{style:{flex:1}}),y&&h.jsxs("span",{style:{...Kl,fontSize:11,color:y.chars>y.softMax?"var(--warn)":"var(--text-3)"},children:[y.chars," / ",y.softMax," chars"]})]}),h.jsx("pre",{"data-testid":"team-preview",style:{...Kl,margin:0,padding:"0 12px 12px",fontSize:11.5,lineHeight:1.45,color:"var(--text-1)",overflow:"auto",flex:1,whiteSpace:"pre-wrap"},children:y?y.issues.length>0?y.issues.map(ae=>`✗ ${ae.path}: ${ae.message}`).join(`
|
|
628
|
+
`):y.block:"…"})]})]})]})]})}const cr={fontFamily:'"JetBrains Mono", monospace'},fh={...cr,fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"var(--text-2)"},Il=(e=!1,t=!1)=>({display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:6,fontSize:12,cursor:t?"default":"pointer",opacity:t?.5:1,background:e?"var(--accent)":"var(--bg-2)",color:e?"var(--bg-0)":"var(--text-1)",border:`1px solid ${e?"var(--accent)":"var(--bg-3)"}`}),po=e=>Math.round(e/4),ki=e=>e.toLocaleString("en-US");function th({title:e,value:t,cap:n,hint:r,testId:a}){const o=n!==void 0&&t>n,c=n?Math.min(100,Math.round(t/n*100)):0;return h.jsxs("div",{"data-testid":a,style:{minWidth:150,flex:1},children:[h.jsx("div",{style:{...fh,marginBottom:2},children:e}),h.jsxs("div",{style:{...cr,fontSize:13,color:o?"var(--warn)":"var(--text-0)"},children:[ki(t),n!==void 0?` / ${ki(n)}`:""," ",h.jsxs("span",{style:{color:"var(--text-3)",fontSize:11},children:["chars · ≈",ki(po(t))," tok"]})]}),n!==void 0&&h.jsx("div",{style:{height:3,background:"var(--bg-3)",borderRadius:2,marginTop:4},children:h.jsx("div",{style:{width:`${c}%`,height:"100%",borderRadius:2,background:o?"var(--warn)":"var(--accent)"}})}),r&&h.jsx("div",{style:{fontSize:10.5,color:"var(--text-3)",marginTop:3},children:r})]})}function H6({agentName:e}){const[t,n]=x.useState(null),[r,a]=x.useState({}),[o,c]=x.useState("AGENTS.md"),[f,p]=x.useState(null),[d,m]=x.useState(null),[_,y]=x.useState(null),[b,w]=x.useState(!1),[S,C]=x.useState([]),[k,j]=x.useState("main"),[R,L]=x.useState(null),[q,O]=x.useState(null),[z,J]=x.useState(null),ie=x.useCallback(async()=>{try{const re=await Me.persona(e);n(re),a(Object.fromEntries(re.files.map(U=>[U.name,U.content]))),y(null),p(null)}catch(re){p(re.message)}},[e]);x.useEffect(()=>{ie()},[ie]),x.useEffect(()=>{Me.sessions(e).then(C).catch(()=>C([]))},[e]);const D=x.useCallback(async()=>{try{L(await Me.promptPreview(e,k)),O(null)}catch(re){O(re.message)}},[e,k]);x.useEffect(()=>{D()},[D]),x.useEffect(()=>{let re=!1;return Me.voiceInstructions(e,k).then(U=>{re||J(U)}).catch(()=>{re||J(null)}),()=>{re=!0}},[e,k]);const A=x.useMemo(()=>new Map(((t==null?void 0:t.files)??[]).map(re=>[re.name,re])),[t]),M=re=>A.has(re)&&r[re]!==A.get(re).content,P=(t==null?void 0:t.kind)==="builder"?["AGENTS.md"]:["AGENTS.md","SOUL.md","USER.md"],G=P.reduce((re,U)=>{var W;return re+(((W=r[U])==null?void 0:W.length)??0)},0),H=async re=>{const U=A.get(re);if(U){w(!0),m(null),p(null),y(null);try{const W=await Me.personaSave(e,re,r[re]??"",U.hash);m(`${re} saved${W.backup?" — previous version kept as a backup":""}. The agent uses it on its next turn.`),await ie(),D()}catch(W){const I=W;I.status===409?y({file:re,content:I.currentContent??""}):p(I.message)}finally{w(!1)}}};if(f&&!t)return h.jsxs("div",{style:{padding:16,color:"var(--danger)"},children:[h.jsx(ui,{size:14,className:"icon-inline"})," ",f]});if(!t)return h.jsx("div",{style:{padding:16,color:"var(--text-2)"},children:"Loading…"});const N=t.budgets,$=R==null?void 0:R.parts.find(re=>re.key==="team"),K=[...P.map(re=>({id:re,title:re,icon:h.jsx(hc,{size:12})})),{id:"agent.yaml",title:"agent.yaml",icon:h.jsx(Kb,{size:12})},{id:"prompt",title:"Full prompt",icon:h.jsx(Ql,{size:12})},...z?[{id:"voice",title:"Voice prompt",icon:h.jsx(ko,{size:12})}]:[]];return h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},"data-testid":"agent-config-window",children:[h.jsxs("div",{style:{display:"flex",gap:18,padding:"10px 14px",borderBottom:"1px solid var(--bg-3)",flexWrap:"wrap"},children:[h.jsx(th,{testId:"meter-persona",title:(t==null?void 0:t.kind)==="builder"?"Builder rules (AGENTS.md)":"Persona (3 files)",value:G,cap:N.personaTotalChars,hint:"AGENTS + SOUL + USER, as drafted here"}),h.jsx(th,{testId:"meter-team",title:"Team block",value:($==null?void 0:$.chars)??0,cap:N.teamBlockChars,hint:"from team.yaml"}),h.jsx(th,{testId:"meter-prompt",title:"Full prompt",value:(R==null?void 0:R.chars)??0,hint:`everything somora sends as instructions · session ${k}`}),h.jsx(th,{testId:"meter-tools",title:`Tool schemas (${(R==null?void 0:R.tools.count)??0})`,value:(R==null?void 0:R.tools.schemaChars)??0,hint:"API tool channel, not in the prompt text"})]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"6px 10px",borderBottom:"1px solid var(--bg-3)"},children:[K.map(re=>{var I;const U=A.get(re.id),W=U&&!U.readOnly&&(((I=r[re.id])==null?void 0:I.length)??0)>N.personaFileChars;return h.jsxs("button",{type:"button","data-testid":`agent-tab-${re.id}`,onClick:()=>c(re.id),style:{...Il(!1),padding:"4px 10px",background:o===re.id?"var(--bg-3)":"transparent",borderColor:o===re.id?"var(--bg-3)":"transparent",color:W?"var(--warn)":o===re.id?"var(--text-0)":"var(--text-2)"},children:[re.icon," ",re.title,M(re.id)?" •":""]},re.id)}),h.jsx("span",{style:{flex:1}}),d&&h.jsxs("span",{style:{fontSize:12,color:"var(--ok)"},children:[h.jsx(uc,{size:12,className:"icon-inline"})," ",d]}),h.jsx("button",{type:"button",style:Il(!1,b),disabled:b,onClick:()=>{ie(),D()},title:"Reload from disk",children:h.jsx(tr,{size:13})})]}),(f||_)&&h.jsxs("div",{style:{padding:"6px 12px",borderBottom:"1px solid var(--bg-3)",fontSize:12,color:"var(--danger)"},"data-testid":"agent-conflict",children:[h.jsx(ui,{size:12,className:"icon-inline"})," ",_?h.jsxs(h.Fragment,{children:[_.file," changed on disk since you loaded it — the agent may have edited it. Your text was NOT saved."," ",h.jsx("button",{type:"button",style:{...Il(),padding:"2px 8px"},onClick:()=>void ie(),children:"Reload"})," ","(your draft stays in the editor until you reload)"]}):f]}),h.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[o!=="prompt"&&(()=>{const re=A.get(o);if(!re)return null;const U=r[o]??"",W=!re.readOnly&&U.length>N.personaFileChars;return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px"},children:[h.jsxs("span",{style:{...cr,fontSize:11,color:W?"var(--warn)":"var(--text-3)"},"data-testid":"agent-file-count",children:[ki(U.length),re.readOnly?"":` / ${ki(N.personaFileChars)}`," chars · ≈",ki(po(U.length))," tok",W?" — over the per-file budget (promptBudgets.personaFileChars)":""]}),!re.exists&&h.jsx("span",{style:{fontSize:11,color:"var(--text-3)"},children:"(file does not exist yet — saving creates it)"}),h.jsx("span",{style:{flex:1}}),re.readOnly?h.jsxs("span",{style:{fontSize:11,color:"var(--text-3)"},children:[h.jsx(Kb,{size:11,className:"icon-inline"})," operator config — model, fallback, REM. Read-only here; edit the file or use the session model/thinking controls."]}):h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",style:Il(!1,!M(o)||b),disabled:!M(o)||b,onClick:()=>a(I=>({...I,[o]:re.content})),children:[h.jsx(pm,{size:12})," Discard"]}),h.jsxs("button",{type:"button","data-testid":"agent-save",style:Il(!0,!M(o)||b),disabled:!M(o)||b,onClick:()=>void H(o),children:[h.jsx(Xx,{size:12})," Save ",o]})]})]}),h.jsx("textarea",{"data-testid":"agent-editor",value:U,readOnly:re.readOnly,spellCheck:!1,onChange:I=>a(E=>({...E,[o]:I.target.value})),style:{...cr,flex:1,minHeight:0,resize:"none",margin:"0 12px 12px",padding:10,fontSize:12.5,lineHeight:1.5,background:"var(--bg-1)",color:re.readOnly?"var(--text-2)":"var(--text-0)",border:`1px solid ${W?"var(--warn)":"var(--bg-3)"}`,borderRadius:6,outline:"none"}})]})})(),o==="voice"&&z&&h.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},"data-testid":"agent-voice-tab",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",flexWrap:"wrap"},children:[h.jsx("span",{style:fh,children:"what the talking model is told"}),h.jsx("span",{style:{flex:1}}),h.jsxs("span",{style:{...cr,fontSize:11,color:"var(--text-3)"},children:[ki(z.chars)," chars · ≈",ki(po(z.chars))," tokens"]})]}),h.jsxs("div",{style:{display:"flex",gap:12,padding:"0 12px 8px",flexWrap:"wrap",alignItems:"flex-start"},children:[h.jsx("table",{style:{...cr,fontSize:11,borderCollapse:"collapse",color:"var(--text-1)"},"data-testid":"agent-voice-facts",children:h.jsxs("tbody",{children:[h.jsxs("tr",{children:[h.jsx("td",{style:{padding:"1px 10px 1px 0",color:"var(--text-2)"},children:"character"}),h.jsx("td",{style:{padding:"1px 8px"},children:z.source==="VOICE.md"?"VOICE.md (hand-written)":"derived from the persona"})]}),h.jsxs("tr",{children:[h.jsx("td",{style:{padding:"1px 10px 1px 0",color:"var(--text-2)"},children:"voice"}),h.jsx("td",{style:{padding:"1px 8px"},children:z.voice})]}),h.jsxs("tr",{children:[h.jsx("td",{style:{padding:"1px 10px 1px 0",color:"var(--text-2)"},children:"language"}),h.jsx("td",{style:{padding:"1px 8px"},children:z.language})]}),h.jsxs("tr",{children:[h.jsx("td",{style:{padding:"1px 10px 1px 0",color:"var(--text-2)"},children:"asks the agent"}),h.jsx("td",{style:{padding:"1px 8px"},children:z.consultPolicy})]})]})}),h.jsxs("div",{style:{fontSize:11,color:"var(--text-3)",maxWidth:380,lineHeight:1.45},children:[z.source==="VOICE.md"?"This agent has a VOICE.md, so the character below is yours and somora only adds the rules under it.":"No VOICE.md for this agent, so the character is derived from its persona. Write one to take it over; the rules under it stay."," ","This is the whole instruction for the talking model — what it knows about the work comes from the agent, live, during the call."]})]}),h.jsx("pre",{"data-testid":"agent-voice-text",style:{...cr,margin:"0 12px 12px",padding:10,fontSize:11.5,lineHeight:1.45,color:"var(--text-1)",background:"var(--bg-1)",border:"1px solid var(--bg-3)",borderRadius:6,overflow:"auto",flex:1,whiteSpace:"pre-wrap"},children:z.text})]}),o==="prompt"&&h.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},"data-testid":"agent-prompt-tab",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",flexWrap:"wrap"},children:[h.jsx("span",{style:fh,children:"as the next turn on"}),h.jsx("select",{value:k,onChange:re=>j(re.target.value),style:{...cr,fontSize:12,background:"var(--bg-1)",color:"var(--text-0)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"2px 6px"},children:[{id:"main",slug:"main"},...S.filter(re=>!re.isMain)].map(re=>h.jsx("option",{value:re.id,children:re.slug},re.id))}),h.jsx("span",{style:fh,children:"would send it"}),h.jsx("span",{style:{flex:1}}),R&&h.jsxs("span",{style:{...cr,fontSize:11,color:"var(--text-3)"},children:[ki(R.chars)," chars · ≈",ki(po(R.chars))," tokens"]})]}),q&&h.jsx("div",{style:{padding:"0 12px",color:"var(--danger)",fontSize:12},children:q}),R&&h.jsxs("div",{style:{display:"flex",gap:12,padding:"0 12px 8px",flexWrap:"wrap"},children:[h.jsx("table",{style:{...cr,fontSize:11,borderCollapse:"collapse",color:"var(--text-1)"},"data-testid":"agent-prompt-parts",children:h.jsxs("tbody",{children:[R.parts.map(re=>h.jsxs("tr",{children:[h.jsx("td",{style:{padding:"1px 10px 1px 0",color:"var(--text-2)"},children:re.label}),h.jsx("td",{style:{padding:"1px 8px",textAlign:"right"},children:ki(re.chars)}),h.jsxs("td",{style:{padding:"1px 8px",textAlign:"right",color:"var(--text-3)"},children:["≈",ki(po(re.chars))," tok"]}),h.jsxs("td",{style:{padding:"1px 8px",textAlign:"right",color:"var(--text-3)"},children:[R.chars?Math.round(re.chars/R.chars*100):0," %"]})]},re.key)),h.jsxs("tr",{style:{borderTop:"1px solid var(--bg-3)"},children:[h.jsxs("td",{style:{padding:"3px 10px 1px 0",color:"var(--text-2)"},children:["+ tool schemas (",R.tools.count," tools, API tool channel)"]}),h.jsx("td",{style:{padding:"3px 8px 1px",textAlign:"right"},children:ki(R.tools.schemaChars)}),h.jsxs("td",{style:{padding:"3px 8px 1px",textAlign:"right",color:"var(--text-3)"},children:["≈",ki(po(R.tools.schemaChars))," tok"]}),h.jsx("td",{})]})]})}),h.jsxs("div",{style:{fontSize:11,color:"var(--text-3)",maxWidth:360,lineHeight:1.45},children:["Not in this text: ",R.notIncluded.join("; "),". Token counts are chars ÷ 4 — an estimate."]})]}),h.jsx("pre",{"data-testid":"agent-prompt-text",style:{...cr,margin:"0 12px 12px",padding:10,fontSize:11.5,lineHeight:1.45,color:"var(--text-1)",background:"var(--bg-1)",border:"1px solid var(--bg-3)",borderRadius:6,overflow:"auto",flex:1,whiteSpace:"pre-wrap"},children:(R==null?void 0:R.text)??"…"})]})]})]})}async function $6(e,t){var n;try{if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))return await navigator.clipboard.writeText(e),"copied"}catch{}return F6(t)?"selected":"failed"}function F6(e){if(!e||typeof document>"u"||typeof window>"u")return!1;try{const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();return n?(n.removeAllRanges(),n.addRange(t),!0):!1}catch{return!1}}const ph=[{key:"aspect_ratio",label:"Aspect ratio",placeholder:"e.g. 16:9"},{key:"size",label:"Size (pixels)",placeholder:"e.g. 1024x1792"},{key:"resolution",label:"Resolution",placeholder:"e.g. 2K"},{key:"quality",label:"Quality",placeholder:"e.g. medium"},{key:"output_format",label:"Format",placeholder:"e.g. png"},{key:"background",label:"Background",placeholder:"e.g. transparent"}];function kx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`}function Ex(e){return e===void 0?null:e<.01?"<$0.01":`$${e.toFixed(2)}`}function q6(e){const t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}function W6(e){return ph.map(t=>e[t.key]).filter(t=>typeof t=="string"&&t.length>0).join(" · ")}function K6(){var at;const[e,t]=x.useState(null),[n,r]=x.useState(null),[a,o]=x.useState(null),[c,f]=x.useState(""),[p,d]=x.useState({}),[m,_]=x.useState(1),[y,b]=x.useState(""),[w,S]=x.useState(!1),[C,k]=x.useState(null),[j,R]=x.useState([]),[L,q]=x.useState(0),[O,z]=x.useState(0),[J,ie]=x.useState(""),D=Hw(),[A,M]=x.useState("all"),[P,G]=x.useState("image"),[H,N]=x.useState(null),[$,K]=x.useState(""),[re,U]=x.useState(""),[W,I]=x.useState({}),[E,F]=x.useState(0),[Y,Z]=x.useState(null),ve=x.useRef(null),Oe=x.useMemo(()=>(e==null?void 0:e.models)??[],[e]);x.useEffect(()=>{Me.imagesStatus().then(V=>{t(V),r(ce=>{var X,fe;return ce??((fe=(X=V.models)==null?void 0:X[0])==null?void 0:fe.name)??null})}).catch(V=>k(V.message))},[]);const _e=x.useCallback(async V=>{try{const ce=await Me.media({...V?{query:V}:{},...A!=="all"?{kind:A}:{},limit:60});R(ce.items),q(ce.total),z(ce.totalBytes)}catch(ce){k(ce.message)}},[A]);x.useEffect(()=>{_e("")},[_e,E]),x.useEffect(()=>{const V=setTimeout(()=>void _e(J),250);return()=>clearTimeout(V)},[J,_e]),x.useEffect(()=>{if(!n)return;let V=!1;return Me.imageCapabilities(n).then(ce=>{V||(o(ce),d(X=>{const fe={};for(const{key:Le}of ph){if(ce.supported&&!ce.supported.includes(Le))continue;const Ge=ce.values[Le],Te=X[Le];Te&&(!Ge||Ge.includes(Te))?fe[Le]=Te:ce.defaults[Le]&&(fe[Le]=ce.defaults[Le])}return fe}))}).catch(()=>{V||o(null)}),()=>{V=!0}},[n]);const Fe=(a==null?void 0:a.maxN)??10,st=x.useCallback(V=>a!=null&&a.supported?a.supported.includes(V):!0,[a]),ae=x.useMemo(()=>ph.filter(V=>st(V.key)),[st]);x.useEffect(()=>{var ce;if(!H)return;const V=(((ce=e==null?void 0:e.models)==null?void 0:ce.length)??0)>0;!V&&H.enabled&&G("video"),V&&!H.enabled&&G("image")},[H,e]),x.useEffect(()=>{let V=!1,ce=null;const X=new Set,fe=async()=>{try{const Le=await Me.videoStatus();if(V)return;N(Le);const Ge=Le.jobs??[];for(const gt of Ge)(gt.status==="completed"||gt.status==="failed")&&!X.has(gt.id)&&(X.add(gt.id),gt.status==="completed"&&F(be=>be+1));const Te=Ge.some(gt=>gt.status==="queued"||gt.status==="in_progress");V||(ce=setTimeout(()=>void fe(),Te?4e3:2e4))}catch{V||(ce=setTimeout(()=>void fe(),2e4))}};return fe(),()=>{V=!0,ce&&clearTimeout(ce)}},[]),x.useEffect(()=>{const V=()=>F(ce=>ce+1);return window.addEventListener("focus",V),()=>window.removeEventListener("focus",V)},[]);const pe=x.useCallback(async()=>{if(!(!c.trim()||w)){S(!0),k(null);try{await Me.generateVideo({prompt:c.trim(),...$?{model:$}:{},...re.trim()?{seconds:Number(re.trim())}:{},...W.aspect_ratio?{aspect_ratio:W.aspect_ratio}:{}}),N(await Me.videoStatus())}catch(V){k(V.message)}finally{S(!1)}}},[c,w,$,re,W]),Xe=x.useCallback(async()=>{if(!(!c.trim()||w)){S(!0),k(null);try{const V=await Me.generateImage({prompt:c.trim(),...n?{model:n}:{},...p,...m>1&&Fe>1?{n:m}:{},...y.trim()&&st("seed")?{seed:Number(y.trim())}:{}});R(ce=>[...V.images,...ce]),q(ce=>ce+V.images.length),z(ce=>ce+V.images.reduce((X,fe)=>X+fe.bytes,0)),Z(V.images[0]??null)}catch(V){k(V.message)}finally{S(!1)}}},[c,w,n,p,m,Fe,y,st]),nt=x.useCallback(async V=>{try{await Me.forgetImage(V),R(ce=>ce.filter(X=>X.id!==V)),q(ce=>Math.max(0,ce-1)),Z(ce=>(ce==null?void 0:ce.id)===V?null:ce)}catch(ce){k(ce.message)}},[]),Pe=x.useCallback(V=>{var X;f(V.prompt),r(V.modelName);const ce={};for(const{key:fe}of ph){const Le=V.specs[fe];typeof Le=="string"&&(ce[fe]=Le)}d(ce),typeof V.specs.seed=="number"&&b(String(V.specs.seed)),(X=ve.current)==null||X.focus()},[]);return e&&!e.enabled&&H&&!H.enabled?h.jsxs("div",{style:{padding:20,fontSize:13,color:"var(--text-1)"},children:[h.jsx(ui,{size:14,className:"icon-inline"})," Media generation is not configured. Add an ",h.jsx("code",{children:"imageGen"})," or ",h.jsx("code",{children:"videoGen"})," block with at least one model to config.yaml."]}):h.jsxs("div",{style:{display:"flex",height:"100%",fontSize:13,minHeight:0},children:[h.jsxs("div",{style:{width:288,flex:"none",borderRight:"1px solid var(--line)",padding:12,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[(H==null?void 0:H.enabled)&&h.jsx("div",{"data-testid":"media-mode-switch",style:{display:"flex",gap:6},children:["image","video"].map(V=>h.jsx("button",{type:"button",onClick:()=>G(V),style:{...zs,flex:1,borderColor:P===V?"var(--accent)":"var(--line-2)",color:P===V?"var(--accent)":"var(--text-2)"},children:V==="image"?h.jsxs(h.Fragment,{children:[h.jsx(Xp,{size:11})," Image"]}):h.jsxs(h.Fragment,{children:[h.jsx(qb,{size:11})," Video"]})},V))}),P==="image"&&Oe.length===0&&h.jsxs("div",{style:{color:"var(--text-2)",fontSize:12,lineHeight:1.45},children:[h.jsx(ui,{size:14,className:"icon-inline"})," No image models configured — set ",h.jsx("code",{children:"imageGen"})," in config.yaml. The gallery below still shows everything that exists."]}),h.jsxs("label",{style:ua,children:["Model",P==="video"?h.jsx("select",{value:$,onChange:V=>K(V.target.value),style:xr,children:((H==null?void 0:H.models)??[]).map(V=>h.jsx("option",{value:V.name,children:V.label},V.name))}):h.jsx("select",{value:n??"",onChange:V=>r(V.target.value),style:xr,children:Oe.map(V=>h.jsx("option",{value:V.name,children:V.label},V.name))})]}),h.jsxs("label",{style:ua,children:["Prompt",h.jsx("textarea",{ref:ve,value:c,onChange:V=>f(V.target.value),onKeyDown:V=>{(V.metaKey||V.ctrlKey)&&V.key==="Enter"&&(P==="video"?pe():Xe())},rows:4,placeholder:"What should the image show?",style:{...xr,resize:"vertical",fontFamily:"inherit",lineHeight:1.45}})]}),P==="video"&&h.jsxs(h.Fragment,{children:[h.jsxs("label",{style:ua,children:["Seconds",h.jsx("input",{value:re,onChange:V=>U(V.target.value),placeholder:"model default",style:xr})]}),h.jsxs("label",{style:ua,children:["Aspect ratio",h.jsxs("select",{value:W.aspect_ratio??"",onChange:V=>I(ce=>({...ce,aspect_ratio:V.target.value||void 0})),style:xr,children:[h.jsx("option",{value:"",children:"— model default —"}),["16:9","9:16","1:1"].map(V=>h.jsx("option",{value:V,children:V},V))]})]}),h.jsx("div",{style:{color:"var(--text-3)",fontSize:11,lineHeight:1.4},children:"A render takes minutes. This starts it and returns — the gallery updates by itself when it lands."})]}),P==="image"&&ae.map(({key:V,label:ce,placeholder:X})=>{var Le,Ge;const fe=a==null?void 0:a.values[V];return h.jsxs("label",{style:ua,children:[ce,fe&&fe.length>0?h.jsxs("select",{value:p[V]??"",onChange:Te=>d(gt=>({...gt,[V]:Te.target.value})),style:xr,children:[h.jsx("option",{value:"",children:"— model default —"}),fe.map(Te=>h.jsx("option",{value:Te,children:Te},Te))]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:p[V]??"",onChange:Te=>d(gt=>({...gt,[V]:Te.target.value})),placeholder:X,list:(Le=a==null?void 0:a.recommended)!=null&&Le[V]?`img-rec-${V}`:void 0,style:xr}),((Ge=a==null?void 0:a.recommended)==null?void 0:Ge[V])&&h.jsx("datalist",{id:`img-rec-${V}`,children:a.recommended[V].map(Te=>h.jsx("option",{value:Te},Te))})]})]},V)}),(Fe>1||st("seed"))&&h.jsxs("div",{style:{display:"flex",gap:8},children:[Fe>1&&h.jsxs("label",{style:{...ua,flex:1},children:["Count",h.jsx("input",{type:"number",min:1,max:Fe,value:m,onChange:V=>_(Math.max(1,Math.min(Fe,Number(V.target.value)||1))),style:xr})]}),st("seed")&&h.jsxs("label",{style:{...ua,flex:1},children:["Seed",h.jsx("input",{value:y,onChange:V=>b(V.target.value.replace(/[^0-9]/g,"")),placeholder:"random",style:xr}),h.jsx("span",{style:Gp,children:"Same prompt and seed reproduce the same image."})]})]}),h.jsxs("span",{style:Gp,children:["Every image is kept in ",(e==null?void 0:e.outputDir)??"the images folder",", and nowhere else."]}),h.jsx("button",{type:"button",disabled:w||!c.trim()||(P==="image"?Oe.length===0:!(((at=H==null?void 0:H.models)==null?void 0:at.length)??0)),onClick:()=>void(P==="video"?pe():Xe()),style:{marginTop:2,padding:"9px 12px",borderRadius:6,border:"1px solid var(--accent-dim)",background:w||!c.trim()?"var(--bg-3)":"var(--accent-glow)",color:w||!c.trim()?"var(--text-2)":"var(--text-0)",cursor:w||!c.trim()?"default":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:7,fontSize:13},children:w?h.jsxs(h.Fragment,{children:[h.jsx(Zp,{size:14,className:"somora-spin"})," Generating…"]}):h.jsxs(h.Fragment,{children:[h.jsx(xT,{size:14})," ",P==="video"?"Start render":"Generate"]})}),(a==null?void 0:a.source)==="unknown"&&h.jsx("span",{style:Gp,children:"Could not read this model's parameter list — fields accept any value and the provider decides."}),C&&h.jsx("div",{style:{color:"var(--danger)",border:"1px solid var(--danger)",borderRadius:6,padding:"8px 10px",whiteSpace:"pre-wrap",lineHeight:1.45},children:C})]}),((H==null?void 0:H.jobs)??[]).some(V=>V.status==="queued"||V.status==="in_progress")&&h.jsx("div",{style:{position:"absolute",left:12,right:12,bottom:10,zIndex:2,display:"flex",flexDirection:"column",gap:4},children:((H==null?void 0:H.jobs)??[]).filter(V=>V.status==="queued"||V.status==="in_progress").slice(0,4).map(V=>h.jsxs("div",{title:V.prompt,style:{display:"flex",alignItems:"center",gap:7,fontSize:11,color:"var(--text-2)",background:"var(--bg-2)",border:"1px solid var(--line-2)",borderRadius:5,padding:"4px 8px"},children:[h.jsx(Zp,{size:11,className:"somora-spin"}),h.jsx("span",{style:{flex:"none"},children:V.modelName}),h.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V.prompt}),h.jsx("span",{style:{flex:"none"},children:V.status==="queued"?V.queuePosition!==void 0?`queued · ${V.queuePosition} ahead`:"queued":`${V.progress??0}%`})]},V.id))}),h.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--line)",flex:"none"},children:[h.jsx(gT,{size:13,style:{color:"var(--text-2)",flex:"none"}}),h.jsx("input",{value:J,onChange:V=>ie(V.target.value),placeholder:"Search prompts…",style:{...xr,flex:1,marginTop:0}}),(H==null?void 0:H.enabled)&&["all","image","video"].map(V=>h.jsx("button",{type:"button",onClick:()=>M(V),style:{...zs,flex:"none",borderColor:A===V?"var(--accent)":"var(--line-2)",color:A===V?"var(--accent)":"var(--text-2)"},children:V==="all"?"All":V==="image"?"Images":"Video"},V)),h.jsx("button",{type:"button",onClick:()=>F(V=>V+1),title:"Reload the gallery",style:{...zs,flex:"none"},children:h.jsx(tr,{size:11})}),h.jsxs("span",{style:{color:"var(--text-2)",fontSize:11,flex:"none"},children:[L," item",L===1?"":"s"," · ",kx(O)]})]}),h.jsx("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:j.length===0?h.jsxs("div",{style:{color:"var(--text-2)",textAlign:"center",paddingTop:40},children:[h.jsx(Xp,{size:20,style:{opacity:.5}}),h.jsx("div",{style:{marginTop:8},children:J?"Nothing matches that search.":"No images yet."})]}):h.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:10},children:j.map(V=>h.jsxs("button",{type:"button",onClick:()=>Z(V),title:V.prompt,style:{padding:0,border:(Y==null?void 0:Y.id)===V.id?"1px solid var(--accent)":"1px solid var(--line)",borderRadius:6,overflow:"hidden",background:"var(--bg-2)",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column"},children:[h.jsxs("div",{style:{position:"relative"},children:[h.jsx("img",{src:V.kind==="video"?`/media/${V.id}/thumb`:`/media/${V.id}/file`,alt:V.prompt,loading:"lazy",style:{width:"100%",aspectRatio:"1 / 1",objectFit:"cover",display:"block",background:"var(--bg-3)"}}),V.kind==="video"&&h.jsxs("span",{style:{position:"absolute",right:5,bottom:5,display:"inline-flex",alignItems:"center",gap:3,padding:"1px 5px",borderRadius:3,background:"rgba(0,0,0,0.62)",color:"#fff",fontSize:10},children:[h.jsx(qb,{size:10}),V.durationSec!==void 0?`${V.durationSec.toFixed(1)}s`:"video"]})]}),h.jsx("span",{style:{padding:"6px 7px",fontSize:11,color:"var(--text-1)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:V.prompt})]},V.id))})}),Y&&h.jsxs("div",{style:{flex:"none",borderTop:"1px solid var(--line)",padding:12,display:"flex",gap:12,maxHeight:220,background:"var(--bg-1)"},children:[Y.kind==="video"?h.jsxs("div",{style:{position:"relative",flex:"none"},children:[h.jsx("video",{controls:!0,preload:"metadata",poster:`/media/${Y.id}/thumb`,src:`/media/${Y.id}/file`,style:{maxHeight:196,maxWidth:320,borderRadius:4,border:"1px solid var(--line)",display:"block",background:"#000"}}),D&&h.jsxs("button",{type:"button","data-testid":"media-video-open-viewer",onClick:()=>D(Y.path),title:"Open in the file viewer","aria-label":"Open video in the file viewer",style:{position:"absolute",top:6,right:6,display:"inline-flex",alignItems:"center",gap:4,padding:"3px 7px",border:"1px solid rgba(255,255,255,0.25)",borderRadius:4,background:"rgba(0,0,0,0.62)",color:"#fff",fontSize:11,fontFamily:"inherit",cursor:"zoom-in"},children:[h.jsx(aS,{size:12})," open"]})]}):h.jsx("img",{src:`/media/${Y.id}/file`,alt:Y.prompt,onClick:()=>D==null?void 0:D(Y.path),title:D?"Open in the file viewer":Y.path,style:{maxHeight:196,maxWidth:260,objectFit:"contain",borderRadius:4,border:"1px solid var(--line)",flex:"none",cursor:D?"zoom-in":"default"}}),h.jsxs("div",{style:{minWidth:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:5},children:[h.jsx("div",{style:{color:"var(--text-0)",lineHeight:1.45},children:Y.prompt}),h.jsxs("div",{style:{color:"var(--text-2)",fontSize:11},children:[Y.modelId," · ",W6(Y.specs)]}),h.jsxs("div",{style:{color:"var(--text-2)",fontSize:11},children:[q6(Y.createdAt)," · ",kx(Y.bytes),Ex(Y.costUsd)?` · ${Ex(Y.costUsd)}`:"",Y.agent?` · by ${Y.agent}`:""]}),h.jsx(G6,{path:Y.path,testId:"media-copy-path"},`p-${Y.id}`),h.jsxs("div",{style:{display:"flex",gap:7,marginTop:3,flexWrap:"wrap"},children:[h.jsx("button",{type:"button",onClick:()=>Pe(Y),style:zs,children:"Use these settings"}),h.jsxs("a",{href:`/media/${Y.id}/file?download=1`,download:Y.filename,draggable:!1,style:{...zs,textDecoration:"none"},title:"Save this image",children:[h.jsx(F2,{size:11})," Download"]}),h.jsxs("button",{type:"button",onClick:()=>void nt(Y.id),style:zs,title:"Removes it from the gallery. The file on disk stays.",children:[h.jsx(nS,{size:11})," Remove from gallery"]})]})]})]})]})]})}function G6({path:e,prefix:t,dim:n,testId:r}){const a=x.useRef(null),[o,c]=x.useState(null);x.useEffect(()=>{if(o!=="copied")return;const p=setTimeout(()=>c(null),1500);return()=>clearTimeout(p)},[o]);const f=o==="copied"?"Copied":o==="selected"?"Select and copy":"Copy path";return h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:6,minWidth:0},children:[t&&h.jsx("span",{style:{fontSize:10.5,color:"var(--text-3)",flex:"none",lineHeight:1.4},children:t}),h.jsx("code",{ref:a,style:{fontSize:10.5,color:n?"var(--text-3)":"var(--text-2)",wordBreak:"break-all",lineHeight:1.4,userSelect:"text",cursor:"text",flex:1,minWidth:0},title:e,children:e}),h.jsxs("button",{type:"button","data-testid":r,onClick:()=>{$6(e,a.current).then(c)},style:{...zs,padding:"1px 6px",fontSize:10.5,flex:"none",color:o==="copied"?"var(--ok)":zs.color},title:o==="selected"?"Clipboard unavailable — the path is selected, press Ctrl+C":"Copy the absolute path","aria-label":`${f}: ${e}`,children:[o==="copied"?h.jsx(uc,{size:11}):h.jsx(qx,{size:11})," ",f]})]})}const ua={display:"flex",flexDirection:"column",gap:4,fontSize:11,color:"var(--text-2)"},xr={background:"var(--bg-2)",border:"1px solid var(--line)",borderRadius:5,color:"var(--text-0)",padding:"6px 8px",fontSize:12.5,outline:"none"},Gp={fontSize:10.5,color:"var(--text-3)",lineHeight:1.4},zs={background:"var(--bg-3)",border:"1px solid var(--line-2)",borderRadius:5,color:"var(--text-1)",padding:"4px 8px",fontSize:11,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,whiteSpace:"nowrap"};function Y6({note:e}){const t=V6(e.ts),n=X6(e.pinnedAt);return h.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--pin-note-bg, var(--bg-1))"},children:[h.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--line-2)",display:"flex",alignItems:"center",gap:8,flexShrink:0,fontSize:11,fontFamily:'"JetBrains Mono", monospace',color:"var(--text-2)"},children:[h.jsx("span",{style:{width:22,height:22,borderRadius:5,background:e.agentColor?`linear-gradient(135deg, ${e.agentColor}, ${e.agentColor}88)`:"var(--bg-3)",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:12},children:e.agentIcon??"🤖"}),h.jsx("span",{style:{color:"var(--text-0)",fontWeight:600},children:e.agentName}),h.jsx("span",{children:"·"}),h.jsx("span",{children:e.sessionLabel??e.sessionId}),h.jsx("span",{style:{marginLeft:"auto",color:"var(--text-3)"},title:t,children:t})]}),h.jsx("div",{style:{flex:1,overflowY:"auto",padding:"12px 14px",fontSize:13,lineHeight:1.5,userSelect:"text"},children:e.text?h.jsx(Um,{content:e.text}):h.jsx("span",{style:{color:"var(--text-3)"},children:"(empty message)"})}),h.jsx("div",{style:{padding:"6px 12px",borderTop:"1px solid var(--line-2)",flexShrink:0,fontSize:10,fontFamily:'"JetBrains Mono", monospace',color:"var(--text-3)",display:"flex",alignItems:"center",gap:6},children:h.jsxs("span",{children:["📌 pinned ",n]})})]})}function V6(e){if(!Number.isFinite(e))return"?";const t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),a=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0");if(r)return`${a}:${o}`;const c=String(t.getDate()).padStart(2,"0"),f=String(t.getMonth()+1).padStart(2,"0");return`${t.getFullYear()}-${f}-${c} ${a}:${o}`}function X6(e){if(!Number.isFinite(e))return"?";const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function Z6({path:e}){const[t,n]=x.useState({status:"loading"});return x.useEffect(()=>{let r=!1;n({status:"loading"});const a=`/files/view?path=${encodeURIComponent(e)}`;return fetch(a).then(async o=>{if(r)return;if(o.ok){const f=await o.json();n({status:"ok",data:f});return}let c=`HTTP ${o.status}`;try{const f=await o.json();f&&typeof f.error=="string"&&(c=f.error)}catch{}n({status:"error",message:c,httpStatus:o.status})}).catch(o=>{r||n({status:"error",message:`network error: ${String(o)}`,httpStatus:0})}),()=>{r=!0}},[e]),h.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--bg-1)"},children:[h.jsx(J6,{path:e,state:t}),h.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"12px 14px",fontSize:13,lineHeight:1.5,userSelect:"text"},children:[t.status==="loading"&&h.jsx("div",{style:{color:"var(--text-3)"},children:"loading…"}),t.status==="error"&&h.jsx(e8,{message:t.message,httpStatus:t.httpStatus}),t.status==="ok"&&h.jsx(Q6,{data:t.data})]})]})}function J6({path:e,state:t}){const n=t.status==="ok"?t8(t.data.bytes):null;return h.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--line-2)",display:"flex",alignItems:"center",gap:8,flexShrink:0,fontSize:11,fontFamily:'"JetBrains Mono", monospace',color:"var(--text-3)"},title:e,children:[h.jsx("span",{style:{color:"var(--text-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e}),t.status==="ok"&&t.data.mime&&h.jsx("span",{style:{flexShrink:0},children:t.data.mime}),n&&h.jsx("span",{style:{flexShrink:0},children:n}),t.status==="ok"&&t.data.truncated&&h.jsx("span",{style:{flexShrink:0,color:"var(--warn)"},title:t.data.truncated_reason,children:"truncated"}),t.status==="ok"&&t.data.downloadUrl&&h.jsx("a",{href:t.data.downloadUrl,download:!0,draggable:!1,style:{flexShrink:0,color:"var(--text-2)",textDecoration:"none",border:"1px solid var(--line-2)",borderRadius:4,padding:"1px 6px"},title:"Download this file",children:"download"})]})}function Q6({data:e}){if(e.kind==="image"&&e.url)return h.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",draggable:!1,style:{display:"block",lineHeight:0},title:"Open at full size",children:h.jsx("img",{src:e.url,alt:e.path,style:{maxWidth:"100%",height:"auto",borderRadius:4,display:"block"}})});if(e.kind==="video"&&e.url)return h.jsx("video",{controls:!0,preload:"metadata",src:e.url,style:{maxWidth:"100%",borderRadius:4,display:"block"}});if(e.kind==="audio"&&e.url)return h.jsx("audio",{controls:!0,preload:"metadata",src:e.url,style:{width:"100%"}});if(e.kind==="pdf"&&e.url)return h.jsx("iframe",{src:e.url,title:e.path,style:{width:"100%",height:"100%",minHeight:480,border:0,borderRadius:4}});if(e.kind==="binary"||e.content===void 0)return h.jsxs("div",{style:{color:"var(--text-2)",fontSize:12},children:[h.jsxs("div",{style:{marginBottom:6},children:["No preview for this file type",e.mime?` (${e.mime})`:"","."]}),e.downloadUrl&&h.jsxs("a",{href:e.downloadUrl,download:!0,draggable:!1,style:{color:"var(--accent)"},children:["Download ",e.path.slice(e.path.lastIndexOf("/")+1)]})]});if(e.kind==="markdown")return h.jsx(Um,{content:e.content});if(e.kind==="code"){const n=`\`\`\`${e.ext.replace(/^\./,"")}
|
|
629
|
+
${e.content}
|
|
630
|
+
\`\`\``;return h.jsx(Om,{remarkPlugins:[Bm],rehypePlugins:[Pm],children:n})}return h.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:'"JetBrains Mono", ui-monospace, monospace',fontSize:12,color:"var(--text-1)"},children:e.content})}function e8({message:e,httpStatus:t}){const n=x.useMemo(()=>t===403?"Access denied":t===404?"File not found":t===400?"Bad request":t===0?"Network error":`Error ${t}`,[t]);return h.jsxs("div",{children:[h.jsx("div",{style:{color:"var(--danger)",fontWeight:600,marginBottom:6},children:n}),h.jsx("div",{style:{color:"var(--text-2)",fontSize:12,fontFamily:'"JetBrains Mono", monospace'},children:e})]})}function t8(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} kB`:`${(e/1024/1024).toFixed(1)} MB`}const n8={rem:{},deep:{active:!1},lucid:{active:!1}};function i8(e=3e4){const[t,n]=x.useState(n8);return x.useEffect(()=>{let r=!1,a=null;const o=()=>{Me.dreamStates().then(c=>{r||n(c)}).catch(()=>{})};return o(),a=setInterval(o,e),()=>{r=!0,a&&clearInterval(a)}},[e]),t}function r8(){const[e,t]=x.useState({active:!1});return x.useEffect(()=>{let n=!1,r=null;const a=()=>{Me.loopState().then(o=>{n||t(o)}).catch(()=>{})};return a(),r=setInterval(a,2e3),()=>{n=!0,r&&clearInterval(r)}},[]),e}const Cx="somora-web-layout",Tx="somora-web-layout-saved",s8=120;function Yl(e,t){return!e||!t?!1:e===t?!0:e.endsWith(`_${t}`)||t.endsWith(`_${e}`)}function a8(e){const t=[];return e.filter(n=>n.kind!=="chat"?!0:t.some(r=>r.agentName===n.agentName&&Yl(r.sessionId,n.sessionId))?!1:(t.push(n),!0))}function o8(){const[e,t]=x.useState([]),[n,r]=x.useState(10),[a,o]=x.useState(null),[c,f]=x.useState(!1);x.useEffect(()=>{try{const I=localStorage.getItem(Cx);if(I){const E=JSON.parse(I);Array.isArray(E.windows)&&(t(a8(E.windows)),r(E.zCounter||10),o(E.focusedId??null))}}catch{}f(!0)},[]),x.useEffect(()=>{if(!c)return;const I=()=>t(Y=>rM(Y,ng()));I();let E=null;const F=()=>{E&&clearTimeout(E),E=setTimeout(I,s8)};return window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F),E&&clearTimeout(E)}},[c]),x.useEffect(()=>{if(!c)return;const I={windows:e,zCounter:n,focusedId:a};try{localStorage.setItem(Cx,JSON.stringify(I))}catch{}},[e,n,a,c]);const p=x.useCallback(I=>{r(E=>E+1),o(I),t(E=>E.map(F=>F.id===I?{...F,z:n+1,minimized:!1}:F))},[n]),d=x.useCallback(I=>{t(E=>E.filter(F=>F.id!==I)),o(E=>E===I?null:E)},[]),m=x.useCallback(I=>{t(E=>E.map(F=>F.id===I?{...F,minimized:!0}:F))},[]),_=x.useCallback((I,E,F)=>{t(Y=>Y.map(Z=>Z.id===I?{...Z,x:E,y:F}:Z))},[]),y=x.useCallback((I,E,F)=>{t(Y=>Y.map(Z=>Z.id===I?{...Z,w:E,h:F}:Z))},[]),b=x.useCallback((I,E)=>{const F=e.find(Z=>Z.id===I),Y=F&&F.kind==="chat"?e.find(Z=>Z.id!==I&&Z.kind==="chat"&&Z.agentName===F.agentName&&Yl(Z.sessionId,E)):void 0;if(Y){p(Y.id);return}t(Z=>{const ve=Z.find(Oe=>Oe.id===I);return!ve||ve.kind!=="chat"||Z.some(Oe=>Oe.id!==I&&Oe.kind==="chat"&&Oe.agentName===ve.agentName&&Yl(Oe.sessionId,E))?Z:Z.map(Oe=>Oe.id===I?{...Oe,sessionId:E}:Oe)})},[e,p]),w=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="sessions-list");if(I){p(I.id);return}const E=Gn(880,600,n+1),F=`sessions-list-${Date.now()}`,Y={id:F,kind:"sessions-list",title:"Sessions",icon:"🗂",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),S=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="sentinel");if(I){p(I.id);return}const E=Gn(820,520,n+1),F=`sentinel-${Date.now()}`,Y={id:F,kind:"sentinel",title:"Sentinel",icon:"🔔",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),C=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="wiki");if(I){p(I.id);return}const E=Gn(1180,700,n+1),F=`wiki-${Date.now()}`,Y={id:F,kind:"wiki",title:"Wiki",icon:"📚",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),k=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="tools");if(I){p(I.id);return}const E=Gn(940,640,n+1),F=`tools-${Date.now()}`,Y={id:F,kind:"tools",title:"Abilities",icon:"🧰",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),j=x.useCallback(I=>{const E=e.find(ve=>ve.kind==="agent-config"&&ve.agentName===I);if(E){p(E.id);return}const F=Gn(900,640,n+1),Y=`agent-config-${I}-${Date.now()}`,Z={id:Y,kind:"agent-config",title:I,meta:"configure",icon:"⚙️",agentName:I,...F,minimized:!1};t(ve=>[...ve,Z]),r(ve=>ve+1),o(Y)},[e,n,p]),R=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="team");if(I){p(I.id);return}const E=Gn(980,660,n+1),F=`team-${Date.now()}`,Y={id:F,kind:"team",title:"Team",icon:"👥",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),L=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="images");if(I){p(I.id);return}const E=Gn(1e3,680,n+1),F=`images-${Date.now()}`,Y={id:F,kind:"images",title:"Media",icon:"🖼",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),q=x.useCallback((I,E)=>{t(F=>F.map(Y=>Y.id===I?{...Y,wikiSlug:E}:Y))},[]),O=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="tmux-list");if(I){p(I.id);return}const E=Gn(520,460,n+1),F=`tmux-list-${Date.now()}`,Y={id:F,kind:"tmux-list",title:"tmux sessions",icon:"⌨",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),z=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="voice");if(I){p(I.id);return}const E=Gn(760,560,n+1),F=`voice-${Date.now()}`,Y={id:F,kind:"voice",title:"voice",icon:"🎙",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),J=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="logs");if(I){p(I.id);return}const E=Gn(900,560,n+1),F=`logs-${Date.now()}`,Y={id:F,kind:"logs",title:"server log",icon:"📜",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),ie=x.useCallback(()=>{const I=e.find(Z=>Z.kind==="browser-list");if(I){p(I.id);return}const E=Gn(560,420,n+1),F=`browser-list-${Date.now()}`,Y={id:F,kind:"browser-list",title:"browser sessions",icon:"🌐",...E,minimized:!1};t(Z=>[...Z,Y]),r(Z=>Z+1),o(F)},[e,n,p]),D=x.useCallback((I,E)=>{const F=e.find(Oe=>Oe.kind==="browser"&&Oe.browserViewId===I);if(F){p(F.id);return}const Y=Gn(1100,760,n+1),Z=`browser-${I}-${Date.now()}`,ve={id:Z,kind:"browser",title:E,meta:"browser",browserViewId:I,...Y,minimized:!1};t(Oe=>[...Oe,ve]),r(Oe=>Oe+1),o(Z)},[e,n,p]),A=x.useCallback(()=>{const I=Gn(720,520,n+1),E=`shell-term-${Date.now()}`,F={id:E,kind:"shell-term",title:"terminal",meta:"shell",...I,minimized:!1};t(Y=>[...Y,F]),r(Y=>Y+1),o(E)},[n]),M=x.useCallback(I=>{const E=e.find(ve=>ve.kind==="tmux-term"&&ve.tmuxName===I);if(E){p(E.id);return}const F=Gn(720,520,n+1),Y=`tmux-term-${I}-${Date.now()}`,Z={id:Y,kind:"tmux-term",title:I,meta:"tmux",tmuxName:I,...F,minimized:!1};t(ve=>[...ve,Z]),r(ve=>ve+1),o(Y)},[e,n,p]),P=x.useCallback(I=>{var ve,Oe;const E=e.find(_e=>_e.kind==="chat"&&_e.agentName===I.agentName&&Yl(_e.sessionId,I.sessionId));if(E){p(E.id);return}const F=Gn(((ve=I.size)==null?void 0:ve.w)??520,((Oe=I.size)==null?void 0:Oe.h)??460,n+1),Y=`chat-${I.agentName}-${I.sessionId}-${Date.now()}`,Z={id:Y,kind:"chat",agentName:I.agentName,sessionId:I.sessionId,title:I.agentLabel,...I.agentMeta?{meta:I.agentMeta}:{},...I.agentIcon?{icon:I.agentIcon}:{},...F,minimized:!1};t(_e=>_e.some(Fe=>Fe.kind==="chat"&&Fe.agentName===I.agentName&&Yl(Fe.sessionId,I.sessionId))?_e:[..._e,Z]),r(_e=>_e+1),o(Y)},[e,n,p]),G=x.useCallback(I=>{const E=e.find(ve=>{var Oe;return ve.kind==="pin-note"&&((Oe=ve.pinNote)==null?void 0:Oe.msgId)===I.msgId});if(E){p(E.id);return}const F=Gn(360,320,n+1),Y=`pin-note-${I.msgId}-${Date.now()}`,Z={id:Y,kind:"pin-note",title:`${I.agentName} note`,icon:"📌",pinNote:I,...F,minimized:!1};t(ve=>[...ve,Z]),r(ve=>ve+1),o(Y)},[e,n,p]),H=x.useCallback(I=>{const E=e.find(Oe=>Oe.kind==="file-view"&&Oe.filePath===I);if(E){p(E.id);return}const F=Gn(560,520,n+1),Y=`file-view-${Date.now()}`,Z=I.split("/").filter(Boolean).pop()??I,ve={id:Y,kind:"file-view",title:Z,meta:I,icon:"📄",filePath:I,...F,minimized:!1};t(Oe=>[...Oe,ve]),r(Oe=>Oe+1),o(Y)},[e,n,p]),N=x.useMemo(()=>new Set(e.filter(I=>I.kind==="pin-note"&&I.pinNote).map(I=>I.pinNote.msgId)),[e]),$=x.useCallback(I=>{const E=e.find(F=>{var Y;return F.kind==="pin-note"&&((Y=F.pinNote)==null?void 0:Y.msgId)===I});E&&(t(F=>F.filter(Y=>Y.id!==E.id)),o(F=>F===E.id?null:F))},[e]),K=x.useCallback(I=>{t(E=>{const F=E.filter(Y=>Y.kind!=="chat"||!Y.agentName||I.has(Y.agentName));return F.length===E.length?E:F})},[]),re=x.useCallback(()=>{t(I=>{const E=I.filter(_e=>!_e.minimized),F=E.length;if(F===0)return I;const Y={x:zu,y:zu,w:window.innerWidth-zu*2,h:window.innerHeight-mm-zu*2},Z=[...E].sort((_e,Fe)=>_e.x-Fe.x||_e.y-Fe.y),ve=iM(F,Y),Oe=new Map(Z.map((_e,Fe)=>[_e.id,ve[Fe]]));return I.map(_e=>{const Fe=Oe.get(_e.id);return Fe?{..._e,...Fe}:_e})})},[]),U=x.useCallback(()=>{const I={windows:e,zCounter:n,focusedId:a};try{localStorage.setItem(Tx,JSON.stringify(I))}catch{}},[e,n,a]),W=x.useCallback(()=>{try{const I=localStorage.getItem(Tx);if(!I)return!1;const E=JSON.parse(I);if(Array.isArray(E.windows))return t(E.windows),r(E.zCounter||10),o(E.focusedId??null),!0}catch{}return!1},[]);return{windows:e,focusedId:a,openChat:P,focus:p,close:d,minimize:m,move:_,resize:y,autoArrange:re,dropOrphanChats:K,saveLayout:U,restoreLayout:W,setWindowSession:b,openTmuxList:O,openTmuxTerm:M,openBrowserList:ie,openLogs:J,openVoice:z,openBrowser:D,openShellTerm:A,openSessionsList:w,openSentinelList:S,openWiki:C,openTools:k,openTeam:R,openAgentConfig:j,openImages:L,setWikiSlug:q,openPinNote:G,unpinMessage:$,pinnedMsgIds:N,openFileView:H}}function Gn(e,t,n){const a=window.innerWidth-e-40,o=window.innerHeight-t-mm-40,c=140+Math.floor(Math.random()*Math.max(1,a-140)),f=60+Math.floor(Math.random()*Math.max(1,o-60));return{x:c,y:f,w:e,h:t,z:n}}function Os(e,t){return`${e}::${t}`}function Mx(e){const t=e.indexOf("::");return{agent:e.slice(0,t),session:e.slice(t+2)}}function l8(e){return!e||!e.unreadAt?!1:e.seenAt?e.unreadAt>e.seenAt:!0}function c8(e){const[t,n]=x.useState(()=>new Set),[r,a]=x.useState({}),o=x.useRef(!1);x.useEffect(()=>{if(o.current||e.length===0)return;o.current=!0;let d=!1;return(async()=>{try{const m=await Me.globalSessions();if(d)return;const _={};for(const y of m)_[Os(y.agent,y.sessionId)]={unreadAt:y.unreadAt??null,seenAt:y.seenAt??null};a(y=>({..._,...y}))}catch{}})(),()=>{d=!0}},[e]),x.useEffect(()=>{const d=new EventSource("/activity/stream");return d.addEventListener("streaming",m=>{try{const _=JSON.parse(m.data);n(y=>{const b=new Set(y),w=Os(_.agent,_.session);return _.phase==="start"?b.add(w):b.delete(w),b})}catch{}}),d.addEventListener("turn",m=>{try{const _=JSON.parse(m.data);a(y=>({...y,[Os(_.agent,_.session)]:{...y[Os(_.agent,_.session)]??{seenAt:null,unreadAt:null},unreadAt:_.unreadAt}}))}catch{}}),d.addEventListener("seen",m=>{try{const _=JSON.parse(m.data);a(y=>({...y,[Os(_.agent,_.session)]:{...y[Os(_.agent,_.session)]??{seenAt:null,unreadAt:null},seenAt:_.seenAt}}))}catch{}}),()=>{d.close()}},[]);const c=x.useCallback((d,m)=>{const _=new Date().toISOString();a(y=>({...y,[Os(d,m)]:{...y[Os(d,m)]??{unreadAt:null,seenAt:null},seenAt:_}})),fetch(`/sessions/${encodeURIComponent(d)}/${encodeURIComponent(m)}/seen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}).catch(()=>{})},[]),f=x.useMemo(()=>{const d=new Set;for(const m of t)d.add(Mx(m).agent);return d},[t]),p=x.useMemo(()=>{const d=new Set;for(const[m,_]of Object.entries(r))l8(_)&&d.add(Mx(m).agent);return d},[r]);return x.useMemo(()=>({streamingAgents:f,unreadAgents:p,marks:r,postSeen:c}),[f,p,r,c])}function u8(){const[e,t]=x.useState(!1);return x.useEffect(()=>{let n=!1;return Me.wikiStatus().then(r=>{n||t(r.enabled)}).catch(()=>{}),()=>{n=!0}},[]),e}function h8(){const[e,t]=x.useState({images:!1,video:!1,any:!1});return x.useEffect(()=>{let n=!1;return Promise.allSettled([Me.imagesStatus(),Me.videoStatus()]).then(([r,a])=>{if(n)return;const o=r.status==="fulfilled"&&r.value.enabled===!0,c=a.status==="fulfilled"&&a.value.enabled===!0;t({images:o,video:c,any:o||c})}),()=>{n=!0}},[]),e}function d8(){const[e,t]=x.useState({enabled:!1,agents:[]});return x.useEffect(()=>{let n=!1;return fetch("/voice/status").then(r=>r.ok?r.json():{enabled:!1,agents:[]}).then(r=>{var a;n||t({enabled:!!r.enabled&&(((a=r.agents)==null?void 0:a.length)??0)>0,agents:r.agents??[]})}).catch(()=>{n||t({enabled:!1,agents:[]})}),()=>{n=!0}},[]),e}const lm=24e3;function f8(e){const t=new Int16Array(e.length);for(let a=0;a<e.length;a++){const o=Math.max(-1,Math.min(1,e[a]??0));t[a]=o<0?o*32768:o*32767}const n=new Uint8Array(t.buffer);let r="";for(let a=0;a<n.length;a++)r+=String.fromCharCode(n[a]??0);return btoa(r)}function p8(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=new Int16Array(n.buffer),a=new Float32Array(r.length);for(let o=0;o<r.length;o++)a[o]=(r[o]??0)/32768;return a}async function g8(e,t){const n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),r=new AudioContext({sampleRate:lm}),a=r.createMediaStreamSource(n),o=r.createAnalyser();o.fftSize=512;const c=new Float32Array(o.fftSize);a.connect(o);const f=r.createScriptProcessor(2048,1,1);let p=!1;f.onaudioprocess=m=>{const _=m.inputBuffer.getChannelData(0);e(f8(p?new Float32Array(_.length):_))},a.connect(f);const d=r.createGain();return d.gain.value=0,f.connect(d),d.connect(r.destination),{level:()=>{o.getFloatTimeDomainData(c);let m=0;for(const _ of c)m=Math.max(m,Math.abs(_));return m},setMuted:m=>{p=m},stop:()=>{f.onaudioprocess=null,f.disconnect(),a.disconnect();for(const m of n.getTracks())m.stop();r.close()}}}function m8(e){const t=new AudioContext({sampleRate:lm}),n=t.createAnalyser();n.fftSize=512,n.connect(t.destination);const r=new Float32Array(n.fftSize);let a=0,o=[];return{play:c=>{const f=p8(c);if(f.length===0)return;const p=t.createBuffer(1,f.length,lm);p.getChannelData(0).set(f);const d=t.createBufferSource();d.buffer=p,d.connect(n);const m=Math.max(t.currentTime,a);d.start(m),a=m+p.duration,o.push(d),d.onended=()=>{o=o.filter(_=>_!==d)}},pendingMs:()=>Math.max(0,(a-t.currentTime)*1e3),level:()=>{n.getFloatTimeDomainData(r);let c=0;for(const f of r)c=Math.max(c,Math.abs(f));return c},stop:()=>{for(const c of o)try{c.stop()}catch{}o=[],a=0},close:()=>{for(const c of o)try{c.stop()}catch{}o=[],t.close()}}}function Ax(){return{value:0,update(e){return this.value=e>this.value?this.value+(e-this.value)*.45:this.value+(e-this.value)*.07,this.value}}}function _8({color:e,speaker:t,active:n,muted:r=!1,micLevel:a,agentLevel:o}){const c=x.useRef(null),f=x.useRef(0),p=x.useRef(Ax()),d=x.useRef(Ax()),m=x.useRef(0);return x.useEffect(()=>{const _=c.current;if(!_)return;const y=_.getContext("2d");if(!y)return;const b=window.devicePixelRatio||1,w=(C,k,j,R,L,q,O,z,J,ie)=>{const D=j*(.1+R*.55);y.beginPath();const A=96;for(let M=0;M<=A;M++){const P=M/A*Math.PI*2,G=Math.sin(P*L+q)*.55+Math.sin(P*(L*2+1)-q*.6)*.25+Math.sin(P*(L+4)+q*1.7)*.12,H=j+D*G+D*R*.5,N=C+Math.cos(P)*H,$=k+Math.sin(P)*H;M===0?y.moveTo(N,$):y.lineTo(N,$)}y.closePath(),ie&&(y.globalAlpha=J*.6,y.fillStyle=ie,y.fill()),y.globalAlpha=J,y.strokeStyle=O,y.lineWidth=z,y.stroke()},S=()=>{const C=_.clientWidth,k=_.clientHeight;(_.width!==C*b||_.height!==k*b)&&(_.width=C*b,_.height=k*b),y.setTransform(b,0,0,b,0,0),y.clearRect(0,0,C,k);const j=p.current.update(n?Math.min(1,o()*2.4):0),R=d.current.update(n&&!r?Math.min(1,a()*2.4):0);m.current+=.02+j*.05+R*.03;const L=C/2,q=k/2,O=Math.min(C,k)*.3,z=y.createRadialGradient(L,q,O*.1,L,q,O*1.7);if(z.addColorStop(0,e),z.addColorStop(1,"transparent"),w(L,q,O,j,3,m.current,e,t==="agent"?2.4:1.4,n?.25+j*.65:.12,z),w(L,q,O*.62,R,7,-m.current*1.3,r?"var(--text-3, #666)":"rgba(255,255,255,0.75)",t==="you"?1.8:1,n?.2+R*.7:.1),n&&j<.02&&R<.02){const J=(Math.sin(m.current*2)+1)/2;w(L,q,O*.3,J*.15,2,m.current*.5,e,1,.25)}y.globalAlpha=1,f.current=requestAnimationFrame(S)};return f.current=requestAnimationFrame(S),()=>cancelAnimationFrame(f.current)},[e,t,n,r,a,o]),h.jsx("canvas",{"data-testid":"voice-orb",ref:c,style:{width:"100%",height:"100%",display:"block"},"aria-label":n?`${t} speaking`:"idle"})}function v8({agents:e}){var ve,Oe;const[t,n]=x.useState(null),[r,a]=x.useState(""),[o,c]=x.useState("main"),[f,p]=x.useState([]),[d,m]=x.useState("idle"),[_,y]=x.useState(null),[b,w]=x.useState(!1),[S,C]=x.useState([]),[k,j]=x.useState(null),[R,L]=x.useState(0),[q,O]=x.useState(null),[z,J]=x.useState(0),ie=x.useRef(null),D=x.useRef(null),A=x.useRef(null),M=x.useRef(null),P=x.useRef({agent:"",session:"main"}),G=x.useRef(null),[H,N]=x.useState(null);x.useEffect(()=>{let _e=!1;return fetch("/voice/status").then(Fe=>Fe.ok?Fe.json():{enabled:!1,agents:[]}).then(Fe=>{_e||(n(Fe),Fe.agents.length>0&&a(st=>st||(Fe.agents[0]??"")))}).catch(()=>{_e||n({enabled:!1,agents:[]})}),()=>{_e=!0}},[]),x.useEffect(()=>{if(!r)return;let _e=!1;return Me.sessions(r).then(Fe=>{if(_e)return;const st=Fe.map(ae=>({id:ae.id,slug:ae.slug||ae.id}));p(st),c(ae=>{var pe;return st.some(Xe=>Xe.slug===ae)?ae:((pe=st[0])==null?void 0:pe.slug)??"main"})}).catch(()=>{_e||p([])}),()=>{_e=!0}},[r]);const $=x.useCallback(_e=>{var Fe,st,ae,pe;(Fe=D.current)==null||Fe.send(JSON.stringify({type:"hangup",reason:_e})),(st=D.current)==null||st.close(),D.current=null,(ae=A.current)==null||ae.stop(),A.current=null,(pe=M.current)==null||pe.close(),M.current=null,m("closed"),O(null)},[]);x.useEffect(()=>()=>{D.current&&$("window closed")},[$]),x.useEffect(()=>{P.current={agent:r,session:o}},[r,o]),x.useEffect(()=>{const _e=ie.current;if(!_e)return;_e.scrollHeight-_e.scrollTop-_e.clientHeight<80&&(_e.scrollTop=_e.scrollHeight)},[S,k]),x.useEffect(()=>{if(q===null)return;const _e=setInterval(()=>J(Math.floor((Date.now()-q)/1e3)),1e3);return()=>clearInterval(_e)},[q]);const K=x.useCallback(_e=>{const Fe=P.current;if(_e.agent===Fe.agent&&_e.session===Fe.session){G.current=null;return}G.current=_e;const st=()=>{var Xe;const ae=G.current;if(!ae)return;const pe=((Xe=M.current)==null?void 0:Xe.pendingMs())??0;if(pe>120){window.setTimeout(st,Math.min(pe,400));return}G.current=null,P.current=ae,a(ae.agent),c(ae.session)};st()},[]),re=x.useCallback(async()=>{var _e,Fe,st;y(null),C([]),j(null),L(0),m("connecting"),O(Date.now()),J(0);try{const ae=m8();M.current=ae;const pe=window.location.protocol==="https:"?"wss":"ws",Xe=new WebSocket(`${pe}://${window.location.host}/voice/attach?agent=${encodeURIComponent(r)}&session=${encodeURIComponent(o)}`);D.current=Xe,Xe.onmessage=nt=>{var V,ce,X;let Pe;try{Pe=JSON.parse(String(nt.data))}catch{return}if(Pe.type==="audio"&&Pe.base64){(V=M.current)==null||V.play(Pe.base64);return}if(Pe.type==="ready"){m("listening");return}if(Pe.type==="state"&&((ce=Pe.call)!=null&&ce.state)){m(Pe.call.state),typeof Pe.call.consults=="number"&&L(Pe.call.consults),N(Pe.call.handoverTo??null);const fe=Pe.call.target;fe!=null&&fe.agent&&(fe!=null&&fe.slug)&&K({agent:fe.agent,session:fe.slug});return}Pe.call&&typeof Pe.call.consults=="number"&&L(Pe.call.consults);const at=Pe.event;if(at)switch(at.kind){case"model_speech":m(fe=>fe==="consulting"?fe:"speaking");break;case"user_transcript":at.final&&at.text?(j(null),C(fe=>[...fe,{who:"you",text:at.text}])):at.text&&j({who:"you",text:at.text});break;case"model_transcript":at.final&&at.text?(j(null),C(fe=>[...fe,{who:"agent",text:at.text}])):at.text&&j(fe=>({who:"agent",text:(fe==null?void 0:fe.who)==="agent"?fe.text+at.text:at.text}));break;case"tool_call":m("consulting");break;case"interrupted":(X=M.current)==null||X.stop(),m("listening");break;case"error":y(at.message??"provider error");break;case"closed":m("closed");break;default:break}},Xe.onerror=()=>y("connection failed"),Xe.onclose=nt=>{var Pe;m("closed"),nt.reason&&nt.code!==1e3&&y(nt.reason),(Pe=A.current)==null||Pe.stop(),A.current=null},await new Promise((nt,Pe)=>{Xe.onopen=()=>nt(),setTimeout(()=>Pe(new Error("timed out")),1e4)}),A.current=await g8(nt=>{Xe.readyState===WebSocket.OPEN&&Xe.send(JSON.stringify({type:"audio",base64:nt}))})}catch(ae){y(ae.message),m("idle"),(_e=A.current)==null||_e.stop(),A.current=null,(Fe=M.current)==null||Fe.close(),M.current=null,(st=D.current)==null||st.close(),D.current=null}},[r,o]),U=x.useCallback(()=>{w(_e=>{var Fe;return(Fe=A.current)==null||Fe.setMuted(!_e),!_e})},[]),W=((ve=e.find(_e=>_e.name===r))==null?void 0:ve.color)??"var(--accent, #6cf)",I=d==="listening"||d==="speaking"||d==="consulting",E=((t==null?void 0:t.maxCallMinutes)??20)*60,F=z>E*.75,Y=z>E*.92,Z=`${Math.floor(z/60)}:${String(z%60).padStart(2,"0")}`;return t&&!t.enabled?h.jsxs("div",{style:{padding:16,color:"var(--text-2)"},children:["Realtime voice is off. Set ",h.jsx("code",{children:"realtimeVoice.enabled"})," in ",h.jsx("code",{children:"config.yaml"}),"."]}):h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",padding:12,gap:10},children:[I?h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[h.jsx("span",{style:{fontSize:18},children:((Oe=e.find(_e=>_e.name===r))==null?void 0:Oe.icon)??"🎙"}),h.jsx("span",{style:{color:W,fontWeight:600},children:r}),h.jsx("span",{style:{color:"var(--text-3)"},children:"·"}),h.jsx("span",{style:{color:"var(--text-2)"},children:o}),h.jsx("span",{"data-testid":"voice-clock",style:{marginLeft:"auto",fontFamily:'"JetBrains Mono", monospace',color:Y?"var(--danger, #e5534b)":F?"var(--warn, #d29922)":"var(--text-3)"},title:`${(t==null?void 0:t.maxCallMinutes)??20} minute limit — the meter runs while nobody speaks`,children:Z})]}):h.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[h.jsx("select",{"data-testid":"voice-agent",value:r,onChange:_e=>a(_e.target.value),style:{background:"var(--bg-2)",color:"var(--text-1)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"4px 6px"},children:((t==null?void 0:t.agents)??[]).map(_e=>h.jsx("option",{value:_e,children:_e},_e))}),h.jsx("select",{"data-testid":"voice-session",value:o,onChange:_e=>c(_e.target.value),style:{background:"var(--bg-2)",color:"var(--text-1)",border:"1px solid var(--bg-3)",borderRadius:6,padding:"4px 6px",flex:1},children:f.map(_e=>h.jsx("option",{value:_e.slug,children:_e.slug},_e.id))})]}),h.jsxs("div",{style:{flex:"0 0 46%",minHeight:150,position:"relative"},children:[h.jsx(_8,{color:W,speaker:d==="speaking"?"agent":"you",active:I,muted:b,micLevel:()=>{var _e;return((_e=A.current)==null?void 0:_e.level())??0},agentLevel:()=>{var _e;return((_e=M.current)==null?void 0:_e.level())??0}}),b&&h.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--warn, #d29922)",pointerEvents:"none"},children:h.jsx(Gb,{size:26})})]}),h.jsxs("div",{"data-testid":"voice-state",style:{textAlign:"center",color:"var(--text-2)",fontSize:12,minHeight:18},children:[H&&d!=="closed"?`putting you through to ${H}…`:h.jsxs(h.Fragment,{children:[d==="idle"&&"ready to talk",d==="connecting"&&"connecting…",d==="listening"&&"listening",d==="consulting"&&"looking it up…",d==="speaking"&&`${r} is talking`,d==="closed"&&"ended"]}),R>0&&h.jsxs("span",{style:{opacity:.6},title:`${r} looked something up ${R} time(s) during this call`,children:[" · ",R===1?"looked up once":`looked up ${R}×`]})]}),_&&h.jsx("div",{"data-testid":"voice-error",style:{color:"var(--danger, #e5534b)",fontSize:12,textAlign:"center"},children:_}),h.jsx("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:I?h.jsxs(h.Fragment,{children:[h.jsx("button",{"data-testid":"voice-mute",type:"button",onClick:U,style:{background:"transparent",color:b?"var(--warn, #d29922)":"var(--text-2)",border:"1px solid var(--bg-3)",borderRadius:20,padding:"8px 14px",cursor:"pointer"},children:b?h.jsx(Gb,{size:14}):h.jsx(Dh,{size:14})}),h.jsxs("button",{"data-testid":"voice-hangup",type:"button",onClick:()=>$("user hung up"),style:{background:"var(--danger, #e5534b)",color:"#fff",border:"none",borderRadius:20,padding:"8px 18px",display:"inline-flex",gap:6,alignItems:"center",cursor:"pointer"},children:[h.jsx(oT,{size:14})," end"]})]}):h.jsxs("button",{"data-testid":"voice-connect",type:"button",onClick:()=>void re(),disabled:!r||d==="connecting",style:{background:W,color:"#000",border:"none",borderRadius:20,padding:"8px 18px",display:"inline-flex",gap:6,alignItems:"center",cursor:"pointer"},children:[h.jsx(lT,{size:14})," talk"]})}),h.jsx("div",{"data-testid":"voice-transcript",ref:ie,className:"voice-transcript",style:{flex:"1 1 0",minHeight:0,overflowY:"auto",fontSize:12,display:"flex",flexDirection:"column",gap:6,paddingRight:2},children:[...S,...k&&k.text.trim()?[k]:[]].map((_e,Fe)=>h.jsx("div",{style:{alignSelf:_e.who==="you"?"flex-end":"flex-start",maxWidth:"85%",padding:"4px 8px",borderRadius:8,lineHeight:1.45,overflowWrap:"anywhere",background:_e.who==="you"?"var(--bg-3)":`color-mix(in srgb, ${W} 14%, transparent)`,color:_e.who==="you"?"var(--text-2)":"var(--text-1)",opacity:_e===k?.65:1,borderLeft:_e.who==="you"?void 0:`2px solid ${W}`},children:_e.text},Fe))})]})}function y8(){const{agents:e,loading:t,error:n}=lS(),r=r8(),a=i8(),o=o8(),c=k2(),f=u8(),p=h8(),d=d8(),m=Nh(),_=m.enabled,y=m.browsers.filter(A=>A.handoff),{dropOrphanChats:b}=o;x.useEffect(()=>{t||n||b(new Set(e.map(A=>A.name)))},[e,t,n,b]);const w=c8(e),S=x.useMemo(()=>{const A=c.map(P=>P.split("::")[0]),M=new Set(A);for(const P of w.streamingAgents)M.add(P);return M},[c,w.streamingAgents]),C={w:960,h:620};function k(A,M,P){o.openChat({agentName:A.name,sessionId:M,agentLabel:`${A.name} · ${P}`,...A.role?{agentMeta:A.role.toLowerCase()}:{},...A.icon?{agentIcon:A.icon}:{},...A.kind==="builder"?{size:C}:{}})}function j(A){k(A,"main","main")}const[R,L]=x.useState(null);function q(A,M){M.preventDefault(),M.stopPropagation(),L({agent:A,x:M.clientX,y:M.clientY})}const O=new Set(o.windows.filter(A=>A.kind==="chat"&&A.agentName).map(A=>A.agentName)),z=new Set(o.windows.flatMap(A=>A.kind==="tmux-list"?["tmux"]:A.kind==="browser-list"||A.kind==="browser"?["browser"]:A.kind==="sessions-list"?["sessions"]:A.kind==="sentinel"?["sentinel"]:A.kind==="wiki"?["wiki"]:A.kind==="tools"?["tools"]:A.kind==="images"?["images"]:A.kind==="team"?["team"]:[])),J=(a==null?void 0:a.lucid.pendingFindings)??0,ie=a==null?void 0:a.lucid.oldestPendingAt,D=[...e.map(A=>({id:`agent:${A.name}`,node:h.jsx(BT,{agent:A,onClick:j,onContextMenu:q,offline:!!n,streaming:S.has(A.name),unread:w.unreadAgents.has(A.name),loopHolder:r.active?r.agent:null,active:O.has(A.name),...a?{dreamStates:a}:{}})})),{id:"app:tmux",node:h.jsx(ar,{label:"tmux",icon:h.jsx(tS,{size:28}),active:z.has("tmux"),onClick:()=>o.openTmuxList()})},{id:"app:terminal",node:h.jsx(ar,{label:"terminal",icon:h.jsx(Eo,{size:26,strokeWidth:1.5}),active:!1,onClick:()=>o.openShellTerm()})},{id:"app:sessions",node:h.jsx(ar,{label:"sessions",icon:h.jsx(nT,{size:26}),active:z.has("sessions"),onClick:()=>o.openSessionsList()})},{id:"app:sentinel",node:h.jsx(ar,{label:"sentinel",icon:h.jsx(um,{size:26}),active:z.has("sentinel"),onClick:()=>o.openSentinelList()})},{id:"app:tools",node:h.jsx(ar,{label:"abilities",icon:h.jsx(sS,{size:26}),active:z.has("tools"),onClick:()=>o.openTools()})},{id:"app:team",node:h.jsx(ar,{label:"team",icon:h.jsx(yT,{size:26}),active:z.has("team"),onClick:()=>o.openTeam()})},{id:"app:logs",node:h.jsx(ar,{label:"log",icon:h.jsx(pT,{size:26}),active:z.has("logs"),onClick:()=>o.openLogs()})},...d.enabled?[{id:"app:voice",node:h.jsx(ar,{label:"voice",icon:h.jsx(Dh,{size:26}),active:z.has("voice"),onClick:()=>o.openVoice()})}]:[],..._?[{id:"app:browser",node:h.jsx(ar,{label:"browser",icon:h.jsx(Oh,{size:26,color:y.length?"var(--warn, #d29922)":void 0}),active:z.has("browser"),onClick:()=>o.openBrowserList()})}]:[],...p.any?[{id:"app:images",node:h.jsx(ar,{label:"media",icon:h.jsx(X2,{size:26}),active:z.has("images"),onClick:()=>o.openImages()})}]:[],...f?[{id:"app:wiki",node:h.jsx(ar,{label:"wiki",icon:h.jsx(B2,{size:26}),active:z.has("wiki"),onClick:()=>o.openWiki(),...J>0?{badge:h.jsx("span",{className:"rem-badge lucid",title:`${J} lucid finding${J===1?"":"s"} awaiting review${ie?` (oldest run from ${ie.slice(0,10)})`:""} — review with any agent via dream_review`,children:J>9?"9+":J})}:{}})}]:[]];return h.jsx(hM,{value:w,children:h.jsx(Sz,{open:o.openFileView,children:h.jsxs("div",{className:"desktop",children:[h.jsxs("div",{className:"desktop-area",children:[h.jsx(NT,{icons:D,loading:t,error:n}),o.windows.map(A=>{if(A.kind==="chat"){const M=e.find(G=>G.name===A.agentName);if(!M)return null;const P=tc(M);return h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,agentColor:P,children:h.jsx(V4,{agent:M,sessionId:A.sessionId??"main",windowFocused:o.focusedId===A.id,onSwitchSession:G=>o.setWindowSession(A.id,G),pinnedMsgIds:o.pinnedMsgIds,onPin:o.openPinNote,onUnpin:o.unpinMessage,onOpenBrowser:o.openBrowser,onOpenSession:(G,H)=>{const N=e.find($=>$.name===G);N&&k(N,H,H==="main"?"main":H)}})},A.id)}return A.kind==="pin-note"&&A.pinNote?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(Y6,{note:A.pinNote})},A.id):A.kind==="file-view"&&A.filePath?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(Z6,{path:A.filePath})},A.id):A.kind==="tmux-list"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(X4,{onAttach:M=>o.openTmuxTerm(M)})},A.id):A.kind==="voice"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(v8,{agents:e})},A.id):A.kind==="logs"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(S5,{})},A.id):A.kind==="browser-list"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(p5,{onOpen:(M,P)=>o.openBrowser(M,P)})},A.id):A.kind==="browser"&&A.browserViewId?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(E5,{viewId:A.browserViewId})},A.id):A.kind==="tmux-term"&&A.tmuxName?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(f5,{tmuxName:A.tmuxName})},A.id):A.kind==="shell-term"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(C5,{})},A.id):A.kind==="sessions-list"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(M5,{onOpenChat:({agent:M,sessionId:P,agentLabel:G})=>{const H=e.find(N=>N.name===M);o.openChat({agentName:M,sessionId:P,agentLabel:G,...H!=null&&H.role?{agentMeta:H.role.toLowerCase()}:{},...H!=null&&H.icon?{agentIcon:H.icon}:{},...(H==null?void 0:H.kind)==="builder"?{size:C}:{}})}})},A.id):A.kind==="sentinel"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(z5,{})},A.id):A.kind==="wiki"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(L6,{slug:A.wikiSlug,onSlugChange:M=>o.setWikiSlug(A.id,M)})},A.id):A.kind==="images"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(K6,{})},A.id):A.kind==="tools"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(j6,{})},A.id):A.kind==="team"?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(U6,{})},A.id):A.kind==="agent-config"&&A.agentName?h.jsx(Kn,{win:A,focused:o.focusedId===A.id,onFocus:o.focus,onClose:o.close,onMinimize:o.minimize,onMove:o.move,onResize:o.resize,children:h.jsx(H6,{agentName:A.agentName})},A.id):null})]}),R&&h.jsx(HT,{agent:R.agent,x:R.x,y:R.y,onClose:()=>L(null),onOpenSession:k,onOpenSessionsTool:()=>o.openSessionsList(),onOpenConfig:A=>o.openAgentConfig(A.name)}),h.jsx(XT,{onOpenBrowsers:o.openBrowserList,windows:o.windows,focusedId:o.focusedId,agents:e,onFocus:o.focus,onAutoArrange:o.autoArrange,onSaveLayout:o.saveLayout,onRestoreLayout:o.restoreLayout})]})})})}function b8(){x.useEffect(()=>{const e=t=>{var c;if(t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const n=(c=window.getSelection)==null?void 0:c.call(window);if(n&&n.toString().length>0)return;const r=t.target;if(!r||typeof r.closest!="function")return;const a=r.closest("a");if(!a||a.getAttribute("target")!=="_blank")return;const o=a.getAttribute("href");o&&/^https?:\/\//i.test(o)&&(t.preventDefault(),t.stopPropagation(),window.open(o,"_blank","noopener,noreferrer"))};return document.addEventListener("mouseup",e,{capture:!0}),()=>document.removeEventListener("mouseup",e,{capture:!0})},[])}function x8(){return b8(),h.jsx(E2,{children:h.jsx(T2,{children:h.jsx(y8,{})})})}const eE=document.getElementById("root");if(!eE)throw new Error("somora-web: #root not found in index.html");f2.createRoot(eE).render(h.jsx(a2.StrictMode,{children:h.jsx(x8,{})}));
|
|
631
|
+
//# sourceMappingURL=index-BaVv6pB2.js.map
|